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#include "node.hxx"
30
31class SwHistory;
32
37constexpr sal_uInt32 getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT; }
38
40{
41public:
42 SwTableBoxNumFormat( sal_uInt32 nFormat = getSwDefaultTextFormat() );
43
44 // "pure virtual methods" of SfxPoolItem
45 virtual bool operator==( const SfxPoolItem& ) const override;
46 virtual SwTableBoxNumFormat* Clone( SfxItemPool* pPool = nullptr ) const override;
47
49 {
50 SetValue( rAttr.GetValue() );
51 return *this;
52 }
53};
54
56{
57 sw::BroadcastingModify* m_pDefinedIn; // Modify object where the formula is located
58 // can only be TableBoxFormat
59
60public:
61 SwTableBoxFormula( const OUString& rFormula );
62
63 // "pure virtual methods" of SfxPoolItem
64 virtual bool operator==( const SfxPoolItem& ) const override;
65 virtual SwTableBoxFormula* Clone( SfxItemPool* pPool = nullptr ) const override;
66
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;
72
73 SwTableBox* GetTableBox();
74 const SwTableBox* GetTableBox() const
75 { return const_cast<SwTableBoxFormula*>(this)->GetTableBox(); }
76
77 void TryBoxNmToPtr();
78 void ToSplitMergeBoxNmWithHistory(SwTableFormulaUpdate& rUpdate, SwHistory* pHistory);
80 {
81 if(!m_pDefinedIn)
82 return;
83 // detect table that contains this attribute
84 const SwNode* pNd = GetNodeOfFormula();
85 if(!pNd) // || &pNd->GetNodes() != &pNd->GetDoc().GetNodes())
86 return;
87 const SwTableNode* pTableNd = pNd->FindTableNode();
88 if(pTableNd == nullptr)
89 return;
90 ChgValid(false);
91 }
92 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
93};
94
96{
97 double m_nValue;
98public:
100 SwTableBoxValue( const double aVal );
101
102 // "pure virtual methods" of SfxPoolItem
103 virtual bool operator==( const SfxPoolItem& ) const override;
104 virtual SwTableBoxValue* Clone( SfxItemPool* pPool = nullptr ) const override;
105
107 {
108 m_nValue = rCmp.m_nValue;
109 return *this;
110 }
111
112 double GetValue() const { return m_nValue; }
113};
114
116 { return Get( RES_BOXATR_FORMAT,bInP); }
118 { return Get( RES_BOXATR_FORMULA,bInP); }
119inline const SwTableBoxValue &SwAttrSet::GetTableBoxValue(bool bInP) const
120 { return Get( RES_BOXATR_VALUE, bInP); }
121
123 { return m_aSet.GetTableBoxNumFormat(bInP); }
125 { return m_aSet.GetTableBoxFormula(bInP); }
126inline const SwTableBoxValue &SwFormat::GetTableBoxValue(bool bInP) const
127 { return m_aSet.GetTableBoxValue(bInP); }
128
129#endif
130
131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:37
void SetValue(sal_uInt32 nTheValue)
virtual bool operator==(const SfxPoolItem &rItem) const override
sal_uInt32 m_nValue
sal_uInt32 GetValue() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxUInt32Item * Clone(SfxItemPool *=nullptr) const override
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
Definition: cellatr.hxx:115
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:117
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:119
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
TableBox attributes - implemented in cellatr.hxx.
Definition: cellatr.hxx:122
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:124
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:126
SwAttrSet m_aSet
Definition: format.hxx:51
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
const SwTableBox * GetTableBox() const
Definition: cellatr.hxx:74
sw::BroadcastingModify * m_pDefinedIn
Definition: cellatr.hxx:57
void ChgDefinedIn(const sw::BroadcastingModify *pNew)
Definition: cellatr.hxx:68
void ChangeState()
Definition: cellatr.hxx:79
const sw::BroadcastingModify * GetDefinedIn() const
Definition: cellatr.hxx:67
SwTableBoxNumFormat & operator=(const SwTableBoxNumFormat &rAttr)
Definition: cellatr.hxx:48
double GetValue() const
Definition: cellatr.hxx:112
double m_nValue
Definition: cellatr.hxx:97
SwTableBoxValue & operator=(const SwTableBoxValue &rCmp)
Definition: cellatr.hxx:106
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(158)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(157)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT