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 RPT_SHAPE_HXX 28 #define RPT_SHAPE_HXX 29 30 #include <cppuhelper/propertysetmixin.hxx> 31 #include <com/sun/star/report/XShape.hpp> 32 #include "ReportControlModel.hxx" 33 #include <cppuhelper/compbase2.hxx> 34 #include <comphelper/broadcasthelper.hxx> 35 #include <com/sun/star/lang/XServiceInfo.hpp> 36 #include "ReportHelperDefines.hxx" 37 #include <comphelper/propagg.hxx> 38 #include <memory> 39 40 namespace reportdesign 41 { 42 typedef ::cppu::PropertySetMixin< com::sun::star::report::XShape > ShapePropertySet; 43 typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XShape 44 ,com::sun::star::lang::XServiceInfo > ShapeBase; 45 46 /** \class OShape Defines the implementation of a \interface com:::sun::star::report::XShape 47 * \ingroup reportdesign_api 48 * 49 */ 50 class OShape : public comphelper::OBaseMutex, 51 public ShapeBase, 52 public ShapePropertySet 53 { 54 friend class OShapeHelper; 55 ::std::auto_ptr< ::comphelper::OPropertyArrayAggregationHelper> m_pAggHelper; 56 OReportControlModel m_aProps; 57 com::sun::star::drawing::HomogenMatrix3 m_Transformation; 58 ::sal_Int32 m_nZOrder; 59 ::sal_Bool m_bOpaque; 60 61 ::rtl::OUString m_sServiceName; 62 ::rtl::OUString m_CustomShapeEngine; 63 ::rtl::OUString m_CustomShapeData; 64 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > 65 m_CustomShapeGeometry; 66 67 private: 68 OShape(const OShape&); 69 OShape& operator=(const OShape&); 70 71 template <typename T> void set( const ::rtl::OUString& _sProperty 72 ,const T& _Value 73 ,T& _member) 74 { 75 BoundListeners l; 76 { 77 ::osl::MutexGuard aGuard(m_aMutex); 78 prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l); 79 _member = _Value; 80 } 81 l.notify(); 82 } 83 void checkIndex(sal_Int32 _nIndex); 84 cppu::IPropertyArrayHelper& getInfoHelper(); 85 protected: 86 virtual ~OShape(); 87 public: 88 explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext); 89 explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext 90 ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory 91 ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape 92 ,const ::rtl::OUString& _sServiceName); 93 94 DECLARE_XINTERFACE( ) 95 // ::com::sun::star::lang::XServiceInfo 96 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 97 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 98 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 99 100 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); 101 static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException ); 102 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 103 create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); 104 // com::sun::star::beans::XPropertySet 105 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 106 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 107 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 108 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 109 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 110 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 111 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 112 113 // XReportComponent 114 REPORTCOMPONENT_HEADER() 115 116 // XShape 117 SHAPE_HEADER() 118 119 virtual ::rtl::OUString SAL_CALL getCustomShapeEngine() throw (::com::sun::star::uno::RuntimeException); 120 virtual void SAL_CALL setCustomShapeEngine( const ::rtl::OUString& _customshapeengine ) throw (::com::sun::star::uno::RuntimeException); 121 virtual ::rtl::OUString SAL_CALL getCustomShapeData() throw (::com::sun::star::uno::RuntimeException); 122 virtual void SAL_CALL setCustomShapeData( const ::rtl::OUString& _customshapedata ) throw (::com::sun::star::uno::RuntimeException); 123 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() throw (::com::sun::star::uno::RuntimeException); 124 virtual void SAL_CALL setCustomShapeGeometry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _customshapegeometry ) throw (::com::sun::star::uno::RuntimeException); 125 126 virtual ::sal_Bool SAL_CALL getOpaque() throw (::com::sun::star::uno::RuntimeException); 127 virtual void SAL_CALL setOpaque( ::sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException); 128 129 // XShapeDescriptor 130 virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException); 131 132 // XReportControlModel 133 REPORTCONTROLMODEL_HEADER() 134 135 // XReportControlFormat 136 REPORTCONTROLFORMAT_HEADER() 137 // XShape 138 virtual ::sal_Int32 SAL_CALL getZOrder() throw (::com::sun::star::uno::RuntimeException); 139 virtual void SAL_CALL setZOrder( ::sal_Int32 _zorder ) throw (::com::sun::star::uno::RuntimeException); 140 virtual ::com::sun::star::drawing::HomogenMatrix3 SAL_CALL getTransformation() throw (::com::sun::star::uno::RuntimeException); 141 virtual void SAL_CALL setTransformation( const ::com::sun::star::drawing::HomogenMatrix3& _transformation ) throw (::com::sun::star::uno::RuntimeException); 142 143 // XCloneable 144 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); 145 146 // XComponent 147 virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); 148 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 149 { 150 cppu::WeakComponentImplHelperBase::addEventListener(aListener); 151 } 152 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 153 { 154 cppu::WeakComponentImplHelperBase::removeEventListener(aListener); 155 } 156 157 // XChild 158 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException); 159 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 160 161 // XContainer 162 virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 163 virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 164 165 // XElementAccess 166 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); 167 virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); 168 169 // XIndexReplace 170 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 171 172 // XIndexContainer 173 virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 174 virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 175 176 // XIndexAccess 177 virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException); 178 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 179 }; 180 } 181 #endif //RPT_SHAPE_HXX 182 183