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
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPTABLELAYOUT_HXX
66 #include "lwplayout.hxx"
73 class LwpSuperTableLayout
;
76 class LwpTableHeadingLayout
;
77 class LwpRowHeadingLayout
;
78 class LwpConnectedCellLayout
;
79 class LwpColumnLayout
;
83 * VO_TABLELAYOUT object and functions for registering styles and converting tables
85 class LwpTableLayout
: public LwpLayout
88 LwpTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
89 virtual ~LwpTableLayout() override
;
90 virtual LWP_LAYOUT_TYPE
GetLayoutType () override
{ return LWP_TABLE_LAYOUT
;}
91 LwpObjectID
& GetColumnLayoutHead(){return m_ColumnLayout
;}
92 void RegisterStyle() override
;
93 LwpTable
* GetTable();
94 LwpCellLayout
* GetDefaultCellLayout(){return m_pDefaultCellLayout
;}
95 LwpSuperTableLayout
* GetSuperTableLayout();
96 LwpObjectID
* SearchCellStoryMap(sal_uInt16 nRow
, sal_uInt16 nCol
);
97 LwpCellLayout
* GetCellByRowCol(sal_uInt16 nRow
, sal_uInt16 nCol
);
98 OUString
GetColumnWidth(sal_uInt16 nCol
);
99 void SetWordProCellMap(sal_uInt16 nRow
, sal_uInt16 nCol
, LwpCellLayout
* pCell
)
101 if (nRow
>= m_nRows
|| nCol
>= m_nCols
)
103 m_WordProCellsMap
[static_cast<size_t>(nRow
) * m_nCols
+ nCol
] = pCell
;
106 void Read() override
;
107 void TraverseTable();
108 void RegisterColumns();
111 void PostProcessParagraph(XFCell
*pCell
, sal_uInt16 nRowID
, sal_uInt16 nColID
);
117 //CColumnLayoutHead cColumnLayout;
118 LwpObjectID m_ColumnLayout
;
119 LwpCellLayout
* m_pDefaultCellLayout
;
120 OUString m_DefaultColumnStyleName
;
121 OUString m_DefaultRowStyleName
;
124 std::vector
<LwpCellLayout
*> m_WordProCellsMap
;
126 LwpColumnLayout
** m_pColumns
;
129 void XFConvert(XFContentContainer
* pCont
) override
;
130 void ConvertTable(rtl::Reference
<XFTable
> const & pXFTable
, sal_uInt16 nStartRow
,
131 sal_uInt16 nEndRow
,sal_uInt8 nStartCol
,sal_uInt8 nEndCol
);
132 const OUString
& GetDefaultRowStyleName(){return m_DefaultRowStyleName
;}
133 void SetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
,XFCell
* pXFCell
);
134 XFCell
* GetCellsMap(sal_uInt16 nRow
,sal_uInt8 nCol
);
135 const std::map
<sal_uInt16
,LwpRowLayout
*>& GetRowsMap(){return m_RowsMap
;}
136 LwpRowLayout
* GetRowLayout(sal_uInt16 nRow
);
138 void ConvertDefaultRow(rtl::Reference
<XFTable
> const & pXFTable
, sal_uInt8 nStartCol
,
139 sal_uInt8 nEndCol
, sal_uInt16 nRowID
);
140 void ConvertColumn(rtl::Reference
<XFTable
> const & pXFTable
, sal_uInt8 nStartCol
, sal_uInt8 nEndCol
);
141 sal_uInt16
ConvertHeadingRow(rtl::Reference
<XFTable
> const & pXFTable
,sal_uInt16 nStartHeadRow
,sal_uInt16 nEndHeadRow
);
142 static bool FindSplitColMark(XFTable
* pXFTable
,sal_uInt8
* pCellMark
,sal_uInt8
& nMaxColSpan
);
143 void SplitRowToCells(XFTable
* pTmpTable
, rtl::Reference
<XFTable
> const & pXFTable
,
144 sal_uInt8 nFirstColSpann
,sal_uInt8
* pCellMark
);
146 std::map
<sal_uInt16
,LwpRowLayout
*> m_RowsMap
;
147 void SplitConflictCells();
148 rtl::Reference
<XFTable
> m_pXFTable
;
149 std::map
<std::pair
<sal_uInt16
,sal_uInt8
>,XFCell
*> m_CellsMap
;
151 void PutCellVals(LwpFoundry
* pFoundry
, LwpObjectID aTableID
);
155 * VO_SUPERTABLELAYOUT object
157 class LwpSuperTableLayout
: public LwpPlacableLayout
160 LwpSuperTableLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
161 virtual ~LwpSuperTableLayout() override
;
162 virtual LWP_LAYOUT_TYPE
GetLayoutType () override
{ return LWP_SUPERTABLE_LAYOUT
;}
163 void RegisterNewStyle();
165 void ApplyPatternFill(XFTableStyle
* pTableStyle
);
166 void ApplyBackGround(XFTableStyle
* pTableStyle
);
168 void ApplyBackColor(XFTableStyle
*pTableStyle
);
169 void ApplyShadow(XFTableStyle
*pTableStyle
);
170 double GetWidth() override
;
171 double GetTableWidth();
172 void ApplyWatermark(XFTableStyle
*pTableStyle
);
173 void ApplyAlignment(XFTableStyle
* pTableStyle
);
174 void XFConvert(XFContentContainer
* pCont
) override
;
176 virtual void XFConvertFrame(XFContentContainer
* pCont
, sal_Int32 nStart
= 0, sal_Int32 nEnd
= 0, bool bAll
= false) override
;
177 void RegisterFrameStyle();
178 LwpTableHeadingLayout
* GetTableHeadingLayout();
180 void Read() override
;
181 LwpTableLayout
* GetTableLayout();
182 bool IsSizeRightToContent();
183 bool IsJustifiable();
189 * VO_COLUMNLAYOUT object
191 class LwpColumnLayout
: public LwpVirtualLayout
194 LwpColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
195 virtual ~LwpColumnLayout() override
;
196 virtual LWP_LAYOUT_TYPE
GetLayoutType () override
{ return LWP_COLUMN_LAYOUT
;}
197 sal_uInt32
GetColumnID(){return ccolid
;}
198 double GetWidth() override
{return LwpTools::ConvertFromUnitsToMetric(cwidth
);}
199 using LwpVirtualLayout::RegisterStyle
;
200 void RegisterStyle(double dCalculatedWidth
);
201 bool IsJustifiable(){return (( m_nAttributes2
& STYLE2_JUSTIFIABLE
) != 0);}
203 void Read() override
;
210 * VO_TABLEHEADINGLAYOUT object
212 class LwpTableHeadingLayout
: public LwpTableLayout
215 LwpTableHeadingLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
216 virtual ~LwpTableHeadingLayout() override
;
217 virtual LWP_LAYOUT_TYPE
GetLayoutType () override
{ return LWP_TABLE_HEADING_LAYOUT
;}
218 void GetStartEndRow(sal_uInt16
& nStartRow
, sal_uInt16
& nEndRow
);
220 void Read() override
;
221 sal_uInt16 cStartRow
;
226 * VO_SUPERPARALLELCOLUMNLAYOUT object
228 class LwpSuperParallelColumnLayout
: public LwpSuperTableLayout
231 LwpSuperParallelColumnLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
232 virtual ~LwpSuperParallelColumnLayout() override
;
234 void Read() override
;
239 * VO_PCOLLAYOUT object
241 class LwpParallelColumnsLayout
: public LwpTableLayout
244 LwpParallelColumnsLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
245 virtual ~LwpParallelColumnsLayout() override
;
247 void Read() override
;
250 class LwpSuperGlossaryLayout
: public LwpSuperTableLayout
253 LwpSuperGlossaryLayout(LwpObjectHeader
&objHdr
, LwpSvStream
* pStrm
);
254 virtual ~LwpSuperGlossaryLayout() override
;
256 void Read() override
;
259 #include "lwpcelllayout.hxx"
260 #include "lwprowlayout.hxx"
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */