filters

config.cc

00001 /*
00002 ** A program to convert the XML rendered by KWord into LATEX.
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 #include <kdebug.h>     /* for kdDebug() stream */
00023 #include "config.h"
00024 
00025 /* Static variable */
00026 const char Config::SPACE_CHAR = ' ';
00027 Config* Config::_instance = 0;
00028 
00029 /*******************************************/
00030 /* Constructor                             */
00031 /*******************************************/
00032 Config::Config()
00033 {
00034     _tabSize = 4;
00035     _tabulation = 0;
00036     _useLatexStyle = true;
00037     _isEmbeded = false;
00038     _convertPictures = false;
00039 }
00040 
00041 Config::Config(const Config &config)
00042 {
00043     setTabSize(config.getTabSize());
00044     setIndentation(config.getIndentation());
00045     setClass(config.getClass());
00046     setEmbeded(config.isEmbeded());
00047 
00048     setEncoding(config.getEncoding());
00049     if(config.isKwordStyleUsed())   useKwordStyle();
00050 }
00051 
00052 /*******************************************/
00053 /* Destructor                              */
00054 /*******************************************/
00055 Config::~Config()
00056 {
00057 }
00058 
00059 void Config::indent()
00060 {
00061     kdDebug(30522) << "Indent tab = " << (_tabulation + getTabSize()) << endl;
00062     _tabulation = _tabulation + getTabSize();
00063 }
00064 
00065 void Config::desindent()
00066 {
00067     if ((_tabulation - getTabSize()) > 0)
00068     {
00069         kdDebug(30522) << "Desindent tab = " << (_tabulation - getTabSize()) << endl;
00070         _tabulation = _tabulation - getTabSize();
00071     }
00072     else
00073     {
00074         kdDebug(30522) << "Desindent tab = 0" << endl;
00075         _tabulation = 0;
00076     }
00077 }
00078 
00079 void Config::writeIndent(QTextStream& out)
00080 {
00081     for(int index = 0; index < _tabulation; index++)
00082     {
00083         out << " ";
00084     }
00085 }
00086 
00087 Config* Config::instance()
00088 {
00089     if(_instance == 0)
00090         _instance = new Config();
00091     return _instance;
00092 }
KDE Home | KDE Accessibility Home | Description of Access Keys