1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef CHART_CHARTDOCUMENTWRAPPER_HXX 28 #define CHART_CHARTDOCUMENTWRAPPER_HXX 29 30 #include "WrappedPropertySet.hxx" 31 //#include "OPropertySet.hxx" 32 #include "ServiceMacros.hxx" 33 #include <com/sun/star/chart2/XChartDocument.hpp> 34 #include <com/sun/star/chart/XChartDocument.hpp> 35 #include <com/sun/star/uno/XComponentContext.hpp> 36 #include <com/sun/star/drawing/XDrawPageSupplier.hpp> 37 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 38 #include <com/sun/star/uno/XAggregation.hpp> 39 #include <com/sun/star/lang/XServiceInfo.hpp> 40 #include <com/sun/star/util/XRefreshable.hpp> 41 #include <cppuhelper/implbase5.hxx> 42 #include <osl/mutex.hxx> 43 #include <unotools/eventlisteneradapter.hxx> 44 #include <comphelper/uno3.hxx> 45 46 #include <boost/shared_ptr.hpp> 47 48 namespace chart 49 { 50 51 namespace wrapper 52 { 53 54 class Chart2ModelContact; 55 56 class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper5 57 < WrappedPropertySet 58 , ::com::sun::star::chart::XChartDocument 59 , ::com::sun::star::drawing::XDrawPageSupplier 60 , ::com::sun::star::lang::XMultiServiceFactory 61 , ::com::sun::star::lang::XServiceInfo 62 , ::com::sun::star::uno::XAggregation 63 > 64 { 65 }; 66 67 class ChartDocumentWrapper : public ChartDocumentWrapper_Base 68 , public ::utl::OEventListenerAdapter 69 { 70 public: 71 explicit ChartDocumentWrapper( 72 const ::com::sun::star::uno::Reference< 73 ::com::sun::star::uno::XComponentContext > & xContext ); 74 virtual ~ChartDocumentWrapper(); 75 76 /// XServiceInfo declarations 77 APPHELPER_XSERVICEINFO_DECL() 78 APPHELPER_SERVICE_FACTORY_HELPER(ChartDocumentWrapper) 79 80 void setAddIn( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable >& xAddIn ); 81 ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > getAddIn() const; 82 83 void setUpdateAddIn( sal_Bool bUpdateAddIn ); 84 sal_Bool getUpdateAddIn() const; 85 86 void setBaseDiagram( const rtl::OUString& rBaseDiagram ); 87 rtl::OUString getBaseDiagram() const; 88 89 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > getAdditionalShapes() const; 90 91 ::com::sun::star::uno::Reference< 92 ::com::sun::star::drawing::XDrawPage > impl_getDrawPage() const 93 throw (::com::sun::star::uno::RuntimeException); 94 95 protected: 96 97 // ____ chart::XChartDocument ____ 98 virtual ::com::sun::star::uno::Reference< 99 ::com::sun::star::drawing::XShape > SAL_CALL getTitle() 100 throw (::com::sun::star::uno::RuntimeException); 101 virtual ::com::sun::star::uno::Reference< 102 ::com::sun::star::drawing::XShape > SAL_CALL getSubTitle() 103 throw (::com::sun::star::uno::RuntimeException); 104 virtual ::com::sun::star::uno::Reference< 105 ::com::sun::star::drawing::XShape > SAL_CALL getLegend() 106 throw (::com::sun::star::uno::RuntimeException); 107 virtual ::com::sun::star::uno::Reference< 108 ::com::sun::star::beans::XPropertySet > SAL_CALL getArea() 109 throw (::com::sun::star::uno::RuntimeException); 110 virtual ::com::sun::star::uno::Reference< 111 ::com::sun::star::chart::XDiagram > SAL_CALL getDiagram() 112 throw (::com::sun::star::uno::RuntimeException); 113 virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference< 114 ::com::sun::star::chart::XDiagram >& xDiagram ) 115 throw (::com::sun::star::uno::RuntimeException); 116 virtual ::com::sun::star::uno::Reference< 117 ::com::sun::star::chart::XChartData > SAL_CALL getData() 118 throw (::com::sun::star::uno::RuntimeException); 119 virtual void SAL_CALL attachData( const ::com::sun::star::uno::Reference< 120 ::com::sun::star::chart::XChartData >& xData ) 121 throw (::com::sun::star::uno::RuntimeException); 122 123 // ____ XModel ____ 124 virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& URL, const ::com::sun::star::uno::Sequence< 125 ::com::sun::star::beans::PropertyValue >& Arguments ) 126 throw (::com::sun::star::uno::RuntimeException); 127 virtual ::rtl::OUString SAL_CALL getURL() 128 throw (::com::sun::star::uno::RuntimeException); 129 virtual ::com::sun::star::uno::Sequence< 130 ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs() 131 throw (::com::sun::star::uno::RuntimeException); 132 virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference< 133 ::com::sun::star::frame::XController >& Controller ) 134 throw (::com::sun::star::uno::RuntimeException); 135 virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference< 136 ::com::sun::star::frame::XController >& Controller ) 137 throw (::com::sun::star::uno::RuntimeException); 138 virtual void SAL_CALL lockControllers() 139 throw (::com::sun::star::uno::RuntimeException); 140 virtual void SAL_CALL unlockControllers() 141 throw (::com::sun::star::uno::RuntimeException); 142 virtual sal_Bool SAL_CALL hasControllersLocked() 143 throw (::com::sun::star::uno::RuntimeException); 144 virtual ::com::sun::star::uno::Reference< 145 ::com::sun::star::frame::XController > SAL_CALL getCurrentController() 146 throw (::com::sun::star::uno::RuntimeException); 147 virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference< 148 ::com::sun::star::frame::XController >& Controller ) 149 throw (::com::sun::star::container::NoSuchElementException, 150 ::com::sun::star::uno::RuntimeException); 151 virtual ::com::sun::star::uno::Reference< 152 ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection() 153 throw (::com::sun::star::uno::RuntimeException); 154 155 // ____ XComponent ____ 156 virtual void SAL_CALL dispose() 157 throw (::com::sun::star::uno::RuntimeException); 158 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 159 ::com::sun::star::lang::XEventListener >& xListener ) 160 throw (::com::sun::star::uno::RuntimeException); 161 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 162 ::com::sun::star::lang::XEventListener >& aListener ) 163 throw (::com::sun::star::uno::RuntimeException); 164 165 // ____ XInterface (for new interfaces) ____ 166 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) 167 throw (::com::sun::star::uno::RuntimeException); 168 169 // ____ ::utl::OEventListenerAdapter ____ 170 virtual void _disposing( const ::com::sun::star::lang::EventObject& rSource ); 171 172 // ____ XDrawPageSupplier ____ 173 virtual ::com::sun::star::uno::Reference< 174 ::com::sun::star::drawing::XDrawPage > SAL_CALL getDrawPage() 175 throw (::com::sun::star::uno::RuntimeException); 176 177 // ____ XMultiServiceFactory ____ 178 virtual ::com::sun::star::uno::Reference< 179 ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) 180 throw (::com::sun::star::uno::Exception, 181 ::com::sun::star::uno::RuntimeException); 182 virtual ::com::sun::star::uno::Reference< 183 ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( 184 const ::rtl::OUString& ServiceSpecifier, 185 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) 186 throw (::com::sun::star::uno::Exception, 187 ::com::sun::star::uno::RuntimeException); 188 virtual ::com::sun::star::uno::Sequence< 189 ::rtl::OUString > SAL_CALL getAvailableServiceNames() 190 throw (::com::sun::star::uno::RuntimeException); 191 192 // ____ XAggregation ____ 193 virtual void SAL_CALL setDelegator( 194 const ::com::sun::star::uno::Reference< 195 ::com::sun::star::uno::XInterface >& rDelegator ) 196 throw (::com::sun::star::uno::RuntimeException); 197 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) 198 throw (::com::sun::star::uno::RuntimeException); 199 200 // ____ WrappedPropertySet ____ 201 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 202 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 203 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 204 205 private: //methods 206 void impl_resetAddIn(); 207 208 private: //member 209 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 210 211 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDelegator; 212 213 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xTitle; 214 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xSubTitle; 215 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xLegend; 216 ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData > m_xChartData; 217 ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > m_xDiagram; 218 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xArea; 219 220 ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > m_xAddIn; 221 rtl::OUString m_aBaseDiagram; 222 sal_Bool m_bUpdateAddIn; 223 224 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xChartView; 225 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> 226 m_xShapeFactory; 227 228 bool m_bIsDisposed; 229 }; 230 231 } // namespace wrapper 232 } // namespace chart 233 234 // CHART_CHARTDOCUMENT_HXX 235 #endif 236