1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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
37 #include <boost/shared_ptr.hpp>
38 #include <sal/types.h>
48 using namespace ::std
;
50 class WW8TableNodeInfo
;
52 class WW8TableNodeInfoInner
54 WW8TableNodeInfo
* mpParent
;
60 const SwTableBox
* mpTableBox
;
61 const SwTable
* mpTable
;
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
93 typedef map
<sal_uInt32
, WW8TableNodeInfoInner::Pointer_t
, greater
<sal_uInt32
> > Inners_t
;
97 const SwNode
* mpNode
;
99 WW8TableNodeInfo
* mpNext
;
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;
136 size_t operator()(const SwNode
* pNode
) const
137 { return reinterpret_cast<size_t>(pNode
); }
142 typedef hash_map
<const SwNode
*, WW8TableNodeInfo::Pointer_t
, hashNode
> Map_t
;
146 processTableLine(const SwTable
* pTable
,
147 const SwTableLine
* pTableLine
,
149 sal_uInt32 nDepth
, WW8TableNodeInfo
* pPrev
);
152 processTableBox(const SwTable
* pTable
,
153 const SwTableBox
* pTableBox
,
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
,
166 WW8TableNodeInfo::Pointer_t
167 insertTableNodeInfo(const SwNode
* pNode
,
168 const SwTable
* pTable
,
169 const SwTableBox
* pTableBox
,
175 typedef boost::shared_ptr
<WW8TableInfo
> Pointer_t
;
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