1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_CHART2UNO_HXX 29*cdf0e10cSrcweir #define SC_CHART2UNO_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "cellsuno.hxx" // for XModifyListenerArr_Impl / ScLinkListener 32*cdf0e10cSrcweir #include "rangelst.hxx" 33*cdf0e10cSrcweir #include "externalrefmgr.hxx" 34*cdf0e10cSrcweir #include "token.hxx" 35*cdf0e10cSrcweir #include "chartlis.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <svl/lstner.hxx> 38*cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataProvider.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSource.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSequence.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/chart2/data/DataSequenceRole.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp> 51*cdf0e10cSrcweir // #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ 52*cdf0e10cSrcweir // #include <com/sun/star/lang/XUnoTunnel.hpp> 53*cdf0e10cSrcweir // #endif 54*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 55*cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 56*cdf0e10cSrcweir #include <cppuhelper/implbase6.hxx> 57*cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx> 58*cdf0e10cSrcweir #include <rtl/ustring.hxx> 59*cdf0e10cSrcweir #include <svl/itemprop.hxx> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir #include <hash_set> 62*cdf0e10cSrcweir #include <list> 63*cdf0e10cSrcweir #include <vector> 64*cdf0e10cSrcweir #include <memory> 65*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir #define USE_CHART2_EMPTYDATASEQUENCE 0 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir class ScDocument; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir // DataProvider ============================================================== 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir class ScChart2DataProvider : public 74*cdf0e10cSrcweir ::cppu::WeakImplHelper4< 75*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataProvider, 76*cdf0e10cSrcweir ::com::sun::star::chart2::data::XRangeXMLConversion, 77*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet, 78*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo>, 79*cdf0e10cSrcweir SfxListener 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir public: 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir explicit ScChart2DataProvider( ScDocument* pDoc ); 84*cdf0e10cSrcweir virtual ~ScChart2DataProvider(); 85*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // XDataProvider --------------------------------------------------------- 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL createDataSourcePossible( 90*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) 91*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 94*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource( 95*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) 96*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 99*cdf0e10cSrcweir ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( 100*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) 101*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( 104*cdf0e10cSrcweir const ::rtl::OUString& aRangeRepresentation ) 105*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 108*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( 109*cdf0e10cSrcweir const ::rtl::OUString& aRangeRepresentation ) 110*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection() 113*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir /* virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > SAL_CALL getNumberFormatsSupplier() 116*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException);*/ 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir // XRangeXMLConversion --------------------------------------------------- 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL convertRangeToXML( const ::rtl::OUString& sRangeRepresentation ) 121*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& sXMLRange ) 124*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // XPropertySet ---------------------------------------------------------- 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 129*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySetInfo> SAL_CALL 130*cdf0e10cSrcweir getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( 133*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 134*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) 135*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 136*cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 137*cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 138*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 139*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 142*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName) 143*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 144*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 145*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( 148*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 149*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 150*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& xListener) 151*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 152*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 153*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( 156*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 157*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 158*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& rListener) 159*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 160*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 161*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( 164*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 165*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 166*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 167*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 168*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 169*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( 172*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 173*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 174*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 175*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 176*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 177*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir // XServiceInfo ---------------------------------------------------------- 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( 182*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 185*cdf0e10cSrcweir rServiceName) throw( ::com::sun::star::uno::RuntimeException); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 188*cdf0e10cSrcweir getSupportedServiceNames() throw( 189*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir private: 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir ScDocument* m_pDocument; 194*cdf0e10cSrcweir SfxItemPropertySet m_aPropSet; 195*cdf0e10cSrcweir sal_Bool m_bIncludeHiddenCells; 196*cdf0e10cSrcweir }; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // DataSource ================================================================ 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir class ScChart2DataSource : public 202*cdf0e10cSrcweir ::cppu::WeakImplHelper2< 203*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSource, 204*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo>, 205*cdf0e10cSrcweir SfxListener 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir public: 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir explicit ScChart2DataSource( ScDocument* pDoc); 210*cdf0e10cSrcweir virtual ~ScChart2DataSource(); 211*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir // XDataSource ----------------------------------------------------------- 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< 216*cdf0e10cSrcweir ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL 217*cdf0e10cSrcweir getDataSequences() throw (::com::sun::star::uno::RuntimeException); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir // XServiceInfo ---------------------------------------------------------- 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( 222*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 225*cdf0e10cSrcweir rServiceName) throw( ::com::sun::star::uno::RuntimeException); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 228*cdf0e10cSrcweir getSupportedServiceNames() throw( 229*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // implementation 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir void AddLabeledSequence(const com::sun::star::uno::Reference < com::sun::star::chart2::data::XLabeledDataSequence >& xNew); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir private: 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir ScDocument* m_pDocument; 238*cdf0e10cSrcweir typedef std::list < com::sun::star::uno::Reference< com::sun::star::chart2::data::XLabeledDataSequence > > LabeledList; 239*cdf0e10cSrcweir LabeledList m_aLabeledSequences; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir }; 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir // DataSequence ============================================================== 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir class ScChart2DataSequence : public 247*cdf0e10cSrcweir ::cppu::WeakImplHelper7< 248*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSequence, 249*cdf0e10cSrcweir ::com::sun::star::chart2::data::XTextualDataSequence, 250*cdf0e10cSrcweir ::com::sun::star::chart2::data::XNumericalDataSequence, 251*cdf0e10cSrcweir ::com::sun::star::util::XCloneable, 252*cdf0e10cSrcweir ::com::sun::star::util::XModifyBroadcaster, 253*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet, 254*cdf0e10cSrcweir // ::com::sun::star::lang::XUnoTunnel, 255*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo>, 256*cdf0e10cSrcweir SfxListener 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir public: 259*cdf0e10cSrcweir explicit ScChart2DataSequence( ScDocument* pDoc, 260*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP, 261*cdf0e10cSrcweir ::std::vector<ScSharedTokenRef>* pTokens, bool bIncludeHiddenCells ); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir virtual ~ScChart2DataSequence(); 264*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir // XDataSequence --------------------------------------------------------- 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 269*cdf0e10cSrcweir SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); 270*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() 271*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 272*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 273*cdf0e10cSrcweir SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin) 274*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 275*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) 276*cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 277*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir // XNumericalDataSequence -------------------------------------------------- 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< double > 282*cdf0e10cSrcweir SAL_CALL getNumericalData( ) throw (::com::sun::star::uno::RuntimeException); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // XTextualDataSequence -------------------------------------------------- 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 287*cdf0e10cSrcweir SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir // XPropertySet ---------------------------------------------------------- 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 292*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySetInfo> SAL_CALL 293*cdf0e10cSrcweir getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( 296*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 297*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) 298*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 299*cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 300*cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 301*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 302*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 305*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName) 306*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 307*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 308*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( 311*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 312*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 313*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& xListener) 314*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 315*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 316*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( 319*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 320*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 321*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& rListener) 322*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 323*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 324*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( 327*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 328*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 329*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 330*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 331*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 332*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( 335*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 336*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 337*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 338*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 339*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 340*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir // XCloneable ------------------------------------------------------------ 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 345*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir // XModifyBroadcaster ---------------------------------------------------- 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir virtual void SAL_CALL addModifyListener( 350*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 351*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 352*cdf0e10cSrcweir virtual void SAL_CALL removeModifyListener( 353*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 354*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir // XServiceInfo ---------------------------------------------------------- 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( 359*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 362*cdf0e10cSrcweir rServiceName) throw( ::com::sun::star::uno::RuntimeException); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 365*cdf0e10cSrcweir getSupportedServiceNames() throw( 366*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir // XUnoTunnel ------------------------------------------------------------ 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir // virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 371*cdf0e10cSrcweir // sal_Int8 >& aIdentifier ) 372*cdf0e10cSrcweir // throw(::com::sun::star::uno::RuntimeException); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir // static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 375*cdf0e10cSrcweir // static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference< 376*cdf0e10cSrcweir // com::sun::star::uno::XInterface> xObj ); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir private: 379*cdf0e10cSrcweir void setDataChangedHint(bool b); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir // Implementation -------------------------------------------------------- 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir void RefChanged(); 384*cdf0e10cSrcweir DECL_LINK( ValueListenerHdl, SfxHint* ); 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir private: 387*cdf0e10cSrcweir ScChart2DataSequence(); // disabled 388*cdf0e10cSrcweir ScChart2DataSequence(const ScChart2DataSequence& r); // disabled 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir class ExternalRefListener : public ScExternalRefManager::LinkListener 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir public: 393*cdf0e10cSrcweir ExternalRefListener(ScChart2DataSequence& rParent, ScDocument* pDoc); 394*cdf0e10cSrcweir virtual ~ExternalRefListener(); 395*cdf0e10cSrcweir virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType); 396*cdf0e10cSrcweir void addFileId(sal_uInt16 nFileId); 397*cdf0e10cSrcweir void removeFileId(sal_uInt16 nFileId); 398*cdf0e10cSrcweir const ::std::hash_set<sal_uInt16>& getAllFileIds(); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir private: 401*cdf0e10cSrcweir ExternalRefListener(); 402*cdf0e10cSrcweir ExternalRefListener(const ExternalRefListener& r); 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir ScChart2DataSequence& mrParent; 405*cdf0e10cSrcweir ::std::hash_set<sal_uInt16> maFileIds; 406*cdf0e10cSrcweir ScDocument* mpDoc; 407*cdf0e10cSrcweir }; 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir /** 410*cdf0e10cSrcweir * Build an internal data array to cache the data ranges, and other 411*cdf0e10cSrcweir * information such as hidden values. 412*cdf0e10cSrcweir */ 413*cdf0e10cSrcweir void BuildDataCache(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir void RebuildDataCache(); 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir sal_Int32 FillCacheFromExternalRef(const ScSharedTokenRef& pToken); 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir void UpdateTokensFromRanges(const ScRangeList& rRanges); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir ExternalRefListener* GetExtRefListener(); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir void StopListeningToAllExternalRefs(); 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir void CopyData(const ScChart2DataSequence& r); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir private: 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir // data array 430*cdf0e10cSrcweir struct Item 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir double mfValue; 433*cdf0e10cSrcweir ::rtl::OUString maString; 434*cdf0e10cSrcweir bool mbIsValue; 435*cdf0e10cSrcweir Item(); 436*cdf0e10cSrcweir }; 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir class HiddenRangeListener : public ScChartHiddenRangeListener 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir public: 441*cdf0e10cSrcweir HiddenRangeListener(ScChart2DataSequence& rParent); 442*cdf0e10cSrcweir virtual ~HiddenRangeListener(); 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir virtual void notify(); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir private: 447*cdf0e10cSrcweir ScChart2DataSequence& mrParent; 448*cdf0e10cSrcweir }; 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir ::std::list<Item> m_aDataArray; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir /** 453*cdf0e10cSrcweir * Cached data for getData. We may also need to cache data for the 454*cdf0e10cSrcweir * numerical and textural data series if they turn out to be bottlenecks 455*cdf0e10cSrcweir * under certain scenarios. 456*cdf0e10cSrcweir */ 457*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aMixedDataCache; 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Int32> m_aHiddenValues; 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir // properties 462*cdf0e10cSrcweir ::com::sun::star::chart2::data::DataSequenceRole m_aRole; 463*cdf0e10cSrcweir sal_Bool m_bIncludeHiddenCells; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir // internals 466*cdf0e10cSrcweir typedef ::std::auto_ptr< ::std::vector<ScSharedTokenRef> > TokenListPtr; 467*cdf0e10cSrcweir typedef ::std::auto_ptr< ::std::vector<sal_uInt32> > RangeIndexMapPtr; 468*cdf0e10cSrcweir typedef ::std::auto_ptr<ExternalRefListener> ExtRefListenerPtr; 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir sal_Int64 m_nObjectId; 471*cdf0e10cSrcweir ScDocument* m_pDocument; 472*cdf0e10cSrcweir TokenListPtr m_pTokens; 473*cdf0e10cSrcweir RangeIndexMapPtr m_pRangeIndices; 474*cdf0e10cSrcweir ExtRefListenerPtr m_pExtRefListener; 475*cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider; 476*cdf0e10cSrcweir SfxItemPropertySet m_aPropSet; 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener; 479*cdf0e10cSrcweir ScLinkListener* m_pValueListener; 480*cdf0e10cSrcweir XModifyListenerArr_Impl m_aValueListeners; 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir bool m_bGotDataChangedHint; 483*cdf0e10cSrcweir bool m_bExtDataRebuildQueued; 484*cdf0e10cSrcweir }; 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir #if USE_CHART2_EMPTYDATASEQUENCE 487*cdf0e10cSrcweir // DataSequence ============================================================== 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir class ScChart2EmptyDataSequence : public 490*cdf0e10cSrcweir ::cppu::WeakImplHelper6< 491*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSequence, 492*cdf0e10cSrcweir ::com::sun::star::chart2::data::XTextualDataSequence, 493*cdf0e10cSrcweir ::com::sun::star::util::XCloneable, 494*cdf0e10cSrcweir ::com::sun::star::util::XModifyBroadcaster, 495*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet, 496*cdf0e10cSrcweir // ::com::sun::star::lang::XUnoTunnel, 497*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo>, 498*cdf0e10cSrcweir SfxListener 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir public: 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir explicit ScChart2EmptyDataSequence( ScDocument* pDoc, 503*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP, 504*cdf0e10cSrcweir const ScRangeListRef& rRangeList, sal_Bool bColumn ); 505*cdf0e10cSrcweir virtual ~ScChart2EmptyDataSequence(); 506*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir // XDataSequence --------------------------------------------------------- 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 511*cdf0e10cSrcweir SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); 512*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() 513*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 514*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 515*cdf0e10cSrcweir SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin) 516*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 517*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) 518*cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 519*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir // XTextualDataSequence -------------------------------------------------- 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 524*cdf0e10cSrcweir SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir // XPropertySet ---------------------------------------------------------- 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 529*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySetInfo> SAL_CALL 530*cdf0e10cSrcweir getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( 533*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 534*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) 535*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 536*cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 537*cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 538*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 539*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 542*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName) 543*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 544*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 545*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( 548*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 549*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 550*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& xListener) 551*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 552*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 553*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( 556*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 557*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 558*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener>& rListener) 559*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 560*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 561*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( 564*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 565*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 566*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 567*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 568*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 569*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( 572*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 573*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 574*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener>& rListener) 575*cdf0e10cSrcweir throw( ::com::sun::star::beans::UnknownPropertyException, 576*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 577*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir // XCloneable ------------------------------------------------------------ 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 582*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir // XModifyBroadcaster ---------------------------------------------------- 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir virtual void SAL_CALL addModifyListener( 587*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 588*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 589*cdf0e10cSrcweir virtual void SAL_CALL removeModifyListener( 590*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 591*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir // XServiceInfo ---------------------------------------------------------- 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw( 596*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 599*cdf0e10cSrcweir rServiceName) throw( ::com::sun::star::uno::RuntimeException); 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 602*cdf0e10cSrcweir getSupportedServiceNames() throw( 603*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir // XUnoTunnel ------------------------------------------------------------ 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir // virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< 608*cdf0e10cSrcweir // sal_Int8 >& aIdentifier ) 609*cdf0e10cSrcweir // throw(::com::sun::star::uno::RuntimeException); 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir // static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); 612*cdf0e10cSrcweir // static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference< 613*cdf0e10cSrcweir // com::sun::star::uno::XInterface> xObj ); 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir // Implementation -------------------------------------------------------- 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir ScRangeListRef GetRangeList() { return m_xRanges; } 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir private: 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir // properties 622*cdf0e10cSrcweir ::com::sun::star::chart2::data::DataSequenceRole m_aRole; 623*cdf0e10cSrcweir sal_Bool m_bIncludeHiddenCells; 624*cdf0e10cSrcweir // internals 625*cdf0e10cSrcweir ScRangeListRef m_xRanges; 626*cdf0e10cSrcweir ScDocument* m_pDocument; 627*cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider; 628*cdf0e10cSrcweir SfxItemPropertySet m_aPropSet; 629*cdf0e10cSrcweir sal_Bool m_bColumn; // defines the orientation to create the right labels 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir }; 632*cdf0e10cSrcweir #endif 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir #endif // SC_CHART2UNO_HXX 635