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