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>
41 #include <com/sun/star/document/XEventsSupplier.hpp>
42 #include <cppuhelper/weak.hxx>
44 namespace com
{ namespace sun
{ namespace star
{
54 struct SvEventDescription
;
55 class ShapeUnoEventAccessImpl
;
58 //------------------------------------------------------------------------
60 // object which aggregates all svx shape objects,
61 // to add own properties
63 class ScShapeObj
: public ::cppu::OWeakObject
,
64 public ::com::sun::star::beans::XPropertySet
,
65 public ::com::sun::star::beans::XPropertyState
,
66 public ::com::sun::star::text::XTextContent
,
67 public ::com::sun::star::text::XText
,
68 public ::com::sun::star::lang::XTypeProvider
,
69 public ::com::sun::star::document::XEventsSupplier
72 friend ScMacroInfo
* lcl_getShapeHyperMacroInfo( ScShapeObj
* pShape
, BOOL bCreate
);
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
;
81 SdrObject
* GetSdrObject() const throw();
83 void GetShapePropertySet();
84 void GetShapePropertyState();
86 friend class ShapeUnoEventAccessImpl
;
89 static const SvEventDescription
* GetSupportedMacroItems();
91 // ctor modifies xShape parameter
92 ScShapeObj( ::com::sun::star::uno::Reference
<
93 ::com::sun::star::drawing::XShape
> & xShape
);
94 virtual ~ScShapeObj();
97 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
98 const ::com::sun::star::uno::Type
& rType
)
99 throw(::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
acquire() throw();
101 virtual void SAL_CALL
release() throw();
104 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
105 SAL_CALL
getPropertySetInfo()
106 throw(::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
108 const ::com::sun::star::uno::Any
& aValue
)
109 throw(::com::sun::star::beans::UnknownPropertyException
,
110 ::com::sun::star::beans::PropertyVetoException
,
111 ::com::sun::star::lang::IllegalArgumentException
,
112 ::com::sun::star::lang::WrappedTargetException
,
113 ::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
115 const ::rtl::OUString
& PropertyName
)
116 throw(::com::sun::star::beans::UnknownPropertyException
,
117 ::com::sun::star::lang::WrappedTargetException
,
118 ::com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
120 const ::com::sun::star::uno::Reference
<
121 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
122 throw(::com::sun::star::beans::UnknownPropertyException
,
123 ::com::sun::star::lang::WrappedTargetException
,
124 ::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
126 const ::com::sun::star::uno::Reference
<
127 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
128 throw(::com::sun::star::beans::UnknownPropertyException
,
129 ::com::sun::star::lang::WrappedTargetException
,
130 ::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
132 const ::com::sun::star::uno::Reference
<
133 ::com::sun::star::beans::XVetoableChangeListener
>& 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
removeVetoableChangeListener( 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
);
145 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState(
146 const ::rtl::OUString
& PropertyName
)
147 throw(::com::sun::star::beans::UnknownPropertyException
,
148 ::com::sun::star::uno::RuntimeException
);
149 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
150 getPropertyStates( const ::com::sun::star::uno::Sequence
<
151 ::rtl::OUString
>& aPropertyName
)
152 throw(::com::sun::star::beans::UnknownPropertyException
,
153 ::com::sun::star::uno::RuntimeException
);
154 virtual void SAL_CALL
setPropertyToDefault( const ::rtl::OUString
& PropertyName
)
155 throw(::com::sun::star::beans::UnknownPropertyException
,
156 ::com::sun::star::uno::RuntimeException
);
157 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault(
158 const ::rtl::OUString
& aPropertyName
)
159 throw(::com::sun::star::beans::UnknownPropertyException
,
160 ::com::sun::star::lang::WrappedTargetException
,
161 ::com::sun::star::uno::RuntimeException
);
164 virtual void SAL_CALL
attach(const ::com::sun::star::uno::Reference
<
165 ::com::sun::star::text::XTextRange
> & xTextRange
)
166 throw( ::com::sun::star::lang::IllegalArgumentException
,
167 ::com::sun::star::uno::RuntimeException
);
168 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
169 getAnchor(void) throw( ::com::sun::star::uno::RuntimeException
);
172 virtual void SAL_CALL
dispose(void) throw( ::com::sun::star::uno::RuntimeException
);
173 virtual void SAL_CALL
addEventListener(const ::com::sun::star::uno::Reference
<
174 ::com::sun::star::lang::XEventListener
> & aListener
)
175 throw( ::com::sun::star::uno::RuntimeException
);
176 virtual void SAL_CALL
removeEventListener(const ::com::sun::star::uno::Reference
<
177 ::com::sun::star::lang::XEventListener
> & aListener
)
178 throw( ::com::sun::star::uno::RuntimeException
);
181 virtual void SAL_CALL
insertTextContent( const ::com::sun::star::uno::Reference
<
182 ::com::sun::star::text::XTextRange
>& xRange
,
183 const ::com::sun::star::uno::Reference
<
184 ::com::sun::star::text::XTextContent
>& xContent
,
186 throw(::com::sun::star::lang::IllegalArgumentException
,
187 ::com::sun::star::uno::RuntimeException
);
188 virtual void SAL_CALL
removeTextContent( const ::com::sun::star::uno::Reference
<
189 ::com::sun::star::text::XTextContent
>& xContent
)
190 throw(::com::sun::star::container::NoSuchElementException
,
191 ::com::sun::star::uno::RuntimeException
);
194 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextCursor
> SAL_CALL
195 createTextCursor() throw(::com::sun::star::uno::RuntimeException
);
196 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextCursor
> SAL_CALL
197 createTextCursorByRange( const ::com::sun::star::uno::Reference
<
198 ::com::sun::star::text::XTextRange
>& aTextPosition
)
199 throw(::com::sun::star::uno::RuntimeException
);
200 virtual void SAL_CALL
insertString( const ::com::sun::star::uno::Reference
<
201 ::com::sun::star::text::XTextRange
>& xRange
,
202 const ::rtl::OUString
& aString
, sal_Bool bAbsorb
)
203 throw(::com::sun::star::uno::RuntimeException
);
204 virtual void SAL_CALL
insertControlCharacter( const ::com::sun::star::uno::Reference
<
205 ::com::sun::star::text::XTextRange
>& xRange
,
206 sal_Int16 nControlCharacter
, sal_Bool bAbsorb
)
207 throw(::com::sun::star::lang::IllegalArgumentException
,
208 ::com::sun::star::uno::RuntimeException
);
211 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
> SAL_CALL
212 getText() throw(::com::sun::star::uno::RuntimeException
);
213 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
214 getStart() throw(::com::sun::star::uno::RuntimeException
);
215 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
216 getEnd() throw(::com::sun::star::uno::RuntimeException
);
217 virtual ::rtl::OUString SAL_CALL
getString() throw(::com::sun::star::uno::RuntimeException
);
218 virtual void SAL_CALL
setString( const ::rtl::OUString
& aString
)
219 throw(::com::sun::star::uno::RuntimeException
);
222 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
223 throw(::com::sun::star::uno::RuntimeException
);
224 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
225 throw(::com::sun::star::uno::RuntimeException
);
228 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents()
229 throw(::com::sun::star::uno::RuntimeException
);