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/.
12 #include <com/sun/star/chart2/data/XDataSequence.hpp>
13 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
14 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
15 #include <com/sun/star/chart2/data/DataSequenceRole.hpp>
16 #include <com/sun/star/lang/XServiceInfo.hpp>
17 #include <com/sun/star/beans/XPropertySet.hpp>
18 #include <com/sun/star/util/XCloneable.hpp>
19 #include <com/sun/star/util/XModifyBroadcaster.hpp>
22 #include <svl/lstner.hxx>
23 #include <svl/itemprop.hxx>
24 #include <cppuhelper/implbase.hxx>
45 sal_uInt32 m_nNumberFormat
;
47 explicit ValueAndFormat()
48 : m_fValue(std::numeric_limits
<double>::quiet_NaN())
50 , m_eType(ValueType::Empty
)
55 explicit ValueAndFormat(double fValue
, sal_uInt32 nNumberFormat
)
58 , m_eType(ValueType::Numeric
)
59 , m_nNumberFormat(nNumberFormat
)
62 explicit ValueAndFormat(OUString
const & rString
)
63 : m_fValue(std::numeric_limits
<double>::quiet_NaN())
65 , m_eType(ValueType::String
)
71 typedef cppu::WeakImplHelper
<css::chart2::data::XDataSequence
,
72 css::chart2::data::XTextualDataSequence
,
73 css::chart2::data::XNumericalDataSequence
,
74 css::util::XCloneable
,
75 css::util::XModifyBroadcaster
,
76 css::beans::XPropertySet
,
77 css::lang::XServiceInfo
>
78 PivotTableDataSequence_Base
;
80 class PivotTableDataSequence final
: public PivotTableDataSequence_Base
, public SfxListener
83 explicit PivotTableDataSequence(ScDocument
* pDocument
,
84 OUString
const & sID
, std::vector
<ValueAndFormat
>&& rData
);
86 virtual ~PivotTableDataSequence() override
;
87 PivotTableDataSequence(const PivotTableDataSequence
&) = delete;
88 PivotTableDataSequence
& operator=(const PivotTableDataSequence
&) = delete;
90 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
93 virtual css::uno::Sequence
<css::uno::Any
> SAL_CALL
getData() override
;
94 virtual OUString SAL_CALL
getSourceRangeRepresentation() override
;
95 virtual css::uno::Sequence
<OUString
> SAL_CALL
96 generateLabel(css::chart2::data::LabelOrigin nOrigin
) override
;
98 virtual sal_Int32 SAL_CALL
getNumberFormatKeyByIndex(sal_Int32 nIndex
) override
;
100 // XNumericalDataSequence
101 virtual css::uno::Sequence
<double> SAL_CALL
getNumericalData() override
;
103 // XTextualDataSequence
104 virtual css::uno::Sequence
<OUString
> SAL_CALL
getTextualData() override
;
107 virtual css::uno::Reference
<css::beans::XPropertySetInfo
> SAL_CALL
108 getPropertySetInfo() override
;
110 virtual void SAL_CALL
setPropertyValue(const OUString
& rPropertyName
,
111 const css::uno::Any
& rValue
) override
;
113 virtual css::uno::Any SAL_CALL
getPropertyValue(const OUString
& rPropertyName
) override
;
115 virtual void SAL_CALL
addPropertyChangeListener(
116 const OUString
& rPropertyName
,
117 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
119 virtual void SAL_CALL
removePropertyChangeListener(
120 const OUString
& rPropertyName
,
121 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& rListener
) override
;
123 virtual void SAL_CALL
addVetoableChangeListener(
124 const OUString
& rPropertyName
,
125 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
127 virtual void SAL_CALL
removeVetoableChangeListener(
128 const OUString
& rPropertyName
,
129 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& rListener
) override
;
132 virtual css::uno::Reference
<css::util::XCloneable
> SAL_CALL
createClone() override
;
134 // XModifyBroadcaster
135 virtual void SAL_CALL
addModifyListener(
136 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
138 virtual void SAL_CALL
removeModifyListener(
139 const css::uno::Reference
<css::util::XModifyListener
>& aListener
) override
;
142 virtual OUString SAL_CALL
getImplementationName() override
;
144 virtual sal_Bool SAL_CALL
supportsService(const OUString
& rServiceName
) override
;
146 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
150 void setRole(css::chart2::data::DataSequenceRole
const & aRole
)
156 ScDocument
* m_pDocument
;
158 std::vector
<ValueAndFormat
> m_aData
;
159 SfxItemPropertySet m_aPropSet
;
160 css::chart2::data::DataSequenceRole m_aRole
;
161 std::vector
<css::uno::Reference
<css::util::XModifyListener
>> m_aValueListeners
;
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */