1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * For LWP filter architecture prototype
59 ************************************************************************/
60 /*************************************************************************
63 ************************************************************************/
65 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
66 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
68 #include "lwpheader.hxx"
70 #include "lwpobjhdr.hxx"
71 #include "lwpobjstrm.hxx"
72 #include "lwpobjid.hxx"
73 #include "lwpdlvlist.hxx"
74 #include "lwpfilehdr.hxx"
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"
86 #define FIRST_LAYOUTPAGENO 0x0001
87 #define LAST_LAYOUTPAGENO 0xffff
89 #define LAY_BUOYNEUTRAL 0x02
90 #define LAY_BUOYLAYER 0x80
93 class LwpVirtualLayout
: public LwpDLNFPVList
96 LwpVirtualLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
97 virtual ~LwpVirtualLayout(){}
98 virtual bool MarginsSameAsParent();
99 inline virtual sal_uInt16
GetNumCols(){return 1;}
100 virtual double GetColWidth(sal_uInt16 nIndex
);
101 virtual double GetColGap(sal_uInt16 nIndex
);
102 virtual double GetMarginsValue(const sal_uInt8
& /*nWhichSide*/){return 0;}
103 virtual double GetExtMarginsValue(const sal_uInt8
& /*nWhichSide*/){return 0;}
104 virtual bool IsAutoGrow(){ return false;}
105 virtual bool IsAutoGrowUp(){ return false;}
106 virtual bool IsAutoGrowDown(){ return false;}
107 virtual bool IsAutoGrowLeft(){ return false;}
108 virtual bool IsAutoGrowRight(){ return false;}
109 virtual bool IsFitGraphic();
110 virtual bool IsAutoGrowWidth();
111 virtual bool IsInlineToMargin();
112 virtual sal_uInt8
GetContentOrientation(){ return TEXT_ORIENT_LRTB
;}
113 virtual bool HonorProtection();
114 virtual bool IsProtected();
115 virtual bool HasProtection();
116 virtual OUString
GetStyleName(){ return m_StyleName
;}
117 virtual bool IsComplex();
118 virtual bool IsAnchorPage(){ return false;}
119 virtual bool IsAnchorFrame(){ return false;}
120 virtual bool IsAnchorCell(){ return false;}
121 virtual bool IsPage();
122 virtual bool IsHeader();
123 virtual bool IsFooter();
124 virtual bool IsFrame();
125 virtual bool IsCell();
126 virtual bool IsSuperTable();
127 virtual bool IsGroupHead();
128 virtual sal_uInt8
GetRelativeType();
129 virtual bool IsRelativeAnchored();
130 virtual LwpUseWhen
* GetUseWhen();
131 virtual LwpUseWhen
* VirtualGetUseWhen(){ return NULL
;}
132 virtual bool IsUseOnAllPages(){ return false;}
133 virtual bool IsUseOnAllEvenPages(){ return false;}
134 virtual bool IsUseOnAllOddPages(){ return false;}
135 virtual bool IsUseOnPage(){ return false;}
136 virtual sal_Int32
GetPageNumber(sal_uInt16
/*nLayoutNumber*/ = 0){ return -1;}
137 virtual bool IsMinimumHeight();
138 virtual bool IsForWaterMark(){ return false;}
139 virtual LwpPara
* GetLastParaOfPreviousStory() { return NULL
; }
140 virtual LwpVirtualLayout
* GetParentLayout();
141 virtual LwpVirtualLayout
* GetContainerLayout(){ return NULL
;}
142 virtual void RegisterChildStyle();
143 virtual bool NoContentReference();
144 virtual bool IsStyleLayout();
145 virtual enumXFAlignType
GetVerticalAlignmentType()
147 if (m_nAttributes
& STYLE_CENTEREDVERTICALLY
)
149 return enumXFAlignMiddle
;
151 else if (m_nAttributes
& STYLE_BOTTOMALIGNED
)
153 return enumXFAlignBottom
;
155 return enumXFAlignTop
;
157 virtual void SetStyleName(const OUString
& str
){ m_StyleName
= str
;}
158 virtual double GetWidth(){return -1;}
160 //Check whether there are contents in the layout
161 virtual bool HasContent(){return false;}
164 void Read() SAL_OVERRIDE
;
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
;
183 LWP_SUPERTABLE_LAYOUT
,
188 LWP_CONNECTED_CELL_LAYOUT
,
189 LWP_HIDDEN_CELL_LAYOUT
,
190 LWP_TABLE_HEADING_LAYOUT
,
191 LWP_ROW_HEADING_LAYOUT
,
194 LWP_TOC_SUPERTABLE_LAYOUT
,
196 LWP_FOOTNOTE_ROW_LAYOUT
,
197 LWP_FOOTNOTE_CELL_LAYOUT
,
199 LWP_ENDNOTE_SUPERTABLE_LAYOUT
,
200 LWP_FOOTNOTE_SUPERTABLE_LAYOUT
,
202 LWP_NOTEHEADER_LAYOUT
,
208 LAY_USEDIRECTION
= 0x01,
211 LAY_TOCONTAINER
= 0x08,
212 LAY_DIRALLBITS
= 0x0f
214 enum {SHIFT_UP
= 0, SHIFT_DOWN
= 4, SHIFT_LEFT
= 8, SHIFT_RIGHT
=12};
216 virtual LWP_LAYOUT_TYPE
GetLayoutType () { return LWP_VIRTUAL_LAYOUT
;}
217 virtual LwpVirtualLayout
* FindChildByType(LWP_LAYOUT_TYPE eType
);
220 class LwpAssociatedLayouts
223 LwpAssociatedLayouts(){}
225 void Read(LwpObjectStream
* pStrm
);
226 LwpObjectID
* GetOnlyLayout(){return &m_OnlyLayout
;}
227 LwpDLVListHeadTail
* GetLayouts(){return &m_Layouts
;}
228 LwpVirtualLayout
* GetLayout(LwpVirtualLayout
* pStartLayout
);
230 LwpObjectID m_OnlyLayout
; //LwpVirtualLayout
231 LwpDLVListHeadTail m_Layouts
;
234 class LwpHeadLayout
: public LwpVirtualLayout
237 LwpHeadLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
238 virtual ~LwpHeadLayout(){}
239 void RegisterStyle() SAL_OVERRIDE
;
240 LwpVirtualLayout
* FindEnSuperTableLayout();
242 void Read() SAL_OVERRIDE
;
243 virtual LWP_LAYOUT_TYPE
GetLayoutType () SAL_OVERRIDE
{ return LWP_HEAD_LAYOUT
;}
250 virtual ~LwpLayoutStyle();
251 void Read(LwpObjectStream
* pStrm
);
253 sal_uInt32 m_nStyleDefinition
;
254 LwpAtomHolder
* m_pDescription
;
262 virtual ~LwpLayoutMisc();
263 void Read(LwpObjectStream
* pStrm
);
265 sal_Int32 m_nGridDistance
;
266 sal_uInt16 m_nGridType
;
267 LwpAtomHolder
* m_pContentStyle
;
270 #include "lwplaypiece.hxx"
272 class LwpMiddleLayout
: public LwpVirtualLayout
275 LwpMiddleLayout( LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
276 virtual ~LwpMiddleLayout();
277 virtual bool MarginsSameAsParent() SAL_OVERRIDE
;
278 virtual double GetMarginsValue(const sal_uInt8
& nWhichSide
) SAL_OVERRIDE
;
279 virtual double GetExtMarginsValue(const sal_uInt8
& nWhichSide
) SAL_OVERRIDE
;
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 bool IsAutoGrow() SAL_OVERRIDE
;
289 virtual bool IsAutoGrowUp() SAL_OVERRIDE
;
290 virtual bool IsAutoGrowDown() SAL_OVERRIDE
;
291 virtual bool IsAutoGrowLeft() SAL_OVERRIDE
;
292 virtual bool IsAutoGrowRight() SAL_OVERRIDE
;
293 virtual sal_uInt8
GetContentOrientation() SAL_OVERRIDE
;
294 virtual bool HonorProtection() SAL_OVERRIDE
;
295 virtual bool IsProtected() SAL_OVERRIDE
;
296 virtual LwpVirtualLayout
* GetWaterMarkLayout();
297 XFBGImage
* GetXFBGImage();
298 virtual bool GetUsePrinterSettings();
300 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);
308 bool CanSizeRight(void);
309 virtual double GetWidth() SAL_OVERRIDE
;
310 virtual sal_Int32
GetMinimumWidth();
311 bool IsSizeRightToContent(void);
312 bool IsSizeRightToContainer(void);
313 sal_Int32
DetermineWidth();
314 virtual double GetHeight();
315 virtual LwpPoint
GetOrigin();
317 bool IsPatternFill();
318 XFBGImage
* GetFillPattern();
320 //Check whether there are contents in the layout
321 virtual bool HasContent() SAL_OVERRIDE
;
325 void Read() SAL_OVERRIDE
;
329 DISK_GOT_STYLE_STUFF
= 0x01,
330 DISK_GOT_MISC_STUFF
= 0x02
333 LwpObjectID m_Content
;
334 LwpObjectID m_BasedOnStyle
;
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
;
346 LwpObjectID
* GetContent(){return &m_Content
;}
347 LwpTabOverride
* GetTabOverride();
350 class LwpLayout
: public LwpMiddleLayout
353 LwpLayout( LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
354 virtual ~LwpLayout();
355 XFColumns
* GetXFColumns();
356 XFColumnSep
* GetColumnSep();
357 LwpShadow
* GetShadow();
358 XFShadow
* GetXFShadow();
360 void Read() SAL_OVERRIDE
;
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
;
371 LwpUseWhen
* VirtualGetUseWhen() SAL_OVERRIDE
;
372 virtual sal_uInt16
GetNumCols() SAL_OVERRIDE
;
373 virtual double GetColWidth(sal_uInt16 nIndex
) SAL_OVERRIDE
;
374 virtual double GetColGap(sal_uInt16 nIndex
) SAL_OVERRIDE
;
375 virtual sal_uInt16
GetUsePage();
386 virtual UseWhenType
GetUseWhenType();
387 virtual bool IsUseOnAllPages() SAL_OVERRIDE
;
388 virtual bool IsUseOnAllEvenPages() SAL_OVERRIDE
;
389 virtual bool IsUseOnAllOddPages() SAL_OVERRIDE
;
390 virtual bool IsUseOnPage() SAL_OVERRIDE
;
391 LwpObjectID
* GetPosition(){ return &m_Positon
;}
392 virtual LwpVirtualLayout
* GetContainerLayout() SAL_OVERRIDE
;
396 class LwpPlacableLayout
: public LwpLayout
399 LwpPlacableLayout( LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
400 virtual ~LwpPlacableLayout();
401 virtual sal_uInt8
GetWrapType();
402 virtual LwpLayoutRelativity
* GetRelativityPiece();
403 virtual sal_uInt8
GetRelativeType() SAL_OVERRIDE
;
404 virtual sal_Int32
GetBaseLineOffset();
405 virtual bool IsAnchorPage() SAL_OVERRIDE
;
406 virtual bool IsAnchorFrame() SAL_OVERRIDE
;
407 virtual bool IsAnchorCell() SAL_OVERRIDE
;
408 virtual void XFConvertFrame(XFContentContainer
* /*pCont*/, sal_Int32
/*nStart*/ = 0, sal_Int32
/*nEnd*/ = 0, bool /*bAll*/ = false) {}
410 void SetFont(XFFont
* pFont
);
421 LAY_WRAP_IRREG_RIGHT
,
422 LAY_WRAP_IRREG_BIGGEST
425 void Read() SAL_OVERRIDE
;
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
437 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */