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_CHARTUNO_HXX 29*cdf0e10cSrcweir #define SC_CHARTUNO_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "address.hxx" 32*cdf0e10cSrcweir #include <svl/lstner.hxx> 33*cdf0e10cSrcweir #include <tools/string.hxx> 34*cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 35*cdf0e10cSrcweir #include <comphelper/propertycontainer.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <com/sun/star/table/XTableChart.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/table/XTableCharts.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 44*cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx> 45*cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir class ScDocShell; 49*cdf0e10cSrcweir class ScRangeListRef; 50*cdf0e10cSrcweir class ScChartObj; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir class ScChartsObj : public cppu::WeakImplHelper4< 54*cdf0e10cSrcweir com::sun::star::table::XTableCharts, 55*cdf0e10cSrcweir com::sun::star::container::XEnumerationAccess, 56*cdf0e10cSrcweir com::sun::star::container::XIndexAccess, 57*cdf0e10cSrcweir com::sun::star::lang::XServiceInfo >, 58*cdf0e10cSrcweir public SfxListener 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir private: 61*cdf0e10cSrcweir ScDocShell* pDocShell; 62*cdf0e10cSrcweir SCTAB nTab; // Charts sind pro Sheet 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir ScChartObj* GetObjectByIndex_Impl(long nIndex) const; 65*cdf0e10cSrcweir ScChartObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir public: 68*cdf0e10cSrcweir ScChartsObj(ScDocShell* pDocSh, SCTAB nT); 69*cdf0e10cSrcweir virtual ~ScChartsObj(); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // XTableCharts 74*cdf0e10cSrcweir virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, 75*cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle& aRect, 76*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 77*cdf0e10cSrcweir ::com::sun::star::table::CellRangeAddress >& aRanges, 78*cdf0e10cSrcweir sal_Bool bColumnHeaders, sal_Bool bRowHeaders ) 79*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 80*cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) 81*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // XNameAccess 84*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 85*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 86*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 87*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 88*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() 89*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 90*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 91*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // XIndexAccess 94*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); 95*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) 96*cdf0e10cSrcweir throw(::com::sun::star::lang::IndexOutOfBoundsException, 97*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 98*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // XEnumerationAccess 101*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL 102*cdf0e10cSrcweir createEnumeration() throw(::com::sun::star::uno::RuntimeException); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir // XElementAccess 105*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 106*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir // XServiceInfo 110*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 111*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 113*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 115*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir }; 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4< 120*cdf0e10cSrcweir ::com::sun::star::table::XTableChart, 121*cdf0e10cSrcweir ::com::sun::star::document::XEmbeddedObjectSupplier, 122*cdf0e10cSrcweir ::com::sun::star::container::XNamed, 123*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > ScChartObj_Base; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir typedef ::comphelper::OPropertyContainer ScChartObj_PBase; 126*cdf0e10cSrcweir typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir class ScChartObj : public ::comphelper::OBaseMutex 129*cdf0e10cSrcweir ,public ScChartObj_Base 130*cdf0e10cSrcweir ,public ScChartObj_PBase 131*cdf0e10cSrcweir ,public ScChartObj_PABase 132*cdf0e10cSrcweir ,public SfxListener 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir private: 135*cdf0e10cSrcweir ScDocShell* pDocShell; 136*cdf0e10cSrcweir SCTAB nTab; // Charts sind pro Sheet 137*cdf0e10cSrcweir String aChartName; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders ); 140*cdf0e10cSrcweir void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir protected: 143*cdf0e10cSrcweir // ::comphelper::OPropertySetHelper 144*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 145*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 146*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 147*cdf0e10cSrcweir using ::cppu::OPropertySetHelper::getFastPropertyValue; 148*cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // ::comphelper::OPropertyArrayUsageHelper 151*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir public: 154*cdf0e10cSrcweir ScChartObj(ScDocShell* pDocSh, SCTAB nT, const String& rN); 155*cdf0e10cSrcweir virtual ~ScChartObj(); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir // XInterface 160*cdf0e10cSrcweir DECLARE_XINTERFACE() 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // XTypeProvider 163*cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir // XComponent 166*cdf0e10cSrcweir virtual void SAL_CALL disposing(); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir // XTableChart 169*cdf0e10cSrcweir virtual sal_Bool SAL_CALL getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders ) 171*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 172*cdf0e10cSrcweir virtual sal_Bool SAL_CALL getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException); 173*cdf0e10cSrcweir virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders ) 174*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 175*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL 176*cdf0e10cSrcweir getRanges( ) throw(::com::sun::star::uno::RuntimeException); 177*cdf0e10cSrcweir virtual void SAL_CALL setRanges( const ::com::sun::star::uno::Sequence< 178*cdf0e10cSrcweir ::com::sun::star::table::CellRangeAddress >& aRanges ) 179*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir // XEmbeddedObjectSupplier 182*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL 183*cdf0e10cSrcweir getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir // XNamed 186*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); 187*cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& aName ) 188*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir // XServiceInfo 191*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 192*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 193*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 194*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 195*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 196*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir // XPropertySet 199*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() 200*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 201*cdf0e10cSrcweir }; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir #endif 204*cdf0e10cSrcweir 205