summaryrefslogtreecommitdiff
path: root/sd/source/ui/framework/factories
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/framework/factories')
-rwxr-xr-xsd/source/ui/framework/factories/BasicPaneFactory.cxx568
-rwxr-xr-xsd/source/ui/framework/factories/BasicPaneFactory.hxx168
-rwxr-xr-xsd/source/ui/framework/factories/BasicToolBarFactory.cxx245
-rwxr-xr-xsd/source/ui/framework/factories/BasicToolBarFactory.hxx118
-rwxr-xr-xsd/source/ui/framework/factories/BasicViewFactory.cxx616
-rwxr-xr-xsd/source/ui/framework/factories/BasicViewFactory.hxx158
-rwxr-xr-xsd/source/ui/framework/factories/ChildWindowPane.cxx251
-rw-r--r--sd/source/ui/framework/factories/ChildWindowPane.hxx132
-rw-r--r--sd/source/ui/framework/factories/FrameWindowPane.cxx62
-rw-r--r--sd/source/ui/framework/factories/FrameWindowPane.hxx63
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.cxx294
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.hxx105
-rw-r--r--sd/source/ui/framework/factories/Pane.cxx267
-rwxr-xr-xsd/source/ui/framework/factories/PresentationFactory.cxx323
-rwxr-xr-xsd/source/ui/framework/factories/TaskPanelFactory.cxx323
-rwxr-xr-xsd/source/ui/framework/factories/TaskPanelFactory.hxx96
-rwxr-xr-xsd/source/ui/framework/factories/ViewShellWrapper.cxx269
-rw-r--r--sd/source/ui/framework/factories/makefile.mk60
18 files changed, 4118 insertions, 0 deletions
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
new file mode 100755
index 000000000000..f406501bd114
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -0,0 +1,568 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicPaneFactory.hxx"
+
+#include "ChildWindowPane.hxx"
+#include "FrameWindowPane.hxx"
+#include "FullScreenPane.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "ViewShellBase.hxx"
+#include "PaneChildWindows.hxx"
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <boost/bind.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace {
+ enum PaneId {
+ CenterPaneId,
+ FullScreenPaneId,
+ LeftImpressPaneId,
+ LeftDrawPaneId,
+ RightPaneId
+ };
+
+ static const sal_Int32 gnConfigurationUpdateStartEvent(0);
+ static const sal_Int32 gnConfigurationUpdateEndEvent(1);
+}
+
+namespace sd { namespace framework {
+
+
+/** Store URL, XPane reference and (local) PaneId for every pane factory
+ that is registered at the PaneController.
+*/
+class BasicPaneFactory::PaneDescriptor
+{
+public:
+ OUString msPaneURL;
+ Reference<XResource> mxPane;
+ PaneId mePaneId;
+ /** The mbReleased flag is set when the pane has been released. Some
+ panes are just hidden and destroyed. When the pane is reused this
+ flag is reset.
+ */
+ bool mbIsReleased;
+ bool mbIsChildWindow;
+
+ bool CompareURL (const OUString& rsPaneURL) { return msPaneURL.equals(rsPaneURL); }
+ bool ComparePane (const Reference<XResource>& rxPane) { return mxPane==rxPane; }
+};
+
+
+class BasicPaneFactory::PaneContainer
+ : public ::std::vector<PaneDescriptor>
+{
+public:
+ PaneContainer (void) {}
+};
+
+
+
+Reference<XInterface> SAL_CALL BasicPaneFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new BasicPaneFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString BasicPaneFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicPaneFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicPaneFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.BasicPaneFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PaneFactory ===========================================================
+
+BasicPaneFactory::BasicPaneFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicPaneFactoryInterfaceBase(m_aMutex),
+ mxComponentContext(rxContext),
+ mxConfigurationControllerWeak(),
+ mpViewShellBase(NULL),
+ mpPaneContainer(new PaneContainer),
+ mbFirstUpdateSeen(false),
+ mpUpdateLockManager()
+{
+}
+
+
+
+
+
+BasicPaneFactory::~BasicPaneFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicPaneFactory::disposing (void)
+{
+ Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
+ if (xCC.is())
+ {
+ xCC->removeResourceFactoryForReference(this);
+ xCC->removeConfigurationChangeListener(this);
+ mxConfigurationControllerWeak = Reference<XConfigurationController>();
+ }
+
+ for (PaneContainer::const_iterator iDescriptor = mpPaneContainer->begin();
+ iDescriptor != mpPaneContainer->end();
+ ++iDescriptor)
+ {
+ if (iDescriptor->mbIsReleased)
+ {
+ Reference<XComponent> xComponent (iDescriptor->mxPane, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->removeEventListener(this);
+ xComponent->dispose();
+ }
+ }
+ }
+}
+
+
+
+
+void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+ mxControllerWeak = xController;
+
+ // Tunnel through the controller to obtain access to the ViewShellBase.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ DrawController* pController
+ = reinterpret_cast<DrawController*>(
+ (sal::static_int_cast<sal_uIntPtr>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId()))));
+ mpViewShellBase = pController->GetViewShellBase();
+ mpUpdateLockManager = mpViewShellBase->GetUpdateLockManager();
+ }
+ catch(RuntimeException&)
+ {}
+
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (xCM->getConfigurationController());
+ mxConfigurationControllerWeak = xCC;
+
+ // Add pane factories for the two left panes (one for Impress and one for
+ // Draw), the center pane, and the right pane.
+ if (xController.is() && xCC.is())
+ {
+ PaneDescriptor aDescriptor;
+ aDescriptor.msPaneURL = FrameworkHelper::msCenterPaneURL;
+ aDescriptor.mePaneId = CenterPaneId;
+ aDescriptor.mbIsReleased = false;
+ aDescriptor.mbIsChildWindow = false;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msFullScreenPaneURL;
+ aDescriptor.mePaneId = FullScreenPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msLeftImpressPaneURL;
+ aDescriptor.mePaneId = LeftImpressPaneId;
+ aDescriptor.mbIsChildWindow = true;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msLeftDrawPaneURL;
+ aDescriptor.mePaneId = LeftDrawPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+
+ aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL;
+ aDescriptor.mePaneId = RightPaneId;
+ mpPaneContainer->push_back(aDescriptor);
+ xCC->addResourceFactory(aDescriptor.msPaneURL, this);
+ }
+
+ // Register as configuration change listener.
+ if (xCC.is())
+ {
+ xCC->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateStartEvent,
+ makeAny(gnConfigurationUpdateStartEvent));
+ xCC->addConfigurationChangeListener(
+ this,
+ FrameworkHelper::msConfigurationUpdateEndEvent,
+ makeAny(gnConfigurationUpdateEndEvent));
+ }
+ }
+ catch (RuntimeException&)
+ {
+ Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
+ if (xCC.is())
+ xCC->removeResourceFactoryForReference(this);
+ }
+ }
+}
+
+
+
+
+//===== XPaneFactory ==========================================================
+
+Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
+ const Reference<XResourceId>& rxPaneId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ Reference<XResource> xPane;
+
+ // Based on the ResourceURL of the given ResourceId look up the
+ // corresponding factory descriptor.
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if (
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::CompareURL, _1, rxPaneId->getResourceURL())));
+
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ if (iDescriptor->mxPane.is())
+ {
+ // The pane has already been created and is still active (has
+ // not yet been released). This should not happen.
+ xPane = iDescriptor->mxPane;
+ }
+ else
+ {
+ // Create a new pane.
+ switch (iDescriptor->mePaneId)
+ {
+ case CenterPaneId:
+ xPane = CreateFrameWindowPane(rxPaneId);
+ break;
+
+ case FullScreenPaneId:
+ xPane = CreateFullScreenPane(mxComponentContext, rxPaneId);
+ break;
+
+ case LeftImpressPaneId:
+ case LeftDrawPaneId:
+ case RightPaneId:
+ xPane = CreateChildWindowPane(
+ rxPaneId,
+ *iDescriptor);
+ break;
+ }
+ iDescriptor->mxPane = xPane;
+
+ // Listen for the pane being disposed.
+ Reference<lang::XComponent> xComponent (xPane, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+ }
+ iDescriptor->mbIsReleased = false;
+ }
+ else
+ {
+ // The requested pane can not be created by any of the factories
+ // managed by the called BasicPaneFactory object.
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "BasicPaneFactory::createPane() called for unknown resource id"),
+ NULL,
+ 0);
+ }
+
+ return xPane;
+}
+
+
+
+
+
+void SAL_CALL BasicPaneFactory::releaseResource (
+ const Reference<XResource>& rxPane)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ // Based on the given XPane reference look up the corresponding factory
+ // descriptor.
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if(
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::ComparePane, _1, rxPane)));
+
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ // The given pane was created by one of the factories. Child
+ // windows are just hidden and will be reused when requested later.
+ // Other windows are disposed and their reference is reset so that
+ // on the next createPane() call for the same pane type the pane is
+ // created anew.
+ ChildWindowPane* pChildWindowPane = dynamic_cast<ChildWindowPane*>(rxPane.get());
+ if (pChildWindowPane != NULL)
+ {
+ iDescriptor->mbIsReleased = true;
+ pChildWindowPane->Hide();
+ }
+ else
+ {
+ iDescriptor->mxPane = NULL;
+ Reference<XComponent> xComponent (rxPane, UNO_QUERY);
+ if (xComponent.is())
+ {
+ // We are disposing the pane and do not have to be informed of
+ // that.
+ xComponent->removeEventListener(this);
+ xComponent->dispose();
+ }
+ }
+ }
+ else
+ {
+ // The given XPane reference is either empty or the pane was not
+ // created by any of the factories managed by the called
+ // BasicPaneFactory object.
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "BasicPaneFactory::releasePane() called for pane that that was not created by same factory."),
+ NULL,
+ 0);
+ }
+}
+
+
+
+
+//===== XConfigurationChangeListener ==========================================
+
+void SAL_CALL BasicPaneFactory::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ sal_Int32 nEventType = 0;
+ rEvent.UserData >>= nEventType;
+ switch (nEventType)
+ {
+ case gnConfigurationUpdateStartEvent:
+ // Lock UI updates while we are switching the views except for
+ // the first time after creation. Outherwise this leads to
+ // problems after reload (missing resizes for the side panes).
+ if (mbFirstUpdateSeen)
+ {
+ if (mpUpdateLockManager.get()!=NULL)
+ {
+ // ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ // mpUpdateLockManager->Lock();
+ }
+ }
+ else
+ mbFirstUpdateSeen = true;
+ break;
+
+ case gnConfigurationUpdateEndEvent:
+ // Unlock the update lock here when only the visibility of
+ // windows but not the view shells displayed in them have
+ // changed. Otherwise the UpdateLockManager takes care of
+ // unlocking at the right time.
+ if (mpUpdateLockManager.get() != NULL)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ // if (mpUpdateLockManager->IsLocked())
+ // mpUpdateLockManager->Unlock();
+ }
+ break;
+ }
+}
+
+
+
+
+//===== lang::XEventListener ==================================================
+
+void SAL_CALL BasicPaneFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if (mxConfigurationControllerWeak == rEventObject.Source)
+ {
+ mxConfigurationControllerWeak = Reference<XConfigurationController>();
+ }
+ else
+ {
+ // Has one of the panes been disposed? If so, then release the
+ // reference to that pane, but not the pane descriptor.
+ Reference<XResource> xPane (rEventObject.Source, UNO_QUERY);
+ PaneContainer::iterator iDescriptor (
+ ::std::find_if (
+ mpPaneContainer->begin(),
+ mpPaneContainer->end(),
+ ::boost::bind(&PaneDescriptor::ComparePane, _1, xPane)));
+ if (iDescriptor != mpPaneContainer->end())
+ {
+ iDescriptor->mxPane = NULL;
+ }
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+Reference<XResource> BasicPaneFactory::CreateFrameWindowPane (
+ const Reference<XResourceId>& rxPaneId)
+{
+ Reference<XResource> xPane;
+
+ if (mpViewShellBase != NULL)
+ {
+ xPane = new FrameWindowPane(rxPaneId, mpViewShellBase->GetViewWindow());
+ }
+
+ return xPane;
+}
+
+
+
+
+Reference<XResource> BasicPaneFactory::CreateFullScreenPane (
+ const Reference<XComponentContext>& rxComponentContext,
+ const Reference<XResourceId>& rxPaneId)
+{
+ Reference<XResource> xPane (
+ new FullScreenPane(
+ rxComponentContext,
+ rxPaneId,
+ mpViewShellBase->GetViewWindow()));
+
+ return xPane;
+}
+
+
+
+
+Reference<XResource> BasicPaneFactory::CreateChildWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ const PaneDescriptor& rDescriptor)
+{
+ Reference<XResource> xPane;
+
+ if (mpViewShellBase != NULL)
+ {
+ // Create the corresponding shell and determine the id of the child window.
+ USHORT nChildWindowId = 0;
+ ::std::auto_ptr<SfxShell> pShell;
+ switch (rDescriptor.mePaneId)
+ {
+ case LeftImpressPaneId:
+ pShell.reset(new LeftImpressPaneShell());
+ nChildWindowId = ::sd::LeftPaneImpressChildWindow::GetChildWindowId();
+ break;
+
+ case LeftDrawPaneId:
+ pShell.reset(new LeftDrawPaneShell());
+ nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId();
+ break;
+
+ case RightPaneId:
+ pShell.reset(new ToolPanelPaneShell());
+ nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId();
+ break;
+
+ default:
+ break;
+ }
+
+ // With shell and child window id create the ChildWindowPane
+ // wrapper.
+ if (pShell.get() != NULL)
+ {
+ xPane = new ChildWindowPane(
+ rxPaneId,
+ nChildWindowId,
+ *mpViewShellBase,
+ pShell);
+ }
+ }
+
+ return xPane;
+}
+
+void BasicPaneFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicPaneFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
new file mode 100755
index 000000000000..9b41866180fc
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * 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_BASIC_PANE_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_PANE_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/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include "UpdateLockManager.hxx"
+
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper3 <
+ css::lang::XInitialization,
+ css::drawing::framework::XResourceFactory,
+ css::drawing::framework::XConfigurationChangeListener
+ > BasicPaneFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd {
+
+class ViewShellBase;
+}
+
+namespace sd { namespace framework {
+
+/** This factory provides the frequently used standard panes
+ private:resource/pane/CenterPane
+ private:resource/pane/FullScreenPane
+ private:resource/pane/LeftImpressPane
+ private:resource/pane/LeftDrawPane
+ private:resource/pane/RightPane
+ There are two left panes because this is (seems to be) the only way to
+ show different titles for the left pane in Draw and Impress.
+*/
+class BasicPaneFactory
+ : private ::cppu::BaseMutex,
+ public BasicPaneFactoryInterfaceBase
+{
+public:
+ BasicPaneFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~BasicPaneFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL
+ releaseResource (
+ const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
+ 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::uno::XComponentContext> mxComponentContext;
+ css::uno::WeakReference<css::drawing::framework::XConfigurationController>
+ mxConfigurationControllerWeak;
+ css::uno::WeakReference<css::frame::XController> mxControllerWeak;
+ ViewShellBase* mpViewShellBase;
+ class PaneDescriptor;
+ class PaneContainer;
+ ::boost::scoped_ptr<PaneContainer> mpPaneContainer;
+ bool mbFirstUpdateSeen;
+ ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
+
+ /** Create a new instance of FrameWindowPane.
+ @param rPaneId
+ There is only one frame window so this id is just checked to
+ have the correct value.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateFrameWindowPane (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
+
+ /** Create a new pane that represents the center pane in full screen
+ mode.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateFullScreenPane (
+ const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
+
+ /** Create a new instance of ChildWindowPane.
+ @param rPaneId
+ The ResourceURL member defines which side pane to create.
+ */
+ css::uno::Reference<css::drawing::framework::XResource>
+ CreateChildWindowPane (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxPaneId,
+ const PaneDescriptor& rDescriptor);
+
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
new file mode 100755
index 000000000000..d353cfc58c1f
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicToolBarFactory.hxx"
+
+#include "ViewTabBar.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <comphelper/mediadescriptor.hxx>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include "DrawController.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+
+Reference<XInterface> SAL_CALL BasicToolBarFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return static_cast<XWeak*>(new BasicToolBarFactory(rxContext));
+}
+
+
+
+
+::rtl::OUString BasicToolBarFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicToolBarFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicToolBarFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.BasicToolBarFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+
+//===== BasicToolBarFactory ===================================================
+
+BasicToolBarFactory::BasicToolBarFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicToolBarFactoryInterfaceBase(m_aMutex),
+ mxConfigurationController(),
+ mxController(),
+ mpViewShellBase(NULL)
+{
+ (void)rxContext;
+}
+
+
+
+
+BasicToolBarFactory::~BasicToolBarFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicToolBarFactory::disposing (void)
+{
+ Shutdown();
+}
+
+
+
+
+void BasicToolBarFactory::Shutdown (void)
+{
+ mpViewShellBase = NULL;
+ Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(static_cast<lang::XEventListener*>(this));
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->removeResourceFactoryForReference(this);
+ mxConfigurationController = NULL;
+ }
+}
+
+
+
+
+//----- XInitialization -------------------------------------------------------
+
+void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ mxController = Reference<frame::XController>(aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpViewShellBase = pController->GetViewShellBase();
+
+ ::comphelper::MediaDescriptor aDescriptor (mxController->getModel()->getArgs());
+ if ( ! aDescriptor.getUnpackedValueOrDefault(
+ ::comphelper::MediaDescriptor::PROP_PREVIEW(),
+ sal_False))
+ {
+ // Register the factory for its supported tool bars.
+ Reference<XControllerManager> xControllerManager(mxController, UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ if (mxConfigurationController.is())
+ {
+ mxConfigurationController->addResourceFactory(
+ FrameworkHelper::msViewTabBarURL, this);
+ }
+
+ Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(static_cast<lang::XEventListener*>(this));
+ }
+ else
+ {
+ // The view shell is in preview mode and thus does not need
+ // the view tab bar.
+ mxConfigurationController = NULL;
+ }
+ }
+ catch (RuntimeException&)
+ {
+ Shutdown();
+ throw;
+ }
+ }
+}
+
+
+
+
+//----- lang::XEventListener --------------------------------------------------
+
+void SAL_CALL BasicToolBarFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ if (rEventObject.Source == mxConfigurationController)
+ mxConfigurationController = NULL;
+}
+
+
+
+
+//===== XPaneFactory ==========================================================
+
+Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
+ const Reference<XResourceId>& rxToolBarId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ Reference<XResource> xToolBar;
+
+ if (rxToolBarId->getResourceURL().equals(FrameworkHelper::msViewTabBarURL))
+ {
+ xToolBar = new ViewTabBar(rxToolBarId, mxController);
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+
+ return xToolBar;
+}
+
+
+
+
+
+void SAL_CALL BasicToolBarFactory::releaseResource (
+ const Reference<XResource>& rxToolBar)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ Reference<XComponent> xComponent (rxToolBar, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+void BasicToolBarFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "BasicToolBarFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx
new file mode 100755
index 000000000000..686de897c179
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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_BASIC_TOOL_BAR_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_TOOL_BAR_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper3 <
+ css::drawing::framework::XResourceFactory,
+ css::lang::XInitialization,
+ css::lang::XEventListener
+ > BasicToolBarFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+namespace sd {
+class ViewShellBase;
+}
+
+namespace sd { namespace framework {
+
+/** This factory provides some of the frequently used tool bars:
+ private:resource/toolbar/ViewTabBar
+*/
+class BasicToolBarFactory
+ : protected ::cppu::BaseMutex,
+ public BasicToolBarFactoryInterfaceBase
+{
+public:
+ BasicToolBarFactory (
+ const css::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext);
+ virtual ~BasicToolBarFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // ToolBarFactory
+
+ virtual css::uno::Reference<com::sun::star::drawing::framework::XResource> SAL_CALL
+ createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxToolBarId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL
+ releaseResource (
+ const css::uno::Reference<com::sun::star::drawing::framework::XResource>&
+ rxToolBar)
+ throw (css::uno::RuntimeException);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+ throw (css::uno::Exception, 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;
+ ViewShellBase* mpViewShellBase;
+
+ void Shutdown (void);
+
+ void ThrowIfDisposed (void) const
+ throw (css::lang::DisposedException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
new file mode 100755
index 000000000000..2dd7689f2b39
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -0,0 +1,616 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "BasicViewFactory.hxx"
+
+#include "framework/ViewShellWrapper.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include "framework/Pane.hxx"
+#include "DrawController.hxx"
+#include "DrawSubController.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "GraphicViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "PresentationViewShell.hxx"
+#include "SlideSorterViewShell.hxx"
+#include "FrameView.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <vcl/wrkwin.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+
+Reference<XInterface> SAL_CALL BasicViewFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new BasicViewFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString BasicViewFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.BasicViewFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.BasicViewFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ViewDescriptor ========================================================
+
+class BasicViewFactory::ViewDescriptor
+{
+public:
+ Reference<XResource> mxView;
+ ::boost::shared_ptr<sd::ViewShell> mpViewShell;
+ ViewShellWrapper* mpWrapper;
+ Reference<XResourceId> mxViewId;
+ static bool CompareView (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ const Reference<XResource>& rxView)
+ { return rpDescriptor->mxView.get() == rxView.get(); }
+};
+
+
+
+
+
+//===== BasicViewFactory::ViewShellContainer ==================================
+
+class BasicViewFactory::ViewShellContainer
+ : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
+{
+public:
+ ViewShellContainer (void) {};
+};
+
+
+class BasicViewFactory::ViewCache
+ : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
+{
+public:
+ ViewCache (void) {};
+};
+
+
+
+
+//===== ViewFactory ===========================================================
+
+BasicViewFactory::BasicViewFactory (
+ const Reference<XComponentContext>& rxContext)
+ : BasicViewFactoryInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mpViewShellContainer(new ViewShellContainer()),
+ mpBase(NULL),
+ mpFrameView(NULL),
+ mpViewCache(new ViewCache()),
+ mxLocalPane(new Pane(Reference<XResourceId>(), new WorkWindow(NULL,WB_STDWORK)))
+{
+ (void)rxContext;
+}
+
+
+
+
+BasicViewFactory::~BasicViewFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::disposing (void)
+{
+ // Disconnect from the frame view.
+ if (mpFrameView != NULL)
+ {
+ mpFrameView->Disconnect();
+ mpFrameView = NULL;
+ }
+
+ // Relase the view cache.
+ ViewShellContainer::const_iterator iView;
+ for (iView=mpViewCache->begin(); iView!=mpViewCache->end(); ++iView)
+ {
+ ReleaseView(*iView, true);
+ }
+
+ // Release the view shell container. At this point no one other than us
+ // should hold references to the view shells (at the moment this is a
+ // trivial requirement, because no one other then us holds a shared
+ // pointer).
+ // ViewShellContainer::const_iterator iView;
+ for (iView=mpViewShellContainer->begin(); iView!=mpViewShellContainer->end(); ++iView)
+ {
+ OSL_ASSERT((*iView)->mpViewShell.unique());
+ }
+ mpViewShellContainer.reset();
+}
+
+
+
+
+Reference<XResource> SAL_CALL BasicViewFactory::createResource (
+ const Reference<XResourceId>& rxViewId)
+ throw(RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ Reference<XResource> xView;
+ const bool bIsCenterPane (
+ rxViewId->isBoundToURL(FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT));
+
+ // Get the pane for the anchor URL.
+ Reference<XPane> xPane;
+ if (mxConfigurationController.is())
+ xPane = Reference<XPane>(mxConfigurationController->getResource(rxViewId->getAnchor()),
+ UNO_QUERY);
+
+ // For main views use the frame view of the last main view.
+ ::sd::FrameView* pFrameView = NULL;
+ if (xPane.is() && bIsCenterPane)
+ {
+ pFrameView = mpFrameView;
+ }
+
+ // Get Window pointer for XWindow of the pane.
+ ::Window* pWindow = NULL;
+ if (xPane.is())
+ pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+
+ // Get the view frame.
+ SfxViewFrame* pFrame = NULL;
+ if (mpBase != NULL)
+ pFrame = mpBase->GetViewFrame();
+
+ if (pFrame != NULL && mpBase!=NULL && pWindow!=NULL)
+ {
+ // Try to get the view from the cache.
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor (GetViewFromCache(rxViewId, xPane));
+
+ // When the requested view is not in the cache then create a new view.
+ if (pDescriptor.get() == NULL)
+ {
+ pDescriptor = CreateView(rxViewId, *pFrame, *pWindow, xPane, pFrameView, bIsCenterPane);
+ }
+
+ if (pDescriptor.get() != NULL)
+ xView = pDescriptor->mxView;
+
+ mpViewShellContainer->push_back(pDescriptor);
+
+ if (bIsCenterPane)
+ ActivateCenterView(pDescriptor);
+ else
+ pWindow->Resize();
+ }
+
+ return xView;
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxView)
+ throw(RuntimeException)
+{
+ if ( ! rxView.is())
+ throw lang::IllegalArgumentException();
+
+ if (rxView.is() && mpBase!=NULL)
+ {
+ ViewShellContainer::iterator iViewShell (
+ ::std::find_if(
+ mpViewShellContainer->begin(),
+ mpViewShellContainer->end(),
+ ::boost::bind(&ViewDescriptor::CompareView, _1, rxView)));
+ if (iViewShell != mpViewShellContainer->end())
+ {
+ ::boost::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
+
+ if ((*iViewShell)->mxViewId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ // Obtain a pointer to and connect to the frame view of the
+ // view. The next view, that is created, will be
+ // initialized with this frame view.
+ if (mpFrameView == NULL)
+ {
+ mpFrameView = pViewShell->GetFrameView();
+ if (mpFrameView)
+ mpFrameView->Connect();
+ }
+
+ // With the view in the center pane the sub controller is
+ // released, too.
+ mpBase->GetDrawController().SetSubController(
+ Reference<drawing::XDrawSubController>());
+
+ SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
+ if (pSfxViewShell != NULL)
+ pSfxViewShell->DisconnectAllClients();
+ }
+
+ ReleaseView(*iViewShell);
+
+ mpViewShellContainer->erase(iViewShell);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+}
+
+
+
+
+void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ Reference<XConfigurationController> xCC;
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ mpBase = pController->GetViewShellBase();
+
+ // Register the factory for its supported views.
+ Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW);
+ mxConfigurationController = xCM->getConfigurationController();
+ if ( ! mxConfigurationController.is())
+ throw RuntimeException();
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
+ }
+ catch (RuntimeException&)
+ {
+ mpBase = NULL;
+ if (mxConfigurationController.is())
+ mxConfigurationController->removeResourceFactoryForReference(this);
+ throw;
+ }
+ }
+}
+
+
+
+
+::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView (
+ const Reference<XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ const Reference<XPane>& rxPane,
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
+{
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor (new ViewDescriptor());
+
+ pDescriptor->mpViewShell = CreateViewShell(
+ rxViewId,
+ rFrame,
+ rWindow,
+ pFrameView,
+ bIsCenterPane);
+ pDescriptor->mxViewId = rxViewId;
+
+ if (pDescriptor->mpViewShell.get() != NULL)
+ {
+ pDescriptor->mpViewShell->Init(bIsCenterPane);
+ mpBase->GetViewShellManager()->ActivateViewShell(pDescriptor->mpViewShell.get());
+
+ pDescriptor->mpWrapper = new ViewShellWrapper(
+ pDescriptor->mpViewShell,
+ rxViewId,
+ rxPane->getWindow());
+ pDescriptor->mxView.set( pDescriptor->mpWrapper->queryInterface( XResource::static_type() ), UNO_QUERY_THROW );
+ }
+
+ return pDescriptor;
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> BasicViewFactory::CreateViewShell (
+ const Reference<XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ FrameView* pFrameView,
+ const bool bIsCenterPane)
+{
+ ::boost::shared_ptr<ViewShell> pViewShell;
+ const OUString& rsViewURL (rxViewId->getResourceURL());
+ if (rsViewURL.equals(FrameworkHelper::msImpressViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_STANDARD,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msDrawViewURL))
+ {
+ pViewShell.reset(
+ new GraphicViewShell (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msOutlineViewURL))
+ {
+ pViewShell.reset(
+ new OutlineViewShell (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msNotesViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_NOTES,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msHandoutViewURL))
+ {
+ pViewShell.reset(
+ new DrawViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ PK_HANDOUT,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msPresentationViewURL))
+ {
+ pViewShell.reset(
+ new PresentationViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL))
+ {
+ pViewShell.reset(
+ new ::sd::toolpanel::ToolPanelViewShell(
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView));
+ }
+ else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL))
+ {
+ pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create (
+ &rFrame,
+ *mpBase,
+ &rWindow,
+ pFrameView,
+ bIsCenterPane);
+ }
+
+ return pViewShell;
+}
+
+
+
+
+void BasicViewFactory::ReleaseView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ bool bDoNotCache)
+{
+ bool bIsCacheable (!bDoNotCache && IsCacheable(rpDescriptor));
+
+ if (bIsCacheable)
+ {
+ Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
+ if (xResource.is())
+ {
+ Reference<XResource> xNewAnchor (mxLocalPane, UNO_QUERY);
+ if (xNewAnchor.is())
+ if (xResource->relocateToAnchor(xNewAnchor))
+ mpViewCache->push_back(rpDescriptor);
+ else
+ bIsCacheable = false;
+ else
+ bIsCacheable = false;
+ }
+ else
+ {
+ bIsCacheable = false;
+ }
+ }
+
+ if ( ! bIsCacheable)
+ {
+ // Shut down the current view shell.
+ rpDescriptor->mpViewShell->Shutdown ();
+ mpBase->GetDocShell()->Disconnect(rpDescriptor->mpViewShell.get());
+ mpBase->GetViewShellManager()->DeactivateViewShell(rpDescriptor->mpViewShell.get());
+
+ Reference<XComponent> xComponent (rpDescriptor->mxView, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+}
+
+
+
+
+bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
+{
+ bool bIsCacheable (false);
+
+ Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
+ if (xResource.is())
+ {
+ static ::std::vector<Reference<XResourceId> > maCacheableResources;
+ if (maCacheableResources.size() == 0)
+ {
+ ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*mpBase));
+
+ // The slide sorter and the task panel are cacheable and relocatable.
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL));
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL));
+ maCacheableResources.push_back(pHelper->CreateResourceId(
+ FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL));
+ }
+
+ ::std::vector<Reference<XResourceId> >::const_iterator iId;
+ for (iId=maCacheableResources.begin(); iId!=maCacheableResources.end(); ++iId)
+ {
+ if ((*iId)->compareTo(rpDescriptor->mxViewId) == 0)
+ {
+ bIsCacheable = true;
+ break;
+ }
+ }
+ }
+
+ return bIsCacheable;
+}
+
+
+
+
+::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromCache (
+ const Reference<XResourceId>& rxViewId,
+ const Reference<XPane>& rxPane)
+{
+ ::boost::shared_ptr<ViewDescriptor> pDescriptor;
+
+ // Search for the requested view in the cache.
+ ViewCache::iterator iEntry;
+ for (iEntry=mpViewCache->begin(); iEntry!=mpViewCache->end(); ++iEntry)
+ {
+ if ((*iEntry)->mxViewId->compareTo(rxViewId) == 0)
+ {
+ pDescriptor = *iEntry;
+ mpViewCache->erase(iEntry);
+ break;
+ }
+ }
+
+ // When the view has been found then relocate it to the given pane and
+ // remove it from the cache.
+ if (pDescriptor.get() != NULL)
+ {
+ bool bRelocationSuccessfull (false);
+ Reference<XRelocatableResource> xResource (pDescriptor->mxView, UNO_QUERY);
+ Reference<XResource> xNewAnchor (rxPane, UNO_QUERY);
+ if (xResource.is() && xNewAnchor.is())
+ {
+ if (xResource->relocateToAnchor(xNewAnchor))
+ bRelocationSuccessfull = true;
+ }
+
+ if ( ! bRelocationSuccessfull)
+ {
+ ReleaseView(pDescriptor, true);
+ pDescriptor.reset();
+ }
+ }
+
+ return pDescriptor;
+}
+
+
+
+
+void BasicViewFactory::ActivateCenterView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
+{
+ mpBase->GetDocShell()->Connect(rpDescriptor->mpViewShell.get());
+
+ // During the creation of the new sub-shell, resize requests were not
+ // forwarded to it because it was not yet registered. Therefore, we
+ // have to request a resize now.
+ rpDescriptor->mpViewShell->UIFeatureChanged();
+ if (mpBase->GetDocShell()->IsInPlaceActive())
+ mpBase->GetViewFrame()->Resize(TRUE);
+
+ mpBase->GetDrawController().SetSubController(
+ rpDescriptor->mpViewShell->CreateSubController());
+}
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/framework/factories/BasicViewFactory.hxx
new file mode 100755
index 000000000000..0cdb45ffc7c1
--- /dev/null
+++ b/sd/source/ui/framework/factories/BasicViewFactory.hxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * 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_BASIC_VIEW_FACTORY_HXX
+#define SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX
+
+#include "MutexOwner.hxx"
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <cppuhelper/compbase2.hxx>
+#include <osl/mutex.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+class ViewShell;
+class ViewShellBase;
+class FrameView;
+}
+class SfxViewFrame;
+class Window;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::drawing::framework::XResourceFactory,
+ css::lang::XInitialization
+ > BasicViewFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+
+
+namespace sd { namespace framework {
+
+/** Factory for the frequently used standard views of the drawing framework:
+ private:resource/view/
+ private:resource/view/ImpressView
+ private:resource/view/GraphicView
+ private:resource/view/OutlineView
+ private:resource/view/NotesView
+ private:resource/view/HandoutView
+ private:resource/view/SlideSorter
+ private:resource/view/PresentationView
+ private:resource/view/TaskPane
+ For some views in some panes this class also acts as a cache.
+*/
+class BasicViewFactory
+ : private sd::MutexOwner,
+ public BasicViewFactoryInterfaceBase
+{
+public:
+ BasicViewFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~BasicViewFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XViewFactory
+
+ 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);
+
+
+ // 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::drawing::framework::XConfigurationController>
+ mxConfigurationController;
+ class ViewDescriptor;
+ class ViewShellContainer;
+ ::boost::scoped_ptr<ViewShellContainer> mpViewShellContainer;
+ ViewShellBase* mpBase;
+ FrameView* mpFrameView;
+
+ class ViewCache;
+ ::boost::shared_ptr<ViewCache> mpViewCache;
+
+ css::uno::Reference<css::drawing::framework::XPane> mxLocalPane;
+
+ ::boost::shared_ptr<ViewDescriptor> CreateView (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ const css::uno::Reference<css::drawing::framework::XPane>& rxPane,
+ FrameView* pFrameView,
+ const bool bIsCenterView);
+
+ ::boost::shared_ptr<ViewShell> CreateViewShell (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ SfxViewFrame& rFrame,
+ ::Window& rWindow,
+ FrameView* pFrameView,
+ const bool bIsCenterView);
+
+ void ActivateCenterView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor);
+
+ void ReleaseView (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
+ bool bDoNotCache = false);
+
+ bool IsCacheable (
+ const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor);
+
+ ::boost::shared_ptr<ViewDescriptor> GetViewFromCache (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
+ const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx
new file mode 100755
index 000000000000..5e4e6df987f0
--- /dev/null
+++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "ChildWindowPane.hxx"
+
+#include "PaneDockingWindow.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+
+ChildWindowPane::ChildWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ USHORT nChildWindowId,
+ ViewShellBase& rViewShellBase,
+ ::std::auto_ptr<SfxShell> pShell)
+ : ChildWindowPaneInterfaceBase(rxPaneId,(::Window*)NULL),
+ mnChildWindowId(nChildWindowId),
+ mrViewShellBase(rViewShellBase),
+ mpShell(pShell),
+ mbHasBeenActivated(false)
+{
+ mrViewShellBase.GetViewShellManager()->ActivateShell(mpShell.get());
+
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame != NULL)
+ {
+ if (mrViewShellBase.IsActive())
+ {
+ if (pViewFrame->KnowsChildWindow(mnChildWindowId))
+ {
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ {
+ // The ViewShellBase has already been activated. Make
+ // the child window visible as soon as possible.
+ pViewFrame->SetChildWindow(mnChildWindowId, TRUE);
+ OSL_TRACE("ChildWindowPane:activating now");
+ }
+ else
+ {
+ // The window is created asynchronously. Rely on the
+ // ConfigurationUpdater to try another update, and with
+ // that another request for this window, in a short
+ // time.
+ OSL_TRACE("ChildWindowPane:activated asynchronously");
+ }
+ }
+ else
+ {
+ OSL_TRACE("ChildWindowPane:not known");
+ }
+ }
+ else
+ {
+ // The ViewShellBase has not yet been activated. Hide the
+ // window and wait a little before it is made visible. See
+ // comments in the GetWindow() method for an explanation.
+ pViewFrame->SetChildWindow(mnChildWindowId, FALSE);
+ OSL_TRACE("ChildWindowPane:base not active");
+ }
+ }
+}
+
+
+
+
+ChildWindowPane::~ChildWindowPane (void) throw()
+{
+}
+
+
+
+
+void ChildWindowPane::Hide (void)
+{
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame != NULL)
+ if (pViewFrame->KnowsChildWindow(mnChildWindowId))
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ pViewFrame->SetChildWindow(mnChildWindowId, FALSE);
+
+ // Release the window because when the child window is shown again it
+ // may use a different window.
+ mxWindow = NULL;
+}
+
+
+
+
+void SAL_CALL ChildWindowPane::disposing (void)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ mrViewShellBase.GetViewShellManager()->DeactivateShell(mpShell.get());
+ mpShell.reset();
+
+ if (mxWindow.is())
+ {
+ mxWindow->removeEventListener(this);
+ }
+
+ Pane::disposing();
+}
+
+
+
+
+::Window* ChildWindowPane::GetWindow (void)
+{
+ do
+ {
+ if (mxWindow.is())
+ // Window already exists => nothing to do.
+ break;
+
+ // When the window is not yet present then obtain it only when the
+ // shell has already been activated. The activation is not
+ // necessary for the code to work properly but is used to optimize
+ // the layouting and displaying of the window. When it is made
+ // visible to early then some layouting seems to be made twice or at
+ // an inconvenient time and the overall process of initializing the
+ // Impress takes longer.
+ if ( ! mbHasBeenActivated && mpShell.get()!=NULL && ! mpShell->IsActive())
+ break;
+
+ mbHasBeenActivated = true;
+ SfxViewFrame* pViewFrame = mrViewShellBase.GetViewFrame();
+ if (pViewFrame == NULL)
+ break;
+ // The view frame has to know the child window. This can be the
+ // case, when for example the document is in read-only mode: the
+ // task pane is then not available.
+ if ( ! pViewFrame->KnowsChildWindow(mnChildWindowId))
+ break;
+
+ pViewFrame->SetChildWindow(mnChildWindowId, TRUE);
+ SfxChildWindow* pChildWindow = pViewFrame->GetChildWindow(mnChildWindowId);
+ if (pChildWindow == NULL)
+ if (pViewFrame->HasChildWindow(mnChildWindowId))
+ {
+ // The child window is not yet visible. Ask the view frame
+ // to show it and try again to get access to the child
+ // window.
+ pViewFrame->ShowChildWindow(mnChildWindowId, TRUE);
+ pChildWindow = pViewFrame->GetChildWindow(mnChildWindowId);
+ }
+
+ // When the child window is still not visible then we have to try later.
+ if (pChildWindow == NULL)
+ break;
+
+ // From the child window get the docking window and from that the
+ // content window that is the container for the actual content.
+ PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(
+ pChildWindow->GetWindow());
+ if (pDockingWindow == NULL)
+ break;
+
+ // At last, we have access to the window and its UNO wrapper.
+ mpWindow = &pDockingWindow->GetContentWindow();
+ mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+
+ // Register as window listener to be informed when the child window
+ // is hidden.
+ if (mxWindow.is())
+ mxWindow->addEventListener(this);
+ }
+ while (false);
+
+ return mpWindow;
+}
+
+
+
+
+Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow (void)
+ throw (RuntimeException)
+{
+ if (mpWindow == NULL || ! mxWindow.is())
+ GetWindow();
+ return Pane::getWindow();
+}
+
+
+
+IMPLEMENT_FORWARD_XINTERFACE2(
+ ChildWindowPane,
+ ChildWindowPaneInterfaceBase,
+ Pane);
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(
+ ChildWindowPane,
+ ChildWindowPaneInterfaceBase,
+ Pane);
+
+
+
+
+//----- XEventListener --------------------------------------------------------
+
+void SAL_CALL ChildWindowPane::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (rEvent.Source == mxWindow)
+ {
+ // The window is gone but the pane remains alive. The next call to
+ // GetWindow() may create the window anew.
+ mxWindow = NULL;
+ mpWindow = NULL;
+ }
+}
+
+
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/ChildWindowPane.hxx b/sd/source/ui/framework/factories/ChildWindowPane.hxx
new file mode 100644
index 000000000000..4d2f154a327f
--- /dev/null
+++ b/sd/source/ui/framework/factories/ChildWindowPane.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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_CHILD_WINDOW_PANE_HXX
+#define SD_FRAMEWORK_CHILD_WINDOW_PANE_HXX
+
+#include "framework/Pane.hxx"
+#include "PaneShells.hxx"
+
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_FRAMEWORK_XRESOURCEID_HPP_
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX_
+#include <comphelper/uno3.hxx>
+#endif
+#include <tools/link.hxx>
+#include <memory>
+
+namespace {
+
+typedef ::cppu::ImplInheritanceHelper1 <
+ ::sd::framework::Pane,
+ ::com::sun::star::lang::XEventListener
+ > ChildWindowPaneInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+class SfxViewFrame;
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** The ChildWindowPane listens to the child window and disposes itself when
+ the child window becomes inaccessible. This happens for instance when a
+ document is made read-only and the task pane is turned off.
+*/
+class ChildWindowPane
+ : public ChildWindowPaneInterfaceBase
+{
+public:
+ ChildWindowPane (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::framework::XResourceId>& rxPaneId,
+ USHORT nChildWindowId,
+ ViewShellBase& rViewShellBase,
+ ::std::auto_ptr<SfxShell> pShell);
+ virtual ~ChildWindowPane (void) throw();
+
+ /** Hide the pane. To make the pane visible again, call GetWindow().
+ */
+ void Hide (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ /** This returns the content window when the child window is already
+ visible. Otherwise <NULL/> is returned. In that case a later call
+ may return the requested window (making a child window visible is an
+ asynchronous process.)
+ Note that GetWindow() may return different Window pointers when
+ Hide() is called in between.
+ */
+ virtual ::Window* GetWindow (void);
+
+ /** The local getWindow() first calls GetWindow() to provide a valid
+ window pointer before forwarding the call to the base class.
+ */
+ virtual ::com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
+ SAL_CALL getWindow (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing(
+ const com::sun::star::lang::EventObject& rEvent)
+ throw (com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> mxPaneId;
+ USHORT mnChildWindowId;
+ ViewShellBase& mrViewShellBase;
+ ::std::auto_ptr<SfxShell> mpShell;
+
+ /** This flag is set when the pane shell has been activated at least
+ once. It is used to optimize the start-up performance (by not
+ showing the window too early) and by not delaying its creation at
+ later times.
+ */
+ bool mbHasBeenActivated;
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/FrameWindowPane.cxx b/sd/source/ui/framework/factories/FrameWindowPane.cxx
new file mode 100644
index 000000000000..8cdbffe05816
--- /dev/null
+++ b/sd/source/ui/framework/factories/FrameWindowPane.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "FrameWindowPane.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace sd { namespace framework {
+
+FrameWindowPane::FrameWindowPane (
+ const Reference<XResourceId>& rxPaneId,
+ ::Window* pWindow)
+ : Pane(rxPaneId,pWindow)
+{
+}
+
+
+
+
+FrameWindowPane::~FrameWindowPane (void) throw()
+{
+}
+
+
+
+
+sal_Bool SAL_CALL FrameWindowPane::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/FrameWindowPane.hxx b/sd/source/ui/framework/factories/FrameWindowPane.hxx
new file mode 100644
index 000000000000..9fbc153f59ce
--- /dev/null
+++ b/sd/source/ui/framework/factories/FrameWindowPane.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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_FRAME_WINDOW_PANE_HXX
+#define SD_FRAMEWORK_FRAME_WINDOW_PANE_HXX
+
+#include "framework/Pane.hxx"
+
+#ifndef _COM_SUN_STAR_DRAWING_FRAMEWORK_XRESOURCEID_HPP_
+#include <com/sun/star/drawing/framework/XResourceId.hpp>
+#endif
+
+
+namespace sd { namespace framework {
+
+/** This subclass is not necessary anymore. We can remove it if that
+ remains so.
+*/
+class FrameWindowPane
+ : public Pane
+{
+public:
+ FrameWindowPane (
+ const ::com::sun::star::uno::Reference<
+ com::sun::star::drawing::framework::XResourceId>& rxPaneId,
+ ::Window* pWindow);
+ virtual ~FrameWindowPane (void) throw();
+
+ /** A frame window typically can (and should) exists on its own without
+ children, if only to visualize that something (a view) is missing.
+ Therefore this method always returns <FALSE/>.
+ */
+ virtual sal_Bool SAL_CALL isAnchorOnly (void)
+ throw (com::sun::star::uno::RuntimeException);
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
new file mode 100644
index 000000000000..74088422b4ab
--- /dev/null
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "FullScreenPane.hxx"
+#include "ViewShellBase.hxx"
+#include <cppcanvas/vclfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/dialog.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd { namespace framework {
+
+FullScreenPane::FullScreenPane (
+ const Reference<XComponentContext>& rxComponentContext,
+ const Reference<XResourceId>& rxPaneId,
+ const ::Window* pViewShellWindow)
+ : FrameWindowPane(rxPaneId,NULL),
+ mxComponentContext(rxComponentContext),
+ mpWorkWindow(NULL)
+{
+ ::Window* pParent = NULL;
+ mpWorkWindow.reset(new WorkWindow(
+ pParent,
+ 0)); // For debugging (non-fullscreen) use WB_BORDER | WB_MOVEABLE | WB_SIZEABLE));
+
+ if ( ! rxPaneId.is())
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nScreenNumber = 1;
+ ExtractArguments(rxPaneId, nScreenNumber);
+
+ if (mpWorkWindow.get() == NULL)
+ return;
+
+ // Create a new top-leve window that is displayed full screen.
+ mpWorkWindow->ShowFullScreenMode(TRUE, nScreenNumber);
+ // For debugging (non-fullscreen) use mpWorkWindow->SetScreenNumber(nScreenNumber);
+ mpWorkWindow->SetMenuBarMode(MENUBAR_MODE_HIDE);
+ mpWorkWindow->SetBorderStyle(WINDOW_BORDER_REMOVEBORDER);
+ mpWorkWindow->SetBackground(Wallpaper());
+ // Don't show the window right now in order to allow the setting of an
+ // accessibility object: accessibility objects are typically
+ // requested by AT-tools when the window is shown. Chaning it
+ // afterwards may or may not work.
+
+ // Add resize listener at the work window.
+ Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+ mpWorkWindow->AddEventListener(aWindowEventHandler);
+
+ // Set title and icon of the new window to those of the current window
+ // of the view shell.
+ if (pViewShellWindow != NULL)
+ {
+ const SystemWindow* pSystemWindow = pViewShellWindow->GetSystemWindow();
+ mpWorkWindow->SetText(pSystemWindow->GetText());
+ mpWorkWindow->SetIcon(pSystemWindow->GetIcon());
+ }
+
+ // For some reason the VCL canvas can not paint into a WorkWindow.
+ // Therefore a child window is created that covers the WorkWindow
+ // completely.
+ mpWindow = new ::Window(mpWorkWindow.get());
+ mpWindow->SetPosSizePixel(Point(0,0), mpWorkWindow->GetSizePixel());
+ mpWindow->SetBackground(Wallpaper());
+ mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+
+ // Create the canvas.
+ mxCanvas = CreateCanvas();
+
+ mpWindow->GrabFocus();
+}
+
+
+
+
+FullScreenPane::~FullScreenPane (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL FullScreenPane::disposing (void)
+{
+ // We have created the window pointed to by mpWindow, we delete it.
+ if (mpWindow != NULL)
+ {
+ delete mpWindow;
+ }
+
+ if (mpWorkWindow.get() != NULL)
+ {
+ Link aWindowEventHandler (LINK(this, FullScreenPane, WindowEventHandler));
+ mpWorkWindow->RemoveEventListener(aWindowEventHandler);
+ mpWorkWindow.reset();
+ }
+
+
+ FrameWindowPane::disposing();
+}
+
+
+
+
+//----- XPane -----------------------------------------------------------------
+
+sal_Bool SAL_CALL FullScreenPane::isVisible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ return mpWindow->IsReallyVisible();
+ else
+ return false;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setVisible (const sal_Bool bIsVisible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ mpWindow->Show(bIsVisible);
+ if (mpWorkWindow != NULL)
+ mpWorkWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL FullScreenPane::getAccessible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWorkWindow != NULL)
+ return mpWorkWindow->GetAccessible(FALSE);
+ else
+ return NULL;
+}
+
+
+
+
+void SAL_CALL FullScreenPane::setAccessible (
+ const Reference<accessibility::XAccessible>& rxAccessible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ if (mpWindow != NULL)
+ {
+ Reference<lang::XInitialization> xInitializable (rxAccessible, UNO_QUERY);
+ if (xInitializable.is())
+ {
+ ::Window* pParentWindow = mpWindow->GetParent();
+ Reference<accessibility::XAccessible> xAccessibleParent;
+ if (pParentWindow != NULL)
+ xAccessibleParent = pParentWindow->GetAccessible();
+ Sequence<Any> aArguments (1);
+ aArguments[0] = Any(xAccessibleParent);
+ xInitializable->initialize(aArguments);
+ }
+ GetWindow()->SetAccessible(rxAccessible);
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ GetWindow()->SetPosPixel(Point(0,0));
+ GetWindow()->SetSizePixel(Size(
+ mpWorkWindow->GetSizePixel().Width(),
+ mpWorkWindow->GetSizePixel().Height()));
+ break;
+
+ case VCLEVENT_OBJECT_DYING:
+ mpWorkWindow.reset();
+ break;
+ }
+ return 1;
+}
+
+
+
+
+Reference<rendering::XCanvas> FullScreenPane::CreateCanvas (void)
+ throw (RuntimeException)
+{
+ ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ if (pWindow != NULL)
+ {
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[1] = Any();
+ aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
+ aArg[3] = makeAny(sal_False);
+ aArg[4] = makeAny(mxWindow);
+
+ Reference<lang::XMultiServiceFactory> xFactory (
+ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.rendering.SpriteCanvas.VCL"),
+ aArg),
+ UNO_QUERY);
+ }
+ else
+ throw RuntimeException();
+}
+
+
+
+
+void FullScreenPane::ExtractArguments (
+ const Reference<XResourceId>& rxPaneId,
+ sal_Int32& rnScreenNumberReturnValue)
+{
+ // Extract arguments from the resource URL.
+ const util::URL aURL = rxPaneId->getFullResourceURL();
+ sal_Int32 nIndex = 0;
+ while (nIndex >= 0)
+ {
+ const OUString aToken = aURL.Arguments.getToken(0, '&', nIndex);
+ if (aToken.getLength() > 0)
+ {
+ // Split at the first '='.
+ const sal_Int32 nAssign = aToken.indexOf('=');
+ const OUString sKey = aToken.copy(0, nAssign);
+ const OUString sValue = aToken.copy(nAssign+1);
+
+ if (sKey.compareToAscii("ScreenNumber") == 0)
+ {
+ rnScreenNumberReturnValue = sValue.toInt32();
+ }
+ }
+ }
+}
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx
new file mode 100644
index 000000000000..c69a09e10b54
--- /dev/null
+++ b/sd/source/ui/framework/factories/FullScreenPane.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * 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_FULL_SCREEN_PANE_HXX
+#define SD_FRAMEWORK_FULL_SCREEN_PANE_HXX
+
+#include "FrameWindowPane.hxx"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <vcl/vclevent.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+class WorkWindow;
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** The full screen pane creates a pane that covers the complete application
+ window, i.e. that hides menu bar, tool bars, status bars.
+*/
+class FullScreenPane
+ : public FrameWindowPane
+{
+public:
+ /** Create a new full screen pane.
+ @param rxComponentContext
+ Used for creating a new canvas.
+ @param rxPaneId
+ The resource id of the new pane.
+ @param pViewShellWindow
+ The top-level parent of this window is used to obtain title and
+ icon for the new top-level window.
+ */
+ FullScreenPane (
+ const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
+ const ::Window* pViewShellWindow);
+ virtual ~FullScreenPane (void) throw();
+
+ virtual void SAL_CALL disposing (void);
+
+ //----- XPane -------------------------------------------------------------
+
+ 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);
+
+
+ //-------------------------------------------------------------------------
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent*);
+
+protected:
+ virtual ::com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas>
+ CreateCanvas (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
+ ::boost::scoped_ptr<WorkWindow> mpWorkWindow;
+
+ void ExtractArguments (
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
+ sal_Int32& rnScreenNumberReturnValue);
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx
new file mode 100644
index 000000000000..94081f24b733
--- /dev/null
+++ b/sd/source/ui/framework/factories/Pane.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/Pane.hxx"
+
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <cppcanvas/vclfactory.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+
+namespace sd { namespace framework {
+
+Pane::Pane (
+ const Reference<XResourceId>& rxPaneId,
+ ::Window* pWindow)
+ throw ()
+ : PaneInterfaceBase(MutexOwner::maMutex),
+ mxPaneId(rxPaneId),
+ mpWindow(pWindow),
+ mxWindow(VCLUnoHelper::GetInterface(pWindow))
+{
+}
+
+
+
+
+Pane::~Pane (void) throw()
+{
+}
+
+
+
+
+void Pane::disposing (void)
+{
+ mxWindow = NULL;
+ mpWindow = NULL;
+}
+
+
+
+
+::Window* Pane::GetWindow (void)
+{
+ if (mxWindow.is())
+ return mpWindow;
+ else
+ return NULL;
+}
+
+
+
+
+//----- XPane -----------------------------------------------------------------
+
+Reference<awt::XWindow> SAL_CALL Pane::getWindow (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxWindow;
+}
+
+
+
+
+Reference<rendering::XCanvas> SAL_CALL Pane::getCanvas (void)
+ throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ ThrowIfDisposed();
+
+ if ( ! mxCanvas.is())
+ mxCanvas = CreateCanvas();
+
+ return mxCanvas;
+}
+
+
+
+
+//----- XPane2 ----------------------------------------------------------------
+
+sal_Bool SAL_CALL Pane::isVisible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ const ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ return pWindow->IsVisible();
+ else
+ return false;
+}
+
+
+
+
+void SAL_CALL Pane::setVisible (sal_Bool bIsVisible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ pWindow->Show(bIsVisible);
+}
+
+
+
+
+Reference<accessibility::XAccessible> SAL_CALL Pane::getAccessible (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ return pWindow->GetAccessible(FALSE);
+ else
+ return NULL;
+}
+
+
+
+
+void SAL_CALL Pane::setAccessible (
+ const Reference<accessibility::XAccessible>& rxAccessible)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ ::Window* pWindow = GetWindow();
+ if (pWindow != NULL)
+ pWindow->SetAccessible(rxAccessible);
+}
+
+
+
+
+//----- XResource -------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL Pane::getResourceId (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxPaneId;
+}
+
+
+
+
+sal_Bool SAL_CALL Pane::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return true;
+}
+
+
+
+
+//----- XUnoTunnel ------------------------------------------------------------
+
+const Sequence<sal_Int8>& Pane::getUnoTunnelId (void)
+{
+ static Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ const ::vos::OGuard aSolarGuard (Application::GetSolarMutex());
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL Pane::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nResult;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+Reference<rendering::XCanvas> Pane::CreateCanvas (void)
+ throw (RuntimeException)
+{
+ Reference<rendering::XCanvas> xCanvas;
+
+ if (mpWindow != NULL)
+ {
+ ::cppcanvas::SpriteCanvasSharedPtr pCanvas (
+ ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas(*mpWindow));
+ if (pCanvas.get() != NULL)
+ xCanvas = Reference<rendering::XCanvas>(pCanvas->getUNOSpriteCanvas(), UNO_QUERY);
+ }
+
+ return xCanvas;
+}
+
+
+
+
+void Pane::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Pane object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx
new file mode 100755
index 000000000000..6f22f1484627
--- /dev/null
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/PresentationFactory.hxx"
+
+#include "framework/FrameworkHelper.hxx"
+#include "DrawController.hxx"
+#include "ViewShellBase.hxx"
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <tools/diagnose_ex.h>
+#include "slideshow.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+
+namespace sd { namespace framework {
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <lang::XInitialization> PresentationFactoryProviderInterfaceBase;
+
+class PresentationFactoryProvider
+ : protected MutexOwner,
+ public PresentationFactoryProviderInterfaceBase
+{
+public:
+ PresentationFactoryProvider (const Reference<XComponentContext>& rxContext);
+ virtual ~PresentationFactoryProvider (void);
+
+ virtual void SAL_CALL disposing (void);
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+typedef ::cppu::WeakComponentImplHelper1 <XView> PresentationViewInterfaceBase;
+
+/** The PresentationView is not an actual view, it is a marker whose
+ existence in a configuration indicates that a slideshow is running
+ (in another application window).
+*/
+class PresentationView
+ : protected MutexOwner,
+ public PresentationViewInterfaceBase
+{
+public:
+ PresentationView (const Reference<XResourceId>& rxViewId)
+ : PresentationViewInterfaceBase(maMutex),mxResourceId(rxViewId) {};
+ virtual ~PresentationView (void) {};
+
+ // XView
+
+ virtual Reference<XResourceId> SAL_CALL getResourceId (void) throw (RuntimeException)
+ { return mxResourceId; };
+
+ virtual sal_Bool SAL_CALL isAnchorOnly (void) throw (RuntimeException)
+ { return false; }
+
+
+private:
+ Reference<XResourceId> mxResourceId;
+};
+
+} // end of anonymous namespace.
+
+
+
+
+//===== PresentationFactoryProvider service ===================================
+
+Reference<XInterface> SAL_CALL PresentationFactoryProvider_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new PresentationFactoryProvider(rxContext)));
+}
+
+
+
+
+::rtl::OUString PresentationFactoryProvider_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.Draw.framework.PresentationFactoryProvider"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.framework.PresentationFactoryProvider"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== PresentationFactory ===================================================
+
+const ::rtl::OUString PresentationFactory::msPresentationViewURL(
+ OUString::createFromAscii("private:resource/view/Presentation"));
+
+
+PresentationFactory::PresentationFactory (
+ const Reference<frame::XController>& rxController)
+ : PresentationFactoryInterfaceBase(MutexOwner::maMutex),
+ mxConfigurationController(),
+ mxController(rxController)
+{
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<XControllerManager> xControllerManager(rxController, UNO_QUERY_THROW);
+ mxConfigurationController = xControllerManager->getConfigurationController();
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+
+
+
+PresentationFactory::~PresentationFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL PresentationFactory::disposing (void)
+{
+}
+
+
+
+
+//----- XViewFactory ----------------------------------------------------------
+
+Reference<XResource> SAL_CALL PresentationFactory::createResource (
+ const Reference<XResourceId>& rxViewId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ ThrowIfDisposed();
+
+ if (rxViewId.is())
+ if ( ! rxViewId->hasAnchor() && rxViewId->getResourceURL().equals(msPresentationViewURL))
+ return new PresentationView(rxViewId);
+
+ return Reference<XResource>();
+}
+
+
+
+
+void SAL_CALL PresentationFactory::releaseResource (
+ const Reference<XResource>& rxView)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ (void)rxView;
+
+ Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY);
+ if (xTunnel.is())
+ {
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != NULL)
+ {
+ ViewShellBase* pBase = pController->GetViewShellBase();
+ if (pBase != NULL)
+ SlideShow::Stop( *pBase );
+ }
+ }
+}
+
+
+
+
+//===== XConfigurationChangeListener ==========================================
+
+void SAL_CALL PresentationFactory::notifyConfigurationChange (
+ const ConfigurationChangeEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+//===== lang::XEventListener ==================================================
+
+void SAL_CALL PresentationFactory::disposing (
+ const lang::EventObject& rEventObject)
+ throw (RuntimeException)
+{
+ (void)rEventObject;
+}
+
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void PresentationFactory::ThrowIfDisposed (void) const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ throw lang::DisposedException (
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "PresentationFactory object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+namespace {
+
+//===== PresentationFactoryProvider ===========================================
+
+PresentationFactoryProvider::PresentationFactoryProvider (
+ const Reference<XComponentContext>& rxContext)
+ : PresentationFactoryProviderInterfaceBase(maMutex)
+{
+ (void)rxContext;
+}
+
+
+
+
+PresentationFactoryProvider::~PresentationFactoryProvider (void)
+{
+}
+
+
+
+
+void PresentationFactoryProvider::disposing (void)
+{
+}
+
+
+
+
+// XInitialization
+
+void SAL_CALL PresentationFactoryProvider::initialize(
+ const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (xCM->getConfigurationController());
+ if (xCC.is())
+ xCC->addResourceFactory(
+ PresentationFactory::msPresentationViewURL,
+ new PresentationFactory(xController));
+ }
+ catch (RuntimeException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+
+
+} // end of anonymous namespace.
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
new file mode 100755
index 000000000000..d7c45ceb803b
--- /dev/null
+++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+#include "TaskPanelFactory.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "DrawController.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <cppuhelper/compbase1.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::rtl::OUString;
+using ::sd::framework::FrameworkHelper;
+
+namespace sd { namespace framework {
+
+Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new TaskPanelFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString TaskPanelFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.TaskPanelFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const OUString sServiceName(
+ OUString::createFromAscii("com.sun.star.drawing.framework.TaskPanelFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//===== ToolPanelResource =====================================================
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ css::drawing::framework::XResource
+ > TaskPanelResourceInterfaceBase;
+
+class TaskPanelResource
+ : private ::cppu::BaseMutex,
+ public TaskPanelResourceInterfaceBase
+{
+public:
+ TaskPanelResource (
+ const Reference<XResourceId>& rxResourceId );
+ virtual ~TaskPanelResource ();
+
+ virtual void SAL_CALL disposing ();
+
+ // XResource
+
+ virtual Reference<XResourceId> SAL_CALL getResourceId (void)
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isAnchorOnly () throw (RuntimeException)
+ { return false; }
+
+private:
+ const Reference<XResourceId> mxResourceId;
+};
+
+} // end of anonymous namespace.
+
+
+
+
+//===== TaskPanelFactory =======================================================
+
+TaskPanelFactory::TaskPanelFactory (
+ const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext)
+ : TaskPanelFactoryInterfaceBase(m_aMutex),
+ mpViewShellBase(NULL)
+{
+ (void)rxContext;
+}
+
+
+
+
+TaskPanelFactory::~TaskPanelFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL TaskPanelFactory::disposing (void)
+{
+}
+
+
+
+
+//===== XInitialization =======================================================
+
+void SAL_CALL TaskPanelFactory::initialize(
+ const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ try
+ {
+ // Get the XController from the first argument.
+ Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain access to the ViewShellBase.
+ try
+ {
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ DrawController* pController
+ = reinterpret_cast<DrawController*>(
+ sal::static_int_cast<sal_uIntPtr>(
+ xTunnel->getSomething(DrawController::getUnoTunnelId())));
+ if (pController != NULL)
+ mpViewShellBase = pController->GetViewShellBase();
+
+ }
+ catch(RuntimeException&)
+ {}
+
+
+ Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
+ Reference<XConfigurationController> xCC (
+ xCM->getConfigurationController(), UNO_QUERY_THROW);
+ xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this);
+ }
+ catch (RuntimeException&)
+ {
+ }
+ }
+}
+
+
+//===== XResourceController ===================================================
+
+namespace
+{
+ void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< ::rtl::OUString >& o_rResourceURLs )
+ {
+ ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" );
+ o_rResourceURLs.resize(0);
+
+ Reference< XResourceId > xResourceId( i_rResourceId );
+ ::rtl::OUString sResourceURL = xResourceId->getResourceURL();
+ while ( sResourceURL.getLength() > 0 )
+ {
+ o_rResourceURLs.push_back( sResourceURL );
+ xResourceId = xResourceId->getAnchor();
+ sResourceURL = xResourceId->getResourceURL();
+ }
+ }
+}
+
+Reference<XResource> SAL_CALL TaskPanelFactory::createResource (
+ const Reference<XResourceId>& rxResourceId)
+ throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
+{
+ Reference<XResource> xResource;
+
+ if ( ! rxResourceId.is())
+ return NULL;
+
+ OUString sResourceURL (rxResourceId->getResourceURL());
+
+ if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) )
+ {
+ toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) );
+
+ if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) )
+ {
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
+
+ // assume that the top-level anchor is the URL of the pane
+ ::std::vector< ::rtl::OUString > aResourceURLs;
+ lcl_collectResourceURLs( rxResourceId, aResourceURLs );
+
+ const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
+ const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
+
+ toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
+ if ( pToolPanel != NULL )
+ xResource = new TaskPanelResource( rxResourceId );
+
+ OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" );
+ }
+ }
+
+ return xResource;
+}
+
+
+
+
+void SAL_CALL TaskPanelFactory::releaseResource (
+ const Reference<XResource>& rxResource)
+ throw (RuntimeException)
+{
+ ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" );
+ const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW );
+
+ // assume that the top-level anchor is the URL of the pane
+ ::std::vector< ::rtl::OUString > aResourceURLs;
+ lcl_collectResourceURLs( xResourceId, aResourceURLs );
+
+ OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" );
+ if ( !aResourceURLs.empty() )
+ {
+ const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
+ ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
+ const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
+ if ( pPaneViewShell != NULL )
+ {
+ const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() );
+ const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) );
+ toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
+
+ if ( ( ePanelId != toolpanel::PID_UNKNOWN )
+ && ( pToolPanel != NULL )
+ )
+ {
+ pToolPanel->DeactivatePanel( sPanelResourceURL );
+ }
+ else
+ {
+ OSL_ENSURE( false, "TaskPanelFactory::releaseResource: don't know what to do with this resource!" );
+ }
+ }
+ }
+
+ Reference<XComponent> xComponent (rxResource, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+//===== ToolPanelResource =====================================================
+
+namespace {
+
+TaskPanelResource::TaskPanelResource (
+ const Reference<XResourceId>& rxResourceId)
+ : TaskPanelResourceInterfaceBase(m_aMutex),
+ mxResourceId(rxResourceId)
+{
+}
+
+
+
+
+TaskPanelResource::~TaskPanelResource (void)
+{
+}
+
+
+
+
+void SAL_CALL TaskPanelResource::disposing ()
+{
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
+ throw (css::uno::RuntimeException)
+{
+ return mxResourceId;
+}
+
+} // end of anonymous namespace
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx
new file mode 100755
index 000000000000..086788a6763e
--- /dev/null
+++ b/sd/source/ui/framework/factories/TaskPanelFactory.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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_TASK_PANEL_FACTORY_HXX
+#define SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
+
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace {
+
+typedef ::cppu::WeakComponentImplHelper2 <
+ css::lang::XInitialization,
+ css::drawing::framework::XResourceFactory
+ > TaskPanelFactoryInterfaceBase;
+
+} // end of anonymous namespace.
+
+
+namespace sd { class ViewShellBase; }
+
+namespace sd { namespace framework {
+
+/** This class creates panels for the task pane.
+*/
+class TaskPanelFactory
+ : private ::cppu::BaseMutex,
+ public TaskPanelFactoryInterfaceBase
+{
+public:
+ TaskPanelFactory (
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext);
+ virtual ~TaskPanelFactory (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence<css::uno::Any>& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<css::drawing::framework::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResourceId>& rxResourcesId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+
+ virtual void SAL_CALL releaseResource (
+ const css::uno::Reference<
+ css::drawing::framework::XResource>& rxResource)
+ throw (css::uno::RuntimeException);
+
+private:
+ ViewShellBase* mpViewShellBase;
+};
+
+} } // end of namespace sd::framework
+
+#endif
diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
new file mode 100755
index 000000000000..a1c0bd525c9e
--- /dev/null
+++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "framework/ViewShellWrapper.hxx"
+#include "framework/Pane.hxx"
+#include "taskpane/ToolPanelViewShell.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+
+#include <com/sun/star/drawing/framework/XPane.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <rtl/uuid.h>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <tools/diagnose_ex.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+using ::com::sun::star::awt::XWindow;
+using ::com::sun::star::rendering::XCanvas;
+using ::com::sun::star::lang::DisposedException;
+
+using ::rtl::OUString;
+using ::sd::toolpanel::ToolPanelViewShell;
+
+namespace sd { namespace framework {
+
+ViewShellWrapper::ViewShellWrapper (
+ ::boost::shared_ptr<ViewShell> pViewShell,
+ const Reference<XResourceId>& rxViewId,
+ const Reference<awt::XWindow>& rxWindow)
+ : ViewShellWrapperInterfaceBase(MutexOwner::maMutex),
+ mpViewShell(pViewShell),
+ mxViewId(rxViewId),
+ mxWindow(rxWindow)
+{
+ if (rxWindow.is())
+ {
+ rxWindow->addWindowListener(this);
+ if (pViewShell != NULL)
+ {
+ pViewShell->Resize();
+ }
+ }
+}
+
+
+
+
+ViewShellWrapper::~ViewShellWrapper (void)
+{
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::disposing (void)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ OSL_TRACE("disposing ViewShellWrapper %x", this);
+ Reference<awt::XWindow> xWindow (mxWindow);
+ if (xWindow.is())
+ {
+ OSL_TRACE("removing ViewShellWrapper %x from window listener at %x", this, mxWindow.get());
+ xWindow->removeWindowListener(this);
+ }
+
+ mpViewShell.reset();
+}
+
+
+
+
+::boost::shared_ptr<ViewShell> ViewShellWrapper::GetViewShell (void)
+{
+ return mpViewShell;
+}
+
+
+
+
+//----- XResource -------------------------------------------------------------
+
+Reference<XResourceId> SAL_CALL ViewShellWrapper::getResourceId (void)
+ throw (RuntimeException)
+{
+ return mxViewId;
+}
+
+
+
+
+sal_Bool SAL_CALL ViewShellWrapper::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+
+
+//----- XRelocatableResource --------------------------------------------------
+
+sal_Bool SAL_CALL ViewShellWrapper::relocateToAnchor (
+ const Reference<XResource>& xResource)
+ throw (RuntimeException)
+{
+ sal_Bool bResult (false);
+
+ Reference<XPane> xPane (xResource, UNO_QUERY);
+ if (xPane.is())
+ {
+ // Detach from the window of the old pane.
+ Reference<awt::XWindow> xWindow (mxWindow);
+ if (xWindow.is())
+ xWindow->removeWindowListener(this);
+ mxWindow = NULL;
+
+ if (mpViewShell.get() != NULL)
+ {
+ ::Window* pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+ if (pWindow != NULL && mpViewShell->RelocateToParentWindow(pWindow))
+ {
+ bResult = sal_True;
+
+ // Attach to the window of the new pane.
+ xWindow = Reference<awt::XWindow>(xPane->getWindow(), UNO_QUERY);
+ if (xWindow.is())
+ {
+ xWindow->addWindowListener(this);
+ mpViewShell->Resize();
+ }
+ }
+ }
+ }
+
+ return bResult;
+}
+
+
+
+
+//----- XUnoTunnel ------------------------------------------------------------
+
+const Sequence<sal_Int8>& ViewShellWrapper::getUnoTunnelId (void)
+{
+ static Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ const ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL ViewShellWrapper::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nResult;
+}
+
+
+
+
+//===== awt::XWindowListener ==================================================
+
+void SAL_CALL ViewShellWrapper::windowResized (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ViewShell* pViewShell (mpViewShell.get());
+ if (pViewShell != NULL)
+ pViewShell->Resize();
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowMoved (const awt::WindowEvent& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowShown (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+ ViewShell* pViewShell (mpViewShell.get());
+ if (pViewShell != NULL)
+ pViewShell->Resize();
+}
+
+
+
+
+void SAL_CALL ViewShellWrapper::windowHidden (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ (void)rEvent;
+}
+
+
+
+
+//===== XEventListener ========================================================
+
+void SAL_CALL ViewShellWrapper::disposing (const lang::EventObject& rEvent)
+ throw (RuntimeException)
+{
+ if (rEvent.Source == mxWindow)
+ mxWindow = NULL;
+}
+
+
+} } // end of namespace sd::framework
diff --git a/sd/source/ui/framework/factories/makefile.mk b/sd/source/ui/framework/factories/makefile.mk
new file mode 100644
index 000000000000..23e780ba1eca
--- /dev/null
+++ b/sd/source/ui/framework/factories/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=framework_factories
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/BasicPaneFactory.obj \
+ $(SLO)$/BasicToolBarFactory.obj \
+ $(SLO)$/BasicViewFactory.obj \
+ $(SLO)$/ChildWindowPane.obj \
+ $(SLO)$/FrameWindowPane.obj \
+ $(SLO)$/FullScreenPane.obj \
+ $(SLO)$/Pane.obj \
+ $(SLO)$/PresentationFactory.obj \
+ $(SLO)$/TaskPanelFactory.obj \
+ $(SLO)$/ViewShellWrapper.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+