diff options
Diffstat (limited to 'sd/source/ui/inc/framework')
-rw-r--r-- | sd/source/ui/inc/framework/Configuration.hxx | 207 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ConfigurationController.hxx | 231 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/DrawModule.hxx | 48 | ||||
-rwxr-xr-x | sd/source/ui/inc/framework/FrameworkHelper.hxx | 421 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ImpressModule.hxx | 47 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ModuleController.hxx | 148 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/Pane.hxx | 175 | ||||
-rwxr-xr-x | sd/source/ui/inc/framework/PresentationFactory.hxx | 116 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/PresentationModule.hxx | 47 | ||||
-rwxr-xr-x | sd/source/ui/inc/framework/ResourceId.hxx | 244 | ||||
-rwxr-xr-x | sd/source/ui/inc/framework/ViewShellWrapper.hxx | 148 |
11 files changed, 1832 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 000000000000..57a6c838feab --- /dev/null +++ b/sd/source/ui/inc/framework/Configuration.hxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_CONFIGURATION_CONFIGURATION_HXX +#define SD_FRAMEWORK_CONFIGURATION_CONFIGURATION_HXX + +#include "MutexOwner.hxx" +#include <com/sun/star/drawing/framework/XConfiguration.hpp> +#include <com/sun/star/drawing/framework/XConfigurationControllerBroadcaster.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <cppuhelper/compbase2.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace { + +typedef ::cppu::WeakComponentImplHelper2 < + ::com::sun::star::drawing::framework::XConfiguration, + ::com::sun::star::container::XNamed + > ConfigurationInterfaceBase; + +} // end of anonymous namespace. + + + + +namespace sd { namespace framework { + +/** 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 unambigously 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 + : private sd::MutexOwner, + 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 ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster>& rxBroadcaster, + bool bBroadcastRequestEvents); + virtual ~Configuration (void); + + virtual void SAL_CALL disposing (void); + + + // XConfiguration + + virtual void SAL_CALL addResource ( + const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>& + rxResourceId) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeResource( + const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>& + rxResourceId) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< com::sun::star::uno::Reference< + com::sun::star::drawing::framework::XResourceId> > SAL_CALL getResources ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::framework::XResourceId>& rxAnchorId, + const ::rtl::OUString& rsResourceURLPrefix, + ::com::sun::star::drawing::framework::AnchorBindingMode eMode) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasResource ( + const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>& + rxResourceId) + throw (::com::sun::star::uno::RuntimeException); + + + // XCloneable + + virtual ::com::sun::star::uno::Reference<com::sun::star::util::XCloneable> + SAL_CALL createClone (void) + throw (::com::sun::star::uno::RuntimeException); + + + // XNamed + + /** Return a human readable string representation. This is used for + debugging purposes. + */ + virtual ::rtl::OUString SAL_CALL getName (void) + throw (::com::sun::star::uno::RuntimeException); + + /** 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 ::rtl::OUString& rName) + throw (::com::sun::star::uno::RuntimeException); + +private: + class ResourceContainer; + /** The resource container holds the URLs of unique resource and of + resource linked to unique resources. + */ + ::boost::scoped_ptr<ResourceContainer> mpResourceContainer; + + /** The broadcaster used for notifying listeners of requests for + configuration changes. + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::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 ::com::sun::star::uno::Reference< + ::com::sun::star::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 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>& + rxResourceId, + const bool bActivation); + + /** When the called object has already been disposed this method throws + an exception and does not return. + */ + void ThrowIfDisposed (void) const + throw (::com::sun::star::lang::DisposedException); +}; + + +/** 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 ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration1, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::framework::XConfiguration>& rxConfiguration2); + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx new file mode 100644 index 000000000000..d5e8dda059d2 --- /dev/null +++ b/sd/source/ui/inc/framework/ConfigurationController.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX +#define SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX + +#include "MutexOwner.hxx" + +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp> +#include <com/sun/star/drawing/framework/XConfiguration.hpp> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp> +#include <com/sun/star/drawing/framework/XResourceId.hpp> +#include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <cppuhelper/compbase2.hxx> +#include <tools/link.hxx> +#include <rtl/ref.hxx> + +#include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/noncopyable.hpp> + +namespace css = ::com::sun::star; + +namespace { + +typedef ::cppu::WeakComponentImplHelper2 < + ::css::drawing::framework::XConfigurationController, + ::css::lang::XInitialization + > ConfigurationControllerInterfaceBase; + +} // end of anonymous namespace. + + +namespace sd { class ViewShellBase; } + + +namespace sd { namespace framework { + +class ChangeRequestQueueProcessor; +class ConfigurationControllerBroadcaster; +class ConfigurationUpdater; +class ConfigurationUpdaterLock; + +/** The configuration controller is responsible for maintaining the current + configuration. + + @see css::drawing::framework::XConfigurationController + for an extended documentation. +*/ +class ConfigurationController + : private sd::MutexOwner, + private boost::noncopyable, + public ConfigurationControllerInterfaceBase +{ +public: + ConfigurationController (void) throw(); + virtual ~ConfigurationController (void) throw(); + + virtual void SAL_CALL disposing (void); + + void ProcessEvent (void); + + /** 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 (void); + + // XConfigurationController + + virtual void SAL_CALL lock (void) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL unlock (void) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL requestResourceActivation ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + css::drawing::framework::ResourceActivationMode eMode) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL requestResourceDeactivation ( + const css::uno::Reference<css::drawing::framework::XResourceId>& + rxResourceId) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL getResource ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL update (void) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference< + css::drawing::framework::XConfiguration> + SAL_CALL getRequestedConfiguration (void) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference< + css::drawing::framework::XConfiguration> + SAL_CALL getCurrentConfiguration (void) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL restoreConfiguration ( + const css::uno::Reference<css::drawing::framework::XConfiguration>& + rxConfiguration) + throw (css::uno::RuntimeException); + + + // XConfigurationControllerBroadcaster + + virtual void SAL_CALL addConfigurationChangeListener ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeListener>& rxListener, + const ::rtl::OUString& rsEventType, + const css::uno::Any& rUserData) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL removeConfigurationChangeListener ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeListener>& rxListener) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL notifyEvent ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) + throw (css::uno::RuntimeException); + + + // XConfigurationRequestQueue + + virtual sal_Bool SAL_CALL hasPendingRequests (void) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL postChangeRequest ( + const css::uno::Reference< + css::drawing::framework::XConfigurationChangeRequest>& rxRequest) + throw (css::uno::RuntimeException); + + + // XResourceFactoryManager + + virtual void SAL_CALL addResourceFactory( + const ::rtl::OUString& sResourceURL, + const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL removeResourceFactoryForURL( + const ::rtl::OUString& sResourceURL) + throw (css::uno::RuntimeException); + + virtual void SAL_CALL removeResourceFactoryForReference( + const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference<css::drawing::framework::XResourceFactory> + SAL_CALL getResourceFactory ( + const ::rtl::OUString& sResourceURL) + throw (css::uno::RuntimeException); + + + // XInitialization + + virtual void SAL_CALL initialize( + const css::uno::Sequence<css::uno::Any>& rArguments) + throw (css::uno::Exception, css::uno::RuntimeException); + + + /** 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 (void); + private: + css::uno::Reference< + css::drawing::framework::XConfigurationController> mxController; + }; + +private: + class Implementation; + ::boost::scoped_ptr<Implementation> mpImplementation; + bool mbIsDisposed; + + /** When the called object has already been disposed this method throws + an exception and does not return. + */ + void ThrowIfDisposed (void) const + throw (css::lang::DisposedException); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/DrawModule.hxx b/sd/source/ui/inc/framework/DrawModule.hxx new file mode 100644 index 000000000000..08fd339df77a --- /dev/null +++ b/sd/source/ui/inc/framework/DrawModule.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_DRAW_MODULE_HXX +#define SD_FRAMEWORK_DRAW_MODULE_HXX + +#include <com/sun/star/frame/XController.hpp> + + +namespace sd { namespace framework { + +/** The task of this module is to instantiate all modules that belong to the + Draw application. +*/ +class DrawModule +{ +public: + static void Initialize ( + ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx new file mode 100755 index 000000000000..58c663449bbc --- /dev/null +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -0,0 +1,421 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_FRAMEWORK_HELPER_HXX +#define SD_FRAMEWORK_FRAMEWORK_HELPER_HXX + +#include "ViewShell.hxx" + +#include "tools/SdGlobalResourceContainer.hxx" + +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/drawing/framework/XView.hpp> +#include <com/sun/star/lang/XEventListener.hpp> + +#include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> +#include <boost/function.hpp> +#include <map> + +namespace sd { +class ViewShell; +class ViewShellBase; +} + +namespace rtl { +class OUString; +} + +namespace css = ::com::sun::star; + +namespace sd { namespace 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. Easy the migration to the drawing framwork. + + Note that a FrameworkHelper disposes itself when one of the resource + controllers called by it throw a DisposedException. +*/ +class FrameworkHelper + : public ::boost::enable_shared_from_this<FrameworkHelper>, + public SdGlobalResource +{ +public: + // URLs of frequently used panes. + static const ::rtl::OUString msPaneURLPrefix; + static const ::rtl::OUString msCenterPaneURL; + static const ::rtl::OUString msFullScreenPaneURL; + static const ::rtl::OUString msLeftImpressPaneURL; + static const ::rtl::OUString msLeftDrawPaneURL; + static const ::rtl::OUString msRightPaneURL; + + // URLs of frequently used views. + static const ::rtl::OUString msViewURLPrefix; + static const ::rtl::OUString msImpressViewURL; + static const ::rtl::OUString msDrawViewURL; + static const ::rtl::OUString msOutlineViewURL; + static const ::rtl::OUString msNotesViewURL; + static const ::rtl::OUString msHandoutViewURL; + static const ::rtl::OUString msSlideSorterURL; + static const ::rtl::OUString msPresentationViewURL; + static const ::rtl::OUString msTaskPaneURL; + + // URLs of frequently used tool bars. + static const ::rtl::OUString msToolBarURLPrefix; + static const ::rtl::OUString msViewTabBarURL; + + // URLs of task panels. + static const ::rtl::OUString msTaskPanelURLPrefix; + static const ::rtl::OUString msMasterPagesTaskPanelURL; + static const ::rtl::OUString msLayoutTaskPanelURL; + static const ::rtl::OUString msTableDesignPanelURL; + static const ::rtl::OUString msCustomAnimationTaskPanelURL; + static const ::rtl::OUString msSlideTransitionTaskPanelURL; + + // Names of frequently used events. + static const ::rtl::OUString msResourceActivationRequestEvent; + static const ::rtl::OUString msResourceDeactivationRequestEvent; + static const ::rtl::OUString msResourceActivationEvent; + static const ::rtl::OUString msResourceDeactivationEvent; + static const ::rtl::OUString msConfigurationUpdateStartEvent; + static const ::rtl::OUString msConfigurationUpdateEndEvent; + + // Service names of the common controllers. + static const ::rtl::OUString msModuleControllerService; + static const ::rtl::OUString msConfigurationControllerService; + + /** 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 ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase); + + static ::boost::shared_ptr<FrameworkHelper> Instance ( + const css::uno::Reference<css::frame::XController>& rxController); + + /** 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 (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 (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 rtl::OUString& rsViewURL); + + /** Return a view URL for the given identifier. See GetViewId() for a + mapping in the opposite direction. + */ + static ::rtl::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 ::boost::shared_ptr<ViewShell> GetViewShell ( + const css::uno::Reference<css::drawing::framework::XView>& rxView); + + ~FrameworkHelper (void); + + typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)> + ConfigurationChangeEventFilter; + typedef ::boost::function<void(bool bEventSeen)> Callback; + typedef ::boost::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 (void); + + /** 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). + */ + ::boost::shared_ptr<ViewShell> GetViewShell (const ::rtl::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 ::rtl::OUString& rsResourceURL, + const ::rtl::OUString& rsAnchorURL); + + /** Request the activation of the specified task panel in the standard + task pane. + */ + void RequestTaskPanel ( + const ::rtl::OUString& rsTaskPanelURL); + + /** Process a slot call that requests a view shell change. + */ + void HandleModeChangeSlot ( + ULONG nSlotId, + SfxRequest& 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 ::rtl::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 (void); + + /** 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 ::rtl::OUString& rsEventName) const; + + /** This is a short cut for WaitForEvent(msConfigurationUpdateEndEvent). + Call this method to execute the pending requests. + */ + void WaitForUpdate (void) 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 (void); + + /** Return a string representation of the given XResourceId object. + */ + static ::rtl::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 ::rtl::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 ::rtl::OUString& rsResourceURL, + const ::rtl::OUString& rsAnchorURL); + + /** Create a new XResourceId object for the given resource URL and the + two given anchor URLs. + */ + static css::uno::Reference< + css::drawing::framework::XResourceId> + CreateResourceId ( + const ::rtl::OUString& rsResourceURL, + const ::rtl::OUString& rsFirstAnchorURL, + const ::rtl::OUString& rsSecondAnchorURL); + + /** Create a new XResourceId object for the given resource URL. + */ + static css::uno::Reference< + css::drawing::framework::XResourceId> + CreateResourceId ( + const ::rtl::OUString& rsResourceURL, + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxAnchor); + + css::uno::Reference<css::drawing::framework::XConfigurationController> + GetConfigurationController (void) const; + + +private: + typedef ::std::map< + ViewShellBase*, + ::boost::shared_ptr<FrameworkHelper> > InstanceMap; + /** The instance map holds (at least) one FrameworkHelper instance for + every ViewShellBase object. + */ + static InstanceMap maInstanceMap; + class ViewURLMap; + static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap; + + 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); // Not implemented. + FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented. + + void Initialize (void); + + void Dispose (void); + + /** 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 ::rtl::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 + + + +namespace sd { namespace framework { + +namespace { + + class FrameworkHelperAllPassFilter + { + public: + bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; } + }; + + + class FrameworkHelperResourceIdFilter + { + public: + FrameworkHelperResourceIdFilter ( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId); + bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent) + { return mxResourceId.is() && rEvent.ResourceId.is() + && mxResourceId->compareTo(rEvent.ResourceId) == 0; } + private: + css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId; + }; + +} // end of anonymous namespace + + + + +} } // end of namespace sd::framework + + +#endif diff --git a/sd/source/ui/inc/framework/ImpressModule.hxx b/sd/source/ui/inc/framework/ImpressModule.hxx new file mode 100644 index 000000000000..f5b309760c4a --- /dev/null +++ b/sd/source/ui/inc/framework/ImpressModule.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_IMPRESS_MODULE_HXX +#define SD_FRAMEWORK_IMPRESS_MODULE_HXX + +#include <com/sun/star/frame/XController.hpp> + +namespace sd { namespace framework { + +/** The task of this module is to instantiate all modules that belong to the + Impress application. +*/ +class ImpressModule +{ +public: + static void Initialize ( + ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx new file mode 100644 index 000000000000..4e9517500abc --- /dev/null +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_MODULE_CONTROLLER_HXX +#define SD_FRAMEWORK_MODULE_CONTROLLER_HXX + +#include "MutexOwner.hxx" + +#include <osl/mutex.hxx> +#include <com/sun/star/drawing/framework/XModuleController.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <cppuhelper/compbase2.hxx> + +#include <boost/scoped_ptr.hpp> +#include <set> + +namespace css = ::com::sun::star; + +namespace { + +typedef ::cppu::WeakComponentImplHelper2 < + css::drawing::framework::XModuleController, + css::lang::XInitialization + > ModuleControllerInterfaceBase; + +} // end of anonymous namespace. + + + +namespace sd { namespace framework { + +/** The ModuleController has to 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 servces + can then register as listeners at the ConfigurationController or do + whatever they like. +*/ +class ModuleController + : private sd::MutexOwner, + public ModuleControllerInterfaceBase +{ +public: + static css::uno::Reference< + css::drawing::framework::XModuleController> + CreateInstance ( + const css::uno::Reference<css::uno::XComponentContext>& + rxContext); + + virtual void SAL_CALL disposing (void); + + + // XModuleController + + virtual void SAL_CALL requestResource(const ::rtl::OUString& rsResourceURL) + throw (css::uno::RuntimeException); + + + // XInitialization + + virtual void SAL_CALL initialize( + const css::uno::Sequence<css::uno::Any>& aArguments) + throw (css::uno::Exception, css::uno::RuntimeException); + +private: + css::uno::Reference< + css::frame::XController> mxController; + + class ResourceToFactoryMap; + ::boost::scoped_ptr<ResourceToFactoryMap> mpResourceToFactoryMap; + class LoadedFactoryContainer; + ::boost::scoped_ptr<LoadedFactoryContainer> mpLoadedFactories; + + ModuleController ( + const css::uno::Reference<css::uno::XComponentContext>& rxContext) + throw(); + ModuleController (void); // Not implemented. + ModuleController (const ModuleController&); // Not implemented. + virtual ~ModuleController (void) throw(); + + /** Load a list of URL to service mappings from the + /org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories + configuration entry. The mappings are stored in the + mpResourceToFactoryMap member. + */ + void LoadFactories (const css::uno::Reference<css::uno::XComponentContext>& rxContext); + + /** 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 (void); + + /** 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 + +#endif diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx new file mode 100644 index 000000000000..f12f0ca118f0 --- /dev/null +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_PANE_HXX +#define SD_FRAMEWORK_PANE_HXX + +#include "MutexOwner.hxx" + +#include <com/sun/star/drawing/framework/XPane.hpp> +#include <com/sun/star/drawing/framework/XPane2.hpp> +#include <com/sun/star/drawing/framework/TabBarButton.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/compbase3.hxx> +#include <tools/link.hxx> +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + +class Window; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace { + +typedef ::cppu::WeakComponentImplHelper3 < + ::com::sun::star::drawing::framework::XPane, + ::com::sun::star::drawing::framework::XPane2, + ::com::sun::star::lang::XUnoTunnel + > PaneInterfaceBase; + +} // end of anonymous namespace. + +namespace sd { namespace framework { + +/** 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 MutexOwner, + public PaneInterfaceBase +{ +public: + /** Create a new Pane object that wrapps 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 ::com::sun::star::uno::Reference< + com::sun::star::drawing::framework::XResourceId>& rxPaneId, + ::Window* pWindow) + throw (); + virtual ~Pane (void) throw(); + + virtual void SAL_CALL disposing (void); + + static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void); + + /** This method is typically used together with the XUnoTunnel to obtain + a Window pointer from an XPane object. + */ + virtual ::Window* GetWindow (void); + + + //----- 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 cssu::Reference<css::awt::XWindow> + SAL_CALL getWindow (void) + throw (cssu::RuntimeException); + + virtual cssu::Reference<css::rendering::XCanvas> + SAL_CALL getCanvas (void) + throw (cssu::RuntimeException); + + + //----- XPane2 ------------------------------------------------------------- + + virtual sal_Bool SAL_CALL isVisible (void) + throw (cssu::RuntimeException); + + virtual void SAL_CALL setVisible (sal_Bool bIsVisible) + throw (cssu::RuntimeException); + + virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL getAccessible (void) + throw (cssu::RuntimeException); + + virtual void SAL_CALL setAccessible ( + const cssu::Reference<css::accessibility::XAccessible>& rxAccessible) + throw (cssu::RuntimeException); + + + //----- XResource --------------------------------------------------------- + + virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> + SAL_CALL getResourceId (void) + throw (::com::sun::star::uno::RuntimeException); + + /** For the typical pane it makes no sense to be dislayed without a + view. Therefore this default implementation returns always <TRUE/>. + */ + virtual sal_Bool SAL_CALL isAnchorOnly (void) + throw (com::sun::star::uno::RuntimeException); + + + //----- XUnoTunnel -------------------------------------------------------- + + virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId) + throw (com::sun::star::uno::RuntimeException); + + +protected: + ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId; + ::Window* mpWindow; + ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow> mxWindow; + ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> mxCanvas; + + /** Overload this method, not getCanvas(), when you want to provide a + different canvas. + */ + virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> + CreateCanvas (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Throw DisposedException when the object has already been disposed or + is currently being disposed. Otherwise this method returns + normally. + */ + void ThrowIfDisposed (void) const + throw (::com::sun::star::lang::DisposedException); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx new file mode 100755 index 000000000000..a607542f2df0 --- /dev/null +++ b/sd/source/ui/inc/framework/PresentationFactory.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_PRESENTATION_FACTORY_HXX +#define SD_FRAMEWORK_PRESENTATION_FACTORY_HXX + +#include "MutexOwner.hxx" + +#include <com/sun/star/drawing/framework/XResourceFactory.hpp> +#include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <osl/mutex.hxx> +#include <cppuhelper/compbase2.hxx> + + +#include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> + +namespace css = ::com::sun::star; + +namespace { + +typedef ::cppu::WeakComponentImplHelper2 < + css::drawing::framework::XResourceFactory, + css::drawing::framework::XConfigurationChangeListener + > PresentationFactoryInterfaceBase; + +} // end of anonymous namespace. + + + +namespace sd { namespace framework { + +/** 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 + : private sd::MutexOwner, + public PresentationFactoryInterfaceBase +{ +public: + static const ::rtl::OUString msPresentationViewURL; + + PresentationFactory ( + const css::uno::Reference<css::frame::XController>& rxController); + virtual ~PresentationFactory (void); + + virtual void SAL_CALL disposing (void); + + + // XResourceFactory + + virtual css::uno::Reference<css::drawing::framework::XResource> + SAL_CALL createResource ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxViewId) + throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); + + virtual void SAL_CALL releaseResource ( + const css::uno::Reference<css::drawing::framework::XResource>& xView) + throw(css::uno::RuntimeException); + + + // XConfigurationChangeListener + + virtual void SAL_CALL notifyConfigurationChange ( + const css::drawing::framework::ConfigurationChangeEvent& rEvent) + throw (css::uno::RuntimeException); + + + // lang::XEventListener + + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEventObject) + throw (css::uno::RuntimeException); + +private: + css::uno::Reference<css::drawing::framework::XConfigurationController> + mxConfigurationController; + css::uno::Reference<css::frame::XController> mxController; + + void ThrowIfDisposed (void) const + throw (css::lang::DisposedException); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/PresentationModule.hxx b/sd/source/ui/inc/framework/PresentationModule.hxx new file mode 100644 index 000000000000..ac96f9c44b2e --- /dev/null +++ b/sd/source/ui/inc/framework/PresentationModule.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_PRESENTATION_MODULE_HXX +#define SD_FRAMEWORK_PRESENTATION_MODULE_HXX + +#include <com/sun/star/frame/XController.hpp> + +namespace sd { namespace framework { + +/** The task of this module is to instantiate all modules that belong to the + fullscreen presentation. +*/ +class PresentationModule +{ +public: + static void Initialize ( + ::com::sun::star::uno::Reference<com::sun::star::frame::XController>& rxController); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/ResourceId.hxx b/sd/source/ui/inc/framework/ResourceId.hxx new file mode 100755 index 000000000000..e8124e895ee6 --- /dev/null +++ b/sd/source/ui/inc/framework/ResourceId.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_RESOURCE_ID_HXX +#define SD_FRAMEWORK_RESOURCE_ID_HXX + +#include <com/sun/star/drawing/framework/XResourceId.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <cppuhelper/compbase2.hxx> +#include <boost/scoped_ptr.hpp> + +namespace css = ::com::sun::star; + + +namespace { + +typedef ::cppu::WeakImplHelper2 < + css::drawing::framework::XResourceId, + css::lang::XInitialization + > ResourceIdInterfaceBase; + +} // end of anonymous namespace. + + + + +namespace sd { namespace framework { + +/** 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 (void); + + /** 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 (const ::std::vector<rtl::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 ::rtl::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 ::rtl::OUString& rsResourceURL, + const ::rtl::OUString& rsAnchorURL); + + /** Create a new resource id for the specified resource type and the + given list of anchor URLs. + @param rsResourceURL + The URL of the actual resource. + @param rsAnchorURLs + The possibly empty list of anchor URLs. + */ + ResourceId ( + const ::rtl::OUString& rsResourceURL, + const ::std::vector<rtl::OUString>& rAnchorURLs); + + /** 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 ::rtl::OUString& rsResourceURL, + const ::rtl::OUString& rsFirstAnchorURL, + const css::uno::Sequence<rtl::OUString>& rAnchorURLs); + + virtual ~ResourceId (void); + + /** Return the list of URLs of both the resource URL and the anchor + URLs. + */ + const ::std::vector<rtl::OUString>& GetResourceURLs (void) const; + + //===== XResourceId ======================================================= + + virtual ::rtl::OUString SAL_CALL + getResourceURL (void) + throw(css::uno::RuntimeException); + + virtual css::util::URL SAL_CALL + getFullResourceURL (void) + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + hasAnchor (void) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference< + css::drawing::framework::XResourceId> SAL_CALL + getAnchor (void) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence<rtl::OUString> SAL_CALL + getAnchorURLs (void) + throw (css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL + getResourceTypePrefix (void) + throw (css::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL + compareTo (const css::uno::Reference< + css::drawing::framework::XResourceId>& rxResourceId) + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + isBoundTo ( + const css::uno::Reference< + css::drawing::framework::XResourceId>& rxResourceId, + css::drawing::framework::AnchorBindingMode eMode) + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + isBoundToURL ( + const ::rtl::OUString& rsAnchorURL, + css::drawing::framework::AnchorBindingMode eMode) + throw (css::uno::RuntimeException); + + virtual css::uno::Reference< + css::drawing::framework::XResourceId> SAL_CALL + clone (void) + throw(css::uno::RuntimeException); + + //===== XInitialization =================================================== + + void SAL_CALL initialize ( + const css::uno::Sequence<css::uno::Any>& aArguments) + throw (css::uno::RuntimeException); + +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<rtl::OUString> maResourceURLs; + + ::boost::scoped_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 objec. + */ + 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 rtl::OUString* psFirstAnchorURL, + const css::uno::Sequence<rtl::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<rtl::OUString>& rResourceURLs, + css::drawing::framework::AnchorBindingMode eMode) const; + + void ParseResourceURL (void); +}; + +} } // end of namespace sd::framework + +#endif diff --git a/sd/source/ui/inc/framework/ViewShellWrapper.hxx b/sd/source/ui/inc/framework/ViewShellWrapper.hxx new file mode 100755 index 000000000000..12483f462d5e --- /dev/null +++ b/sd/source/ui/inc/framework/ViewShellWrapper.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_FRAMEWORK_VIEW_SHELL_WRAPPER_HXX +#define SD_FRAMEWORK_VIEW_SHELL_WRAPPER_HXX + +#include "MutexOwner.hxx" +#include <com/sun/star/drawing/framework/XView.hpp> +#include <com/sun/star/drawing/framework/XRelocatableResource.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <osl/mutex.hxx> +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <boost/shared_ptr.hpp> + +namespace { + +typedef ::cppu::WeakComponentImplHelper4 < ::com::sun::star::lang::XUnoTunnel + , ::com::sun::star::awt::XWindowListener + , ::com::sun::star::drawing::framework::XRelocatableResource + , ::com::sun::star::drawing::framework::XView + > ViewShellWrapperInterfaceBase; + +} // end of anonymous namespace. + +namespace sd { class ViewShell; } + +namespace sd { namespace framework { + +/** 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 :private sd::MutexOwner + ,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 ( + ::boost::shared_ptr<ViewShell> pViewShell, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::framework::XResourceId>& rxViewId, + const ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>& rxWindow); + virtual ~ViewShellWrapper (void); + + virtual void SAL_CALL disposing (void); + + static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void); + + /** This method is typically used together with the XUnoTunnel interface + to obtain a pointer to the wrapped ViewShell object for a given + XView object. + */ + ::boost::shared_ptr<ViewShell> GetViewShell (void); + + // XUnoTunnel + + virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId) + throw (com::sun::star::uno::RuntimeException); + + // XResource + + virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> + SAL_CALL getResourceId (void) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isAnchorOnly (void) + throw (com::sun::star::uno::RuntimeException); + + + // XRelocatableResource + + virtual sal_Bool SAL_CALL relocateToAnchor ( + const ::com::sun::star::uno::Reference< + com::sun::star::drawing::framework::XResource>& xResource) + throw (com::sun::star::uno::RuntimeException); + + + // XWindowListener + + virtual void SAL_CALL windowResized( + const ::com::sun::star::awt::WindowEvent& rEvent) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL windowMoved( + const ::com::sun::star::awt::WindowEvent& rEvent) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL windowShown( + const ::com::sun::star::lang::EventObject& rEvent) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL windowHidden( + const ::com::sun::star::lang::EventObject& rEvent) + throw (::com::sun::star::uno::RuntimeException); + + + // XEventListener + + virtual void SAL_CALL disposing( + const com::sun::star::lang::EventObject& rEvent) + throw (com::sun::star::uno::RuntimeException); + +private: + ::boost::shared_ptr< ViewShell > mpViewShell; + const ::com::sun::star::uno::Reference< com::sun::star::drawing::framework::XResourceId > mxViewId; + ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow > mxWindow; +}; + +} } // end of namespace sd::framework + +#endif |