/src/libreoffice/sd/source/ui/inc/unopage.hxx
Line | Count | Source |
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 | | |
33 | | #include <comphelper/servicehelper.hxx> |
34 | | #include <cppuhelper/implbase.hxx> |
35 | | |
36 | | #include "unosrch.hxx" |
37 | | #include <sdpage.hxx> |
38 | | |
39 | | class SdrObject; |
40 | | class SdXImpressDocument; |
41 | | class SdMasterPage; |
42 | | |
43 | | /** The shape type a presentation object of the given kind claims - what the placeholder is, which |
44 | | can differ from what currently represents it on the page. */ |
45 | | OUString GetPresObjShapeType(PresObjKind eKind); |
46 | | |
47 | | class SdGenericDrawPage : public SvxDrawPage, |
48 | | public SdUnoSearchReplaceShape, |
49 | | public css::drawing::XShapeCombiner, |
50 | | public css::drawing::XShapeBinder, |
51 | | public css::container::XNamed, |
52 | | public css::beans::XPropertySet, |
53 | | public css::beans::XMultiPropertySet, |
54 | | public css::animations::XAnimationNodeSupplier, |
55 | | public css::office::XAnnotationAccess, |
56 | | public css::document::XLinkTargetSupplier |
57 | | { |
58 | | private: |
59 | | SdXImpressDocument* mpDocModel; |
60 | | SdrModel* mpSdrModel; |
61 | | bool mbIsImpressDocument; |
62 | | sal_Int16 mnTempPageNumber; // for printing handouts |
63 | | css::uno::Any mSlideLayout; // import slide layout pptx |
64 | | const SvxItemPropertySet* mpPropSet; |
65 | | |
66 | | void UpdateModel(); |
67 | | |
68 | | protected: |
69 | | friend class SdXImpressDocument; |
70 | | |
71 | | /// @throws css::lang::IllegalArgumentException |
72 | | virtual void setBackground( const css::uno::Any& rValue ); |
73 | | /// @throws std::exception |
74 | | virtual void getBackground( css::uno::Any& rValue ); |
75 | | |
76 | | OUString getBookmarkURL() const; |
77 | | void setBookmarkURL( std::u16string_view rURL ); |
78 | | |
79 | | void SetLeftBorder( sal_Int32 nValue ); |
80 | | void SetRightBorder( sal_Int32 nValue ); |
81 | | void SetUpperBorder( sal_Int32 nValue ); |
82 | | void SetLowerBorder( sal_Int32 nValue ); |
83 | | |
84 | | void SetWidth( sal_Int32 nWidth ); |
85 | | void SetHeight( sal_Int32 nHeight ); |
86 | | |
87 | | bool IsImpressDocument() const; |
88 | | |
89 | | virtual void disposing() noexcept override; |
90 | | |
91 | | css::uno::Any getNavigationOrder(); |
92 | | void setNavigationOrder( const css::uno::Any& rValue ); |
93 | | |
94 | | /// @throws css::uno::RuntimeException |
95 | | void throwIfDisposed() const; |
96 | | |
97 | | public: |
98 | | SdGenericDrawPage(SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet); |
99 | | virtual ~SdGenericDrawPage() noexcept override; |
100 | | |
101 | | // internal |
102 | 2.72k | bool isValid() const { return (SvxDrawPage::mpPage != nullptr) && (mpModel != nullptr); } |
103 | | |
104 | 1.02M | SdPage* GetPage() const { return static_cast<SdPage*>(SvxDrawPage::mpPage); } |
105 | | SdXImpressDocument* GetModel() const; |
106 | | |
107 | | static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; |
108 | | virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; |
109 | | |
110 | | // this is called whenever a SdrObject must be created for an empty api shape wrapper |
111 | | virtual rtl::Reference<SdrObject> CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
112 | | |
113 | | // SvxDrawPage |
114 | | virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject *pObj) const override; |
115 | | |
116 | | // XInterface |
117 | 0 | virtual void SAL_CALL acquire() noexcept override { SvxDrawPage::acquire(); } |
118 | 0 | virtual void SAL_CALL release() noexcept override { SvxDrawPage::release(); } |
119 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; |
120 | | |
121 | | // XShapeCombiner |
122 | | virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override; |
123 | | virtual void SAL_CALL split( const css::uno::Reference< css::drawing::XShape >& xGroup ) override; |
124 | | |
125 | | // XShapeBinder |
126 | | virtual css::uno::Reference< css::drawing::XShape > SAL_CALL bind( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override; |
127 | | virtual void SAL_CALL unbind( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
128 | | |
129 | | // XPropertySet |
130 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; |
131 | | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; |
132 | | virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
133 | | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
134 | | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
135 | | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
136 | | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
137 | | |
138 | | // XMultiPropertySet |
139 | | virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; |
140 | | virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; |
141 | | virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; |
142 | | virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; |
143 | | virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; |
144 | | |
145 | | // XLinkTargetSupplier |
146 | | virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks( ) override; |
147 | | |
148 | | // XServiceInfo |
149 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
150 | | |
151 | | // XAnimationNodeSupplier |
152 | | virtual css::uno::Reference< css::animations::XAnimationNode > SAL_CALL getAnimationNode( ) override; |
153 | | |
154 | | // XAnnotationAccess: |
155 | | virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() override; |
156 | | virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) override; |
157 | | virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() override; |
158 | | }; |
159 | | |
160 | | /*********************************************************************** |
161 | | * * |
162 | | ***********************************************************************/ |
163 | | |
164 | | class SdDrawPage final : public css::drawing::XMasterPageTarget, |
165 | | public css::presentation::XPresentationPage, |
166 | | public SdGenericDrawPage |
167 | | { |
168 | | private: |
169 | | css::uno::Sequence< css::uno::Type > maTypeSequence; |
170 | | |
171 | | virtual void setBackground( const css::uno::Any& rValue ) override; |
172 | | virtual void getBackground( css::uno::Any& rValue ) override; |
173 | | public: |
174 | | SdDrawPage(SdXImpressDocument* pModel, SdPage* pInPage); |
175 | | virtual ~SdDrawPage() noexcept override; |
176 | | |
177 | | UNO3_GETIMPLEMENTATION_DECL( SdDrawPage ) |
178 | | |
179 | | static OUString getPageApiName( SdPage const * pPage ); |
180 | | static OUString getPageApiNameFromUiName( const OUString& rUIName ); |
181 | | static OUString getUiNameFromPageApiName( const OUString& rApiName ); |
182 | | |
183 | | // XInterface |
184 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; |
185 | | virtual void SAL_CALL acquire() noexcept override; |
186 | | virtual void SAL_CALL release() noexcept override; |
187 | | |
188 | | // XTypeProvider |
189 | | virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; |
190 | | virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; |
191 | | |
192 | | // XServiceInfo |
193 | | virtual OUString SAL_CALL getImplementationName() override; |
194 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
195 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
196 | | |
197 | | // XMasterPageTarget |
198 | | virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getMasterPage( ) override; |
199 | | virtual void SAL_CALL setMasterPage( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage ) override; |
200 | | |
201 | | // XPresentationPage |
202 | | virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override; |
203 | | |
204 | | // XNamed |
205 | | virtual OUString SAL_CALL getName( ) override; |
206 | | virtual void SAL_CALL setName( const OUString& aName ) override; |
207 | | |
208 | | // XIndexAccess |
209 | | virtual sal_Int32 SAL_CALL getCount() override ; |
210 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
211 | | |
212 | | // XElementAccess |
213 | | virtual css::uno::Type SAL_CALL getElementType() override; |
214 | | virtual sal_Bool SAL_CALL hasElements() override; |
215 | | |
216 | | // XShapes |
217 | | virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
218 | | virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
219 | | |
220 | | SdMasterPage* getSdMasterPage(); |
221 | | }; |
222 | | |
223 | | /*********************************************************************** |
224 | | * * |
225 | | ***********************************************************************/ |
226 | | |
227 | | class SdMasterPage final : public css::presentation::XPresentationPage, |
228 | | public SdGenericDrawPage |
229 | | { |
230 | | private: |
231 | | css::uno::Sequence< css::uno::Type > maTypeSequence; |
232 | | |
233 | | virtual void setBackground( const css::uno::Any& rValue ) override; |
234 | | virtual void getBackground( css::uno::Any& rValue ) override; |
235 | | |
236 | | public: |
237 | | SdMasterPage(SdXImpressDocument* pModel, SdPage* pInPage); |
238 | | virtual ~SdMasterPage() noexcept override; |
239 | | |
240 | | UNO3_GETIMPLEMENTATION_DECL(SdMasterPage) |
241 | | |
242 | | // XInterface |
243 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; |
244 | | virtual void SAL_CALL acquire() noexcept override; |
245 | | virtual void SAL_CALL release() noexcept override; |
246 | | |
247 | | // XTypeProvider |
248 | | virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; |
249 | | virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; |
250 | | |
251 | | // XServiceInfo |
252 | | virtual OUString SAL_CALL getImplementationName() override; |
253 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
254 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
255 | | |
256 | | // XIndexAccess |
257 | | virtual sal_Int32 SAL_CALL getCount() override ; |
258 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
259 | | |
260 | | // XElementAccess |
261 | | virtual css::uno::Type SAL_CALL getElementType() override; |
262 | | virtual sal_Bool SAL_CALL hasElements() override; |
263 | | |
264 | | // XPresentationPage |
265 | | virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override; |
266 | | |
267 | | // XNamed |
268 | | virtual OUString SAL_CALL getName( ) override; |
269 | | virtual void SAL_CALL setName( const OUString& aName ) override; |
270 | | |
271 | | // XShapes |
272 | | virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
273 | | virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; |
274 | | }; |
275 | | |
276 | | /*********************************************************************** |
277 | | * * |
278 | | ***********************************************************************/ |
279 | | |
280 | | class SdPageLinkTargets final : public ::cppu::WeakImplHelper< css::container::XNameAccess, |
281 | | css::lang::XServiceInfo > |
282 | | { |
283 | | private: |
284 | | rtl::Reference< SdGenericDrawPage > mxPage; |
285 | | |
286 | | public: |
287 | | SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) noexcept; |
288 | | virtual ~SdPageLinkTargets() noexcept override; |
289 | | |
290 | | // internal |
291 | | SdrObject* FindObject( std::u16string_view rName ) const noexcept; |
292 | | |
293 | | // XServiceInfo |
294 | | virtual OUString SAL_CALL getImplementationName() override; |
295 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
296 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
297 | | |
298 | | // XNameAccess |
299 | | virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; |
300 | | virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; |
301 | | virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; |
302 | | |
303 | | // XElementAccess |
304 | | virtual css::uno::Type SAL_CALL getElementType() override; |
305 | | virtual sal_Bool SAL_CALL hasElements() override; |
306 | | }; |
307 | | |
308 | | OUString getUiNameFromPageApiNameImpl( const OUString& rApiName ); |
309 | | |
310 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |