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