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 <cppuhelper/compbase.hxx>
23 #include <comphelper/uno3.hxx>
24 #include <comphelper/broadcasthelper.hxx>
25 #include <comphelper/propertycontainer.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 ::cppu::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::OMutexAndBroadcastHelper
,
73 public ::comphelper::OPropertyContainer
,
74 public ::comphelper::OPropertyArrayUsageHelper
< UncachedDataSequence
>,
75 public impl::UncachedDataSequence_Base
78 /** The referring data provider is held as uno reference to ensure its
79 lifetime is at least as long as the one of this object.
82 rtl::Reference
< InternalDataProvider
> xIntDataProv
,
83 OUString aRangeRepresentation
);
85 rtl::Reference
< InternalDataProvider
> xIntDataProv
,
86 OUString aRangeRepresentation
,
87 const OUString
& rRole
);
88 UncachedDataSequence( const UncachedDataSequence
& rSource
);
89 virtual ~UncachedDataSequence() override
;
91 /// declare XServiceInfo methods
92 virtual OUString SAL_CALL
getImplementationName() override
;
93 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
94 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
96 /// merge XInterface implementations
98 /// merge XTypeProvider implementations
99 DECLARE_XTYPEPROVIDER()
102 // ____ XPropertySet ____
103 /// @see css::beans::XPropertySet
104 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
105 /// @see ::comphelper::OPropertySetHelper
106 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
107 /// @see ::comphelper::OPropertyArrayUsageHelper
108 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const override
;
110 // ____ XDataSequence ____
111 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getData() override
;
112 virtual OUString SAL_CALL
getSourceRangeRepresentation() override
;
113 virtual css::uno::Sequence
< OUString
> SAL_CALL
generateLabel(
114 css::chart2::data::LabelOrigin nLabelOrigin
) override
;
115 virtual ::sal_Int32 SAL_CALL
getNumberFormatKeyByIndex( ::sal_Int32 nIndex
) override
;
117 // ____ XNumericalDataSequence ____
118 /// @see css::chart::data::XNumericalDataSequence
119 virtual css::uno::Sequence
< double > SAL_CALL
getNumericalData() override
;
121 // ____ XTextualDataSequence ____
122 /// @see css::chart::data::XTextualDataSequence
123 virtual css::uno::Sequence
< OUString
> SAL_CALL
getTextualData() override
;
125 // ____ XIndexReplace ____
126 virtual void SAL_CALL
replaceByIndex( ::sal_Int32 Index
, const css::uno::Any
& Element
) override
;
128 // ____ XIndexAccess (base of XIndexReplace) ____
129 virtual ::sal_Int32 SAL_CALL
getCount() override
;
130 virtual css::uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) override
;
132 // ____ XElementAccess (base of XIndexAccess) ____
133 virtual css::uno::Type SAL_CALL
getElementType() override
;
134 virtual sal_Bool SAL_CALL
hasElements() override
;
136 // ____ XNamed (for setting a new range representation) ____
137 virtual OUString SAL_CALL
getName() override
;
138 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
140 // ____ XCloneable ____
141 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone() override
;
143 // ____ XModifiable ____
144 virtual sal_Bool SAL_CALL
isModified() override
;
145 virtual void SAL_CALL
setModified( sal_Bool bModified
) override
;
147 // ____ XModifyBroadcaster (base of XModifiable) ____
148 virtual void SAL_CALL
addModifyListener(
149 const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
150 virtual void SAL_CALL
removeModifyListener(
151 const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
153 void fireModifyEvent();
156 sal_Int32 m_nNumberFormatKey
;
158 OUString m_aXMLRange
;
161 /** This method registers all properties. It should be called by all
164 void registerProperties();
166 rtl::Reference
< InternalDataProvider
> m_xDataProvider
;
167 OUString m_aSourceRepresentation
;
168 rtl::Reference
<ModifyEventForwarder
> m_xModifyEventForwarder
;
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */