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/.
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 .
22 #include <comphelper/compbase.hxx>
23 #include <comphelper/uno3.hxx>
24 #include <comphelper/broadcasthelper.hxx>
25 #include <comphelper/propertycontainer2.hxx>
26 #include <comphelper/proparrhlp.hxx>
27 #include <rtl/ref.hxx>
29 // interfaces and types
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/chart2/data/XDataSequence.hpp>
32 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
33 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
34 #include <com/sun/star/container/XIndexReplace.hpp>
35 #include <com/sun/star/container/XNamed.hpp>
36 #include <com/sun/star/util/XCloneable.hpp>
37 #include <com/sun/star/util/XModifiable.hpp>
39 namespace com::sun::star::beans
{ class XPropertySetInfo
; }
40 namespace com::sun::star::chart2
{ class XInternalDataProvider
; }
44 class InternalDataProvider
;
45 class ModifyEventForwarder
;
49 typedef ::comphelper::WeakComponentImplHelper
<
50 css::chart2::data::XDataSequence
,
51 css::chart2::data::XNumericalDataSequence
,
52 css::chart2::data::XTextualDataSequence
,
53 css::util::XCloneable
,
54 css::util::XModifiable
, // contains util::XModifyBroadcaster
55 css::container::XIndexReplace
,
56 css::container::XNamed
, // for setting a new range representation
57 css::lang::XServiceInfo
>
58 UncachedDataSequence_Base
;
62 * This sequence object does NOT store actual sequence data. Instead, it
63 * references a column inside the internal data table (represented by class
64 * InternalData) via range representation string. The range representation
65 * string ends with a numeric value that indicates the column index within
66 * the internal data table.
68 * <p>A range representation can be either '0', '1', '2', ..., or 'label 1',
71 class UncachedDataSequence final
:
72 public ::comphelper::OPropertyContainer2
,
73 public ::comphelper::OPropertyArrayUsageHelper
< UncachedDataSequence
>,
74 public impl::UncachedDataSequence_Base
77 /** The referring data provider is held as uno reference to ensure its
78 lifetime is at least as long as the one of this object.
81 rtl::Reference
< InternalDataProvider
> xIntDataProv
,
82 OUString aRangeRepresentation
);
84 rtl::Reference
< InternalDataProvider
> xIntDataProv
,
85 OUString aRangeRepresentation
,
86 const OUString
& rRole
);
87 UncachedDataSequence( const UncachedDataSequence
& rSource
);
88 virtual ~UncachedDataSequence() override
;
90 /// declare XServiceInfo methods
91 virtual OUString SAL_CALL
getImplementationName() override
;
92 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
93 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
95 /// merge XInterface implementations
97 /// merge XTypeProvider implementations
98 DECLARE_XTYPEPROVIDER()
101 // ____ XPropertySet ____
102 /// @see css::beans::XPropertySet
103 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
104 /// @see ::comphelper::OPropertySetHelper
105 virtual ::cppu::IPropertyArrayHelper
& getInfoHelper() override
;
106 /// @see ::comphelper::OPropertyArrayUsageHelper
107 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const override
;
109 // ____ XDataSequence ____
110 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getData() override
;
111 virtual OUString SAL_CALL
getSourceRangeRepresentation() override
;
112 virtual css::uno::Sequence
< OUString
> SAL_CALL
generateLabel(
113 css::chart2::data::LabelOrigin nLabelOrigin
) override
;
114 virtual ::sal_Int32 SAL_CALL
getNumberFormatKeyByIndex( ::sal_Int32 nIndex
) override
;
116 // ____ XNumericalDataSequence ____
117 /// @see css::chart::data::XNumericalDataSequence
118 virtual css::uno::Sequence
< double > SAL_CALL
getNumericalData() override
;
120 // ____ XTextualDataSequence ____
121 /// @see css::chart::data::XTextualDataSequence
122 virtual css::uno::Sequence
< OUString
> SAL_CALL
getTextualData() override
;
124 // ____ XIndexReplace ____
125 virtual void SAL_CALL
replaceByIndex( ::sal_Int32 Index
, const css::uno::Any
& Element
) override
;
127 // ____ XIndexAccess (base of XIndexReplace) ____
128 virtual ::sal_Int32 SAL_CALL
getCount() override
;
129 virtual css::uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) override
;
131 // ____ XElementAccess (base of XIndexAccess) ____
132 virtual css::uno::Type SAL_CALL
getElementType() override
;
133 virtual sal_Bool SAL_CALL
hasElements() override
;
135 // ____ XNamed (for setting a new range representation) ____
136 virtual OUString SAL_CALL
getName() override
;
137 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
139 // ____ XCloneable ____
140 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone() override
;
142 // ____ XModifiable ____
143 virtual sal_Bool SAL_CALL
isModified() override
;
144 virtual void SAL_CALL
setModified( sal_Bool bModified
) override
;
146 // ____ XModifyBroadcaster (base of XModifiable) ____
147 virtual void SAL_CALL
addModifyListener(
148 const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
149 virtual void SAL_CALL
removeModifyListener(
150 const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
152 void fireModifyEvent();
155 sal_Int32 m_nNumberFormatKey
;
157 OUString m_aXMLRange
;
160 /** This method registers all properties. It should be called by all
163 void registerProperties();
165 rtl::Reference
< InternalDataProvider
> m_xDataProvider
;
166 OUString m_aSourceRepresentation
;
167 rtl::Reference
<ModifyEventForwarder
> m_xModifyEventForwarder
;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */