Branch data 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 ANCHOR_HEIGHT 0x120000
87 : : #define FIRST_LAYOUTPAGENO 0x0001
88 : : #define LAST_LAYOUTPAGENO 0xffff
89 : :
90 : : #define LAY_BUOYFLOAT 0x01
91 : : #define LAY_BUOYNEUTRAL 0x02
92 : : #define LAY_BUOYSINK 0x03
93 : : #define LAY_BUOYLAYER 0x80
94 : :
95 : : class LwpPara;
96 : : class LwpVirtualLayout : public LwpDLNFPVList
97 : : {
98 : : public:
99 : : LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
100 [ - + ]: 399 : virtual ~LwpVirtualLayout(){}
101 : : virtual sal_Bool MarginsSameAsParent();
102 : 0 : inline virtual sal_uInt16 GetNumCols(){return 1;}
103 : : virtual double GetColWidth(sal_uInt16 nIndex);
104 : : virtual double GetColGap(sal_uInt16 nIndex);
105 : 15 : virtual double GetMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
106 : 0 : virtual double GetExtMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
107 : 0 : virtual sal_Bool IsAutoGrow(){ return sal_False;}
108 : 0 : virtual sal_Bool IsAutoGrowUp(){ return sal_False;}
109 : 0 : virtual sal_Bool IsAutoGrowDown(){ return sal_False;}
110 : 0 : virtual sal_Bool IsAutoGrowLeft(){ return sal_False;}
111 : 0 : virtual sal_Bool IsAutoGrowRight(){ return sal_False;}
112 : : virtual sal_Bool IsFitGraphic();
113 : : virtual sal_Bool IsAutoGrowWidth();
114 : : virtual sal_Bool IsInlineToMargin();
115 : 0 : virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
116 : : virtual sal_Bool HonorProtection();
117 : : virtual sal_Bool IsProtected();
118 : : virtual sal_Bool HasProtection();
119 : 12 : virtual OUString GetStyleName(){ return m_StyleName;}
120 : : virtual sal_Bool IsComplex();
121 : 0 : virtual sal_Bool IsAnchorPage(){ return sal_False;}
122 : 0 : virtual sal_Bool IsAnchorFrame(){ return sal_False;}
123 : 0 : virtual sal_Bool IsAnchorCell(){ return sal_False;}
124 : : virtual sal_Bool IsPage();
125 : : virtual sal_Bool IsHeader();
126 : : virtual sal_Bool IsFooter();
127 : : virtual sal_Bool IsFrame();
128 : : virtual sal_Bool IsCell();
129 : : virtual sal_Bool IsSuperTable();
130 : : virtual sal_Bool IsGroupHead();
131 : : virtual sal_uInt8 GetRelativeType();
132 : : virtual sal_Bool IsRelativeAnchored();
133 : : virtual LwpUseWhen* GetUseWhen();
134 : 0 : virtual LwpUseWhen* VirtualGetUseWhen(){ return NULL;}
135 : 0 : virtual sal_Bool IsUseOnAllPages(){ return sal_False;}
136 : 0 : virtual sal_Bool IsUseOnAllEvenPages(){ return sal_False;}
137 : 0 : virtual sal_Bool IsUseOnAllOddPages(){ return sal_False;}
138 : 0 : virtual sal_Bool IsUseOnPage(){ return sal_False;}
139 : 0 : virtual sal_Int32 GetPageNumber(sal_uInt16 /*nLayoutNumber*/ = 0){ return -1;}
140 : : virtual sal_Bool IsMinimumHeight();
141 : 51 : virtual sal_Bool IsForWaterMark(){ return sal_False;}
142 : 0 : virtual LwpPara* GetLastParaOfPreviousStory() { return NULL; }
143 : : virtual LwpVirtualLayout* GetParentLayout();
144 : 0 : virtual LwpVirtualLayout* GetContainerLayout(){ return NULL;}
145 : : virtual void RegisterChildStyle();
146 : : virtual sal_Bool NoContentReference();
147 : : virtual sal_Bool IsStyleLayout();
148 : 225 : virtual enumXFAlignType GetVerticalAlignmentType()
149 : : {
150 [ - + ]: 225 : if (m_nAttributes & STYLE_CENTEREDVERTICALLY)
151 : : {
152 : 0 : return enumXFAlignMiddle;
153 : : }
154 [ - + ]: 225 : else if (m_nAttributes & STYLE_BOTTOMALIGNED)
155 : : {
156 : 0 : return enumXFAlignBottom;
157 : : }
158 : 225 : return enumXFAlignTop;
159 : : };
160 : 75 : virtual void SetStyleName(const OUString & str){ m_StyleName = str;}
161 : 0 : virtual double GetWidth(){return -1;}
162 : :
163 : : //Check whether there are contents in the layout
164 : 0 : virtual sal_Bool HasContent(){return sal_False;}
165 : : //End by
166 : : protected:
167 : : void Read();
168 : : protected:
169 : : sal_uInt32 m_nAttributes;
170 : : sal_uInt32 m_nAttributes2;
171 : : sal_uInt32 m_nAttributes3;
172 : : sal_uInt32 m_nOverrideFlag;
173 : : sal_uInt16 m_nDirection;
174 : : sal_uInt16 m_nEditorID;
175 : : LwpObjectID m_NextEnumerated;
176 : : LwpObjectID m_PreviousEnumerated;
177 : : OUString m_StyleName;
178 : : enum LWP_LAYOUT_TYPE
179 : : {
180 : : LWP_VIRTUAL_LAYOUT,
181 : : LWP_HEAD_LAYOUT,
182 : : LWP_PAGE_LAYOUT,
183 : : LWP_HEADER_LAYOUT,
184 : : LWP_FOOTER_LAYOUT,
185 : : LWP_FRAME_LAYOUT,
186 : : LWP_SUPERTABLE_LAYOUT,
187 : : LWP_TABLE_LAYOUT,
188 : : LWP_ROW_LAYOUT,
189 : : LWP_COLUMN_LAYOUT,
190 : : LWP_CELL_LAYOUT,
191 : : LWP_CONNECTED_CELL_LAYOUT,
192 : : LWP_HIDDEN_CELL_LAYOUT,
193 : : LWP_TABLE_HEADING_LAYOUT,
194 : : LWP_ROW_HEADING_LAYOUT,
195 : : LWP_DROPCAP_LAYOUT,
196 : : LWP_GROUP_LAYOUT,
197 : : LWP_TOC_SUPERTABLE_LAYOUT,
198 : : LWP_FOOTNOTE_LAYOUT,
199 : : LWP_FOOTNOTE_ROW_LAYOUT,
200 : : LWP_FOOTNOTE_CELL_LAYOUT,
201 : : LWP_ENDNOTE_LAYOUT,
202 : : LWP_ENDNOTE_SUPERTABLE_LAYOUT,
203 : : LWP_FOOTNOTE_SUPERTABLE_LAYOUT,
204 : : LWP_NOTE_LAYOUT,
205 : : LWP_NOTEHEADER_LAYOUT,
206 : : LWP_NOTETEXT_LAYOUT,
207 : : LWP_VIEWPORT_LAYOUT
208 : : };
209 : : enum LayoutDirection
210 : : {
211 : : LAY_USEDIRECTION = 0x01,
212 : : LAY_AUTOGROW = 0x02,
213 : : LAY_AUTOSIZE = 0x04,
214 : : LAY_TOCONTAINER = 0x08,
215 : : LAY_DIRALLBITS = 0x0f
216 : : };
217 : : enum {SHIFT_UP = 0, SHIFT_DOWN = 4, SHIFT_LEFT = 8, SHIFT_RIGHT =12};
218 : : public:
219 : 0 : virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_VIRTUAL_LAYOUT;}
220 : : virtual LwpVirtualLayout* FindChildByType(LWP_LAYOUT_TYPE eType);
221 : : };
222 : :
223 : : class LwpAssociatedLayouts
224 : : {
225 : : public:
226 : 261 : LwpAssociatedLayouts(){}
227 : : //LwpAssociatedLayouts(LwpObjectStream* pStrm){Read(pStrm);}
228 : : public:
229 : : void Read(LwpObjectStream* pStrm);
230 : 18 : LwpObjectID* GetOnlyLayout(){return &m_OnlyLayout;}
231 : : LwpDLVListHeadTail* GetLayouts(){return &m_Layouts;}
232 : : LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
233 : : protected:
234 : : LwpObjectID m_OnlyLayout; //LwpVirtualLayout
235 : : LwpDLVListHeadTail m_Layouts;
236 : : };
237 : :
238 : : class LwpHeadLayout : public LwpVirtualLayout
239 : : {
240 : : public:
241 : : LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
242 [ - + ]: 192 : virtual ~LwpHeadLayout(){}
243 : : void RegisterStyle();
244 : : LwpVirtualLayout* FindEnSuperTableLayout();
245 : : protected:
246 : : void Read();
247 : 435 : virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_HEAD_LAYOUT;}
248 : : };
249 : :
250 : : //add by , 01/20/2005
251 : : class LwpLayoutStyle
252 : : {
253 : : public:
254 : : LwpLayoutStyle();
255 : : virtual ~LwpLayoutStyle();
256 : : void Read(LwpObjectStream* pStrm);
257 : : private:
258 : : sal_uInt32 m_nStyleDefinition;
259 : : LwpAtomHolder* m_pDescription;
260 : : sal_uInt16 m_nKey;
261 : : };
262 : :
263 : : class LwpLayoutMisc
264 : : {
265 : : public:
266 : : LwpLayoutMisc();
267 : : virtual ~LwpLayoutMisc();
268 : : void Read(LwpObjectStream* pStrm);
269 : : private:
270 : : sal_Int32 m_nGridDistance;
271 : : sal_uInt16 m_nGridType;
272 : : LwpAtomHolder* m_pContentStyle;
273 : : };
274 : : //end add
275 : :
276 : : #include "lwplaypiece.hxx"
277 : :
278 : : class LwpMiddleLayout : public LwpVirtualLayout
279 : : {
280 : : public:
281 : : LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
282 : : virtual ~LwpMiddleLayout();
283 : : virtual sal_Bool MarginsSameAsParent();
284 : : virtual double GetMarginsValue(const sal_uInt8& nWhichSide);
285 : : virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide);
286 : : LwpLayoutGeometry* GetGeometry();
287 : : double GetGeometryHeight();
288 : : double GetGeometryWidth();
289 : : LwpBorderStuff* GetBorderStuff();
290 : : LwpBackgroundStuff* GetBackgroundStuff();
291 : : enumXFTextDir GetTextDirection();
292 : : XFBorders* GetXFBorders();
293 : : LwpColor* GetBackColor();
294 : : virtual sal_Bool IsAutoGrow();
295 : : virtual sal_Bool IsAutoGrowUp();
296 : : virtual sal_Bool IsAutoGrowDown();
297 : : virtual sal_Bool IsAutoGrowLeft();
298 : : virtual sal_Bool IsAutoGrowRight();
299 : : virtual sal_uInt8 GetContentOrientation();
300 : : virtual sal_Bool HonorProtection();
301 : : virtual sal_Bool IsProtected();
302 : : virtual LwpVirtualLayout* GetWaterMarkLayout();
303 : : XFBGImage* GetXFBGImage();
304 : : virtual sal_Bool GetUsePrinterSettings();
305 : :
306 [ + - ]: 84 : LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj());}
307 : : sal_uInt16 GetScaleMode(void);
308 : : sal_uInt16 GetScaleTile(void);
309 : : sal_uInt16 GetScaleCenter(void);
310 : : sal_uInt32 GetScalePercentage(void);
311 : : double GetScaleWidth(void);
312 : : double GetScaleHeight(void);
313 : :
314 : : sal_Bool CanSizeRight(void);
315 : : virtual double GetWidth();
316 : : virtual sal_Int32 GetMinimumWidth();
317 : : sal_Bool IsSizeRightToContent(void);
318 : : sal_Bool IsSizeRightToContainer(void);
319 : : sal_Int32 DetermineWidth();
320 : : virtual double GetHeight();
321 : : virtual LwpPoint GetOrigin();
322 : :
323 : : // added by , 06/01/2004
324 : : sal_Bool IsPatternFill();
325 : : XFBGImage* GetFillPattern();
326 : : // end add
327 : :
328 : :
329 : : //Check whether there are contents in the layout
330 : : virtual sal_Bool HasContent();
331 : : //End by
332 : :
333 : : protected:
334 : : void Read();
335 : : protected:
336 : : enum
337 : : {
338 : : DISK_GOT_STYLE_STUFF = 0x01,
339 : : DISK_GOT_MISC_STUFF = 0x02
340 : : };
341 : :
342 : : LwpObjectID m_Content;
343 : : LwpObjectID m_BasedOnStyle;
344 : :
345 : : // 01/20/2005
346 : : LwpObjectID m_TabPiece;
347 : : LwpLayoutStyle* m_pStyleStuff;
348 : : LwpLayoutMisc* m_pMiscStuff;
349 : : LwpObjectID m_LayGeometry;
350 : : LwpObjectID m_LayScale;
351 : : LwpObjectID m_LayMargins;
352 : : LwpObjectID m_LayBorderStuff;
353 : : LwpObjectID m_LayBackgroundStuff;
354 : : LwpObjectID m_LayExtBorderStuff;
355 : : //end
356 : : public:
357 : 60 : LwpObjectID* GetContent(){return &m_Content;}
358 : : LwpTabOverride* GetTabOverride();
359 : : };
360 : :
361 : : class LwpLayout : public LwpMiddleLayout
362 : : {
363 : : public:
364 : : LwpLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
365 : : virtual ~LwpLayout();
366 : : XFColumns* GetXFColumns();
367 : : XFColumnSep* GetColumnSep();
368 : : LwpShadow* GetShadow();
369 : : XFShadow* GetXFShadow();
370 : : protected:
371 : : void Read();
372 : : protected:
373 : : // 01/20/2005
374 : : LwpUseWhen* m_pUseWhen;
375 : : LwpObjectID m_Positon;
376 : : LwpObjectID m_LayColumns;
377 : : LwpObjectID m_LayGutterStuff;
378 : : LwpObjectID m_LayJoinStuff;
379 : : LwpObjectID m_LayShadow;
380 : : LwpObjectID m_LayExtJoinStuff;
381 : : //end
382 : :
383 : : public:
384 : : LwpUseWhen* VirtualGetUseWhen();
385 : : virtual sal_uInt16 GetNumCols();
386 : : virtual double GetColWidth(sal_uInt16 nIndex);
387 : : virtual double GetColGap(sal_uInt16 nIndex);
388 : : virtual sal_uInt16 GetUsePage();
389 : : public:
390 : : enum UseWhenType
391 : : {
392 : : StartWithinColume,
393 : : StartWithinPage,
394 : : StartOnNextPage,
395 : : StartOnOddPage,
396 : : StartOnEvenPage
397 : : };
398 : : public:
399 : : virtual UseWhenType GetUseWhenType();
400 : : virtual sal_Bool IsUseOnAllPages();
401 : : virtual sal_Bool IsUseOnAllEvenPages();
402 : : virtual sal_Bool IsUseOnAllOddPages();
403 : : virtual sal_Bool IsUseOnPage();
404 : 201 : LwpObjectID* GetPosition(){ return &m_Positon;}
405 : : virtual LwpVirtualLayout* GetContainerLayout();
406 : : };
407 : :
408 : : class XFFont;
409 : : class LwpPlacableLayout : public LwpLayout
410 : : {
411 : : public:
412 : : LwpPlacableLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
413 : : virtual ~LwpPlacableLayout();
414 : : virtual sal_uInt8 GetWrapType();
415 : : virtual LwpLayoutRelativity* GetRelativityPiece();
416 : : virtual sal_uInt8 GetRelativeType();
417 : : virtual sal_Int32 GetBaseLineOffset();
418 : : virtual sal_Bool IsAnchorPage();
419 : : virtual sal_Bool IsAnchorFrame();
420 : : virtual sal_Bool IsAnchorCell();
421 : 0 : virtual void XFConvertFrame(XFContentContainer* /*pCont*/, sal_Int32 /*nStart*/ = 0, sal_Int32 /*nEnd*/ = 0, sal_Bool /*bAll*/ = sal_False) {}
422 : : XFFont* GetFont();
423 : : void SetFont(XFFont* pFont);
424 : : enum WrapType
425 : : {
426 : : LAY_WRAP_AROUND = 1,
427 : : LAY_NO_WRAP_BESIDE,
428 : : LAY_NO_WRAP_AROUND,
429 : : LAY_WRAP_LEFT,
430 : : LAY_WRAP_RIGHT,
431 : : //OLD_LAY_WRAP_RIGHT,
432 : : LAY_WRAP_BOTH,
433 : : LAY_WRAP_IRREG_BOTH,
434 : : LAY_WRAP_IRREG_LEFT,
435 : : LAY_WRAP_IRREG_RIGHT,
436 : : LAY_WRAP_IRREG_BIGGEST
437 : : };
438 : : protected:
439 : : void Read();
440 : : protected:
441 : : sal_uInt8 m_nWrapType;
442 : : sal_uInt8 m_nBuoyancy;
443 : : sal_Int32 m_nBaseLineOffset;
444 : : LwpAtomHolder m_Script;
445 : : LwpObjectID m_LayRelativity;
446 : : sal_uInt16 m_nPageNumber;//for frame anchored to page
447 : : XFFont* m_pFont;//for frame position
448 : : };
449 : : #endif
450 : :
451 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|