merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / cellatr.hxx
blobad9ae500affbeb273850ef8082f0a47d63dd1cb2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cellatr.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CELLATR_HXX
32 #define _CELLATR_HXX
34 #include <svtools/intitem.hxx>
35 #include <svtools/zforlist.hxx>
36 #include "swdllapi.h"
37 #include "format.hxx"
38 #include "cellfml.hxx"
40 class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
42 BOOL bAuto; // automatisch vergebenes Flag
43 public:
44 SwTblBoxNumFormat( UINT32 nFormat = NUMBERFORMAT_TEXT,
45 BOOL bAuto = FALSE );
47 // "pure virtual Methoden" vom SfxPoolItem
48 virtual int operator==( const SfxPoolItem& ) const;
49 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
51 inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
53 SetValue( rAttr.GetValue() );
54 SetAutoFlag( rAttr.GetAutoFlag() );
55 return *this;
58 BOOL GetAutoFlag() const { return bAuto; }
59 void SetAutoFlag( BOOL bFlag = TRUE ) { bAuto = bFlag; }
62 class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
64 SwModify* pDefinedIn; // Modify-Object, in dem die Formel steht
65 // kann nur TablenBoxFormat sein
67 public:
68 SwTblBoxFormula( const String& rFormula );
70 // "pure virtual Methoden" vom SfxPoolItem
71 virtual int operator==( const SfxPoolItem& ) const;
72 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
74 // erfrage und setze den Modify-Pointer
75 inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
76 inline void ChgDefinedIn( const SwModify* pNew )
77 { pDefinedIn = (SwModify*)pNew; }
78 // suche den Node, in dem die Formel steht:
79 // BoxAttribut -> BoxStartNode
80 virtual const SwNode* GetNodeOfFormula() const;
82 SwTableBox* GetTableBox();
83 const SwTableBox* GetTableBox() const
84 { return ((SwTblBoxFormula*)this)->GetTableBox(); }
86 // Status aendern
87 void ChangeState( const SfxPoolItem* pItem );
88 // berechne die Formel
89 void Calc( SwTblCalcPara& rCalcPara, double& rValue );
92 class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
94 double nValue;
95 public:
96 SwTblBoxValue();
97 SwTblBoxValue( const double aVal );
99 // "pure virtual Methoden" vom SfxPoolItem
100 virtual int operator==( const SfxPoolItem& ) const;
101 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
103 inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
105 nValue = rCmp.nValue;
106 return *this;
109 double GetValue() const { return nValue; }
114 //***************************************************************************
116 inline const SwTblBoxNumFormat &SwAttrSet::GetTblBoxNumFmt(BOOL bInP) const
117 { return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
118 inline const SwTblBoxFormula &SwAttrSet::GetTblBoxFormula(BOOL bInP) const
119 { return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
120 inline const SwTblBoxValue &SwAttrSet::GetTblBoxValue(BOOL bInP) const
121 { return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
123 //***************************************************************************
125 inline const SwTblBoxNumFormat &SwFmt::GetTblBoxNumFmt(BOOL bInP) const
126 { return aSet.GetTblBoxNumFmt(bInP); }
127 inline const SwTblBoxFormula &SwFmt::GetTblBoxFormula(BOOL bInP) const
128 { return aSet.GetTblBoxFormula(bInP); }
129 inline const SwTblBoxValue &SwFmt::GetTblBoxValue(BOOL bInP) const
130 { return aSet.GetTblBoxValue(bInP); }
132 #endif