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 INCLUDED_SW_INC_CELLATR_HXX
21 : #define INCLUDED_SW_INC_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 : namespace rtl { class OUString; }
30 :
31 0 : class SW_DLLPUBLIC SwTblBoxNumFormat : public SfxUInt32Item
32 : {
33 : sal_Bool bAuto; ///< automatically given flag
34 : public:
35 : SwTblBoxNumFormat( sal_uInt32 nFormat = NUMBERFORMAT_TEXT,
36 : sal_Bool bAuto = sal_False );
37 :
38 : // "pure virtual methods" of SfxPoolItem
39 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
40 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
41 :
42 : inline SwTblBoxNumFormat& operator=( const SwTblBoxNumFormat& rAttr )
43 : {
44 : SetValue( rAttr.GetValue() );
45 : SetAutoFlag( rAttr.GetAutoFlag() );
46 : return *this;
47 : }
48 :
49 : sal_Bool GetAutoFlag() const { return bAuto; }
50 : void SetAutoFlag( sal_Bool bFlag = sal_True ) { bAuto = bFlag; }
51 : };
52 :
53 0 : class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
54 : {
55 : SwModify* pDefinedIn; // Modify object where the formula is located
56 : // can only be TableBoxFormat
57 :
58 : public:
59 : SwTblBoxFormula( const OUString& rFormula );
60 0 : virtual ~SwTblBoxFormula() {};
61 :
62 : // "pure virtual methods" of SfxPoolItem
63 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
64 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
65 :
66 0 : inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
67 0 : inline void ChgDefinedIn( const SwModify* pNew )
68 0 : { pDefinedIn = (SwModify*)pNew; }
69 : // BoxAttribut -> BoxStartNode
70 : virtual const SwNode* GetNodeOfFormula() const SAL_OVERRIDE;
71 :
72 : SwTableBox* GetTableBox();
73 : const SwTableBox* GetTableBox() const
74 : { return ((SwTblBoxFormula*)this)->GetTableBox(); }
75 :
76 : void ChangeState( const SfxPoolItem* pItem );
77 : void Calc( SwTblCalcPara& rCalcPara, double& rValue );
78 : };
79 :
80 0 : class SW_DLLPUBLIC SwTblBoxValue : public SfxPoolItem
81 : {
82 : double nValue;
83 : public:
84 : SwTblBoxValue();
85 : SwTblBoxValue( const double aVal );
86 :
87 : // "pure virtual methods" of SfxPoolItem
88 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
89 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
90 :
91 : inline SwTblBoxValue& operator=( const SwTblBoxValue& rCmp )
92 : {
93 : nValue = rCmp.nValue;
94 : return *this;
95 : }
96 :
97 0 : double GetValue() const { return nValue; }
98 : };
99 :
100 0 : inline const SwTblBoxNumFormat &SwAttrSet::GetTblBoxNumFmt(sal_Bool bInP) const
101 0 : { return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); }
102 0 : inline const SwTblBoxFormula &SwAttrSet::GetTblBoxFormula(sal_Bool bInP) const
103 0 : { return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); }
104 0 : inline const SwTblBoxValue &SwAttrSet::GetTblBoxValue(sal_Bool bInP) const
105 0 : { return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); }
106 :
107 0 : inline const SwTblBoxNumFormat &SwFmt::GetTblBoxNumFmt(sal_Bool bInP) const
108 0 : { return aSet.GetTblBoxNumFmt(bInP); }
109 0 : inline const SwTblBoxFormula &SwFmt::GetTblBoxFormula(sal_Bool bInP) const
110 0 : { return aSet.GetTblBoxFormula(bInP); }
111 0 : inline const SwTblBoxValue &SwFmt::GetTblBoxValue(sal_Bool bInP) const
112 0 : { return aSet.GetTblBoxValue(bInP); }
113 :
114 : #endif
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|