cid#1606759 Data race condition
[LibreOffice.git] / lotuswordpro / source / filter / lwpcelllayout.hxx
blob72aad7b4136f1bab822c8596dfd550d9e024dcdc
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,
29 * MA 02111-1307 USA
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 /**
57 * @file
58 * For LWP filter architecture prototype - cell layouts
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCELLLAYOUT_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPCELLLAYOUT_HXX
64 #include "lwplayout.hxx"
65 #include <xfilter/xfcell.hxx>
67 typedef enum
69 enumWholeBorder = 0,
70 enumNoLeftBorder,
71 enumNoBottomBorder,
72 enumNoLeftNoBottomBorder,
73 enumCellBorderTopLimit = 4,
74 } LwpCellBorderType;
76 class XFCell;
77 class XFCellStyle;
78 class LwpCellList;
79 class LwpTable;
80 class LwpTableLayout;
81 /**
82 * @brief
83 * VO_CELLLAYOUT object
85 class LwpCellLayout : public LwpMiddleLayout
87 public:
88 LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
89 virtual ~LwpCellLayout() override;
90 virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;}
91 rtl::Reference<XFCell> DoConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
93 if (m_bConvertCell)
94 throw std::runtime_error("recursion in page divisions");
95 m_bConvertCell = true;
96 rtl::Reference<XFCell> aRet = ConvertCell(aTableID, nRow, nCol);
97 m_bConvertCell = false;
98 return aRet;
100 sal_uInt16 GetRowID() const {return crowid;}
101 sal_uInt8 GetColID() const {return ccolid;}
102 void RegisterStyle() override;
103 LwpObjectID& GetNumericsObject() {return cLayNumerics;}
104 LwpObjectID * GetPreviousCellStory();
105 virtual LwpPara* GetLastParaOfPreviousStory() override;
106 LwpTableLayout * GetTableLayout();
107 virtual void SetCellMap();
108 double GetActualWidth();
109 const OUString& GetNumfmtName() const {return m_NumfmtName;}
110 protected:
111 void Read() override;
112 LwpTable * GetTable();
113 void ApplyPadding(XFCellStyle* pCellStyle);
114 void ApplyBorders(XFCellStyle* pCellStyle);
115 void ApplyPatternFill(XFCellStyle* pCellStyle);
116 void ApplyBackGround(XFCellStyle* pCellStyle);
117 void ApplyBackColor(XFCellStyle* pCellStyle);
118 void ApplyWatermark(XFCellStyle* pCellStyle);
119 void ApplyProtect(XFCell * pCell, LwpObjectID aTableID);
120 void ApplyFmtStyle(XFCellStyle *pCellStyle);
121 OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
122 void RegisterDefaultCell();
123 virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
124 virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
125 static LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
126 static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
127 virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; };
129 bool m_bConvertCell;
130 sal_uInt16 crowid;
131 sal_uInt8 ccolid;
132 LwpObjectID cLayNumerics;
133 LwpObjectID cLayDiagonalLine;
135 enum LeaderDotType
137 LDT_NONE = 0,
138 LDT_DOTS = 1,
139 LDT_DASHES = 2,
140 LDT_UNDERSCORES = 3
142 LeaderDotType cType;
143 OUString m_CellStyleNames[enumCellBorderTopLimit];
145 OUString m_NumfmtName;//Add to support number color
149 * @brief
150 * VO_HIDDENCELLLAYOUT object
152 class LwpHiddenCellLayout final : public LwpCellLayout
154 public:
155 LwpHiddenCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
156 virtual ~LwpHiddenCellLayout() override;
157 virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;}
158 virtual void Parse(IXFStream* pOutputStream) override;
159 void RegisterStyle() override {}
160 virtual void SetCellMap() override;
161 private:
162 void Read() override;
163 virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
164 LwpObjectID cconnectedlayout;
168 * @brief
169 * VO_CONNECTEDCELLLAYOUT object
171 class LwpConnectedCellLayout : public LwpCellLayout
173 public:
174 LwpConnectedCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
175 virtual ~LwpConnectedCellLayout() override;
176 virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;}
177 virtual void Parse(IXFStream* pOutputStream) override;
178 sal_uInt16 GetNumrows() const {return m_nRealrowspan;}
179 sal_uInt8 GetNumcols() const {return m_nRealcolspan;}
180 virtual void SetCellMap() override;
181 void SetNumrows(sal_uInt16 nVal){m_nRealrowspan = nVal;}
182 protected:
183 void Read() override;
184 virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow) override {return nRow + m_nRealrowspan; };
185 virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout) override;
186 virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
187 private:
188 sal_uInt16 cnumrows;
189 sal_uInt8 cnumcols;
190 sal_uInt16 m_nRealrowspan;
191 sal_uInt8 m_nRealcolspan;
194 * @brief
195 * VO_PCOLBLOCK object
198 class LwpParallelColumnsBlock : public LwpCellLayout
200 public:
201 LwpParallelColumnsBlock(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
202 virtual ~LwpParallelColumnsBlock() override;
203 protected:
204 void Read() override;
208 #endif
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */