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