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/XNamed.hpp>
24 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
25 #include <com/sun/star/presentation/XPresentationPage.hpp>
26 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
27 #include <com/sun/star/beans/XMultiPropertySet.hpp>
28 #include <com/sun/star/office/XAnnotationAccess.hpp>
30 #include <svx/unopage.hxx>
31 #include <svx/fmdpage.hxx>
33 #include <comphelper/servicehelper.hxx>
34 #include <cppuhelper/implbase.hxx>
36 #include "unosrch.hxx"
40 class SdXImpressDocument
;
42 class SdGenericDrawPage
: public SvxFmDrawPage
,
43 public SdUnoSearchReplaceShape
,
44 public css::drawing::XShapeCombiner
,
45 public css::drawing::XShapeBinder
,
46 public css::container::XNamed
,
47 public css::beans::XPropertySet
,
48 public css::beans::XMultiPropertySet
,
49 public css::animations::XAnimationNodeSupplier
,
50 public css::office::XAnnotationAccess
,
51 public css::document::XLinkTargetSupplier
54 SdXImpressDocument
* mpDocModel
;
56 bool mbIsImpressDocument
;
57 sal_Int16 mnTempPageNumber
; // for printing handouts
62 friend class SdXImpressDocument
;
64 const SvxItemPropertySet
* mpPropSet
;
66 /// @throws css::lang::IllegalArgumentException
67 virtual void setBackground( const css::uno::Any
& rValue
);
68 /// @throws std::exception
69 virtual void getBackground( css::uno::Any
& rValue
);
71 OUString
getBookmarkURL() const;
72 void setBookmarkURL( OUString
const & rURL
);
74 void SetLeftBorder( sal_Int32 nValue
);
75 void SetRightBorder( sal_Int32 nValue
);
76 void SetUpperBorder( sal_Int32 nValue
);
77 void SetLowerBorder( sal_Int32 nValue
);
79 void SetWidth( sal_Int32 nWidth
);
80 void SetHeight( sal_Int32 nHeight
);
82 bool IsImpressDocument() const;
84 virtual void disposing() throw() override
;
86 css::uno::Any
getNavigationOrder();
87 void setNavigationOrder( const css::uno::Any
& rValue
);
89 /// @throws css::uno::RuntimeException
90 void throwIfDisposed() const;
93 SdGenericDrawPage(SdXImpressDocument
* pModel
, SdPage
* pInPage
, const SvxItemPropertySet
* pSet
);
94 virtual ~SdGenericDrawPage() throw() override
;
97 bool isValid() { return (SvxDrawPage::mpPage
!= nullptr) && (mpModel
!= nullptr); }
99 SdPage
* GetPage() const { return static_cast<SdPage
*>(SvxDrawPage::mpPage
); }
100 SdXImpressDocument
* GetModel() const;
102 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId() throw();
103 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
105 // this is called whenever a SdrObject must be created for a empty api shape wrapper
106 virtual SdrObject
*CreateSdrObject_( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
109 virtual css::uno::Reference
<css::drawing::XShape
> CreateShape(SdrObject
*pObj
) const override
;
112 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
113 virtual void SAL_CALL
release() throw() override
;
116 virtual css::uno::Reference
< css::drawing::XShape
> SAL_CALL
combine( const css::uno::Reference
< css::drawing::XShapes
>& xShapes
) override
;
117 virtual void SAL_CALL
split( const css::uno::Reference
< css::drawing::XShape
>& xGroup
) override
;
120 virtual css::uno::Reference
< css::drawing::XShape
> SAL_CALL
bind( const css::uno::Reference
< css::drawing::XShapes
>& xShapes
) override
;
121 virtual void SAL_CALL
unbind( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
124 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
125 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
126 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
127 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
128 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
129 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
130 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
133 virtual void SAL_CALL
setPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
134 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
135 virtual void SAL_CALL
addPropertiesChangeListener( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
136 virtual void SAL_CALL
removePropertiesChangeListener( const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
137 virtual void SAL_CALL
firePropertiesChangeEvent( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
139 // XLinkTargetSupplier
140 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getLinks( ) override
;
143 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
145 // XAnimationNodeSupplier
146 virtual css::uno::Reference
< css::animations::XAnimationNode
> SAL_CALL
getAnimationNode( ) override
;
148 // XAnnotationAccess:
149 virtual css::uno::Reference
< css::office::XAnnotation
> SAL_CALL
createAndInsertAnnotation() override
;
150 virtual void SAL_CALL
removeAnnotation(const css::uno::Reference
< css::office::XAnnotation
> & annotation
) override
;
151 virtual css::uno::Reference
< css::office::XAnnotationEnumeration
> SAL_CALL
createAnnotationEnumeration() override
;
154 /***********************************************************************
156 ***********************************************************************/
158 class SdDrawPage
: public css::drawing::XMasterPageTarget
,
159 public css::presentation::XPresentationPage
,
160 public SdGenericDrawPage
163 css::uno::Sequence
< css::uno::Type
> maTypeSequence
;
166 virtual void setBackground( const css::uno::Any
& rValue
) override
;
167 virtual void getBackground( css::uno::Any
& rValue
) override
;
169 SdDrawPage(SdXImpressDocument
* pModel
, SdPage
* pInPage
);
170 virtual ~SdDrawPage() throw() override
;
172 UNO3_GETIMPLEMENTATION_DECL( SdDrawPage
)
174 static OUString
getPageApiName( SdPage
const * pPage
);
175 static OUString
getPageApiNameFromUiName( const OUString
& rUIName
);
176 static OUString
getUiNameFromPageApiName( const OUString
& rApiName
);
179 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
180 virtual void SAL_CALL
acquire() throw() override
;
181 virtual void SAL_CALL
release() throw() override
;
184 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
185 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
188 virtual OUString SAL_CALL
getImplementationName() override
;
189 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
190 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
193 virtual css::uno::Reference
< css::drawing::XDrawPage
> SAL_CALL
getMasterPage( ) override
;
194 virtual void SAL_CALL
setMasterPage( const css::uno::Reference
< css::drawing::XDrawPage
>& xMasterPage
) override
;
197 virtual css::uno::Reference
< css::drawing::XDrawPage
> SAL_CALL
getNotesPage( ) override
;
200 virtual OUString SAL_CALL
getName( ) override
;
201 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
204 virtual sal_Int32 SAL_CALL
getCount() override
;
205 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
208 virtual css::uno::Type SAL_CALL
getElementType() override
;
209 virtual sal_Bool SAL_CALL
hasElements() override
;
212 virtual void SAL_CALL
add( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
213 virtual void SAL_CALL
remove( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
216 /***********************************************************************
218 ***********************************************************************/
220 class SdMasterPage
: public css::presentation::XPresentationPage
,
221 public SdGenericDrawPage
224 css::uno::Sequence
< css::uno::Type
> maTypeSequence
;
226 virtual void setBackground( const css::uno::Any
& rValue
) override
;
227 virtual void getBackground( css::uno::Any
& rValue
) override
;
230 SdMasterPage(SdXImpressDocument
* pModel
, SdPage
* pInPage
);
231 virtual ~SdMasterPage() throw() override
;
233 UNO3_GETIMPLEMENTATION_DECL(SdMasterPage
)
236 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
237 virtual void SAL_CALL
acquire() throw() override
;
238 virtual void SAL_CALL
release() throw() override
;
241 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
242 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
245 virtual OUString SAL_CALL
getImplementationName() override
;
246 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
247 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
250 virtual sal_Int32 SAL_CALL
getCount() override
;
251 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
254 virtual css::uno::Type SAL_CALL
getElementType() override
;
255 virtual sal_Bool SAL_CALL
hasElements() override
;
258 virtual css::uno::Reference
< css::drawing::XDrawPage
> SAL_CALL
getNotesPage( ) override
;
261 virtual OUString SAL_CALL
getName( ) override
;
262 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
265 virtual void SAL_CALL
add( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
266 virtual void SAL_CALL
remove( const css::uno::Reference
< css::drawing::XShape
>& xShape
) override
;
269 /***********************************************************************
271 ***********************************************************************/
273 class SdPageLinkTargets
: public ::cppu::WeakImplHelper
< css::container::XNameAccess
,
274 css::lang::XServiceInfo
>
277 css::uno::Reference
< css::drawing::XDrawPage
> mxPage
;
278 SdGenericDrawPage
* mpUnoPage
;
281 SdPageLinkTargets( SdGenericDrawPage
* pUnoPage
) throw();
282 virtual ~SdPageLinkTargets() throw() override
;
285 SdrObject
* FindObject( const OUString
& rName
) const throw();
288 virtual OUString SAL_CALL
getImplementationName() override
;
289 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
290 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
293 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
294 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
295 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
298 virtual css::uno::Type SAL_CALL
getElementType() override
;
299 virtual sal_Bool SAL_CALL
hasElements() override
;
302 OUString
getUiNameFromPageApiNameImpl( const OUString
& rApiName
);
304 #endif // INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPAGE_HXX
306 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */