kword/latex/export/config.cpp
1/*
2** A program to convert the XML rendered by KWord into LATEX.
3**
4** Copyright (C) 2002-2003 Robert JACOLIN
5**
6** This library is free software; you can redistribute it and/or
7** modify it under the terms of the GNU Library General Public
8** License as published by the Free Software Foundation; either
9** version 2 of the License, or (at your option) any later version.
10**
11** This library is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14** Library General Public License for more details.
15**
16** To receive a copy of the GNU Library General Public License, write to the
17** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19**
20*/
21
22#include <kdebug.h> /* for kdDebug() stream */
23#include "config.h"
24
25/* Static variable */
26const char Config::SPACE_CHAR = ' ';
27Config* Config::_instance = 0;
28
29/*******************************************/
30/* Constructor */
31/*******************************************/
33{
34 _tabSize = 4;
35 _tabulation = 0;
36 _useLatexStyle = true;
37 _isEmbeded = false;
38 _convertPictures = false;
39}
40
41Config::Config(const Config &config)
42{
43 setTabSize(config.getTabSize());
44 setIndentation(config.getIndentation());
45 setClass(config.getClass());
46 setEmbeded(config.isEmbeded());
47
48 setEncoding(config.getEncoding());
49 if(config.isKwordStyleUsed()) useKwordStyle();
50}
51
52/*******************************************/
53/* Destructor */
54/*******************************************/
55Config::~Config()
56{
57}
58
59void Config::indent()
60{
61 kdDebug(30522) << "Indent tab = " << (_tabulation + getTabSize()) << endl;
62 _tabulation = _tabulation + getTabSize();
63}
64
65void Config::desindent()
66{
67 if ((_tabulation - getTabSize()) > 0)
68 {
69 kdDebug(30522) << "Desindent tab = " << (_tabulation - getTabSize()) << endl;
70 _tabulation = _tabulation - getTabSize();
71 }
72 else
73 {
74 kdDebug(30522) << "Desindent tab = 0" << endl;
75 _tabulation = 0;
76 }
77}
78
79void Config::writeIndent(TQTextStream& out)
80{
81 for(int index = 0; index < _tabulation; index++)
82 {
83 out << " ";
84 }
85}
86
87Config* Config::instance()
88{
89 if(_instance == 0)
90 _instance = new Config();
91 return _instance;
92}
This class hold all parameters and configuration from a file or from the filter configuration dialog ...
void setTabSize(int size)
Initialise the tab size.
bool isKwordStyleUsed() const
Return the value of a tabulation.
Config()
Constructors.
void setClass(const TQString &lclass)
The class can be article, book, letter, report or slides.