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