Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SD_UNOPAGE_HXX
20 : #define _SD_UNOPAGE_HXX
21 :
22 : #include <com/sun/star/document/XLinkTargetSupplier.hpp>
23 : #include <com/sun/star/container/XIndexAccess.hpp>
24 : #include <com/sun/star/container/XNamed.hpp>
25 : #include <com/sun/star/drawing/XMasterPageTarget.hpp>
26 : #include <com/sun/star/presentation/XPresentationPage.hpp>
27 : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
28 : #include <com/sun/star/beans/XMultiPropertySet.hpp>
29 : #include <com/sun/star/office/XAnnotationAccess.hpp>
30 :
31 : #include <svl/itemprop.hxx>
32 :
33 : #include <svx/unopage.hxx>
34 : #include <svx/fmdpage.hxx>
35 : #include <svx/svdpool.hxx>
36 :
37 : #include <comphelper/servicehelper.hxx>
38 :
39 : #include "unosrch.hxx"
40 :
41 : class SdPage;
42 : class SdrObject;
43 : class SdXImpressDocument;
44 : struct SfxItemPropertySimpleEntry;
45 :
46 : /***********************************************************************
47 : * *
48 : ***********************************************************************/
49 : class SdGenericDrawPage : public SvxFmDrawPage,
50 : public SdUnoSearchReplaceShape,
51 : public ::com::sun::star::drawing::XShapeCombiner,
52 : public ::com::sun::star::drawing::XShapeBinder,
53 : public ::com::sun::star::container::XNamed,
54 : public ::com::sun::star::beans::XPropertySet,
55 : public ::com::sun::star::beans::XMultiPropertySet,
56 : public ::com::sun::star::animations::XAnimationNodeSupplier,
57 : public ::com::sun::star::office::XAnnotationAccess,
58 : public ::com::sun::star::document::XLinkTargetSupplier
59 : {
60 : private:
61 : SdXImpressDocument* mpModel;
62 : SdrModel* mpSdrModel;
63 : sal_Int16 mnTempPageNumber; // for printing handouts
64 :
65 : protected:
66 : friend class SdXImpressDocument;
67 :
68 : const SvxItemPropertySet* mpPropSet;
69 :
70 : virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
71 : virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
72 :
73 : rtl::OUString getBookmarkURL() const;
74 : void setBookmarkURL( rtl::OUString& rURL );
75 :
76 : void SetLftBorder( sal_Int32 nValue );
77 : void SetRgtBorder( sal_Int32 nValue );
78 : void SetUppBorder( sal_Int32 nValue );
79 : void SetLwrBorder( sal_Int32 nValue );
80 :
81 : void SetWidth( sal_Int32 nWidth );
82 : void SetHeight( sal_Int32 nHeight );
83 :
84 : bool mbIsImpressDocument;
85 :
86 : virtual void disposing() throw();
87 :
88 : ::com::sun::star::uno::Any getNavigationOrder();
89 : void setNavigationOrder( const ::com::sun::star::uno::Any& rValue );
90 :
91 : void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException );
92 :
93 : public:
94 : SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet ) throw();
95 : virtual ~SdGenericDrawPage() throw();
96 :
97 : // intern
98 13 : sal_Bool isValid() { return (SvxDrawPage::mpPage != NULL) && (mpModel != NULL); }
99 :
100 5034 : SdPage* GetPage() const { return (SdPage*)SvxDrawPage::mpPage; }
101 : SdXImpressDocument* GetModel() const;
102 :
103 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
104 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
105 :
106 : // this is called whenever a SdrObject must be created for a empty api shape wrapper
107 : virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
108 :
109 : // SvxFmDrawPage
110 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
111 :
112 : // XInterface
113 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
114 : virtual void SAL_CALL release() throw();
115 :
116 : // XShapeCombiner
117 : 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);
118 : virtual void SAL_CALL split( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xGroup ) throw(::com::sun::star::uno::RuntimeException);
119 :
120 : // XShapeBinder
121 : 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);
122 : virtual void SAL_CALL unbind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
123 :
124 : // XPropertySet
125 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
126 : 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);
127 : 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);
128 : 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);
129 : 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);
130 : 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);
131 : 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);
132 :
133 : // XMultiPropertySet
134 : 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);
135 : 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);
136 : 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);
137 : virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
138 : 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);
139 :
140 : // XLinkTargetSupplier
141 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException);
142 :
143 : // XServiceInfo
144 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
145 :
146 : // XAnimationNodeSupplier
147 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException);
148 :
149 : // XAnnotationAccess:
150 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException);
151 : 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);
152 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException);
153 : };
154 :
155 : /***********************************************************************
156 : * *
157 : ***********************************************************************/
158 :
159 : class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget,
160 : public ::com::sun::star::presentation::XPresentationPage,
161 : public SdGenericDrawPage
162 : {
163 : private:
164 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
165 :
166 : protected:
167 : virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
168 : virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
169 : public:
170 : SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
171 : virtual ~SdDrawPage() throw();
172 :
173 : UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
174 :
175 : static ::rtl::OUString getPageApiName( SdPage* pPage );
176 : static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName );
177 : static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName );
178 :
179 : // XInterface
180 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
181 : virtual void SAL_CALL acquire() throw();
182 : virtual void SAL_CALL release() throw();
183 :
184 : // XTypeProvider
185 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
186 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
187 :
188 : // XServiceInfo
189 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
190 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
191 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
192 :
193 : // XMasterPageTarget
194 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage( ) throw(::com::sun::star::uno::RuntimeException);
195 : virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException);
196 :
197 : // XPresentationPage
198 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException);
199 :
200 : // XNamed
201 : virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
202 : virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
203 :
204 : // XIndexAccess
205 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
206 : 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);
207 :
208 : // XElementAccess
209 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
210 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
211 :
212 : // XShapes
213 : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
214 : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
215 : };
216 :
217 : /***********************************************************************
218 : * *
219 : ***********************************************************************/
220 :
221 : class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage,
222 : public SdGenericDrawPage
223 : {
224 : private:
225 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
226 : protected:
227 : virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException );
228 : virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
229 :
230 : public:
231 : SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
232 : virtual ~SdMasterPage() throw();
233 :
234 : UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
235 :
236 : // XInterface
237 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
238 : virtual void SAL_CALL acquire() throw();
239 : virtual void SAL_CALL release() throw();
240 :
241 : // XTypeProvider
242 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
243 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
244 :
245 : // XServiceInfo
246 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
247 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
248 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
249 :
250 : // XIndexAccess
251 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
252 : 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);
253 :
254 : // XElementAccess
255 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
256 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
257 :
258 : // XPresentationPage
259 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException);
260 :
261 : // XNamed
262 : virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
263 : virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
264 :
265 : // XShapes
266 : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
267 : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
268 : };
269 :
270 :
271 : /***********************************************************************
272 : * *
273 : ***********************************************************************/
274 : #include <cppuhelper/implbase2.hxx>
275 :
276 : class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess,
277 : ::com::sun::star::lang::XServiceInfo >
278 : {
279 : private:
280 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage;
281 : SdGenericDrawPage* mpUnoPage;
282 :
283 : public:
284 : SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw();
285 : virtual ~SdPageLinkTargets() throw();
286 :
287 : // intern
288 : SdrObject* FindObject( const String& rName ) const throw();
289 :
290 : // XServiceInfo
291 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
292 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
293 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
294 :
295 : // XNameAccess
296 : 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);
297 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
298 : virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
299 :
300 : // XElementAccess
301 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
302 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
303 : };
304 :
305 : #endif // _SD_UNOPAGE_HXX
306 :
307 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|