update dev300-m58
[ooovba.git] / sw / source / filter / ww8 / WW8TableInfo.hxx
blobb5eee16dd6047cabc3331a86b567d80dee3eee85
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8TableInfo.hxx,v $
10 * $Revision: 1.1.2.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef WW8_TABLE_INFO_HXX
32 #define WW8_TABLE_INFO_HXX
33 #include <hash_map>
34 #include <string>
35 #include <map>
36 #include <functional>
37 #include <boost/shared_ptr.hpp>
38 #include <sal/types.h>
40 class SwTable;
41 class SwTableLine;
42 class SwTableBox;
43 class SwNode;
44 class SwWW8Writer;
46 namespace ww8
48 using namespace ::std;
50 class WW8TableNodeInfo;
52 class WW8TableNodeInfoInner
54 WW8TableNodeInfo * mpParent;
55 sal_uInt32 mnDepth;
56 sal_uInt32 mnCell;
57 sal_uInt32 mnRow;
58 bool mbEndOfLine;
59 bool mbEndOfCell;
60 const SwTableBox * mpTableBox;
61 const SwTable * mpTable;
63 public:
64 typedef boost::shared_ptr<WW8TableNodeInfoInner> Pointer_t;
66 WW8TableNodeInfoInner(WW8TableNodeInfo * pParent);
67 ~WW8TableNodeInfoInner();
69 void setDepth(sal_uInt32 nDepth);
70 void setCell(sal_uInt32 nCell);
71 void setRow(sal_uInt32 nRow);
72 void setEndOfLine(bool bEndOfLine);
73 void setEndOfCell(bool bEndOfCell);
74 void setTableBox(const SwTableBox * pTableBox);
75 void setTable(const SwTable * pTable);
77 sal_uInt32 getDepth() const;
78 sal_uInt32 getCell() const;
79 sal_uInt32 getRow() const;
80 bool isEndOfCell() const;
81 bool isEndOfLine() const;
82 const SwTableBox * getTableBox() const;
83 const SwTable * getTable() const;
85 const SwNode * getNode() const;
87 string toString() const;
90 class WW8TableNodeInfo
92 public:
93 typedef map<sal_uInt32, WW8TableNodeInfoInner::Pointer_t, greater<sal_uInt32> > Inners_t;
95 private:
96 sal_uInt32 mnDepth;
97 const SwNode * mpNode;
98 Inners_t mInners;
99 WW8TableNodeInfo * mpNext;
101 public:
102 typedef boost::shared_ptr<WW8TableNodeInfo> Pointer_t;
104 WW8TableNodeInfo(const SwNode * pTxtNode);
105 virtual ~WW8TableNodeInfo();
107 void setDepth(sal_uInt32 nDepth);
108 void setEndOfLine(bool bEndOfLine);
109 void setEndOfCell(bool bEndOfCell);
110 void setTableBox(const SwTableBox *pTableBox);
111 void setTable(const SwTable * pTable);
112 void setCell(sal_uInt32 nCell);
113 void setRow(sal_uInt32 nRow);
114 void setNext(WW8TableNodeInfo * pNext);
116 sal_uInt32 getDepth() const;
117 bool isEndOfLine() const;
118 bool isEndOfCell() const;
119 const SwNode * getNode() const;
120 const SwTableBox * getTableBox() const;
121 const SwTable * getTable() const;
122 WW8TableNodeInfo * getNext() const;
124 const Inners_t & getInners() const;
125 const WW8TableNodeInfoInner::Pointer_t getFirstInner() const;
126 const WW8TableNodeInfoInner::Pointer_t getInnerForDepth(sal_uInt32 nDepth) const;
128 sal_uInt32 getCell() const;
129 sal_uInt32 getRow() const;
131 ::std::string toString() const;
134 struct hashNode
136 size_t operator()(const SwNode * pNode) const
137 { return reinterpret_cast<size_t>(pNode); }
140 class WW8TableInfo
142 typedef hash_map<const SwNode *, WW8TableNodeInfo::Pointer_t, hashNode > Map_t;
143 Map_t mMap;
145 WW8TableNodeInfo *
146 processTableLine(const SwTable * pTable,
147 const SwTableLine * pTableLine,
148 sal_uInt32 nRow,
149 sal_uInt32 nDepth, WW8TableNodeInfo * pPrev);
151 WW8TableNodeInfo *
152 processTableBox(const SwTable * pTable,
153 const SwTableBox * pTableBox,
154 sal_uInt32 nRow,
155 sal_uInt32 nCell,
156 sal_uInt32 nDepth, bool bEndOfLine, WW8TableNodeInfo * pPrev);
158 WW8TableNodeInfo::Pointer_t
159 processTableBoxLines(const SwTableBox * pBox,
160 const SwTable * pTable,
161 const SwTableBox * pBoxToSet,
162 sal_uInt32 nRow,
163 sal_uInt32 nCell,
164 sal_uInt32 nDepth);
166 WW8TableNodeInfo::Pointer_t
167 insertTableNodeInfo(const SwNode * pNode,
168 const SwTable * pTable,
169 const SwTableBox * pTableBox,
170 sal_uInt32 nRow,
171 sal_uInt32 nCell,
172 sal_uInt32 nDepth);
174 public:
175 typedef boost::shared_ptr<WW8TableInfo> Pointer_t;
177 WW8TableInfo();
178 virtual ~WW8TableInfo();
180 void processSwTable(const SwTable * pTable);
181 WW8TableNodeInfo::Pointer_t getTableNodeInfo(const SwNode * pNode);
182 const SwNode * getNextNode(const SwNode * pNode);
186 #endif // WW8_TABLE_INFO_HXX