xref: /aoo42x/main/sw/inc/cellatr.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _CELLATR_HXX
29*cdf0e10cSrcweir #define _CELLATR_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svl/intitem.hxx>
32*cdf0e10cSrcweir #include <svl/zforlist.hxx>
33*cdf0e10cSrcweir #include "swdllapi.h"
34*cdf0e10cSrcweir #include "format.hxx"
35*cdf0e10cSrcweir #include "cellfml.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir 	sal_Bool bAuto;		// automatisch vergebenes Flag
40*cdf0e10cSrcweir public:
41*cdf0e10cSrcweir 	SwTblBoxNumFormat( sal_uInt32 nFormat = NUMBERFORMAT_TEXT,
42*cdf0e10cSrcweir 						sal_Bool bAuto = sal_False );
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir 	// "pure virtual Methoden" vom SfxPoolItem
45*cdf0e10cSrcweir 	virtual int             operator==( const SfxPoolItem& ) const;
46*cdf0e10cSrcweir 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 	inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
49*cdf0e10cSrcweir 	{
50*cdf0e10cSrcweir 		SetValue( rAttr.GetValue() );
51*cdf0e10cSrcweir 		SetAutoFlag( rAttr.GetAutoFlag() );
52*cdf0e10cSrcweir 		return *this;
53*cdf0e10cSrcweir 	}
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	sal_Bool GetAutoFlag() const 					{ return bAuto; }
56*cdf0e10cSrcweir 	void SetAutoFlag( sal_Bool bFlag = sal_True )		{ bAuto = bFlag; }
57*cdf0e10cSrcweir };
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 	SwModify* pDefinedIn;	// Modify-Object, in dem die Formel steht
62*cdf0e10cSrcweir 							// kann nur TablenBoxFormat sein
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir public:
65*cdf0e10cSrcweir 	SwTblBoxFormula( const String& rFormula );
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 	// "pure virtual Methoden" vom SfxPoolItem
68*cdf0e10cSrcweir 	virtual int             operator==( const SfxPoolItem& ) const;
69*cdf0e10cSrcweir 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	// erfrage und setze den Modify-Pointer
72*cdf0e10cSrcweir 	inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
73*cdf0e10cSrcweir 	inline void ChgDefinedIn( const SwModify* pNew )
74*cdf0e10cSrcweir 											{ pDefinedIn = (SwModify*)pNew; }
75*cdf0e10cSrcweir 	// suche den Node, in dem die Formel steht:
76*cdf0e10cSrcweir 	//	BoxAttribut	-> BoxStartNode
77*cdf0e10cSrcweir 	virtual const SwNode* GetNodeOfFormula() const;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 		  SwTableBox* GetTableBox();
80*cdf0e10cSrcweir 	const SwTableBox* GetTableBox() const
81*cdf0e10cSrcweir 		{ return ((SwTblBoxFormula*)this)->GetTableBox(); }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 	// Status aendern
84*cdf0e10cSrcweir 	void ChangeState( const SfxPoolItem* pItem );
85*cdf0e10cSrcweir 	// berechne die Formel
86*cdf0e10cSrcweir 	void Calc( SwTblCalcPara& rCalcPara, double& rValue );
87*cdf0e10cSrcweir };
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	double nValue;
92*cdf0e10cSrcweir public:
93*cdf0e10cSrcweir 	SwTblBoxValue();
94*cdf0e10cSrcweir 	SwTblBoxValue( const double aVal );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	// "pure virtual Methoden" vom SfxPoolItem
97*cdf0e10cSrcweir 	virtual int             operator==( const SfxPoolItem& ) const;
98*cdf0e10cSrcweir 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
101*cdf0e10cSrcweir 	{
102*cdf0e10cSrcweir 		nValue = rCmp.nValue;
103*cdf0e10cSrcweir 		return *this;
104*cdf0e10cSrcweir 	}
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	double GetValue() const 					{ return nValue; }
107*cdf0e10cSrcweir };
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir //***************************************************************************
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir inline const SwTblBoxNumFormat      &SwAttrSet::GetTblBoxNumFmt(sal_Bool bInP) const
114*cdf0e10cSrcweir 	{   return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
115*cdf0e10cSrcweir inline const SwTblBoxFormula		&SwAttrSet::GetTblBoxFormula(sal_Bool bInP) const
116*cdf0e10cSrcweir 	{   return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
117*cdf0e10cSrcweir inline const SwTblBoxValue			&SwAttrSet::GetTblBoxValue(sal_Bool bInP) const
118*cdf0e10cSrcweir 	{   return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir //***************************************************************************
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir inline const SwTblBoxNumFormat		&SwFmt::GetTblBoxNumFmt(sal_Bool bInP) const
123*cdf0e10cSrcweir 	{   return aSet.GetTblBoxNumFmt(bInP); }
124*cdf0e10cSrcweir inline const SwTblBoxFormula		&SwFmt::GetTblBoxFormula(sal_Bool bInP) const
125*cdf0e10cSrcweir 	{   return aSet.GetTblBoxFormula(bInP); }
126*cdf0e10cSrcweir inline const SwTblBoxValue			&SwFmt::GetTblBoxValue(sal_Bool bInP) const
127*cdf0e10cSrcweir 	{   return aSet.GetTblBoxValue(bInP); }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir #endif
130