summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-05-17 20:32:16 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-05-20 11:33:39 +0100
commit66a5cc468cef0c6db8b42b7f25367f04208e6f2e (patch)
treea9b84b17ac4f1dbd368a61ef056d23dda25af617
parent05f0eb57618d090fa45011120a907a3b1157accb (diff)
Only register and use the Sidebar if it is globally enabled.
-rw-r--r--include/sfx2/sidebar/SidebarChildWindow.hxx2
-rw-r--r--sc/source/ui/app/scdll.cxx2
-rw-r--r--sd/source/ui/app/sddll2.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx8
-rw-r--r--sfx2/source/view/viewfrm.cxx24
-rw-r--r--sw/source/ui/app/swmodule.cxx2
6 files changed, 35 insertions, 5 deletions
diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx
index 194f09893bac..0d9739d78cf1 100644
--- a/include/sfx2/sidebar/SidebarChildWindow.hxx
+++ b/include/sfx2/sidebar/SidebarChildWindow.hxx
@@ -39,6 +39,8 @@ public:
SfxBindings* pBindings,
SfxChildWinInfo* pInfo);
+ static void RegisterChildWindowIfEnabled (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0);
+
SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow);
static sal_Int32 GetDefaultWidth (Window* pWindow);
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 897a59f2e077..b31a45e74874 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -229,7 +229,7 @@ void ScDLL::Init()
// common SFX controller
::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod );
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(false, pMod);
// Svx-StatusBar-Controller
SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx
index d28257dcc0f7..78c78ea26b17 100644
--- a/sd/source/ui/app/sddll2.cxx
+++ b/sd/source/ui/app/sddll2.cxx
@@ -127,7 +127,7 @@ void SdDLL::RegisterControllers()
::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod);
::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod);
::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod);
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
SvxFillToolBoxControl::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index cb001ceaf4c5..dfaff1e416eb 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -22,6 +22,7 @@
#include "sfx2/sfxsids.hrc"
#include "helpid.hrc"
#include "sfx2/dockwin.hxx"
+#include "sfx2/viewfrm.hxx"
#include <sfx2/sidebar/ResourceDefinitions.hrc>
@@ -73,5 +74,12 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
return 0;
}
+void SidebarChildWindow::RegisterChildWindowIfEnabled (sal_Bool bVisible,
+ SfxModule *pMod,
+ sal_uInt16 nFlags)
+{
+ if ( SfxViewFrame::IsSidebarEnabled() )
+ RegisterChildWindow( bVisible, pMod, nFlags );
+}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b8a9fb6159c8..219f5dc0a3ed 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/ui/UIElementFactoryManager.hpp>
#include <toolkit/unohlp.hxx>
#include <vcl/splitwin.hxx>
@@ -3410,13 +3411,32 @@ bool SfxViewFrame::IsSidebarEnabled()
if (!bInitialized)
{
bInitialized = true;
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ xContext = ::comphelper::getProcessComponentContext();
try {
- bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get(
- comphelper::getProcessComponentContext());
+ bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get( xContext );
} catch (const uno::Exception &e) {
SAL_WARN("sfx2.view", "don't have experimental sidebar option installed");
}
+
+ // rip out the services from framework/ for good measure
+ if( !bEnabled )
+ {
+ try
+ {
+ uno::Reference< ui::XUIElementFactoryManager > xUIElementFactory = ui::UIElementFactoryManager::create( xContext );
+ xUIElementFactory->deregisterFactory( "toolpanel", "ScPanelFactory", "" );
+ xUIElementFactory->deregisterFactory( "toolpanel", "SwPanelFactory", "" );
+ xUIElementFactory->deregisterFactory( "toolpanel", "SvxPanelFactory", "" );
+ xUIElementFactory->deregisterFactory( "toolpanel", "SdPanelFactory", "" );
+ }
+ catch ( const uno::Exception &e )
+ {
+ SAL_WARN( "sfx2.view", "Exception de-registering sidebar factories " << e.Message );
+ }
+ }
}
+
return bEnabled;
}
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 126cea5d7352..fb53d186b249 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -400,7 +400,7 @@ void SwDLL::RegisterControls()
::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
::sfx2::TaskPaneWrapper::RegisterChildWindow(0, pMod);
}