1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
31 #include <svl/intitem.hxx>
32 #include <svl/zforlist.hxx>
35 #include "cellfml.hxx"
37 class SW_DLLPUBLIC SwTblBoxNumFormat
: public SfxUInt32Item
39 BOOL bAuto
; // automatisch vergebenes Flag
41 SwTblBoxNumFormat( UINT32 nFormat
= NUMBERFORMAT_TEXT
,
44 // "pure virtual Methoden" vom SfxPoolItem
45 virtual int operator==( const SfxPoolItem
& ) const;
46 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
48 inline SwTblBoxNumFormat
& operator=( const SwTblBoxNumFormat
& rAttr
)
50 SetValue( rAttr
.GetValue() );
51 SetAutoFlag( rAttr
.GetAutoFlag() );
55 BOOL
GetAutoFlag() const { return bAuto
; }
56 void SetAutoFlag( BOOL bFlag
= TRUE
) { bAuto
= bFlag
; }
59 class SwTblBoxFormula
: public SfxPoolItem
, public SwTableFormula
61 SwModify
* pDefinedIn
; // Modify-Object, in dem die Formel steht
62 // kann nur TablenBoxFormat sein
65 SwTblBoxFormula( const String
& rFormula
);
67 // "pure virtual Methoden" vom SfxPoolItem
68 virtual int operator==( const SfxPoolItem
& ) const;
69 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
71 // erfrage und setze den Modify-Pointer
72 inline const SwModify
* GetDefinedIn() const { return pDefinedIn
; }
73 inline void ChgDefinedIn( const SwModify
* pNew
)
74 { pDefinedIn
= (SwModify
*)pNew
; }
75 // suche den Node, in dem die Formel steht:
76 // BoxAttribut -> BoxStartNode
77 virtual const SwNode
* GetNodeOfFormula() const;
79 SwTableBox
* GetTableBox();
80 const SwTableBox
* GetTableBox() const
81 { return ((SwTblBoxFormula
*)this)->GetTableBox(); }
84 void ChangeState( const SfxPoolItem
* pItem
);
85 // berechne die Formel
86 void Calc( SwTblCalcPara
& rCalcPara
, double& rValue
);
89 class SW_DLLPUBLIC SwTblBoxValue
: public SfxPoolItem
94 SwTblBoxValue( const double aVal
);
96 // "pure virtual Methoden" vom SfxPoolItem
97 virtual int operator==( const SfxPoolItem
& ) const;
98 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
100 inline SwTblBoxValue
& operator=( const SwTblBoxValue
& rCmp
)
102 nValue
= rCmp
.nValue
;
106 double GetValue() const { return nValue
; }
111 //***************************************************************************
113 inline const SwTblBoxNumFormat
&SwAttrSet::GetTblBoxNumFmt(BOOL bInP
) const
114 { return (const SwTblBoxNumFormat
&)Get( RES_BOXATR_FORMAT
,bInP
); }
115 inline const SwTblBoxFormula
&SwAttrSet::GetTblBoxFormula(BOOL bInP
) const
116 { return (const SwTblBoxFormula
&)Get( RES_BOXATR_FORMULA
,bInP
); }
117 inline const SwTblBoxValue
&SwAttrSet::GetTblBoxValue(BOOL bInP
) const
118 { return (const SwTblBoxValue
&)Get( RES_BOXATR_VALUE
, bInP
); }
120 //***************************************************************************
122 inline const SwTblBoxNumFormat
&SwFmt::GetTblBoxNumFmt(BOOL bInP
) const
123 { return aSet
.GetTblBoxNumFmt(bInP
); }
124 inline const SwTblBoxFormula
&SwFmt::GetTblBoxFormula(BOOL bInP
) const
125 { return aSet
.GetTblBoxFormula(bInP
); }
126 inline const SwTblBoxValue
&SwFmt::GetTblBoxValue(BOOL bInP
) const
127 { return aSet
.GetTblBoxValue(bInP
); }