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,
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 ************************************************************************/
57 * For LWP filter architecture prototype - table layouts
59 /*************************************************************************
62 ************************************************************************/
63 #ifndef _LWPTABLELAYOUT_HXX
64 #define _LWPTABLELAYOUT_HXX
67 #include "lwplayout.hxx"
74 class LwpSuperTableLayout
;
77 class LwpTableHeadingLayout
;
78 class LwpRowHeadingLayout
;
79 class LwpConnectedCellLayout
;
80 class LwpColumnLayout
;
84 * VO_TABLELAYOUT object and functions for registering styles and coverting tables
86 class LwpTableLayout
: public LwpLayout
89 LwpTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
90 virtual ~LwpTableLayout();
91 virtual LWP_LAYOUT_TYPE
GetLayoutType () { return LWP_TABLE_LAYOUT
;}
92 LwpObjectID
* GetColumnLayoutHead(){return &m_ColumnLayout
;};
94 LwpTable
* GetTable();
95 LwpCellLayout
* GetDefaultCellLayout(){return m_pDefaultCellLayout
;};
96 LwpSuperTableLayout
* GetSuperTableLayout();
97 LwpObjectID
* SearchCellStoryMap(sal_uInt16 nRow
, sal_uInt16 nCol
);
98 LwpCellLayout
* GetCellByRowCol(sal_uInt16 nRow
, sal_uInt16 nCol
);
99 OUString
GetColumnWidth(sal_uInt16 nCol
);
100 void SetWordProCellMap(sal_uInt16 nRow
, sal_uInt16 nCol
, LwpCellLayout
* pCell
)
102 if (nRow
>= m_nRows
|| nCol
>= m_nCols
)
104 m_WordProCellsMap
[nRow
* m_nCols
+ nCol
] = pCell
;
108 void TraverseTable();
109 void RegisterColumns();
112 void PostProcessParagraph(XFCell
*pCell
, sal_uInt16 nRowID
, sal_uInt16 nColID
);
118 //CColumnLayoutHead cColumnLayout;
119 LwpObjectID m_ColumnLayout
;
120 OUString m_FrameStyleName
;
121 LwpCellLayout
* m_pDefaultCellLayout
;
122 OUString m_DefaultColumnStyleName
;
123 OUString m_DefaultRowStyleName
;
126 std::vector
<LwpCellLayout
*> m_WordProCellsMap
;
128 LwpColumnLayout
** m_pColumns
;
132 void XFConvert(XFContentContainer
* pCont
);
133 void ConvertTable(XFTable
* pXFTable
,sal_uInt16 nStartRow
,
134 sal_uInt16 nEndRow
,sal_uInt8 nStartCol
,sal_uInt8 nEndCol
);
135 OUString
GetDefaultRowStyleName(){return m_DefaultRowStyleName
;}
136 void SetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
,XFCell
* pXFCell
);
137 XFCell
* GetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
);
138 std::map
<sal_uInt16
,LwpRowLayout
*> GetRowsMap(){return m_RowsMap
;}
139 LwpRowLayout
* GetRowLayout(sal_uInt16 nRow
);
141 void ConvertDefaultRow(XFTable
* pXFTable
,sal_uInt8 nStartCol
,
142 sal_uInt8 nEndCol
,sal_uInt16 nRowID
);
143 void ConvertColumn(XFTable
*pXFTable
,sal_uInt8 nStartCol
,sal_uInt8 nEndCol
);
144 sal_uInt16
ConvertHeadingRow(XFTable
* pXFTable
,sal_uInt16 nStartHeadRow
,sal_uInt16 nEndHeadRow
);
145 sal_Bool
FindSplitColMark(XFTable
* pXFTable
,sal_uInt8
* pCellMark
,sal_uInt8
& nMaxColSpan
);
146 void SplitRowToCells(XFTable
* pTmpTable
,XFTable
* pXFTable
,
147 sal_uInt8 nFirstColSpann
,sal_uInt8
* pCellMark
);
149 std::map
<sal_uInt16
,LwpRowLayout
*> m_RowsMap
;
150 void SplitConflictCells();
152 std::map
<std::pair
<sal_uInt16
,sal_uInt8
>,XFCell
*> m_CellsMap
;
154 void PutCellVals(LwpFoundry
* pFoundry
, LwpObjectID aTableID
);
158 * VO_SUPERTABLELAYOUT object
160 class LwpSuperTableLayout
: public LwpPlacableLayout
163 LwpSuperTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
164 virtual ~LwpSuperTableLayout();
165 virtual LWP_LAYOUT_TYPE
GetLayoutType () { return LWP_SUPERTABLE_LAYOUT
;}
166 void RegisterStyle();
168 // add by , 06/03/2005
169 void ApplyPatternFill(XFTableStyle
* pTableStyle
);
170 void ApplyBackGround(XFTableStyle
* pTableStyle
);
173 void ApplyBackColor(XFTableStyle
*pTableStyle
);
174 void ApplyShadow(XFTableStyle
*pTableStyle
);
176 double GetTableWidth();
177 void ApplyWatermark(XFTableStyle
*pTableStyle
);
178 void ApplyAlignment(XFTableStyle
* pTableStyle
);
179 void XFConvert(XFContentContainer
* pCont
);
181 virtual void XFConvertFrame(XFContentContainer
* pCont
, sal_Int32 nStart
= 0, sal_Int32 nEnd
= 0, sal_Bool bAll
= sal_False
);
182 void ParseFrame(XFFrame
* pXFFrame
);
183 void RegisterFrameStyle();
184 LwpTableHeadingLayout
* GetTableHeadingLayout();
187 LwpTableLayout
* GetTableLayout();
188 sal_Bool
IsSizeRightToContent();
189 sal_Bool
IsJustifiable();
196 * VO_COLUMNLAYOUT object
198 class LwpColumnLayout
: public LwpVirtualLayout
201 LwpColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
202 virtual ~LwpColumnLayout();
203 virtual LWP_LAYOUT_TYPE
GetLayoutType () { return LWP_COLUMN_LAYOUT
;}
204 sal_uInt32
GetColumnID(){return ccolid
;};
205 double GetWidth(){return LwpTools::ConvertFromUnitsToMetric(cwidth
);};
206 void RegisterStyle(double dCalculatedWidth
);
207 sal_Bool
IsJustifiable(){return (( m_nAttributes2
& STYLE2_JUSTIFIABLE
) != 0);};
216 * VO_TABLEHEADINGLAYOUT object
218 class LwpTableHeadingLayout
: public LwpTableLayout
221 LwpTableHeadingLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
222 virtual ~LwpTableHeadingLayout();
223 virtual LWP_LAYOUT_TYPE
GetLayoutType () { return LWP_TABLE_HEADING_LAYOUT
;}
224 void GetStartEndRow(sal_uInt16
& nStartRow
, sal_uInt16
& nEndRow
);
225 LwpRowHeadingLayout
* GetFirstRowHeadingLayout();
228 sal_uInt16 cStartRow
;
233 * VO_SUPERPARALLELCOLUMNLAYOUT object
235 class LwpSuperParallelColumnLayout
: public LwpSuperTableLayout
238 LwpSuperParallelColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
239 virtual ~LwpSuperParallelColumnLayout();
246 * VO_PCOLLAYOUT object
248 class LwpParallelColumnsLayout
: public LwpTableLayout
251 LwpParallelColumnsLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
252 virtual ~LwpParallelColumnsLayout();
257 class LwpSuperGlossaryLayout
: public LwpSuperTableLayout
260 LwpSuperGlossaryLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
261 virtual ~LwpSuperGlossaryLayout();
266 #include "lwpcelllayout.hxx"
267 #include "lwprowlayout.hxx"