From 54d820a7815af03a248c1aa424fae9bf9a4881f4 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 17 May 2013 11:51:41 +0100 Subject: add experimental option for sidebar to 'Advanced' pane. --- cui/source/options/optjava.cxx | 12 ++++++-- cui/source/options/optjava.hxx | 1 + cui/uiconfig/ui/optadvancedpage.ui | 19 +++++++++++- include/sfx2/viewfrm.hxx | 3 ++ include/svtools/miscopt.hxx | 3 ++ .../schema/org/openoffice/Office/Common.xcs | 8 ++++- sd/source/ui/framework/module/ImpressModule.cxx | 10 ++++-- sd/source/ui/framework/tools/FrameworkHelper.cxx | 17 +++++++--- sd/source/ui/sidebar/PanelFactory.cxx | 14 +++++++++ sfx2/source/view/viewfrm.cxx | 24 +++++++++++++++ svtools/source/config/miscopt.cxx | 36 ++++++++++++++++++++-- 11 files changed, 135 insertions(+), 12 deletions(-) diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 8f7adca0dd97..1c03981a794d 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -144,6 +144,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet get(m_pParameterBtn, "parameters"); get(m_pClassPathBtn, "classpath"); get(m_pExperimentalCB, "experimental"); + get(m_pExpSidebarCB, "exp_sidebar"); get(m_pMacroCB, "macrorecording"); m_sAccessibilityText = get("a11y")->GetText(); m_sAddDialogText = get("selectruntime")->GetText(); @@ -622,6 +623,13 @@ sal_Bool SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ ) bModified = sal_True; } + if ( m_pExpSidebarCB->IsChecked() != m_pExpSidebarCB->GetSavedValue() ) + { + SvtMiscOptions aMiscOpt; + aMiscOpt.SetExperimentalSidebar( m_pExpSidebarCB->IsChecked() ); + bModified = sal_True; + } + if ( m_pMacroCB->IsChecked() != m_pMacroCB->GetSavedValue() ) { SvtMiscOptions aMiscOpt; @@ -629,8 +637,6 @@ sal_Bool SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ ) bModified = sal_True; } - - if ( m_pPathDlg ) { OUString sPath( m_pPathDlg->GetClassPath() ); @@ -716,6 +722,8 @@ void SvxJavaOptionsPage::Reset( const SfxItemSet& /*rSet*/ ) m_pExperimentalCB->Check( aMiscOpt.IsExperimentalMode() ); m_pExperimentalCB->SaveValue(); + m_pExpSidebarCB->Check( aMiscOpt.IsExperimentalSidebar() ); + m_pExpSidebarCB->SaveValue(); m_pMacroCB->Check( aMiscOpt.IsMacroRecorderMode() ); m_pMacroCB->SaveValue(); diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index 07fa6be1bfeb..b3e9c8ef3dad 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -65,6 +65,7 @@ private: Timer m_aResetTimer; CheckBox* m_pExperimentalCB; + CheckBox* m_pExpSidebarCB; CheckBox* m_pMacroCB; ::std::vector< JavaInfo* > diff --git a/cui/uiconfig/ui/optadvancedpage.ui b/cui/uiconfig/ui/optadvancedpage.ui index ddfce7e19a73..1c5449738d7c 100644 --- a/cui/uiconfig/ui/optadvancedpage.ui +++ b/cui/uiconfig/ui/optadvancedpage.ui @@ -339,6 +339,23 @@ 1 + + + Enable experimental sidebar (on restart) + True + True + False + True + 0 + True + + + 0 + 1 + 1 + 1 + + Enable macro recording @@ -350,7 +367,7 @@ 0 - 1 + 2 1 1 diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 522b4719eac0..c31681b2fd01 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -152,6 +152,9 @@ public: static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL ); + /// is the new sidebar enabled for the app as a whole ? + static bool IsSidebarEnabled(); + // interne Handler SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const; diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx index 85c5b604e689..ca0b569b12ad 100644 --- a/include/svtools/miscopt.hxx +++ b/include/svtools/miscopt.hxx @@ -109,6 +109,9 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options void SetExperimentalMode( sal_Bool bSet ); sal_Bool IsExperimentalMode() const; + void SetExperimentalSidebar( sal_Bool bSet ); + sal_Bool IsExperimentalSidebar() const; + void SetMacroRecorderMode( sal_Bool bSet ); sal_Bool IsMacroRecorderMode() const; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 314ee5c5c853..be586f7105fb 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5527,11 +5527,17 @@ - Determins if various experimental, and potentially unstable + Determines if various experimental, and potentially unstable features should be enabled in the user interface. false + + + Determines if the experimental sidebar UI change should be enabled. + + false + Determins if the limited, and awkward code producing diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index 240a94a23cf3..cd417647f5cb 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include "sfx2/viewfrm.hxx" #include "framework/ImpressModule.hxx" #include "framework/FrameworkHelper.hxx" @@ -45,9 +45,15 @@ void ImpressModule::Initialize (Reference& rxController) new SlideSorterModule( rxController, FrameworkHelper::msLeftImpressPaneURL); + + bool bSidebar = SfxViewFrame::IsSidebarEnabled(); new ToolPanelModule( rxController, - FrameworkHelper::msSidebarViewURL); + bSidebar ? FrameworkHelper::msSidebarViewURL : + FrameworkHelper::msTaskPaneURL, + bSidebar ? FrameworkHelper::msSidebarPaneURL : + FrameworkHelper::msRightPaneURL + ); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index ab98a7ac4779..88517327e1b1 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -19,6 +19,7 @@ #include +#include "sfx2/viewfrm.hxx" #include "framework/FrameworkHelper.hxx" #include "framework/ConfigurationController.hxx" @@ -608,6 +609,14 @@ Reference FrameworkHelper::RequestSidebarPanel ( const OUString& rsTaskPanelURL, const bool bEnsureTaskPaneIsVisible) { + OUString aViewURL, aPaneURL; + bool bSidebar = SfxViewFrame::IsSidebarEnabled(); + + aViewURL = bSidebar ? FrameworkHelper::msSidebarViewURL : + FrameworkHelper::msTaskPaneURL; + aPaneURL = bSidebar ? FrameworkHelper::msSidebarPaneURL : + FrameworkHelper::msRightPaneURL; + try { if (mxConfigurationController.is()) @@ -619,7 +628,7 @@ Reference FrameworkHelper::RequestSidebarPanel ( mxConfigurationController->getCurrentConfiguration()); if (xConfiguration.is()) if ( ! xConfiguration->hasResource( - CreateResourceId(msSidebarViewURL, msSidebarPaneURL))) + CreateResourceId(aViewURL, aPaneURL))) { // Task pane is not active. Do not force it. return NULL; @@ -629,12 +638,12 @@ Reference FrameworkHelper::RequestSidebarPanel ( // Create the resource id from URLs for the sidebar pane // and view and the requested panel. mxConfigurationController->requestResourceActivation( - CreateResourceId(msSidebarPaneURL), + CreateResourceId(aPaneURL), ResourceActivationMode_ADD); mxConfigurationController->requestResourceActivation( - CreateResourceId(msSidebarViewURL, msSidebarPaneURL), + CreateResourceId(aViewURL, aPaneURL), ResourceActivationMode_REPLACE); - Reference xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL)); + Reference xPanelId (CreateResourceId(rsTaskPanelURL, aViewURL, aPanelURL)); mxConfigurationController->requestResourceActivation( xPanelId, ResourceActivationMode_REPLACE); diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index 193468a3ff43..2b457819b28f 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -34,6 +35,10 @@ #include #include +#include +#include +#include "officecfg/Office/Common.hxx" + using namespace css; using namespace cssu; using namespace ::sd::framework; @@ -71,6 +76,13 @@ Reference mxControllerDisposeListener; Reference SAL_CALL PanelFactory_createInstance ( const Reference& rxContext) { + bool bSidebar = SfxViewFrame::IsSidebarEnabled(); + if (!bSidebar) + { + SAL_WARN( "sd", "Creating a disabled sidebar factory" ); + return NULL; + } + return Reference(static_cast(new PanelFactory(rxContext))); } @@ -205,3 +217,5 @@ Reference SAL_CALL PanelFactory::createUIElement ( } } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 4faf84fae3e9..801b08c2199d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -92,6 +92,10 @@ #include #include +#include +#include +#include "officecfg/Office/Common.hxx" + #include using namespace ::com::sun::star; @@ -3391,4 +3395,24 @@ void SfxViewFrame::RemoveInfoBar( const OUString& sId ) } } +bool SfxViewFrame::IsSidebarEnabled() +{ + static bool bInitialized = false; + static bool bEnabled = false; + + // read the setting once at start, and that's what we + // stick with for now. + if (!bInitialized) + { + bInitialized = true; + try { + bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get( + comphelper::getProcessComponentContext()); + } catch (const uno::Exception &e) { + SAL_WARN("sfx2.view", "don't have experimental sidebar option installed"); + } + } + return bEnabled; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index ed509e05dd1f..4ac2f9f14ff9 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -63,8 +63,10 @@ using namespace ::com::sun::star; #define PROPERTYHANDLE_ALWAYSALLOWSAVE 8 #define PROPERTYNAME_EXPERIMENTALMODE "ExperimentalMode" #define PROPERTYHANDLE_EXPERIMENTALMODE 9 -#define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode" +#define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode" #define PROPERTYHANDLE_MACRORECORDERMODE 10 +#define PROPERTYNAME_EXPERIMENTALSIDEBAR "ExperimentalSidebar" +#define PROPERTYHANDLE_EXPERIMENTALSIDEBAR 11 #define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from @@ -88,6 +90,7 @@ class SvtMiscOptions_Impl : public ConfigItem sal_Bool m_bDisableUICustomization; sal_Bool m_bAlwaysAllowSave; sal_Bool m_bExperimentalMode; + sal_Bool m_bExperimentalSidebar; sal_Bool m_bMacroRecorderMode; public: @@ -160,6 +163,12 @@ class SvtMiscOptions_Impl : public ConfigItem inline sal_Bool IsExperimentalMode() const { return m_bExperimentalMode; } + inline void SetExperimentalSidebar( sal_Bool bSet ) + { m_bExperimentalSidebar = bSet; SetModified(); } + + inline sal_Bool IsExperimentalSidebar() const + { return m_bExperimentalSidebar; } + inline void SetMacroRecorderMode( sal_Bool bSet ) { m_bMacroRecorderMode = bSet; SetModified(); } @@ -272,6 +281,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() , m_bIsShowLinkWarningDialogRO( sal_False ) , m_bAlwaysAllowSave( sal_False ) , m_bExperimentalMode( sal_False ) + , m_bExperimentalSidebar( sal_False ) , m_bMacroRecorderMode( sal_False ) { @@ -391,6 +401,12 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() OSL_FAIL("Wrong type of \"Misc\\MacroRecorderMode\"!" ); break; } + case PROPERTYHANDLE_EXPERIMENTALSIDEBAR : + { + if( !(seqValues[nProperty] >>= m_bExperimentalSidebar) ) + OSL_FAIL("Wrong type of \"Misc\\ExperimentalSidebar\"!" ); + break; + } } } @@ -673,6 +689,11 @@ void SvtMiscOptions_Impl::Commit() seqValues[nProperty] <<= m_bMacroRecorderMode; break; } + case PROPERTYHANDLE_EXPERIMENTALSIDEBAR : + { + seqValues[nProperty] <<= m_bExperimentalSidebar; + break; + } } } // Set properties in configuration. @@ -697,7 +718,8 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames() OUString(PROPERTYNAME_DISABLEUICUSTOMIZATION), OUString(PROPERTYNAME_ALWAYSALLOWSAVE), OUString(PROPERTYNAME_EXPERIMENTALMODE), - OUString(PROPERTYNAME_MACRORECORDERMODE) + OUString(PROPERTYNAME_MACRORECORDERMODE), + OUString(PROPERTYNAME_EXPERIMENTALSIDEBAR) }; // Initialize return sequence with these list ... @@ -878,6 +900,16 @@ sal_Bool SvtMiscOptions::IsExperimentalMode() const return m_pDataContainer->IsExperimentalMode(); } +void SvtMiscOptions::SetExperimentalSidebar( sal_Bool bSet ) +{ + m_pDataContainer->SetExperimentalSidebar( bSet ); +} + +sal_Bool SvtMiscOptions::IsExperimentalSidebar() const +{ + return m_pDataContainer->IsExperimentalSidebar(); +} + void SvtMiscOptions::SetMacroRecorderMode( sal_Bool bSet ) { m_pDataContainer->SetMacroRecorderMode( bSet ); -- cgit