Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / cellatr.hxx
blobce677d9c746cc648557d79905d3bb099da6c5284
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include "swdllapi.h"
26 #include "format.hxx"
27 #include "cellfml.hxx"
29 namespace rtl { class OUString; }
31 class SW_DLLPUBLIC SwTableBoxNumFormat : public SfxUInt32Item
33 bool bAuto; ///< automatically given flag
34 public:
35 SwTableBoxNumFormat( sal_uInt32 nFormat = css::util::NumberFormat::TEXT,
36 bool bAuto = false );
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;
42 inline SwTableBoxNumFormat& operator=( const SwTableBoxNumFormat& rAttr )
44 SetValue( rAttr.GetValue() );
45 SetAutoFlag( rAttr.GetAutoFlag() );
46 return *this;
49 bool GetAutoFlag() const { return bAuto; }
50 void SetAutoFlag( bool bFlag = true ) { bAuto = bFlag; }
53 class SwTableBoxFormula : public SfxPoolItem, public SwTableFormula
55 SwModify* pDefinedIn; // Modify object where the formula is located
56 // can only be TableBoxFormat
58 public:
59 SwTableBoxFormula( const OUString& rFormula );
60 virtual ~SwTableBoxFormula() {};
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;
66 inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
67 inline void ChgDefinedIn( const SwModify* pNew )
68 { pDefinedIn = const_cast<SwModify*>(pNew); }
69 // BoxAttribut -> BoxStartNode
70 virtual const SwNode* GetNodeOfFormula() const SAL_OVERRIDE;
72 SwTableBox* GetTableBox();
73 const SwTableBox* GetTableBox() const
74 { return const_cast<SwTableBoxFormula*>(this)->GetTableBox(); }
76 void ChangeState( const SfxPoolItem* pItem );
77 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
80 class SW_DLLPUBLIC SwTableBoxValue : public SfxPoolItem
82 double nValue;
83 public:
84 SwTableBoxValue();
85 SwTableBoxValue( const double aVal );
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;
91 inline SwTableBoxValue& operator=( const SwTableBoxValue& rCmp )
93 nValue = rCmp.nValue;
94 return *this;
97 double GetValue() const { return nValue; }
100 inline const SwTableBoxNumFormat &SwAttrSet::GetTableBoxNumFormat(bool bInP) const
101 { return static_cast<const SwTableBoxNumFormat&>(Get( RES_BOXATR_FORMAT,bInP)); }
102 inline const SwTableBoxFormula &SwAttrSet::GetTableBoxFormula(bool bInP) const
103 { return static_cast<const SwTableBoxFormula&>(Get( RES_BOXATR_FORMULA,bInP)); }
104 inline const SwTableBoxValue &SwAttrSet::GetTableBoxValue(bool bInP) const
105 { return static_cast<const SwTableBoxValue&>(Get( RES_BOXATR_VALUE, bInP)); }
107 inline const SwTableBoxNumFormat &SwFormat::GetTableBoxNumFormat(bool bInP) const
108 { return m_aSet.GetTableBoxNumFormat(bInP); }
109 inline const SwTableBoxFormula &SwFormat::GetTableBoxFormula(bool bInP) const
110 { return m_aSet.GetTableBoxFormula(bInP); }
111 inline const SwTableBoxValue &SwFormat::GetTableBoxValue(bool bInP) const
112 { return m_aSet.GetTableBoxValue(bInP); }
114 #endif
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */