You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/02/19 10:09:05 UTC
svn commit: r1447641 [2/9] - in /openoffice/branches/sidebar/main:
default_images/sfx2/res/symphony/ framework/inc/services/
framework/source/services/ offapi/com/sun/star/ui/
officecfg/registry/data/org/openoffice/Office/
officecfg/registry/data/org/o...
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx Tue Feb 19 09:09:02 2013
@@ -37,6 +37,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing::framework;
using ::rtl::OUString;
+#undef VERBOSE
+//#define VERBOSE 1
+
namespace sd { namespace framework {
ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager)
@@ -84,10 +87,22 @@ void ResourceFactoryManager::AddFactory
{
// The URL is a URL pattern not an single URL.
maFactoryPatternList.push_back(FactoryPatternList::value_type(rsURL, rxFactory));
+
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("ResourceFactoryManager::AddFactory pattern %s %x\n",
+ OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(),
+ rxFactory.get());
+#endif
}
else
{
maFactoryMap[rsURL] = rxFactory;
+
+#if defined VERBOSE && VERBOSE>=1
+ OSL_TRACE("ResourceFactoryManager::AddFactory fixed %s %x\n",
+ OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(),
+ rxFactory.get());
+#endif
}
}
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.cxx Tue Feb 19 09:09:02 2013
@@ -52,7 +52,7 @@ namespace {
FullScreenPaneId,
LeftImpressPaneId,
LeftDrawPaneId,
- RightPaneId
+ SidebarPaneId
};
static const sal_Int32 gnConfigurationUpdateStartEvent(0);
@@ -205,7 +205,7 @@ void SAL_CALL BasicPaneFactory::initiali
mxConfigurationControllerWeak = xCC;
// Add pane factories for the two left panes (one for Impress and one for
- // Draw), the center pane, and the right pane.
+ // Draw) and the center pane.
if (xController.is() && xCC.is())
{
PaneDescriptor aDescriptor;
@@ -231,11 +231,6 @@ void SAL_CALL BasicPaneFactory::initiali
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.
@@ -304,7 +299,6 @@ Reference<XResource> SAL_CALL BasicPaneF
case LeftImpressPaneId:
case LeftDrawPaneId:
- case RightPaneId:
xPane = CreateChildWindowPane(
rxPaneId,
*iDescriptor);
@@ -523,11 +517,6 @@ Reference<XResource> BasicPaneFactory::C
pShell.reset(new LeftDrawPaneShell());
nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId();
break;
-
- case RightPaneId:
- pShell.reset(new ToolPanelPaneShell());
- nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId();
- break;
default:
break;
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx Tue Feb 19 09:09:02 2013
@@ -67,7 +67,6 @@ namespace sd { namespace framework {
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.
*/
@@ -127,7 +126,7 @@ private:
::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
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicViewFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicViewFactory.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicViewFactory.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/BasicViewFactory.cxx Tue Feb 19 09:09:02 2013
@@ -38,7 +38,7 @@
#include "DrawViewShell.hxx"
#include "GraphicViewShell.hxx"
#include "OutlineViewShell.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
+#include "SidebarViewShell.hxx"
#include "PresentationViewShell.hxx"
#include "SlideSorterViewShell.hxx"
#include "FrameView.hxx"
@@ -327,7 +327,7 @@ void SAL_CALL BasicViewFactory::initiali
mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
- mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this);
+ mxConfigurationController->addResourceFactory(FrameworkHelper::msSidebarViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
}
catch (RuntimeException&)
@@ -445,10 +445,10 @@ void SAL_CALL BasicViewFactory::initiali
&rWindow,
pFrameView));
}
- else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL))
+ else if (rsViewURL.equals(FrameworkHelper::msSidebarViewURL))
{
pViewShell.reset(
- new ::sd::toolpanel::ToolPanelViewShell(
+ new ::sd::sidebar::SidebarViewShell(
&rFrame,
*mpBase,
&rWindow,
@@ -529,8 +529,6 @@ bool BasicViewFactory::IsCacheable (cons
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;
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/Pane.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/Pane.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/Pane.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/Pane.cxx Tue Feb 19 09:09:02 2013
@@ -81,6 +81,16 @@ void Pane::disposing (void)
+void Pane::SetWindow (::Window* pWindow)
+{
+ OSL_TRACE("setting Pane::mpWindow to %x", pWindow);
+ mpWindow = pWindow;
+ mxWindow = VCLUnoHelper::GetInterface(mpWindow);
+}
+
+
+
+
//----- XPane -----------------------------------------------------------------
Reference<awt::XWindow> SAL_CALL Pane::getWindow (void)
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelFactory.cxx Tue Feb 19 09:09:02 2013
@@ -23,9 +23,12 @@
#include "precompiled_sd.hxx"
#include "TaskPanelFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
+#include "SidebarViewShell.hxx"
+#include "SidebarPanelId.hxx"
#include "DrawController.hxx"
#include "framework/FrameworkHelper.hxx"
+#include "framework/TaskPanelResource.hxx"
+#include "Window.hxx"
#include <cppuhelper/compbase1.hxx>
#include <tools/diagnose_ex.h>
@@ -37,6 +40,8 @@ using namespace ::com::sun::star::drawin
using ::rtl::OUString;
using ::sd::framework::FrameworkHelper;
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
namespace sd { namespace framework {
Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance (
@@ -68,42 +73,6 @@ Sequence<rtl::OUString> SAL_CALL TaskPan
-//===== 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 (
@@ -163,7 +132,9 @@ void SAL_CALL TaskPanelFactory::initiali
Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
Reference<XConfigurationController> xCC (
xCM->getConfigurationController(), UNO_QUERY_THROW);
- xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msAllMasterPagesTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msRecentMasterPagesTaskPanelURL, this);
+ xCC->addResourceFactory(FrameworkHelper::msUsedMasterPagesTaskPanelURL, this);
xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this);
xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this);
xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this);
@@ -206,28 +177,56 @@ Reference<XResource> SAL_CALL TaskPanelF
return NULL;
OUString sResourceURL (rxResourceId->getResourceURL());
-
- if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) )
+
+ 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 );
+ sidebar::PanelId ePanelId (sidebar::PID_UNKNOWN);
- const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
- const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
+ if (mpViewShellBase == NULL)
+ return NULL;
- toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
- if ( pToolPanel != NULL )
- xResource = new TaskPanelResource( rxResourceId );
+ sidebar::SidebarViewShell* pSidebarViewShell
+ = dynamic_cast<sidebar::SidebarViewShell*>(
+ FrameworkHelper::Instance(*mpViewShellBase)
+ ->GetViewShell(FrameworkHelper::msSidebarPaneURL).get());
+ if (pSidebarViewShell == NULL)
+ return NULL;
- OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" );
+ if (sResourceURL.equals(FrameworkHelper::msAllMasterPagesTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_MASTER_PAGES_ALL;
+ }
+ else if (sResourceURL.equals(FrameworkHelper::msRecentMasterPagesTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_MASTER_PAGES_RECENT;
+ }
+ else if (sResourceURL.equals(FrameworkHelper::msUsedMasterPagesTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_MASTER_PAGES_USED;
+ }
+ else if (sResourceURL.equals(FrameworkHelper::msLayoutTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_LAYOUT;
}
+ else if (sResourceURL.equals(FrameworkHelper::msCustomAnimationTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_CUSTOM_ANIMATION;
+ }
+ else if (sResourceURL.equals(FrameworkHelper::msSlideTransitionTaskPanelURL))
+ {
+ ePanelId = sidebar::PID_SLIDE_TRANSITION;
+ }
+ else if (sResourceURL.equals(FrameworkHelper::msTableDesignPanelURL))
+ {
+ ePanelId = sidebar::PID_TABLE_DESIGN;
+ }
+ else
+ return NULL;
+
+ xResource = new TaskPanelResource(
+ *pSidebarViewShell,
+ ePanelId,
+ rxResourceId);
}
return xResource;
@@ -240,80 +239,10 @@ void SAL_CALL TaskPanelFactory::releaseR
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
Added: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelResource.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelResource.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelResource.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/TaskPanelResource.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,135 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SidebarViewShell.hxx"
+
+#include "framework/TaskPanelResource.hxx"
+
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+using namespace css;
+using namespace cssu;
+using namespace cssdf;
+
+
+namespace sd { namespace framework {
+
+namespace {
+ ::Window* GetWindowForResource (
+ ViewShellBase& rViewShellBase,
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId)
+ {
+ ::Window* pWindow = NULL;
+ if (rxResourceId.is() && rxResourceId->getAnchor().is())
+ {
+ ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rViewShellBase));
+ Reference<awt::XWindow> xWindow (
+ pFrameworkHelper->GetPaneWindow(rxResourceId->getAnchor()->getAnchor()));
+ pWindow = VCLUnoHelper::GetWindow(xWindow);
+ }
+ return pWindow;
+ }
+}
+
+
+
+
+TaskPanelResource::TaskPanelResource (
+ sidebar::SidebarViewShell& rSidebarViewShell,
+ sidebar::PanelId ePanelId,
+ const Reference<XResourceId>& rxResourceId)
+ : TaskPanelResourceInterfaceBase(m_aMutex),
+ mxResourceId(rxResourceId),
+ mpControl(rSidebarViewShell.CreatePanel(
+ GetWindowForResource(rSidebarViewShell.GetViewShellBase(), rxResourceId),
+ ePanelId))
+{
+ if (mpControl.get() != NULL)
+ {
+ mpControl->Show();
+ mpControl->GetParent()->Show();
+ mpControl->AddEventListener(LINK(this,TaskPanelResource,WindowEventHandler));
+ }
+}
+
+
+
+
+TaskPanelResource::~TaskPanelResource (void)
+{
+ mpControl.reset();
+}
+
+
+
+
+void SAL_CALL TaskPanelResource::disposing ()
+{
+ mpControl.reset();
+}
+
+
+
+
+Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
+ throw (css::uno::RuntimeException)
+{
+ return mxResourceId;
+}
+
+
+
+
+sal_Bool SAL_CALL TaskPanelResource::isAnchorOnly (void)
+ throw (RuntimeException)
+{
+ return false;
+}
+
+
+
+
+::Window* TaskPanelResource::GetControl (void) const
+{
+ return mpControl.get();
+}
+
+
+
+
+IMPL_LINK(TaskPanelResource,WindowEventHandler,VclWindowEvent*,pEvent)
+{
+ if (pEvent!=NULL && pEvent->GetId()==SFX_HINT_DYING)
+ {
+ // Somebody else deleted the window. Release our reference so
+ // that we do not delete it again.
+ mpControl.release();
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+} } // end of namespace sd::framework
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/ViewShellWrapper.cxx Tue Feb 19 09:09:02 2013
@@ -25,7 +25,6 @@
#include "framework/ViewShellWrapper.hxx"
#include "framework/Pane.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
#include "ViewShell.hxx"
#include "Window.hxx"
@@ -50,7 +49,6 @@ using ::com::sun::star::rendering::XCanv
using ::com::sun::star::lang::DisposedException;
using ::rtl::OUString;
-using ::sd::toolpanel::ToolPanelViewShell;
namespace sd { namespace framework {
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/factories/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/factories/makefile.mk?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/factories/makefile.mk (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/factories/makefile.mk Tue Feb 19 09:09:02 2013
@@ -48,6 +48,7 @@ SLOFILES = \
$(SLO)$/Pane.obj \
$(SLO)$/PresentationFactory.obj \
$(SLO)$/TaskPanelFactory.obj \
+ $(SLO)$/TaskPanelResource.obj \
$(SLO)$/ViewShellWrapper.obj
# --- Tagets -------------------------------------------------------
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/module/ImpressModule.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/module/ImpressModule.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/module/ImpressModule.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/module/ImpressModule.cxx Tue Feb 19 09:09:02 2013
@@ -29,7 +29,6 @@
#include "ViewTabBarModule.hxx"
#include "CenterViewFocusModule.hxx"
#include "SlideSorterModule.hxx"
-#include "ToolPanelModule.hxx"
#include "ToolBarModule.hxx"
#include "ShellStackGuard.hxx"
@@ -50,7 +49,6 @@ void ImpressModule::Initialize (Referenc
new SlideSorterModule(
rxController,
FrameworkHelper::msLeftImpressPaneURL);
- ToolPanelModule::Initialize(rxController);
new ToolBarModule(rxController);
new ShellStackGuard(rxController);
}
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/module/ToolPanelModule.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/module/ToolPanelModule.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/module/ToolPanelModule.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/module/ToolPanelModule.cxx Tue Feb 19 09:09:02 2013
@@ -142,8 +142,8 @@ void ToolPanelModule::Initialize (const
new ResourceManager(
rxController,
FrameworkHelper::CreateResourceId(
- FrameworkHelper::msTaskPaneURL,
- FrameworkHelper::msRightPaneURL)));
+ FrameworkHelper::msSidebarViewURL,
+ FrameworkHelper::msSidebarPaneURL)));
pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL);
pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL);
pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL);
Modified: openoffice/branches/sidebar/main/sd/source/ui/framework/tools/FrameworkHelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/framework/tools/FrameworkHelper.cxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/framework/tools/FrameworkHelper.cxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/framework/tools/FrameworkHelper.cxx Tue Feb 19 09:09:02 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
#include "precompiled_sd.hxx"
#include <osl/time.h>
@@ -37,6 +35,7 @@
#include "DrawController.hxx"
#include "app.hrc"
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XPane.hpp>
#include <cppuhelper/compbase1.hxx>
#include <svl/lstner.hxx>
@@ -102,8 +101,10 @@ public:
virtual ~CallbackCaller (void);
virtual void SAL_CALL disposing (void);
+ // XEventListener
virtual void SAL_CALL disposing (const lang::EventObject& rEvent)
throw (RuntimeException);
+ // XConfigurationChangeListener
virtual void SAL_CALL notifyConfigurationChange (const ConfigurationChangeEvent& rEvent)
throw (RuntimeException);
@@ -179,8 +180,8 @@ const OUString FrameworkHelper::msLeftIm
msPaneURLPrefix + OUString::createFromAscii("LeftImpressPane"));
const OUString FrameworkHelper::msLeftDrawPaneURL(
msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane"));
-const OUString FrameworkHelper::msRightPaneURL(
- msPaneURLPrefix + OUString::createFromAscii("RightPane"));
+const OUString FrameworkHelper::msSidebarPaneURL(
+ msPaneURLPrefix + OUString::createFromAscii("SidebarPane"));
// View URLs.
@@ -201,8 +202,8 @@ const OUString FrameworkHelper::msSlideS
msViewURLPrefix + OUString::createFromAscii("SlideSorter"));
const OUString FrameworkHelper::msPresentationViewURL(
msViewURLPrefix + OUString::createFromAscii("PresentationView"));
-const OUString FrameworkHelper::msTaskPaneURL(
- msViewURLPrefix + OUString::createFromAscii("TaskPane"));
+const OUString FrameworkHelper::msSidebarViewURL(
+ msViewURLPrefix + OUString::createFromAscii("SidebarView"));
// Tool bar URLs.
@@ -215,9 +216,13 @@ const OUString FrameworkHelper::msViewTa
// Task panel URLs.
const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix(
- OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/"));
-const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL(
- msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages"));
+ OUString::createFromAscii("private:resource/toolpanel/"));
+const ::rtl::OUString FrameworkHelper::msAllMasterPagesTaskPanelURL(
+ msTaskPanelURLPrefix + OUString::createFromAscii("AllMasterPages"));
+const ::rtl::OUString FrameworkHelper::msRecentMasterPagesTaskPanelURL(
+ msTaskPanelURLPrefix + OUString::createFromAscii("RecentMasterPages"));
+const ::rtl::OUString FrameworkHelper::msUsedMasterPagesTaskPanelURL(
+ msTaskPanelURLPrefix + OUString::createFromAscii("UsedMasterPages"));
const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL(
msTaskPanelURLPrefix + OUString::createFromAscii("Layouts"));
const ::rtl::OUString FrameworkHelper::msTableDesignPanelURL(
@@ -237,6 +242,8 @@ const OUString FrameworkHelper::msResour
OUString::createFromAscii("ResourceActivation"));
const OUString FrameworkHelper::msResourceDeactivationEvent(
OUString::createFromAscii("ResourceDeactivation"));
+const OUString FrameworkHelper::msResourceDeactivationEndEvent(
+ OUString::createFromAscii("ResourceDeactivationEnd"));
const OUString FrameworkHelper::msConfigurationUpdateStartEvent(
OUString::createFromAscii("ConfigurationUpdateStart"));
const OUString FrameworkHelper::msConfigurationUpdateEndEvent(
@@ -337,6 +344,20 @@ private:
+//----- FrameworkHelper::Deleter ----------------------------------------------
+
+class FrameworkHelper::Deleter
+{
+public:
+ void operator()(FrameworkHelper* pObject)
+ {
+ delete pObject;
+ }
+};
+
+
+
+
//----- FrameworkHelper -------------------------------------------------------
::boost::scoped_ptr<FrameworkHelper::ViewURLMap> FrameworkHelper::mpViewURLMap(new ViewURLMap());
@@ -381,7 +402,9 @@ FrameworkHelper::InstanceMap FrameworkHe
::osl::MutexGuard aGuard (aMutexFunctor());
if (iHelper == maInstanceMap.end())
{
- pHelper = ::boost::shared_ptr<FrameworkHelper>(new FrameworkHelper(rBase));
+ pHelper = ::boost::shared_ptr<FrameworkHelper>(
+ new FrameworkHelper(rBase),
+ FrameworkHelper::Deleter());
pHelper->Initialize();
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
maInstanceMap[&rBase] = pHelper;
@@ -524,6 +547,61 @@ Reference<XView> FrameworkHelper::GetVie
+Reference<awt::XWindow> FrameworkHelper::GetPaneWindow (const Reference<XResourceId>& rxPaneId)
+{
+ Reference<awt::XWindow> xWindow;
+
+ if (rxPaneId.is() && mxConfigurationController.is())
+ {
+ try
+ {
+ if (rxPaneId->getResourceURL().match(msPaneURLPrefix))
+ {
+ Reference<XPane> xPane (mxConfigurationController->getResource(rxPaneId), UNO_QUERY);
+ if (xPane.is())
+ xWindow = xPane->getWindow();
+ }
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {
+ }
+ }
+
+ return xWindow;
+}
+
+
+
+
+Reference<XResource> FrameworkHelper::GetResource (const Reference<XResourceId>& rxResourceId)
+{
+ Reference<XResource> xResource;
+
+ if (rxResourceId.is() && mxConfigurationController.is())
+ {
+ try
+ {
+ return mxConfigurationController->getResource(rxResourceId);
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {
+ }
+ }
+
+ return NULL;
+}
+
+
+
+
Reference<XResourceId> FrameworkHelper::RequestView (
const OUString& rsResourceURL,
const OUString& rsAnchorURL)
@@ -559,7 +637,7 @@ Reference<XResourceId> FrameworkHelper::
-void FrameworkHelper::RequestTaskPanel (
+Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
const OUString& rsTaskPanelURL,
const bool bEnsureTaskPaneIsVisible)
{
@@ -572,26 +650,29 @@ void FrameworkHelper::RequestTaskPanel (
{
Reference<XConfiguration> xConfiguration (
mxConfigurationController->getCurrentConfiguration());
- if (xConfiguration.is())
- if ( ! xConfiguration->hasResource(
- CreateResourceId(msTaskPaneURL, msRightPaneURL)))
- {
- // Task pane does is not active. Do not force it.
- return;
- }
+ if (xConfiguration.is())
+ if ( ! xConfiguration->hasResource(
+ CreateResourceId(msSidebarViewURL, msSidebarPaneURL)))
+ {
+ // Task pane is not active. Do not force it.
+ return NULL;
+ }
}
- // Create the resource id from URLs for the pane, the task pane
- // view, and the task panel.
+ // Create the resource id from URLs for the sidebar pane
+ // and view and the requested panel.
mxConfigurationController->requestResourceActivation(
- CreateResourceId(msRightPaneURL),
+ CreateResourceId(msSidebarPaneURL),
ResourceActivationMode_ADD);
mxConfigurationController->requestResourceActivation(
- CreateResourceId(msTaskPaneURL, msRightPaneURL),
+ CreateResourceId(msSidebarViewURL, msSidebarPaneURL),
ResourceActivationMode_REPLACE);
+ Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
mxConfigurationController->requestResourceActivation(
- CreateResourceId(rsTaskPanelURL, msTaskPaneURL, msRightPaneURL),
+ xPanelId,
ResourceActivationMode_REPLACE);
+
+ return xPanelId;
}
}
catch (lang::DisposedException&)
@@ -600,6 +681,26 @@ void FrameworkHelper::RequestTaskPanel (
}
catch (RuntimeException&)
{}
+
+ return NULL;
+}
+
+
+
+
+void FrameworkHelper::RequestResourceDeactivation (const cssu::Reference<cssdf::XResourceId>& rxResourceId)
+{
+ try
+ {
+ if (mxConfigurationController.is() && rxResourceId.is())
+ mxConfigurationController->requestResourceDeactivation(rxResourceId);
+ }
+ catch (lang::DisposedException&)
+ {
+ Dispose();
+ }
+ catch (RuntimeException&)
+ {}
}
@@ -616,7 +717,7 @@ ViewShell::ShellType FrameworkHelper::Ge
(*mpViewURLMap)[msHandoutViewURL] = ViewShell::ST_HANDOUT;
(*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER;
(*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION;
- (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE;
+ (*mpViewURLMap)[msSidebarViewURL] = ViewShell::ST_SIDEBAR;
}
ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL));
if (iView != mpViewURLMap->end())
@@ -639,7 +740,7 @@ ViewShell::ShellType FrameworkHelper::Ge
case ViewShell::ST_HANDOUT : return msHandoutViewURL;
case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL;
case ViewShell::ST_PRESENTATION : return msPresentationViewURL;
- case ViewShell::ST_TASK_PANE : return msTaskPaneURL;
+ case ViewShell::ST_SIDEBAR : return msSidebarViewURL;
default:
return OUString();
}
@@ -788,6 +889,30 @@ void FrameworkHelper::RunOnResourceActiv
+void FrameworkHelper::RunOnResourceDeactivation(
+ const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const Callback& rCallback,
+ const bool bRunOnDeactivationEnd)
+{
+ if (mxConfigurationController.is()
+ && ! mxConfigurationController->getResource(rxResourceId).is())
+ {
+ rCallback(false);
+ }
+ else
+ {
+ RunOnEvent(
+ bRunOnDeactivationEnd
+ ? msResourceDeactivationEndEvent
+ : msResourceDeactivationEvent,
+ FrameworkHelperResourceIdFilter(rxResourceId),
+ rCallback);
+ }
+}
+
+
+
+
/** A callback that sets a flag to a specified value when the callback is
called.
*/
Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/PaneChildWindows.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/PaneChildWindows.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/PaneChildWindows.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/PaneChildWindows.hxx Tue Feb 19 09:09:02 2013
@@ -68,29 +68,7 @@ public:
SFX_DECL_CHILDWINDOW(LeftPaneDrawChildWindow);
};
-
-
-
-//======================================================================================================================
-//= ToolPanelChildWindow
-//======================================================================================================================
-class ToolPanelChildWindow :public PaneChildWindow
- ,public ::sfx2::ITaskPaneToolPanelAccess
-{
-public:
- ToolPanelChildWindow(
- ::Window* i_pParentWindow,
- sal_uInt16 i_nId,
- SfxBindings* i_pBindings,
- SfxChildWinInfo* i_pChildWindowInfo );
-
- SFX_DECL_CHILDWINDOW( ToolPanelChildWindow );
-
- // ::sfx2::ITaskPaneToolPanelAccess
- virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
-};
-
-
+
} // end of namespace ::sd
#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarPanelId.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarPanelId.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarPanelId.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarPanelId.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,53 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SD_SIDEBAR_PANEL_ID_HXX
+#define SD_SIDEBAR_PANEL_ID_HXX
+
+namespace rtl
+{
+ class OUString;
+}
+
+
+namespace sd { namespace sidebar {
+
+/** List of top level panels that can be shown in the task pane.
+*/
+enum PanelId
+{
+ PID__START = 0,
+ PID_UNKNOWN = PID__START,
+ PID_MASTER_PAGES_ALL,
+ PID_MASTER_PAGES_RECENT,
+ PID_MASTER_PAGES_USED,
+ PID_LAYOUT,
+ PID_TABLE_DESIGN,
+ PID_ANIMATION_SCHEMES,
+ PID_CUSTOM_ANIMATION,
+ PID_SLIDE_TRANSITION,
+ PID__END = PID_SLIDE_TRANSITION
+};
+
+} } // namespace sd::sidebar
+
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarViewShell.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarViewShell.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarViewShell.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/SidebarViewShell.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,114 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SD_SIDEBAR_VIEW_SHELL_HXX
+#define SD_SIDEBAR_VIEW_SHELL_HXX
+
+#include "ViewShell.hxx"
+#include "SidebarPanelId.hxx"
+#include "glob.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include <vcl/button.hxx>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/shell.hxx>
+#include <sfx2/viewfac.hxx>
+#include <sfx2/dockwin.hxx>
+
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+
+namespace sd { namespace sidebar {
+
+class SidebarShellManager;
+
+/** This is the bare minimum that is necessary to run the legacy task panels.
+*/
+class SidebarViewShell
+ : public ViewShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SD_IF_SDSIDEBARVIEWSHELL)
+
+ SidebarViewShell (
+ SfxViewFrame* pFrame,
+ ViewShellBase& rViewShellBase,
+ ::Window* pParentWindow,
+ FrameView* pFrameView);
+ virtual ~SidebarViewShell (void);
+
+ /** Register the SFX interfaces so that (some of) the controls can be
+ pushed as SFX shells on the shell stack and process slot calls and
+ so on.
+ */
+ static void RegisterControls (void);
+
+ /** This factory method is used by the TaskPanelFactory to create
+ task panel objects.
+ */
+ ::Window* CreatePanel (
+ ::Window* pParentWindow,
+ const PanelId ePanelId);
+
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
+ virtual void KeyInput (const KeyEvent& rEvent);
+ using sd::ViewShell::KeyInput;
+
+ virtual SdPage* GetActualPage (void);
+ virtual SdPage* getCurrentPage (void) const;
+
+ void Execute (SfxRequest& rRequest);
+ void GetState (SfxItemSet& rItemSet);
+
+ virtual void ArrangeGUIElements (void);
+
+ SidebarShellManager& GetSubShellManager (void) const;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessibleDocumentView (::sd::Window* pWindow);
+
+ virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
+
+ /** Relocate all toplevel controls to the given parent window.
+ */
+ virtual bool RelocateToParentWindow (::Window* pParentWindow);
+
+private:
+ ::boost::shared_ptr<SidebarShellManager> mpSubShellManager;
+ WorkWindow maContentWindowParent;
+
+ /** Return a pointer to the docking window that is the parent or a
+ predecessor of the content window.
+ @return
+ When the view shell is not placed in a docking window, e.g. when
+ shown in the center pane, then <NULL?> is returned.
+ */
+ DockingWindow* GetDockingWindow (void);
+};
+
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/ViewShell.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/ViewShell.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/ViewShell.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/ViewShell.hxx Tue Feb 19 09:09:02 2013
@@ -35,9 +35,7 @@
#include "glob.hxx"
#include "pres.hxx"
#include "cfgids.hxx"
-#ifndef _SD_VIEW_HXX
#include "View.hxx"
-#endif
#include "sddllapi.h"
#include <com/sun/star/drawing/XDrawSubController.hpp>
@@ -111,7 +109,7 @@ public:
ST_OUTLINE,
ST_SLIDE_SORTER,
ST_PRESENTATION,
- ST_TASK_PANE
+ ST_SIDEBAR
};
static const int MAX_HSPLIT_CNT = 1;
static const int MAX_VSPLIT_CNT = 1;
Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/framework/FrameworkHelper.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/framework/FrameworkHelper.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/framework/FrameworkHelper.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/framework/FrameworkHelper.hxx Tue Feb 19 09:09:02 2013
@@ -48,6 +48,8 @@ class OUString;
}
namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
namespace sd { namespace framework {
@@ -56,10 +58,10 @@ namespace sd { namespace framework {
It has three main tasks:
1. Provide frequently used strings of resource URLs and event names.
2. Provide shortcuts for accessing the sd framework.
- 3. Easy the migration to the drawing framwork.
+ 3. Ease the migration to the drawing framwork.
Note that a FrameworkHelper disposes itself when one of the resource
- controllers called by it throw a DisposedException.
+ controllers called by it throws a DisposedException.
*/
class FrameworkHelper
: public ::boost::enable_shared_from_this<FrameworkHelper>,
@@ -72,7 +74,7 @@ public:
static const ::rtl::OUString msFullScreenPaneURL;
static const ::rtl::OUString msLeftImpressPaneURL;
static const ::rtl::OUString msLeftDrawPaneURL;
- static const ::rtl::OUString msRightPaneURL;
+ static const ::rtl::OUString msSidebarPaneURL;
// URLs of frequently used views.
static const ::rtl::OUString msViewURLPrefix;
@@ -83,7 +85,7 @@ public:
static const ::rtl::OUString msHandoutViewURL;
static const ::rtl::OUString msSlideSorterURL;
static const ::rtl::OUString msPresentationViewURL;
- static const ::rtl::OUString msTaskPaneURL;
+ static const ::rtl::OUString msSidebarViewURL;
// URLs of frequently used tool bars.
static const ::rtl::OUString msToolBarURLPrefix;
@@ -91,7 +93,9 @@ public:
// URLs of task panels.
static const ::rtl::OUString msTaskPanelURLPrefix;
- static const ::rtl::OUString msMasterPagesTaskPanelURL;
+ static const ::rtl::OUString msAllMasterPagesTaskPanelURL;
+ static const ::rtl::OUString msRecentMasterPagesTaskPanelURL;
+ static const ::rtl::OUString msUsedMasterPagesTaskPanelURL;
static const ::rtl::OUString msLayoutTaskPanelURL;
static const ::rtl::OUString msTableDesignPanelURL;
static const ::rtl::OUString msCustomAnimationTaskPanelURL;
@@ -102,6 +106,7 @@ public:
static const ::rtl::OUString msResourceDeactivationRequestEvent;
static const ::rtl::OUString msResourceActivationEvent;
static const ::rtl::OUString msResourceDeactivationEvent;
+ static const ::rtl::OUString msResourceDeactivationEndEvent;
static const ::rtl::OUString msConfigurationUpdateStartEvent;
static const ::rtl::OUString msConfigurationUpdateEndEvent;
@@ -116,7 +121,7 @@ public:
static ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase);
static ::boost::shared_ptr<FrameworkHelper> Instance (
- const css::uno::Reference<css::frame::XController>& rxController);
+ const cssu::Reference<css::frame::XController>& rxController);
/** Mark the FrameworkHelper object for the given ViewShellBase as
disposed. A following ReleaseInstance() call will destroy the
@@ -153,17 +158,15 @@ public:
reference then an empty pointer is returned.
*/
static ::boost::shared_ptr<ViewShell> GetViewShell (
- const css::uno::Reference<css::drawing::framework::XView>& rxView);
+ const cssu::Reference<cssdf::XView>& rxView);
- ~FrameworkHelper (void);
-
- typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)>
+ typedef ::boost::function<bool(const cssdf::ConfigurationChangeEvent&)>
ConfigurationChangeEventFilter;
typedef ::boost::function<void(bool bEventSeen)> Callback;
typedef ::boost::function<
void(
- const css::uno::Reference<
- css::drawing::framework::XResourceId>&)
+ const cssu::Reference<
+ cssdf::XResourceId>&)
> ResourceFunctor;
/** Test whether the called FrameworkHelper object is valid.
@@ -196,10 +199,19 @@ public:
of the involved objects does not support XTunnel (where
necessary).
*/
- css::uno::Reference<css::drawing::framework::XView>
- GetView (
- const css::uno::Reference<
- css::drawing::framework::XResourceId>& rxPaneOrViewId);
+ cssu::Reference<cssdf::XView> GetView (
+ const cssu::Reference<cssdf::XResourceId>& rxPaneOrViewId);
+
+ /** Return the XWindow that is represented by the pane with the
+ given resource id.
+ */
+ cssu::Reference<css::awt::XWindow> GetPaneWindow (
+ const cssu::Reference<cssdf::XResourceId>& rxPaneId);
+
+ /** Return the XResource object with the given resource id.
+ */
+ cssu::Reference<cssdf::XResource> GetResource (
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId);
/** Request the specified view to be displayed in the specified pane.
When the pane is not visible its creation is also requested. The
@@ -213,24 +225,33 @@ public:
the caller can, for example, call RunOnResourceActivation() to
do some initialization after the requested view becomes active.
*/
- css::uno::Reference<css::drawing::framework::XResourceId> RequestView (
+ cssu::Reference<cssdf::XResourceId> RequestView (
const ::rtl::OUString& rsResourceURL,
const ::rtl::OUString& rsAnchorURL);
- /** Request the activation of the specified task panel in the standard
- task pane.
- @param rsTaskPanelURL
+ /** Request the activation of the specified panel in the
+ sidebar.
+ @param rsSidebarPanelURL
The panel that is to be activated.
- @param bEnsureTaskPaneIsVisible
- When this is <TRUE/> then the task pane is activated when not
+ @param bEnsurePaneIsVisible
+ When this is <TRUE/> then the sidebar pane is activated when not
yet active.
When this flag is <FALSE/> then the requested panel
is activated only when the task pane is already active. When it
is not active then this call is silently ignored.
+ @return
+ The resource id of the requested sidebar panel is returned. With that
+ the caller can, for example, call RunOnResourceActivation() to
+ do some initialization after the requested view becomes active.
*/
- void RequestTaskPanel (
- const ::rtl::OUString& rsTaskPanelURL,
+ cssu::Reference<cssdf::XResourceId> RequestSidebarPanel (
+ const ::rtl::OUString& rsSidebarPanelURL,
const bool bEnsureTaskPaneIsVisible = true);
+
+ /** Request the deactivation of the specified resource.
+ */
+ void RequestResourceDeactivation (
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId);
/** Process a slot call that requests a view shell change.
*/
@@ -260,9 +281,30 @@ public:
*/
void RunOnResourceActivation(
- const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId,
const Callback& rCallback);
+ /** Run the given callback when the specified resource has been
+ deactivated. When the resource is not active already when
+ this method is called then rCallback is called before this
+ method returns.
+ @param rxResourceId
+ Wait for the deactivation of this resource before calling
+ rCallback.
+ @param rCallback
+ The callback to be called when the resource is
+ deactivated.
+ @param bRunOnDeactivationEnd
+ The callback is run either when the deactivation starts
+ and the callback can still access the resource or when the
+ deactivatio is complete and the resource is no longer available.
+
+ */
+ void RunOnResourceDeactivation(
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId,
+ const Callback& rCallback,
+ const bool bRunOnDeactivationEnd);
+
/** Normally the requested changes of the configuration are executed
asynchronously. However, there is at least one situation (searching
with the Outliner) where the surrounding code does not cope with
@@ -296,21 +338,21 @@ public:
/** Return a string representation of the given XResourceId object.
*/
static ::rtl::OUString ResourceIdToString (
- const css::uno::Reference<
- css::drawing::framework::XResourceId>& rxResourceId);
+ const cssu::Reference<
+ cssdf::XResourceId>& rxResourceId);
/** Create a new XResourceId object for the given resource URL.
*/
- static css::uno::Reference<
- css::drawing::framework::XResourceId>
+ static cssu::Reference<
+ cssdf::XResourceId>
CreateResourceId (
const ::rtl::OUString& rsResourceURL);
/** Create a new XResourceId object for the given resource URL and a
single anchor URL.
*/
- static css::uno::Reference<
- css::drawing::framework::XResourceId>
+ static cssu::Reference<
+ cssdf::XResourceId>
CreateResourceId (
const ::rtl::OUString& rsResourceURL,
const ::rtl::OUString& rsAnchorURL);
@@ -318,8 +360,8 @@ public:
/** Create a new XResourceId object for the given resource URL and the
two given anchor URLs.
*/
- static css::uno::Reference<
- css::drawing::framework::XResourceId>
+ static cssu::Reference<
+ cssdf::XResourceId>
CreateResourceId (
const ::rtl::OUString& rsResourceURL,
const ::rtl::OUString& rsFirstAnchorURL,
@@ -327,14 +369,14 @@ public:
/** Create a new XResourceId object for the given resource URL.
*/
- static css::uno::Reference<
- css::drawing::framework::XResourceId>
+ static cssu::Reference<
+ cssdf::XResourceId>
CreateResourceId (
const ::rtl::OUString& rsResourceURL,
- const css::uno::Reference<
- css::drawing::framework::XResourceId>& rxAnchor);
+ const cssu::Reference<
+ cssdf::XResourceId>& rxAnchor);
- css::uno::Reference<css::drawing::framework::XConfigurationController>
+ cssu::Reference<cssdf::XConfigurationController>
GetConfigurationController (void) const;
@@ -350,16 +392,18 @@ private:
static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap;
ViewShellBase& mrBase;
- css::uno::Reference<css::drawing::framework::XConfigurationController>
+ cssu::Reference<cssdf::XConfigurationController>
mxConfigurationController;
class DisposeListener;
friend class DisposeListener;
- css::uno::Reference<css::lang::XComponent>
+ cssu::Reference<css::lang::XComponent>
mxDisposeListener;
FrameworkHelper (ViewShellBase& rBase);
FrameworkHelper (const FrameworkHelper& rHelper); // Not implemented.
+ ~FrameworkHelper (void);
+ class Deleter; friend class Deleter;
FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented.
void Initialize (void);
@@ -399,7 +443,7 @@ namespace {
class FrameworkHelperAllPassFilter
{
public:
- bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; }
+ bool operator() (const cssdf::ConfigurationChangeEvent&) { return true; }
};
@@ -407,12 +451,12 @@ namespace {
{
public:
FrameworkHelperResourceIdFilter (
- const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
- bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent)
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId);
+ bool operator() (const cssdf::ConfigurationChangeEvent& rEvent)
{ return mxResourceId.is() && rEvent.ResourceId.is()
&& mxResourceId->compareTo(rEvent.ResourceId) == 0; }
private:
- css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
+ cssu::Reference<cssdf::XResourceId> mxResourceId;
};
} // end of anonymous namespace
Modified: openoffice/branches/sidebar/main/sd/source/ui/inc/framework/Pane.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/framework/Pane.hxx?rev=1447641&r1=1447640&r2=1447641&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/framework/Pane.hxx (original)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/framework/Pane.hxx Tue Feb 19 09:09:02 2013
@@ -94,6 +94,7 @@ public:
*/
virtual ::Window* GetWindow (void);
+ void SetWindow (::Window* pWindow);
//----- XPane -------------------------------------------------------------
Added: openoffice/branches/sidebar/main/sd/source/ui/inc/framework/TaskPanelResource.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/inc/framework/TaskPanelResource.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/inc/framework/TaskPanelResource.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/inc/framework/TaskPanelResource.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,85 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include "SidebarPanelId.hxx"
+
+#include <com/sun/star/drawing/framework/XResource.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
+
+class Window;
+
+namespace sd { namespace sidebar {
+ class SidebarViewShell;
+} }
+
+
+namespace sd { namespace framework {
+
+typedef ::cppu::WeakComponentImplHelper1 <
+ cssdf::XResource
+ > TaskPanelResourceInterfaceBase;
+
+
+/** A simple wrapper around a legacy task pane control that gives
+ access to that control (via GetControl()).
+*/
+class TaskPanelResource
+ : private ::cppu::BaseMutex,
+ public TaskPanelResourceInterfaceBase
+{
+public:
+ /** Create a resource object that represents the legacy taskpane
+ panel.
+ @param rxResourceId
+ drawing framework resource id
+ @param pControl
+ The new TaskPanelResource object takes ownership for this control.
+ */
+ TaskPanelResource (
+ sidebar::SidebarViewShell& rSidebarViewShell,
+ sidebar::PanelId ePanelId,
+ const cssu::Reference<cssdf::XResourceId>& rxResourceId);
+ virtual ~TaskPanelResource (void);
+ virtual void SAL_CALL disposing (void);
+
+ // XResource
+ virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException);
+ virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException);
+
+ ::Window* GetControl (void) const;
+
+private:
+ const cssu::Reference<cssdf::XResourceId> mxResourceId;
+ // Using auto_ptr because it has release(), what scoped_ptr doesn't.
+ ::std::auto_ptr< ::Window> mpControl;
+
+ DECL_LINK(WindowEventHandler,VclWindowEvent*);
+};
+
+} } // end of namespace sd::framework
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/IDisposable.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/IDisposable.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/IDisposable.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/IDisposable.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,44 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+
+#ifndef SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX
+#define SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX
+
+#include <tools/gen.hxx>
+#include <sal/types.h>
+
+class Window;
+
+namespace sd { namespace sidebar {
+
+
+class IDisposable
+{
+public:
+ virtual void Dispose (void) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/ILayoutableWindow.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/ILayoutableWindow.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/ILayoutableWindow.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/ILayoutableWindow.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,49 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+
+#ifndef SD_SIDEBAR_LAYOUTABLE_WINDOW_INTERFACE_HXX
+#define SD_SIDEBAR_LAYOUTABLE_WINDOW_INTERFACE_HXX
+
+#include <tools/gen.hxx>
+#include <sal/types.h>
+
+#include <com/sun/star/ui/LayoutSize.hpp>
+
+class Window;
+
+namespace sd { namespace sidebar {
+
+
+class ILayoutableWindow
+{
+public:
+ /** Return the preferred height with the constraint, that the
+ window will be set to the given width.
+ */
+ virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/ISidebarReceiver.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/ISidebarReceiver.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/ISidebarReceiver.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/ISidebarReceiver.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,40 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SD_SIDEBAR_RECEIVER_INTERFACE_HXX
+#define SD_SIDEBAR_RECEIVER_INTERFACE_HXX
+
+#include <com/sun/star/ui/XSidebar.hpp>
+
+namespace sd { namespace sidebar {
+
+
+class ISidebarReceiver
+{
+public:
+ virtual void SetSidebar (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XSidebar>& rxSidebar) = 0;
+};
+
+
+} } // end of namespace ::sd::sidebar
+
+#endif
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.cxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.cxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.cxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,378 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SidebarFactory.hxx"
+#include "framework/FrameworkHelper.hxx"
+#include "framework/Pane.hxx"
+#include "ViewShellBase.hxx"
+#include "UIElementWrapper.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+
+using namespace css;
+using namespace cssu;
+using namespace css::drawing::framework;
+using namespace ::sd::framework;
+using ::rtl::OUString;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+namespace sd { namespace sidebar {
+
+namespace {
+ /** Note that these names have to be identical to (the tail of)
+ the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu
+ for the TaskPanelFactory.
+ */
+ const static char* gsResourceNameCustomAnimations = "/CustomAnimations";
+ const static char* gsResourceNameLayouts = "/Layouts";
+ const static char* gsResourceNameAllMasterPages = "/AllMasterPages";
+ const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages";
+ const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages";
+ const static char* gsResourceNameSlideTransitions = "/SlideTransitions";
+ const static char* gsResourceNameTableDesign = "/TableDesign";
+}
+
+class SidebarFactory::Implementation
+{
+public:
+ Reference<cssdf::XConfigurationController> mxConfigurationController;
+ rtl::Reference<framework::Pane> mxPane;
+ Reference<ui::XUIElement> mxUIElement;
+ Reference<frame::XController> mxController;
+ Reference<awt::XWindow> mxParentWindow;
+ bool mbIsDisposed;
+
+ Implementation (const Reference<frame::XController>& rxController);
+ ~Implementation (void);
+ void Dispose (void);
+};
+
+
+SidebarFactory::ControllerToImplementationMap SidebarFactory::maControllerToImplementationMap;
+Reference<lang::XEventListener> mxControllerDisposeListener;
+
+
+
+// ----- Service functions ----------------------------------------------------
+
+Reference<XInterface> SAL_CALL SidebarFactory_createInstance (
+ const Reference<XComponentContext>& rxContext)
+{
+ return Reference<XInterface>(static_cast<XWeak*>(new SidebarFactory(rxContext)));
+}
+
+
+
+
+::rtl::OUString SidebarFactory_getImplementationName (void) throw(RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.SidebarFactory"));
+}
+
+
+
+
+Sequence<rtl::OUString> SAL_CALL SidebarFactory_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.SidebarFactory"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+
+
+
+
+//----- SidebarFactory --------------------------------------------------------
+
+SidebarFactory::SidebarFactory(
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ : SidebarFactoryInterfaceBase(m_aMutex),
+ mpImplementation()
+{
+}
+
+
+
+
+SidebarFactory::~SidebarFactory (void)
+{
+}
+
+
+
+
+void SAL_CALL SidebarFactory::disposing (void)
+{
+ SharedImplementation pImplementation;
+ pImplementation.swap(mpImplementation);
+ if (pImplementation)
+ pImplementation->Dispose();
+}
+
+
+
+
+// XInitialization
+
+void SAL_CALL SidebarFactory::initialize (const Sequence<Any>& aArguments)
+ throw (Exception, RuntimeException)
+{
+ if (aArguments.getLength() > 0)
+ {
+ mpImplementation = GetImplementationForController(
+ Reference<frame::XController>(aArguments[0], UNO_QUERY));
+ }
+}
+
+
+
+
+// XUIElementFactory
+
+Reference<ui::XUIElement> SAL_CALL SidebarFactory::createUIElement (
+ const ::rtl::OUString& rsUIElementResourceURL,
+ const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+ throw(
+ css::container::NoSuchElementException,
+ css::lang::IllegalArgumentException,
+ cssu::RuntimeException)
+{
+ // Process arguments.
+ const ::comphelper::NamedValueCollection aArguments (rArguments);
+ Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+ Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+ Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
+
+ // Throw exceptions when the arguments are not as expected.
+ ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ if ( ! xParentWindow.is() || pParentWindow==NULL)
+ throw RuntimeException(
+ A2S("SidebarFactory::createUIElement called without ParentWindow"),
+ NULL);
+ if ( ! xFrame.is())
+ throw RuntimeException(
+ A2S("SidebarFactory::createUIElement called without XFrame"),
+ NULL);
+ mpImplementation = GetImplementationForController(xFrame->getController());
+ if ( ! mpImplementation)
+ throw RuntimeException(
+ A2S("SidebarFactory::createUIElement called without XController"),
+ NULL);
+ if (mpImplementation->mxConfigurationController.is())
+ mpImplementation->mxConfigurationController->addResourceFactory(
+ FrameworkHelper::msSidebarPaneURL+A2S("*"), this);
+
+ // Remember the parent window, so that following calls to
+ // createResource() can access it.
+ mpImplementation->mxParentWindow = xParentWindow;
+ if (mpImplementation->mxPane.is())
+ mpImplementation->mxPane->SetWindow(VCLUnoHelper::GetWindow(xParentWindow));
+
+ // Create a framework view.
+ OUString sTaskPanelURL;
+#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
+ if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
+ sTaskPanelURL = FrameworkHelper::msCustomAnimationTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
+ sTaskPanelURL = FrameworkHelper::msLayoutTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages))
+ sTaskPanelURL = FrameworkHelper::msAllMasterPagesTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages))
+ sTaskPanelURL = FrameworkHelper::msRecentMasterPagesTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
+ sTaskPanelURL = FrameworkHelper::msUsedMasterPagesTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
+ sTaskPanelURL = FrameworkHelper::msSlideTransitionTaskPanelURL;
+ else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
+ sTaskPanelURL = FrameworkHelper::msTableDesignPanelURL;
+#undef EndsWith
+
+ if (sTaskPanelURL.getLength() == 0)
+ throw lang::IllegalArgumentException();
+
+ // Create a wrapper around pane and view and return it as
+ // XUIElement.
+ Reference<ui::XUIElement> xUIElement;
+ try
+ {
+ xUIElement.set(new UIElementWrapper(
+ rsUIElementResourceURL,
+ xFrame,
+ sTaskPanelURL,
+ xSidebar,
+ VCLUnoHelper::GetWindow(xParentWindow)));
+ }
+ catch(Exception& rException)
+ {
+ // Creation of XUIElement failed. mxUIElement remains empty.
+ }
+
+ Reference<lang::XComponent> xComponent (xUIElement, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+
+ return xUIElement;
+}
+
+
+
+
+// XResourceFactory
+
+Reference<drawing::framework::XResource>
+ SAL_CALL SidebarFactory::createResource (
+ const Reference<drawing::framework::XResourceId>& rxPaneId)
+ throw (RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException)
+{
+ if ( ! rxPaneId.is())
+ throw lang::IllegalArgumentException();
+
+ const OUString sResourceURL (rxPaneId->getResourceURL());
+ if ( ! sResourceURL.equals(FrameworkHelper::msSidebarPaneURL))
+ throw lang::IllegalArgumentException();
+
+ if ( ! mpImplementation)
+ throw RuntimeException(A2S("SidebarFactory not initialized"), NULL);
+
+ ::Window* pWindow = VCLUnoHelper::GetWindow(mpImplementation->mxParentWindow);
+ if (pWindow == NULL)
+ throw RuntimeException();
+
+ mpImplementation->mxPane.set(new Pane(rxPaneId, pWindow));
+ Reference<drawing::framework::XResource> xPane (static_cast<XPane*>(mpImplementation->mxPane.get()));
+ return xPane;
+}
+
+
+
+
+void SAL_CALL SidebarFactory::releaseResource (
+ const Reference<drawing::framework::XResource>& rxPane)
+ throw (RuntimeException)
+{
+ (void)rxPane;
+
+ // Any panes created by us are just wrappers around windows whose lifetime
+ // is controlled somewhere else => nothing to do.
+}
+
+
+
+
+void SAL_CALL SidebarFactory::disposing (const ::css::lang::EventObject& rEvent)
+ throw(cssu::RuntimeException)
+{
+ /*
+ if (mpImplementation
+ && rEvent.Source == mpImplementation->mxUIElement)
+ {
+ mpImplementation->mxUIElement.clear();
+ }
+ */
+}
+
+
+
+
+SidebarFactory::SharedImplementation SidebarFactory::GetImplementationForController (
+ const cssu::Reference<css::frame::XController>& rxController)
+{
+ SharedImplementation pImplementation;
+ if (rxController.is())
+ {
+ ControllerToImplementationMap::const_iterator iImplementation (
+ maControllerToImplementationMap.find(rxController));
+ if (iImplementation == maControllerToImplementationMap.end())
+ {
+ pImplementation.reset(new Implementation(rxController));
+ maControllerToImplementationMap[rxController] = pImplementation;
+
+ // Each Implementation object is referenced by two
+ // SidebarFactory objects. The Implementation object is
+ // destroyed when the first of the SidebarFactory objects
+ // is disposed.
+ }
+ else
+ pImplementation = iImplementation->second;
+ }
+ return pImplementation;
+}
+
+
+
+
+//----- SidebarFactory::Implementation ----------------------------------------
+
+SidebarFactory::Implementation::Implementation (const Reference<frame::XController>& rxController)
+ : mxConfigurationController(),
+ mxPane(),
+ mxUIElement(),
+ mxController(rxController),
+ mxParentWindow(),
+ mbIsDisposed(false)
+{
+ Reference<XControllerManager> xCM (rxController, UNO_QUERY);
+ if (xCM.is())
+ {
+ mxConfigurationController = xCM->getConfigurationController();
+ }
+}
+
+
+
+
+SidebarFactory::Implementation::~Implementation (void)
+{
+ Dispose();
+}
+
+
+
+
+void SidebarFactory::Implementation::Dispose (void)
+{
+ if (mbIsDisposed)
+ return;
+
+ mbIsDisposed = true;
+
+ // Release the entry in the maControllerToImplementationMap even though there
+ // may be another object that "references" to it.
+ ControllerToImplementationMap::iterator iImplementation (
+ maControllerToImplementationMap.find(mxController));
+ if (iImplementation != maControllerToImplementationMap.end())
+ maControllerToImplementationMap.erase(iImplementation);
+
+ mxController.clear();
+}
+
+
+} } // end of namespace sd::sidebar
Added: openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.hxx?rev=1447641&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.hxx (added)
+++ openoffice/branches/sidebar/main/sd/source/ui/sidebar/SidebarFactory.hxx Tue Feb 19 09:09:02 2013
@@ -0,0 +1,153 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SD_SIDEBAR_FACTORY_HXX
+#define SD_SIDEBAR_FACTORY_HXX
+
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <rtl/ref.hxx>
+#include "framework/Pane.hxx"
+
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <map>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+namespace cssdf = ::com::sun::star::drawing::framework;
+
+
+namespace sd {
+ class ViewShellBase;
+}
+
+namespace sd { namespace sidebar {
+
+namespace
+{
+ typedef ::cppu::WeakComponentImplHelper4 <
+ css::lang::XInitialization,
+ css::ui::XUIElementFactory,
+ cssdf::XResourceFactory,
+ css::lang::XEventListener
+ > SidebarFactoryInterfaceBase;
+}
+
+
+/** This factory creates both XUIElements (for sidebar panels) and
+ a drawing framework pane.
+
+ The drawing framework pane is a container for the SidebarViewShell
+ which is necessary to run the legacy implementations of the task
+ pane panels.
+
+ Control and information flow is like this:
+
+ When one of the old task panels is requested to be displayed in
+ the sidebar this factory is called for
+ XUIElementFactory::createUIElement().
+ One of the arguments, the window, is then exported into the
+ drawing framework as pane. After this the drawing framework is
+ used to create the SidebarViewShell (once known as
+ TaskPaneViewShell or ToolPanelViewShell) and the requested panel.
+*/
+class SidebarFactory
+ : private ::boost::noncopyable,
+ private ::cppu::BaseMutex,
+ public SidebarFactoryInterfaceBase
+{
+public:
+ static ::rtl::OUString SAL_CALL getImplementationName (void);
+ static cssu::Reference<cssu::XInterface> SAL_CALL createInstance (
+ const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory);
+ static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void);
+
+ SidebarFactory (const cssu::Reference<cssu::XComponentContext>& rxContext);
+ virtual ~SidebarFactory (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);
+
+
+ // XUIElementFactory
+
+ cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
+ const ::rtl::OUString& rsResourceURL,
+ const ::cssu::Sequence<css::beans::PropertyValue>& rArguments)
+ throw(
+ css::container::NoSuchElementException,
+ css::lang::IllegalArgumentException,
+ cssu::RuntimeException);
+
+
+ // XResourceFactory
+
+ virtual css::uno::Reference<cssdf::XResource>
+ SAL_CALL createResource (
+ const css::uno::Reference<cssdf::XResourceId>& rxPaneId)
+ throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
+ virtual void SAL_CALL
+ releaseResource (
+ const css::uno::Reference<cssdf::XResource>& rxPane)
+ throw (css::uno::RuntimeException);
+
+
+ // XEventListener
+
+ virtual void SAL_CALL disposing (const ::css::lang::EventObject& rEvent)
+ throw(cssu::RuntimeException);
+
+private:
+ /** Due to the fact that this class is a factory for both
+ XUIElement and XResource objects, there are different
+ instantiations for the same XController although only one
+ would be really necessary. This map makes sure that the
+ different object have access to the same information.
+ */
+ class Implementation;
+ typedef ::boost::shared_ptr<Implementation> SharedImplementation;
+ typedef ::std::map<cssu::Reference<css::frame::XController>,SharedImplementation>
+ ControllerToImplementationMap;
+ static ControllerToImplementationMap maControllerToImplementationMap;
+ SharedImplementation mpImplementation;
+
+ static SharedImplementation GetImplementationForController (
+ const cssu::Reference<css::frame::XController>& rxController);
+};
+
+
+} } // end of namespace sd::sidebar
+
+#endif