Kaydet (Commit) 66a5cc46 authored tarafından Michael Meeks's avatar Michael Meeks

Only register and use the Sidebar if it is globally enabled.

üst 05f0eb57
...@@ -39,6 +39,8 @@ public: ...@@ -39,6 +39,8 @@ public:
SfxBindings* pBindings, SfxBindings* pBindings,
SfxChildWinInfo* pInfo); SfxChildWinInfo* pInfo);
static void RegisterChildWindowIfEnabled (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0);
SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow); SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow);
static sal_Int32 GetDefaultWidth (Window* pWindow); static sal_Int32 GetDefaultWidth (Window* pWindow);
......
...@@ -229,7 +229,7 @@ void ScDLL::Init() ...@@ -229,7 +229,7 @@ void ScDLL::Init()
// common SFX controller // common SFX controller
::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod ); ::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod );
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(false, pMod);
// Svx-StatusBar-Controller // Svx-StatusBar-Controller
SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod); SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
......
...@@ -127,7 +127,7 @@ void SdDLL::RegisterControllers() ...@@ -127,7 +127,7 @@ void SdDLL::RegisterControllers()
::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod);
::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod);
::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod);
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
SvxFillToolBoxControl::RegisterControl(0, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl::RegisterControl(0, pMod); SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "sfx2/sfxsids.hrc" #include "sfx2/sfxsids.hrc"
#include "helpid.hrc" #include "helpid.hrc"
#include "sfx2/dockwin.hxx" #include "sfx2/dockwin.hxx"
#include "sfx2/viewfrm.hxx"
#include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/ResourceDefinitions.hrc>
...@@ -73,5 +74,12 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow) ...@@ -73,5 +74,12 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
return 0; 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 } } // end of namespace sfx2::sidebar
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/ui/UIElementFactoryManager.hpp>
#include <toolkit/unohlp.hxx> #include <toolkit/unohlp.hxx>
#include <vcl/splitwin.hxx> #include <vcl/splitwin.hxx>
...@@ -3410,13 +3411,32 @@ bool SfxViewFrame::IsSidebarEnabled() ...@@ -3410,13 +3411,32 @@ bool SfxViewFrame::IsSidebarEnabled()
if (!bInitialized) if (!bInitialized)
{ {
bInitialized = true; bInitialized = true;
css::uno::Reference< css::uno::XComponentContext > xContext;
xContext = ::comphelper::getProcessComponentContext();
try { try {
bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get( bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get( xContext );
comphelper::getProcessComponentContext());
} catch (const uno::Exception &e) { } catch (const uno::Exception &e) {
SAL_WARN("sfx2.view", "don't have experimental sidebar option installed"); 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; return bEnabled;
} }
......
...@@ -400,7 +400,7 @@ void SwDLL::RegisterControls() ...@@ -400,7 +400,7 @@ void SwDLL::RegisterControls()
::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
::sfx2::TaskPaneWrapper::RegisterChildWindow(0, pMod); ::sfx2::TaskPaneWrapper::RegisterChildWindow(0, pMod);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment