layout.h
1
2/*
3** Header file for inclusion with kword_xml2latex.c
4**
5** Copyright (C) 2000 Robert JACOLIN
6**
7** This library is free software; you can redistribute it and/or
8** modify it under the terms of the GNU Library General Public
9** License as published by the Free Software Foundation; either
10** version 2 of the License, or (at your option) any later version.
11**
12** This library is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15** Library General Public License for more details.
16**
17** To receive a copy of the GNU Library General Public License, write to the
18** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20**
21*/
22
23#ifndef __KWORD_LAYOUT_H__
24#define __KWORD_LAYOUT_H__
25
26#include <tqtextstream.h>
27#include <tqstring.h>
28#include <kdebug.h>
29#include "textformat.h"
30
31enum _EType
32{
33 TL_NONE, /* NONE */
34 TL_ARABIC, /* 1, 2, ... */
35 TL_LLETTER, /* a, b, ... */
36 TL_CLETTER, /* A, B, ... */
37 TL_LLNUMBER, /* i, ii, ... */
38 TL_CLNUMBER, /* I, II, ... */
39 TL_CUSTOM_SIMPLE, /* */
40 TL_CUSTOM_COMPLEX, /* */
41 TL_CIRCLE_BULLET, /* o */
42 TL_SQUARE_BULLET, /* * */
43 TL_DISC_BULLET /* o */
44};
45
46enum _EEnv
47{
48 ENV_NONE,
49 ENV_LEFT,
50 ENV_RIGHT,
51 ENV_CENTER,
52 ENV_JUSTIFY /* default in latex */
53};
54
55typedef enum _EType EType;
56typedef enum _EEnv EEnv;
57
58/***********************************************************************/
59/* Class: Layout */
60/***********************************************************************/
61
66class Layout: public TextFormat
67{
68 TQString _name;
69 TQString _following;
70 EType _counterType;
71 int _counterDepth;
72 int _counterBullet;
73 int _counterStart;
74 int _numberingType;
75 EEnv _env;
76 static TQString _last_name;
77 static EType _last_counter;
78 bool _useHardBreakAfter;
79 bool _useHardBreak;
80 bool _keepLinesTogether;
81
82 public:
88 Layout();
89
90 /*
91 * Destructor
92 *
93 * Nothing to do.
94 */
95 virtual ~Layout() {
96 kdDebug(30522) << "Destruction of a layout." << endl;
97 }
98
102 bool isChapter () const { return (_numberingType == 1); }
103 bool isList () const { return (_numberingType == 0); }
104 bool isEnum () const { return (_counterType != TL_NONE); }
105 bool isLastSame () const { return (_name == _last_name); }
106 bool isNextSame () const { return (_following == _name); }
107 TQString getLastName () const { return _last_name; }
108 EType getLastCounter () const { return _last_counter; }
109 EType getCounterType () const { return _counterType; }
110 int getCounterDepth () const { return _counterDepth; }
111 int getCounterBullet () const { return _counterBullet; }
112 int getCounterStart () const { return _counterStart; }
113 int getNumberingType () const { return _numberingType; }
114 EEnv getEnv () const { return _env; }
115 bool isHardBreakAfter () const { return _useHardBreakAfter; }
116 bool isHardBreak () const { return _useHardBreak; }
117 bool isKeppLinesTogether() const { return _keepLinesTogether; }
118
122 void setName (TQString name) { _name = name; }
123 void setLastName () { _last_name = _name; }
124 void setLastCounter () { _last_counter= _counterType; }
125 void setFollowing (TQString name) { _following = name; }
126 void setCounterType (int ct) { _counterType = (EType) ct; }
127 void setCounterDepth (int cd) { _counterDepth = cd; }
128 void setCounterBullet(int cb) { _counterBullet = cb; }
129 void setCounterStart (int cs) { _counterStart = cs; }
130 void setNumberingType(int nt) { _numberingType = nt; }
131 void setEnv (int env) { _env = (EEnv) env; }
132 void useHardBreakAfter() { _useHardBreakAfter = true; }
133 void useHardBreak () { _useHardBreak = true; }
134 void keepLinesTogether() { _keepLinesTogether = true; }
135
140 void analyseLayout (const TQDomNode);
141
142 private:
143 void analyseCounter (const TQDomNode);
144 void analyseFollowing(const TQDomNode);
145 void analyseName (const TQDomNode);
146 void analyseEnv (const TQDomNode);
147 void analyseBreakLine(const TQDomNode);
148};
149
150#endif /* __KWORD_LAYOUT_H__ */
This class tells about a paragraph and its contents.
Definition layout.h:67
void analyseLayout(const TQDomNode)
Helpfull functions.
Definition layout.cpp:55
Layout()
Constructors.
Definition layout.cpp:37
void setName(TQString name)
Modifiers.
Definition layout.h:122
bool isChapter() const
Accessors.
Definition layout.h:102
This class holds information formating the textzone.
Definition textformat.h:70