xref: /aoo4110/main/sw/inc/cellatr.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CELLATR_HXX
25 #define _CELLATR_HXX
26 
27 #include <svl/intitem.hxx>
28 #include <svl/zforlist.hxx>
29 #include "swdllapi.h"
30 #include "format.hxx"
31 #include "cellfml.hxx"
32 
33 class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
34 {
35 	sal_Bool bAuto;		// automatisch vergebenes Flag
36 public:
37 	SwTblBoxNumFormat( sal_uInt32 nFormat = NUMBERFORMAT_TEXT,
38 						sal_Bool bAuto = sal_False );
39 
40 	// "pure virtual Methoden" vom SfxPoolItem
41 	virtual int             operator==( const SfxPoolItem& ) const;
42 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
43 
operator =(const SwTblBoxNumFormat & rAttr)44 	inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
45 	{
46 		SetValue( rAttr.GetValue() );
47 		SetAutoFlag( rAttr.GetAutoFlag() );
48 		return *this;
49 	}
50 
GetAutoFlag() const51 	sal_Bool GetAutoFlag() const 					{ return bAuto; }
SetAutoFlag(sal_Bool bFlag=sal_True)52 	void SetAutoFlag( sal_Bool bFlag = sal_True )		{ bAuto = bFlag; }
53 };
54 
55 class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
56 {
57 	SwModify* pDefinedIn;	// Modify-Object, in dem die Formel steht
58 							// kann nur TablenBoxFormat sein
59 
60 public:
61 	SwTblBoxFormula( const String& rFormula );
62 
63 	// "pure virtual Methoden" vom SfxPoolItem
64 	virtual int             operator==( const SfxPoolItem& ) const;
65 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
66 
67 	// erfrage und setze den Modify-Pointer
GetDefinedIn() const68 	inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
ChgDefinedIn(const SwModify * pNew)69 	inline void ChgDefinedIn( const SwModify* pNew )
70 											{ pDefinedIn = (SwModify*)pNew; }
71 	// suche den Node, in dem die Formel steht:
72 	//	BoxAttribut	-> BoxStartNode
73 	virtual const SwNode* GetNodeOfFormula() const;
74 
75 		  SwTableBox* GetTableBox();
GetTableBox() const76 	const SwTableBox* GetTableBox() const
77 		{ return ((SwTblBoxFormula*)this)->GetTableBox(); }
78 
79 	// Status aendern
80 	void ChangeState( const SfxPoolItem* pItem );
81 	// berechne die Formel
82 	void Calc( SwTblCalcPara& rCalcPara, double& rValue );
83 };
84 
85 class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
86 {
87 	double nValue;
88 public:
89 	SwTblBoxValue();
90 	SwTblBoxValue( const double aVal );
91 
92 	// "pure virtual Methoden" vom SfxPoolItem
93 	virtual int             operator==( const SfxPoolItem& ) const;
94 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
95 
operator =(const SwTblBoxValue & rCmp)96 	inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
97 	{
98 		nValue = rCmp.nValue;
99 		return *this;
100 	}
101 
GetValue() const102 	double GetValue() const 					{ return nValue; }
103 };
104 
105 
106 
107 //***************************************************************************
108 
GetTblBoxNumFmt(sal_Bool bInP) const109 inline const SwTblBoxNumFormat      &SwAttrSet::GetTblBoxNumFmt(sal_Bool bInP) const
110 	{   return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
GetTblBoxFormula(sal_Bool bInP) const111 inline const SwTblBoxFormula		&SwAttrSet::GetTblBoxFormula(sal_Bool bInP) const
112 	{   return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
GetTblBoxValue(sal_Bool bInP) const113 inline const SwTblBoxValue			&SwAttrSet::GetTblBoxValue(sal_Bool bInP) const
114 	{   return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
115 
116 //***************************************************************************
117 
GetTblBoxNumFmt(sal_Bool bInP) const118 inline const SwTblBoxNumFormat		&SwFmt::GetTblBoxNumFmt(sal_Bool bInP) const
119 	{   return aSet.GetTblBoxNumFmt(bInP); }
GetTblBoxFormula(sal_Bool bInP) const120 inline const SwTblBoxFormula		&SwFmt::GetTblBoxFormula(sal_Bool bInP) const
121 	{   return aSet.GetTblBoxFormula(bInP); }
GetTblBoxValue(sal_Bool bInP) const122 inline const SwTblBoxValue			&SwFmt::GetTblBoxValue(sal_Bool bInP) const
123 	{   return aSet.GetTblBoxValue(bInP); }
124 
125 #endif
126