filters

config.h

00001 /*
00002 ** Header file for inclusion with kword_xml2latex.c
00003 **
00004 ** Copyright (C) 2002 - 2003 Robert JACOLIN
00005 **
00006 ** This library is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU Library General Public
00008 ** License as published by the Free Software Foundation; either
00009 ** version 2 of the License, or (at your option) any later version.
00010 **
00011 ** This library is distributed in the hope that it will be useful,
00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 ** Library General Public License for more details.
00015 **
00016 ** To receive a copy of the GNU Library General Public License, write to the
00017 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 **
00020 */
00021 
00022 #ifndef __LATEX_CONFIG_H__
00023 #define __LATEX_CONFIG_H__
00024 
00025 #include <qtextstream.h>
00026 #include <qstringlist.h>
00027 
00028 /***********************************************************************/
00029 /* Class: Config                                                       */
00030 /***********************************************************************/
00031 
00037 class Config
00038 {
00039     /* Document tab */
00040     bool _useLatexStyle;
00041     bool _isEmbeded;
00042     QString _class;
00043     QString _quality;
00044     unsigned int _defaultFontSize;
00045     
00046     /* Pictures tab */
00047     bool _convertPictures;
00048     QString _picturesDir;
00049 
00050     /* Language tab */
00051     //bool _useUnicode;
00052     //bool _useLatin1;
00053     QString _encoding;
00054     QStringList _languagesList;
00055     QString _defaultLanguage;
00056 
00057     int _tabSize;   /* Size of the para indentation. */
00058     int _tabulation;    /* Total size  of the indentation. */
00059 
00060     public:
00061 
00062         static const char SPACE_CHAR;
00063         
00064         static Config* instance(void);
00065         
00066         Config(const Config&);
00067 
00068         /* 
00069          * Destructor
00070          */
00071         virtual ~Config();
00072 
00073         /* ==== Getters ==== */
00074 
00078         bool isKwordStyleUsed() const { return (_useLatexStyle == false); }
00079         bool isEmbeded() const { return _isEmbeded; }
00080         QString getClass() const { return _class; }
00081         QString getQuality() const { return _quality; }
00082         unsigned int getDefaultFontSize() const { return _defaultFontSize; }
00083 
00084         bool convertPictures() const { return _convertPictures; }
00085         QString getPicturesDir() const { return _picturesDir; }
00086         
00087         bool mustUseUnicode() const { return (_encoding == "unicode"); }
00088         bool mustUseLatin1() const { return (_encoding != "unicode"); }
00089         QString getEncoding() const { return _encoding; }
00090         QStringList getLanguagesList() const { return _languagesList; }
00091         QString getDefaultLanguage() const { return _defaultLanguage; }
00092         
00093         int getTabSize() const { return _tabSize; }
00094         int getIndentation() const { return _tabulation; }
00095 
00096         /* ==== Setters ==== */
00097 
00102         void setTabSize(int size)
00103         {
00104             if(size >= 0)
00105                 _tabSize = size;
00106         }
00107         
00108         void useLatexStyle() { _useLatexStyle = true;  }
00109         void useKwordStyle() { _useLatexStyle = false; }
00110         void setEmbeded(bool emb) { _isEmbeded = emb; }
00113         void setClass(const QString &lclass) { _class = lclass; }
00114         void setQuality(const QString &quality) { _quality = quality; }
00115         void setDefaultFontSize(int size) { _defaultFontSize = size; }
00116 
00117         void convertPictures(bool state) { _convertPictures = state; }
00118         void setPicturesDir(const QString &dir) { _picturesDir = dir; }
00119 
00120         void setEncoding(const QString &enc) { _encoding = enc; }
00121         void addLanguage(const QString &l) { _languagesList.append(l); }
00122         void setDefaultLanguage(const QString &l) { _defaultLanguage = l; }
00123         
00124         void setIndentation(int indent) { _tabulation = indent; }
00125         
00126         /* ==== Helpfull functions ==== */
00127         void indent();
00128         void desindent();
00129 
00130         void writeIndent(QTextStream& out);
00131 
00132     protected:
00139         Config(); /* Ensure singleton */
00140 
00141         static Config* _instance; /* Singleton */
00142 
00143     private:
00144 
00145 };
00146 
00147 #endif /* __LATEX_CONFIG_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys