1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/*
* Kivio - Visual Modelling and Flowcharting
* Copyright (C) 2000-2001 theKompany.com & Dave Marotti
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __kivio_page_h__
#define __kivio_page_h__
class KivioPage;
class KivioView;
class KivioMap;
class KivioCanvas;
class KivioDoc;
class KoDocumentEntry;
class TQWidget;
class TQPainter;
class TQDomElement;
class KivioLayer;
class KoPoint;
class DCOPObject;
#include <KoDocument.h>
#include <tqpen.h>
#include <tqptrlist.h>
#include <tqintdict.h>
#include <tqmemarray.h>
#include <tqrect.h>
#include <tqpalette.h>
#include <tqwidget.h>
#include <KoPoint.h>
#include "kivio_stencil.h"
#include <koffice_export.h>
class KivioPainter;
class KPrinter;
class KivioView;
class KoZoomHandler;
class KoRect;
class KoXmlWriter;
class KoStore;
class KoGenStyles;
#define BORDER_SPACE 1
struct AlignData
{
enum Align { None, Left, Center, Right, Top, Bottom };
Align v;
Align h;
bool centerOfPage;
};
struct DistributeData
{
enum Distribute { None, Left, Center, Right, Top, Bottom, Spacing };
enum Extent { Selection, Page };
Distribute v;
Distribute h;
Extent extent;
};
class KIVIO_EXPORT KivioPage : public TQObject
{
Q_OBJECT
public:
KivioPage( KivioMap *_map, const TQString &pageName, const char *_name=0L );
~KivioPage();
virtual DCOPObject* dcopObject();
TQString pageName()const { return m_strName; }
bool setPageName( const TQString& name, bool init = false );
virtual TQDomElement save( TQDomDocument& );
virtual void saveOasis(KoStore* store, KoXmlWriter* docWriter, KoGenStyles* styles);
virtual bool loadXML( const TQDomElement& );
bool loadOasis(const TQDomElement& page, KoOasisStyles& oasisStyles);
bool isLoading();
bool isHidden()const { return m_bPageHide; }
void setHidden(bool hidden) { m_bPageHide=hidden; }
void setMap( KivioMap* _map ) { m_pMap = _map; }
KivioDoc* doc()const { return m_pDoc; }
KivioMap* map()const { return m_pMap; }
KivioPage *findPage( const TQString & _name );
void print( TQPainter &painter, KPrinter *_printer );
void update();
int id()const { return m_id; }
static KivioPage* find( int _id );
KoPageLayout paperLayout()const { return m_pPageLayout; }
void setPaperLayout(const KoPageLayout&);
void paintContent( KivioPainter& painter, const TQRect& rect, bool transparent, TQPoint, KoZoomHandler*, bool, bool );
void printContent( KivioPainter& painter, int xdpi = 0, int ydpi = 0 );
void printSelected( KivioPainter& painter, int xdpi = 0, int ydpi = 0 );
void printContent(KivioPainter& painter, KoZoomHandler* zoomHandler);
bool isStencilSelected( KivioStencil * );
void selectAllStencils();
void unselectAllStencils();
bool unselectStencil( KivioStencil * );
void selectStencil( KivioStencil * );
void selectStencils( double, double, double, double );
TQPtrList<KivioStencil> *selectedStencils() { return &m_lstSelection; }
bool checkForStencilTypeInSelection(KivioStencilType type);
bool checkForTextBoxesInSelection();
KoRect getRectForAllSelectedStencils();
KoRect getRectForAllStencils();
int generateStencilIds( int );
KivioStencil *checkForStencil( KoPoint *, int *, double, bool);
KivioLayer *curLayer()const { return m_pCurLayer; }
void setCurLayer( KivioLayer *pLayer ) { m_pCurLayer=pLayer; }
TQPtrList<KivioLayer> *layers() { return &m_lstLayers; }
KivioLayer *firstLayer();
KivioLayer *nextLayer();
KivioLayer *lastLayer();
KivioLayer *prevLayer();
bool removeCurrentLayer();
void addLayer( KivioLayer * );
void insertLayer( int, KivioLayer * );
KivioLayer *layerAt( int );
void takeLayer( KivioLayer *pLayer );
/*
* Stencil routines
*/
bool addStencil( KivioStencil * );
void alignStencils( AlignData );
void distributeStencils( DistributeData );
KivioConnectorTarget *connectPointToTarget( KivioConnectorPoint *, double );
KoPoint snapToTarget( const KoPoint& p, double thresh, bool& hit );
void setHidePage(bool _hide);
TQValueList<double> horizontalGuideLines() const { return m_hGuideLines; }
TQValueList<double> verticalGuideLines() const { return m_vGuideLines; }
public slots:
void deleteSelectedStencils();
void groupSelectedStencils();
void ungroupSelectedStencils();
void bringToFront();
void sendToBack();
void copy();
void cut();
void paste(KivioView* view);
void setPaintSelected(bool paint = true);
void setGuideLines(const TQValueList<double> hGuideLines, const TQValueList<double> vGuideLines);
void addGuideLine(Qt::Orientation orientation, double position);
signals:
void sig_updateView( KivioPage *_page );
void sig_updateView( KivioPage *_page, const TQRect& );
void sig_nameChanged( KivioPage* page, const TQString& old_name );
void sig_PageHidden(KivioPage *_page);
void sig_PageShown(KivioPage *_page);
void sig_pageLayoutChanged(const KoPageLayout&);
protected:
void printPage( TQPainter &_painter, const TQRect& page_range, const TQRect& view );
TQDomElement saveLayout( TQDomDocument & );
bool loadLayout( const TQDomElement & );
void saveGuideLines(TQDomElement& element);
void loadGuideLines(const TQDomElement& element);
TQString m_strName;
KivioMap *m_pMap;
KivioDoc *m_pDoc;
TQPtrList<KivioLayer> m_lstLayers;
KivioLayer *m_pCurLayer;
TQPtrList<KivioStencil> m_lstSelection;
int m_id;
bool m_bPageHide;
static int s_id;
static TQIntDict<KivioPage>* s_mapPages;
KoPageLayout m_pPageLayout;
DCOPObject* m_dcop;
TQValueList<double> m_hGuideLines;
TQValueList<double> m_vGuideLines;
};
#endif
|