merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / unoframe.hxx
blob2775db86900bfa5bf92bd8b71664f1e49858e51a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoframe.hxx,v $
10 * $Revision: 1.22 $
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 ************************************************************************/
30 #ifndef _UNOFRAME_HXX
31 #define _UNOFRAME_HXX
33 #include <unoobj.hxx>
34 #include <sfx2/objsh.hxx>
35 #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
36 #include <com/sun/star/text/XTextFrame.hpp>
37 #include <com/sun/star/drawing/XShape.hpp>
38 #include <com/sun/star/util/XModifyListener.hpp>
39 #include <com/sun/star/frame/XModel.hpp>
40 #include <com/sun/star/document/XEventsSupplier.hpp>
42 #include <com/sun/star/container/XNameAccess.hpp>
45 class SwDoc;
46 class SfxItemPropertSet;
47 /*-----------------12.02.98 11:21-------------------
49 --------------------------------------------------*/
50 class BaseFrameProperties_Impl;
51 class SwXFrame : public cppu::WeakImplHelper6
53 ::com::sun::star::lang::XServiceInfo,
54 ::com::sun::star::beans::XPropertySet,
55 ::com::sun::star::beans::XPropertyState,
56 ::com::sun::star::drawing::XShape,
57 ::com::sun::star::container::XNamed,
58 ::com::sun::star::lang::XUnoTunnel
60 public SwClient
62 SwEventListenerContainer aLstnrCntnr;
63 const SfxItemPropertySet* m_pPropSet;
64 SwDoc* m_pDoc;
66 const FlyCntType eType;
68 // Descriptor-interface
69 BaseFrameProperties_Impl* pProps;
70 sal_Bool bIsDescriptor;
71 String sName;
73 SwPaM* m_pCopySource;
75 protected:
76 com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData;
77 com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxStyleFamily;
79 virtual ~SwXFrame();
80 public:
81 SwXFrame(FlyCntType eSet,
82 const SfxItemPropertySet* pPropSet,
83 SwDoc *pDoc ); //Descriptor-If
84 SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet,
85 const SfxItemPropertySet* pPropSet);
88 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
90 //XUnoTunnel
91 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
93 TYPEINFO();
95 //XNamed
96 virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
97 virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
99 //XPropertySet
100 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
101 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
102 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
103 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
104 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
105 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
108 //XPropertyState
109 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
110 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
111 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
112 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114 //XShape
115 virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw(::com::sun::star::uno::RuntimeException);
116 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
117 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
120 //XShapeDescriptor
121 virtual rtl::OUString SAL_CALL getShapeType(void) throw( ::com::sun::star::uno::RuntimeException );
123 //Basisimplementierung
124 //XComponent
125 virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
126 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
127 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
129 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
131 //XServiceInfo
132 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
133 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
134 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
136 //SwClient
137 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
139 void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
140 void attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
142 SwFrmFmt* GetFrmFmt() const
144 return PTR_CAST ( SwFrmFmt, GetRegisteredIn() );
146 FlyCntType GetFlyCntType()const {return eType;}
148 sal_Bool IsDescriptor() const {return bIsDescriptor;}
149 void ResetDescriptor();
150 //copy text from a given source PaM
151 void SetSelection(SwPaM& rCopySource);
152 static SdrObject *GetOrCreateSdrObject( SwFlyFrmFmt *pFmt );
154 /*-----------------20.02.98 11:28-------------------
156 --------------------------------------------------*/
157 typedef cppu::WeakImplHelper3
159 ::com::sun::star::text::XTextFrame,
160 ::com::sun::star::container::XEnumerationAccess,
161 ::com::sun::star::document::XEventsSupplier
163 SwXTextFrameBaseClass;
165 class SwXTextFrame : public SwXTextFrameBaseClass,
166 public SwXText,
167 public SwXFrame
169 const SfxItemPropertSet* _pPropSet;
171 protected:
172 virtual const SwStartNode *GetStartNode() const;
174 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createCursor()throw(::com::sun::star::uno::RuntimeException);
175 virtual ~SwXTextFrame();
176 public:
177 SwXTextFrame(SwDoc *pDoc);
178 SwXTextFrame(SwFrmFmt& rFmt);
181 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
182 virtual void SAL_CALL acquire( ) throw();
183 virtual void SAL_CALL release( ) throw();
185 //XTypeProvider
186 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
187 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
189 //XTextFrame
190 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
192 //XText
193 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
194 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
196 //XEnumerationAccess - frueher XParagraphEnumerationAccess
197 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
199 //XElementAccess
200 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
201 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
203 //XTextContent
204 virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
205 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
207 //XComponent
208 virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
209 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
210 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
212 //XServiceInfo
213 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
214 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
215 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
217 // XEventsSupplier
218 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
220 //XUnoTunnel
221 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
223 //XPropertySet
224 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
226 void * SAL_CALL operator new( size_t ) throw();
227 void SAL_CALL operator delete( void * ) throw();
229 /*-----------------20.02.98 11:28-------------------
231 --------------------------------------------------*/
232 typedef cppu::WeakImplHelper2
234 ::com::sun::star::text::XTextContent,
235 ::com::sun::star::document::XEventsSupplier
237 SwXTextGraphicObjectBaseClass;
238 class SwXTextGraphicObject : public SwXTextGraphicObjectBaseClass,
239 public SwXFrame
241 protected:
242 virtual ~SwXTextGraphicObject();
243 public:
244 SwXTextGraphicObject( SwDoc *pDoc );
245 SwXTextGraphicObject(SwFrmFmt& rFmt);
248 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
249 virtual void SAL_CALL acquire( ) throw();
250 virtual void SAL_CALL release( ) throw();
252 //XTypeProvider
253 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
254 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
256 //XTextContent
257 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
258 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
260 //XComponent
261 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
262 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
263 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
265 //XServiceInfo
266 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
267 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
268 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
270 // XEventsSupplier
271 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
272 void * SAL_CALL operator new( size_t ) throw();
273 void SAL_CALL operator delete( void * ) throw();
275 /*-----------------20.02.98 11:28-------------------
277 --------------------------------------------------*/
278 class SwOLENode;
279 typedef cppu::WeakImplHelper3
281 ::com::sun::star::text::XTextContent,
282 ::com::sun::star::document::XEmbeddedObjectSupplier2,
283 ::com::sun::star::document::XEventsSupplier
284 >SwXTextEmbeddedObjectBaseClass;
286 class SwXTextEmbeddedObject : public SwXTextEmbeddedObjectBaseClass,
287 public SwXFrame
289 protected:
290 virtual ~SwXTextEmbeddedObject();
292 public:
293 SwXTextEmbeddedObject( SwDoc *pDoc );
294 SwXTextEmbeddedObject(SwFrmFmt& rFmt);
297 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
298 virtual void SAL_CALL acquire( ) throw();
299 virtual void SAL_CALL release( ) throw();
301 //XTypeProvider
302 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
303 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
305 //XTextContent
306 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
307 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
309 //XComponent
310 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
311 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
312 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
314 //XEmbeddedObjectSupplier2
315 virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL getEmbeddedObject(void) throw( ::com::sun::star::uno::RuntimeException );
316 virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject(void) throw( ::com::sun::star::uno::RuntimeException );
317 virtual ::sal_Int64 SAL_CALL getAspect() throw (::com::sun::star::uno::RuntimeException);
318 virtual void SAL_CALL setAspect( ::sal_Int64 _aspect ) throw (::com::sun::star::uno::RuntimeException);
319 virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getReplacementGraphic() throw (::com::sun::star::uno::RuntimeException);
321 //XServiceInfo
322 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
323 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
324 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
326 // XEventsSupplier
327 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
328 void * SAL_CALL operator new( size_t ) throw();
329 void SAL_CALL operator delete( void * ) throw();
334 class SwXOLEListener : public cppu::WeakImplHelper1
336 ::com::sun::star::util::XModifyListener
338 public SwClient
340 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLEModel;
341 // SfxObjectShell* GetObjShell( const SwFmt& rFmt,
342 // SwOLENode** ppNd = 0 ) const;
343 SwFmt* GetFmt() const { return (SwFmt*)GetRegisteredIn(); }
344 public:
345 SwXOLEListener(SwFmt& rOLEFmt, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLE);
346 ~SwXOLEListener();
347 TYPEINFO();
349 // ::com::sun::star::lang::XEventListener
350 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
352 // ::com::sun::star::util::XModifyListener
353 virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
355 void Modify( SfxPoolItem*, SfxPoolItem* );
360 #endif