1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _CHART_UNCACHEDDATASEQUENCE_HXX 24 #define _CHART_UNCACHEDDATASEQUENCE_HXX 25 26 // helper classes 27 #include <cppuhelper/compbase8.hxx> 28 #include <comphelper/uno3.hxx> 29 #include <comphelper/broadcasthelper.hxx> 30 #include <comphelper/propertycontainer.hxx> 31 #include <comphelper/proparrhlp.hxx> 32 #include "ServiceMacros.hxx" 33 #include "charttoolsdllapi.hxx" 34 35 // interfaces and types 36 #include <com/sun/star/lang/XServiceInfo.hpp> 37 #include <com/sun/star/beans/XPropertySet.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 #include <com/sun/star/chart2/XInternalDataProvider.hpp> 40 #include <com/sun/star/chart2/data/XDataSequence.hpp> 41 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> 42 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> 43 #include <com/sun/star/container/XIndexReplace.hpp> 44 #include <com/sun/star/container/XNamed.hpp> 45 #include <com/sun/star/util/XCloneable.hpp> 46 #include <com/sun/star/util/XModifyBroadcaster.hpp> 47 #include <com/sun/star/util/XModifiable.hpp> 48 49 #include <vector> 50 51 // ____________________ 52 namespace chart 53 { 54 55 namespace impl 56 { 57 typedef ::cppu::WeakComponentImplHelper8< 58 ::com::sun::star::chart2::data::XDataSequence, 59 ::com::sun::star::chart2::data::XNumericalDataSequence, 60 ::com::sun::star::chart2::data::XTextualDataSequence, 61 ::com::sun::star::util::XCloneable, 62 ::com::sun::star::util::XModifiable, // contains util::XModifyBroadcaster 63 ::com::sun::star::container::XIndexReplace, 64 ::com::sun::star::container::XNamed, // for setting a new range representation 65 ::com::sun::star::lang::XServiceInfo > 66 UncachedDataSequence_Base; 67 } 68 69 class UncachedDataSequence : 70 public ::comphelper::OMutexAndBroadcastHelper, 71 public ::comphelper::OPropertyContainer, 72 public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >, 73 public impl::UncachedDataSequence_Base 74 { 75 public: 76 /** The referring data provider is held as uno reference to ensure its 77 lifetime is at least as long as the one of this object. 78 */ 79 UncachedDataSequence( 80 const ::com::sun::star::uno::Reference< 81 ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv, 82 const ::rtl::OUString & rRangeRepresentation ); 83 UncachedDataSequence( 84 const ::com::sun::star::uno::Reference< 85 ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv, 86 const ::rtl::OUString & rRangeRepresentation, 87 const ::rtl::OUString & rRole ); 88 UncachedDataSequence( const UncachedDataSequence & rSource ); 89 virtual ~UncachedDataSequence(); 90 91 /// declare XServiceInfo methods 92 APPHELPER_XSERVICEINFO_DECL() 93 94 /// merge XInterface implementations 95 DECLARE_XINTERFACE() 96 /// merge XTypeProvider implementations 97 DECLARE_XTYPEPROVIDER() 98 99 protected: 100 // ____ XPropertySet ____ 101 /// @see ::com::sun::star::beans::XPropertySet 102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(); 103 /// @see ::comphelper::OPropertySetHelper 104 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 105 /// @see ::comphelper::OPropertyArrayUsageHelper 106 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; 107 108 // ____ XDataSequence ____ 109 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData(); 110 virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation(); 111 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel( 112 ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin ); 113 virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ); 114 115 // ____ XNumericalDataSequence ____ 116 /// @see ::com::sun::star::chart::data::XNumericalDataSequence 117 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData(); 118 119 // ____ XTextualDataSequence ____ 120 /// @see ::com::sun::star::chart::data::XTextualDataSequence 121 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData(); 122 123 // ____ XIndexReplace ____ 124 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ); 125 126 // ____ XIndexAccess (base of XIndexReplace) ____ 127 virtual ::sal_Int32 SAL_CALL getCount(); 128 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ); 129 130 // ____ XElementAccess (base of XIndexAccess) ____ 131 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 132 virtual ::sal_Bool SAL_CALL hasElements(); 133 134 // ____ XNamed (for setting a new range representation) ____ 135 virtual ::rtl::OUString SAL_CALL getName(); 136 virtual void SAL_CALL setName( const ::rtl::OUString& aName ); 137 138 // ____ XCloneable ____ 139 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(); 140 141 // ____ XModifiable ____ 142 virtual ::sal_Bool SAL_CALL isModified(); 143 virtual void SAL_CALL setModified( ::sal_Bool bModified ); 144 145 // ____ XModifyBroadcaster (base of XModifiable) ____ 146 virtual void SAL_CALL addModifyListener( 147 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); 148 virtual void SAL_CALL removeModifyListener( 149 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); 150 151 void fireModifyEvent(); 152 153 mutable ::osl::Mutex m_aMutex; 154 155 // <properties> 156 sal_Int32 m_nNumberFormatKey; 157 ::rtl::OUString m_sRole; 158 ::rtl::OUString m_aXMLRange; 159 // </properties> 160 161 /** This method registers all properties. It should be called by all 162 constructors. 163 */ 164 void registerProperties(); 165 166 private: 167 ::com::sun::star::uno::Reference< 168 ::com::sun::star::chart2::XInternalDataProvider > m_xDataProvider; 169 ::rtl::OUString m_aSourceRepresentation; 170 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > 171 m_xModifyEventForwarder; 172 }; 173 174 } // namespace chart 175 176 177 // _CHART_UNCACHEDDATASEQUENCE_HXX 178 #endif 179