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
34constexpr sal_uInt32 getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT; }
35
37{
38public:
39 SwTableBoxNumFormat( sal_uInt32 nFormat = getSwDefaultTextFormat() );
40
41 // "pure virtual methods" of SfxPoolItem
42 virtual bool operator==( const SfxPoolItem& ) const override;
43 virtual SwTableBoxNumFormat* Clone( SfxItemPool* pPool = nullptr ) const override;
44
46 {
47 SetValue( rAttr.GetValue() );
48 return *this;
49 }
50};
51
53{
54 sw::BroadcastingModify* m_pDefinedIn; // Modify object where the formula is located
55 // can only be TableBoxFormat
56
57public:
58 SwTableBoxFormula( const OUString& rFormula );
59
60 // "pure virtual methods" of SfxPoolItem
61 virtual bool operator==( const SfxPoolItem& ) const override;
62 virtual SwTableBoxFormula* Clone( SfxItemPool* pPool = nullptr ) const override;
63
64 const sw::BroadcastingModify* GetDefinedIn() const { return m_pDefinedIn; }
66 { m_pDefinedIn = const_cast<sw::BroadcastingModify*>(pNew); }
67 // BoxAttribut -> BoxStartNode
68 virtual const SwNode* GetNodeOfFormula() const override;
69
70 SwTableBox* GetTableBox();
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;
81public:
83 SwTableBoxValue( const double aVal );
84
85 // "pure virtual methods" of SfxPoolItem
86 virtual bool operator==( const SfxPoolItem& ) const override;
87 virtual SwTableBoxValue* 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); }
101 { return Get( RES_BOXATR_FORMULA,bInP); }
102inline const SwTableBoxValue &SwAttrSet::GetTableBoxValue(bool bInP) const
103 { return Get( RES_BOXATR_VALUE, bInP); }
104
106 { return m_aSet.GetTableBoxNumFormat(bInP); }
108 { return m_aSet.GetTableBoxFormula(bInP); }
109inline 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: */
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:34
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:98
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:100
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:102
const SwTableBoxNumFormat & GetTableBoxNumFormat(bool=true) const
TableBox attributes - implemented in cellatr.hxx.
Definition: cellatr.hxx:105
const SwTableBoxFormula & GetTableBoxFormula(bool=true) const
Definition: cellatr.hxx:107
const SwTableBoxValue & GetTableBoxValue(bool=true) const
Definition: cellatr.hxx:109
SwAttrSet m_aSet
Definition: format.hxx:51
Base class of the Writer document model elements.
Definition: node.hxx:84
const SwTableBox * GetTableBox() const
Definition: cellatr.hxx:71
sw::BroadcastingModify * m_pDefinedIn
Definition: cellatr.hxx:54
void ChgDefinedIn(const sw::BroadcastingModify *pNew)
Definition: cellatr.hxx:65
const sw::BroadcastingModify * GetDefinedIn() const
Definition: cellatr.hxx:64
SwTableBoxNumFormat & operator=(const SwTableBoxNumFormat &rAttr)
Definition: cellatr.hxx:45
double GetValue() const
Definition: cellatr.hxx:95
double m_nValue
Definition: cellatr.hxx:80
SwTableBoxValue & operator=(const SwTableBoxValue &rCmp)
Definition: cellatr.hxx:89
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT