LibreOffice Module sd (master) 1
DrawController.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
20#pragma once
21
22#include <sddllapi.h>
25#include <com/sun/star/view/XSelectionSupplier.hpp>
26#include <com/sun/star/view/XFormLayerAccess.hpp>
27#include <com/sun/star/drawing/XDrawView.hpp>
28#include <com/sun/star/drawing/framework/XControllerManager.hpp>
29#include <com/sun/star/lang/XServiceInfo.hpp>
30#include <comphelper/uno3.hxx>
32#include <unotools/weakref.hxx>
33#include <rtl/ref.hxx>
34#include <tools/gen.hxx>
35#include <memory>
36#include <vector>
37
38namespace com::sun::star::drawing { class XDrawSubController; }
39namespace com::sun::star::drawing::framework { class XConfigurationController; }
40namespace com::sun::star::drawing::framework { class XModuleController; }
41namespace com::sun::star::drawing { class XLayer; }
42namespace osl { class Mutex; }
43namespace sd::framework { class ConfigurationController; }
44namespace sd::framework { class ModuleController; }
45class SdPage;
46
47namespace sd {
48
49typedef ::cppu::ImplInheritanceHelper <
51 css::view::XSelectionSupplier,
52 css::lang::XServiceInfo,
53 css::drawing::XDrawView,
54 css::view::XSelectionChangeListener,
55 css::view::XFormLayerAccess,
56 css::drawing::framework::XControllerManager
58
60{
61public:
62 explicit BroadcastHelperOwner (::osl::Mutex& rMutex) : maBroadcastHelper(rMutex) {};
64};
65
66class ViewShellBase;
67
81{
82public:
84 PROPERTY_WORKAREA = 0,
85 PROPERTY_SUB_CONTROLLER = 1,
87 PROPERTY_MASTERPAGEMODE = 3,
88 PROPERTY_LAYERMODE = 4,
89 PROPERTY_ACTIVE_LAYER = 5,
90 PROPERTY_ZOOMTYPE = 6,
91 PROPERTY_ZOOMVALUE = 7,
92 PROPERTY_VIEWOFFSET = 8,
93 PROPERTY_DRAWVIEWMODE = 9
94 ,PROPERTY_UPDATEACC = 10
95 ,PROPERTY_PAGE_CHANGE = 11
96 };
97
100 explicit DrawController (ViewShellBase& rBase) noexcept;
101
102 virtual ~DrawController() noexcept override;
103
114 void SetSubController (
115 const css::uno::Reference<css::drawing::XDrawSubController>& rxSubController);
116
119 void FireVisAreaChanged (const ::tools::Rectangle& rVisArea) noexcept;
120
123 void FireSelectionChangeListener() noexcept;
124
127 void FireChangeEditMode (bool bMasterPageMode) noexcept;
128
131 void FireChangeLayerMode (bool bLayerMode) noexcept;
132
135 void FireSwitchCurrentPage (SdPage* pCurrentPage) noexcept;
136
140 void BroadcastContextChange() const;
141 void NotifyAccUpdate();
142 void fireChangeLayer( css::uno::Reference< css::drawing::XLayer>* pCurrentLayer ) noexcept;
143 // change the parameter to int
144 //void fireSwitchCurrentPage( String pageName) throw();
145 void fireSwitchCurrentPage( sal_Int32 pageIndex) noexcept;
146 bool IsDisposing() const { return mbDisposing; }
147
154 ViewShellBase* GetViewShellBase() { return mpBase;}
155
161 void ReleaseViewShellBase();
162
164 DECLARE_XTYPEPROVIDER()
165
166 // XComponent
167 virtual void SAL_CALL dispose() override;
168 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
169 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
170
171 // XController
172 virtual sal_Bool SAL_CALL suspend( sal_Bool Suspend ) override;
173
174 // XServiceInfo
175 virtual OUString SAL_CALL getImplementationName() override;
176 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
177 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
178
179 // XSelectionSupplier
180 virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
181 virtual css::uno::Any SAL_CALL getSelection( ) override;
182 virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
183 virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
184
185 // XPropertySet
186 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
187
188 // XFormLayerAccess
189 virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController( const css::uno::Reference< css::form::XForm >& Form ) override;
190 virtual sal_Bool SAL_CALL isFormDesignMode( ) override;
191 virtual void SAL_CALL setFormDesignMode( sal_Bool DesignMode ) override;
192
193 // XControlAccess
194 virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl( const css::uno::Reference< css::awt::XControlModel >& xModel ) override;
195
196 // XDrawView
197 virtual void SAL_CALL
198 setCurrentPage (
199 const css::uno::Reference<
200 css::drawing::XDrawPage >& xPage) override;
201
202 virtual css::uno::Reference<
203 css::drawing::XDrawPage > SAL_CALL
204 getCurrentPage() override;
205
206 // lang::XEventListener
207 virtual void SAL_CALL
208 disposing (const css::lang::EventObject& rEventObject) override;
209
210 // view::XSelectionChangeListener
211 virtual void SAL_CALL
212 selectionChanged (const css::lang::EventObject& rEvent) override;
213
214 // XControllerManager
215
216 virtual css::uno::Reference<css::drawing::framework::XConfigurationController> SAL_CALL
217 getConfigurationController() override;
218
219 virtual css::uno::Reference<css::drawing::framework::XModuleController> SAL_CALL
220 getModuleController() override;
221
222private:
226 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
227
228 static void FillPropertyTable (
229 ::std::vector< css::beans::Property>& rProperties);
230
235 virtual void SAL_CALL getFastPropertyValue(
236 css::uno::Any& rValue,
237 sal_Int32 nHandle ) const override;
238
253 virtual sal_Bool SAL_CALL convertFastPropertyValue(
254 css::uno::Any & rConvertedValue,
255 css::uno::Any & rOldValue,
256 sal_Int32 nHandle,
257 const css::uno::Any& rValue ) override;
258
262 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
263 sal_Int32 nHandle,
264 const css::uno::Any& rValue ) override;
265
271 void ThrowIfDisposed() const;
272
273 using cppu::OPropertySetHelper::disposing;
274 using cppu::OPropertySetHelper::getFastPropertyValue;
275
276 css::uno::Reference< css::drawing::XLayer>* mpCurrentLayer;
277
278 const css::uno::Type m_aSelectionTypeIdentifier;
279
284
285 ::tools::Rectangle maLastVisArea;
286 ::unotools::WeakReference<SdPage> mpCurrentPage;
287 bool mbMasterPageMode;
288 bool mbLayerMode;
289
293 bool mbDisposing;
294
295 ::std::unique_ptr< ::cppu::IPropertyArrayHelper> mpPropertyArrayHelper;
296
299 css::uno::Reference<css::drawing::XDrawSubController> mxSubController;
300
301 rtl::Reference<sd::framework::ConfigurationController> mxConfigurationController;
302 rtl::Reference<sd::framework::ModuleController> mxModuleController;
303
309 void FirePropertyChange (
310 sal_Int32 nHandle,
311 const css::uno::Any& rNewValue,
312 const css::uno::Any& rOldValue);
313
314 void ProvideFrameworkControllers();
315 void DisposeFrameworkControllers();
316};
317
318} // end of namespace sd
319
320/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BroadcastHelperOwner(::osl::Mutex &rMutex)
::cppu::OBroadcastHelper maBroadcastHelper
The DrawController is the UNO controller for Impress and Draw.
ViewShellBase * GetViewShellBase()
Return a pointer to the ViewShellBase object that the DrawController is connected to.
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
constexpr OUStringLiteral PROPERTY_CURRENTPAGE
Type
::cppu::ImplInheritanceHelper< SfxBaseController, css::view::XSelectionSupplier, css::lang::XServiceInfo, css::drawing::XDrawView, css::view::XSelectionChangeListener, css::view::XFormLayerAccess, css::drawing::framework::XControllerManager > DrawControllerInterfaceBase
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
unsigned char sal_Bool
#define DECLARE_XINTERFACE()