summaryrefslogtreecommitdiff
path: root/sfx2
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 /sfx2
parent05f0eb57618d090fa45011120a907a3b1157accb (diff)
Only register and use the Sidebar if it is globally enabled.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx8
-rw-r--r--sfx2/source/view/viewfrm.cxx24
2 files changed, 30 insertions, 2 deletions
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;
}