xref: /trunk/main/reportdesign/source/core/inc/Shape.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir #ifndef RPT_SHAPE_HXX
24cdf0e10cSrcweir #define RPT_SHAPE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <cppuhelper/propertysetmixin.hxx>
27cdf0e10cSrcweir #include <com/sun/star/report/XShape.hpp>
28cdf0e10cSrcweir #include "ReportControlModel.hxx"
29cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx>
30cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include "ReportHelperDefines.hxx"
33cdf0e10cSrcweir #include <comphelper/propagg.hxx>
34cdf0e10cSrcweir #include <memory>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace reportdesign
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     typedef ::cppu::PropertySetMixin<        com::sun::star::report::XShape > ShapePropertySet;
39cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper2<    com::sun::star::report::XShape
40cdf0e10cSrcweir                                                 ,com::sun::star::lang::XServiceInfo > ShapeBase;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     /** \class OShape Defines the implementation of a \interface com:::sun::star::report::XShape
43cdf0e10cSrcweir      * \ingroup reportdesign_api
44cdf0e10cSrcweir      *
45cdf0e10cSrcweir      */
46cdf0e10cSrcweir     class OShape :  public comphelper::OBaseMutex,
47cdf0e10cSrcweir                     public ShapeBase,
48cdf0e10cSrcweir                     public ShapePropertySet
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         friend class OShapeHelper;
51cdf0e10cSrcweir         ::std::auto_ptr< ::comphelper::OPropertyArrayAggregationHelper> m_pAggHelper;
52cdf0e10cSrcweir         OReportControlModel                                             m_aProps;
53cdf0e10cSrcweir         com::sun::star::drawing::HomogenMatrix3                         m_Transformation;
54cdf0e10cSrcweir         ::sal_Int32                                                     m_nZOrder;
55cdf0e10cSrcweir         ::sal_Bool                                                      m_bOpaque;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         ::rtl::OUString                                                 m_sServiceName;
58cdf0e10cSrcweir         ::rtl::OUString                                                 m_CustomShapeEngine;
59cdf0e10cSrcweir         ::rtl::OUString                                                 m_CustomShapeData;
60cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
61cdf0e10cSrcweir                                                                         m_CustomShapeGeometry;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     private:
64cdf0e10cSrcweir         OShape(const OShape&);
65cdf0e10cSrcweir         OShape& operator=(const OShape&);
66cdf0e10cSrcweir 
set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)67cdf0e10cSrcweir         template <typename T> void set(  const ::rtl::OUString& _sProperty
68cdf0e10cSrcweir                                         ,const T& _Value
69cdf0e10cSrcweir                                         ,T& _member)
70cdf0e10cSrcweir         {
71cdf0e10cSrcweir             BoundListeners l;
72cdf0e10cSrcweir             {
73cdf0e10cSrcweir                 ::osl::MutexGuard aGuard(m_aMutex);
74cdf0e10cSrcweir                 prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
75cdf0e10cSrcweir                 _member = _Value;
76cdf0e10cSrcweir             }
77cdf0e10cSrcweir             l.notify();
78cdf0e10cSrcweir         }
79cdf0e10cSrcweir         void checkIndex(sal_Int32 _nIndex);
80cdf0e10cSrcweir         cppu::IPropertyArrayHelper& getInfoHelper();
81cdf0e10cSrcweir     protected:
82cdf0e10cSrcweir         virtual ~OShape();
83cdf0e10cSrcweir     public:
84cdf0e10cSrcweir         explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
85cdf0e10cSrcweir         explicit OShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext
86cdf0e10cSrcweir                         ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _xFactory
87cdf0e10cSrcweir                         ,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape
88cdf0e10cSrcweir                         ,const ::rtl::OUString& _sServiceName);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         DECLARE_XINTERFACE( )
91cdf0e10cSrcweir         // ::com::sun::star::lang::XServiceInfo
92cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
97cdf0e10cSrcweir         static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
98cdf0e10cSrcweir         static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
99cdf0e10cSrcweir             create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
100cdf0e10cSrcweir         // com::sun::star::beans::XPropertySet
101cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir         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);
103cdf0e10cSrcweir         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);
104cdf0e10cSrcweir         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);
105cdf0e10cSrcweir         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);
106cdf0e10cSrcweir         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);
107cdf0e10cSrcweir         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);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir         // XReportComponent
110cdf0e10cSrcweir         REPORTCOMPONENT_HEADER()
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         // XShape
113cdf0e10cSrcweir         SHAPE_HEADER()
114cdf0e10cSrcweir 
115cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getCustomShapeEngine() throw (::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir         virtual void SAL_CALL setCustomShapeEngine( const ::rtl::OUString& _customshapeengine ) throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getCustomShapeData() throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir         virtual void SAL_CALL setCustomShapeData( const ::rtl::OUString& _customshapedata ) throw (::com::sun::star::uno::RuntimeException);
119cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir         virtual void SAL_CALL setCustomShapeGeometry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _customshapegeometry ) throw (::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getOpaque() throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir         virtual void SAL_CALL setOpaque( ::sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         // XShapeDescriptor
126cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getShapeType(  ) throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir         // XReportControlModel
129cdf0e10cSrcweir         REPORTCONTROLMODEL_HEADER()
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         // XReportControlFormat
132cdf0e10cSrcweir         REPORTCONTROLFORMAT_HEADER()
133cdf0e10cSrcweir         // XShape
134cdf0e10cSrcweir         virtual ::sal_Int32 SAL_CALL getZOrder() throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir         virtual void SAL_CALL setZOrder( ::sal_Int32 _zorder ) throw (::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir         virtual ::com::sun::star::drawing::HomogenMatrix3 SAL_CALL getTransformation() throw (::com::sun::star::uno::RuntimeException);
137cdf0e10cSrcweir         virtual void SAL_CALL setTransformation( const ::com::sun::star::drawing::HomogenMatrix3& _transformation ) throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         // XCloneable
140cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir         // XComponent
143cdf0e10cSrcweir         virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)144cdf0e10cSrcweir         virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
145cdf0e10cSrcweir         {
146cdf0e10cSrcweir             cppu::WeakComponentImplHelperBase::addEventListener(aListener);
147cdf0e10cSrcweir         }
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)148cdf0e10cSrcweir         virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir             cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
151cdf0e10cSrcweir         }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir         // XChild
154cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
155cdf0e10cSrcweir         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);
156cdf0e10cSrcweir 
157cdf0e10cSrcweir         // XContainer
158cdf0e10cSrcweir         virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
159cdf0e10cSrcweir         virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir         // XElementAccess
162cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir 
165cdf0e10cSrcweir         // XIndexReplace
166cdf0e10cSrcweir         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);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir         // XIndexContainer
169cdf0e10cSrcweir         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);
170cdf0e10cSrcweir         virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         // XIndexAccess
173cdf0e10cSrcweir         virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
174cdf0e10cSrcweir         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);
175cdf0e10cSrcweir     };
176cdf0e10cSrcweir }
177cdf0e10cSrcweir #endif //RPT_SHAPE_HXX
178