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: unoframe.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 ************************************************************************/
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>
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
62 SwEventListenerContainer aLstnrCntnr
;
63 const SfxItemPropertySet
* m_pPropSet
;
66 const FlyCntType eType
;
68 // Descriptor-interface
69 BaseFrameProperties_Impl
* pProps
;
70 sal_Bool bIsDescriptor
;
76 com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> mxStyleData
;
77 com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> mxStyleFamily
;
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();
91 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
121 virtual rtl::OUString SAL_CALL
getShapeType(void) throw( ::com::sun::star::uno::RuntimeException
);
123 //Basisimplementierung
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
);
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
);
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
,
169 const SfxItemPropertSet
* _pPropSet
;
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();
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();
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
);
190 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
> SAL_CALL
getText(void) throw( ::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
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
);
218 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameReplace
> SAL_CALL
getEvents( ) throw(::com::sun::star::uno::RuntimeException
);
221 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
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
,
242 virtual ~SwXTextGraphicObject();
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();
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
);
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
);
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
);
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
);
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 --------------------------------------------------*/
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
,
290 virtual ~SwXTextEmbeddedObject();
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();
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
);
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
);
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
);
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
);
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
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(); }
345 SwXOLEListener(SwFmt
& rOLEFmt
, ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> xOLE
);
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
* );