android: Update app-specific/MIME type icons
[LibreOffice.git] / sd / source / ui / inc / unopage.hxx
blobd191124fb1940b1f347dfef703a255d84c2e4955
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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>
31 #include <svx/unopage.hxx>
32 #include <svx/fmdpage.hxx>
34 #include <comphelper/servicehelper.hxx>
35 #include <cppuhelper/implbase.hxx>
37 #include "unosrch.hxx"
38 #include <sdpage.hxx>
40 class SdrObject;
41 class SdXImpressDocument;
43 class SdGenericDrawPage : public SvxFmDrawPage,
44 public SdUnoSearchReplaceShape,
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
54 private:
55 SdXImpressDocument* mpDocModel;
56 SdrModel* mpSdrModel;
57 bool mbIsImpressDocument;
58 sal_Int16 mnTempPageNumber; // for printing handouts
59 css::uno::Any mSlideLayout; // import slide layout pptx
60 const SvxItemPropertySet* mpPropSet;
62 void UpdateModel();
64 protected:
65 friend class SdXImpressDocument;
67 /// @throws css::lang::IllegalArgumentException
68 virtual void setBackground( const css::uno::Any& rValue );
69 /// @throws std::exception
70 virtual void getBackground( css::uno::Any& rValue );
72 OUString getBookmarkURL() const;
73 void setBookmarkURL( std::u16string_view rURL );
75 void SetLeftBorder( sal_Int32 nValue );
76 void SetRightBorder( sal_Int32 nValue );
77 void SetUpperBorder( sal_Int32 nValue );
78 void SetLowerBorder( sal_Int32 nValue );
80 void SetWidth( sal_Int32 nWidth );
81 void SetHeight( sal_Int32 nHeight );
83 bool IsImpressDocument() const;
85 virtual void disposing() noexcept override;
87 css::uno::Any getNavigationOrder();
88 void setNavigationOrder( const css::uno::Any& rValue );
90 /// @throws css::uno::RuntimeException
91 void throwIfDisposed() const;
93 public:
94 SdGenericDrawPage(SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet);
95 virtual ~SdGenericDrawPage() noexcept override;
97 // internal
98 bool isValid() const { return (SvxDrawPage::mpPage != nullptr) && (mpModel != nullptr); }
100 SdPage* GetPage() const { return static_cast<SdPage*>(SvxDrawPage::mpPage); }
101 SdXImpressDocument* GetModel() const;
103 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
104 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
106 // this is called whenever a SdrObject must be created for an empty api shape wrapper
107 virtual rtl::Reference<SdrObject> CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
109 // SvxFmDrawPage
110 virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject *pObj) const override;
112 // XInterface
113 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
114 virtual void SAL_CALL release() noexcept override;
116 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
118 // XShapeCombiner
119 virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
120 virtual void SAL_CALL split( const css::uno::Reference< css::drawing::XShape >& xGroup ) override;
122 // XShapeBinder
123 virtual css::uno::Reference< css::drawing::XShape > SAL_CALL bind( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
124 virtual void SAL_CALL unbind( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
126 // XPropertySet
127 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
128 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
129 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
130 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
131 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
132 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
133 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
135 // XMultiPropertySet
136 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
137 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
138 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
139 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
140 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
142 // XLinkTargetSupplier
143 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks( ) override;
145 // XServiceInfo
146 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
148 // XAnimationNodeSupplier
149 virtual css::uno::Reference< css::animations::XAnimationNode > SAL_CALL getAnimationNode( ) override;
151 // XAnnotationAccess:
152 virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() override;
153 virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) override;
154 virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() override;
157 /***********************************************************************
159 ***********************************************************************/
161 class SdDrawPage final : public css::drawing::XMasterPageTarget,
162 public css::presentation::XPresentationPage,
163 public SdGenericDrawPage
165 private:
166 css::uno::Sequence< css::uno::Type > maTypeSequence;
168 virtual void setBackground( const css::uno::Any& rValue ) override;
169 virtual void getBackground( css::uno::Any& rValue ) override;
170 public:
171 SdDrawPage(SdXImpressDocument* pModel, SdPage* pInPage);
172 virtual ~SdDrawPage() noexcept override;
174 UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
176 static OUString getPageApiName( SdPage const * pPage );
177 static OUString getPageApiNameFromUiName( const OUString& rUIName );
178 static OUString getUiNameFromPageApiName( const OUString& rApiName );
180 // XInterface
181 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
182 virtual void SAL_CALL acquire() noexcept override;
183 virtual void SAL_CALL release() noexcept override;
185 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
187 // XTypeProvider
188 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
189 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
191 // XServiceInfo
192 virtual OUString SAL_CALL getImplementationName() override;
193 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
194 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
196 // XMasterPageTarget
197 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getMasterPage( ) override;
198 virtual void SAL_CALL setMasterPage( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage ) override;
200 // XPresentationPage
201 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override;
203 // XNamed
204 virtual OUString SAL_CALL getName( ) override;
205 virtual void SAL_CALL setName( const OUString& aName ) override;
207 // XIndexAccess
208 virtual sal_Int32 SAL_CALL getCount() override ;
209 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
211 // XElementAccess
212 virtual css::uno::Type SAL_CALL getElementType() override;
213 virtual sal_Bool SAL_CALL hasElements() override;
215 // XShapes
216 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
217 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
220 /***********************************************************************
222 ***********************************************************************/
224 class SdMasterPage final : public css::presentation::XPresentationPage,
225 public SdGenericDrawPage
227 private:
228 css::uno::Sequence< css::uno::Type > maTypeSequence;
230 virtual void setBackground( const css::uno::Any& rValue ) override;
231 virtual void getBackground( css::uno::Any& rValue ) override;
233 public:
234 SdMasterPage(SdXImpressDocument* pModel, SdPage* pInPage);
235 virtual ~SdMasterPage() noexcept override;
237 UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
239 // XInterface
240 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
241 virtual void SAL_CALL acquire() noexcept override;
242 virtual void SAL_CALL release() noexcept override;
244 css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
246 // XTypeProvider
247 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
248 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
250 // XServiceInfo
251 virtual OUString SAL_CALL getImplementationName() override;
252 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
253 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
255 // XIndexAccess
256 virtual sal_Int32 SAL_CALL getCount() override ;
257 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
259 // XElementAccess
260 virtual css::uno::Type SAL_CALL getElementType() override;
261 virtual sal_Bool SAL_CALL hasElements() override;
263 // XPresentationPage
264 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getNotesPage( ) override;
266 // XNamed
267 virtual OUString SAL_CALL getName( ) override;
268 virtual void SAL_CALL setName( const OUString& aName ) override;
270 // XShapes
271 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
272 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
275 /***********************************************************************
277 ***********************************************************************/
279 class SdPageLinkTargets final : public ::cppu::WeakImplHelper< css::container::XNameAccess,
280 css::lang::XServiceInfo >
282 private:
283 css::uno::Reference< css::drawing::XDrawPage > mxPage;
284 SdGenericDrawPage* mpUnoPage;
286 public:
287 SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) noexcept;
288 virtual ~SdPageLinkTargets() noexcept override;
290 // internal
291 SdrObject* FindObject( std::u16string_view rName ) const noexcept;
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;
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;
303 // XElementAccess
304 virtual css::uno::Type SAL_CALL getElementType() override;
305 virtual sal_Bool SAL_CALL hasElements() override;
308 OUString getUiNameFromPageApiNameImpl( const OUString& rApiName );
310 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */