add experimental option for sidebar to 'Advanced' pane.
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 8f7adca..1c03981 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<FixedText>("a11y")->GetText();
    m_sAddDialogText = get<FixedText>("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 07fa6be..b3e9c8e 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 ddfce7e..1c54497 100644
--- a/cui/uiconfig/ui/optadvancedpage.ui
+++ b/cui/uiconfig/ui/optadvancedpage.ui
@@ -340,6 +340,23 @@
                  </packing>
                </child>
                <child>
                  <object class="GtkCheckButton" id="exp_sidebar">
                    <property name="label" translatable="yes">Enable experimental sidebar (on restart)</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">False</property>
                    <property name="use_underline">True</property>
                    <property name="xalign">0</property>
                    <property name="draw_indicator">True</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">1</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkCheckButton" id="macrorecording">
                    <property name="label" translatable="yes">Enable macro recording</property>
                    <property name="visible">True</property>
@@ -350,7 +367,7 @@
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">1</property>
                    <property name="top_attach">2</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 522b471..c31681b 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 85c5b604..ca0b569 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 314ee5c..be586f7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5527,11 +5527,17 @@
      </prop>
      <prop oor:name="ExperimentalMode" oor:type="xs:boolean" oor:nillable="false">
        <info>
          <desc>Determins if various experimental, and potentially unstable
          <desc>Determines if various experimental, and potentially unstable
          features should be enabled in the user interface.</desc>
        </info>
        <value>false</value>
      </prop>
      <prop oor:name="ExperimentalSidebar" oor:type="xs:boolean" oor:nillable="false">
        <info>
          <desc>Determines if the experimental sidebar UI change should be enabled.</desc>
        </info>
        <value>false</value>
      </prop>
      <prop oor:name="MacroRecorderMode" oor:type="xs:boolean" oor:nillable="false">
        <info>
          <desc>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 240a94a..cd41764 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<frame::XController>& 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 ab98a7a..8851732 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -19,6 +19,7 @@

#include <osl/time.h>

#include "sfx2/viewfrm.hxx"
#include "framework/FrameworkHelper.hxx"

#include "framework/ConfigurationController.hxx"
@@ -608,6 +609,14 @@ Reference<XResourceId> 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<XResourceId> 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<XResourceId> 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<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
            Reference<XResourceId> 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 193468a..2b45781 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 <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx>

#include <comphelper/processfactory.hxx>
#include <comphelper/configuration.hxx>
#include "officecfg/Office/Common.hxx"

using namespace css;
using namespace cssu;
using namespace ::sd::framework;
@@ -71,6 +76,13 @@ Reference<lang::XEventListener> mxControllerDisposeListener;
Reference<XInterface> SAL_CALL PanelFactory_createInstance (
    const Reference<XComponentContext>& rxContext)
{
    bool bSidebar = SfxViewFrame::IsSidebarEnabled();
    if (!bSidebar)
    {
        SAL_WARN( "sd", "Creating a disabled sidebar factory" );
	return NULL;
    }

    return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext)));
}

@@ -205,3 +217,5 @@ Reference<ui::XUIElement> 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 4faf84f..801b08c 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -92,6 +92,10 @@
#include <svtools/svtresid.hxx>
#include <framework/framelistanalyzer.hxx>

#include <comphelper/processfactory.hxx>
#include <comphelper/configuration.hxx>
#include "officecfg/Office/Common.hxx"

#include <boost/optional.hpp>

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 ed509e0..4ac2f9f 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 <vcl/toolbox.hxx>

@@ -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 );