1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_INC_CELLATR_HXX
21 #define INCLUDED_SW_INC_CELLATR_HXX
23 #include <svl/intitem.hxx>
24 #include <svl/zforlist.hxx>
27 #include "hintids.hxx"
28 #include "cellfml.hxx"
33 /** The number formatter's default locale's @ Text format.
34 Not necessarily system locale, but the locale the formatter was constructed
35 with. For this SvNumberFormatter::IsTextFormat() always returns true.
37 constexpr sal_uInt32
getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT
; }
39 class SW_DLLPUBLIC SwTableBoxNumFormat final
: public SfxUInt32Item
42 SwTableBoxNumFormat( sal_uInt32 nFormat
= getSwDefaultTextFormat() );
44 // "pure virtual methods" of SfxPoolItem
45 virtual bool operator==( const SfxPoolItem
& ) const override
;
46 virtual SwTableBoxNumFormat
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
48 SwTableBoxNumFormat
& operator=( const SwTableBoxNumFormat
& rAttr
)
50 SetValue( rAttr
.GetValue() );
55 class SW_DLLPUBLIC SwTableBoxFormula final
: public SfxPoolItem
, public SwTableFormula
57 sw::BroadcastingModify
* m_pDefinedIn
; // Modify object where the formula is located
58 // can only be TableBoxFormat
61 SwTableBoxFormula( const OUString
& rFormula
);
63 // "pure virtual methods" of SfxPoolItem
64 virtual bool operator==( const SfxPoolItem
& ) const override
;
65 virtual SwTableBoxFormula
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
67 const sw::BroadcastingModify
* GetDefinedIn() const { return m_pDefinedIn
; }
68 void ChgDefinedIn( const sw::BroadcastingModify
* pNew
)
69 { m_pDefinedIn
= const_cast<sw::BroadcastingModify
*>(pNew
); }
70 // BoxAttribut -> BoxStartNode
71 virtual const SwNode
* GetNodeOfFormula() const override
;
73 SwTableBox
* GetTableBox();
74 const SwTableBox
* GetTableBox() const
75 { return const_cast<SwTableBoxFormula
*>(this)->GetTableBox(); }
78 void ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate
& rUpdate
, SwHistory
* pHistory
);
83 // detect table that contains this attribute
84 const SwNode
* pNd
= GetNodeOfFormula();
85 if(!pNd
) // || &pNd->GetNodes() != &pNd->GetDoc().GetNodes())
87 const SwTableNode
* pTableNd
= pNd
->FindTableNode();
88 if(pTableNd
== nullptr)
92 void Calc( SwTableCalcPara
& rCalcPara
, double& rValue
);
95 class SW_DLLPUBLIC SwTableBoxValue final
: public SfxPoolItem
100 SwTableBoxValue( const double aVal
);
102 // "pure virtual methods" of SfxPoolItem
103 virtual bool operator==( const SfxPoolItem
& ) const override
;
104 virtual SwTableBoxValue
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
106 SwTableBoxValue
& operator=( const SwTableBoxValue
& rCmp
)
108 m_nValue
= rCmp
.m_nValue
;
112 double GetValue() const { return m_nValue
; }
115 inline const SwTableBoxNumFormat
&SwAttrSet::GetTableBoxNumFormat(bool bInP
) const
116 { return Get( RES_BOXATR_FORMAT
,bInP
); }
117 inline const SwTableBoxFormula
&SwAttrSet::GetTableBoxFormula(bool bInP
) const
118 { return Get( RES_BOXATR_FORMULA
,bInP
); }
119 inline const SwTableBoxValue
&SwAttrSet::GetTableBoxValue(bool bInP
) const
120 { return Get( RES_BOXATR_VALUE
, bInP
); }
122 inline const SwTableBoxNumFormat
&SwFormat::GetTableBoxNumFormat(bool bInP
) const
123 { return m_aSet
.GetTableBoxNumFormat(bInP
); }
124 inline const SwTableBoxFormula
&SwFormat::GetTableBoxFormula(bool bInP
) const
125 { return m_aSet
.GetTableBoxFormula(bInP
); }
126 inline const SwTableBoxValue
&SwFormat::GetTableBoxValue(bool bInP
) const
127 { return m_aSet
.GetTableBoxValue(bInP
); }
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */