summaryrefslogtreecommitdiffstats
path: root/sd/source/ui/inc/framework
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sd/source/ui/inc/framework
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sd/source/ui/inc/framework')
-rw-r--r--sd/source/ui/inc/framework/Configuration.hxx181
-rw-r--r--sd/source/ui/inc/framework/ConfigurationController.hxx180
-rw-r--r--sd/source/ui/inc/framework/DrawModule.hxx46
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx340
-rw-r--r--sd/source/ui/inc/framework/ImpressModule.hxx46
-rw-r--r--sd/source/ui/inc/framework/ModuleController.hxx114
-rw-r--r--sd/source/ui/inc/framework/Pane.hxx141
-rw-r--r--sd/source/ui/inc/framework/PresentationFactory.hxx77
-rw-r--r--sd/source/ui/inc/framework/PresentationModule.hxx46
-rw-r--r--sd/source/ui/inc/framework/ResourceId.hxx213
-rw-r--r--sd/source/ui/inc/framework/ViewShellWrapper.hxx131
11 files changed, 1515 insertions, 0 deletions
diff --git a/sd/source/ui/inc/framework/Configuration.hxx b/sd/source/ui/inc/framework/Configuration.hxx
new file mode 100644
index 000000000..8f33ef431
--- /dev/null
+++ b/sd/source/ui/inc/framework/Configuration.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XConfiguration.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/compbase.hxx>
+
+#include <memory>
+
+namespace com::sun::star::util { class XCloneable; }
+namespace com::sun::star::drawing::framework { class XConfigurationControllerBroadcaster; }
+
+namespace sd::framework {
+
+typedef comphelper::WeakComponentImplHelper <
+ css::drawing::framework::XConfiguration,
+ css::container::XNamed,
+ css::lang::XServiceInfo
+ > ConfigurationInterfaceBase;
+
+/** A configuration describes the resources of an application like panes,
+ views, and tool bars and their relationships that are currently active
+ or are requested to be activated. Resources are specified by URLs rather
+ than references so that not only the current configuration but also a
+ requested configuration can be represented.
+
+ A resource URL describes the type of a resource, not its actual
+ instance. For resources, like panes, that are unique with respect to an
+ application frame, that does not mean much of a difference. For other
+ resources like views, that may have more than one instance per
+ application frame, this is different. To identify them unambiguously a
+ second URL, one of a unique resource, is necessary. This second URL is
+ called the anchor of the first. The two types of resources are called
+ unique and linked respectively.
+
+ Direct manipulation of a configuration object is not advised with the
+ exception of the configuration controller and objects that implement the
+ XConfigurationChangeOperation interface.
+*/
+class Configuration final
+ : public ConfigurationInterfaceBase
+{
+public:
+ /** Create a new configuration with a broadcaster that is used to send
+ events about requested configuration changes.
+ @param rxBroadcaster
+ This broadcaster is typically the same as the one used by the
+ ConfigurationController.
+ @param bBroadcastRequestEvents
+ When this is <TRUE/> then modifications to the configuration
+ trigger the broadcasting of "ResourceActivationRequestEvent" and
+ "ResourceDeactivationRequestEvent". When this flag is <FALSE/>
+ then events with type "ResourceActivationEvent" and
+ "ResourceDeactivationEvent" are broadcasted.
+ */
+ Configuration (const css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents);
+ virtual ~Configuration() override;
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ // XConfiguration
+
+ virtual void SAL_CALL addResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>&
+ rxResourceId) override;
+
+ virtual void SAL_CALL removeResource(
+ const css::uno::Reference<css::drawing::framework::XResourceId>&
+ rxResourceId) override;
+
+ virtual css::uno::Sequence< css::uno::Reference<
+ css::drawing::framework::XResourceId> > SAL_CALL getResources (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
+ const OUString& rsResourceURLPrefix,
+ css::drawing::framework::AnchorBindingMode eMode) override;
+
+ virtual sal_Bool SAL_CALL hasResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>&
+ rxResourceId) override;
+
+ // XCloneable
+
+ virtual css::uno::Reference<css::util::XCloneable>
+ SAL_CALL createClone() override;
+
+ // XNamed
+
+ /** Return a human readable string representation. This is used for
+ debugging purposes.
+ */
+ virtual OUString SAL_CALL getName() override;
+
+ /** This call is ignored because the XNamed interface is (mis)used to
+ give access to a human readable name for debugging purposes.
+ */
+ virtual void SAL_CALL setName (const OUString& rName) override;
+
+ OUString SAL_CALL getImplementationName() override;
+
+ sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+private:
+ class ResourceContainer;
+ /** The resource container holds the URLs of unique resource and of
+ resource linked to unique resources.
+ */
+ std::unique_ptr<ResourceContainer> mpResourceContainer;
+
+ /** The broadcaster used for notifying listeners of requests for
+ configuration changes.
+ */
+ css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster>
+ mxBroadcaster;
+
+ bool mbBroadcastRequestEvents;
+
+ /** This private variant of the constructor is used for cloning a
+ Configuration object.
+ @param rResourceContainer
+ The new Configuration is created with a copy of the elements in
+ this container.
+ */
+ Configuration (const css::uno::Reference<css::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster,
+ bool bBroadcastRequestEvents,
+ const ResourceContainer& rResourceContainer);
+
+ /** Send an event to all interested listeners that a resource has been
+ added or removed. The event is sent to the listeners via the
+ ConfigurationController.
+ @param rxResourceId
+ The resource that is added to or removed from the configuration.
+ @param bActivation
+ This specifies whether an activation or deactivation is
+ broadcasted. The mbBroadcastRequestEvents member is also taken
+ into account when the actual event type field is determined.
+ */
+ void PostEvent (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const bool bActivation);
+
+ /** When the called object has already been disposed this method throws
+ an exception and does not return.
+
+ @throws css::lang::DisposedException
+ */
+ void ThrowIfDisposed() const;
+};
+
+/** Return whether the two given configurations contain the same resource
+ ids. The order of resource ids is ignored. Empty references are
+ treated like empty configurations.
+*/
+bool AreConfigurationsEquivalent (
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration1,
+ const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration2);
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx
new file mode 100644
index 000000000..2fe2f48d0
--- /dev/null
+++ b/sd/source/ui/inc/framework/ConfigurationController.hxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase.hxx>
+
+#include <memory>
+
+
+namespace com::sun::star::drawing::framework { class XConfiguration; }
+namespace com::sun::star::drawing::framework { class XConfigurationChangeRequest; }
+namespace com::sun::star::drawing::framework { class XResourceId; }
+namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; }
+
+namespace sd::framework {
+
+typedef ::cppu::WeakComponentImplHelper <
+ css::drawing::framework::XConfigurationController,
+ css::lang::XInitialization
+ > ConfigurationControllerInterfaceBase;
+
+/** The configuration controller is responsible for maintaining the current
+ configuration.
+
+ @see css::drawing::framework::XConfigurationController
+ for an extended documentation.
+*/
+class ConfigurationController
+ : private cppu::BaseMutex,
+ public ConfigurationControllerInterfaceBase
+{
+public:
+ ConfigurationController() noexcept;
+ virtual ~ConfigurationController() noexcept override;
+ ConfigurationController(const ConfigurationController&) = delete;
+ ConfigurationController& operator=(const ConfigurationController&) = delete;
+
+ virtual void SAL_CALL disposing() override;
+
+ void ProcessEvent();
+
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate();
+
+ // XConfigurationController
+
+ virtual void SAL_CALL lock() override;
+
+ virtual void SAL_CALL unlock() override;
+
+ virtual void SAL_CALL requestResourceActivation (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ css::drawing::framework::ResourceActivationMode eMode) override;
+
+ virtual void SAL_CALL requestResourceDeactivation (
+ const css::uno::Reference<css::drawing::framework::XResourceId>&
+ rxResourceId) override;
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL getResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId) override;
+
+ virtual void SAL_CALL update() override;
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XConfiguration>
+ SAL_CALL getRequestedConfiguration() override;
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XConfiguration>
+ SAL_CALL getCurrentConfiguration() override;
+
+ virtual void SAL_CALL restoreConfiguration (
+ const css::uno::Reference<css::drawing::framework::XConfiguration>&
+ rxConfiguration) override;
+
+ // XConfigurationControllerBroadcaster
+
+ virtual void SAL_CALL addConfigurationChangeListener (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener,
+ const OUString& rsEventType,
+ const css::uno::Any& rUserData) override;
+
+ virtual void SAL_CALL removeConfigurationChangeListener (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeListener>& rxListener) override;
+
+ virtual void SAL_CALL notifyEvent (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
+
+ // XConfigurationRequestQueue
+
+ virtual sal_Bool SAL_CALL hasPendingRequests() override;
+
+ virtual void SAL_CALL postChangeRequest (
+ const css::uno::Reference<
+ css::drawing::framework::XConfigurationChangeRequest>& rxRequest) override;
+
+ // XResourceFactoryManager
+
+ virtual void SAL_CALL addResourceFactory(
+ const OUString& sResourceURL,
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override;
+
+ virtual void SAL_CALL removeResourceFactoryForURL(
+ const OUString& sResourceURL) override;
+
+ virtual void SAL_CALL removeResourceFactoryForReference(
+ const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override;
+
+ virtual css::uno::Reference<css::drawing::framework::XResourceFactory>
+ SAL_CALL getResourceFactory (
+ const OUString& sResourceURL) override;
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& rArguments) override;
+
+ /** Use this class instead of calling lock() and unlock() directly in
+ order to be exception safe.
+ */
+ class Lock
+ {
+ public:
+ Lock (const css::uno::Reference<
+ css::drawing::framework::XConfigurationController>& rxController);
+ ~Lock();
+ private:
+ css::uno::Reference<
+ css::drawing::framework::XConfigurationController> mxController;
+ };
+
+private:
+ class Implementation;
+ std::unique_ptr<Implementation> mpImplementation;
+ bool mbIsDisposed;
+
+ /** When the called object has already been disposed this method throws
+ an exception and does not return.
+
+ @throws css::lang::DisposedException
+ @throws css::uno::RuntimeException
+ */
+ void ThrowIfDisposed () const;
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/DrawModule.hxx b/sd/source/ui/inc/framework/DrawModule.hxx
new file mode 100644
index 000000000..79a59b4f9
--- /dev/null
+++ b/sd/source/ui/inc/framework/DrawModule.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace com::sun::star::frame
+{
+class XController;
+}
+namespace com::sun::star::uno
+{
+template <typename> class Reference;
+}
+
+namespace sd::framework
+{
+/** The task of this module is to instantiate all modules that belong to the
+ Draw application.
+*/
+class DrawModule
+{
+public:
+ static void Initialize(css::uno::Reference<css::frame::XController> const& rxController);
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
new file mode 100644
index 000000000..c9bf981bb
--- /dev/null
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <ViewShell.hxx>
+
+#include <tools/SdGlobalResourceContainer.hxx>
+
+#include <functional>
+#include <map>
+#include <memory>
+
+namespace com::sun::star::drawing::framework { class XConfigurationController; }
+namespace com::sun::star::drawing::framework { class XResourceId; }
+namespace com::sun::star::drawing::framework { class XView; }
+namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; }
+
+namespace sd {
+class ViewShellBase;
+}
+
+
+namespace sd::framework {
+
+/** The FrameworkHelper is a convenience class that simplifies the
+ access to the drawing framework.
+ It has three main tasks:
+ 1. Provide frequently used strings of resource URLs and event names.
+ 2. Provide shortcuts for accessing the sd framework.
+ 3. Ease the migration to the drawing framework.
+
+ Note that a FrameworkHelper disposes itself when one of the resource
+ controllers called by it throws a DisposedException.
+*/
+class FrameworkHelper
+ : public std::enable_shared_from_this<FrameworkHelper>,
+ public SdGlobalResource
+{
+public:
+ // URLs of frequently used panes.
+ static constexpr OUStringLiteral msPaneURLPrefix = u"private:resource/pane/";
+ static const OUString msCenterPaneURL;
+ static const OUString msFullScreenPaneURL;
+ static const OUString msLeftImpressPaneURL;
+ static const OUString msLeftDrawPaneURL;
+
+ // URLs of frequently used views.
+ static constexpr OUStringLiteral msViewURLPrefix = u"private:resource/view/";
+ static const OUString msImpressViewURL;
+ static const OUString msDrawViewURL;
+ static const OUString msOutlineViewURL;
+ static const OUString msNotesViewURL;
+ static const OUString msHandoutViewURL;
+ static const OUString msSlideSorterURL;
+ static const OUString msPresentationViewURL;
+ static const OUString msSidebarViewURL;
+
+ // URLs of frequently used tool bars.
+ static constexpr OUStringLiteral msToolBarURLPrefix = u"private:resource/toolbar/";
+ static const OUString msViewTabBarURL;
+
+ // Names of frequently used events.
+ static constexpr OUStringLiteral msResourceActivationRequestEvent
+ = u"ResourceActivationRequested";
+ static constexpr OUStringLiteral msResourceDeactivationRequestEvent
+ = u"ResourceDeactivationRequest";
+ static constexpr OUStringLiteral msResourceActivationEvent = u"ResourceActivation";
+ static constexpr OUStringLiteral msResourceDeactivationEvent = u"ResourceDeactivation";
+ static constexpr OUStringLiteral msResourceDeactivationEndEvent = u"ResourceDeactivationEnd";
+ static constexpr OUStringLiteral msConfigurationUpdateStartEvent = u"ConfigurationUpdateStart";
+ static constexpr OUStringLiteral msConfigurationUpdateEndEvent = u"ConfigurationUpdateEnd";
+
+ /** Return the FrameworkHelper object that is associated with the given
+ ViewShellBase. If such an object does not yet exist, a new one is
+ created.
+ */
+ static ::std::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase);
+
+ /** Mark the FrameworkHelper object for the given ViewShellBase as
+ disposed. A following ReleaseInstance() call will destroy the
+ FrameworkHelper object.
+
+ Do not call this method. It is an internally used method that can
+ not be made private.
+ */
+ static void DisposeInstance (const ViewShellBase& rBase);
+
+ /** Destroy the FrameworkHelper object for the given ViewShellBase.
+
+ Do not call this method. It is an internally used method that can
+ not be made private.
+ */
+ static void ReleaseInstance (const ViewShellBase& rBase);
+
+ /** Return an identifier for the given view URL. This identifier can be
+ used in a switch statement. See GetViewURL() for a mapping in the
+ opposite direction.
+ */
+ static ViewShell::ShellType GetViewId (const OUString& rsViewURL);
+
+ /** Return a view URL for the given identifier. See GetViewId() for a
+ mapping in the opposite direction.
+ */
+ static OUString GetViewURL (ViewShell::ShellType eType);
+
+ /** Return a ViewShell pointer for the given XView reference. This
+ assumes that the given reference is implemented by the
+ ViewShellWrapper class that supports the XTunnel interface.
+ @return
+ When the ViewShell pointer can not be inferred from the given
+ reference then an empty pointer is returned.
+ */
+ static ::std::shared_ptr<ViewShell> GetViewShell (
+ const css::uno::Reference<css::drawing::framework::XView>& rxView);
+
+ typedef ::std::function<bool (const css::drawing::framework::ConfigurationChangeEvent&)>
+ ConfigurationChangeEventFilter;
+ typedef ::std::function<void (bool bEventSeen)> Callback;
+ typedef ::std::function<
+ void (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>&)
+ > ResourceFunctor;
+
+ /** Test whether the called FrameworkHelper object is valid.
+ @return
+ When the object has already been disposed then <FALSE/> is returned.
+ */
+ bool IsValid() const;
+
+ /** Return a pointer to the view shell that is displayed in the
+ specified pane. See GetView() for a variant that returns a
+ reference to XView instead of a ViewShell pointer.
+ @return
+ An empty pointer is returned when for example the specified pane
+ does not exist or is not visible or does not show a view or one
+ of the involved objects does not support XUnoTunnel (where
+ necessary).
+ */
+ ::std::shared_ptr<ViewShell> GetViewShell (const OUString& rsPaneURL);
+
+ /** Return a reference to the view that is displayed in the specified
+ pane. See GetViewShell () for a variant that returns a ViewShell
+ pointer instead of a reference to XView.
+ @param rxPaneOrViewId
+ When this ResourceId specifies a view then that view is
+ returned. When it belongs to a pane then one view in that pane
+ is returned.
+ @return
+ An empty reference is returned when for example the specified pane
+ does not exist or is not visible or does not show a view or one
+ of the involved objects does not support XTunnel (where
+ necessary).
+ */
+ css::uno::Reference<css::drawing::framework::XView> GetView (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneOrViewId);
+
+ /** Request the specified view to be displayed in the specified pane.
+ When the pane is not visible its creation is also requested. The
+ update that creates the actual view object is done asynchronously.
+ @param rsResourceURL
+ The resource URL of the view to show.
+ @param rsAnchorURL
+ The URL of the pane in which to show the view.
+ @return
+ The resource id of the requested view is returned. With that
+ the caller can, for example, call RunOnResourceActivation() to
+ do some initialization after the requested view becomes active.
+ */
+ css::uno::Reference<css::drawing::framework::XResourceId> RequestView (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL);
+
+ /** Process a slot call that requests a view shell change.
+ */
+ void HandleModeChangeSlot (
+ sal_uInt16 nSlotId,
+ SfxRequest const & rRequest);
+
+ /** Run the given callback when the specified event is notified by the
+ ConfigurationManager. When there are no pending requests and
+ therefore no events would be notified (in the foreseeable future)
+ then the callback is called immediately.
+ The callback is called with a flag that tells the callback whether
+ the event it waits for has been sent.
+ */
+ void RunOnConfigurationEvent(
+ const OUString& rsEventType,
+ const Callback& rCallback);
+
+ /** Run the given callback when the specified resource has been
+ activated. When the resource is active already when this method is
+ called then rCallback is called before this method returns.
+ @param rxResourceId
+ Wait for the activation of this resource before calling
+ rCallback.
+ @param rCallback
+ The callback to be called when the resource is activated.
+
+ */
+ void RunOnResourceActivation(
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const Callback& rCallback);
+
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate();
+
+ /** Block until the specified event is notified by the configuration
+ controller. When the configuration controller is not processing any
+ requests the method returns immediately.
+ */
+ void WaitForEvent (const OUString& rsEventName) const;
+
+ /** This is a short cut for WaitForEvent(msConfigurationUpdateEndEvent).
+ Call this method to execute the pending requests.
+ */
+ void WaitForUpdate() const;
+
+ /** Explicit request for an update of the current configuration. Call
+ this method when one of the resources managed by the sd framework
+ has been activated or deactivated from the outside, i.e. not by the
+ framework itself. An example for this is a click on the closer
+ button of one of the side panes.
+ */
+ void UpdateConfiguration();
+
+ /** Return a string representation of the given XResourceId object.
+ */
+ static OUString ResourceIdToString (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId);
+
+ /** Create a new XResourceId object for the given resource URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const OUString& rsResourceURL);
+
+ /** Create a new XResourceId object for the given resource URL and a
+ single anchor URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL);
+
+ /** Create a new XResourceId object for the given resource URL.
+ */
+ static css::uno::Reference<
+ css::drawing::framework::XResourceId>
+ CreateResourceId (
+ const OUString& rsResourceURL,
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxAnchor);
+
+ const css::uno::Reference<css::drawing::framework::XConfigurationController>&
+ GetConfigurationController() const { return mxConfigurationController;}
+
+private:
+ typedef ::std::map<
+ const ViewShellBase*,
+ ::std::shared_ptr<FrameworkHelper> > InstanceMap;
+ /** The instance map holds (at least) one FrameworkHelper instance for
+ every ViewShellBase object.
+ */
+ static InstanceMap maInstanceMap;
+ class ViewURLMap;
+ static ViewURLMap maViewURLMap;
+
+ ViewShellBase& mrBase;
+ css::uno::Reference<css::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+
+ class DisposeListener;
+ friend class DisposeListener;
+ css::uno::Reference<css::lang::XComponent>
+ mxDisposeListener;
+
+ FrameworkHelper (ViewShellBase& rBase);
+ FrameworkHelper (const FrameworkHelper& rHelper) = delete;
+ virtual ~FrameworkHelper() override;
+ class Deleter; friend class Deleter;
+ FrameworkHelper& operator= (const FrameworkHelper& rHelper) = delete;
+
+ void Initialize();
+
+ void Dispose();
+
+ /** Run the given callback when an event of the specified type is
+ received from the ConfigurationController or when the
+ ConfigurationController has no pending change requests.
+ @param rsEventType
+ Run rCallback only on this event.
+ @param rFilter
+ This filter has to return <TRUE/> in order for rCallback to be
+ called.
+ @param rCallback
+ The callback functor to be called.
+ */
+ void RunOnEvent(
+ const OUString& rsEventType,
+ const ConfigurationChangeEventFilter& rFilter,
+ const Callback& rCallback) const;
+
+ /** This disposing method is forwarded from the inner DisposeListener class.
+ */
+ void disposing (const css::lang::EventObject& rEventObject);
+};
+
+} // end of namespace sd::framework
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ImpressModule.hxx b/sd/source/ui/inc/framework/ImpressModule.hxx
new file mode 100644
index 000000000..da7ede9d9
--- /dev/null
+++ b/sd/source/ui/inc/framework/ImpressModule.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace com::sun::star::frame
+{
+class XController;
+}
+namespace com::sun::star::uno
+{
+template <class interface_type> class Reference;
+}
+
+namespace sd::framework
+{
+/** The task of this module is to instantiate all modules that belong to the
+ Impress application.
+*/
+class ImpressModule
+{
+public:
+ static void Initialize(css::uno::Reference<css::frame::XController> const& rxController);
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx
new file mode 100644
index 000000000..4efc6cc15
--- /dev/null
+++ b/sd/source/ui/inc/framework/ModuleController.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XModuleController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/compbase.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include <unordered_map>
+
+namespace com::sun::star::frame { class XController; }
+namespace com::sun::star::uno { class XComponentContext; }
+
+namespace sd::framework {
+
+typedef comphelper::WeakComponentImplHelper <
+ css::drawing::framework::XModuleController,
+ css::lang::XInitialization
+ > ModuleControllerInterfaceBase;
+
+/** The ModuleController has two tasks:
+
+ 1. It reads the
+ org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
+ configuration data that maps from resource URLs to service names of
+ factories that can create resources for the URLs. When the
+ configuration controller wants to create a resource for which it does
+ not have a factory, it asks the ModuleController to provide one. The
+ ModuleController looks up the service name registered for the URL of the
+ resource and instantiates this service. The service is expected to
+ register on its creation a factory for the resource in question.
+
+ 2. The ModuleController reads on its creation
+ org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
+ configuration data and instantiates all listed services. These services
+ can then register as listeners at the ConfigurationController or do
+ whatever they like.
+*/
+class ModuleController final
+ : public ModuleControllerInterfaceBase
+{
+public:
+ static css::uno::Reference<
+ css::drawing::framework::XModuleController>
+ CreateInstance (
+ const css::uno::Reference<css::uno::XComponentContext>&
+ rxContext);
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+
+ // XModuleController
+
+ virtual void SAL_CALL requestResource(const OUString& rsResourceURL) override;
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& aArguments) override;
+
+private:
+ css::uno::Reference<
+ css::frame::XController> mxController;
+
+ std::unordered_map<OUString, OUString> maResourceToFactoryMap;
+ std::unordered_map<OUString, css::uno::WeakReference<css::uno::XInterface>> maLoadedFactories;
+
+ /// @throws std::exception
+ ModuleController (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ ModuleController (const ModuleController&) = delete;
+ virtual ~ModuleController() noexcept override;
+
+ /** Called for every entry in the ResourceFactories configuration entry.
+ */
+ void ProcessFactory (const ::std::vector<css::uno::Any>& rValues);
+
+ /** Instantiate all startup services that are found in the
+ /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
+ configuration entry. This method is called once when a new
+ ModuleController object is created.
+ */
+ void InstantiateStartupServices();
+
+ /** Called for one entry in the StartupServices configuration list this
+ method instantiates the service described by the entry. It does not
+ hold references to the new object so that the object will be
+ destroyed on function exit when it does not register itself
+ somewhere. It typically will register as
+ XConfigurationChangeListener at the configuration controller.
+ */
+ void ProcessStartupService (const ::std::vector<css::uno::Any>& rValues);
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx
new file mode 100644
index 000000000..9e8ee25a1
--- /dev/null
+++ b/sd/source/ui/inc/framework/Pane.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/drawing/framework/XPane2.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
+
+namespace sd::framework {
+
+typedef ::cppu::WeakComponentImplHelper <
+ css::drawing::framework::XPane,
+ css::drawing::framework::XPane2,
+ css::lang::XUnoTunnel
+ > PaneInterfaceBase;
+
+/** A pane is a wrapper for a window and possibly for a tab bar (for view
+ switching). Panes are unique resources.
+
+ This class has two responsibilities:
+ 1. It implements the XPane interface. This is the most important
+ interface of this class for API based views (of which there not that
+ many yet) because it gives access to the XWindow.
+ 2. It gives access to the underlying VCL Window by implementing the
+ XUnoTunnel interface. This is necessary at the moment and in the
+ foreseeable future because many parts of the Draw and Impress views rely
+ on direct access on the Window class.
+*/
+class Pane
+ : protected cppu::BaseMutex,
+ public PaneInterfaceBase
+{
+public:
+ /** Create a new Pane object that wraps the given window.
+ @param rsPaneURL
+ The URL that is used by the configuration to identify the pane.
+ The given URL has to be valid.
+ @param pWindow
+ The VCL Window (usually this really is an sd::Window) that is
+ wrapped by the new Pane object. The given pointer must not be
+ NULL.
+ */
+ Pane (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
+ vcl::Window* pWindow)
+ noexcept;
+ virtual ~Pane() override;
+
+ virtual void SAL_CALL disposing() override;
+
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+
+ /** This method is typically used together with the XUnoTunnel to obtain
+ a Window pointer from an XPane object.
+ */
+ virtual vcl::Window* GetWindow();
+
+ //----- XPane -------------------------------------------------------------
+
+ /** For a UNO API based implementation of a view this may the most
+ important method of this class because the view is only interested
+ in the window of the pane.
+ */
+ virtual css::uno::Reference<css::awt::XWindow>
+ SAL_CALL getWindow() override;
+
+ virtual css::uno::Reference<css::rendering::XCanvas>
+ SAL_CALL getCanvas() override;
+
+ //----- XPane2 -------------------------------------------------------------
+
+ virtual sal_Bool SAL_CALL isVisible() override;
+
+ virtual void SAL_CALL setVisible (sal_Bool bIsVisible) override;
+
+ virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible() override;
+
+ virtual void SAL_CALL setAccessible (
+ const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible) override;
+
+ //----- XResource ---------------------------------------------------------
+
+ virtual css::uno::Reference<css::drawing::framework::XResourceId>
+ SAL_CALL getResourceId() override;
+
+ /** For the typical pane it makes no sense to be displayed without a
+ view. Therefore this default implementation returns always <TRUE/>.
+ */
+ virtual sal_Bool SAL_CALL isAnchorOnly() override;
+
+ //----- XUnoTunnel --------------------------------------------------------
+
+ virtual sal_Int64 SAL_CALL getSomething (const css::uno::Sequence<sal_Int8>& rId) override;
+
+protected:
+ css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
+ VclPtr<vcl::Window> mpWindow;
+ css::uno::Reference<css::awt::XWindow> mxWindow;
+ css::uno::Reference<css::rendering::XCanvas> mxCanvas;
+
+ /** Override this method, not getCanvas(), when you want to provide a
+ different canvas.
+
+ @throws css::uno::RuntimeException
+ */
+ virtual css::uno::Reference<css::rendering::XCanvas>
+ CreateCanvas();
+
+ /** Throw DisposedException when the object has already been disposed or
+ is currently being disposed. Otherwise this method returns
+ normally.
+
+ @throws css::lang::DisposedException
+ */
+ void ThrowIfDisposed() const;
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx
new file mode 100644
index 000000000..897825c8a
--- /dev/null
+++ b/sd/source/ui/inc/framework/PresentationFactory.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
+#include <comphelper/compbase.hxx>
+
+namespace com::sun::star::frame { class XController; }
+
+namespace sd::framework {
+
+typedef comphelper::WeakComponentImplHelper <
+ css::drawing::framework::XResourceFactory,
+ css::drawing::framework::XConfigurationChangeListener
+ > PresentationFactoryInterfaceBase;
+
+/** This factory creates a marker view whose existence in a configuration
+ indicates that a slideshow is running (in another but associated
+ application window).
+*/
+class PresentationFactory final
+ : public PresentationFactoryInterfaceBase
+{
+public:
+ PresentationFactory (
+ const css::uno::Reference<css::frame::XController>& rxController);
+ virtual ~PresentationFactory() override;
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxViewId) override;
+
+ virtual void SAL_CALL releaseResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& xView) override;
+
+ // XConfigurationChangeListener
+
+ virtual void SAL_CALL notifyConfigurationChange (
+ const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
+
+ // lang::XEventListener
+
+ using WeakComponentImplHelperBase::disposing;
+ virtual void SAL_CALL disposing (
+ const css::lang::EventObject& rEventObject) override;
+
+private:
+ css::uno::Reference<css::frame::XController> mxController;
+
+ /// @throws css::lang::DisposedException
+ void ThrowIfDisposed() const;
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/PresentationModule.hxx b/sd/source/ui/inc/framework/PresentationModule.hxx
new file mode 100644
index 000000000..f6dcfbc69
--- /dev/null
+++ b/sd/source/ui/inc/framework/PresentationModule.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace com::sun::star::frame
+{
+class XController;
+}
+namespace com::sun::star::uno
+{
+template <class interface_type> class Reference;
+}
+
+namespace sd::framework
+{
+/** The task of this module is to instantiate all modules that belong to the
+ fullscreen presentation.
+*/
+class PresentationModule
+{
+public:
+ static void Initialize(css::uno::Reference<css::frame::XController> const& rxController);
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ResourceId.hxx b/sd/source/ui/inc/framework/ResourceId.hxx
new file mode 100644
index 000000000..98b456c76
--- /dev/null
+++ b/sd/source/ui/inc/framework/ResourceId.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase.hxx>
+
+#include <memory>
+
+namespace com::sun::star::util { class XURLTransformer; }
+namespace com::sun::star::uno { template <class interface_type> class WeakReference; }
+
+namespace sd::framework {
+
+typedef ::cppu::WeakImplHelper <
+ css::drawing::framework::XResourceId,
+ css::lang::XInitialization,
+ css::lang::XServiceInfo
+ > ResourceIdInterfaceBase;
+
+/** Implementation of the css::drawing::framework::ResourceId
+ service and the css::drawing::framework::XResourceId
+ interface.
+*/
+class ResourceId
+ : public ResourceIdInterfaceBase
+{
+public:
+ /** Create a new, empty resource id.
+ */
+ ResourceId();
+
+ /** Create a new resource id that is described by the given URLs.
+ @param rsResourceURLs
+ The first URL specifies the type of resource. The other URLs
+ describe its anchor.
+ The set of URLs may be empty. The result is then the same as
+ returned by ResourceId() default constructor.
+ */
+ ResourceId (std::vector<OUString>&& rsResourceURLs);
+
+ /** Create a new resource id that has an empty anchor.
+ @param rsResourceURL
+ When this resource URL is empty then the resulting ResourceId
+ object is identical to when the ResourceId() default constructor
+ had been called.
+ */
+ ResourceId (
+ const OUString& rsResourceURL);
+
+ /** Create a new resource id for the given resource type and an anchor
+ that is specified by a single URL. This constructor can be used for
+ example for views that are bound to panes.
+ @param rsResourceURL
+ The URL of the actual resource.
+ @param rsAnchorURL
+ The single URL of the anchor.
+ */
+ ResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsAnchorURL);
+
+ /** Create a new resource id with an anchor that consists of a sequence
+ of URLs that is extended by a further URL.
+ @param rsResourceURL
+ The URL of the actual resource.
+ @param rsFirstAnchorURL
+ This URL extends the anchor given by rAnchorURLs.
+ @param rAnchorURLs
+ An anchor as it is returned by XResourceId::getAnchorURLs().
+ */
+ ResourceId (
+ const OUString& rsResourceURL,
+ const OUString& rsFirstAnchorURL,
+ const css::uno::Sequence<OUString>& rAnchorURLs);
+
+ virtual ~ResourceId() override;
+
+ //===== XResourceId =======================================================
+
+ virtual OUString SAL_CALL
+ getResourceURL() override;
+
+ virtual css::util::URL SAL_CALL
+ getFullResourceURL() override;
+
+ virtual sal_Bool SAL_CALL
+ hasAnchor() override;
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XResourceId> SAL_CALL
+ getAnchor() override;
+
+ virtual css::uno::Sequence<OUString> SAL_CALL
+ getAnchorURLs() override;
+
+ virtual OUString SAL_CALL
+ getResourceTypePrefix() override;
+
+ virtual sal_Int16 SAL_CALL
+ compareTo (const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId) override;
+
+ virtual sal_Bool SAL_CALL
+ isBoundTo (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourceId,
+ css::drawing::framework::AnchorBindingMode eMode) override;
+
+ virtual sal_Bool SAL_CALL
+ isBoundToURL (
+ const OUString& rsAnchorURL,
+ css::drawing::framework::AnchorBindingMode eMode) override;
+
+ virtual css::uno::Reference<
+ css::drawing::framework::XResourceId> SAL_CALL
+ clone() override;
+
+ //===== XInitialization ===================================================
+
+ void SAL_CALL initialize (
+ const css::uno::Sequence<css::uno::Any>& aArguments) override;
+
+ OUString SAL_CALL getImplementationName() override;
+
+ sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
+
+ css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+private:
+ /** The set of URLs that consist of the resource URL at index 0 and the
+ anchor URLs and indices 1 and above.
+ */
+ std::vector<OUString> maResourceURLs;
+
+ std::unique_ptr<css::util::URL> mpURL;
+
+ static css::uno::WeakReference<css::util::XURLTransformer> mxURLTransformerWeak;
+
+ /** Compare the called ResourceId object to the given ResourceId object.
+ This uses the implementation of both objects to speed up the
+ comparison.
+ */
+ sal_Int16 CompareToLocalImplementation (const ResourceId& rId) const;
+
+ /** Compare the called ResourceId object to the given XResourceId object
+ reference. The comparison is done via the UNO interface. Namely,
+ it uses the getResourceURL() and the getAnchorURLs() methods to get
+ access to the URLs of the given object.
+ */
+ sal_Int16 CompareToExternalImplementation (const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxId) const;
+
+ /** Return whether the called ResourceId object is bound to the anchor
+ consisting of the URLs given by psFirstAnchorURL and paAnchorURLs.
+ @param psFirstAnchorURL
+ Optional first URL of the anchor. This can be missing or present
+ independently of paAnchorURLs.
+ @param paAnchorURLs
+ Optional set of additional anchor URLs. This can be missing or
+ present independently of psFirstAnchorURL.
+ @param eMode
+ This specifies whether the called resource has to be directly
+ bound to the given anchor in order to return <TRUE/> or whether
+ it can be bound indirectly, too.
+ */
+ bool IsBoundToAnchor (
+ const OUString* psFirstAnchorURL,
+ const css::uno::Sequence<OUString>* paAnchorURLs,
+ css::drawing::framework::AnchorBindingMode eMode) const;
+
+ /** Return whether the called ResourceId object is bound to the anchor
+ consisting of the URLs in rResourceURLs.
+ @param rResourceURLs
+ A possibly empty list of anchor URLs.
+ @param eMode
+ This specifies whether the called resource has to be directly
+ bound to the given anchor in order to return <TRUE/> or whether
+ it can be bound indirectly, too.
+ */
+ bool IsBoundToAnchor (
+ const ::std::vector<OUString>& rResourceURLs,
+ css::drawing::framework::AnchorBindingMode eMode) const;
+
+ void ParseResourceURL();
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
new file mode 100644
index 000000000..43dca4d67
--- /dev/null
+++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/drawing/framework/XRelocatableResource.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/compbase.hxx>
+
+#include <memory>
+
+namespace sd { class ViewShell; }
+namespace sd::slidesorter { class SlideSorterViewShell; }
+namespace com::sun::star::awt { class XWindow; }
+
+namespace sd::framework {
+
+typedef comphelper::WeakComponentImplHelper < css::lang::XUnoTunnel
+ , css::awt::XWindowListener
+ , css::view::XSelectionSupplier
+ , css::drawing::framework::XRelocatableResource
+ , css::drawing::framework::XView
+ > ViewShellWrapperInterfaceBase;
+
+/** This class wraps ViewShell objects and makes them look like an XView.
+ Most importantly it provides a tunnel to the ViewShell implementation.
+ Then it forwards size changes of the pane window to the view shell.
+*/
+class ViewShellWrapper final : public ViewShellWrapperInterfaceBase
+{
+public:
+ /** Create a new ViewShellWrapper object that wraps the given ViewShell
+ object.
+ @param pViewShell
+ The ViewShell object to wrap.
+ @param rsViewURL
+ URL of the view type of the wrapped view shell.
+ @param rxWindow
+ This window reference is optional. When a valid reference is
+ given then size changes of the referenced window are forwarded
+ to the ViewShell object.
+ */
+ ViewShellWrapper (
+ const ::std::shared_ptr<ViewShell>& pViewShell,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ const css::uno::Reference<css::awt::XWindow>& rxWindow);
+ virtual ~ViewShellWrapper() override;
+
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+
+ static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
+
+ /** This method is typically used together with the XUnoTunnel interface
+ to obtain a pointer to the wrapped ViewShell object for a given
+ XView object.
+ */
+ const ::std::shared_ptr<ViewShell>& GetViewShell() const { return mpViewShell;}
+
+ // XUnoTunnel
+
+ virtual sal_Int64 SAL_CALL getSomething (const css::uno::Sequence<sal_Int8>& rId) override;
+
+ // XResource
+
+ virtual css::uno::Reference<css::drawing::framework::XResourceId>
+ SAL_CALL getResourceId() override;
+
+ virtual sal_Bool SAL_CALL isAnchorOnly() override;
+
+ // XSelectionSupplier
+
+ virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
+ virtual css::uno::Any SAL_CALL getSelection() override;
+ virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
+
+ // XRelocatableResource
+
+ virtual sal_Bool SAL_CALL relocateToAnchor (
+ const css::uno::Reference<
+ css::drawing::framework::XResource>& xResource) override;
+
+ // XWindowListener
+
+ virtual void SAL_CALL windowResized(
+ const css::awt::WindowEvent& rEvent) override;
+
+ virtual void SAL_CALL windowMoved(
+ const css::awt::WindowEvent& rEvent) override;
+
+ virtual void SAL_CALL windowShown(
+ const css::lang::EventObject& rEvent) override;
+
+ virtual void SAL_CALL windowHidden(
+ const css::lang::EventObject& rEvent) override;
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing(
+ const css::lang::EventObject& rEvent) override;
+
+private:
+ ::std::shared_ptr< ViewShell > mpViewShell;
+ ::std::shared_ptr< ::sd::slidesorter::SlideSorterViewShell > mpSlideSorterViewShell;
+ const css::uno::Reference< css::drawing::framework::XResourceId > mxViewId;
+ css::uno::Reference<css::awt::XWindow > mxWindow;
+};
+
+} // end of namespace sd::framework
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */