Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _CELLATR_HXX
21 : #define _CELLATR_HXX
22 :
23 : #include <svl/intitem.hxx>
24 : #include <svl/zforlist.hxx>
25 : #include "swdllapi.h"
26 : #include "format.hxx"
27 : #include "cellfml.hxx"
28 :
29 214 : class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
30 : {
31 : sal_Bool bAuto; ///< automatically given flag
32 : public:
33 : SwTblBoxNumFormat( sal_uInt32 nFormat = NUMBERFORMAT_TEXT,
34 : sal_Bool bAuto = sal_False );
35 :
36 : // "pure virtual methods" of SfxPoolItem
37 : virtual int operator==( const SfxPoolItem& ) const;
38 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
39 :
40 : inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
41 : {
42 : SetValue( rAttr.GetValue() );
43 : SetAutoFlag( rAttr.GetAutoFlag() );
44 : return *this;
45 : }
46 :
47 : sal_Bool GetAutoFlag() const { return bAuto; }
48 : void SetAutoFlag( sal_Bool bFlag = sal_True ) { bAuto = bFlag; }
49 : };
50 :
51 0 : class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
52 : {
53 : SwModify* pDefinedIn; // Modify object where the formula is located
54 : // can only be TableBoxFormat
55 :
56 : public:
57 : SwTblBoxFormula( const String& rFormula );
58 66 : ~SwTblBoxFormula() {};
59 :
60 : // "pure virtual methods" of SfxPoolItem
61 : virtual int operator==( const SfxPoolItem& ) const;
62 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
63 :
64 0 : inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
65 0 : inline void ChgDefinedIn( const SwModify* pNew )
66 0 : { pDefinedIn = (SwModify*)pNew; }
67 : // BoxAttribut -> BoxStartNode
68 : virtual const SwNode* GetNodeOfFormula() const;
69 :
70 : SwTableBox* GetTableBox();
71 : const SwTableBox* GetTableBox() const
72 : { return ((SwTblBoxFormula*)this)->GetTableBox(); }
73 :
74 : void ChangeState( const SfxPoolItem* pItem );
75 : void Calc( SwTblCalcPara& rCalcPara, double& rValue );
76 : };
77 :
78 223 : class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
79 : {
80 : double nValue;
81 : public:
82 : SwTblBoxValue();
83 : SwTblBoxValue( const double aVal );
84 :
85 : // "pure virtual methods" of SfxPoolItem
86 : virtual int operator==( const SfxPoolItem& ) const;
87 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
88 :
89 : inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
90 : {
91 : nValue = rCmp.nValue;
92 : return *this;
93 : }
94 :
95 254 : double GetValue() const { return nValue; }
96 : };
97 :
98 :
99 :
100 : //***************************************************************************
101 :
102 114 : inline const SwTblBoxNumFormat &SwAttrSet::GetTblBoxNumFmt(sal_Bool bInP) const
103 114 : { return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
104 0 : inline const SwTblBoxFormula &SwAttrSet::GetTblBoxFormula(sal_Bool bInP) const
105 0 : { return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
106 104 : inline const SwTblBoxValue &SwAttrSet::GetTblBoxValue(sal_Bool bInP) const
107 104 : { return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
108 :
109 : //***************************************************************************
110 :
111 114 : inline const SwTblBoxNumFormat &SwFmt::GetTblBoxNumFmt(sal_Bool bInP) const
112 114 : { return aSet.GetTblBoxNumFmt(bInP); }
113 0 : inline const SwTblBoxFormula &SwFmt::GetTblBoxFormula(sal_Bool bInP) const
114 0 : { return aSet.GetTblBoxFormula(bInP); }
115 104 : inline const SwTblBoxValue &SwFmt::GetTblBoxValue(sal_Bool bInP) const
116 104 : { return aSet.GetTblBoxValue(bInP); }
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|