Branch data 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 _XFCell_HXX
62 : : #define _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 : : XFCell(const XFCell& other);
80 : :
81 : : XFCell& operator=(const XFCell& other);
82 : :
83 : : virtual ~XFCell();
84 : :
85 : : public:
86 : : using XFContentContainer::Add;
87 : :
88 : : /**
89 : : * @descr Add content for table cell.
90 : : */
91 : : void Add(IXFContent *pContent);
92 : :
93 : : /**
94 : : * @descr If cell spans more the one column, then set column span.
95 : : */
96 : : void SetColumnSpaned(sal_Int32 num);
97 : :
98 : : /**
99 : : * @descr Set whether the following cells use the same style and content.
100 : : */
101 : : void SetRepeated(sal_Int32 num);
102 : :
103 : : /**
104 : : * @descr Set cell number value.
105 : : */
106 : : void SetValue(double value);
107 : :
108 : : /**
109 : : * @descr Set cell number value.
110 : : */
111 : : void SetValue(rtl::OUString value);
112 : :
113 : : /**
114 : : * @descr Set cell formula.
115 : : */
116 : : void SetFormula(rtl::OUString formula);
117 : :
118 : : /**
119 : : * @descr Set cell protected.
120 : : */
121 : : void SetProtect(sal_Bool protect=sal_True);
122 : :
123 : : /**
124 : : * @descr Set cell column id.
125 : : */
126 : : void SetCol(sal_Int32 col);
127 : :
128 : : /**
129 : : * @descr Set cell owner row.
130 : : */
131 : : void SetOwnerRow(XFRow *pRow);
132 : :
133 : : /**
134 : : * @descr Return cell name. It's a tool function for formula.
135 : : */
136 : : rtl::OUString GetCellName();
137 : :
138 : : /**
139 : : * @descr Return cell column id.
140 : : */
141 : : sal_Int32 GetCol();
142 : :
143 : : /**
144 : : * @descr return cell'owner row.
145 : : */
146 : : XFRow* GetOwnerRow();
147 : :
148 : : /**
149 : : * @descr If cell has a sub-table, return it, else return NULL.
150 : : */
151 : : XFTable* GetSubTable();
152 : :
153 : : /**
154 : : * @descr return cell column span property.
155 : : */
156 : : sal_Int32 GetColSpaned();
157 : :
158 : : /**
159 : : * @descr Output cell as xml element.
160 : : */
161 : : virtual void ToXml(IXFStream *pStrm);
162 : :
163 : : private:
164 : : XFRow *m_pOwnerRow;
165 : : XFTable *m_pSubTable;
166 : : sal_Int32 m_nCol;
167 : : sal_Int32 m_nColSpaned;
168 : : sal_Int32 m_nRepeated;
169 : : enumXFValueType m_eValueType;
170 : : rtl::OUString m_strValue;
171 : : rtl::OUString m_strDisplay;
172 : : rtl::OUString m_strFormula;
173 : : sal_Bool m_bProtect;
174 : : };
175 : :
176 : 0 : inline void XFCell::SetColumnSpaned(sal_Int32 num)
177 : : {
178 : 0 : m_nColSpaned = num;
179 : 0 : }
180 : :
181 : 0 : inline void XFCell::SetRepeated(sal_Int32 repeated)
182 : : {
183 : 0 : m_nRepeated = repeated;
184 : 0 : }
185 : :
186 : 0 : inline void XFCell::SetFormula(rtl::OUString formula)
187 : : {
188 : 0 : m_strFormula = formula;
189 : 0 : }
190 : :
191 : 60 : inline void XFCell::SetProtect(sal_Bool protect/* =sal_True */)
192 : : {
193 : 60 : m_bProtect = protect;
194 : 60 : }
195 : :
196 : 100 : inline void XFCell::SetCol(sal_Int32 col)
197 : : {
198 : 100 : m_nCol = col;
199 : 100 : }
200 : :
201 : 100 : inline void XFCell::SetOwnerRow(XFRow *pRow)
202 : : {
203 : 100 : m_pOwnerRow = pRow;
204 : 100 : }
205 : :
206 : : inline sal_Int32 XFCell::GetCol()
207 : : {
208 : : return m_nCol;
209 : : }
210 : :
211 : : inline XFRow* XFCell::GetOwnerRow()
212 : : {
213 : : return m_pOwnerRow;
214 : : }
215 : :
216 : : inline XFTable* XFCell::GetSubTable()
217 : : {
218 : : return m_pSubTable;
219 : : }
220 : :
221 : 0 : inline sal_Int32 XFCell::GetColSpaned()
222 : : {
223 : 0 : return m_nColSpaned;
224 : : }
225 : :
226 : : #endif
227 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|