xref: /aoo41x/main/sd/source/ui/unoidl/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 _SD_UNOPAGE_HXX
28 #define _SD_UNOPAGE_HXX
29 
30 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
31 #include <com/sun/star/container/XIndexAccess.hpp>
32 #include <com/sun/star/container/XNamed.hpp>
33 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
34 #include <com/sun/star/presentation/XPresentationPage.hpp>
35 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
36 #include <com/sun/star/beans/XMultiPropertySet.hpp>
37 #include <com/sun/star/office/XAnnotationAccess.hpp>
38 
39 #include <svl/itemprop.hxx>
40 
41 #ifndef _SVX_UNOPAGE_HXX
42 #include <svx/unopage.hxx>
43 #endif
44 #include <svx/fmdpage.hxx>
45 #include <svx/svdpool.hxx>
46 
47 #include <comphelper/servicehelper.hxx>
48 
49 #include "unosrch.hxx"
50 
51 class SdPage;
52 class SvxShape;
53 class SdrObject;
54 struct SfxItemPropertySimpleEntry;
55 
56 #ifdef SVX_LIGHT
57 #define SvxFmDrawPage SvxDrawPage
58 #endif
59 
60 /***********************************************************************
61 *                                                                      *
62 ***********************************************************************/
63 class SdGenericDrawPage : public SvxFmDrawPage,
64 						  public SdUnoSearchReplaceShape,
65 						  public ::com::sun::star::drawing::XShapeCombiner,
66 						  public ::com::sun::star::drawing::XShapeBinder,
67 						  public ::com::sun::star::container::XNamed,
68 						  public ::com::sun::star::beans::XPropertySet,
69 						  public ::com::sun::star::beans::XMultiPropertySet,
70 						  public ::com::sun::star::animations::XAnimationNodeSupplier,
71            			      public ::com::sun::star::office::XAnnotationAccess,
72 						  public ::com::sun::star::document::XLinkTargetSupplier
73 {
74 private:
75 	SdXImpressDocument* mpModel;
76 	SdrModel* mpSdrModel;
77 	sal_Int16 mnTempPageNumber; // for printing handouts
78 
79 protected:
80 	friend class SdXImpressDocument;
81 
82 	const SvxItemPropertySet*	mpPropSet;
83 
84 	virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
85 	virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
86 
87 	rtl::OUString getBookmarkURL() const;
88 	void setBookmarkURL( rtl::OUString& rURL );
89 
90 	void SetLftBorder( sal_Int32 nValue );
91 	void SetRgtBorder( sal_Int32 nValue );
92 	void SetUppBorder( sal_Int32 nValue );
93 	void SetLwrBorder( sal_Int32 nValue );
94 
95 	void SetWidth( sal_Int32 nWidth );
96 	void SetHeight( sal_Int32 nHeight );
97 
98 	bool	 mbIsImpressDocument;
99 
100 	virtual void disposing() throw();
101 
102 	::com::sun::star::uno::Any getNavigationOrder();
103 	void setNavigationOrder( const ::com::sun::star::uno::Any& rValue );
104 
105 	void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException );
106 
107 public:
108 	SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet ) throw();
109 	virtual ~SdGenericDrawPage() throw();
110 
111 	// intern
112 	sal_Bool isValid() { return (SvxDrawPage::mpPage != NULL) && (mpModel != NULL); }
113 
114 	SdPage* GetPage() const { return (SdPage*)SvxDrawPage::mpPage; }
115 	SdXImpressDocument* GetModel() const;
116 
117 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
118 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
119 
120 	// this is called whenever a SdrObject must be created for a empty api shape wrapper
121 	virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
122 
123 	// SvxFmDrawPage
124 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  _CreateShape( SdrObject *pObj ) const throw ();
125 
126 	// XInterface
127 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
128 	virtual void SAL_CALL release() throw();
129 
130 	// XShapeCombiner
131     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL combine( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
132     virtual void SAL_CALL split( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xGroup ) throw(::com::sun::star::uno::RuntimeException);
133 
134 	// XShapeBinder
135     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL bind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
136     virtual void SAL_CALL unbind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
137 
138 	// XPropertySet
139     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
140     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);
141     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);
142     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);
143     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);
144     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);
145     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);
146 
147 	// XMultiPropertySet
148     virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
149     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
150     virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
151     virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
152     virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
153 
154 	// XLinkTargetSupplier
155     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks(  ) throw(::com::sun::star::uno::RuntimeException);
156 
157 	// XServiceInfo
158     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
159 
160 	// XAnimationNodeSupplier
161     virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode(  ) throw (::com::sun::star::uno::RuntimeException);
162 
163 	// XAnnotationAccess:
164     virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException);
165     virtual void SAL_CALL removeAnnotation(const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > & annotation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
166     virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException);
167 };
168 
169 /***********************************************************************
170 *                                                                      *
171 ***********************************************************************/
172 
173 class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget,
174 				   public ::com::sun::star::presentation::XPresentationPage,
175 				   public SdGenericDrawPage
176 {
177 private:
178 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
179 
180 protected:
181 	virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
182 	virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
183 public:
184 	SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
185 	virtual ~SdDrawPage() throw();
186 
187 	UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
188 
189 	static ::rtl::OUString getPageApiName( SdPage* pPage );
190 	static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName );
191 	static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName );
192 
193 	// XInterface
194 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
195 	virtual void SAL_CALL acquire() throw();
196 	virtual void SAL_CALL release() throw();
197 
198 	// XTypeProvider
199     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
200     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
201 
202 	// XServiceInfo
203     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
204     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
205     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
206 
207 	// XMasterPageTarget
208     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage(  ) throw(::com::sun::star::uno::RuntimeException);
209     virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException);
210 
211 	// XPresentationPage
212     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage(  ) throw(::com::sun::star::uno::RuntimeException);
213 
214 	// XNamed
215     virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
216     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
217 
218 	// XIndexAccess
219     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
220     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);
221 
222 	// XElementAccess
223     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
224     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
225 
226 	// XShapes
227     virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
228     virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
229 };
230 
231 /***********************************************************************
232 *                                                                      *
233 ***********************************************************************/
234 
235 class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage,
236 					 public SdGenericDrawPage
237 {
238 private:
239 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
240 protected:
241 	virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException  );
242 	virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
243 
244 public:
245 	SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
246 	virtual ~SdMasterPage() throw();
247 
248 	UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
249 
250 	// XInterface
251 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
252 	virtual void SAL_CALL acquire() throw();
253 	virtual void SAL_CALL release() throw();
254 
255 	// XTypeProvider
256     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
257     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
258 
259 	// XServiceInfo
260     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
261     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
262     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
263 
264 	// XIndexAccess
265     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
266     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);
267 
268 	// XElementAccess
269     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
270     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
271 
272 	// XPresentationPage
273     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage(  ) throw(::com::sun::star::uno::RuntimeException);
274 
275 	// XNamed
276     virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
277     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
278 
279 	// XShapes
280     virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
281     virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
282 };
283 
284 
285 /***********************************************************************
286 *                                                                      *
287 ***********************************************************************/
288 #include <cppuhelper/implbase2.hxx>
289 
290 class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess,
291 												  ::com::sun::star::lang::XServiceInfo >
292 {
293 private:
294 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage;
295 	SdGenericDrawPage* mpUnoPage;
296 
297 public:
298 	SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw();
299 	virtual ~SdPageLinkTargets() throw();
300 
301 	// intern
302 	SdrObject* FindObject( const String& rName ) const throw();
303 
304 	// XServiceInfo
305     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
306     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
307     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
308 
309 	// XNameAccess
310     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
311     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
312     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
313 
314 	// XElementAccess
315     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
316     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
317 };
318 
319 #endif // _SD_UNOPAGE_HXX
320