LibreOffice Module sw (master)  1
cellatr.hxx
Go to the documentation of this file.
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 "hintids.hxx"
28 #include "cellfml.hxx"
29 
34 constexpr sal_uInt32 getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT; }
35 
37 {
38 public:
39  SwTableBoxNumFormat( sal_uInt32 nFormat = getSwDefaultTextFormat() );
40 
41  // "pure virtual methods" of SfxPoolItem
42  virtual bool operator==( const SfxPoolItem& ) const override;
43  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
44 
46  {
47  SetValue( rAttr.GetValue() );
48  return *this;
49  }
50 };
51 
53 {
54  SwModify* m_pDefinedIn; // Modify object where the formula is located
55  // can only be TableBoxFormat
56 
57 public:
58  SwTableBoxFormula( const OUString& rFormula );
59 
60  // "pure virtual methods" of SfxPoolItem
61  virtual bool operator==( const SfxPoolItem& ) const override;
62  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
63 
64  const SwModify* GetDefinedIn() const { return m_pDefinedIn; }
65  void ChgDefinedIn( const SwModify* pNew )
66  { m_pDefinedIn = const_cast<SwModify*>(pNew); }
67  // BoxAttribut -> BoxStartNode
68  virtual const SwNode* GetNodeOfFormula() const override;
69 
71  const SwTableBox* GetTableBox() const
72  { return const_cast<SwTableBoxFormula*>(this)->GetTableBox(); }
73 
74  void ChangeState( const SfxPoolItem* pItem );
75  void Calc( SwTableCalcPara& rCalcPara, double& rValue );
76 };
77 
79 {
80  double m_nValue;
81 public:
83  SwTableBoxValue( const double aVal );
84 
85  // "pure virtual methods" of SfxPoolItem
86  virtual bool operator==( const SfxPoolItem& ) const override;
87  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
88 
90  {
91  m_nValue = rCmp.m_nValue;
92  return *this;
93  }
94 
95  double GetValue() const { return m_nValue; }
96 };
97 
99  { return Get( RES_BOXATR_FORMAT,bInP); }
100 inline const SwTableBoxFormula &SwAttrSet::GetTableBoxFormula(bool bInP) const
101  { return Get( RES_BOXATR_FORMULA,bInP); }
102 inline const SwTableBoxValue &SwAttrSet::GetTableBoxValue(bool bInP) const
103  { return Get( RES_BOXATR_VALUE, bInP); }
104 
106  { return m_aSet.GetTableBoxNumFormat(bInP); }
107 inline const SwTableBoxFormula &SwFormat::GetTableBoxFormula(bool bInP) const
108  { return m_aSet.GetTableBoxFormula(bInP); }
109 inline const SwTableBoxValue &SwFormat::GetTableBoxValue(bool bInP) const
110  { return m_aSet.GetTableBoxValue(bInP); }
111 
112 #endif
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
TableBox attributes - implemented in cellatr.hxx.
Definition: cellatr.hxx:105
virtual SfxPoolItem * Clone(SfxItemPool *=nullptr) const override
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
Definition: cellatr.hxx:98
virtual bool operator==(const SfxPoolItem &) const override
Definition: cellatr.cxx:65
constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT
double GetValue() const
Definition: cellatr.hxx:95
SwAttrSet m_aSet
Definition: format.hxx:48
void ChangeState(const SfxPoolItem *pItem)
Definition: cellatr.cxx:107
SwTableBox * GetTableBox()
Definition: cellatr.cxx:99
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cellatr.cxx:72
const SwModify * GetDefinedIn() const
Definition: cellatr.hxx:64
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:102
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:100
const SwTableBox * GetTableBox() const
Definition: cellatr.hxx:71
#define RES_BOXATR_VALUE
Definition: hintids.hxx:263
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
void ChgDefinedIn(const SwModify *pNew)
Definition: cellatr.hxx:65
SwTableBoxFormula(const OUString &rFormula)
Definition: cellatr.cxx:58
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:109
void Calc(SwTableCalcPara &rCalcPara, double &rValue)
Definition: cellatr.cxx:187
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual const SwNode * GetNodeOfFormula() const override
Get node type of the node containing this formula.
Definition: cellatr.cxx:87
virtual bool operator==(const SfxPoolItem &rItem) const override
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
SwTableBoxValue & operator=(const SwTableBoxValue &rCmp)
Definition: cellatr.hxx:89
SwModify * m_pDefinedIn
Definition: cellatr.hxx:54
void SetValue(sal_uInt32 nTheValue)
sal_uInt32 GetValue() const
double m_nValue
Definition: cellatr.hxx:80
SwTableBoxNumFormat & operator=(const SwTableBoxNumFormat &rAttr)
Definition: cellatr.hxx:45
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:34
#define RES_BOXATR_FORMAT
Definition: hintids.hxx:261
#define RES_BOXATR_FORMULA
Definition: hintids.hxx:262
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:107
Base class of the Writer document model elements.
Definition: node.hxx:79