Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
12 : * GNU Lesser General Public License Version 2.1
13 : * =============================================
14 : * Copyright 2000 by Sun Microsystems, Inc.
15 : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : *
17 : * This library is free software; you can redistribute it and/or
18 : * modify it under the terms of the GNU Lesser General Public
19 : * License version 2.1, as published by the Free Software Foundation.
20 : *
21 : * This library is distributed in the hope that it will be useful,
22 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : * Lesser General Public License for more details.
25 : *
26 : * You should have received a copy of the GNU Lesser General Public
27 : * License along with this library; if not, write to the Free Software
28 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : * MA 02111-1307 USA
30 : *
31 : *
32 : * Sun Industry Standards Source License Version 1.1
33 : * =================================================
34 : * The contents of this file are subject to the Sun Industry Standards
35 : * Source License Version 1.1 (the "License"); You may not use this file
36 : * except in compliance with the License. You may obtain a copy of the
37 : * License at http://www.openoffice.org/license.html.
38 : *
39 : * Software provided under this License is provided on an "AS IS" basis,
40 : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : * See the License for the specific provisions governing your rights and
44 : * obligations concerning the Software.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /*************************************************************************
57 : * @file
58 : * For LWP filter architecture prototype
59 : ************************************************************************/
60 : /*************************************************************************
61 : * Change History
62 : Jan 2005 Created
63 : ************************************************************************/
64 :
65 : #ifndef _LWPLAYOUT_HXX
66 : #define _LWPLAYOUT_HXX
67 :
68 : #include "lwpheader.hxx"
69 : #include "lwpobj.hxx"
70 : #include "lwpobjhdr.hxx"
71 : #include "lwpobjstrm.hxx"
72 : #include "lwpobjid.hxx"
73 : #include "lwpdlvlist.hxx"
74 : #include "lwpfilehdr.hxx"
75 :
76 : #include "lwplayoutdef.hxx"
77 : #include "xfilter/xfdefs.hxx"
78 : #include "xfilter/xfpagemaster.hxx"
79 : #include "xfilter/xfcolumns.hxx"
80 : #include "xfilter/xfborders.hxx"
81 : #include "xfilter/xfframestyle.hxx"
82 : #include "xfilter/xfframe.hxx"
83 : #include "xfilter/xfbgimage.hxx"
84 : #include "lwpusewhen.hxx"
85 :
86 : #define FIRST_LAYOUTPAGENO 0x0001
87 : #define LAST_LAYOUTPAGENO 0xffff
88 :
89 : #define LAY_BUOYNEUTRAL 0x02
90 : #define LAY_BUOYLAYER 0x80
91 :
92 : class LwpPara;
93 : class LwpVirtualLayout : public LwpDLNFPVList
94 : {
95 : public:
96 : LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
97 133 : virtual ~LwpVirtualLayout(){}
98 : virtual sal_Bool MarginsSameAsParent();
99 0 : inline virtual sal_uInt16 GetNumCols(){return 1;}
100 : virtual double GetColWidth(sal_uInt16 nIndex);
101 : virtual double GetColGap(sal_uInt16 nIndex);
102 5 : virtual double GetMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
103 0 : virtual double GetExtMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
104 0 : virtual sal_Bool IsAutoGrow(){ return sal_False;}
105 0 : virtual sal_Bool IsAutoGrowUp(){ return sal_False;}
106 0 : virtual sal_Bool IsAutoGrowDown(){ return sal_False;}
107 0 : virtual sal_Bool IsAutoGrowLeft(){ return sal_False;}
108 0 : virtual sal_Bool IsAutoGrowRight(){ return sal_False;}
109 : virtual sal_Bool IsFitGraphic();
110 : virtual sal_Bool IsAutoGrowWidth();
111 : virtual sal_Bool IsInlineToMargin();
112 0 : virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
113 : virtual sal_Bool HonorProtection();
114 : virtual sal_Bool IsProtected();
115 : virtual sal_Bool HasProtection();
116 4 : virtual OUString GetStyleName(){ return m_StyleName;}
117 : virtual sal_Bool IsComplex();
118 0 : virtual sal_Bool IsAnchorPage(){ return sal_False;}
119 0 : virtual sal_Bool IsAnchorFrame(){ return sal_False;}
120 0 : virtual sal_Bool IsAnchorCell(){ return sal_False;}
121 : virtual sal_Bool IsPage();
122 : virtual sal_Bool IsHeader();
123 : virtual sal_Bool IsFooter();
124 : virtual sal_Bool IsFrame();
125 : virtual sal_Bool IsCell();
126 : virtual sal_Bool IsSuperTable();
127 : virtual sal_Bool IsGroupHead();
128 : virtual sal_uInt8 GetRelativeType();
129 : virtual sal_Bool IsRelativeAnchored();
130 : virtual LwpUseWhen* GetUseWhen();
131 0 : virtual LwpUseWhen* VirtualGetUseWhen(){ return NULL;}
132 0 : virtual sal_Bool IsUseOnAllPages(){ return sal_False;}
133 0 : virtual sal_Bool IsUseOnAllEvenPages(){ return sal_False;}
134 0 : virtual sal_Bool IsUseOnAllOddPages(){ return sal_False;}
135 0 : virtual sal_Bool IsUseOnPage(){ return sal_False;}
136 0 : virtual sal_Int32 GetPageNumber(sal_uInt16 /*nLayoutNumber*/ = 0){ return -1;}
137 : virtual sal_Bool IsMinimumHeight();
138 17 : virtual sal_Bool IsForWaterMark(){ return sal_False;}
139 0 : virtual LwpPara* GetLastParaOfPreviousStory() { return NULL; }
140 : virtual LwpVirtualLayout* GetParentLayout();
141 0 : virtual LwpVirtualLayout* GetContainerLayout(){ return NULL;}
142 : virtual void RegisterChildStyle();
143 : virtual sal_Bool NoContentReference();
144 : virtual sal_Bool IsStyleLayout();
145 75 : virtual enumXFAlignType GetVerticalAlignmentType()
146 : {
147 75 : if (m_nAttributes & STYLE_CENTEREDVERTICALLY)
148 : {
149 0 : return enumXFAlignMiddle;
150 : }
151 75 : else if (m_nAttributes & STYLE_BOTTOMALIGNED)
152 : {
153 0 : return enumXFAlignBottom;
154 : }
155 75 : return enumXFAlignTop;
156 : };
157 25 : virtual void SetStyleName(const OUString & str){ m_StyleName = str;}
158 0 : virtual double GetWidth(){return -1;}
159 :
160 : //Check whether there are contents in the layout
161 0 : virtual sal_Bool HasContent(){return sal_False;}
162 : //End by
163 : protected:
164 : void Read();
165 : protected:
166 : sal_uInt32 m_nAttributes;
167 : sal_uInt32 m_nAttributes2;
168 : sal_uInt32 m_nAttributes3;
169 : sal_uInt32 m_nOverrideFlag;
170 : sal_uInt16 m_nDirection;
171 : sal_uInt16 m_nEditorID;
172 : LwpObjectID m_NextEnumerated;
173 : LwpObjectID m_PreviousEnumerated;
174 : OUString m_StyleName;
175 : enum LWP_LAYOUT_TYPE
176 : {
177 : LWP_VIRTUAL_LAYOUT,
178 : LWP_HEAD_LAYOUT,
179 : LWP_PAGE_LAYOUT,
180 : LWP_HEADER_LAYOUT,
181 : LWP_FOOTER_LAYOUT,
182 : LWP_FRAME_LAYOUT,
183 : LWP_SUPERTABLE_LAYOUT,
184 : LWP_TABLE_LAYOUT,
185 : LWP_ROW_LAYOUT,
186 : LWP_COLUMN_LAYOUT,
187 : LWP_CELL_LAYOUT,
188 : LWP_CONNECTED_CELL_LAYOUT,
189 : LWP_HIDDEN_CELL_LAYOUT,
190 : LWP_TABLE_HEADING_LAYOUT,
191 : LWP_ROW_HEADING_LAYOUT,
192 : LWP_DROPCAP_LAYOUT,
193 : LWP_GROUP_LAYOUT,
194 : LWP_TOC_SUPERTABLE_LAYOUT,
195 : LWP_FOOTNOTE_LAYOUT,
196 : LWP_FOOTNOTE_ROW_LAYOUT,
197 : LWP_FOOTNOTE_CELL_LAYOUT,
198 : LWP_ENDNOTE_LAYOUT,
199 : LWP_ENDNOTE_SUPERTABLE_LAYOUT,
200 : LWP_FOOTNOTE_SUPERTABLE_LAYOUT,
201 : LWP_NOTE_LAYOUT,
202 : LWP_NOTEHEADER_LAYOUT,
203 : LWP_NOTETEXT_LAYOUT,
204 : LWP_VIEWPORT_LAYOUT
205 : };
206 : enum LayoutDirection
207 : {
208 : LAY_USEDIRECTION = 0x01,
209 : LAY_AUTOGROW = 0x02,
210 : LAY_AUTOSIZE = 0x04,
211 : LAY_TOCONTAINER = 0x08,
212 : LAY_DIRALLBITS = 0x0f
213 : };
214 : enum {SHIFT_UP = 0, SHIFT_DOWN = 4, SHIFT_LEFT = 8, SHIFT_RIGHT =12};
215 : public:
216 0 : virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_VIRTUAL_LAYOUT;}
217 : virtual LwpVirtualLayout* FindChildByType(LWP_LAYOUT_TYPE eType);
218 : };
219 :
220 : class LwpAssociatedLayouts
221 : {
222 : public:
223 87 : LwpAssociatedLayouts(){}
224 : public:
225 : void Read(LwpObjectStream* pStrm);
226 6 : LwpObjectID* GetOnlyLayout(){return &m_OnlyLayout;}
227 : LwpDLVListHeadTail* GetLayouts(){return &m_Layouts;}
228 : LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
229 : protected:
230 : LwpObjectID m_OnlyLayout; //LwpVirtualLayout
231 : LwpDLVListHeadTail m_Layouts;
232 : };
233 :
234 : class LwpHeadLayout : public LwpVirtualLayout
235 : {
236 : public:
237 : LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
238 64 : virtual ~LwpHeadLayout(){}
239 : void RegisterStyle();
240 : LwpVirtualLayout* FindEnSuperTableLayout();
241 : protected:
242 : void Read();
243 145 : virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_HEAD_LAYOUT;}
244 : };
245 :
246 : class LwpLayoutStyle
247 : {
248 : public:
249 : LwpLayoutStyle();
250 : virtual ~LwpLayoutStyle();
251 : void Read(LwpObjectStream* pStrm);
252 : private:
253 : sal_uInt32 m_nStyleDefinition;
254 : LwpAtomHolder* m_pDescription;
255 : sal_uInt16 m_nKey;
256 : };
257 :
258 : class LwpLayoutMisc
259 : {
260 : public:
261 : LwpLayoutMisc();
262 : virtual ~LwpLayoutMisc();
263 : void Read(LwpObjectStream* pStrm);
264 : private:
265 : sal_Int32 m_nGridDistance;
266 : sal_uInt16 m_nGridType;
267 : LwpAtomHolder* m_pContentStyle;
268 : };
269 :
270 : #include "lwplaypiece.hxx"
271 :
272 : class LwpMiddleLayout : public LwpVirtualLayout
273 : {
274 : public:
275 : LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
276 : virtual ~LwpMiddleLayout();
277 : virtual sal_Bool MarginsSameAsParent();
278 : virtual double GetMarginsValue(const sal_uInt8& nWhichSide);
279 : virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide);
280 : LwpLayoutGeometry* GetGeometry();
281 : double GetGeometryHeight();
282 : double GetGeometryWidth();
283 : LwpBorderStuff* GetBorderStuff();
284 : LwpBackgroundStuff* GetBackgroundStuff();
285 : enumXFTextDir GetTextDirection();
286 : XFBorders* GetXFBorders();
287 : LwpColor* GetBackColor();
288 : virtual sal_Bool IsAutoGrow();
289 : virtual sal_Bool IsAutoGrowUp();
290 : virtual sal_Bool IsAutoGrowDown();
291 : virtual sal_Bool IsAutoGrowLeft();
292 : virtual sal_Bool IsAutoGrowRight();
293 : virtual sal_uInt8 GetContentOrientation();
294 : virtual sal_Bool HonorProtection();
295 : virtual sal_Bool IsProtected();
296 : virtual LwpVirtualLayout* GetWaterMarkLayout();
297 : XFBGImage* GetXFBGImage();
298 : virtual sal_Bool GetUsePrinterSettings();
299 :
300 28 : LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj());}
301 : sal_uInt16 GetScaleMode(void);
302 : sal_uInt16 GetScaleTile(void);
303 : sal_uInt16 GetScaleCenter(void);
304 : sal_uInt32 GetScalePercentage(void);
305 : double GetScaleWidth(void);
306 : double GetScaleHeight(void);
307 :
308 : sal_Bool CanSizeRight(void);
309 : virtual double GetWidth();
310 : virtual sal_Int32 GetMinimumWidth();
311 : sal_Bool IsSizeRightToContent(void);
312 : sal_Bool IsSizeRightToContainer(void);
313 : sal_Int32 DetermineWidth();
314 : virtual double GetHeight();
315 : virtual LwpPoint GetOrigin();
316 :
317 : sal_Bool IsPatternFill();
318 : XFBGImage* GetFillPattern();
319 :
320 : //Check whether there are contents in the layout
321 : virtual sal_Bool HasContent();
322 : //End by
323 :
324 : protected:
325 : void Read();
326 : protected:
327 : enum
328 : {
329 : DISK_GOT_STYLE_STUFF = 0x01,
330 : DISK_GOT_MISC_STUFF = 0x02
331 : };
332 :
333 : LwpObjectID m_Content;
334 : LwpObjectID m_BasedOnStyle;
335 :
336 : LwpObjectID m_TabPiece;
337 : LwpLayoutStyle* m_pStyleStuff;
338 : LwpLayoutMisc* m_pMiscStuff;
339 : LwpObjectID m_LayGeometry;
340 : LwpObjectID m_LayScale;
341 : LwpObjectID m_LayMargins;
342 : LwpObjectID m_LayBorderStuff;
343 : LwpObjectID m_LayBackgroundStuff;
344 : LwpObjectID m_LayExtBorderStuff;
345 : public:
346 20 : LwpObjectID* GetContent(){return &m_Content;}
347 : LwpTabOverride* GetTabOverride();
348 : };
349 :
350 : class LwpLayout : public LwpMiddleLayout
351 : {
352 : public:
353 : LwpLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
354 : virtual ~LwpLayout();
355 : XFColumns* GetXFColumns();
356 : XFColumnSep* GetColumnSep();
357 : LwpShadow* GetShadow();
358 : XFShadow* GetXFShadow();
359 : protected:
360 : void Read();
361 : protected:
362 : LwpUseWhen* m_pUseWhen;
363 : LwpObjectID m_Positon;
364 : LwpObjectID m_LayColumns;
365 : LwpObjectID m_LayGutterStuff;
366 : LwpObjectID m_LayJoinStuff;
367 : LwpObjectID m_LayShadow;
368 : LwpObjectID m_LayExtJoinStuff;
369 :
370 : public:
371 : LwpUseWhen* VirtualGetUseWhen();
372 : virtual sal_uInt16 GetNumCols();
373 : virtual double GetColWidth(sal_uInt16 nIndex);
374 : virtual double GetColGap(sal_uInt16 nIndex);
375 : virtual sal_uInt16 GetUsePage();
376 : public:
377 : enum UseWhenType
378 : {
379 : StartWithinColume,
380 : StartWithinPage,
381 : StartOnNextPage,
382 : StartOnOddPage,
383 : StartOnEvenPage
384 : };
385 : public:
386 : virtual UseWhenType GetUseWhenType();
387 : virtual sal_Bool IsUseOnAllPages();
388 : virtual sal_Bool IsUseOnAllEvenPages();
389 : virtual sal_Bool IsUseOnAllOddPages();
390 : virtual sal_Bool IsUseOnPage();
391 67 : LwpObjectID* GetPosition(){ return &m_Positon;}
392 : virtual LwpVirtualLayout* GetContainerLayout();
393 : };
394 :
395 : class XFFont;
396 : class LwpPlacableLayout : public LwpLayout
397 : {
398 : public:
399 : LwpPlacableLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
400 : virtual ~LwpPlacableLayout();
401 : virtual sal_uInt8 GetWrapType();
402 : virtual LwpLayoutRelativity* GetRelativityPiece();
403 : virtual sal_uInt8 GetRelativeType();
404 : virtual sal_Int32 GetBaseLineOffset();
405 : virtual sal_Bool IsAnchorPage();
406 : virtual sal_Bool IsAnchorFrame();
407 : virtual sal_Bool IsAnchorCell();
408 0 : virtual void XFConvertFrame(XFContentContainer* /*pCont*/, sal_Int32 /*nStart*/ = 0, sal_Int32 /*nEnd*/ = 0, sal_Bool /*bAll*/ = sal_False) {}
409 : XFFont* GetFont();
410 : void SetFont(XFFont* pFont);
411 : enum WrapType
412 : {
413 : LAY_WRAP_AROUND = 1,
414 : LAY_NO_WRAP_BESIDE,
415 : LAY_NO_WRAP_AROUND,
416 : LAY_WRAP_LEFT,
417 : LAY_WRAP_RIGHT,
418 : LAY_WRAP_BOTH,
419 : LAY_WRAP_IRREG_BOTH,
420 : LAY_WRAP_IRREG_LEFT,
421 : LAY_WRAP_IRREG_RIGHT,
422 : LAY_WRAP_IRREG_BIGGEST
423 : };
424 : protected:
425 : void Read();
426 : protected:
427 : sal_uInt8 m_nWrapType;
428 : sal_uInt8 m_nBuoyancy;
429 : sal_Int32 m_nBaseLineOffset;
430 : LwpAtomHolder m_Script;
431 : LwpObjectID m_LayRelativity;
432 : sal_uInt16 m_nPageNumber;//for frame anchored to page
433 : XFFont* m_pFont;//for frame position
434 : };
435 : #endif
436 :
437 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|