xref: /AOO41X/main/sc/inc/shapeuno.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
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 
24 #ifndef SC_SHAPEUNO_HXX
25 #define SC_SHAPEUNO_HXX
26 
27 #include <tools/solar.h>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/text/XTextContent.hpp>
31 #include <com/sun/star/text/XText.hpp>
32 #include <com/sun/star/lang/XTypeProvider.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/document/XEventsSupplier.hpp>
35 #include <com/sun/star/container/XChild.hpp>
36 
37 #include <cppuhelper/implbase5.hxx>
38 #include <cppuhelper/implbase1.hxx>
39 
40 namespace com { namespace sun { namespace star {
41     namespace uno {
42         class XAggregation;
43     }
44     namespace drawing {
45         class XShape;
46     }
47 }}}
48 
49 class SdrObject;
50 struct SvEventDescription;
51 class ShapeUnoEventAccessImpl;
52 
53 //------------------------------------------------------------------------
54 
55 //  object which aggregates all svx shape objects,
56 //  to add own properties
57 
58 typedef ::cppu::WeakImplHelper5 <   ::com::sun::star::beans::XPropertySet
59                                 ,   ::com::sun::star::beans::XPropertyState
60                                 ,   ::com::sun::star::text::XTextContent
61                                 ,   ::com::sun::star::document::XEventsSupplier
62                                 ,   ::com::sun::star::lang::XServiceInfo
63                                 >   ScShapeObj_Base;
64 typedef ::cppu::ImplHelper1     <   ::com::sun::star::text::XText
65                                 >   ScShapeObj_TextBase;
66 typedef ::cppu::ImplHelper1     <   ::com::sun::star::container::XChild
67                                 >   ScShapeObj_ChildBase;
68 class ScShapeObj    :public ScShapeObj_Base
69                     ,public ScShapeObj_TextBase
70                     ,public ScShapeObj_ChildBase
71 {
72 private:
73     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
74     // cached pointers to avoid repeated queryAggregation calls:
75     ::com::sun::star::beans::XPropertySet*                                  pShapePropertySet;
76     ::com::sun::star::beans::XPropertyState*                                pShapePropertyState;
77     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo;
78     com::sun::star::uno::Sequence< sal_Int8 >*                              pImplementationId;
79     bool                                                                    bIsTextShape;
80     bool                                                                    bIsNoteCaption;
81     bool                                                                    bInitializedNotifier;
82 
83     SdrObject* GetSdrObject() const throw();
84 
85     void                    GetShapePropertySet();
86     void                    GetShapePropertyState();
87 
88 friend class ShapeUnoEventAccessImpl;
89 
90 public:
91     static const SvEventDescription* GetSupportedMacroItems();
92 
93                             // ctor modifies xShape parameter
94                             ScShapeObj( ::com::sun::star::uno::Reference<
95                                             ::com::sun::star::drawing::XShape > & xShape );
96     virtual                 ~ScShapeObj();
97 
98                             // XInterface
99     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
100                                 const ::com::sun::star::uno::Type & rType )
101                                     throw(::com::sun::star::uno::RuntimeException);
102     virtual void SAL_CALL   acquire() throw();
103     virtual void SAL_CALL   release() throw();
104 
105                             // XPropertySet
106     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
107                             SAL_CALL getPropertySetInfo()
108                                 throw(::com::sun::star::uno::RuntimeException);
109     virtual void SAL_CALL   setPropertyValue( const ::rtl::OUString& aPropertyName,
110                                     const ::com::sun::star::uno::Any& aValue )
111                                 throw(::com::sun::star::beans::UnknownPropertyException,
112                                     ::com::sun::star::beans::PropertyVetoException,
113                                     ::com::sun::star::lang::IllegalArgumentException,
114                                     ::com::sun::star::lang::WrappedTargetException,
115                                     ::com::sun::star::uno::RuntimeException);
116     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
117                                     const ::rtl::OUString& PropertyName )
118                                 throw(::com::sun::star::beans::UnknownPropertyException,
119                                     ::com::sun::star::lang::WrappedTargetException,
120                                     ::com::sun::star::uno::RuntimeException);
121     virtual void SAL_CALL   addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
122                                     const ::com::sun::star::uno::Reference<
123                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
124                                 throw(::com::sun::star::beans::UnknownPropertyException,
125                                     ::com::sun::star::lang::WrappedTargetException,
126                                     ::com::sun::star::uno::RuntimeException);
127     virtual void SAL_CALL   removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
128                                     const ::com::sun::star::uno::Reference<
129                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
130                                 throw(::com::sun::star::beans::UnknownPropertyException,
131                                     ::com::sun::star::lang::WrappedTargetException,
132                                     ::com::sun::star::uno::RuntimeException);
133     virtual void SAL_CALL   addVetoableChangeListener( const ::rtl::OUString& PropertyName,
134                                     const ::com::sun::star::uno::Reference<
135                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
136                                 throw(::com::sun::star::beans::UnknownPropertyException,
137                                     ::com::sun::star::lang::WrappedTargetException,
138                                     ::com::sun::star::uno::RuntimeException);
139     virtual void SAL_CALL   removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
140                                     const ::com::sun::star::uno::Reference<
141                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
142                                 throw(::com::sun::star::beans::UnknownPropertyException,
143                                     ::com::sun::star::lang::WrappedTargetException,
144                                     ::com::sun::star::uno::RuntimeException);
145 
146                             // XPropertyState
147     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
148                                     const ::rtl::OUString& PropertyName )
149                                 throw(::com::sun::star::beans::UnknownPropertyException,
150                                     ::com::sun::star::uno::RuntimeException);
151     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
152                             getPropertyStates( const ::com::sun::star::uno::Sequence<
153                                         ::rtl::OUString >& aPropertyName )
154                                 throw(::com::sun::star::beans::UnknownPropertyException,
155                                     ::com::sun::star::uno::RuntimeException);
156     virtual void SAL_CALL   setPropertyToDefault( const ::rtl::OUString& PropertyName )
157                                 throw(::com::sun::star::beans::UnknownPropertyException,
158                                     ::com::sun::star::uno::RuntimeException);
159     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
160                                     const ::rtl::OUString& aPropertyName )
161                                 throw(::com::sun::star::beans::UnknownPropertyException,
162                                     ::com::sun::star::lang::WrappedTargetException,
163                                     ::com::sun::star::uno::RuntimeException);
164 
165                             // XTextContent
166     virtual void SAL_CALL   attach(const ::com::sun::star::uno::Reference<
167                                     ::com::sun::star::text::XTextRange > & xTextRange)
168                                 throw( ::com::sun::star::lang::IllegalArgumentException,
169                                         ::com::sun::star::uno::RuntimeException );
170     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
171                             getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
172 
173                             // XComponent
174     virtual void SAL_CALL   dispose(void) throw( ::com::sun::star::uno::RuntimeException );
175     virtual void SAL_CALL   addEventListener(const ::com::sun::star::uno::Reference<
176                                     ::com::sun::star::lang::XEventListener > & aListener)
177                                 throw( ::com::sun::star::uno::RuntimeException );
178     virtual void SAL_CALL   removeEventListener(const ::com::sun::star::uno::Reference<
179                                     ::com::sun::star::lang::XEventListener > & aListener)
180                                 throw( ::com::sun::star::uno::RuntimeException );
181 
182                             // XText
183     virtual void SAL_CALL   insertTextContent( const ::com::sun::star::uno::Reference<
184                                     ::com::sun::star::text::XTextRange >& xRange,
185                                 const ::com::sun::star::uno::Reference<
186                                     ::com::sun::star::text::XTextContent >& xContent,
187                                 sal_Bool bAbsorb )
188                                     throw(::com::sun::star::lang::IllegalArgumentException,
189                                     ::com::sun::star::uno::RuntimeException);
190     virtual void SAL_CALL   removeTextContent( const ::com::sun::star::uno::Reference<
191                                 ::com::sun::star::text::XTextContent >& xContent )
192                                     throw(::com::sun::star::container::NoSuchElementException,
193                                             ::com::sun::star::uno::RuntimeException);
194 
195                             // XSimpleText
196     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
197                             createTextCursor() throw(::com::sun::star::uno::RuntimeException);
198     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
199                             createTextCursorByRange( const ::com::sun::star::uno::Reference<
200                                         ::com::sun::star::text::XTextRange >& aTextPosition )
201                                     throw(::com::sun::star::uno::RuntimeException);
202     virtual void SAL_CALL   insertString( const ::com::sun::star::uno::Reference<
203                                         ::com::sun::star::text::XTextRange >& xRange,
204                                         const ::rtl::OUString& aString, sal_Bool bAbsorb )
205                                     throw(::com::sun::star::uno::RuntimeException);
206     virtual void SAL_CALL   insertControlCharacter( const ::com::sun::star::uno::Reference<
207                                         ::com::sun::star::text::XTextRange >& xRange,
208                                         sal_Int16 nControlCharacter, sal_Bool bAbsorb )
209                                     throw(::com::sun::star::lang::IllegalArgumentException,
210                                         ::com::sun::star::uno::RuntimeException);
211 
212                             // XTextRange
213     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
214                             getText() throw(::com::sun::star::uno::RuntimeException);
215     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
216                             getStart() throw(::com::sun::star::uno::RuntimeException);
217     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
218                             getEnd() throw(::com::sun::star::uno::RuntimeException);
219     virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
220     virtual void SAL_CALL   setString( const ::rtl::OUString& aString )
221                                     throw(::com::sun::star::uno::RuntimeException);
222 
223     // XChild
224     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent()
225                             throw (::com::sun::star::uno::RuntimeException);
226     virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent )
227                             throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
228 
229                             // XTypeProvider
230     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
231                                 throw(::com::sun::star::uno::RuntimeException);
232     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
233                                 throw(::com::sun::star::uno::RuntimeException);
234 
235                             // XEventsSupplier
236     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents()
237                                 throw(::com::sun::star::uno::RuntimeException);
238 
239                             // XServiceInfo
240     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
241                                 throw (::com::sun::star::uno::RuntimeException) ;
242     virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
243                                 throw (::com::sun::star::uno::RuntimeException);
244     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
245                                 throw (::com::sun::star::uno::RuntimeException);
246 };
247 
248 #endif
249 
250