1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: shapeuno.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_SHAPEUNO_HXX
32 #define SC_SHAPEUNO_HXX
34 #include <tools/solar.h>
35 #include <com/sun/star/beans/XPropertyState.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/text/XTextContent.hpp>
38 #include <com/sun/star/text/XText.hpp>
39 #include <com/sun/star/lang/XTypeProvider.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/document/XEventsSupplier.hpp>
43 #include <cppuhelper/implbase5.hxx>
44 #include <cppuhelper/implbase1.hxx>
46 namespace com
{ namespace sun
{ namespace star
{
56 struct SvEventDescription
;
57 class ShapeUnoEventAccessImpl
;
60 //------------------------------------------------------------------------
62 // object which aggregates all svx shape objects,
63 // to add own properties
65 typedef ::cppu::WeakImplHelper5
< ::com::sun::star::beans::XPropertySet
66 , ::com::sun::star::beans::XPropertyState
67 , ::com::sun::star::text::XTextContent
68 , ::com::sun::star::document::XEventsSupplier
69 , ::com::sun::star::lang::XServiceInfo
71 typedef ::cppu::ImplHelper1
< ::com::sun::star::text::XText
72 > ScShapeObj_TextBase
;
73 class ScShapeObj
:public ScShapeObj_Base
74 ,public ScShapeObj_TextBase
77 friend ScMacroInfo
* lcl_getShapeHyperMacroInfo( ScShapeObj
* pShape
, BOOL bCreate
);
78 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XAggregation
> mxShapeAgg
;
79 // cached pointers to avoid repeated queryAggregation calls:
80 ::com::sun::star::beans::XPropertySet
* pShapePropertySet
;
81 ::com::sun::star::beans::XPropertyState
* pShapePropertyState
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> mxPropSetInfo
;
83 com::sun::star::uno::Sequence
< sal_Int8
>* pImplementationId
;
85 bool bInitializedNotifier
;
87 SdrObject
* GetSdrObject() const throw();
89 void GetShapePropertySet();
90 void GetShapePropertyState();
92 friend class ShapeUnoEventAccessImpl
;
95 static const SvEventDescription
* GetSupportedMacroItems();
97 // ctor modifies xShape parameter
98 ScShapeObj( ::com::sun::star::uno::Reference
<
99 ::com::sun::star::drawing::XShape
> & xShape
);
100 virtual ~ScShapeObj();
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();
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
);
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
);
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
);
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
);
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
,
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
);
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
);
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
);
228 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
229 throw(::com::sun::star::uno::RuntimeException
);
230 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
231 throw(::com::sun::star::uno::RuntimeException
);
234 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents()
235 throw(::com::sun::star::uno::RuntimeException
);
238 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
239 throw (::com::sun::star::uno::RuntimeException
) ;
240 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
241 throw (::com::sun::star::uno::RuntimeException
);
242 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
243 throw (::com::sun::star::uno::RuntimeException
);