kword/latex/export/fileheader.h
1/*
2** Header file for inclusion with kword_xml2latex.c
3**
4** Copyright (C) 2000, 2002 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#ifndef __KWORD_FILEHEADER_H__
23#define __KWORD_FILEHEADER_H__
24
25#include <tqtextstream.h>
26
27#include "xmlparser.h"
28
29/***********************************************************************/
30/* Class: FileHeader */
31/***********************************************************************/
32
39class FileHeader: public XmlParser
40{
41 public:
42 enum TFormat { TF_A3, TF_A4, TF_A5, TF_USLETTER, TF_USLEGAL, TF_SCREEN,
43 TF_CUSTOM, TF_B3, TF_USEXECUTIVE };
44 enum TUnit { TU_MM, TU_CM, TU_PT, TU_INCH };
45 enum TOrient { TO_PORTRAIT, TO_LANDSCAPE };
46 enum TColonne { TC_NONE, TC_1, TC_2, TC_MORE };
47 enum THeadfoot { TH_ALL = 0, TH_XXX = 1, TH_FIRST = 2, TH_EVODD = 3 };
48 enum TProcType { TP_NORMAL, TP_DTP };
49
50 static FileHeader* instance(void);
51
52 private:
53 /* PAPER */
54 TFormat _format;
55 double _width,
56 _height;
57 TOrient _orientation;
58 TColonne _colonne;
59 double _columnSpacing;
60 THeadfoot _headType;
61 THeadfoot _footType;
62 TProcType _processing;
63 int _standardPage;
64 double _footBody;
65 double _headBody;
66
67 /* PAPERBORDERS */
68 double _leftBorder,
69 _rightBorder,
70 _bottomBorder,
71 _topBorder;
72
73 /* ATTRIBUTES */
74 TUnit _unite;
75 bool _hasHeader;
76 bool _hasFooter;
77 bool _hasTOC;
78
79 /* FOOTNOTEMGR */
80
81 /* DIVERSE */
82 /* for special packages to include */
83 bool _hasColor;
84 bool _hasUnderline;
85 bool _hasEnumerate;
86 bool _hasGraphics;
87 bool _hasTable;
88
89 public:
90
94 virtual ~FileHeader();
95
99 TFormat getFormat () const { return _format; }
100 TOrient getOrientation () const { return _orientation; }
101 TColonne getColumns () const { return _colonne; }
102 THeadfoot getHeadType () const { return _headType; }
103 THeadfoot getFootType () const { return _footType; }
104 TUnit getUnit () const { return _unite; }
105 TProcType getProcessing () const { return _processing; }
106 int getStandardPge () const { return _standardPage; }
107 bool hasHeader () const { return _hasHeader; }
108 bool hasFooter () const { return _hasFooter; }
109 bool hasTOC () const { return _hasTOC; }
110 bool hasColor () const { return _hasColor; }
111 bool hasUnderline () const { return _hasUnderline; }
112 bool hasEnumerate () const { return _hasEnumerate; }
113 bool hasGraphics () const { return _hasGraphics; }
114 bool hasTable () const { return _hasTable; }
115
119 void setFormat (TFormat f) { _format = f; }
120 void setFormat (int f) { _format = (TFormat) f; }
121 void setOrientation(TOrient o) { _orientation = o; }
122 void setOrientation(int o) { _orientation = (TOrient) o; }
123 void setColumns (TColonne c) { _colonne = c; }
124 void setColumns (int c) { _colonne = (TColonne) c; }
125 void setUnit (int u) { _unite = (TUnit) u; }
126 void setProcessing (int p) { _processing = (TProcType) p; }
127 void setStandardPge(int s) { _standardPage = s; }
128 void setTOC (int t) { _hasTOC = t; }
129 void setHeadType (int ht) { _headType = (THeadfoot) ht; }
130 void setFootType (int ft) { _footType = (THeadfoot) ft; }
131 void useColor () { _hasColor = true; }
132 void useUnderline () { _hasUnderline = true; }
133 void useEnumerate () { _hasEnumerate = true; }
134 void useGraphics () { _hasGraphics = true; }
135 void useTable () { _hasTable = true; }
136
137 void analysePaper (const TQDomNode);
138 void analyseAttributs (const TQDomNode);
139
140 void generate (TQTextStream &);
141
142 protected:
146 FileHeader(); /* Ensure singleton */
147
148 static FileHeader* _instance; /* singleton */
149
150 private:
151
152 void analysePaperParam(const TQDomNode);
153
154 void generatePaper (TQTextStream&);
155 void generateLatinPreambule(TQTextStream&);
156 void generateUnicodePreambule(TQTextStream&);
157 void generatePackage (TQTextStream&);
158
159};
160
161#endif /* __KWORD_FILEHEADER_H__ */
This class hold all general information about the doc : does it use a color markup,...
FileHeader()
Constructor.
void setFormat(TFormat f)
Modifiors.
TFormat getFormat() const
Accessors.
virtual ~FileHeader()
Destructor.
This class supply some convenients methods to access to a DOM tree.