xref: /aoo41x/main/svx/inc/svx/unopage.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_UNOWPAGE_HXX
24cdf0e10cSrcweir #define _SVX_UNOWPAGE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
27cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
28cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeGrouper.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeCombiner.hpp>
34cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeBinder.hpp>
35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_XUNOTUNNEL_HPP_
36cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
39cdf0e10cSrcweir #include <cppuhelper/weakagg.hxx>
40cdf0e10cSrcweir #include <svl/lstner.hxx>
41cdf0e10cSrcweir #include <editeng/mutxhelp.hxx>
42cdf0e10cSrcweir #include "svx/svxdllapi.h"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
45cdf0e10cSrcweir #include <comphelper/servicehelper.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <svx/unoprov.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class SdrPage;
50cdf0e10cSrcweir class SdrModel;
51cdf0e10cSrcweir class SdrView;
52cdf0e10cSrcweir class SdrPageView;
53cdf0e10cSrcweir class SdrObject;
54cdf0e10cSrcweir class List;
55cdf0e10cSrcweir class SvxShapeDescriptor;
56cdf0e10cSrcweir class SvxShape;
57cdf0e10cSrcweir class SvxShapeGroup;
58cdf0e10cSrcweir class SvxShapeConnector;
59cdf0e10cSrcweir class SvxShapeList;
60cdf0e10cSrcweir class SvxDrawPageList;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /***********************************************************************
63cdf0e10cSrcweir * Macros fuer Umrechnung Twips<->100tel mm                             *
64cdf0e10cSrcweir ***********************************************************************/
65cdf0e10cSrcweir #define	TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
66cdf0e10cSrcweir #define	MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
67cdf0e10cSrcweir 
68cdf0e10cSrcweir /***********************************************************************
69cdf0e10cSrcweir *                                                                      *
70cdf0e10cSrcweir ***********************************************************************/
71cdf0e10cSrcweir class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
72cdf0e10cSrcweir 											   ::com::sun::star::drawing::XShapeGrouper,
73cdf0e10cSrcweir 											   ::com::sun::star::lang::XServiceInfo,
74cdf0e10cSrcweir 											   ::com::sun::star::lang::XUnoTunnel,
75cdf0e10cSrcweir 											   ::com::sun::star::lang::XComponent>,
76cdf0e10cSrcweir 					public SfxListener,
77cdf0e10cSrcweir 					protected SvxMutexHelper
78cdf0e10cSrcweir {
79cdf0e10cSrcweir  protected:
80cdf0e10cSrcweir 	cppu::OBroadcastHelper mrBHelper;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	SdrPage*  		mpPage;
83cdf0e10cSrcweir 	SdrModel* 		mpModel;
84cdf0e10cSrcweir 	SdrView*		mpView;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	void	_SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* 	pPageView ) throw ();
87cdf0e10cSrcweir 	void	_SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* 	pPageView ) throw();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	virtual void disposing() throw();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir  public:
92cdf0e10cSrcweir 	SvxDrawPage( SdrPage* pPage ) throw();
93cdf0e10cSrcweir 	SvxDrawPage() throw();
94cdf0e10cSrcweir 	virtual ~SvxDrawPage() throw();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// Internals
GetSdrPage() const97cdf0e10cSrcweir 	SdrPage* GetSdrPage() const { return mpPage; }
98cdf0e10cSrcweir 	void ChangeModel( SdrModel* pNewModel );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	// Erzeugen eines SdrObjects und Einfugen in die SdrPage
101cdf0e10cSrcweir 	SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	// Typ und Inventor bestimmen
104cdf0e10cSrcweir 	void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const ::rtl::OUString& aName ) const throw();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	// Erzeugen eines SdrObjects anhand einer Description. Kann von
107cdf0e10cSrcweir 	// abgeleiteten Klassen dazu benutzt werden, eigene Shapes zu
108cdf0e10cSrcweir 	// unterstuetzen (z.B. Controls)
109cdf0e10cSrcweir 	virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL ) throw();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
114cdf0e10cSrcweir 	// werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
115cdf0e10cSrcweir 	// ein ein SvxShape aggregierenden Objekt anlegen.
116cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	static SvxDrawPage* GetPageForSdrPage( SdrPage* pPage ) throw();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// SfxListener
123cdf0e10cSrcweir 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	// XInterface
126cdf0e10cSrcweir 	virtual void SAL_CALL release() throw();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// XShapes
129cdf0e10cSrcweir     virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
130cdf0e10cSrcweir     virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	// XElementAccess
133cdf0e10cSrcweir     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	// XIndexAccess
137cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
138cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	// XShapeGrouper
141cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir     virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw(::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     // XServiceInfo
145cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	// XComponent
150cdf0e10cSrcweir 	virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 	virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir #endif
156cdf0e10cSrcweir 
157