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 ************************************************************************/
58 * For LWP filter architecture prototype - table layouts
60 /*************************************************************************
63 ************************************************************************/
64 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
65 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
68 #include "lwplayout.hxx"
75 class LwpSuperTableLayout
;
78 class LwpTableHeadingLayout
;
79 class LwpRowHeadingLayout
;
80 class LwpConnectedCellLayout
;
81 class LwpColumnLayout
;
85 * VO_TABLELAYOUT object and functions for registering styles and coverting tables
87 class LwpTableLayout
: public LwpLayout
90 LwpTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
91 virtual ~LwpTableLayout();
92 virtual LWP_LAYOUT_TYPE
GetLayoutType () SAL_OVERRIDE
{ return LWP_TABLE_LAYOUT
;}
93 LwpObjectID
& GetColumnLayoutHead(){return m_ColumnLayout
;}
94 void RegisterStyle() SAL_OVERRIDE
;
95 LwpTable
* GetTable();
96 LwpCellLayout
* GetDefaultCellLayout(){return m_pDefaultCellLayout
;}
97 LwpSuperTableLayout
* GetSuperTableLayout();
98 LwpObjectID
* SearchCellStoryMap(sal_uInt16 nRow
, sal_uInt16 nCol
);
99 LwpCellLayout
* GetCellByRowCol(sal_uInt16 nRow
, sal_uInt16 nCol
);
100 OUString
GetColumnWidth(sal_uInt16 nCol
);
101 void SetWordProCellMap(sal_uInt16 nRow
, sal_uInt16 nCol
, LwpCellLayout
* pCell
)
103 if (nRow
>= m_nRows
|| nCol
>= m_nCols
)
105 m_WordProCellsMap
[static_cast<size_t>(nRow
) * m_nCols
+ nCol
] = pCell
;
108 void Read() SAL_OVERRIDE
;
109 void TraverseTable();
110 void RegisterColumns();
113 void PostProcessParagraph(XFCell
*pCell
, sal_uInt16 nRowID
, sal_uInt16 nColID
);
119 //CColumnLayoutHead cColumnLayout;
120 LwpObjectID m_ColumnLayout
;
121 LwpCellLayout
* m_pDefaultCellLayout
;
122 OUString m_DefaultColumnStyleName
;
123 OUString m_DefaultRowStyleName
;
126 std::vector
<LwpCellLayout
*> m_WordProCellsMap
;
128 LwpColumnLayout
** m_pColumns
;
131 void XFConvert(XFContentContainer
* pCont
) SAL_OVERRIDE
;
132 void ConvertTable(XFTable
* pXFTable
,sal_uInt16 nStartRow
,
133 sal_uInt16 nEndRow
,sal_uInt8 nStartCol
,sal_uInt8 nEndCol
);
134 OUString
GetDefaultRowStyleName(){return m_DefaultRowStyleName
;}
135 void SetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
,XFCell
* pXFCell
);
136 XFCell
* GetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
);
137 std::map
<sal_uInt16
,LwpRowLayout
*> GetRowsMap(){return m_RowsMap
;}
138 LwpRowLayout
* GetRowLayout(sal_uInt16 nRow
);
140 void ConvertDefaultRow(XFTable
* pXFTable
,sal_uInt8 nStartCol
,
141 sal_uInt8 nEndCol
,sal_uInt16 nRowID
);
142 void ConvertColumn(XFTable
*pXFTable
,sal_uInt8 nStartCol
,sal_uInt8 nEndCol
);
143 sal_uInt16
ConvertHeadingRow(XFTable
* pXFTable
,sal_uInt16 nStartHeadRow
,sal_uInt16 nEndHeadRow
);
144 static bool FindSplitColMark(XFTable
* pXFTable
,sal_uInt8
* pCellMark
,sal_uInt8
& nMaxColSpan
);
145 void SplitRowToCells(XFTable
* pTmpTable
,XFTable
* pXFTable
,
146 sal_uInt8 nFirstColSpann
,sal_uInt8
* pCellMark
);
148 std::map
<sal_uInt16
,LwpRowLayout
*> m_RowsMap
;
149 void SplitConflictCells();
151 std::map
<std::pair
<sal_uInt16
,sal_uInt8
>,XFCell
*> m_CellsMap
;
153 void PutCellVals(LwpFoundry
* pFoundry
, LwpObjectID aTableID
);
157 * VO_SUPERTABLELAYOUT object
159 class LwpSuperTableLayout
: public LwpPlacableLayout
162 LwpSuperTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
163 virtual ~LwpSuperTableLayout();
164 virtual LWP_LAYOUT_TYPE
GetLayoutType () SAL_OVERRIDE
{ return LWP_SUPERTABLE_LAYOUT
;}
165 void RegisterNewStyle();
167 // add by , 06/03/2005
168 void ApplyPatternFill(XFTableStyle
* pTableStyle
);
169 void ApplyBackGround(XFTableStyle
* pTableStyle
);
172 void ApplyBackColor(XFTableStyle
*pTableStyle
);
173 void ApplyShadow(XFTableStyle
*pTableStyle
);
174 double GetWidth() SAL_OVERRIDE
;
175 double GetTableWidth();
176 void ApplyWatermark(XFTableStyle
*pTableStyle
);
177 void ApplyAlignment(XFTableStyle
* pTableStyle
);
178 void XFConvert(XFContentContainer
* pCont
) SAL_OVERRIDE
;
180 virtual void XFConvertFrame(XFContentContainer
* pCont
, sal_Int32 nStart
= 0, sal_Int32 nEnd
= 0, bool bAll
= false) SAL_OVERRIDE
;
181 void RegisterFrameStyle();
182 LwpTableHeadingLayout
* GetTableHeadingLayout();
184 void Read() SAL_OVERRIDE
;
185 LwpTableLayout
* GetTableLayout();
186 bool IsSizeRightToContent();
187 bool IsJustifiable();
194 * VO_COLUMNLAYOUT object
196 class LwpColumnLayout
: public LwpVirtualLayout
199 LwpColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
200 virtual ~LwpColumnLayout();
201 virtual LWP_LAYOUT_TYPE
GetLayoutType () SAL_OVERRIDE
{ return LWP_COLUMN_LAYOUT
;}
202 sal_uInt32
GetColumnID(){return ccolid
;}
203 double GetWidth() SAL_OVERRIDE
{return LwpTools::ConvertFromUnitsToMetric(cwidth
);}
204 using LwpVirtualLayout::RegisterStyle
;
205 void RegisterStyle(double dCalculatedWidth
);
206 bool IsJustifiable(){return (( m_nAttributes2
& STYLE2_JUSTIFIABLE
) != 0);}
208 void Read() SAL_OVERRIDE
;
215 * VO_TABLEHEADINGLAYOUT object
217 class LwpTableHeadingLayout
: public LwpTableLayout
220 LwpTableHeadingLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
221 virtual ~LwpTableHeadingLayout();
222 virtual LWP_LAYOUT_TYPE
GetLayoutType () SAL_OVERRIDE
{ return LWP_TABLE_HEADING_LAYOUT
;}
223 void GetStartEndRow(sal_uInt16
& nStartRow
, sal_uInt16
& nEndRow
);
224 LwpRowHeadingLayout
* GetFirstRowHeadingLayout();
226 void Read() SAL_OVERRIDE
;
227 sal_uInt16 cStartRow
;
232 * VO_SUPERPARALLELCOLUMNLAYOUT object
234 class LwpSuperParallelColumnLayout
: public LwpSuperTableLayout
237 LwpSuperParallelColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
238 virtual ~LwpSuperParallelColumnLayout();
240 void Read() SAL_OVERRIDE
;
245 * VO_PCOLLAYOUT object
247 class LwpParallelColumnsLayout
: public LwpTableLayout
250 LwpParallelColumnsLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
251 virtual ~LwpParallelColumnsLayout();
253 void Read() SAL_OVERRIDE
;
256 class LwpSuperGlossaryLayout
: public LwpSuperTableLayout
259 LwpSuperGlossaryLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
260 virtual ~LwpSuperGlossaryLayout();
262 void Read() SAL_OVERRIDE
;
265 #include "lwpcelllayout.hxx"
266 #include "lwprowlayout.hxx"
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */