[Libreoffice-commits] core.git: chart2/source extras/source include/sfx2 include/svx include/vcl sc/source sc/uiconfig sd/inc sd/source sd/uiconfig sfx2/inc sfx2/Library_sfx.mk sfx2/source sfx2/uiconfig svx/inc svx/source sw/inc sw/source sw/uiconfig vcl/Library_vcl.mk vcl/source

Szymon Kłos eszkadev at gmail.com
Mon Jun 27 17:52:27 UTC 2016


 chart2/source/controller/main/ChartController.cxx       |    2 
 chart2/source/controller/sidebar/ChartAxisPanel.cxx     |    2 
 chart2/source/controller/sidebar/ChartAxisPanel.hxx     |    2 
 chart2/source/controller/sidebar/ChartElementsPanel.cxx |    2 
 chart2/source/controller/sidebar/ChartElementsPanel.hxx |    4 
 chart2/source/controller/sidebar/ChartErrorBarPanel.cxx |    2 
 chart2/source/controller/sidebar/ChartErrorBarPanel.hxx |    2 
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx   |    2 
 chart2/source/controller/sidebar/ChartSeriesPanel.hxx   |    2 
 extras/source/glade/libreoffice-catalog.xml.in          |    3 
 include/sfx2/notebookbar/SfxNotebookBar.hxx             |    2 
 include/sfx2/sidebar/DeckDescriptor.hxx                 |    2 
 include/sfx2/sidebar/EnumContext.hxx                    |  167 -----------
 include/sfx2/sidebar/IContextChangeReceiver.hxx         |    4 
 include/sfx2/sidebar/PanelDescriptor.hxx                |    2 
 include/sfx2/sidebar/SidebarPanelBase.hxx               |    2 
 include/sfx2/sidebar/TabBar.hxx                         |    1 
 include/svx/ParaLineSpacingPopup.hxx                    |    2 
 include/svx/ParaSpacingControl.hxx                      |    1 
 include/svx/sidebar/ContextChangeEventMultiplexer.hxx   |    6 
 include/svx/sidebar/SelectionAnalyzer.hxx               |   10 
 include/svx/sidebar/SelectionChangeHandler.hxx          |    6 
 include/vcl/EnumContext.hxx                             |  167 +++++++++++
 include/vcl/builder.hxx                                 |    4 
 include/vcl/contexttabctrl.hxx                          |   39 ++
 include/vcl/notebookbar.hxx                             |   20 +
 include/vcl/tabctrl.hxx                                 |    2 
 include/vcl/tabpage.hxx                                 |    6 
 sc/source/ui/drawfunc/chartsh.cxx                       |    4 
 sc/source/ui/drawfunc/drawsh2.cxx                       |    6 
 sc/source/ui/drawfunc/drformsh.cxx                      |    4 
 sc/source/ui/drawfunc/drtxtob.cxx                       |    4 
 sc/source/ui/drawfunc/graphsh.cxx                       |    4 
 sc/source/ui/drawfunc/mediash.cxx                       |    4 
 sc/source/ui/drawfunc/oleobjsh.cxx                      |    4 
 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx         |    2 
 sc/source/ui/sidebar/AlignmentPropertyPanel.hxx         |    4 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx    |    2 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx    |    4 
 sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx      |    2 
 sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx      |    4 
 sc/source/ui/view/auditsh.cxx                           |    4 
 sc/source/ui/view/cellsh.cxx                            |    4 
 sc/source/ui/view/editsh.cxx                            |    4 
 sc/source/ui/view/pivotsh.cxx                           |    4 
 sc/source/ui/view/tabvwsh4.cxx                          |    2 
 sc/uiconfig/scalc/ui/notebookbar.ui                     |    2 
 sd/inc/pch/precompiled_sd.hxx                           |    2 
 sd/source/ui/sidebar/SlideBackground.cxx                |   10 
 sd/source/ui/sidebar/SlideBackground.hxx                |    4 
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx |    4 
 sd/source/ui/table/tableobjectbar.cxx                   |    4 
 sd/source/ui/unoidl/DrawController.cxx                  |    4 
 sd/source/ui/view/drviewsa.cxx                          |    4 
 sd/source/ui/view/outlnvsh.cxx                          |    4 
 sd/source/ui/view/sdview.cxx                            |    2 
 sd/uiconfig/simpress/ui/notebookbar.ui                  |    2 
 sfx2/Library_sfx.mk                                     |    1 
 sfx2/inc/pch/precompiled_sfx.hxx                        |    2 
 sfx2/source/notebookbar/SfxNotebookBar.cxx              |   39 ++
 sfx2/source/sidebar/ContextChangeBroadcaster.cxx        |    4 
 sfx2/source/sidebar/EnumContext.cxx                     |  232 ----------------
 sfx2/source/sidebar/ResourceManager.cxx                 |   46 +--
 sfx2/source/sidebar/SidebarController.cxx               |    4 
 sfx2/source/sidebar/SidebarPanelBase.cxx                |    6 
 sfx2/uiconfig/ui/notebookbar.ui                         |    2 
 svx/inc/pch/precompiled_svx.hxx                         |    2 
 svx/source/sidebar/ContextChangeEventMultiplexer.cxx    |   10 
 svx/source/sidebar/PanelFactory.cxx                     |    2 
 svx/source/sidebar/SelectionAnalyzer.cxx                |    2 
 svx/source/sidebar/SelectionChangeHandler.cxx           |   12 
 svx/source/sidebar/line/LinePropertyPanel.cxx           |    2 
 svx/source/sidebar/line/LinePropertyPanel.hxx           |    4 
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx      |    4 
 svx/source/sidebar/paragraph/ParaPropertyPanel.hxx      |    4 
 svx/source/sidebar/paragraph/ParaSpacingControl.cxx     |    6 
 svx/source/sidebar/paragraph/ParaSpacingWindow.cxx      |    2 
 svx/source/sidebar/paragraph/ParaSpacingWindow.hxx      |    6 
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx     |    2 
 svx/source/sidebar/possize/PosSizePropertyPanel.hxx     |    4 
 svx/source/sidebar/styles/StylesPropertyPanel.hxx       |    2 
 svx/source/sidebar/text/TextPropertyPanel.cxx           |    6 
 svx/source/sidebar/text/TextPropertyPanel.hxx           |   10 
 sw/inc/pch/precompiled_sw.hxx                           |    2 
 sw/source/uibase/shells/annotsh.cxx                     |    4 
 sw/source/uibase/shells/beziersh.cxx                    |    4 
 sw/source/uibase/shells/drawsh.cxx                      |    4 
 sw/source/uibase/shells/drformsh.cxx                    |    4 
 sw/source/uibase/shells/drwtxtsh.cxx                    |    4 
 sw/source/uibase/shells/frmsh.cxx                       |    4 
 sw/source/uibase/shells/grfsh.cxx                       |    4 
 sw/source/uibase/shells/mediash.cxx                     |    4 
 sw/source/uibase/shells/olesh.cxx                       |    4 
 sw/source/uibase/shells/tabsh.cxx                       |    4 
 sw/source/uibase/shells/textsh.cxx                      |    4 
 sw/uiconfig/swriter/ui/notebookbar.ui                   |   21 -
 vcl/Library_vcl.mk                                      |    2 
 vcl/source/control/contexttabctrl.cxx                   |   54 +++
 vcl/source/control/notebookbar.cxx                      |   29 ++
 vcl/source/control/tabctrl.cxx                          |   26 +
 vcl/source/window/EnumContext.cxx                       |  232 ++++++++++++++++
 vcl/source/window/builder.cxx                           |   78 +++++
 vcl/source/window/tabpage.cxx                           |   20 +
 103 files changed, 897 insertions(+), 601 deletions(-)

New commits:
commit 1df394503f1e62b091453c95c05a212892ae8d58
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Fri Jun 17 23:54:00 2016 +0200

    GSoC notebookbar: switching tabs depending on context
    
    + sfx2::sidebar::EnumContext moved to the vcl module
    + TabPage contains vector with context values
    + vcl builder reads control's contexts from the "class" mark
    + ContextTabControl shows tabs depending on context
    
    Change-Id: I661b0d3f35d46ace2a2e8eb1d374148f0c60017d
    Reviewed-on: https://gerrit.libreoffice.org/26447
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 5085223..974d52d 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -121,7 +121,7 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
     m_eDrawMode( CHARTDRAW_SELECT ),
     mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
             [this]() { return this->GetContextName(); },
-                this, sfx2::sidebar::EnumContext::Context_Cell))
+                this, vcl::EnumContext::Context_Cell))
 {
     m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) );
 }
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index be80a4c..ac0d6f4 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -310,7 +310,7 @@ void ChartAxisPanel::DataChanged(
 }
 
 void ChartAxisPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& )
+    const vcl::EnumContext& )
 {
     updateData();
 }
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index d84f005..6cb9ec7 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -50,7 +50,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 1e52f24..5a8625b 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -501,7 +501,7 @@ void ChartElementsPanel::DataChanged(
 }
 
 void ChartElementsPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if(maContext == rContext)
     {
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index e336c82..43565de 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -54,7 +54,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     // constructor/destuctor
     ChartElementsPanel(
@@ -98,7 +98,7 @@ private:
     VclPtr<ListBox> mpLBLegendPosition;
     VclPtr<VclHBox> mpBoxLegend;
 
-    ::sfx2::sidebar::EnumContext            maContext;
+    vcl::EnumContext maContext;
 
     css::uno::Reference<css::frame::XModel> mxModel;
     css::uno::Reference<css::util::XModifyListener> mxListener;
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 401e7cf..248b9e7 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -374,7 +374,7 @@ void ChartErrorBarPanel::DataChanged(
 }
 
 void ChartErrorBarPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& )
+    const vcl::EnumContext& )
 {
     updateData();
 }
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 6beb6ae..cff8398 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -48,7 +48,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index b2a71cc..7147dda 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -408,7 +408,7 @@ void ChartSeriesPanel::DataChanged(
 }
 
 void ChartSeriesPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& )
+    const vcl::EnumContext& )
 {
     updateData();
 }
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 72928b7..f9465c3 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -58,7 +58,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index e1117ed..3b322ae 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -804,5 +804,8 @@
     <glade-widget-class title="Show Text" name="cuilo-SvxShowText"
                         generic-name="ShowText" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Notebookbar with context" name="vcllo-ContextTabControl"
+                        generic-name="ContextTabControl" parent="GtkNotebook"
+                        icon-name="widget-gtk-notebook"/>
   </glade-widget-classes>
 </glade-catalog>
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 156d616..1b79c78 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -29,6 +29,8 @@ public:
     static void StateMethod(SystemWindow* pSysWindow,
                             const css::uno::Reference<css::frame::XFrame> xFrame,
                             const OUString& rUIFile);
+
+    static void RemoveListeners(SystemWindow* pSysWindow);
 };
 
 } // namespace sfx2
diff --git a/include/sfx2/sidebar/DeckDescriptor.hxx b/include/sfx2/sidebar/DeckDescriptor.hxx
index 8c1b9ef..a262562 100644
--- a/include/sfx2/sidebar/DeckDescriptor.hxx
+++ b/include/sfx2/sidebar/DeckDescriptor.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX
 #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKDESCRIPTOR_HXX
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include "ContextList.hxx"
 
 #include <sfx2/sidebar/Deck.hxx>
diff --git a/include/sfx2/sidebar/IContextChangeReceiver.hxx b/include/sfx2/sidebar/IContextChangeReceiver.hxx
index ea5c24a..b8f6512 100644
--- a/include/sfx2/sidebar/IContextChangeReceiver.hxx
+++ b/include/sfx2/sidebar/IContextChangeReceiver.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SFX2_SIDEBAR_ICONTEXTCHANGERECEIVER_HXX
 #define INCLUDED_SFX2_SIDEBAR_ICONTEXTCHANGERECEIVER_HXX
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/dllapi.h>
 
 
@@ -31,7 +31,7 @@ class SFX2_DLLPUBLIC IContextChangeReceiver
 public:
     virtual ~IContextChangeReceiver ();
 
-    virtual void HandleContextChange (const EnumContext& rContext) = 0;
+    virtual void HandleContextChange (const vcl::EnumContext& rContext) = 0;
 };
 
 } } // end of namespace ::sd::sidebar
diff --git a/include/sfx2/sidebar/PanelDescriptor.hxx b/include/sfx2/sidebar/PanelDescriptor.hxx
index 2e1abb2..f62076e 100644
--- a/include/sfx2/sidebar/PanelDescriptor.hxx
+++ b/include/sfx2/sidebar/PanelDescriptor.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX
 #define INCLUDED_SFX2_SOURCE_SIDEBAR_PANELDESCRIPTOR_HXX
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/sidebar/ContextList.hxx>
 
 namespace sfx2 { namespace sidebar {
diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
index 41e1534..606d65c 100644
--- a/include/sfx2/sidebar/SidebarPanelBase.hxx
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SFX2_SIDEBAR_SIDEBARPANELBASE_HXX
 #define INCLUDED_SFX2_SIDEBAR_SIDEBARPANELBASE_HXX
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
 
 #include <cppuhelper/compbase5.hxx>
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 5a8c0cd..a805a94 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
 #define INCLUDED_SFX2_SOURCE_SIDEBAR_TABBAR_HXX
 
+#include <sfx2//dllapi.h>
 #include "DeckDescriptor.hxx"
 #include <sfx2/sidebar/ResourceManager.hxx>
 
diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx
index 19bbfd4..c9f761c 100644
--- a/include/svx/ParaLineSpacingPopup.hxx
+++ b/include/svx/ParaLineSpacingPopup.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGPOPUP_HXX
 
 #include <editeng/lspcitem.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/tbxctrl.hxx>
 #include <svl/poolitem.hxx>
 #include <svx/svxdllapi.h>
diff --git a/include/svx/ParaSpacingControl.hxx b/include/svx/ParaSpacingControl.hxx
index 03e7cf9..b4e287c 100644
--- a/include/svx/ParaSpacingControl.hxx
+++ b/include/svx/ParaSpacingControl.hxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
-#include <sfx2/sidebar/EnumContext.hxx>
 
 namespace svx {
 
diff --git a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
index d5cb391..9b94e90 100644
--- a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
+++ b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX
 
 #include <svx/svxdllapi.h>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
 
@@ -41,7 +41,7 @@ public:
     */
     static void NotifyContextChange (
         const css::uno::Reference<css::frame::XController>& rxController,
-        const ::sfx2::sidebar::EnumContext::Context eContext);
+        const vcl::EnumContext::Context eContext);
 
     /** Notify the activation of a context.
         @param pViewShell
@@ -53,7 +53,7 @@ public:
     */
     static void NotifyContextChange (
         SfxViewShell* pViewShell,
-        const ::sfx2::sidebar::EnumContext::Context eContext);
+        const vcl::EnumContext::Context eContext);
 
 private:
     static ::rtl::OUString GetModuleName (
diff --git a/include/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx
index 62c4116..e80f5db 100644
--- a/include/svx/sidebar/SelectionAnalyzer.hxx
+++ b/include/svx/sidebar/SelectionAnalyzer.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX
 #define INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/svxdllapi.h>
 
 class SdrMarkList;
@@ -36,7 +36,7 @@ namespace svx { namespace sidebar {
 class SVX_DLLPUBLIC SelectionAnalyzer
 {
 public:
-    static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC (
+    static vcl::EnumContext::Context GetContextForSelection_SC (
         const SdrMarkList& rMarkList);
 
     enum ViewType
@@ -47,14 +47,14 @@ public:
         VT_Notes,
         VT_Outline
     };
-    static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD (
+    static vcl::EnumContext::Context GetContextForSelection_SD (
         const SdrMarkList& rMarkList,
         const ViewType eViewType);
 
 private:
-    static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC (
+    static vcl::EnumContext::Context GetContextForObjectId_SC (
         const sal_uInt16 nObjectId);
-    static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD (
+    static vcl::EnumContext::Context GetContextForObjectId_SD (
         const sal_uInt16 nObjectId,
         const ViewType eViewType);
     static sal_uInt32 GetInventorTypeFromMark (
diff --git a/include/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx
index 841ab32..38d72ab 100644
--- a/include/svx/sidebar/SelectionChangeHandler.hxx
+++ b/include/svx/sidebar/SelectionChangeHandler.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX
 
 #include <svx/svxdllapi.h>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <com/sun/star/view/XSelectionChangeListener.hpp>
@@ -50,7 +50,7 @@ public:
     SelectionChangeHandler (
         const std::function<rtl::OUString ()>& rSelectionChangeCallback,
         const css::uno::Reference<css::frame::XController>& rxController,
-        const sfx2::sidebar::EnumContext::Context eDefaultContext);
+        const vcl::EnumContext::Context eDefaultContext);
     virtual ~SelectionChangeHandler();
 
     virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent)
@@ -71,7 +71,7 @@ private:
 
     const std::function<rtl::OUString ()> maSelectionChangeCallback;
     css::uno::Reference<css::frame::XController> mxController;
-    const sfx2::sidebar::EnumContext::Context meDefaultContext;
+    const vcl::EnumContext::Context meDefaultContext;
     bool mbIsConnected;
 };
 
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/vcl/EnumContext.hxx
similarity index 92%
rename from include/sfx2/sidebar/EnumContext.hxx
rename to include/vcl/EnumContext.hxx
index 2dfa5a2..cb48266 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/vcl/EnumContext.hxx
@@ -16,19 +16,19 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_SFX2_SIDEBAR_ENUMCONTEXT_HXX
-#define INCLUDED_SFX2_SIDEBAR_ENUMCONTEXT_HXX
+#ifndef INCLUDED_VCL_ENUMCONTEXT_HXX
+#define INCLUDED_VCL_ENUMCONTEXT_HXX
 
-#include <sfx2/dllapi.h>
+#include <vcl/dllapi.h>
 
 #include <rtl/ustring.hxx>
 
 #include <vector>
 
 
-namespace sfx2 { namespace sidebar {
+namespace vcl {
 
-class SFX2_DLLPUBLIC EnumContext
+class VCL_DLLPUBLIC EnumContext
 {
 public:
     enum Application
@@ -157,10 +157,10 @@ private:
 };
 
 
-#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::a)<<16)\
-        | static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::e))
+#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::vcl::EnumContext::a)<<16)\
+        | static_cast<sal_uInt16>(::vcl::EnumContext::e))
 
-} } // end of namespace sfx2::sidebar
+} // end of namespace vcl
 
 #endif
 
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 8c50fee..353d818 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -18,6 +18,8 @@
 #include <vcl/dllapi.h>
 #include <vcl/window.hxx>
 #include <vcl/vclptr.hxx>
+#include <tools/wintypes.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include <memory>
 #include <map>
@@ -349,6 +351,8 @@ private:
     void        handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader);
     VclPtr<vcl::Window> handleObject(vcl::Window *pParent, xmlreader::XmlReader &reader);
     void        handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
+    std::vector<vcl::EnumContext::Context>    handleStyle(xmlreader::XmlReader &reader);
+    vcl::EnumContext::Context    getContext(xmlreader::XmlReader &reader);
     void        applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
     void        collectProperty(xmlreader::XmlReader &reader, const OString &rID, stringmap &rVec);
     static void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap);
diff --git a/include/vcl/contexttabctrl.hxx b/include/vcl/contexttabctrl.hxx
new file mode 100644
index 0000000..452d9f3
--- /dev/null
+++ b/include/vcl/contexttabctrl.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CONTEXTTABCTRL_HXX
+#define INCLUDED_VCL_CONTEXTTABCTRL_HXX
+
+#include <vcl/EnumContext.hxx>
+#include <vcl/tabctrl.hxx>
+
+class VCL_DLLPUBLIC ContextTabControl : public TabControl
+{
+public:
+    ContextTabControl( vcl::Window* pParent, WinBits nStyle = WB_STDTABCONTROL );
+
+    void SetContext( vcl::EnumContext::Context eContext );
+
+private:
+    vcl::EnumContext::Context eLastContext;
+};
+
+#endif // INCLUDED_VCL_TABCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx
index 9dd7e9f..37fa7ee 100644
--- a/include/vcl/notebookbar.hxx
+++ b/include/vcl/notebookbar.hxx
@@ -12,9 +12,13 @@
 
 #include <vcl/builder.hxx>
 #include <vcl/ctrl.hxx>
+#include <vcl/contexttabctrl.hxx>
+#include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <vcl/EnumContext.hxx>
 
 /// This implements Widget Layout-based notebook-like menu bar.
-class NotebookBar : public Control, public VclBuilderContainer
+class NotebookBar : public Control, public VclBuilderContainer,
+                    public css::ui::XContextChangeEventListener
 {
 public:
     NotebookBar(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame);
@@ -25,6 +29,20 @@ public:
     virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE;
 
     virtual void StateChanged(StateChangedType nType) override;
+
+    // XContextChangeEventListener
+    virtual void SAL_CALL notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent)
+        throw (css::uno::RuntimeException, std::exception) override;
+
+    virtual ::css::uno::Any SAL_CALL queryInterface(const ::css::uno::Type& aType)
+        throw (::css::uno::RuntimeException, ::std::exception) override;
+    virtual void SAL_CALL acquire() throw () override;
+    virtual void SAL_CALL release() throw () override;
+    virtual void SAL_CALL disposing(const ::css::lang::EventObject&)
+        throw (::css::uno::RuntimeException, ::std::exception) override;
+
+private:
+    VclPtr<ContextTabControl> m_pTabControl;
 };
 
 #endif // INCLUDED_VCL_NOTEBOOKBAR_HXX
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 4b3e0e8..410cb2b 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -56,6 +56,7 @@ private:
     bool                mbRestoreHelpId;
     bool                mbSmallInvalidate;
     bool                mbLayoutDirty;
+    bool                mbHideDisabledTabs;
     Link<TabControl*,void> maActivateHdl;
     Link<TabControl*,bool> maDeactivateHdl;
 
@@ -125,6 +126,7 @@ public:
     void                RemovePage( sal_uInt16 nPageId );
     void                Clear();
     void                EnablePage( sal_uInt16 nPageId, bool bEnable = true );
+    void                HideDisabledTabs(bool bHide = true);
 
     sal_uInt16          GetPagePos( sal_uInt16 nPageId ) const;
     sal_uInt16          GetPageCount() const;
diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx
index b1c16e0..5a35901 100644
--- a/include/vcl/tabpage.hxx
+++ b/include/vcl/tabpage.hxx
@@ -35,6 +35,8 @@ private:
     SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void ImplInitSettings();
 
+    std::vector<vcl::EnumContext::Context> maContext;
+
 public:
     explicit        TabPage( vcl::Window* pParent, WinBits nStyle = 0 );
     explicit        TabPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription );
@@ -57,6 +59,10 @@ public:
     virtual void    SetPosPixel(const Point& rNewPos) override;
     virtual void    SetSizePixel(const Size& rNewSize) override;
     virtual Size    GetOptimalSize() const override;
+
+    void            SetContext( const std::vector<vcl::EnumContext::Context>& aContext );
+    bool            HasContext( const vcl::EnumContext::Context eContext ) const;
+    const std::vector<vcl::EnumContext::Context>& GetContext() const;
 };
 
 #endif // INCLUDED_VCL_TABPAGE_HXX
diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx
index 56cdadb..b07f8b9 100644
--- a/sc/source/ui/drawfunc/chartsh.cxx
+++ b/sc/source/ui/drawfunc/chartsh.cxx
@@ -25,7 +25,7 @@
 #include <sfx2/app.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <vcl/msgbox.hxx>
 
@@ -61,7 +61,7 @@ ScChartShell::ScChartShell(ScViewData* pData) :
 {
     SetHelpId( HID_SCSHELL_CHARTSH );
     SetName( "ChartObject" );
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Chart));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Chart));
 }
 
 ScChartShell::~ScChartShell()
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 6ee0f37..ca7f898 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -58,7 +58,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) :
     mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
             [this] () { return this->GetSidebarContextName(); },
             GetFrame()->GetFrame().GetController(),
-            sfx2::sidebar::EnumContext::Context_Cell))
+            vcl::EnumContext::Context_Cell))
 {
     SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() );
     ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
@@ -395,13 +395,13 @@ void ScDrawShell::Activate (const bool bMDI)
 
     ContextChangeEventMultiplexer::NotifyContextChange(
         GetFrame()->GetFrame().GetController(),
-        ::sfx2::sidebar::EnumContext::GetContextEnum(
+        vcl::EnumContext::GetContextEnum(
             GetSidebarContextName()));
 }
 
 ::rtl::OUString ScDrawShell::GetSidebarContextName()
 {
-    return sfx2::sidebar::EnumContext::GetContextName(
+    return vcl::EnumContext::GetContextName(
         svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
             GetDrawView()->GetMarkedObjectList()));
 }
diff --git a/sc/source/ui/drawfunc/drformsh.cxx b/sc/source/ui/drawfunc/drformsh.cxx
index bea35a8..28b5e4f 100644
--- a/sc/source/ui/drawfunc/drformsh.cxx
+++ b/sc/source/ui/drawfunc/drformsh.cxx
@@ -35,7 +35,7 @@
 #include "drawview.hxx"
 #include "scresid.hxx"
 #include <svx/svdobj.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #define ScDrawFormShell
 #include "scslots.hxx"
@@ -56,7 +56,7 @@ ScDrawFormShell::ScDrawFormShell(ScViewData* pData) :
 {
     SetHelpId(HID_SCSHELL_DRAWFORMSH);
     SetName("DrawForm");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Form));
 }
 
 ScDrawFormShell::~ScDrawFormShell()
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index f98b27d..4a305db 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -61,7 +61,7 @@
 
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include "sc.hrc"
 #include "globstr.hrc"
@@ -127,7 +127,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) :
 
     SetHelpId( HID_SCSHELL_DRTXTOB );
     SetName("DrawText");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_DrawText));
 }
 
 ScDrawTextObjectBar::~ScDrawTextObjectBar()
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index bf09e75..4176a5a 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -21,7 +21,7 @@
 #include <sfx2/app.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/opengrf.hxx>
 #include <svl/whiter.hxx>
 #include <svx/svdograf.hxx>
@@ -58,7 +58,7 @@ ScGraphicShell::ScGraphicShell(ScViewData* pData) :
 {
     SetHelpId(HID_SCSHELL_GRAPHIC);
     SetName("GraphicObject");
-        SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
+        SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Graphic));
 }
 
 ScGraphicShell::~ScGraphicShell()
diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx
index e89733a..4ddeec4 100644
--- a/sc/source/ui/drawfunc/mediash.cxx
+++ b/sc/source/ui/drawfunc/mediash.cxx
@@ -24,7 +24,7 @@
 #include <svl/whiter.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include "mediash.hxx"
 #include "sc.hrc"
@@ -50,7 +50,7 @@ ScMediaShell::ScMediaShell(ScViewData* pData) :
 {
     SetHelpId(HID_SCSHELL_MEDIA);
     SetName( OUString( ScResId( SCSTR_MEDIASHELL ) ) );
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Media));
 }
 
 ScMediaShell::~ScMediaShell()
diff --git a/sc/source/ui/drawfunc/oleobjsh.cxx b/sc/source/ui/drawfunc/oleobjsh.cxx
index 6c2ff3d..e3096eb 100644
--- a/sc/source/ui/drawfunc/oleobjsh.cxx
+++ b/sc/source/ui/drawfunc/oleobjsh.cxx
@@ -35,7 +35,7 @@
 #include "drawview.hxx"
 #include "scresid.hxx"
 #include <svx/svdobj.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #define ScOleObjectShell
 #include "scslots.hxx"
@@ -56,7 +56,7 @@ ScOleObjectShell::ScOleObjectShell(ScViewData* pData) :
 {
     SetHelpId(HID_SCSHELL_OLEOBEJCTSH);
     SetName("OleObject");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_OLE));
 }
 
 ScOleObjectShell::~ScOleObjectShell()
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 8762aad..463c90b 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -247,7 +247,7 @@ void AlignmentPropertyPanel::DataChanged(
 }
 
 void AlignmentPropertyPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
     {
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 1ae9b98..c5c0dea 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -50,7 +50,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -93,7 +93,7 @@ private:
     /// bitfield
     bool                                        mbMultiDisable : 1;
 
-    ::sfx2::sidebar::EnumContext                maContext;
+    vcl::EnumContext                            maContext;
     SfxBindings*                                mpBindings;
 
     DECL_LINK_TYPED( MFLeftIndentMdyHdl, Edit&, void );
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index e653c17..a425145 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -245,7 +245,7 @@ void CellAppearancePropertyPanel::DataChanged(
     (void)rEvent;
 }
 
-void CellAppearancePropertyPanel::HandleContextChange(const ::sfx2::sidebar::EnumContext& rContext)
+void CellAppearancePropertyPanel::HandleContextChange(const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
     {
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index f8cddae..1aefb2a 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -59,7 +59,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -136,7 +136,7 @@ private:
     std::unique_ptr< CellLineStylePopup > mpCellLineStylePopup;
     std::unique_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
 
-    ::sfx2::sidebar::EnumContext            maContext;
+    vcl::EnumContext                        maContext;
     SfxBindings*                            mpBindings;
 
     DECL_LINK_TYPED(TbxCellBorderSelectHdl, ToolBox*, void);
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 15bc8a1..1a70f32 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -169,7 +169,7 @@ void NumberFormatPropertyPanel::DataChanged(
 }
 
 void NumberFormatPropertyPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if(maContext == rContext)
     {
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index c6b2c82..7947cb7 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -46,7 +46,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -78,7 +78,7 @@ private:
 
     sal_Int32                               mnCategorySelected;
 
-    ::sfx2::sidebar::EnumContext            maContext;
+    vcl::EnumContext                        maContext;
     SfxBindings*                            mpBindings;
 
     DECL_LINK_TYPED(NumFormatSelectHdl, ListBox&, void);
diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx
index bba0b46..bc94dd0 100644
--- a/sc/source/ui/view/auditsh.cxx
+++ b/sc/source/ui/view/auditsh.cxx
@@ -23,7 +23,7 @@
 #include <sfx2/objface.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include "auditsh.hxx"
 #include "tabvwsh.hxx"
@@ -56,7 +56,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) :
     }
     SetHelpId( HID_SCSHELL_AUDIT );
     SetName("Auditing");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Auditing));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Auditing));
 }
 
 ScAuditingShell::~ScAuditingShell()
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index f609e15..667c869 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -33,7 +33,7 @@
 #include <sfx2/objface.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/clipfmtitem.hxx>
 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <editeng/langitem.hxx>
@@ -80,7 +80,7 @@ ScCellShell::ScCellShell(ScViewData* pData) :
 {
     SetHelpId(HID_SCSHELL_CELLSH);
     SetName("Cell");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Cell));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Cell));
 }
 
 ScCellShell::~ScCellShell()
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 864f1ab..7953fc5 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -36,7 +36,7 @@
 #include <editeng/flstitem.hxx>
 #include <editeng/fontitem.hxx>
 #include <svx/hlnkitem.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/scripttypeitem.hxx>
 #include <editeng/shdditem.hxx>
@@ -99,7 +99,7 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) :
     SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
     SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
     SetName("EditCell");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_EditCell));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_EditCell));
 }
 
 ScEditShell::~ScEditShell()
diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx
index b5c1383..13899b2 100644
--- a/sc/source/ui/view/pivotsh.cxx
+++ b/sc/source/ui/view/pivotsh.cxx
@@ -25,7 +25,7 @@
 #include <sfx2/request.hxx>
 #include <svl/whiter.hxx>
 #include <vcl/msgbox.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include "sc.hrc"
 #include "pivotsh.hxx"
@@ -65,7 +65,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) :
     }
     SetHelpId( HID_SCSHELL_PIVOTSH );
     SetName("Pivot");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Pivot));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Pivot));
 }
 
 ScPivotShell::~ScPivotShell()
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index d143030..caa945a 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -214,7 +214,7 @@ void ScTabViewShell::Activate(bool bMDI)
 
     ContextChangeEventMultiplexer::NotifyContextChange(
         GetController(),
-        ::sfx2::sidebar::EnumContext::Context_Default);
+        vcl::EnumContext::Context_Default);
 }
 
 void ScTabViewShell::Deactivate(bool bMDI)
diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui
index 8b75850..cf72d70 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -157,7 +157,7 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="vcllo-ContextTabControl" id="notebook1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index f687662..2d4b069 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -91,6 +91,7 @@
 #include <vcl/dndhelp.hxx>
 #include <vcl/dockwin.hxx>
 #include <vcl/edit.hxx>
+#include <vcl/EnumContext.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/fntstyle.hxx>
@@ -355,7 +356,6 @@
 #include <sfx2/printer.hxx>
 #include <sfx2/progress.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/sidebar/Sidebar.hxx>
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <sfx2/sidebar/Theme.hxx>
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index 10a6c91..26f1dfd 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -160,7 +160,7 @@ void SlideBackground::Initialize()
 }
 
 void SlideBackground::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
         return;
@@ -371,10 +371,10 @@ IMPL_LINK_TYPED(SlideBackground, EventMultiplexerListener,
         {
             if(!mbTitle)
             {
-                sfx2::sidebar::EnumContext rDrawContext(sfx2::sidebar::EnumContext::Application_Draw,
-                                                        sfx2::sidebar::EnumContext::Context_DrawPage);
-                sfx2::sidebar::EnumContext rImpressContext(sfx2::sidebar::EnumContext::Application_Impress,
-                                                        sfx2::sidebar::EnumContext::Context_DrawPage);
+                vcl::EnumContext rDrawContext(vcl::EnumContext::Application_Draw,
+                                              vcl::EnumContext::Context_DrawPage);
+                vcl::EnumContext rImpressContext(vcl::EnumContext::Application_Impress,
+                                                 vcl::EnumContext::Context_DrawPage);
                 if(maContext == rDrawContext)
                 {
                     SetPanelTitle(SD_RESSTR(STR_PAGE_NAME));
diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx
index 1fba18a..0848e56 100644
--- a/sd/source/ui/sidebar/SlideBackground.hxx
+++ b/sd/source/ui/sidebar/SlideBackground.hxx
@@ -69,7 +69,7 @@ public:
         const SfxPoolItem* pState,
         const bool bIsEnabled) override;
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
 private:
 
@@ -105,7 +105,7 @@ private:
     bool mbEditModeChangePending;
 
     css::uno::Reference<css::frame::XFrame> mxFrame;
-    ::sfx2::sidebar::EnumContext            maContext;
+    vcl::EnumContext maContext;
     bool         mbTitle;
     SfxBindings* mpBindings;
 
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 50fa6a7..25f0810 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -60,7 +60,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <svx/svxids.hrc>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <svx/sidebar/SelectionAnalyzer.hxx>
 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
@@ -77,7 +77,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing::framework;
 
 using ::sd::framework::FrameworkHelper;
-using ::sfx2::sidebar::EnumContext;
+using ::vcl::EnumContext;
 
 namespace sd { namespace slidesorter {
 
diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx
index ded39a1..c52b271 100644
--- a/sd/source/ui/table/tableobjectbar.cxx
+++ b/sd/source/ui/table/tableobjectbar.cxx
@@ -25,7 +25,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/msgpool.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <svl/itempool.hxx>
 #include <svx/svdomedia.hxx>
@@ -93,7 +93,7 @@ TableObjectBar::TableObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView )
     SetRepeatTarget( mpView );
     SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR );
     SetName( SD_RESSTR( RID_DRAW_TABLE_TOOLBOX ) );
-    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
+    SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Table));
 }
 
 TableObjectBar::~TableObjectBar()
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
index 8f9c46e..645a680 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -45,7 +45,7 @@
 #include <svx/fmshell.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 
 #include <memory>
@@ -55,7 +55,7 @@ using namespace ::cppu;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing::framework;
-using ::sfx2::sidebar::EnumContext;
+using vcl::EnumContext;
 
 namespace sd {
 
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2e79b86..6e78e3e 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -73,7 +73,7 @@
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
-using sfx2::sidebar::EnumContext;
+using vcl::EnumContext;
 
 namespace sd {
 
@@ -115,7 +115,7 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
     , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
           [this] () { return this->GetSidebarContextName(); },
           uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()),
-          sfx2::sidebar::EnumContext::Context_Default))
+          vcl::EnumContext::Context_Default))
 {
     if (pFrameViewArgument != nullptr)
         mpFrameView = pFrameViewArgument;
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 44fe29a..7da4bd9 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -47,7 +47,7 @@
 #include <svl/itempool.hxx>
 #include <sfx2/tplpitem.hxx>
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/svdorect.hxx>
 #include <sot/formats.hxx>
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
@@ -203,7 +203,7 @@ OutlineViewShell::OutlineViewShell (
 
     Construct(GetDocSh());
 
-    SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText));
+    SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_OutlineText));
 
     m_StrOldPageName.clear();
 
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 95c3f56..df17d6c 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -46,7 +46,7 @@
 
 #include <svx/dialogs.hrc>
 #include <sfx2/viewfrm.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/svdopage.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <svx/xlndsit.hxx>
diff --git a/sd/uiconfig/simpress/ui/notebookbar.ui b/sd/uiconfig/simpress/ui/notebookbar.ui
index fafd7ef..da12749 100644
--- a/sd/uiconfig/simpress/ui/notebookbar.ui
+++ b/sd/uiconfig/simpress/ui/notebookbar.ui
@@ -147,7 +147,7 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="vcllo-ContextTabControl" id="notebook1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 2cbeb26..ad58c6f 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -261,7 +261,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/sidebar/DeckLayouter \
     sfx2/source/sidebar/DeckTitleBar \
     sfx2/source/sidebar/DrawHelper \
-    sfx2/source/sidebar/EnumContext \
     sfx2/source/sidebar/FocusManager \
     sfx2/source/sidebar/MenuButton \
     sfx2/source/sidebar/IContextChangeReceiver \
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index a6fda69..694aaa1 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -94,6 +94,7 @@
 #include <vcl/dibtools.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/edit.hxx>
+#include <vcl/EnumContext.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/floatwin.hxx>
 #include <vcl/font.hxx>
@@ -492,7 +493,6 @@
 #include <sfx2/sidebar/DeckDescriptor.hxx>
 #include <sfx2/sidebar/DeckTitleBar.hxx>
 #include <sfx2/sidebar/DrawHelper.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/sidebar/Paint.hxx>
 #include <sfx2/sidebar/Panel.hxx>
 #include <sfx2/sidebar/PanelTitleBar.hxx>
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index dd7a41c..5640e46 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -13,8 +13,14 @@
 #include <unotools/viewoptions.hxx>
 #include <vcl/notebookbar.hxx>
 #include <vcl/syswin.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
+#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
 
 using namespace sfx2;
+using namespace css::uno;
+using namespace css::ui;
 
 void SfxNotebookBar::ExecMethod(SfxBindings& rBindings)
 {
@@ -33,7 +39,7 @@ void SfxNotebookBar::StateMethod(SfxBindings& rBindings, const OUString& rUIFile
 }
 
 void SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
-                                 const css::uno::Reference<css::frame::XFrame> xFrame,
+                                 const Reference<css::frame::XFrame> xFrame,
                                  const OUString& rUIFile)
 {
     assert(pSysWindow);
@@ -42,13 +48,44 @@ void SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 
     if (aViewOpt.IsVisible())
     {
+        RemoveListeners(pSysWindow);
+
         // setup if necessary
         pSysWindow->SetNotebookBar(rUIFile, xFrame);
 
         pSysWindow->GetNotebookBar()->Show();
+
+        SfxViewFrame* pView = SfxViewFrame::Current();
+
+        if(pView)
+        {
+            Reference<XContextChangeEventMultiplexer> xMultiplexer
+                        = ContextChangeEventMultiplexer::get(
+                                ::comphelper::getProcessComponentContext());
+
+            if(xFrame.is() && xMultiplexer.is())
+            {
+                xMultiplexer->addContextChangeEventListener(
+                                    pSysWindow->GetNotebookBar().get(),
+                                    xFrame->getController());
+            }
+        }
     }
     else if (auto pNotebookBar = pSysWindow->GetNotebookBar())
         pNotebookBar->Hide();
 }
 
+void SfxNotebookBar::RemoveListeners(SystemWindow* pSysWindow)
+{
+    Reference<XContextChangeEventMultiplexer> xMultiplexer
+                        = ContextChangeEventMultiplexer::get(
+                                ::comphelper::getProcessComponentContext());
+
+    if (pSysWindow->GetNotebookBar() && xMultiplexer.is())
+    {
+        xMultiplexer->removeAllContextChangeEventListeners(
+                           pSysWindow->GetNotebookBar().get());
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
index 5ede4a5..0a1bbe0 100644
--- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
+++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include <sidebar/ContextChangeBroadcaster.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <com/sun/star/ui/ContextChangeEventObject.hpp>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
@@ -58,7 +58,7 @@ void ContextChangeBroadcaster::Deactivate (const css::uno::Reference<css::frame:
         BroadcastContextChange(
             rxFrame,
             GetModuleName(rxFrame),
-            EnumContext::GetContextName(EnumContext::Context_Default));
+            vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Default));
     }
 }
 
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 8958f3b..d6a51a0 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -466,42 +466,42 @@ void ResourceManager::ReadContextList (
         // application name may result in more than one value (eg
         // DrawImpress will result in two enums, one for Draw and one
         // for Impress).
-        std::vector<EnumContext::Application> aApplications;
-        EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName));
+        std::vector<vcl::EnumContext::Application> aApplications;
+        vcl::EnumContext::Application eApplication (vcl::EnumContext::GetApplicationEnum(sApplicationName));
 
-        if (eApplication == EnumContext::Application_None
-            && !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None)))
+        if (eApplication == vcl::EnumContext::Application_None
+            && !sApplicationName.equals(vcl::EnumContext::GetApplicationName(vcl::EnumContext::Application_None)))
         {
             // Handle some special names: abbreviations that make
             // context descriptions more readable.
             if (sApplicationName == "Writer")
-                aApplications.push_back(EnumContext::Application_Writer);
+                aApplications.push_back(vcl::EnumContext::Application_Writer);
             else if (sApplicationName == "Calc")
-                aApplications.push_back(EnumContext::Application_Calc);
+                aApplications.push_back(vcl::EnumContext::Application_Calc);
             else if (sApplicationName == "Draw")
-                aApplications.push_back(EnumContext::Application_Draw);
+                aApplications.push_back(vcl::EnumContext::Application_Draw);
             else if (sApplicationName == "Impress")
-                aApplications.push_back(EnumContext::Application_Impress);
+                aApplications.push_back(vcl::EnumContext::Application_Impress);
             else if (sApplicationName == "Chart")
-                aApplications.push_back(EnumContext::Application_Chart);
+                aApplications.push_back(vcl::EnumContext::Application_Chart);
             else if (sApplicationName == "DrawImpress")
             {
                 // A special case among the special names:  it is
                 // common to use the same context descriptions for
                 // both Draw and Impress.  This special case helps to
                 // avoid duplication in the .xcu file.
-                aApplications.push_back(EnumContext::Application_Draw);
-                aApplications.push_back(EnumContext::Application_Impress);
+                aApplications.push_back(vcl::EnumContext::Application_Draw);
+                aApplications.push_back(vcl::EnumContext::Application_Impress);
             }
             else if (sApplicationName == "WriterVariants")
             {
                 // Another special case for all Writer variants.
-                aApplications.push_back(EnumContext::Application_Writer);
-                aApplications.push_back(EnumContext::Application_WriterGlobal);
-                aApplications.push_back(EnumContext::Application_WriterWeb);
-                aApplications.push_back(EnumContext::Application_WriterXML);
-                aApplications.push_back(EnumContext::Application_WriterForm);
-                aApplications.push_back(EnumContext::Application_WriterReport);
+                aApplications.push_back(vcl::EnumContext::Application_Writer);
+                aApplications.push_back(vcl::EnumContext::Application_WriterGlobal);
+                aApplications.push_back(vcl::EnumContext::Application_WriterWeb);
+                aApplications.push_back(vcl::EnumContext::Application_WriterXML);
+                aApplications.push_back(vcl::EnumContext::Application_WriterForm);
+                aApplications.push_back(vcl::EnumContext::Application_WriterReport);
             }
             else
             {
@@ -516,8 +516,8 @@ void ResourceManager::ReadContextList (
         }
 
         // Setup the actual context enum.
-        const EnumContext::Context eContext (EnumContext::GetContextEnum(sContextName));
-        if (eContext == EnumContext::Context_Unknown)
+        const vcl::EnumContext::Context eContext (vcl::EnumContext::GetContextEnum(sContextName));
+        if (eContext == vcl::EnumContext::Context_Unknown)
         {
             SAL_WARN("sfx.sidebar", "context name " << sContextName << " not recognized");
             continue;
@@ -538,15 +538,15 @@ void ResourceManager::ReadContextList (
 
 
         // Add context descriptors.
-        std::vector<EnumContext::Application>::const_iterator iApplication;
+        std::vector<vcl::EnumContext::Application>::const_iterator iApplication;
         for (iApplication = aApplications.begin(); iApplication != aApplications.end(); ++iApplication)
         {
-            if (*iApplication != EnumContext::Application_None)
+            if (*iApplication != vcl::EnumContext::Application_None)
             {
                 rContextList.AddContextDescription(
                     Context(
-                        EnumContext::GetApplicationName(*iApplication),
-                        EnumContext::GetContextName(eContext)),
+                        vcl::EnumContext::GetApplicationName(*iApplication),
+                        vcl::EnumContext::GetContextName(eContext)),
                     bIsInitiallyVisible,
                     sMenuCommand);
             }
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 78de65d..4685bf6 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -683,14 +683,14 @@ void SidebarController::SwitchToDeck (
     if (aPanelContextDescriptors.empty())
     {
         // There are no panels to be displayed in the current context.
-        if (EnumContext::GetContextEnum(rContext.msContext) != EnumContext::Context_Empty)
+        if (vcl::EnumContext::GetContextEnum(rContext.msContext) != vcl::EnumContext::Context_Empty)
         {
             // Switch to the "empty" context and try again.
             SwitchToDeck(
                 rDeckDescriptor,
                 Context(
                     rContext.msApplication,
-                    EnumContext::GetContextName(EnumContext::Context_Empty)));
+                    vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Empty)));
             return;
         }
         else
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index e8ed312..ff77084 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -104,9 +104,9 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
         = dynamic_cast<IContextChangeReceiver*>(mpControl.get());
     if (pContextChangeReceiver != nullptr)
     {
-        const EnumContext aContext(
-            EnumContext::GetApplicationEnum(rEvent.ApplicationName),
-            EnumContext::GetContextEnum(rEvent.ContextName));
+        const vcl::EnumContext aContext(
+            vcl::EnumContext::GetApplicationEnum(rEvent.ApplicationName),
+            vcl::EnumContext::GetContextEnum(rEvent.ContextName));
         pContextChangeReceiver->HandleContextChange(aContext);
     }
 }
diff --git a/sfx2/uiconfig/ui/notebookbar.ui b/sfx2/uiconfig/ui/notebookbar.ui
index 1f7bf46..a0aa02e 100644
--- a/sfx2/uiconfig/ui/notebookbar.ui
+++ b/sfx2/uiconfig/ui/notebookbar.ui
@@ -11,7 +11,7 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="vcllo-ContextTabControl" id="notebook1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index d10895b..c1dff2d 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -91,6 +91,7 @@
 #include <vcl/dllapi.h>
 #include <vcl/dockwin.hxx>
 #include <vcl/edit.hxx>
+#include <vcl/EnumContext.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/floatwin.hxx>
@@ -331,7 +332,6 @@
 #include <sfx2/sfxuno.hxx>
 #include <sfx2/shell.hxx>
 #include <sfx2/sidebar/ControlFactory.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/sidebar/ResourceManager.hxx>
 #include <sfx2/sidebar/TabBar.hxx>
 #include <sfx2/sidebar/Theme.hxx>
diff --git a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
index 53f40f4..f8dbc13 100644
--- a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
+++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
@@ -33,14 +33,14 @@ using namespace css::uno;
 
 void ContextChangeEventMultiplexer::NotifyContextChange (
     const css::uno::Reference<css::frame::XController>& rxController,
-    const ::sfx2::sidebar::EnumContext::Context eContext)
+    const vcl::EnumContext::Context eContext)
 {
     if (rxController.is() && rxController->getFrame().is())
     {
         const css::ui::ContextChangeEventObject aEvent(
             rxController,
             GetModuleName(rxController->getFrame()),
-            ::sfx2::sidebar::EnumContext::GetContextName(eContext));
+            vcl::EnumContext::GetContextName(eContext));
 
         css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
             css::ui::ContextChangeEventMultiplexer::get(
@@ -53,7 +53,7 @@ void ContextChangeEventMultiplexer::NotifyContextChange (
 
 void ContextChangeEventMultiplexer::NotifyContextChange (
     SfxViewShell* pViewShell,
-    const ::sfx2::sidebar::EnumContext::Context eContext)
+    const vcl::EnumContext::Context eContext)
 {
     if (pViewShell != nullptr)
         NotifyContextChange(pViewShell->GetController(), eContext);
@@ -75,8 +75,8 @@ void ContextChangeEventMultiplexer::NotifyContextChange (
         // during initialization or destruction of a view.
         // Ignore it.
     }
-    return ::sfx2::sidebar::EnumContext::GetApplicationName(
-        ::sfx2::sidebar::EnumContext::Application_None);
+    return vcl::EnumContext::GetApplicationName(
+        vcl::EnumContext::Application_None);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 4b954ec..ceb4f68 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -114,7 +114,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
     Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
     const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
     SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
-    ::sfx2::sidebar::EnumContext aContext (
+    vcl::EnumContext aContext (
         aArguments.getOrDefault("ApplicationName", OUString()),
         aArguments.getOrDefault("ContextName", OUString()));
 
diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx
index a4c6dbf..df468fb 100644
--- a/svx/source/sidebar/SelectionAnalyzer.cxx
+++ b/svx/source/sidebar/SelectionAnalyzer.cxx
@@ -25,7 +25,7 @@
 #include "svx/fmglob.hxx"
 #include "svx/globl3d.hxx"
 
-using sfx2::sidebar::EnumContext;
+using vcl::EnumContext;
 
 
 namespace svx { namespace sidebar {
diff --git a/svx/source/sidebar/SelectionChangeHandler.cxx b/svx/source/sidebar/SelectionChangeHandler.cxx
index 2cc8cc9..76430af 100644
--- a/svx/source/sidebar/SelectionChangeHandler.cxx
+++ b/svx/source/sidebar/SelectionChangeHandler.cxx
@@ -21,21 +21,19 @@
 #include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
 #include "svx/svdmrkv.hxx"
 
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/shell.hxx>
 
 
 using namespace css;
 using namespace css::uno;
 
-using namespace sfx2::sidebar;
-
 namespace svx { namespace sidebar {
 
 SelectionChangeHandler::SelectionChangeHandler (
     const std::function<rtl::OUString()>& rSelectionChangeCallback,
     const Reference<css::frame::XController>& rxController,
-    const EnumContext::Context eDefaultContext)
+    const vcl::EnumContext::Context eDefaultContext)
     : SelectionChangeHandlerInterfaceBase(m_aMutex),
       maSelectionChangeCallback(rSelectionChangeCallback),
       mxController(rxController),
@@ -55,11 +53,11 @@ void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&
 {
     if (maSelectionChangeCallback)
     {
-        const EnumContext::Context eContext (
-            EnumContext::GetContextEnum(maSelectionChangeCallback()));
+        const vcl::EnumContext::Context eContext (
+            vcl::EnumContext::GetContextEnum(maSelectionChangeCallback()));
         ContextChangeEventMultiplexer::NotifyContextChange(
             mxController,
-            eContext==EnumContext::Context_Unknown
+            eContext==vcl::EnumContext::Context_Unknown
                 ? meDefaultContext
                 : eContext);
     }
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 9670e74..b5038bc 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -184,7 +184,7 @@ void LinePropertyPanel::NotifyItemUpdate(
 }
 
 void LinePropertyPanel::HandleContextChange(
-    const sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if(maContext == rContext)
     {
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 595cc45..19b2cdd 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -71,7 +71,7 @@ public:
         SfxBindings* pBindings);
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -113,7 +113,7 @@ private:
     sfx2::sidebar::ControllerItem maCapStyle;
 
     SfxBindings* mpBindings;
-    sfx2::sidebar::EnumContext maContext;
+    vcl::EnumContext maContext;
 
     void Initialize();
 };
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index b50c587..f5cdf2b 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -72,7 +72,7 @@ VclPtr<vcl::Window> ParaPropertyPanel::Create (
 }
 
 void ParaPropertyPanel::HandleContextChange (
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
     {
@@ -146,7 +146,7 @@ void ParaPropertyPanel::HandleContextChange (
             break;
     }
 
-    mpTBxOutline->Show( maContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_DrawImpress );
+    mpTBxOutline->Show( maContext.GetApplication_DI() == vcl::EnumContext::Application_DrawImpress );
 }
 
 void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index 50fde91..4b20474 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -56,7 +56,7 @@ public:
     SfxBindings* GetBindings() { return mpBindings;}
 
     virtual void HandleContextChange (
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -107,7 +107,7 @@ private:
     ::sfx2::sidebar::ControllerItem  maIncIndentControl;
     ::sfx2::sidebar::ControllerItem  m_aMetricCtl;
 
-    ::sfx2::sidebar::EnumContext maContext;
+    vcl::EnumContext maContext;
     SfxBindings* mpBindings;
     css::uno::Reference<css::ui::XSidebar> mxSidebar;
 
diff --git a/svx/source/sidebar/paragraph/ParaSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaSpacingControl.cxx
index 7822db1..e4dc5d0 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingControl.cxx
@@ -137,9 +137,9 @@ void SAL_CALL ParaLRSpacingControl::notifyContextChangeEvent(const css::ui::Cont
 
     if(pWindow)
     {
-        ::sfx2::sidebar::EnumContext eContext = ::sfx2::sidebar::EnumContext(
-                ::sfx2::sidebar::EnumContext::GetApplicationEnum(rEvent.ApplicationName),
-                ::sfx2::sidebar::EnumContext::GetContextEnum(rEvent.ContextName));
+        vcl::EnumContext eContext = vcl::EnumContext(
+                vcl::EnumContext::GetApplicationEnum(rEvent.ApplicationName),
+                vcl::EnumContext::GetContextEnum(rEvent.ContextName));
         pWindow->SetContext(eContext);
     }
 }
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
index 93a2099..e5d81ed 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
@@ -135,7 +135,7 @@ void ParaLRSpacingWindow::dispose()
     VclVBox::dispose();
 }
 
-void ParaLRSpacingWindow::SetContext(const ::sfx2::sidebar::EnumContext& eContext)
+void ParaLRSpacingWindow::SetContext(const vcl::EnumContext& eContext)
 {
     m_aContext = eContext;
 }
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
index 4a01ae8..61ccfca 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx
@@ -24,10 +24,10 @@
 #include <editeng/lrspitem.hxx>
 #include <vcl/builder.hxx>
 #include <vcl/layout.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/relfld.hxx>
 #include <svtools/unitconv.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 
 using namespace com::sun::star;
 
@@ -64,7 +64,7 @@ public:
 
     void SetValue(SfxItemState eState, const SfxPoolItem* pState);
     void SetUnit(FieldUnit eUnit);
-    void SetContext(const ::sfx2::sidebar::EnumContext& eContext);
+    void SetContext(const vcl::EnumContext& eContext);
 
 private:
     VclPtr<SvxRelativeField> m_pBeforeSpacing;
@@ -73,7 +73,7 @@ private:
 
     SfxMapUnit m_eUnit;
 
-    ::sfx2::sidebar::EnumContext m_aContext;
+    vcl::EnumContext m_aContext;
 
     DECL_LINK_TYPED(ModifySpacingHdl, Edit&, void);
 };
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 103d226..155e2a3 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -253,7 +253,7 @@ void PosSizePropertyPanel::DataChanged(
 }
 
 void PosSizePropertyPanel::HandleContextChange(
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
     {
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index 21ada21..9ec990c 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -65,7 +65,7 @@ public:
         const DataChangedEvent& rEvent) override;
 
     virtual void HandleContextChange(
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -136,7 +136,7 @@ private:
     ::sfx2::sidebar::ControllerItem         maAutoHeightControl;
     ::sfx2::sidebar::ControllerItem         m_aMetricCtl;
 
-    ::sfx2::sidebar::EnumContext            maContext;
+    vcl::EnumContext                        maContext;
     SfxBindings*                            mpBindings;
 
     /// bitfield
diff --git a/svx/source/sidebar/styles/StylesPropertyPanel.hxx b/svx/source/sidebar/styles/StylesPropertyPanel.hxx
index dd91133..1b16267 100644
--- a/svx/source/sidebar/styles/StylesPropertyPanel.hxx
+++ b/svx/source/sidebar/styles/StylesPropertyPanel.hxx
@@ -4,7 +4,7 @@
 #include <sfx2/sidebar/SidebarPanelBase.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svtools/ctrlbox.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <com/sun/star/ui/XUIElement.hpp>
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 85cbaab..e9c8d96 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -39,7 +39,7 @@ VclPtr<vcl::Window> TextPropertyPanel::Create (
     vcl::Window* pParent,
     const css::uno::Reference<css::frame::XFrame>& rxFrame,
     SfxBindings* pBindings,
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (pParent == nullptr)
         throw lang::IllegalArgumentException("no parent Window given to TextPropertyPanel::Create", nullptr, 0);
@@ -55,7 +55,7 @@ VclPtr<vcl::Window> TextPropertyPanel::Create (
                 rContext);
 }
 
-TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const ::sfx2::sidebar::EnumContext& /*rContext*/ )
+TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const vcl::EnumContext& /*rContext*/ )
     : PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame),
         maFontSizeControl   (SID_ATTR_CHAR_FONTHEIGHT,  *pBindings, *this, OUString("FontHeight"),   rxFrame),
 
@@ -91,7 +91,7 @@ void TextPropertyPanel::dispose()
 }
 
 void TextPropertyPanel::HandleContextChange (
-    const ::sfx2::sidebar::EnumContext& rContext)
+    const vcl::EnumContext& rContext)
 {
     if (maContext == rContext)
         return;
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index fbdb711..a61ea40 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -22,7 +22,7 @@
 #include <sfx2/sidebar/SidebarPanelBase.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svtools/ctrlbox.hxx>
 #include <editeng/fhgtitem.hxx>
 
@@ -51,11 +51,11 @@ public:
         vcl::Window* pParent,
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         SfxBindings* pBindings,
-        const ::sfx2::sidebar::EnumContext& rContext);
+        const vcl::EnumContext& rContext);
 
 
     virtual void HandleContextChange (
-        const ::sfx2::sidebar::EnumContext& rContext) override;
+        const vcl::EnumContext& rContext) override;
 
 
     virtual void NotifyItemUpdate(
@@ -68,7 +68,7 @@ public:
         vcl::Window* pParent,
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         SfxBindings* pBindings,
-        const ::sfx2::sidebar::EnumContext& rContext);
+        const vcl::EnumContext& rContext);
 
 private:
     //ui controls
@@ -84,7 +84,7 @@ private:
 
     SvxFontHeightItem*          mpHeightItem;
 
-    ::sfx2::sidebar::EnumContext maContext;
+    vcl::EnumContext maContext;
 };
 
 } } // end of namespace svx::sidebar
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index bcad79a..374228b 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -99,6 +99,7 @@
 #include <vcl/dialog.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/edit.hxx>
+#include <vcl/EnumContext.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/floatwin.hxx>
@@ -413,7 +414,6 @@
 #include <sfx2/progress.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/shell.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/tbxctrl.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index d9b8d9f..e83249e 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -102,7 +102,7 @@
 #include <svx/dialogs.hrc>
 
 #include <svx/svxids.hrc>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/itempool.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/editeng.hxx>
@@ -156,7 +156,7 @@ SwAnnotationShell::SwAnnotationShell( SwView& r )
     : rView(r)
 {
     SetPool(SwAnnotationShell::GetAnnotationPool(rView));
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Annotation));
 }
 
 SwAnnotationShell::~SwAnnotationShell()
diff --git a/sw/source/uibase/shells/beziersh.cxx b/sw/source/uibase/shells/beziersh.cxx
index 45af54e..8303d4c 100644
--- a/sw/source/uibase/shells/beziersh.cxx
+++ b/sw/source/uibase/shells/beziersh.cxx
@@ -23,7 +23,7 @@
 #include <svl/eitem.hxx>
 #include <svl/whiter.hxx>
 #include <svx/svdopath.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objface.hxx>
@@ -63,7 +63,7 @@ SwBezierShell::SwBezierShell(SwView &_rView):
     SdrView*    pSdrView = pSh->GetDrawView();
     pSdrView->SetEliminatePolyPointLimitAngle(1500L);
 
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Draw));
 }
 
 void SwBezierShell::Execute(SfxRequest &rReq)
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 6c1fc43..a1bb766 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -43,7 +43,7 @@
 
 #include <svx/svdoashp.hxx>
 #include <svx/xtable.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/svdoole2.hxx>
 #include <sfx2/opengrf.hxx>
 #include <svx/svdograf.hxx>
@@ -538,7 +538,7 @@ SwDrawShell::SwDrawShell(SwView &_rView) :
     SetHelpId(SW_DRAWSHELL);
     SetName("Draw");
 
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Draw));
 }
 
 // Edit SfxRequests for FontWork
diff --git a/sw/source/uibase/shells/drformsh.cxx b/sw/source/uibase/shells/drformsh.cxx
index 360d99b..e93f759 100644
--- a/sw/source/uibase/shells/drformsh.cxx
+++ b/sw/source/uibase/shells/drformsh.cxx
@@ -26,7 +26,7 @@
 #include <sfx2/app.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/srchitem.hxx>
 #include <svx/fmglob.hxx>
 #include <svx/svdouno.hxx>
@@ -250,7 +250,7 @@ SwDrawFormShell::SwDrawFormShell(SwView &_rView) :
     SetHelpId(SW_DRAWFORMSHELL);
     GetShell().NoEdit();
     SetName("DrawForm");
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Form));
 }
 
 SwDrawFormShell::~SwDrawFormShell()
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index df2dbda..9905653 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -35,7 +35,7 @@
 #include <sfx2/bindings.hxx>
 #include <svx/fontwork.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/whiter.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/editstat.hxx>
@@ -133,7 +133,7 @@ SwDrawTextShell::SwDrawTextShell(SwView &rV) :
     rSh.NoEdit();
     SetName("ObjectText");
     SetHelpId(SW_DRWTXTSHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_DrawText));
 }
 
 SwDrawTextShell::~SwDrawTextShell()
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index a78df35..0854306 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -39,7 +39,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/hlnkitem.hxx>
 #include <svx/svdview.hxx>
 #include <vcl/msgbox.hxx>
@@ -943,7 +943,7 @@ SwFrameShell::SwFrameShell(SwView &_rView) :
     // #96392# Use this to announce it is the frame shell who creates the selection.
     SwTransferable::CreateSelection( _rView.GetWrtShell(), this );
 
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Frame));
 }
 
 SwFrameShell::~SwFrameShell()
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 110d0916..c5fee03 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -31,7 +31,7 @@
 #include <editeng/sizeitem.hxx>
 #include <editeng/protitem.hxx>
 #include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svl/srchitem.hxx>
 #include <sfx2/htmlmode.hxx>
 #include <svx/sdgluitm.hxx>
@@ -943,7 +943,7 @@ SwGrfShell::SwGrfShell(SwView &_rView) :
 {
     SetName("Graphic");
     SetHelpId(SW_GRFSHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Graphic));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/mediash.cxx b/sw/source/uibase/shells/mediash.cxx
index 59953c7..ccf4e5a 100644
--- a/sw/source/uibase/shells/mediash.cxx
+++ b/sw/source/uibase/shells/mediash.cxx
@@ -58,7 +58,7 @@
 #include <popup.hrc>
 
 #include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
 #include <avmedia/mediaitem.hxx>
@@ -192,7 +192,7 @@ SwMediaShell::SwMediaShell(SwView &_rView) :
 {
     SetName("Media Playback");
     SetHelpId(SW_MEDIASHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Media));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/olesh.cxx b/sw/source/uibase/shells/olesh.cxx
index 82dbaef..160c34a 100644
--- a/sw/source/uibase/shells/olesh.cxx
+++ b/sw/source/uibase/shells/olesh.cxx
@@ -21,7 +21,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/objitem.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <wrtsh.hxx>
 #include <view.hxx>
 #include <helpid.h>
@@ -52,7 +52,7 @@ SwOleShell::SwOleShell(SwView &_rView) :
 {
     SetName("Object");
     SetHelpId(SW_OLESHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_OLE));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 2fe8d82..0f83534 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -45,7 +45,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <o3tl/enumrange.hxx>
 
 #include <fmtornt.hxx>
@@ -1406,7 +1406,7 @@ SwTableShell::SwTableShell(SwView &_rView) :
 {
     SetName("Table");
     SetHelpId(SW_TABSHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Table));
 }
 
 void SwTableShell::GetFrameBorderState(SfxItemSet &rSet)
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 392e42c..e302b8f 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -98,7 +98,7 @@
 
 #define SwTextShell
 #include <sfx2/msg.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 #include <swslots.hxx>
 #include <SwRewriter.hxx>
 #include <comcore.hrc>
@@ -829,7 +829,7 @@ SwTextShell::SwTextShell(SwView &_rView) :
 {
     SetName("Text");
     SetHelpId(SW_TEXTSHELL);
-    SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text));
+    SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context_Text));
 }
 
 SwTextShell::~SwTextShell()
diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui
index 0c22525..2c9cbdd 100644
--- a/sw/uiconfig/swriter/ui/notebookbar.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar.ui
@@ -178,7 +178,7 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="vcllo-ContextTabControl" id="notebook1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
@@ -1192,6 +1192,10 @@
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Home</property>
                 <property name="use_underline">True</property>
+                <style>
+                  <class name="context-any"/>
+                  <class name="context-Text"/>
+                </style>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -3568,24 +3572,15 @@
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Table</property>
                 <property name="use_underline">True</property>
+                <style>
+                  <class name="context-Table"/>
+                </style>
               </object>
               <packing>
                 <property name="position">6</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child type="tab">
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child type="tab">
-              <placeholder/>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index d3c3f80..8068cff 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -189,8 +189,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/window/window \
     vcl/source/window/winproc \
     vcl/source/window/wrkwin \
+    vcl/source/window/EnumContext \
     vcl/source/control/button \
     vcl/source/control/combobox \
+    vcl/source/control/contexttabctrl \
     vcl/source/control/ctrl \
     vcl/source/control/edit \
     vcl/source/control/field2 \
