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