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 : : * For LWP filter architecture prototype - table object
59 : : */
60 : : /*************************************************************************
61 : : * Change History
62 : : Mar 2005 Created
63 : : ************************************************************************/
64 : : #ifndef _LWPLAYOUTNUMERICSOVERRIDE_HXX_
65 : : #define _LWPLAYOUTNUMERICSOVERRIDE_HXX_
66 : :
67 : : #include "lwpobj.hxx"
68 : : #include "lwpatomholder.hxx"
69 : : #include "lwpstory.hxx"
70 : :
71 : : #include "xfilter/xfcell.hxx"
72 : :
73 : : // temporily added for compile
74 : : class LwpObject;
75 : :
76 : : class LwpContent;
77 : : class LwpTableLayout;
78 : : /**
79 : : * @brief
80 : : * VO_CELLLIST object
81 : : */
82 : : class LwpCellList : public LwpDLVList
83 : : {
84 : : public:
85 : : LwpCellList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
86 : : virtual ~LwpCellList();
87 : :
88 : : virtual void Parse(IXFStream* pOutputStream);
89 : 0 : LwpObjectID GetNextID(){return *GetNext();}
90 : 0 : sal_uInt8 GetColumnID(){return cColumn;}
91 : 0 : virtual sal_Bool IsFormula(){return sal_False;}
92 : 0 : LwpObjectID GetValueID(){return cValue;}
93 : :
94 : : virtual void Convert(XFCell * pCell, LwpTableLayout* pCellsMap=NULL);
95 : : protected:
96 : : sal_uInt8 cColumn;
97 : : LwpObjectID cParent;
98 : :
99 : : void Read();
100 : : LwpObjectID cValue;
101 : : };
102 : : /**
103 : : * @brief
104 : : * VO_ROWLIST object
105 : : */
106 : : class LwpRowList : public LwpDLVList
107 : : {
108 : : public:
109 : : LwpRowList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
110 : : ~LwpRowList();
111 : :
112 : : void Parse(IXFStream* pOutputStream);
113 : 0 : LwpObjectID GetChildHeadID(){return *cChild.GetHead();}
114 : 0 : LwpObjectID GetNextID(){return *GetNext();}
115 : 0 : sal_uInt16 GetRowID(){return cRowID;}
116 : : protected:
117 : : LwpDLVListHeadTail cChild;
118 : : LwpObjectID cParent;
119 : : sal_uInt16 cRowID;
120 : : void Read();
121 : : };
122 : : /**
123 : : * @brief
124 : : * VO_NUMERICVALUE object
125 : : */
126 : : class LwpNumericValue : public LwpObject
127 : : {
128 : : public:
129 : : LwpNumericValue(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
130 : : ~LwpNumericValue();
131 : :
132 : 0 : double GetValue(){return cNumber;}
133 : : void Parse(IXFStream* pOutputStream);
134 : : protected:
135 : : double cNumber;
136 : : //LwpContent m_TheContent;
137 : : void Read();
138 : : };
139 : :
140 : : ////////////////////////////////////////////////////////////////////////
141 : : /**
142 : : * @brief
143 : : * VO_TABLERANGE object
144 : : */
145 : : class LwpTableRange: public LwpDLVList
146 : : {
147 : : public:
148 : : LwpTableRange(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
149 : : ~LwpTableRange();
150 : :
151 : : void Parse(IXFStream* pOutputStream);
152 : 0 : LwpObjectID GetCellRangeID(){return cpCellRange;}
153 : 0 : LwpObjectID GetTableID(){ return cqTable;}
154 : 0 : LwpTableRange* GetNext() { return (LwpTableRange*)(LwpDLVList::GetNext()->obj());}
155 : : protected:
156 : : LwpObjectID cqTable;
157 : : LwpObjectID cpCellRange;
158 : : void Read();
159 : : };
160 : : /**
161 : : * @brief
162 : : * VO_CELLRANGE object
163 : : */
164 : : class LwpCellRange: public LwpObject
165 : : {
166 : : public:
167 : : LwpCellRange(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
168 : : ~LwpCellRange();
169 : :
170 : : void Parse(IXFStream* pOutputStream);
171 : 0 : LwpObjectID GetFolderID(){return cpFolder;}
172 : : protected:
173 : : LwpObjectID cpFolder;
174 : : void Read();
175 : : };
176 : : /**
177 : : * @brief
178 : : * VO_FOLDER object
179 : : */
180 : : class LwpFolder: public LwpDLVList
181 : : {
182 : : public:
183 : : LwpFolder(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
184 : : ~LwpFolder();
185 : :
186 : : void Parse(IXFStream* pOutputStream);
187 : 0 : LwpObjectID GetChildHeadID(){ return *cChild.GetHead();}
188 : : protected:
189 : : LwpDLVListHeadTail cChild;
190 : : LwpObjectID cParent;
191 : : LwpObjectID cqTable;
192 : : void Read();
193 : : };
194 : : /**
195 : : * @brief
196 : : * VO_DEPENDENT object
197 : : */
198 : : class LwpDependent: public LwpDLVList
199 : : {
200 : : public:
201 : : LwpDependent(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
202 : : ~LwpDependent();
203 : :
204 : : void Parse(IXFStream* pOutputStream);
205 : : protected:
206 : : void Read();
207 : : LwpObjectID cFormulaInfo;
208 : : sal_uInt16 cReferenceOffset; // Used to fix dependent formula when we're
209 : : // dropped, sorted.
210 : : // Flags:
211 : : enum
212 : : {
213 : : START_CELL = 0x01,
214 : : END_CELL = 0x02,
215 : : REGISTERED = 0x04
216 : : };
217 : : sal_uInt8 cFlags; // Used to fix dependent formula when we're
218 : : // dropped, sorted.
219 : : };
220 : :
221 : :
222 : : ///////////////////////////////////////////////////////////////
223 : : /**
224 : : * @brief
225 : : * row or column id
226 : : */
227 : : class LwpRowColumnQualifier
228 : : {
229 : : public:
230 : : LwpRowColumnQualifier(void);
231 : 0 : ~LwpRowColumnQualifier(){}
232 : :
233 : : inline void SetAbsolute(void);
234 : : inline void ClearAbsolute(void);
235 : : sal_Bool IsAbsolute(void);
236 : :
237 : : inline void SetAfter(void);
238 : : inline void ClearAfter(void);
239 : : sal_Bool IsAfter(void);
240 : :
241 : : void SetBad(sal_Bool Bad);
242 : : sal_Bool IsBad(void);
243 : :
244 : : void QuickRead(LwpObjectStream *pStrm);
245 : :
246 : : private:
247 : : enum // cFlags bit definitions
248 : : {
249 : : REF_ABSOLUTE = 0x01,
250 : : REF_AFTER = 0x02,
251 : : REF_BAD = 0x04
252 : : };
253 : : sal_uInt8 cFlags;
254 : : };
255 : :
256 : : inline void
257 : : LwpRowColumnQualifier::SetAbsolute(void)
258 : : {
259 : : cFlags |= REF_ABSOLUTE;
260 : : }
261 : :
262 : : inline void
263 : : LwpRowColumnQualifier::ClearAbsolute(void)
264 : : {
265 : : cFlags &= ~REF_ABSOLUTE;
266 : : }
267 : :
268 : : inline void
269 : : LwpRowColumnQualifier::SetAfter(void)
270 : : {
271 : : cFlags |= REF_AFTER;
272 : : }
273 : :
274 : : inline void
275 : : LwpRowColumnQualifier::ClearAfter(void)
276 : : {
277 : : cFlags &= ~REF_AFTER;
278 : : }
279 : :
280 : : inline
281 : 0 : LwpRowColumnQualifier::LwpRowColumnQualifier()
282 : : {
283 : 0 : cFlags = 0;
284 : 0 : }
285 : :
286 : : inline sal_Bool
287 : 0 : LwpRowColumnQualifier::IsAfter()
288 : : {
289 [ # # ]: 0 : return cFlags & REF_AFTER ? sal_True : sal_False;
290 : : }
291 : :
292 : : inline sal_Bool
293 : 0 : LwpRowColumnQualifier::IsBad()
294 : : {
295 [ # # ]: 0 : return cFlags & REF_BAD ? sal_True : sal_False;
296 : : }
297 : :
298 : : inline sal_Bool
299 : 0 : LwpRowColumnQualifier::IsAbsolute()
300 : : {
301 : 0 : return cFlags & REF_ABSOLUTE ? sal_True : sal_False;
302 : : }
303 : : /**
304 : : * @brief
305 : : * row id
306 : : */
307 : : class LwpRowSpecifier
308 : : {
309 : : public:
310 : 0 : LwpRowSpecifier(void){}
311 : 0 : ~LwpRowSpecifier(){}
312 : :
313 : : void QuickRead(LwpObjectStream *pStrm);
314 : : String ToString(sal_uInt16 nFormulaRow);
315 : :
316 : : sal_uInt16 RowID(sal_uInt16 FormulaRow);
317 : : sal_uInt16 &Row(void);
318 : :
319 : : void SetAbsolute(void);
320 : : void ClearAbsolute(void);
321 : : sal_Bool IsAbsolute(void);
322 : :
323 : : void SetAfter(void);
324 : : void ClearAfter(void);
325 : : sal_Bool IsAfter(void);
326 : :
327 : : void SetBad(sal_Bool Bad);
328 : : sal_Bool IsBad(void);
329 : : void SetRowDelta(sal_uInt16 ReferenceRowID, sal_uInt16 FormulaRowID);
330 : :
331 : : private:
332 : : sal_uInt16 cRow;
333 : : LwpRowColumnQualifier cQualifier;
334 : : };
335 : :
336 : : inline sal_uInt16
337 : 0 : LwpRowSpecifier::RowID(sal_uInt16 FormulaRow)
338 : : {
339 [ # # ]: 0 : if (cQualifier.IsBad())
340 : : {
341 : 0 : return 0xffff;
342 : : }
343 [ # # ]: 0 : if (cQualifier.IsAbsolute())
344 : 0 : return cRow;
345 : :
346 [ # # ]: 0 : if (cQualifier.IsAfter())
347 : 0 : return FormulaRow + cRow;
348 : 0 : return FormulaRow - cRow;
349 : : }
350 : :
351 : : inline sal_uInt16 &
352 : : LwpRowSpecifier::Row()
353 : : {
354 : : return cRow;
355 : : }
356 : :
357 : : inline void
358 : : LwpRowSpecifier::SetAbsolute(void)
359 : : {
360 : : cQualifier.SetAbsolute();
361 : : }
362 : :
363 : : inline void
364 : : LwpRowSpecifier::ClearAbsolute(void)
365 : : {
366 : : cQualifier.ClearAbsolute();
367 : : }
368 : :
369 : : inline sal_Bool
370 : : LwpRowSpecifier::IsAbsolute()
371 : : {
372 : : return cQualifier.IsAbsolute();
373 : : }
374 : :
375 : : inline void
376 : : LwpRowSpecifier::SetAfter(void)
377 : : {
378 : : cQualifier.SetAfter();
379 : : }
380 : :
381 : : inline void
382 : : LwpRowSpecifier::ClearAfter(void)
383 : : {
384 : : cQualifier.ClearAfter();
385 : : }
386 : :
387 : : inline sal_Bool
388 : : LwpRowSpecifier::IsAfter()
389 : : {
390 : : return cQualifier.IsAfter();
391 : : }
392 : :
393 : : inline void
394 : : LwpRowSpecifier::SetBad(sal_Bool Bad)
395 : : {
396 : : cQualifier.SetBad(Bad);
397 : : }
398 : :
399 : : inline sal_Bool
400 : : LwpRowSpecifier::IsBad()
401 : : {
402 : : return cQualifier.IsBad();
403 : : }
404 : : /**
405 : : * @brief
406 : : * column id
407 : : */
408 : : class LwpColumnSpecifier
409 : : {
410 : : public:
411 : 0 : LwpColumnSpecifier(void){}
412 : 0 : ~LwpColumnSpecifier(){}
413 : :
414 : : void QuickRead(LwpObjectStream *pStrm);
415 : : sal_uInt8 Column(){return cColumn;}
416 : : String ToString(sal_uInt8 nFormulaCol);
417 : :
418 : : sal_uInt8 ColumnID(sal_uInt8 FormulaColumn);
419 : : void SetAbsolute(void);
420 : : void ClearAbsolute(void);
421 : : sal_Bool IsAbsolute(void);
422 : : void SetAfter(void);
423 : : void ClearAfter(void);
424 : : sal_Bool IsAfter(void);
425 : : void SetBad(sal_Bool Bad);
426 : : sal_Bool IsBad(void);
427 : : void SetColumnDelta(sal_uInt8 ReferenceColumnID, sal_uInt8 FormulaColumnID);
428 : :
429 : : private:
430 : : sal_uInt8 cColumn;
431 : : LwpRowColumnQualifier cQualifier;
432 : : };
433 : :
434 : : inline sal_uInt8
435 : 0 : LwpColumnSpecifier::ColumnID(sal_uInt8 FormulaColumn)
436 : : {
437 [ # # ]: 0 : if (cQualifier.IsBad())
438 : : {
439 : 0 : return 0xff;
440 : : }
441 [ # # ]: 0 : if (cQualifier.IsAbsolute())
442 : 0 : return cColumn;
443 [ # # ]: 0 : if (cQualifier.IsAfter())
444 : 0 : return FormulaColumn + cColumn;
445 : 0 : return FormulaColumn - cColumn;
446 : : }
447 : :
448 : : inline void
449 : : LwpColumnSpecifier::SetAbsolute(void)
450 : : {
451 : : cQualifier.SetAbsolute();
452 : : }
453 : :
454 : : inline void
455 : : LwpColumnSpecifier::ClearAbsolute(void)
456 : : {
457 : : cQualifier.ClearAbsolute();
458 : : }
459 : :
460 : : inline sal_Bool
461 : : LwpColumnSpecifier::IsAbsolute()
462 : : {
463 : : return cQualifier.IsAbsolute();
464 : : }
465 : :
466 : : inline void
467 : : LwpColumnSpecifier::SetAfter(void)
468 : : {
469 : : cQualifier.SetAfter();
470 : : }
471 : :
472 : : inline void
473 : : LwpColumnSpecifier::ClearAfter(void)
474 : : {
475 : : cQualifier.ClearAfter();
476 : : }
477 : :
478 : : inline sal_Bool
479 : : LwpColumnSpecifier::IsAfter()
480 : : {
481 : : return cQualifier.IsAfter();
482 : : }
483 : :
484 : : inline void
485 : : LwpColumnSpecifier::SetBad(sal_Bool Bad)
486 : : {
487 : : cQualifier.SetBad(Bad);
488 : : }
489 : :
490 : : inline sal_Bool
491 : : LwpColumnSpecifier::IsBad()
492 : : {
493 : : return cQualifier.IsBad();
494 : : }
495 : : #endif
496 : :
497 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|