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>
45 sal_uInt32 m_nNumberFormat
;
47 explicit ValueAndFormat()
50 , m_eType(ValueType::Empty
)
53 rtl::math::setNan(&m_fValue
);
56 explicit ValueAndFormat(double fValue
, sal_uInt32 nNumberFormat
)
59 , m_eType(ValueType::Numeric
)
60 , m_nNumberFormat(nNumberFormat
)
63 explicit ValueAndFormat(OUString
const & rString
)
66 , m_eType(ValueType::String
)
69 rtl::math::setNan(&m_fValue
);
73 typedef cppu::WeakImplHelper
<css::chart2::data::XDataSequence
,
74 css::chart2::data::XTextualDataSequence
,
75 css::chart2::data::XNumericalDataSequence
,
76 css::util::XCloneable
,
77 css::util::XModifyBroadcaster
,
78 css::beans::XPropertySet
,
79 css::lang::XServiceInfo
>
80 PivotTableDataSequence_Base
;
82 class PivotTableDataSequence final
: public PivotTableDataSequence_Base
, public SfxListener
85 explicit PivotTableDataSequence(ScDocument
* pDocument
, OUString
const & sPivotTableName
,
86 OUString
const & sID
, std::vector
<ValueAndFormat
> const & rData
);
88 virtual ~PivotTableDataSequence() override
;
89 PivotTableDataSequence(const PivotTableDataSequence
&) = delete;
90 PivotTableDataSequence
& operator=(const PivotTableDataSequence
&) = delete;
92 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
95 virtual css::uno::Sequence
<css::uno::Any
> SAL_CALL
getData() override
;
96 virtual OUString SAL_CALL
getSourceRangeRepresentation() override
;
97 virtual css::uno::Sequence
<OUString
> SAL_CALL
98 generateLabel(css::chart2::data::LabelOrigin nOrigin
) override
;
100 virtual sal_Int32 SAL_CALL
getNumberFormatKeyByIndex(sal_Int32 nIndex
) override
;
102 // XNumericalDataSequence
103 virtual css::uno::Sequence
<double> SAL_CALL
getNumericalData() override
;
105 // XTextualDataSequence
106 virtual css::uno::Sequence
<OUString
> SAL_CALL
getTextualData() override
;
109 virtual css::uno::Reference
<css::beans::XPropertySetInfo
> SAL_CALL
110 getPropertySetInfo() override
;
112 virtual void SAL_CALL
setPropertyValue(const OUString
& rPropertyName
,
113 const css::uno::Any
& rValue
) override
;
115 virtual css::uno::Any SAL_CALL
getPropertyValue(const OUString
& rPropertyName
) override
;
117 virtual void SAL_CALL
addPropertyChangeListener(
118 const OUString
& rPropertyName
,
119 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
121 virtual void SAL_CALL
removePropertyChangeListener(
122 const OUString
& rPropertyName
,
123 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& rListener
) override
;
125 virtual void SAL_CALL
addVetoableChangeListener(
126 const OUString
& rPropertyName
,
127 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
129 virtual void SAL_CALL
removeVetoableChangeListener(
130 const OUString
& rPropertyName
,
131 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
134 virtual css::uno::Reference
<css::util::XCloneable
> SAL_CALL
createClone() override
;
136 // XModifyBroadcaster
137 virtual void SAL_CALL
addModifyListener(
138 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
140 virtual void SAL_CALL
removeModifyListener(
141 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
144 virtual OUString SAL_CALL
getImplementationName() override
;
146 virtual sal_Bool SAL_CALL
supportsService(const OUString
& rServiceName
) override
;
148 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
152 void setRole(css::chart2::data::DataSequenceRole
const & aRole
)
158 ScDocument
* m_pDocument
;
159 OUString
const m_sPivotTableName
;
160 OUString
const m_aID
;
161 std::vector
<ValueAndFormat
> m_aData
;
162 SfxItemPropertySet
const m_aPropSet
;
163 css::chart2::data::DataSequenceRole m_aRole
;
164 std::vector
<css::uno::Reference
<css::util::XModifyListener
>> m_aValueListeners
;
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */