tdf#149609 release mouse before showing popups from calc grid window
[LibreOffice.git] / sw / inc / cellatr.hxx
blobf5d4909fd1b6fe1f818186a0ac84f2b314d131b6
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 "hintids.hxx"
28 #include "cellfml.hxx"
30 /** The number formatter's default locale's @ Text format.
31 Not necessarily system locale, but the locale the formatter was constructed
32 with. For this SvNumberFormatter::IsTextFormat() always returns true.
34 constexpr sal_uInt32 getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT; }
36 class SW_DLLPUBLIC SwTableBoxNumFormat final : public SfxUInt32Item
38 public:
39 SwTableBoxNumFormat( sal_uInt32 nFormat = getSwDefaultTextFormat() );
41 // "pure virtual methods" of SfxPoolItem
42 virtual bool operator==( const SfxPoolItem& ) const override;
43 virtual SwTableBoxNumFormat* Clone( SfxItemPool* pPool = nullptr ) const override;
45 SwTableBoxNumFormat& operator=( const SwTableBoxNumFormat& rAttr )
47 SetValue( rAttr.GetValue() );
48 return *this;
52 class SW_DLLPUBLIC SwTableBoxFormula final : public SfxPoolItem, public SwTableFormula
54 sw::BroadcastingModify* m_pDefinedIn; // Modify object where the formula is located
55 // can only be TableBoxFormat
57 public:
58 SwTableBoxFormula( const OUString& rFormula );
60 // "pure virtual methods" of SfxPoolItem
61 virtual bool operator==( const SfxPoolItem& ) const override;
62 virtual SwTableBoxFormula* Clone( SfxItemPool* pPool = nullptr ) const override;
64 const sw::BroadcastingModify* GetDefinedIn() const { return m_pDefinedIn; }
65 void ChgDefinedIn( const sw::BroadcastingModify* pNew )
66 { m_pDefinedIn = const_cast<sw::BroadcastingModify*>(pNew); }
67 // BoxAttribut -> BoxStartNode
68 virtual const SwNode* GetNodeOfFormula() const override;
70 SwTableBox* GetTableBox();
71 const SwTableBox* GetTableBox() const
72 { return const_cast<SwTableBoxFormula*>(this)->GetTableBox(); }
74 void ChangeState( const SfxPoolItem* pItem );
75 void Calc( SwTableCalcPara& rCalcPara, double& rValue );
78 class SW_DLLPUBLIC SwTableBoxValue final : public SfxPoolItem
80 double m_nValue;
81 public:
82 SwTableBoxValue();
83 SwTableBoxValue( const double aVal );
85 // "pure virtual methods" of SfxPoolItem
86 virtual bool operator==( const SfxPoolItem& ) const override;
87 virtual SwTableBoxValue* Clone( SfxItemPool* pPool = nullptr ) const override;
89 SwTableBoxValue& operator=( const SwTableBoxValue& rCmp )
91 m_nValue = rCmp.m_nValue;
92 return *this;
95 double GetValue() const { return m_nValue; }
98 inline const SwTableBoxNumFormat &SwAttrSet::GetTableBoxNumFormat(bool bInP) const
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); }
105 inline const SwTableBoxNumFormat &SwFormat::GetTableBoxNumFormat(bool bInP) const
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); }
112 #endif
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */