Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
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
16 : *
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.
20 : *
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.
25 : *
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
30 : *
31 : *
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.
38 : *
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.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /*************************************************************************
57 : * @file
58 : * Table cell.
59 : ************************************************************************/
60 :
61 : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFCELL_HXX
62 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFCELL_HXX
63 :
64 : #include "xfcontent.hxx"
65 : #include "xfcontentcontainer.hxx"
66 : #include <vector>
67 :
68 : class XFTable;
69 : class XFRow;
70 :
71 : /**
72 : * @descr Table cell object.
73 : */
74 : class XFCell : public XFContentContainer
75 : {
76 : public:
77 : XFCell();
78 :
79 : virtual ~XFCell();
80 :
81 : public:
82 : using XFContentContainer::Add;
83 :
84 : /**
85 : * @descr Add content for table cell.
86 : */
87 : void Add(XFContent *pContent) SAL_OVERRIDE;
88 :
89 : /**
90 : * @descr If cell spans more the one column, then set column span.
91 : */
92 : void SetColumnSpaned(sal_Int32 num);
93 :
94 : /**
95 : * @descr Set whether the following cells use the same style and content.
96 : */
97 : void SetRepeated(sal_Int32 num);
98 :
99 : /**
100 : * @descr Set cell number value.
101 : */
102 : void SetValue(double value);
103 :
104 : /**
105 : * @descr Set cell number value.
106 : */
107 : void SetValue(const OUString& value);
108 :
109 : /**
110 : * @descr Set cell formula.
111 : */
112 : void SetFormula(const OUString& formula);
113 :
114 : /**
115 : * @descr Set cell protected.
116 : */
117 : void SetProtect(bool protect=true);
118 :
119 : /**
120 : * @descr Set cell column id.
121 : */
122 : void SetCol(sal_Int32 col);
123 :
124 : /**
125 : * @descr Set cell owner row.
126 : */
127 : void SetOwnerRow(XFRow *pRow);
128 :
129 : /**
130 : * @descr Return cell name. It's a tool function for formula.
131 : */
132 : OUString GetCellName();
133 :
134 : /**
135 : * @descr Return cell column id.
136 : */
137 : sal_Int32 GetCol();
138 :
139 : /**
140 : * @descr return cell'owner row.
141 : */
142 : XFRow* GetOwnerRow();
143 :
144 : /**
145 : * @descr If cell has a sub-table, return it, else return NULL.
146 : */
147 : XFTable* GetSubTable();
148 :
149 : /**
150 : * @descr return cell column span property.
151 : */
152 : sal_Int32 GetColSpaned();
153 :
154 : /**
155 : * @descr Output cell as xml element.
156 : */
157 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
158 :
159 : private:
160 : XFRow *m_pOwnerRow;
161 : XFTable *m_pSubTable;
162 : sal_Int32 m_nCol;
163 : sal_Int32 m_nColSpaned;
164 : sal_Int32 m_nRepeated;
165 : enumXFValueType m_eValueType;
166 : OUString m_strValue;
167 : OUString m_strFormula;
168 : bool m_bProtect;
169 : };
170 :
171 0 : inline void XFCell::SetColumnSpaned(sal_Int32 num)
172 : {
173 0 : m_nColSpaned = num;
174 0 : }
175 :
176 0 : inline void XFCell::SetRepeated(sal_Int32 repeated)
177 : {
178 0 : m_nRepeated = repeated;
179 0 : }
180 :
181 0 : inline void XFCell::SetFormula(const OUString& formula)
182 : {
183 0 : m_strFormula = formula;
184 0 : }
185 :
186 20 : inline void XFCell::SetProtect(bool protect/* =sal_True */)
187 : {
188 20 : m_bProtect = protect;
189 20 : }
190 :
191 20 : inline void XFCell::SetCol(sal_Int32 col)
192 : {
193 20 : m_nCol = col;
194 20 : }
195 :
196 20 : inline void XFCell::SetOwnerRow(XFRow *pRow)
197 : {
198 20 : m_pOwnerRow = pRow;
199 20 : }
200 :
201 : inline sal_Int32 XFCell::GetCol()
202 : {
203 : return m_nCol;
204 : }
205 :
206 : inline XFRow* XFCell::GetOwnerRow()
207 : {
208 : return m_pOwnerRow;
209 : }
210 :
211 : inline XFTable* XFCell::GetSubTable()
212 : {
213 : return m_pSubTable;
214 : }
215 :
216 0 : inline sal_Int32 XFCell::GetColSpaned()
217 : {
218 0 : return m_nColSpaned;
219 : }
220 :
221 : #endif
222 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|