1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SC_INC_PIVOTTABLEDATASEQUENCE_HXX
11 #define INCLUDED_SC_INC_PIVOTTABLEDATASEQUENCE_HXX
13 #include <com/sun/star/chart2/data/XDataSequence.hpp>
14 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
15 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
16 #include <com/sun/star/chart2/data/DataSequenceRole.hpp>
17 #include <com/sun/star/lang/XServiceInfo.hpp>
18 #include <com/sun/star/beans/XPropertySet.hpp>
19 #include <com/sun/star/util/XCloneable.hpp>
20 #include <com/sun/star/util/XModifyBroadcaster.hpp>
23 #include <svl/lstner.hxx>
24 #include <svl/itemprop.hxx>
25 #include <cppuhelper/implbase.hxx>
26 #include <rtl/math.hxx>
28 #include "unonames.hxx"
29 #include "document.hxx"
48 sal_uInt32 m_nNumberFormat
;
50 explicit ValueAndFormat()
53 , m_eType(ValueType::Empty
)
56 rtl::math::setNan(&m_fValue
);
59 explicit ValueAndFormat(double fValue
, sal_uInt32 nNumberFormat
)
62 , m_eType(ValueType::Numeric
)
63 , m_nNumberFormat(nNumberFormat
)
66 explicit ValueAndFormat(OUString
const & rString
)
69 , m_eType(ValueType::String
)
72 rtl::math::setNan(&m_fValue
);
76 typedef cppu::WeakImplHelper
<css::chart2::data::XDataSequence
,
77 css::chart2::data::XTextualDataSequence
,
78 css::chart2::data::XNumericalDataSequence
,
79 css::util::XCloneable
,
80 css::util::XModifyBroadcaster
,
81 css::beans::XPropertySet
,
82 css::lang::XServiceInfo
>
83 PivotTableDataSequence_Base
;
85 class PivotTableDataSequence
: public PivotTableDataSequence_Base
, public SfxListener
88 explicit PivotTableDataSequence(ScDocument
* pDocument
, OUString
const & sPivotTableName
,
89 OUString
const & sID
, std::vector
<ValueAndFormat
> const & rData
);
91 virtual ~PivotTableDataSequence() override
;
92 PivotTableDataSequence(const PivotTableDataSequence
&) = delete;
93 PivotTableDataSequence
& operator=(const PivotTableDataSequence
&) = delete;
95 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
98 virtual css::uno::Sequence
<css::uno::Any
> SAL_CALL
getData() override
;
99 virtual OUString SAL_CALL
getSourceRangeRepresentation() override
;
100 virtual css::uno::Sequence
<OUString
> SAL_CALL
101 generateLabel(css::chart2::data::LabelOrigin nOrigin
) override
;
103 virtual sal_Int32 SAL_CALL
getNumberFormatKeyByIndex(sal_Int32 nIndex
) override
;
105 // XNumericalDataSequence
106 virtual css::uno::Sequence
<double> SAL_CALL
getNumericalData() override
;
108 // XTextualDataSequence
109 virtual css::uno::Sequence
<OUString
> SAL_CALL
getTextualData() override
;
112 virtual css::uno::Reference
<css::beans::XPropertySetInfo
> SAL_CALL
113 getPropertySetInfo() override
;
115 virtual void SAL_CALL
setPropertyValue(const OUString
& rPropertyName
,
116 const css::uno::Any
& rValue
) override
;
118 virtual css::uno::Any SAL_CALL
getPropertyValue(const OUString
& rPropertyName
) override
;
120 virtual void SAL_CALL
addPropertyChangeListener(
121 const OUString
& rPropertyName
,
122 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
124 virtual void SAL_CALL
removePropertyChangeListener(
125 const OUString
& rPropertyName
,
126 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& rListener
) override
;
128 virtual void SAL_CALL
addVetoableChangeListener(
129 const OUString
& rPropertyName
,
130 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
132 virtual void SAL_CALL
removeVetoableChangeListener(
133 const OUString
& rPropertyName
,
134 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
137 virtual css::uno::Reference
<css::util::XCloneable
> SAL_CALL
createClone() override
;
139 // XModifyBroadcaster
140 virtual void SAL_CALL
addModifyListener(
141 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
143 virtual void SAL_CALL
removeModifyListener(
144 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
147 virtual OUString SAL_CALL
getImplementationName() override
;
149 virtual sal_Bool SAL_CALL
supportsService(const OUString
& rServiceName
) override
;
151 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
155 void setRole(css::chart2::data::DataSequenceRole
const & aRole
)
161 ScDocument
* m_pDocument
;
162 OUString m_sPivotTableName
;
164 std::vector
<ValueAndFormat
> m_aData
;
165 SfxItemPropertySet m_aPropSet
;
166 css::chart2::data::DataSequenceRole m_aRole
;
167 std::vector
<css::uno::Reference
<css::util::XModifyListener
>> m_aValueListeners
;
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */