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