LibreOffice Module sd (master) 1
unopage.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <com/sun/star/document/XLinkTargetSupplier.hpp>
22#include <com/sun/star/container/XNamed.hpp>
23#include <com/sun/star/drawing/XMasterPageTarget.hpp>
24#include <com/sun/star/drawing/XShapeCombiner.hpp>
25#include <com/sun/star/drawing/XShapeBinder.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 <svx/unopage.hxx>
32#include <svx/fmdpage.hxx>
33
36
37#include "unosrch.hxx"
38#include <sdpage.hxx>
39
40class SdrObject;
42
45 public css::drawing::XShapeCombiner,
46 public css::drawing::XShapeBinder,
47 public css::container::XNamed,
48 public css::beans::XPropertySet,
49 public css::beans::XMultiPropertySet,
50 public css::animations::XAnimationNodeSupplier,
51 public css::office::XAnnotationAccess,
52 public css::document::XLinkTargetSupplier
53{
54private:
58 sal_Int16 mnTempPageNumber; // for printing handouts
60
61 void UpdateModel();
62
63protected:
64 friend class SdXImpressDocument;
65
67 virtual void setBackground( const css::uno::Any& rValue );
69 virtual void getBackground( css::uno::Any& rValue );
70
71 OUString getBookmarkURL() const;
72 void setBookmarkURL( std::u16string_view rURL );
73
74 void SetLeftBorder( sal_Int32 nValue );
75 void SetRightBorder( sal_Int32 nValue );
76 void SetUpperBorder( sal_Int32 nValue );
77 void SetLowerBorder( sal_Int32 nValue );
78
79 void SetWidth( sal_Int32 nWidth );
80 void SetHeight( sal_Int32 nHeight );
81
82 bool IsImpressDocument() const;
83
84 virtual void disposing() noexcept override;
85
86 css::uno::Any getNavigationOrder();
87 void setNavigationOrder( const css::uno::Any& rValue );
88
90 void throwIfDisposed() const;
91
92public:
93 SdGenericDrawPage(SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet);
94 virtual ~SdGenericDrawPage() noexcept override;
95
96 // internal
97 bool isValid() const { return (SvxDrawPage::mpPage != nullptr) && (mpModel != nullptr); }
98
99 SdPage* GetPage() const { return static_cast<SdPage*>(SvxDrawPage::mpPage); }
101
102 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
103 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
104
105 // this is called whenever a SdrObject must be created for an empty api shape wrapper
106 virtual rtl::Reference<SdrObject> CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
107
108 // SvxFmDrawPage
109 virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject *pObj) const override;
110
111 // XInterface
112 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
113 virtual void SAL_CALL release() noexcept override;
114
115 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
116
117 // XShapeCombiner
118 virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
119 virtual void SAL_CALL split( const css::uno::Reference< css::drawing::XShape >& xGroup ) override;
120
121 // XShapeBinder
122 virtual css::uno::Reference< css::drawing::XShape > SAL_CALL bind( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
123 virtual void SAL_CALL unbind( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
124
125 // XPropertySet
126 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
127 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
128 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
129 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
130 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
131 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
132 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
133
134 // XMultiPropertySet
135 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
136 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
137 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
138 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
139 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
140
141 // XLinkTargetSupplier
142 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks( ) override;
143
144 // XServiceInfo
145 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
146
147 // XAnimationNodeSupplier
148 virtual css::uno::Reference< css::animations::XAnimationNode > SAL_CALL getAnimationNode( ) override;
149
150 // XAnnotationAccess:
151 virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() override;
152 virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) override;
153 virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() override;
154};
155
156/***********************************************************************
157* *
158***********************************************************************/
159
160class SdDrawPage final : public css::drawing::XMasterPageTarget,
161 public css::presentation::XPresentationPage,
162 public SdGenericDrawPage
163{
164private:
165 css::uno::Sequence< css::uno::Type > maTypeSequence;
166
167 virtual void setBackground( const css::uno::Any& rValue ) override;
168 virtual void getBackground( css::uno::Any& rValue ) override;
169public:
170 SdDrawPage(SdXImpressDocument* pModel, SdPage* pInPage);
171 virtual ~SdDrawPage() noexcept override;
172
173 UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
174
175 static OUString getPageApiName( SdPage const * pPage );
176 static OUString getPageApiNameFromUiName( const OUString& rUIName );
177 static OUString getUiNameFromPageApiName( const OUString& rApiName );
178
179 // XInterface
180 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
181 virtual void SAL_CALL acquire() noexcept override;
182 virtual void SAL_CALL release() noexcept override;
183
184 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
185
186 // XTypeProvider
187 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
188 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
189
190 // XServiceInfo
191 virtual OUString SAL_CALL getImplementationName() override;
192 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
193 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
194
195 // XMasterPageTarget
196 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getMasterPage( ) override;
197 virtual void SAL_CALL setMasterPage( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage ) override;
198
199 // XPresentationPage
200 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override;
201
202 // XNamed
203 virtual OUString SAL_CALL getName( ) override;
204 virtual void SAL_CALL setName( const OUString& aName ) override;
205
206 // XIndexAccess
207 virtual sal_Int32 SAL_CALL getCount() override ;
208 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
209
210 // XElementAccess
211 virtual css::uno::Type SAL_CALL getElementType() override;
212 virtual sal_Bool SAL_CALL hasElements() override;
213
214 // XShapes
215 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
216 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
217};
218
219/***********************************************************************
220* *
221***********************************************************************/
222
223class SdMasterPage final : public css::presentation::XPresentationPage,
224 public SdGenericDrawPage
225{
226private:
227 css::uno::Sequence< css::uno::Type > maTypeSequence;
228
229 virtual void setBackground( const css::uno::Any& rValue ) override;
230 virtual void getBackground( css::uno::Any& rValue ) override;
231
232public:
233 SdMasterPage(SdXImpressDocument* pModel, SdPage* pInPage);
234 virtual ~SdMasterPage() noexcept override;
235
236 UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
237
238 // XInterface
239 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
240 virtual void SAL_CALL acquire() noexcept override;
241 virtual void SAL_CALL release() noexcept override;
242
243 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
244
245 // XTypeProvider
246 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
247 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
248
249 // XServiceInfo
250 virtual OUString SAL_CALL getImplementationName() override;
251 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
252 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
253
254 // XIndexAccess
255 virtual sal_Int32 SAL_CALL getCount() override ;
256 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
257
258 // XElementAccess
259 virtual css::uno::Type SAL_CALL getElementType() override;
260 virtual sal_Bool SAL_CALL hasElements() override;
261
262 // XPresentationPage
263 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override;
264
265 // XNamed
266 virtual OUString SAL_CALL getName( ) override;
267 virtual void SAL_CALL setName( const OUString& aName ) override;
268
269 // XShapes
270 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
271 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
272};
273
274/***********************************************************************
275* *
276***********************************************************************/
277
278class SdPageLinkTargets final : public ::cppu::WeakImplHelper< css::container::XNameAccess,
279 css::lang::XServiceInfo >
280{
281private:
282 css::uno::Reference< css::drawing::XDrawPage > mxPage;
284
285public:
286 SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) noexcept;
287 virtual ~SdPageLinkTargets() noexcept override;
288
289 // internal
290 SdrObject* FindObject( std::u16string_view rName ) const noexcept;
291
292 // XServiceInfo
293 virtual OUString SAL_CALL getImplementationName() override;
294 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
295 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
296
297 // XNameAccess
298 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
299 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
300 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
301
302 // XElementAccess
303 virtual css::uno::Type SAL_CALL getElementType() override;
304 virtual sal_Bool SAL_CALL hasElements() override;
305};
306
307OUString getUiNameFromPageApiNameImpl( const OUString& rApiName );
308
309/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
css::uno::Sequence< css::uno::Type > maTypeSequence
Definition: unopage.hxx:165
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unopage.cxx:1399
virtual void getBackground(css::uno::Any &rValue)
Definition: unopage.cxx:1558
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unopage.cxx:1538
sal_Int16 mnTempPageNumber
Definition: unopage.hxx:58
virtual void SAL_CALL unbind(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unopage.cxx:1684
css::uno::Any getNavigationOrder()
Definition: unopage.cxx:2649
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept
Definition: unopage.cxx:328
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unopage.cxx:580
void SetHeight(sal_Int32 nHeight)
Definition: unopage.cxx:1854
SdrModel * mpSdrModel
Definition: unopage.hxx:56
void SetWidth(sal_Int32 nWidth)
Definition: unopage.cxx:1825
void SetUpperBorder(sal_Int32 nValue)
Definition: unopage.cxx:1749
void SetRightBorder(sal_Int32 nValue)
Definition: unopage.cxx:1725
virtual void disposing() noexcept override
Definition: unopage.cxx:1891
void setNavigationOrder(const css::uno::Any &rValue)
Definition: unopage.cxx:2566
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: unopage.cxx:1548
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unopage.cxx:1008
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unopage.cxx:1403
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unopage.cxx:1348
bool isValid() const
Definition: unopage.hxx:97
css::uno::Any SAL_CALL queryAggregation(css::uno::Type const &rType) override
Definition: unopage.cxx:520
SdPage * GetPage() const
Definition: unopage.hxx:99
void throwIfDisposed() const
Definition: unopage.cxx:359
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
Definition: unopage.cxx:1352
bool mbIsImpressDocument
Definition: unopage.hxx:57
virtual void SAL_CALL split(const css::uno::Reference< css::drawing::XShape > &xGroup) override
Definition: unopage.cxx:1635
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const override
Definition: unopage.cxx:1407
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL bind(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
Definition: unopage.cxx:1652
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unopage.cxx:1346
virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() override
Definition: unopage.cxx:2527
virtual css::uno::Reference< css::animations::XAnimationNode > SAL_CALL getAnimationNode() override
Definition: unopage.cxx:1898
const SvxItemPropertySet * mpPropSet
Definition: unopage.hxx:59
bool IsImpressDocument() const
Definition: unopage.cxx:372
void SetLeftBorder(sal_Int32 nValue)
Definition: unopage.cxx:1701
SdXImpressDocument * GetModel() const
Definition: unopage.cxx:365
virtual void SAL_CALL release() noexcept override
Definition: unopage.cxx:1884
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unopage.cxx:334
void SetLowerBorder(sal_Int32 nValue)
Definition: unopage.cxx:1773
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unopage.cxx:1349
virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() override
Definition: unopage.cxx:2542
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unopage.cxx:1374
SdXImpressDocument * mpDocModel
Definition: unopage.hxx:55
virtual void setBackground(const css::uno::Any &rValue)
Definition: unopage.cxx:1553
virtual rtl::Reference< SdrObject > CreateSdrObject_(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unopage.cxx:396
void UpdateModel()
Definition: unopage.cxx:380
void setBookmarkURL(std::u16string_view rURL)
Definition: unopage.cxx:1579
virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > &annotation) override
Definition: unopage.cxx:2537
OUString getBookmarkURL() const
Definition: unopage.cxx:1563
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unopage.cxx:1395
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unopage.cxx:515
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unopage.cxx:1347
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unopage.cxx:573
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
Definition: unopage.cxx:1600
css::uno::Sequence< css::uno::Type > maTypeSequence
Definition: unopage.hxx:227
css::uno::Reference< css::drawing::XDrawPage > mxPage
Definition: unopage.hxx:282
SdGenericDrawPage * mpUnoPage
Definition: unopage.hxx:283
this class implements a search or replace operation on a given page or a given sdrobj
Definition: unosrch.hxx:40
virtual void SAL_CALL acquire() noexcept override
Definition: unomodel.cxx:352
SdrModel * mpModel
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int32 SAL_CALL getCount() override
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
SdrPage * mpPage
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Type
unsigned char sal_Bool
signed char sal_Int8
OUString getPageApiNameFromUiName(const OUString &rUIName)
Definition: unopage.cxx:2174
OUString getPageApiName(SdPage const *pPage)
Definition: unopage.cxx:2156
OUString getUiNameFromPageApiNameImpl(const OUString &rApiName)
Definition: unopage.cxx:2197