1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_SHAPEUNO_HXX
21 #define SC_SHAPEUNO_HXX
23 #include <tools/solar.h>
24 #include <com/sun/star/beans/XPropertyState.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/text/XTextContent.hpp>
27 #include <com/sun/star/text/XText.hpp>
28 #include <com/sun/star/lang/XTypeProvider.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/document/XEventsSupplier.hpp>
31 #include <com/sun/star/container/XChild.hpp>
33 #include <cppuhelper/implbase5.hxx>
34 #include <cppuhelper/implbase1.hxx>
36 namespace com
{ namespace sun
{ namespace star
{
46 struct SvEventDescription
;
47 class ShapeUnoEventAccessImpl
;
50 //------------------------------------------------------------------------
52 // object which aggregates all svx shape objects,
53 // to add own properties
55 typedef ::cppu::WeakImplHelper5
< ::com::sun::star::beans::XPropertySet
56 , ::com::sun::star::beans::XPropertyState
57 , ::com::sun::star::text::XTextContent
58 , ::com::sun::star::document::XEventsSupplier
59 , ::com::sun::star::lang::XServiceInfo
61 typedef ::cppu::ImplHelper1
< ::com::sun::star::text::XText
62 > ScShapeObj_TextBase
;
63 typedef ::cppu::ImplHelper1
< ::com::sun::star::container::XChild
64 > ScShapeObj_ChildBase
;
65 class ScShapeObj
:public ScShapeObj_Base
66 ,public ScShapeObj_TextBase
67 ,public ScShapeObj_ChildBase
70 friend ScMacroInfo
* ScShapeObj_getShapeHyperMacroInfo( ScShapeObj
* pShape
, sal_Bool bCreate
);
71 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XAggregation
> mxShapeAgg
;
72 // cached pointers to avoid repeated queryAggregation calls:
73 ::com::sun::star::beans::XPropertySet
* pShapePropertySet
;
74 ::com::sun::star::beans::XPropertyState
* pShapePropertyState
;
75 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> mxPropSetInfo
;
76 com::sun::star::uno::Sequence
< sal_Int8
>* pImplementationId
;
79 bool bInitializedNotifier
;
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 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 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 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 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 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 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 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 OUString
>& aPropertyName
)
152 throw(::com::sun::star::beans::UnknownPropertyException
,
153 ::com::sun::star::uno::RuntimeException
);
154 virtual void SAL_CALL
setPropertyToDefault( const 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 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 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 OUString SAL_CALL
getString() throw(::com::sun::star::uno::RuntimeException
);
218 virtual void SAL_CALL
setString( const OUString
& aString
)
219 throw(::com::sun::star::uno::RuntimeException
);
222 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
getParent()
223 throw (::com::sun::star::uno::RuntimeException
);
224 virtual void SAL_CALL
setParent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xParent
)
225 throw (::com::sun::star::lang::NoSupportException
, ::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 OUString SAL_CALL
getImplementationName( )
239 throw (::com::sun::star::uno::RuntimeException
) ;
240 virtual ::sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
241 throw (::com::sun::star::uno::RuntimeException
);
242 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
243 throw (::com::sun::star::uno::RuntimeException
);
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */