xref: /aoo41x/main/svx/inc/svx/unopage.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_UNOWPAGE_HXX
28 #define _SVX_UNOWPAGE_HXX
29 
30 #include <com/sun/star/lang/XComponent.hpp>
31 #include <cppuhelper/interfacecontainer.hxx>
32 #include <com/sun/star/lang/XTypeProvider.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/drawing/XDrawPage.hpp>
36 #include <com/sun/star/drawing/XShapeGrouper.hpp>
37 #include <com/sun/star/drawing/XShapeCombiner.hpp>
38 #include <com/sun/star/drawing/XShapeBinder.hpp>
39 #ifndef _COM_SUN_STAR_UNO_XUNOTUNNEL_HPP_
40 #include <com/sun/star/lang/XUnoTunnel.hpp>
41 #endif
42 #include <cppuhelper/weak.hxx>
43 #include <cppuhelper/weakagg.hxx>
44 #include <svl/lstner.hxx>
45 #include <editeng/mutxhelp.hxx>
46 #include "svx/svxdllapi.h"
47 
48 #include <cppuhelper/implbase5.hxx>
49 #include <comphelper/servicehelper.hxx>
50 
51 #include <svx/unoprov.hxx>
52 
53 class SdrPage;
54 class SdrModel;
55 class SdrView;
56 class SdrPageView;
57 class SdrObject;
58 class List;
59 class SvxShapeDescriptor;
60 class SvxShape;
61 class SvxShapeGroup;
62 class SvxShapeConnector;
63 class SvxShapeList;
64 class SvxDrawPageList;
65 
66 /***********************************************************************
67 * Macros fuer Umrechnung Twips<->100tel mm                             *
68 ***********************************************************************/
69 #define	TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
70 #define	MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
71 
72 /***********************************************************************
73 *                                                                      *
74 ***********************************************************************/
75 class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
76 											   ::com::sun::star::drawing::XShapeGrouper,
77 											   ::com::sun::star::lang::XServiceInfo,
78 											   ::com::sun::star::lang::XUnoTunnel,
79 											   ::com::sun::star::lang::XComponent>,
80 					public SfxListener,
81 					protected SvxMutexHelper
82 {
83  protected:
84 	cppu::OBroadcastHelper mrBHelper;
85 
86 	SdrPage*  		mpPage;
87 	SdrModel* 		mpModel;
88 	SdrView*		mpView;
89 
90 	void	_SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* 	pPageView ) throw ();
91 	void	_SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* 	pPageView ) throw();
92 
93 	virtual void disposing() throw();
94 
95  public:
96 	SvxDrawPage( SdrPage* pPage ) throw();
97 	SvxDrawPage() throw();
98 	virtual ~SvxDrawPage() throw();
99 
100 	// Internals
101 	SdrPage* GetSdrPage() const { return mpPage; }
102 	void ChangeModel( SdrModel* pNewModel );
103 
104 	// Erzeugen eines SdrObjects und Einfugen in die SdrPage
105 	SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
106 
107 	// Typ und Inventor bestimmen
108 	void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const ::rtl::OUString& aName ) const throw();
109 
110 	// Erzeugen eines SdrObjects anhand einer Description. Kann von
111 	// abgeleiteten Klassen dazu benutzt werden, eigene Shapes zu
112 	// unterstuetzen (z.B. Controls)
113 	virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
114 
115 	static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL ) throw();
116 
117 	// Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
118 	// werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
119 	// ein ein SvxShape aggregierenden Objekt anlegen.
120 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw();
121 
122 	static SvxDrawPage* GetPageForSdrPage( SdrPage* pPage ) throw();
123 
124 	UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
125 
126 	// SfxListener
127 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
128 
129 	// XInterface
130 	virtual void SAL_CALL release() throw();
131 
132 	// XShapes
133     virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
134     virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
135 
136 	// XElementAccess
137     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
138     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
139 
140 	// XIndexAccess
141     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
142     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);
143 
144 	// XShapeGrouper
145     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);
146     virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw(::com::sun::star::uno::RuntimeException);
147 
148     // XServiceInfo
149     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
150     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
151     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
152 
153 	// XComponent
154 	virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
155 	virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
156 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
157 };
158 
159 #endif
160 
161