diff --git a/vcl/source/control/contexttabctrl.cxx b/vcl/source/control/contexttabctrl.cxx
new file mode 100644
index 0000000..29e43ad
--- /dev/null
+++ b/vcl/source/control/contexttabctrl.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <vcl/builderfactory.hxx>
+#include <vcl/contexttabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+VCL_BUILDER_FACTORY(ContextTabControl);
+
+ContextTabControl::ContextTabControl( vcl::Window* pParent, WinBits nStyle ) :
+    TabControl( pParent, nStyle )
+    , eLastContext(vcl::EnumContext::Context::Context_Any)
+{
+    HideDisabledTabs();
+}
+
+void ContextTabControl::SetContext( vcl::EnumContext::Context eContext )
+{
+    if (eLastContext != eContext)
+    {
+        for (int nChild = 0; nChild < GetChildCount(); ++nChild)
+        {
+            TabPage* pPage = static_cast<TabPage*>(GetChild(nChild));
+
+            if (pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Context_Any))
+                EnablePage(nChild + 1, true);
+            else
+                EnablePage(nChild + 1, false);
+
+            if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Context_Any)
+                SetCurPageId(nChild + 1);
+        }
+
+        eLastContext = eContext;
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index a037eb7..939fa10 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -9,12 +9,14 @@
 
 #include <vcl/layout.hxx>
 #include <vcl/notebookbar.hxx>
+#include <cppuhelper/queryinterface.hxx>
 
 NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
     : Control(pParent)
 {
     SetStyle(GetStyle() | WB_DIALOGCONTROL);
     m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame);
+    get(m_pTabControl, "notebook1");
 }
 
 NotebookBar::~NotebookBar()
@@ -76,4 +78,31 @@ void NotebookBar::StateChanged(StateChangedType nType)
     Control::StateChanged(nType);
 }
 
+void SAL_CALL NotebookBar::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent)
+        throw (css::uno::RuntimeException, std::exception)
+{
+    m_pTabControl->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName));
+}
+
+::css::uno::Any SAL_CALL NotebookBar::queryInterface(const ::css::uno::Type& aType)
+    throw (::css::uno::RuntimeException, ::std::exception)
+{
+    return ::cppu::queryInterface(aType, static_cast<css::ui::XContextChangeEventListener*>(this));
+}
+
+void SAL_CALL NotebookBar::acquire() throw ()
+{
+    Control::acquire();
+}
+
+void SAL_CALL NotebookBar::release() throw ()
+{
+    Control::release();
+}
+
+void SAL_CALL NotebookBar::disposing(const ::css::lang::EventObject&)
+    throw (::css::uno::RuntimeException, ::std::exception)
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 491a2a0..6420817 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -96,6 +96,7 @@ void TabControl::ImplInit( vcl::Window* pParent, WinBits nStyle )
     mbSmallInvalidate           = false;
     mpTabCtrlData               = new ImplTabCtrlData;
     mpTabCtrlData->mpListBox    = nullptr;
+    mbHideDisabledTabs          = false;
 
     ImplInitSettings( true, true, true );
 
@@ -1197,16 +1198,20 @@ void TabControl::ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle&
         while (idx < mpTabCtrlData->maItemList.size())
         {
             ImplTabItem* pItem = &mpTabCtrlData->maItemList[idx];
-            if (pItem != pCurItem)
+
+            if(!mbHideDisabledTabs || (mbHideDisabledTabs && pItem->mbEnabled))
             {
-                vcl::Region aClipRgn(rRenderContext.GetActiveClipRegion());
-                aClipRgn.Intersect(pItem->maRect);
-                if (!rRect.IsEmpty())
-                    aClipRgn.Intersect(rRect);
-                if (!aClipRgn.IsEmpty())
+                if (pItem != pCurItem)
                 {
-                    ImplDrawItem(rRenderContext, pItem, aCurRect, false/*bLayout*/,
-                                 pItem == pFirstTab, pItem == pLastTab);
+                    vcl::Region aClipRgn(rRenderContext.GetActiveClipRegion());
+                    aClipRgn.Intersect(pItem->maRect);
+                    if (!rRect.IsEmpty())
+                        aClipRgn.Intersect(rRect);
+                    if (!aClipRgn.IsEmpty())
+                    {
+                        ImplDrawItem(rRenderContext, pItem, aCurRect, false/*bLayout*/,
+                                     pItem == pFirstTab, pItem == pLastTab);
+                    }
                 }
             }
 
@@ -1757,6 +1762,11 @@ void TabControl::EnablePage( sal_uInt16 i_nPageId, bool i_bEnable )
     }
 }
 
+void TabControl::HideDisabledTabs(bool bHide)
+{
+    mbHideDisabledTabs = bHide;
+}
+
 sal_uInt16 TabControl::GetPageCount() const
 {
     return (sal_uInt16)mpTabCtrlData->maItemList.size();
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/vcl/source/window/EnumContext.cxx
similarity index 98%
rename from sfx2/source/sidebar/EnumContext.cxx
rename to vcl/source/window/EnumContext.cxx
index 281e63f..80d35b6 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -16,13 +16,13 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#include <sfx2/sidebar/EnumContext.hxx>
+#include <vcl/EnumContext.hxx>
 
 #include <osl/diagnose.h>
 
 #include <map>
 
-namespace sfx2 { namespace sidebar {
+namespace vcl {
 
 namespace {
 
@@ -227,6 +227,6 @@ const ::rtl::OUString& EnumContext::GetContextName (const Context eContext)
         return maContextVector[nIndex];
 }
 
-} } // end of namespace sfx2::sidebar
+} // end of namespace vcl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 2f1fd3d..9797956 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1923,6 +1923,8 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
 
     int nLevel = 1;
     stringmap aProperties;
+    std::vector<vcl::EnumContext::Context> context;
+
     while(true)
     {
         xmlreader::Span name;
@@ -1952,6 +1954,11 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
                     }
                 }
             }
+            else if (name.equals("style"))
+            {
+                context = handleStyle(reader);
+                --nLevel;
+            }
             else if (name.equals("property"))
                 collectProperty(reader, sID, aProperties);
         }
@@ -1977,6 +1984,11 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
         pTabControl->SetPageText(nPageId,
             OStringToOUString(aFind->second, RTL_TEXTENCODING_UTF8));
         pTabControl->SetPageName(nPageId, sID);
+        if (context.size() != 0)
+        {
+            TabPage* pPage = static_cast<TabPage*>(pTabControl->GetTabPage(nPageId));
+            pPage->SetContext(context);
+        }
     }
     else
         pTabControl->RemovePage(pTabControl->GetCurPageId());
@@ -3032,6 +3044,72 @@ void VclBuilder::applyPackingProperty(vcl::Window *pCurrent,
     }
 }
 
+std::vector<vcl::EnumContext::Context> VclBuilder::handleStyle(xmlreader::XmlReader &reader)
+{
+    std::vector<vcl::EnumContext::Context> aContext;
+
+    xmlreader::Span name;
+    int nsId;
+
+    int nLevel = 1;
+
+    while(true)
+    {
+        xmlreader::XmlReader::Result res = reader.nextItem(
+            xmlreader::XmlReader::Text::NONE, &name, &nsId);
+
+        if (res == xmlreader::XmlReader::Result::Done)
+            break;
+
+        if (res == xmlreader::XmlReader::Result::Begin)
+        {
+            ++nLevel;
+            if (name.equals("class"))
+            {
+                aContext.push_back(getContext(reader));
+            }
+        }
+
+        if (res == xmlreader::XmlReader::Result::End)
+        {
+            --nLevel;
+        }
+
+        if (!nLevel)
+            break;
+    }
+
+    return aContext;
+}
+
+vcl::EnumContext::Context VclBuilder::getContext(xmlreader::XmlReader &reader)
+{
+    xmlreader::Span name;
+    int nsId;
+
+    while (reader.nextAttribute(&nsId, &name))
+    {
+        if (name.equals("name"))
+        {
+            name = reader.getAttributeValue(false);
+            OString sKey(name.begin, name.length);
+
+            if (sKey.startsWith("context-"))
+            {
+                OString sContext = sKey.copy(sKey.indexOf('-') + 1);
+                OUString sContext2 = OUString(sContext.getStr(), sContext.getLength(), RTL_TEXTENCODING_UTF8);
+                return vcl::EnumContext::GetContextEnum(sContext2);
+            }
+            else
+            {
+                SAL_WARN("vcl.layout", "unknown class: " << sKey.getStr());
+            }
+        }
+    }
+
+    return vcl::EnumContext::Context::Context_Any;
+}
+
 OString VclBuilder::getTranslation(const OString &rID, const OString &rProperty) const
 {
     Translations::const_iterator aWidgetFind = m_pParserState->m_aTranslations.find(rID);
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 576d645..2079ec9 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -44,6 +44,8 @@ void TabPage::ImplInit( vcl::Window* pParent, WinBits nStyle )
     // otherwise they will paint with a wrong background
     if( IsNativeControlSupported(ControlType::TabBody, ControlPart::Entire) && GetParent() && (GetParent()->GetType() == WINDOW_TABCONTROL) )
         EnableChildTransparentMode();
+
+    maContext.push_back( vcl::EnumContext::Context::Context_Any );
 }
 
 void TabPage::ImplInitSettings()
@@ -222,4 +224,22 @@ void TabPage::SetPosPixel(const Point& rAllocPos)
     }
 }
 
+void TabPage::SetContext(const std::vector<vcl::EnumContext::Context>& aContext)
+{
+    maContext = aContext;
+}
+
+bool TabPage::HasContext( const vcl::EnumContext::Context eContext ) const
+{
+    auto aFind = std::find(maContext.begin(), maContext.end(), eContext);
+    if (aFind == maContext.end())
+        return false;
+    return true;
+}
+
+const std::vector< vcl::EnumContext::Context >& TabPage::GetContext() const
+{
+    return maContext;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list