1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPAGE_HXX
20 #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPAGE_HXX
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>
31 #include <svl/itemprop.hxx>
33 #include <svx/unopage.hxx>
34 #include <svx/fmdpage.hxx>
35 #include <svx/svdpool.hxx>
37 #include <comphelper/servicehelper.hxx>
39 #include "unosrch.hxx"
43 class SdXImpressDocument
;
44 struct SfxItemPropertySimpleEntry
;
46 /***********************************************************************
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
61 SdXImpressDocument
* mpModel
;
63 sal_Int16 mnTempPageNumber
; // for printing handouts
66 friend class SdXImpressDocument
;
68 const SvxItemPropertySet
* mpPropSet
;
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();
73 OUString
getBookmarkURL() const;
74 void setBookmarkURL( OUString
& rURL
);
76 void SetLftBorder( sal_Int32 nValue
);
77 void SetRgtBorder( sal_Int32 nValue
);
78 void SetUppBorder( sal_Int32 nValue
);
79 void SetLwrBorder( sal_Int32 nValue
);
81 void SetWidth( sal_Int32 nWidth
);
82 void SetHeight( sal_Int32 nHeight
);
84 bool mbIsImpressDocument
;
86 virtual void disposing() throw() SAL_OVERRIDE
;
88 ::com::sun::star::uno::Any
getNavigationOrder();
89 void setNavigationOrder( const ::com::sun::star::uno::Any
& rValue
);
91 void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException
);
94 SdGenericDrawPage( SdXImpressDocument
* pModel
, SdPage
* pInPage
, const SvxItemPropertySet
* pSet
) throw();
95 virtual ~SdGenericDrawPage() throw();
98 bool isValid() { return (SvxDrawPage::mpPage
!= NULL
) && (mpModel
!= NULL
); }
100 SdPage
* GetPage() const { return static_cast<SdPage
*>(SvxDrawPage::mpPage
); }
101 SdXImpressDocument
* GetModel() const;
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
, std::exception
) SAL_OVERRIDE
;
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
)
108 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual css::uno::Reference
<css::drawing::XShape
> _CreateShape(SdrObject
*pObj
) const
112 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
119 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
, std::exception
) SAL_OVERRIDE
;
120 virtual void SAL_CALL
split( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xGroup
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 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
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
unbind( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
129 throw (::com::sun::star::beans::UnknownPropertyException
,
130 ::com::sun::star::beans::PropertyVetoException
,
131 ::com::sun::star::lang::IllegalArgumentException
,
132 ::com::sun::star::lang::WrappedTargetException
,
133 ::com::sun::star::uno::RuntimeException
,
134 std::exception
) SAL_OVERRIDE
;
135 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual void SAL_CALL
addPropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
137 virtual void SAL_CALL
removePropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
138 virtual void SAL_CALL
addVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
139 virtual void SAL_CALL
removeVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
142 virtual void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< 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
, std::exception
) SAL_OVERRIDE
;
143 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
144 virtual void SAL_CALL
addPropertiesChangeListener( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual void SAL_CALL
removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual void SAL_CALL
firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 // XLinkTargetSupplier
149 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
154 // XAnimationNodeSupplier
155 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> SAL_CALL
getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 // XAnnotationAccess:
158 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> SAL_CALL
createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
159 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
, std::exception
) SAL_OVERRIDE
;
160 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotationEnumeration
> SAL_CALL
createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 /***********************************************************************
165 ***********************************************************************/
167 class SdDrawPage
: public ::com::sun::star::drawing::XMasterPageTarget
,
168 public ::com::sun::star::presentation::XPresentationPage
,
169 public SdGenericDrawPage
172 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> maTypeSequence
;
175 virtual void setBackground( const ::com::sun::star::uno::Any
& rValue
) throw(::com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
176 virtual void getBackground( ::com::sun::star::uno::Any
& rValue
) throw() SAL_OVERRIDE
;
178 SdDrawPage( SdXImpressDocument
* pModel
, SdPage
* pInPage
) throw();
179 virtual ~SdDrawPage() throw();
181 UNO3_GETIMPLEMENTATION_DECL( SdDrawPage
)
183 static OUString
getPageApiName( SdPage
* pPage
);
184 static OUString
getPageApiNameFromUiName( const OUString
& rUIName
);
185 static OUString
getUiNameFromPageApiName( const OUString
& rApiName
);
188 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
190 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
193 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
194 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
198 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
199 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
202 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
getMasterPage( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
203 virtual void SAL_CALL
setMasterPage( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xMasterPage
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
206 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
getNotesPage( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
209 virtual OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
210 virtual void SAL_CALL
setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
213 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
214 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
, std::exception
) SAL_OVERRIDE
;
217 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
218 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
221 virtual void SAL_CALL
add( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
222 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
)
223 throw (::com::sun::star::uno::RuntimeException
,
224 std::exception
) SAL_OVERRIDE
;
227 /***********************************************************************
229 ***********************************************************************/
231 class SdMasterPage
: public ::com::sun::star::presentation::XPresentationPage
,
232 public SdGenericDrawPage
235 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> maTypeSequence
;
237 virtual void setBackground( const ::com::sun::star::uno::Any
& rValue
) throw( ::com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
238 virtual void getBackground( ::com::sun::star::uno::Any
& rValue
) throw() SAL_OVERRIDE
;
241 SdMasterPage( SdXImpressDocument
* pModel
, SdPage
* pInPage
) throw();
242 virtual ~SdMasterPage() throw();
244 UNO3_GETIMPLEMENTATION_DECL(SdMasterPage
)
247 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
248 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
249 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
252 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
253 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
256 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
257 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
258 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
261 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
262 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
, std::exception
) SAL_OVERRIDE
;
265 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
266 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
269 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
getNotesPage( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
272 virtual OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
273 virtual void SAL_CALL
setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
276 virtual void SAL_CALL
add( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
277 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xShape
)
278 throw (::com::sun::star::uno::RuntimeException
,
279 std::exception
) SAL_OVERRIDE
;
282 /***********************************************************************
284 ***********************************************************************/
285 #include <cppuhelper/implbase2.hxx>
287 class SdPageLinkTargets
: public ::cppu::WeakImplHelper2
< ::com::sun::star::container::XNameAccess
,
288 ::com::sun::star::lang::XServiceInfo
>
291 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> mxPage
;
292 SdGenericDrawPage
* mpUnoPage
;
295 SdPageLinkTargets( SdGenericDrawPage
* pUnoPage
) throw();
296 virtual ~SdPageLinkTargets() throw();
299 SdrObject
* FindObject( const OUString
& rName
) const throw();
302 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
303 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
304 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
307 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
308 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
309 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
312 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
313 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
316 OUString
getUiNameFromPageApiNameImpl( const OUString
& rApiName
);
318 #endif // INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPAGE_HXX
320 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */