merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwptblcell.hxx
blobbef573f762259aa3ce5be099a0210f6431e7d6e9
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /**
56 * @file
57 * For LWP filter architecture prototype - table object
59 /*************************************************************************
60 * Change History
61 Mar 2005 Created
62 ************************************************************************/
63 #ifndef _LWPLAYOUTNUMERICSOVERRIDE_HXX_
64 #define _LWPLAYOUTNUMERICSOVERRIDE_HXX_
66 #include "lwpobj.hxx"
67 #include "lwpatomholder.hxx"
68 #include "lwpstory.hxx"
70 #include "xfilter/xfcell.hxx"
72 // temporily added for compile
73 class LwpObject;
75 class LwpContent;
76 class LwpTableLayout;
77 /**
78 * @brief
79 * VO_CELLLIST object
81 class LwpCellList : public LwpDLVList
83 public:
84 LwpCellList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
85 virtual ~LwpCellList();
87 virtual void Parse(IXFStream* pOutputStream);
88 LwpObjectID GetNextID(){return *GetNext();}
89 sal_uInt8 GetColumnID(){return cColumn;}
90 virtual sal_Bool IsFormula(){return sal_False;}
91 LwpObjectID GetValueID(){return cValue;}
93 virtual void Convert(XFCell * pCell, LwpTableLayout* pCellsMap=NULL);
94 protected:
95 sal_uInt8 cColumn;
96 LwpObjectID cParent;
98 void Read();
99 LwpObjectID cValue;
102 * @brief
103 * VO_ROWLIST object
105 class LwpRowList : public LwpDLVList
107 public:
108 LwpRowList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
109 ~LwpRowList();
111 void Parse(IXFStream* pOutputStream);
112 LwpObjectID GetChildHeadID(){return *cChild.GetHead();}
113 LwpObjectID GetNextID(){return *GetNext();}
114 sal_uInt16 GetRowID(){return cRowID;}
115 protected:
116 LwpDLVListHeadTail cChild;
117 LwpObjectID cParent;
118 sal_uInt16 cRowID;
119 void Read();
122 * @brief
123 * VO_NUMERICVALUE object
125 class LwpNumericValue : public LwpObject
127 public:
128 LwpNumericValue(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
129 ~LwpNumericValue();
131 double GetValue(){return cNumber;}
132 void Parse(IXFStream* pOutputStream);
133 protected:
134 double cNumber;
135 //LwpContent m_TheContent;
136 void Read();
139 ////////////////////////////////////////////////////////////////////////
141 * @brief
142 * VO_TABLERANGE object
144 class LwpTableRange: public LwpDLVList
146 public:
147 LwpTableRange(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
148 ~LwpTableRange();
150 void Parse(IXFStream* pOutputStream);
151 LwpObjectID GetCellRangeID(){return cpCellRange;}
152 LwpObjectID GetTableID(){ return cqTable;}
153 LwpTableRange* GetNext() { return (LwpTableRange*)(LwpDLVList::GetNext()->obj());}
154 protected:
155 LwpObjectID cqTable;
156 LwpObjectID cpCellRange;
157 void Read();
160 * @brief
161 * VO_CELLRANGE object
163 class LwpCellRange: public LwpObject
165 public:
166 LwpCellRange(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
167 ~LwpCellRange();
169 void Parse(IXFStream* pOutputStream);
170 LwpObjectID GetFolderID(){return cpFolder;}
171 protected:
172 LwpObjectID cpFolder;
173 void Read();
176 * @brief
177 * VO_FOLDER object
179 class LwpFolder: public LwpDLVList
181 public:
182 LwpFolder(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
183 ~LwpFolder();
185 void Parse(IXFStream* pOutputStream);
186 LwpObjectID GetChildHeadID(){ return *cChild.GetHead();}
187 protected:
188 LwpDLVListHeadTail cChild;
189 LwpObjectID cParent;
190 LwpObjectID cqTable;
191 void Read();
194 * @brief
195 * VO_DEPENDENT object
197 class LwpDependent: public LwpDLVList
199 public:
200 LwpDependent(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
201 ~LwpDependent();
203 void Parse(IXFStream* pOutputStream);
204 protected:
205 void Read();
206 LwpObjectID cFormulaInfo;
207 sal_uInt16 cReferenceOffset; // Used to fix dependent formula when we're
208 // dropped, sorted.
209 // Flags:
210 enum
212 START_CELL = 0x01,
213 END_CELL = 0x02,
214 REGISTERED = 0x04
216 sal_uInt8 cFlags; // Used to fix dependent formula when we're
217 // dropped, sorted.
221 ///////////////////////////////////////////////////////////////
223 * @brief
224 * row or column id
226 class LwpRowColumnQualifier
228 public:
229 LwpRowColumnQualifier(void);
230 ~LwpRowColumnQualifier(){}
232 inline void SetAbsolute(void);
233 inline void ClearAbsolute(void);
234 sal_Bool IsAbsolute(void);
236 inline void SetAfter(void);
237 inline void ClearAfter(void);
238 sal_Bool IsAfter(void);
240 void SetBad(sal_Bool Bad);
241 sal_Bool IsBad(void);
243 void QuickRead(LwpObjectStream *pStrm);
245 private:
246 enum // cFlags bit definitions
248 REF_ABSOLUTE = 0x01,
249 REF_AFTER = 0x02,
250 REF_BAD = 0x04
252 sal_uInt8 cFlags;
255 inline void
256 LwpRowColumnQualifier::SetAbsolute(void)
258 cFlags |= REF_ABSOLUTE;
261 inline void
262 LwpRowColumnQualifier::ClearAbsolute(void)
264 cFlags &= ~REF_ABSOLUTE;
267 inline void
268 LwpRowColumnQualifier::SetAfter(void)
270 cFlags |= REF_AFTER;
273 inline void
274 LwpRowColumnQualifier::ClearAfter(void)
276 cFlags &= ~REF_AFTER;
279 inline
280 LwpRowColumnQualifier::LwpRowColumnQualifier()
282 cFlags = 0;
285 inline sal_Bool
286 LwpRowColumnQualifier::IsAfter()
288 return cFlags & REF_AFTER ? sal_True : sal_False;
291 inline sal_Bool
292 LwpRowColumnQualifier::IsBad()
294 return cFlags & REF_BAD ? sal_True : sal_False;
297 inline sal_Bool
298 LwpRowColumnQualifier::IsAbsolute()
300 return cFlags & REF_ABSOLUTE ? sal_True : sal_False;
303 * @brief
304 * row id
306 class LwpRowSpecifier
308 public:
309 LwpRowSpecifier(void){}
310 ~LwpRowSpecifier(){}
312 void QuickRead(LwpObjectStream *pStrm);
313 String ToString(USHORT nFormulaRow);
315 USHORT RowID(USHORT FormulaRow);
316 USHORT &Row(void);
318 void SetAbsolute(void);
319 void ClearAbsolute(void);
320 sal_Bool IsAbsolute(void);
322 void SetAfter(void);
323 void ClearAfter(void);
324 sal_Bool IsAfter(void);
326 void SetBad(sal_Bool Bad);
327 sal_Bool IsBad(void);
328 void SetRowDelta(USHORT ReferenceRowID, USHORT FormulaRowID);
330 private:
331 sal_uInt16 cRow;
332 LwpRowColumnQualifier cQualifier;
335 inline USHORT
336 LwpRowSpecifier::RowID(USHORT FormulaRow)
338 if (cQualifier.IsBad())
340 return 0xffff;
342 if (cQualifier.IsAbsolute())
343 return cRow;
345 if (cQualifier.IsAfter())
346 return FormulaRow + cRow;
347 return FormulaRow - cRow;
350 inline USHORT &
351 LwpRowSpecifier::Row()
353 return cRow;
356 inline void
357 LwpRowSpecifier::SetAbsolute(void)
359 cQualifier.SetAbsolute();
362 inline void
363 LwpRowSpecifier::ClearAbsolute(void)
365 cQualifier.ClearAbsolute();
368 inline sal_Bool
369 LwpRowSpecifier::IsAbsolute()
371 return cQualifier.IsAbsolute();
374 inline void
375 LwpRowSpecifier::SetAfter(void)
377 cQualifier.SetAfter();
380 inline void
381 LwpRowSpecifier::ClearAfter(void)
383 cQualifier.ClearAfter();
386 inline sal_Bool
387 LwpRowSpecifier::IsAfter()
389 return cQualifier.IsAfter();
392 inline void
393 LwpRowSpecifier::SetBad(sal_Bool Bad)
395 cQualifier.SetBad(Bad);
398 inline sal_Bool
399 LwpRowSpecifier::IsBad()
401 return cQualifier.IsBad();
404 * @brief
405 * column id
407 class LwpColumnSpecifier
409 public:
410 LwpColumnSpecifier(void){};
411 ~LwpColumnSpecifier(){};
413 void QuickRead(LwpObjectStream *pStrm);
414 sal_uInt8 Column(){return cColumn;}
415 String ToString(sal_uInt8 nFormulaCol);
417 sal_uInt8 ColumnID(sal_uInt8 FormulaColumn);
418 void SetAbsolute(void);
419 void ClearAbsolute(void);
420 sal_Bool IsAbsolute(void);
421 void SetAfter(void);
422 void ClearAfter(void);
423 sal_Bool IsAfter(void);
424 void SetBad(sal_Bool Bad);
425 sal_Bool IsBad(void);
426 void SetColumnDelta(sal_uInt8 ReferenceColumnID, sal_uInt8 FormulaColumnID);
428 private:
429 sal_uInt8 cColumn;
430 LwpRowColumnQualifier cQualifier;
433 inline sal_uInt8
434 LwpColumnSpecifier::ColumnID(sal_uInt8 FormulaColumn)
436 if (cQualifier.IsBad())
438 return 0xff;
440 if (cQualifier.IsAbsolute())
441 return cColumn;
442 if (cQualifier.IsAfter())
443 return FormulaColumn + cColumn;
444 return FormulaColumn - cColumn;
447 inline void
448 LwpColumnSpecifier::SetAbsolute(void)
450 cQualifier.SetAbsolute();
453 inline void
454 LwpColumnSpecifier::ClearAbsolute(void)
456 cQualifier.ClearAbsolute();
459 inline sal_Bool
460 LwpColumnSpecifier::IsAbsolute()
462 return cQualifier.IsAbsolute();
465 inline void
466 LwpColumnSpecifier::SetAfter(void)
468 cQualifier.SetAfter();
471 inline void
472 LwpColumnSpecifier::ClearAfter(void)
474 cQualifier.ClearAfter();
477 inline sal_Bool
478 LwpColumnSpecifier::IsAfter()
480 return cQualifier.IsAfter();
483 inline void
484 LwpColumnSpecifier::SetBad(sal_Bool Bad)
486 cQualifier.SetBad(Bad);
489 inline sal_Bool
490 LwpColumnSpecifier::IsBad()
492 return cQualifier.IsBad();
494 #endif