138d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 338d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 438d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 538d50f7bSAndrew Rist * distributed with this work for additional information 638d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 738d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 838d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 938d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 1038d50f7bSAndrew Rist * 1138d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1238d50f7bSAndrew Rist * 1338d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 1438d50f7bSAndrew Rist * software distributed under the License is distributed on an 1538d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1638d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 1738d50f7bSAndrew Rist * specific language governing permissions and limitations 1838d50f7bSAndrew Rist * under the License. 1938d50f7bSAndrew Rist * 2038d50f7bSAndrew Rist *************************************************************/ 2138d50f7bSAndrew Rist 22cdf0e10cSrcweir #ifndef SC_CHARTUNO_HXX 23cdf0e10cSrcweir #define SC_CHARTUNO_HXX 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include "address.hxx" 26cdf0e10cSrcweir #include <svl/lstner.hxx> 27cdf0e10cSrcweir #include <tools/string.hxx> 28cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 29cdf0e10cSrcweir #include <comphelper/propertycontainer.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <com/sun/star/table/XTableChart.hpp> 32cdf0e10cSrcweir #include <com/sun/star/table/XTableCharts.hpp> 33cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 35cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 36cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 37*7d1ce60bSWang Lei #include <com/sun/star/container/XNamedEx.hpp> 38cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx> 39cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir class ScDocShell; 43cdf0e10cSrcweir class ScRangeListRef; 44cdf0e10cSrcweir class ScChartObj; 45cdf0e10cSrcweir 46cdf0e10cSrcweir 47cdf0e10cSrcweir class ScChartsObj : public cppu::WeakImplHelper4< 48cdf0e10cSrcweir com::sun::star::table::XTableCharts, 49cdf0e10cSrcweir com::sun::star::container::XEnumerationAccess, 50cdf0e10cSrcweir com::sun::star::container::XIndexAccess, 51cdf0e10cSrcweir com::sun::star::lang::XServiceInfo >, 52cdf0e10cSrcweir public SfxListener 53cdf0e10cSrcweir { 54cdf0e10cSrcweir private: 55cdf0e10cSrcweir ScDocShell* pDocShell; 56cdf0e10cSrcweir SCTAB nTab; // Charts sind pro Sheet 57cdf0e10cSrcweir 58cdf0e10cSrcweir ScChartObj* GetObjectByIndex_Impl(long nIndex) const; 59cdf0e10cSrcweir ScChartObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const; 60cdf0e10cSrcweir 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir ScChartsObj(ScDocShell* pDocSh, SCTAB nT); 63cdf0e10cSrcweir virtual ~ScChartsObj(); 64cdf0e10cSrcweir 65cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir // XTableCharts 68cdf0e10cSrcweir virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, 69cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle& aRect, 70cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 71cdf0e10cSrcweir ::com::sun::star::table::CellRangeAddress >& aRanges, 72cdf0e10cSrcweir sal_Bool bColumnHeaders, sal_Bool bRowHeaders ) 73cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) 75cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 76cdf0e10cSrcweir 77cdf0e10cSrcweir // XNameAccess 78cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 79cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 80cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 81cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() 83cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 85cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir // XIndexAccess 88cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); 89cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) 90cdf0e10cSrcweir throw(::com::sun::star::lang::IndexOutOfBoundsException, 91cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 92cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XEnumerationAccess 95cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL 96cdf0e10cSrcweir createEnumeration() throw(::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir 98cdf0e10cSrcweir // XElementAccess 99cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 100cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XServiceInfo 104cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 105cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 107cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 109cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4< 114cdf0e10cSrcweir ::com::sun::star::table::XTableChart, 115cdf0e10cSrcweir ::com::sun::star::document::XEmbeddedObjectSupplier, 116*7d1ce60bSWang Lei ::com::sun::star::container::XNamedEx, // #i121178#: support displaying name 117cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > ScChartObj_Base; 118cdf0e10cSrcweir 119cdf0e10cSrcweir typedef ::comphelper::OPropertyContainer ScChartObj_PBase; 120cdf0e10cSrcweir typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase; 121cdf0e10cSrcweir 122cdf0e10cSrcweir class ScChartObj : public ::comphelper::OBaseMutex 123cdf0e10cSrcweir ,public ScChartObj_Base 124cdf0e10cSrcweir ,public ScChartObj_PBase 125cdf0e10cSrcweir ,public ScChartObj_PABase 126cdf0e10cSrcweir ,public SfxListener 127cdf0e10cSrcweir { 128cdf0e10cSrcweir private: 129cdf0e10cSrcweir ScDocShell* pDocShell; 130cdf0e10cSrcweir SCTAB nTab; // Charts sind pro Sheet 131cdf0e10cSrcweir String aChartName; 132*7d1ce60bSWang Lei String aObjectName; // #i121178#: the OLE object's name(displaying name) 133cdf0e10cSrcweir 134cdf0e10cSrcweir void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders ); 135cdf0e10cSrcweir void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const; 136cdf0e10cSrcweir 137cdf0e10cSrcweir protected: 138cdf0e10cSrcweir // ::comphelper::OPropertySetHelper 139cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 140cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 141cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 142cdf0e10cSrcweir using ::cppu::OPropertySetHelper::getFastPropertyValue; 143cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; 144cdf0e10cSrcweir 145cdf0e10cSrcweir // ::comphelper::OPropertyArrayUsageHelper 146cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; 147cdf0e10cSrcweir 148cdf0e10cSrcweir public: 149cdf0e10cSrcweir ScChartObj(ScDocShell* pDocSh, SCTAB nT, const String& rN); 150cdf0e10cSrcweir virtual ~ScChartObj(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir // XInterface 155cdf0e10cSrcweir DECLARE_XINTERFACE() 156cdf0e10cSrcweir 157cdf0e10cSrcweir // XTypeProvider 158cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 159cdf0e10cSrcweir 160cdf0e10cSrcweir // XComponent 161cdf0e10cSrcweir virtual void SAL_CALL disposing(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir // XTableChart 164cdf0e10cSrcweir virtual sal_Bool SAL_CALL getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException); 165cdf0e10cSrcweir virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders ) 166cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 167cdf0e10cSrcweir virtual sal_Bool SAL_CALL getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException); 168cdf0e10cSrcweir virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders ) 169cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 170cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL 171cdf0e10cSrcweir getRanges( ) throw(::com::sun::star::uno::RuntimeException); 172cdf0e10cSrcweir virtual void SAL_CALL setRanges( const ::com::sun::star::uno::Sequence< 173cdf0e10cSrcweir ::com::sun::star::table::CellRangeAddress >& aRanges ) 174cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 175cdf0e10cSrcweir 176cdf0e10cSrcweir // XEmbeddedObjectSupplier 177cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL 178cdf0e10cSrcweir getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException); 179cdf0e10cSrcweir 180cdf0e10cSrcweir // XNamed 181cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); 182cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& aName ) 183cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 184cdf0e10cSrcweir 185*7d1ce60bSWang Lei // XNamedEx 186*7d1ce60bSWang Lei virtual ::rtl::OUString SAL_CALL getDisplayName() throw(::com::sun::star::uno::RuntimeException); 187*7d1ce60bSWang Lei virtual void SAL_CALL setDisplayName( const ::rtl::OUString& aName ) 188*7d1ce60bSWang Lei throw(::com::sun::star::uno::RuntimeException); 189*7d1ce60bSWang Lei 190cdf0e10cSrcweir // XServiceInfo 191cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 192cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 193cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 194cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 195cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 196cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 197cdf0e10cSrcweir 198cdf0e10cSrcweir // XPropertySet 199cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() 200cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 201cdf0e10cSrcweir }; 202cdf0e10cSrcweir 203cdf0e10cSrcweir #endif 204cdf0e10cSrcweir 205