You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/01/29 09:14:12 UTC

svn commit: r1439779 [2/3] - in /openoffice/branches/sidebar/main: default_images/sfx2/res/ default_images/sfx2/res/symphony/ framework/inc/services/ framework/source/services/ offapi/com/sun/star/util/ officecfg/registry/data/org/openoffice/Office/UI/...

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.cxx Tue Jan 29 08:14:09 2013
@@ -37,12 +37,17 @@
 #include "sfxlocal.hrc"
 #include <vcl/floatwin.hxx>
 #include <vcl/dockwin.hxx>
+#include <svl/smplhint.hxx>
+#include <tools/link.hxx>
 #include <comphelper/componentfactory.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/ui/ContextChangeEventObject.hpp>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
 
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
@@ -50,7 +55,7 @@
 
 using namespace css;
 using namespace cssu;
-
+using ::rtl::OUString;
 
 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
 
@@ -79,8 +84,13 @@ SidebarController::SidebarController (
               mpParentWindow,
               rxFrame,
               ::boost::bind(&SidebarController::SwitchToDeck, this, _1),
-              ::boost::bind(&SidebarController::ShowPopupMenu, this, _1))),
-      mxFrame(rxFrame)
+              ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))),
+      mxFrame(rxFrame),
+      maCurrentContext(
+          EnumContext::Application_Unknown,
+          EnumContext::Context_Unknown),
+      msCurrentDeckId(A2S("PropertyDeck")),
+      maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this))
 {
     if (pParentWindow == NULL)
     {
@@ -88,8 +98,6 @@ SidebarController::SidebarController (
             return;
     }
 
-    UpdateConfigurations(Context(A2S("default"), A2S("default")));
-
     // Listen for context change events.
     cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
         css::ui::ContextChangeEventMultiplexer::get(
@@ -97,7 +105,7 @@ SidebarController::SidebarController (
     if (xMultiplexer.is())
         xMultiplexer->addContextChangeEventListener(
             static_cast<css::ui::XContextChangeEventListener*>(this),
-            NULL);
+            mxFrame->getController());
 
     // Listen for window events.
     mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
@@ -135,7 +143,7 @@ void SAL_CALL SidebarController::disposi
 
     if (mpCurrentConfiguration)
     {
-        mpCurrentConfiguration->Disable();
+        mpCurrentConfiguration->Dispose();
         mpCurrentConfiguration.reset();
     }
 
@@ -150,7 +158,10 @@ void SAL_CALL SidebarController::disposi
 void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
     throw(cssu::RuntimeException)
 {
-    UpdateConfigurations(Context(rEvent.ApplicationName, rEvent.ContextName));
+    UpdateConfigurations(
+        EnumContext(
+            rEvent.ApplicationName,
+            rEvent.ContextName));
 }
 
 
@@ -159,9 +170,11 @@ void SAL_CALL SidebarController::notifyC
 void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject)
     throw(cssu::RuntimeException)
 {
+    (void)rEventObject;
+    
     if (mpCurrentConfiguration)
     {
-        mpCurrentConfiguration->Disable();
+        mpCurrentConfiguration->Dispose();
         mpCurrentConfiguration.reset();
     }
     if (mpTabBar != NULL)
@@ -178,6 +191,16 @@ void SAL_CALL SidebarController::disposi
 void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& rEvent)
     throw(cssu::RuntimeException)
 {
+    (void)rEvent;
+    
+    maPropertyChangeForwarder.RequestCall();
+}
+
+
+
+
+void SidebarController::BroadcastPropertyChange (void)
+{
     DataChangedEvent aEvent (DATACHANGED_USER);
     mpParentWindow->NotifyAllChilds(aEvent);
     mpParentWindow->Invalidate(INVALIDATE_CHILDREN);
@@ -188,59 +211,95 @@ void SAL_CALL SidebarController::propert
 
 void SidebarController::NotifyResize (void)
 {
+    if (mpTabBar == NULL)
+    {
+        OSL_ASSERT(mpTabBar!=NULL);
+        return;
+    }
+    
+    Window* pParentWindow = mpTabBar->GetParent();
+    
+    const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
+    const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
+
     if (mpCurrentConfiguration != NULL)
     {
-        if (mpCurrentConfiguration->mpDeck==NULL || mpTabBar==NULL)
+        if (mpCurrentConfiguration->mpDeck==NULL)
         {
-            OSL_ASSERT(mpCurrentConfiguration->mpDeck!=NULL && mpTabBar!=NULL);
+            OSL_ASSERT(mpCurrentConfiguration->mpDeck!=NULL);
         }
         else
         {
-            Window* pParentWindow = mpCurrentConfiguration->mpDeck->GetParent();
-            if (pParentWindow==NULL || pParentWindow!=mpTabBar->GetParent())
-            {
-                OSL_ASSERT(mpCurrentConfiguration->mpDeck->GetParent() != NULL);
-                OSL_ASSERT(mpCurrentConfiguration->mpDeck->GetParent() == mpTabBar->GetParent());
-            }
-    
-            const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
-            const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
             mpCurrentConfiguration->mpDeck->SetPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
             mpCurrentConfiguration->mpDeck->Show();
-            mpTabBar->SetPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
-            mpTabBar->Show();
-
             mpCurrentConfiguration->mpDeck->RequestLayout();
         }
     }
+
+    mpTabBar->SetPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
+    mpTabBar->Show();
 }
 
 
 
 
-void SidebarController::UpdateConfigurations (const Context& rContext)
+void SidebarController::UpdateConfigurations (const EnumContext& rContext)
 {
-    maCurrentContext = rContext;
+    if (maCurrentContext != rContext)
+    {
+        maCurrentContext = rContext;
 
-    ResourceManager::DeckContainer aDeckDescriptors;
-    ResourceManager::Instance().GetMatchingDecks (
-        aDeckDescriptors,
-        rContext,
-        mxFrame);
-    mpTabBar->SetDecks(aDeckDescriptors);
+        // Notify the tab bar about the updated set of decks.
+        ResourceManager::IdContainer aDeckIds;
+        ResourceManager::Instance().GetMatchingDecks (
+            aDeckIds,
+            rContext,
+            mxFrame);
+        mpTabBar->SetDecks(aDeckIds);
+
+        // Check if the current deck is among the matching decks.
+        bool bCurrentDeckMatches (false);
+        for (ResourceManager::IdContainer::const_iterator
+                 iDeck(aDeckIds.begin()),
+                 iEnd(aDeckIds.end());
+             iDeck!=iEnd;
+             ++iDeck)
+        {
+            if (iDeck->equals(msCurrentDeckId))
+            {
+                bCurrentDeckMatches = true;
+                break;
+            }
+        }
 
-    const DeckDescriptor* pDeckDescriptor (ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame));
-    if (pDeckDescriptor != NULL)
-        SwitchToDeck(*pDeckDescriptor, rContext);
+        DeckDescriptor const* pDeckDescriptor = NULL;
+        if ( ! bCurrentDeckMatches)
+        {
+            pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame);
+            msCurrentDeckId = pDeckDescriptor->msId;
+        }
+        else
+            pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId);
+        if (pDeckDescriptor != NULL)
+        {
+            msCurrentDeckId = pDeckDescriptor->msId;
+            SwitchToDeck(*pDeckDescriptor, rContext);
+        }
+    }
 }
 
 
 
 
 void SidebarController::SwitchToDeck (
-    const DeckDescriptor& rDeckDescriptor)
+    const ::rtl::OUString& rsDeckId)
 {
-    SwitchToDeck(rDeckDescriptor, maCurrentContext);
+    if ( ! msCurrentDeckId.equals(rsDeckId))
+    {
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId);
+        if (pDeckDescriptor != NULL)
+            SwitchToDeck(*pDeckDescriptor, maCurrentContext);
+    }
 }
 
 
@@ -248,54 +307,85 @@ void SidebarController::SwitchToDeck (
 
 void SidebarController::SwitchToDeck (
     const DeckDescriptor& rDeckDescriptor,
-    const Context& rContext)
+    const EnumContext& rContext)
 {
+    if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId))
+    {
+        // When the deck changes then destroy the deck and all panels
+        // and create everything new.
+        if (mpCurrentConfiguration)
+        {
+            mpCurrentConfiguration->Dispose();
+            mpCurrentConfiguration.reset();
+        }
+
+        msCurrentDeckId = rDeckDescriptor.msId;
+    }
+    
     // Determine the panels to display in the deck.
-    ResourceManager::PanelContainer aPanelDescriptors;
+    ResourceManager::IdContainer aPanelIds;
     ResourceManager::Instance().GetMatchingPanels(
-        aPanelDescriptors,
+        aPanelIds,
         rContext,
         rDeckDescriptor.msId,
         mxFrame);
 
-    // Setup a configuration for the requested deck
-    // and create the deck.
-    ::boost::shared_ptr<DeckConfiguration> pConfiguration (new DeckConfiguration);
-    pConfiguration->mpDeck = new Deck(rDeckDescriptor, mpParentWindow);
-
-    // Create the panels.
-    for (ResourceManager::PanelContainer::const_iterator
-             iPanel(aPanelDescriptors.begin()),
-             iEnd(aPanelDescriptors.end());
-         iPanel!=iEnd;
-         ++iPanel)
+    // Provide a configuration and Deck object.
+    if ( ! mpCurrentConfiguration)
     {
-        // Create the panel which is the parent window of the UIElement.
-        Panel* pPanel = new Panel(
-            *iPanel,
-            pConfiguration->mpDeck,
-            ::boost::bind(&Deck::RequestLayout,pConfiguration->mpDeck));
+        mpCurrentConfiguration.reset(new DeckConfiguration);
+        mpCurrentConfiguration->mpDeck = new Deck(rDeckDescriptor, mpParentWindow);
+    }
 
-        // Create the XUIElement.
-        Reference<ui::XUIElement> xUIElement (CreateUIElement(
-                pPanel->GetComponentInterface(),
-                iPanel->msImplementationURL,
-                pPanel
-                ));
-        if (xUIElement.is())
+    // Update the panel list.
+    const sal_Int32 nNewPanelCount (aPanelIds.size());
+    ::std::vector<Panel*> aNewPanels;
+    ::std::vector<Panel*> aCurrentPanels;
+    if (mpCurrentConfiguration)
+        aCurrentPanels.swap(mpCurrentConfiguration->maPanels);
+    aNewPanels.resize(nNewPanelCount);
+    for (sal_Int32 nIndex=0; nIndex<nNewPanelCount; ++nIndex)
+    {
+        const OUString& rsPanelId (aPanelIds[nIndex]);
+
+        // Find the corresponding panel among the currently active
+        // panels.
+        ::std::vector<Panel*>::iterator iPanel (::std::find_if(
+                aCurrentPanels.begin(),
+                aCurrentPanels.end(),
+                ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rsPanelId))));
+        if (iPanel != aCurrentPanels.end())
         {
-            // Initialize the panel and add it to the active deck.
-            pPanel->SetUIElement(xUIElement);
-            pConfiguration->maPanels.push_back(pPanel);
+            // Panel already exists in current configuration.  Move it
+            // to new configuration.
+            aNewPanels[nIndex] = *iPanel;
+            aCurrentPanels[::std::distance(aCurrentPanels.begin(), iPanel)] = NULL;
         }
         else
         {
-            delete pPanel;
+            // Panel does not yet exist.  Create it.
+            aNewPanels[nIndex] = CreatePanel(rsPanelId, mpCurrentConfiguration->mpDeck);
         }
     }
 
-    // Activate the new configuration.
-    MakeConfigurationCurrent(pConfiguration);
+    // Destroy all panels that are not used in the new configuration.
+    for (::std::vector<Panel*>::const_iterator iPanel(aCurrentPanels.begin()),iEnd(aCurrentPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        if (*iPanel != NULL)
+            (*iPanel)->Dispose();
+    }
+
+    // Activate the deck and the new set of panels.
+    mpCurrentConfiguration->maPanels.swap(aNewPanels);
+    mpCurrentConfiguration->mpDeck->SetPosSizePixel(
+        0,
+        0,
+        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
+        mpParentWindow->GetSizePixel().Height());
+    mpCurrentConfiguration->mpDeck->SetPanels(mpCurrentConfiguration->maPanels);
+    mpCurrentConfiguration->mpDeck->Show();
 
     // Tell the tab bar to highlight the button associated with the
     // deck.
@@ -305,6 +395,42 @@ void SidebarController::SwitchToDeck (
 
 
 
+Panel* SidebarController::CreatePanel (
+    const OUString& rsPanelId,
+    Deck* pDeck) const
+{
+    const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
+    if (pPanelDescriptor == NULL)
+        return NULL;
+            
+    // Create the panel which is the parent window of the UIElement.
+    Panel* pPanel = new Panel(
+        *pPanelDescriptor,
+        pDeck,
+        ::boost::bind(&Deck::RequestLayout,pDeck));
+
+    // Create the XUIElement.
+    Reference<ui::XUIElement> xUIElement (CreateUIElement(
+            pPanel->GetComponentInterface(),
+            pPanelDescriptor->msImplementationURL,
+            pPanel));
+    if (xUIElement.is())
+    {
+        // Initialize the panel and add it to the active deck.
+        pPanel->SetUIElement(xUIElement);
+    }
+    else
+    {
+        delete pPanel;
+        pPanel = NULL;
+    }
+
+    return pPanel;
+}
+
+
+
+
 Reference<ui::XUIElement> SidebarController::CreateUIElement (
     const Reference<awt::XWindowPeer>& rxWindow,
     const ::rtl::OUString& rsImplementationURL,
@@ -325,10 +451,11 @@ Reference<ui::XUIElement> SidebarControl
         SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
         if (pSfxDockingWindow != NULL)
             aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
+        const Sequence<beans::PropertyValue> aProperties (aCreationArguments.getPropertyValues());
         Reference<ui::XUIElement> xUIElement(
             xUIElementFactory->createUIElement(
                 rsImplementationURL,
-                aCreationArguments.getPropertyValues()),
+                aProperties),
             UNO_QUERY_THROW);
 
         // Provide the new ui element with the XSidebarPanel object
@@ -364,34 +491,10 @@ Reference<ui::XUIElement> SidebarControl
 
 
 
-void SidebarController::MakeConfigurationCurrent (const ::boost::shared_ptr<DeckConfiguration>& rpConfiguration)
-{
-    if ( ! rpConfiguration || rpConfiguration->mpDeck == NULL)
-        return;
-
-    // Deactivate the current deck and panels.
-    if (mpCurrentConfiguration && mpCurrentConfiguration->mpDeck!=NULL)
-        mpCurrentConfiguration->Disable();
-
-    mpCurrentConfiguration = rpConfiguration;
-
-    mpCurrentConfiguration->mpDeck->SetPosSizePixel(
-        0,
-        0,
-        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
-        mpParentWindow->GetSizePixel().Height());
-    mpCurrentConfiguration->mpDeck->Show();
-    mpCurrentConfiguration->Activate();
-}
-
-
-
-
 IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
 {
     if (pEvent != NULL)
     {
-        ::Window* pWindow = pEvent->GetWindow();
         switch (pEvent->GetId())
         {
             case VCLEVENT_WINDOW_GETFOCUS:
@@ -425,9 +528,12 @@ IMPL_LINK(SidebarController, WindowEvent
 
 
 
-void SidebarController::ShowPopupMenu (const Rectangle& rButtonBox) const
+void SidebarController::ShowPopupMenu (
+    const Rectangle& rButtonBox,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
 {
-    ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu();
+    ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rDeckSelectionData, rDeckShowData);
     pMenu->SetSelectHdl(LINK(this, SidebarController, OnMenuItemSelected));
         
     // pass toolbox button rect so the menu can stay open on button up
@@ -439,7 +545,9 @@ void SidebarController::ShowPopupMenu (c
 
 
 
-::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (void) const
+::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
+    const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+    const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const
 {
     ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu());
     FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
@@ -452,12 +560,22 @@ void SidebarController::ShowPopupMenu (c
     
     // Add one entry for every tool panel element to individually make
     // them visible or hide them.
-    if (mpTabBar != NULL)
     {
-        mpTabBar->AddPopupMenuEntries(*pMenu, MID_FIRST_PANEL);
-        pMenu->InsertSeparator();
+        sal_Int32 nIndex (MID_FIRST_PANEL);
+        for(::std::vector<TabBar::DeckMenuData>::const_iterator
+                iItem(rDeckSelectionData.begin()),
+                iEnd(rDeckSelectionData.end());
+            iItem!=iEnd;
+            ++iItem)
+        {
+            pMenu->InsertItem(nIndex, iItem->get<0>(), MIB_RADIOCHECK);
+            pMenu->CheckItem(nIndex, iItem->get<2>());
+            ++nIndex;
+        }
     }
 
+    pMenu->InsertSeparator();
+
     // Add entry for docking or un-docking the tool panel.
     if (mpParentWindow->IsFloatingMode())
         pMenu->InsertItem(MID_LOCK_TASK_PANEL, String(SfxResId(STR_SFX_DOCK)));
@@ -466,7 +584,20 @@ void SidebarController::ShowPopupMenu (c
 
     // Add sub menu for customization (hiding of deck tabs.)
     PopupMenu* pCustomizationMenu = new PopupMenu();
-    mpTabBar->AddCustomizationMenuEntries(*pCustomizationMenu, MID_FIRST_HIDE);
+    {
+        sal_Int32 nIndex (MID_FIRST_HIDE);
+        for(::std::vector<TabBar::DeckMenuData>::const_iterator
+                iItem(rDeckShowData.begin()),
+                iEnd(rDeckShowData.end());
+            iItem!=iEnd;
+            ++iItem)
+        {
+            pCustomizationMenu->InsertItem(nIndex, iItem->get<0>(), MIB_CHECKABLE);
+            pCustomizationMenu->CheckItem(nIndex, iItem->get<2>());
+            ++nIndex;
+        }
+    }
+
     pCustomizationMenu->InsertSeparator();
     pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, String(SfxResId(STRING_RESTORE)));
     
@@ -510,7 +641,7 @@ IMPL_LINK(SidebarController, OnMenuItemS
             try
             {
                 if (nIndex >= MID_FIRST_PANEL && nIndex<MID_FIRST_HIDE)
-                    SwitchToDeck(mpTabBar->GetDeckDescriptorForIndex(nIndex - MID_FIRST_PANEL));
+                    SwitchToDeck(mpTabBar->GetDeckIdForIndex(nIndex - MID_FIRST_PANEL));
                 else if (nIndex >=MID_FIRST_HIDE)
                     mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE);
             }

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarController.hxx Tue Jan 29 08:14:09 2013
@@ -23,10 +23,17 @@
 #define SFX_SIDEBAR_CONTROLLER_HXX
 
 #include "ResourceManager.hxx"
+#include "sfx2/sidebar/EnumContext.hxx"
+#include "AsynchronousCall.hxx"
+#include "TabBar.hxx"
+
+#include <vcl/menu.hxx>
 
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+
 #include <boost/noncopyable.hpp>
 #include <cppuhelper/compbase2.hxx>
 #include <cppuhelper/basemutex.hxx>
@@ -47,12 +54,13 @@ class DockingWindow;
 
 namespace sfx2 { namespace sidebar {
 
+class ContentPanelDescriptor;
+class Deck;
+class DeckConfiguration;
+class DeckDescriptor;
 class Panel;
 class TabBar;
 class TabBarConfiguration;
-class DeckDescriptor;
-class DeckConfiguration;
-class ContentPanelDescriptor;
 
 class SidebarController
     : private ::boost::noncopyable,
@@ -80,28 +88,38 @@ public:
     void NotifyResize (void);
 
     void SwitchToDeck (
-        const DeckDescriptor& rDeckDescriptor);
+        const ::rtl::OUString& rsDeckId);
 
 private:
     ::boost::shared_ptr<DeckConfiguration> mpCurrentConfiguration;
     DockingWindow* mpParentWindow;
     TabBar* mpTabBar;
     cssu::Reference<css::frame::XFrame> mxFrame;
-    Context maCurrentContext;
-
+    EnumContext maCurrentContext;
+    ::rtl::OUString msCurrentDeckId;
+    AsynchronousCall maPropertyChangeForwarder;
+    
     DECL_LINK(WindowEventHandler, VclWindowEvent*);
-    void UpdateConfigurations (const Context& rContext);
+    void UpdateConfigurations (const EnumContext& rContext);
     cssu::Reference<css::ui::XUIElement> CreateUIElement (
         const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
         const ::rtl::OUString& rsImplementationURL,
         Panel* pPanel) const;
+    Panel* CreatePanel (
+        const ::rtl::OUString& rsPanelId,
+        Deck* pDeck) const;
     void SwitchToDeck (
         const DeckDescriptor& rDeckDescriptor,
-        const Context& rContext);
-    void MakeConfigurationCurrent (const ::boost::shared_ptr<DeckConfiguration>& rpConfiguration);
-    void ShowPopupMenu (const Rectangle& rButtonBox) const;
-    ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const;
+        const EnumContext& rContext);
+    void ShowPopupMenu (
+        const Rectangle& rButtonBox,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
+    ::boost::shared_ptr<PopupMenu> CreatePopupMenu (
+        const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData,
+        const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const;
     DECL_LINK(OnMenuItemSelected, Menu*);
+    void BroadcastPropertyChange (void);
 
     virtual void SAL_CALL disposing (void);
 };

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarDockingWindow.hxx Tue Jan 29 08:14:09 2013
@@ -25,6 +25,7 @@
 #include "sfx2/dockwin.hxx"
 #include "Sidebar.hxx"
 
+#include <rtl/ref.hxx>
 
 namespace sfx2 {
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.cxx Tue Jan 29 08:14:09 2013
@@ -28,7 +28,10 @@
 
 #include <vos/mutex.hxx>
 #include <vcl/svapp.hxx>
+#include <svl/smplhint.hxx>
 #include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/XWindowPeer.hpp>
 
 
 using namespace css;
@@ -71,6 +74,7 @@ SidebarPanel::~SidebarPanel (void)
 void SAL_CALL SidebarPanel::disposing (const css::lang::EventObject& rEventObject)
     throw(cssu::RuntimeException)
 {
+    (void)rEventObject;
 }
 
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanel.hxx Tue Jan 29 08:14:09 2013
@@ -22,6 +22,7 @@
 #ifndef SFX_SIDEBAR_SIDEBAR_PANEL_HXX
 #define SFX_SIDEBAR_SIDEBAR_PANEL_HXX
 
+#include <tools/link.hxx>
 #include <com/sun/star/ui/XSidebarPanel.hpp>
 
 #include <boost/noncopyable.hpp>
@@ -40,6 +41,7 @@ namespace
 
 
 class DockingWindow;
+class VclWindowEvent;
 
 namespace sfx2 { namespace sidebar {
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarPanelBase.cxx Tue Jan 29 08:14:09 2013
@@ -24,6 +24,9 @@
 #include "sfx2/sidebar/SidebarPanelBase.hxx"
 #include "sfx2/sidebar/Theme.hxx"
 #include "sfx2/imagemgr.hxx"
+#include <vcl/ctrl.hxx>
+#include <comphelper/processfactory.hxx>
+
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 
@@ -33,20 +36,31 @@ using namespace cssu;
 
 namespace sfx2 { namespace sidebar {
 
+Reference<ui::XUIElement> SidebarPanelBase::Create (
+    const ::rtl::OUString& rsResourceURL,
+    const cssu::Reference<css::frame::XFrame>& rxFrame,
+    Control* pControl)
+{
+    Reference<ui::XUIElement> xUIElement (
+        new SidebarPanelBase(
+            rsResourceURL,
+            rxFrame,
+            pControl));
+    return xUIElement;
+}
+
+
+
+
 SidebarPanelBase::SidebarPanelBase (
     const ::rtl::OUString& rsResourceURL,
-    Window* pParentWindow,
     const cssu::Reference<css::frame::XFrame>& rxFrame,
-    const ResId& rResId)
+    Control* pControl)
     : SidebarPanelBaseInterfaceBase(m_aMutex),
       msResourceURL(rsResourceURL),
-      Control(pParentWindow, rResId),
       mxFrame(rxFrame),
-      meFontUnderline(UNDERLINE_SINGLE)
+      mpControl(pControl)
 {
-    // Let the Pane draw the background.
-    SetBackground(Wallpaper());
-    
     cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
         css::ui::ContextChangeEventMultiplexer::get(
             ::comphelper::getProcessComponentContext()));
@@ -67,6 +81,8 @@ SidebarPanelBase::~SidebarPanelBase (voi
 void SAL_CALL SidebarPanelBase::disposing (void)
     throw (cssu::RuntimeException)
 {
+    mpControl = NULL;
+    
     if (mxFrame.is())
     {
         cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -84,11 +100,19 @@ void SAL_CALL SidebarPanelBase::disposin
 // XContextChangeEventListener
 void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
     const ui::ContextChangeEventObject& rEvent)
+    throw (cssu::RuntimeException)
 {
-    HandleContextChange (
-        EnumContext(
+    if (mpControl != NULL)
+    {
+        const EnumContext aContext(
             EnumContext::GetApplicationEnum(rEvent.ApplicationName),
-            EnumContext::GetContextEnum(rEvent.ContextName)));
+            EnumContext::GetContextEnum(rEvent.ContextName));
+
+        ContextChangeReceiverInterface* pContextChangeReceiver
+            = dynamic_cast<ContextChangeReceiverInterface*>(mpControl);
+        if (pContextChangeReceiver != NULL)
+            pContextChangeReceiver->HandleContextChange(aContext);
+    }
 }
 
 
@@ -98,6 +122,10 @@ void SAL_CALL SidebarPanelBase::disposin
     const css::lang::EventObject& rEvent)
     throw (cssu::RuntimeException)
 {
+    (void)rEvent;
+    
+    mxFrame = NULL;
+    mpControl = NULL;
 }
 
 
@@ -143,6 +171,8 @@ Reference<accessibility::XAccessible> SA
     const Reference<accessibility::XAccessible>& rxParentAccessible)
     throw(cssu::RuntimeException)
 {
+    (void)rxParentAccessible;
+    
     // Not yet implemented.
     return NULL;
 }
@@ -153,33 +183,24 @@ Reference<accessibility::XAccessible> SA
 Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow (void)
     throw(cssu::RuntimeException)
 {
-    return Reference<awt::XWindow>(
-        Control::GetComponentInterface(),
-        UNO_QUERY);    
-}
-
-
-
-
-FontUnderline SidebarPanelBase::GetDefaultUnderline (void) const
-{
-    return meFontUnderline;
+    if (mpControl != NULL)
+        return Reference<awt::XWindow>(
+            mpControl->GetComponentInterface(),
+            UNO_QUERY);
+    else
+        return NULL;
 }
 
 
 
 
-Image SidebarPanelBase::GetIcon (const ::rtl::OUString& rsURL)
-{
-    return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode());
-}
-
-
-
-
-void SidebarPanelBase::SetDefaultUnderline (const FontUnderline eFontUnderline)
+sal_Int32 SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth)
+    throw(cssu::RuntimeException)
 {
-    meFontUnderline = eFontUnderline;
+    if (mpControl != NULL)
+        return mpControl->GetSizePixel().Height();
+    else
+        return -1;
 }
 
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarResource.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarResource.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarResource.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarResource.hxx Tue Jan 29 08:14:09 2013
@@ -25,6 +25,8 @@
 
 #include "Sidebar.hrc"
 #include <sfx2/sfxresid.hxx>
+#include <tools/rc.hxx>
+
 
 class SidebarResource : public Resource
 {

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.cxx Tue Jan 29 08:14:09 2013
@@ -22,9 +22,12 @@
 #include "precompiled_sfx2.hxx"
 
 #include "SidebarToolBox.hxx"
+#include "ToolBoxBackground.hxx"
+#include "sfx2/sidebar/Theme.hxx"
 
 #include <vcl/gradient.hxx>
 
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
@@ -35,10 +38,12 @@ namespace sfx2 { namespace sidebar {
 SidebarToolBox::SidebarToolBox (
     Window* pParentWindow,
     const ResId& rResId)
-    : ToolBox(pParentWindow, rResId)
+    : ToolBox(pParentWindow, rResId),
+      mbParentIsBorder(false),
+      maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
 {
-	SetBackground(Wallpaper());
-	SetPaintTransparent(true);
+    SetBackground(Wallpaper());
+    SetPaintTransparent(true);
 }
 
 
@@ -51,51 +56,104 @@ SidebarToolBox::~SidebarToolBox (void)
 
 
 
-void SidebarToolBox::Paint (const Rectangle& rRect)
+void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow)
 {
-    /*
-    OutputDevice* pDevice (GetParent());
+    if (pBorderWindow != GetParent())
+    {
+        OSL_ASSERT("SetBorderWindow can only handle parent as border window");
+        return;
+    }
 
-    if (pDevice != NULL)
+    if ( ! mbParentIsBorder)
     {
-        Rectangle aRect (GetPosPixel(), GetSizePixel());
-        aRect.Left() -= 2;
-        aRect.Top() -= 1;
-        aRect.Right() += 2;
-        aRect.Bottom() += 1;
-        const Color aSavedLineColor = pDevice->GetLineColor();
-        const Color aSavedFillColor = pDevice->GetFillColor();
-        Color aLineColor(200,209,225);
-        //	Color aLineColor = GetSettings().GetStyleSettings().GetPropertySectionTBxBorderColor();
-        if(!GetSettings().GetStyleSettings().GetHighContrastMode())	
-            pDevice->SetLineColor(aLineColor);
-        else
-            pDevice->SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
-        pDevice->SetFillColor(COL_TRANSPARENT);
-        pDevice->DrawRect(aRect);
-
-        aRect.Left() += 1 ;
-        aRect.Top() += 1;
-        aRect.Right() -= 1;
-        aRect.Bottom() -= 1;
-        Color aStartColor(220,228,238);
-        Color aEndColor(245,245,247);
-        Gradient aBKGrad(GRADIENT_LINEAR, aStartColor, aEndColor);
-        if(!GetSettings().GetStyleSettings().GetHighContrastMode())	
-            //	DrawGradient(aRect, GetSettings().GetStyleSettings().GetPropertySectionTBxBKGGradient());
-            pDevice->DrawGradient(aRect, aBKGrad);
-	//else
-	//{
-	//	SetFillColor(GetSettings().GetStyleSettings().GetMenuColor());
-	//	DrawRect(aRect);
-	//}
+        mbParentIsBorder = true;
 
-        pDevice->SetLineColor(aSavedLineColor);
-        pDevice->SetFillColor(aSavedFillColor);
+        SetPosSizePixel (
+            GetPosPixel().X(),
+            GetPosPixel().Y(),
+            GetSizePixel().Width(),
+            GetSizePixel().Height(),
+            WINDOW_POSSIZE_ALL);
     }
-    */
+}
+
+
+
 
+void SidebarToolBox::Paint (const Rectangle& rRect)
+{
     ToolBox::Paint(rRect);
+    
+    OSL_TRACE("paint ToolBox at %d,%d",
+        GetPosPixel().X(),
+        GetPosPixel().Y());
+
+    if (Theme::GetBoolean(Theme::Bool_UseToolBoxItemSeparator))
+    {
+        const sal_Int32 nSeparatorY ((GetSizePixel().Height() - maItemSeparator.GetSizePixel().Height())/2);
+        const sal_uInt16 nItemCount (GetItemCount());
+        int nLastRight (-1);
+        for (sal_uInt16 nIndex=0; nIndex<nItemCount; ++nIndex)
+        {
+            const Rectangle aItemBoundingBox (GetItemPosRect(nIndex));
+            if (nLastRight >= 0)
+            {
+                const int nSeparatorX ((nLastRight + aItemBoundingBox.Left() - 1) / 2);
+                DrawImage(Point(nSeparatorX,nSeparatorY), maItemSeparator);
+            }
+        
+            nLastRight = aItemBoundingBox.Right();
+        }
+    }
 }
 
+
+
+
+Point SidebarToolBox::GetPosPixel (void) const
+{
+    if (mbParentIsBorder)
+    {
+        const Point aParentPoint (GetParent()->GetPosPixel());
+        const Point aChildPoint (ToolBox::GetPosPixel());
+        return Point(
+            aParentPoint.X() + aChildPoint.X(),
+            aParentPoint.Y() + aChildPoint.Y());
+    }
+    else
+        return ToolBox::GetPosPixel();
+}
+
+
+
+
+void SidebarToolBox::SetPosSizePixel (
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    sal_uInt16 nFlags)
+{
+    if (mbParentIsBorder)
+    {
+        const Point aRelativePosition (static_cast<ToolBoxBackground*>(GetParent())->SetToolBoxChild(
+                this,
+                nX,
+                nY,
+                nWidth,
+                nHeight,
+                nFlags));
+        ToolBox::SetPosSizePixel(
+            aRelativePosition.X(),
+            aRelativePosition.Y(),
+            nWidth,
+            nHeight,
+            nFlags);
+    }
+    else
+        ToolBox::SetPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
+}
+
+
+
 } } // end of namespace sfx2::sidebar

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/SidebarToolBox.hxx Tue Jan 29 08:14:09 2013
@@ -34,7 +34,20 @@ public:
     SidebarToolBox (Window* pParentWindow, const ResId& rResId);
     virtual ~SidebarToolBox (void);
 
+    void SetBorderWindow (const Window* pBorderWindow);
     virtual void Paint (const Rectangle& rRect);
+
+    virtual Point GetPosPixel (void) const;
+    virtual void SetPosSizePixel (
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags);
+
+private:
+    bool mbParentIsBorder;
+    Image maItemSeparator;
 };
 
 

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.cxx Tue Jan 29 08:14:09 2013
@@ -23,7 +23,7 @@
 
 #include "TabBar.hxx"
 #include "TabItem.hxx"
-#include "sfx2/sidebar/ControlFactory.hxx"
+#include "sidebar/ControlFactory.hxx"
 #include "DeckDescriptor.hxx"
 #include "Paint.hxx"
 #include "sfx2/sidebar/Theme.hxx"
@@ -33,7 +33,7 @@
 #include <vcl/image.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/componentcontext.hxx>
-#include <tools/SvBorder.hxx>
+#include <tools/svborder.hxx>
 
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 
@@ -49,8 +49,8 @@ namespace sfx2 { namespace sidebar {
 TabBar::TabBar (
     Window* pParentWindow,
     const Reference<frame::XFrame>& rxFrame,
-    const ::boost::function<void(const DeckDescriptor&)>& rDeckActivationFunctor,
-    const ::boost::function<void(const Rectangle&)>& rPopupMenuProvider)
+    const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor,
+    const PopupMenuProvider& rPopupMenuProvider)
     : Window(pParentWindow),
       mxFrame(rxFrame),
       mpMenuButton(ControlFactory::CreateMenuButton(this)),
@@ -68,8 +68,7 @@ TabBar::TabBar (
             ? BMP_COLOR_HIGHCONTRAST
             : BMP_COLOR_NORMAL);
     mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked));
-
-    EnableClipSiblings();
+    Layout();
 }
 
 
@@ -86,7 +85,6 @@ void TabBar::Paint (const Rectangle& rUp
 {
     Window::Paint(rUpdateArea);
 
-    const sal_Int32 nVerticalPadding (Theme::GetTabMenuPadding());
     const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
     SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
     DrawLine(
@@ -108,7 +106,7 @@ sal_Int32 TabBar::GetDefaultWidth (void)
 
 
 void TabBar::SetDecks (
-    const ResourceManager::DeckContainer& rDeckDescriptors)
+    const ResourceManager::IdContainer& rDeckIds)
 {
     // Remove the current buttons.
     {
@@ -123,21 +121,28 @@ void TabBar::SetDecks (
         maItems.clear();
     }
 
-    maItems.resize(rDeckDescriptors.size());
+    maItems.resize(rDeckIds.size());
     sal_Int32 nIndex (0);
-    for (ResourceManager::DeckContainer::const_iterator
-             iDeck(rDeckDescriptors.begin()),
-             iEnd(rDeckDescriptors.end());
-         iDeck!=iEnd;
-         ++iDeck)
+    for (ResourceManager::IdContainer::const_iterator
+             iDeckId(rDeckIds.begin()),
+             iEnd(rDeckIds.end());
+         iDeckId!=iEnd;
+         ++iDeckId)
     {
+        const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(*iDeckId);
+        if (pDescriptor == NULL)
+        {
+            OSL_ASSERT(pDescriptor!=NULL);
+            continue;
+        }
+            
         Item& rItem (maItems[nIndex++]);
-        rItem.maDeckDescriptor = *iDeck;
-        rItem.mpButton = CreateTabItem(*iDeck);
+        rItem.msDeckId = pDescriptor->msId;
+        rItem.mpButton = CreateTabItem(*pDescriptor);
         rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
         rItem.maDeckActivationFunctor = maDeckActivationFunctor;
         rItem.mbIsHiddenByDefault = false;
-        rItem.mbIsHidden = rItem.mbIsHiddenByDefault;
+        rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
     }
 
     UpdateButtonIcons();
@@ -161,10 +166,14 @@ void TabBar::UpdateButtonIcons (void)
         iItem!=iEnd;
         ++iItem)
     {
-        iItem->mpButton->SetModeImage(
-            GetItemImage(iItem->maDeckDescriptor),
-            eColorMode);
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+        if (pDeckDescriptor != NULL)
+            iItem->mpButton->SetModeImage(
+                GetItemImage(*pDeckDescriptor),
+                eColorMode);
     }
+
+    Invalidate();
 }
 
 
@@ -183,6 +192,7 @@ void TabBar::Layout (void)
         Theme::GetInteger(Theme::Int_TabItemWidth),
         Theme::GetInteger(Theme::Int_TabItemHeight));
 
+    // Place the menu button and the separator.
     if (mpMenuButton != NULL)
     {
         mpMenuButton->SetPosSizePixel(
@@ -192,17 +202,19 @@ void TabBar::Layout (void)
         nY += mpMenuButton->GetSizePixel().Height() + 1 + Theme::GetInteger(Theme::Int_TabMenuPadding);
         mnMenuSeparatorY = nY - Theme::GetInteger(Theme::Int_TabMenuPadding)/2 - 1;
     }
-    
+
+    // Place the deck selection buttons.
     for(ItemContainer::const_iterator
             iItem(maItems.begin()), iEnd(maItems.end());
         iItem!=iEnd;
         ++iItem)
     {
+        Button& rButton (*iItem->mpButton);
+        rButton.Show( ! iItem->mbIsHidden);
+        
         if (iItem->mbIsHidden)
             continue;
 
-        Button& rButton (*iItem->mpButton);
-        
         // Place and size the icon.
         rButton.SetPosSizePixel(
             Point(nX,nY),
@@ -223,7 +235,7 @@ void TabBar::HighlightDeck (const ::rtl:
          iItem!=iEnd;
          ++iItem)
     {
-        if (iItem->maDeckDescriptor.msId.equals(rsDeckId))
+        if (iItem->msDeckId.equals(rsDeckId))
         {
             iItem->mpButton->Check();
             break;
@@ -236,14 +248,10 @@ void TabBar::HighlightDeck (const ::rtl:
 
 void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
 {
-    if  (rDataChangedEvent.GetType() == DATACHANGED_SETTINGS
-        &&  (rDataChangedEvent.GetFlags() & SETTINGS_STYLE)!= 0)
-    {
-        UpdateButtonIcons();
-        Invalidate();
-    }
-    else
-        Window::DataChanged(rDataChangedEvent);
+    SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
+    UpdateButtonIcons();
+
+    Window::DataChanged(rDataChangedEvent);
 }
 
 
@@ -260,7 +268,6 @@ RadioButton* TabBar::CreateTabItem (cons
 
 
 
-
 Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const
 {
     return Tools::GetImage(
@@ -272,57 +279,22 @@ Image TabBar::GetItemImage (const DeckDe
 
 
 
-IMPL_LINK(TabBar::Item, HandleClick, Button*, pButton)
-{
-    maDeckActivationFunctor(maDeckDescriptor);
-    return 1;
-}
-
-
-
-
-void TabBar::AddPopupMenuEntries (
-    PopupMenu& rMenu,
-    const sal_Int32 nFirstIndex)
-{
-    sal_Int32 nIndex (nFirstIndex);
-    for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
-        iItem!=iEnd;
-        ++iItem)
-    {
-        rMenu.InsertItem(nIndex, iItem->maDeckDescriptor.msTitle, MIB_RADIOCHECK);
-        rMenu.CheckItem(nIndex, iItem->mpButton->IsChecked());
-        ++nIndex;
-    }
-}
-
-
 
-
-void TabBar::AddCustomizationMenuEntries (
-    PopupMenu& rMenu,
-    const sal_Int32 nFirstIndex)
+IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG)
 {
-    sal_Int32 nIndex (nFirstIndex);
-    for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
-        iItem!=iEnd;
-        ++iItem)
-    {
-        rMenu.InsertItem(nIndex, iItem->maDeckDescriptor.msTitle, MIB_CHECKABLE);
-        rMenu.CheckItem(nIndex, !iItem->mbIsHidden);
-        ++nIndex;
-    }
+    maDeckActivationFunctor(msDeckId);
+    return 1;
 }
 
 
 
 
-const DeckDescriptor& TabBar::GetDeckDescriptorForIndex (const sal_Int32 nIndex) const
+const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
 {
-    if (nIndex<0 || nIndex>=maItems.size())
+    if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
         throw RuntimeException();
     else
-        return maItems[nIndex].maDeckDescriptor;
+        return maItems[nIndex].msDeckId;
 }
 
 
@@ -330,11 +302,14 @@ const DeckDescriptor& TabBar::GetDeckDes
 
 void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
 {
-    if (nIndex<0 || nIndex>=maItems.size())
+    if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
         throw RuntimeException();
     else
     {
         maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
+        ResourceManager::Instance().SetIsDeckEnabled(
+            maItems[nIndex].msDeckId,
+            maItems[nIndex].mbIsHidden);
         Layout();
     }
 }
@@ -362,13 +337,39 @@ void TabBar::RestoreHideFlags (void)
 
 
 
-IMPL_LINK(TabBar, OnToolboxClicked, void*, pToolBox)
+IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
 {
-    //    mpMenuButton->EndSelection();
+    ::std::vector<DeckMenuData> aSelectionData;
+    ::std::vector<DeckMenuData> aShowData;
+    
+    for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
+        iItem!=iEnd;
+        ++iItem)
+    {
+        const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
+        if (pDeckDescriptor != NULL)
+        {
+            if ( ! iItem->mbIsHidden)
+                aSelectionData.push_back(
+                    DeckMenuData(
+                        pDeckDescriptor->msTitle,
+                        pDeckDescriptor->msId,
+                        iItem->mpButton->IsChecked()));
+
+            aShowData.push_back(
+                DeckMenuData(
+                    pDeckDescriptor->msTitle,
+                    pDeckDescriptor->msId,
+                    !iItem->mbIsHidden));
+        }
+    }
+
     maPopupMenuProvider(
         Rectangle(
             mpMenuButton->GetPosPixel(),
-            mpMenuButton->GetSizePixel()));
+            mpMenuButton->GetSizePixel()),
+        aSelectionData,
+        aShowData);
     
     return 0;
 }

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabBar.hxx Tue Jan 29 08:14:09 2013
@@ -25,9 +25,14 @@
 #include "DeckDescriptor.hxx"
 #include "ResourceManager.hxx"
 
-#include "vcl/window.hxx"
+#include <vcl/menu.hxx>
+#include <vcl/window.hxx>
+
+#include <boost/function.hpp>
+#include <boost/tuple/tuple.hpp>
 
 class Button;
+class RadioButton;
 
 namespace sfx2 { namespace sidebar {
 
@@ -40,11 +45,20 @@ class TabBar
     : public Window
 {
 public:
+    /** DeckMenuData has entries for display name, deck id, and a flag:
+         - isCurrentDeck for the deck selection data
+         - isEnabled     for the show/hide menu 
+    */
+    typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData;
+    typedef ::boost::function<void(
+            const Rectangle&,
+            const ::std::vector<DeckMenuData>& rDeckSelectionData,
+            const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider;
     TabBar (
         Window* pParentWindow,
         const cssu::Reference<css::frame::XFrame>& rxFrame,
-        const ::boost::function<void(const DeckDescriptor&)>& rDeckActivationFunctor,
-        const ::boost::function<void(const Rectangle&)>& rPopupMenuProvider);
+        const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
+        const PopupMenuProvider& rPopupMenuProvider);
     virtual ~TabBar (void);
 
     virtual void Paint (const Rectangle& rUpdateArea);
@@ -53,7 +67,7 @@ public:
     static sal_Int32 GetDefaultWidth (void);
 
     void SetDecks (
-        const ResourceManager::DeckContainer& rDeckDescriptors);
+        const ResourceManager::IdContainer& rDeckIds);
     void HighlightDeck (const ::rtl::OUString& rsDeckId);
     void AddPopupMenuEntries (
         PopupMenu& rMenu,
@@ -61,7 +75,7 @@ public:
     void AddCustomizationMenuEntries (
         PopupMenu& rMenu,
         const sal_Int32 nFirstIndex);
-    const DeckDescriptor& GetDeckDescriptorForIndex (const sal_Int32 nIndex) const;
+    const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const;
     void ToggleHideFlag (const sal_Int32 nIndex);
     void RestoreHideFlags (void);
     
@@ -73,16 +87,16 @@ private:
     public:
         DECL_LINK(HandleClick, Button*);
         RadioButton* mpButton;
-        DeckDescriptor maDeckDescriptor;
-        ::boost::function<void(const DeckDescriptor&)> maDeckActivationFunctor;
+        ::rtl::OUString msDeckId;
+        ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
         bool mbIsHidden;
         bool mbIsHiddenByDefault;
     };
     typedef ::std::vector<Item> ItemContainer;
     ItemContainer maItems;
-    const ::boost::function<void(const DeckDescriptor&)> maDeckActivationFunctor;
+    const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
     sal_Int32 mnMenuSeparatorY;
-    ::boost::function<void(const Rectangle&)> maPopupMenuProvider;
+    PopupMenuProvider maPopupMenuProvider;
     
     RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
     Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TabItem.cxx Tue Jan 29 08:14:09 2013
@@ -66,8 +66,10 @@ void TabItem::Paint (const Rectangle& rU
                 Rectangle(Point(0,0), GetSizePixel()),
                 2,
                 bIsMouseOver||bIsSelected ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
-                bIsMouseOver ? Theme::GetPaint(Theme::Paint_TabItemBackground) : sidebar::Paint());
-        
+                bIsMouseOver
+                    ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
+                    : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
+
             const Image aIcon (Button::GetModeImage(Theme::IsHighContrastMode()
                     ? BMP_COLOR_HIGHCONTRAST
                     : BMP_COLOR_NORMAL));

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Theme.cxx Tue Jan 29 08:14:09 2013
@@ -62,6 +62,7 @@ Theme::Theme (void)
       maIntegers(),
       maBooleans(),
       mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()),
+      mbIsHighContrastModeSetManually(false),
       maPropertyNameToIdMap(),
       maPropertyIdToNameMap(),
       maRawValues(),
@@ -142,6 +143,18 @@ bool Theme::GetBoolean (const ThemeItem 
 
 
 
+Rectangle Theme::GetRectangle (const ThemeItem eItem)
+{
+    const PropertyType eType (GetPropertyType(eItem));
+    OSL_ASSERT(eType==PT_Rectangle);
+    const sal_Int32 nIndex (GetIndex(eItem, eType));
+    const Theme& rTheme (GetCurrentTheme());
+    return rTheme.maRectangles[nIndex];
+}
+
+
+
+
 bool Theme::IsHighContrastMode (void)
 {
     const Theme& rTheme (GetCurrentTheme());
@@ -153,8 +166,16 @@ bool Theme::IsHighContrastMode (void)
 
 void Theme::HandleDataChange (void)
 {
-    GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
-    GetCurrentTheme().InitializeTheme();
+    Theme& rTheme (GetCurrentTheme());
+
+    if ( ! rTheme.mbIsHighContrastModeSetManually)
+    {
+        // Do not modify mbIsHighContrastMode when it was manually set.
+        GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+        rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode);
+    }
+
+    GetCurrentTheme().UpdateTheme();
 }
 
 
@@ -162,16 +183,41 @@ void Theme::HandleDataChange (void)
 
 void Theme::InitializeTheme (void)
 {
+    setPropertyValue(
+        maPropertyIdToNameMap[Bool_UseSymphonyIcons],
+        Any(true));
+    setPropertyValue(
+        maPropertyIdToNameMap[Bool_UseSystemColors],
+        Any(false));
+}
+
+
+
+
+void Theme::UpdateTheme (void)
+{
     SidebarResource aLocalResource;
 
     try
     {
+        const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings());
+        const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors));
+
+#define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n))
+
         setPropertyValue(
             maPropertyIdToNameMap[Paint_DeckBackground],
-            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : 0xf0f0f0)));
+            Any(sal_Int32(Alternatives(
+                        0xf0f0f0,
+                        0x000000,
+                        rStyle.GetDialogColor().GetRGBColor()))));
+
         setPropertyValue(
             maPropertyIdToNameMap[Paint_DeckTitleBarBackground],
-            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 :0xf0f0f0)));
+            Any(sal_Int32(Alternatives(
+                        0xf0f0f0,
+                        0x000000,
+                        rStyle.GetDialogColor().GetRGBColor()))));
         setPropertyValue(
             maPropertyIdToNameMap[Int_DeckLeftPadding],
             Any(sal_Int32(2)));
@@ -192,11 +238,16 @@ void Theme::InitializeTheme (void)
             Any(sal_Int32(1)));
         setPropertyValue(
             maPropertyIdToNameMap[Color_DeckTitleFont],
-            Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
+            Any(sal_Int32(Alternatives(
+                        0x262626,
+                        0x00ff00,
+                        rStyle.GetDialogTextColor().GetRGBColor()))));
         setPropertyValue(
             maPropertyIdToNameMap[Int_DeckTitleBarHeight],
-            Any(sal_Int32(26)));
-
+            Any(sal_Int32(Alternatives(
+                        26,
+                        26,
+                        rStyle.GetFloatTitleHeight()))));
         setPropertyValue(
             maPropertyIdToNameMap[Paint_PanelBackground],
             Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : 0xffffff)));
@@ -208,8 +259,10 @@ void Theme::InitializeTheme (void)
             Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626)));
         setPropertyValue(
             maPropertyIdToNameMap[Int_PanelTitleBarHeight],
-            Any(sal_Int32(26)));
-
+            Any(sal_Int32(Alternatives(
+                        26,
+                        26,
+                        rStyle.GetTitleHeight()))));
         setPropertyValue(
             maPropertyIdToNameMap[Paint_TabBarBackground],
             Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : 0xf0f0f0)));
@@ -246,15 +299,18 @@ void Theme::InitializeTheme (void)
             maPropertyIdToNameMap[Color_TabItemBorder],
             Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf)));
         setPropertyValue(
-            maPropertyIdToNameMap[Paint_TabItemBackground],
-            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : 0xffffff)));
+            maPropertyIdToNameMap[Paint_TabItemBackgroundNormal],
+            Any());
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight],
+            Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : 0x00ffffff)));
 
         setPropertyValue(
             maPropertyIdToNameMap[Paint_HorizontalBorder],
-            Any(sal_Int32(mbIsHighContrastMode ? 0xff00ff000 : 0xd9d9d9)));
+            Any(sal_Int32(mbIsHighContrastMode ? 0xff00ff00 : 0xd9d9d9)));
         setPropertyValue(
             maPropertyIdToNameMap[Paint_VerticalBorder],
-            Any(sal_Int32(mbIsHighContrastMode ? 0xff00ff000 : 0xd9d9d9)));
+            Any(sal_Int32(mbIsHighContrastMode ? 0xff00ff00 : 0xd9d9d9)));
 
         setPropertyValue(
             maPropertyIdToNameMap[Image_Grip],
@@ -278,15 +334,52 @@ void Theme::InitializeTheme (void)
             maPropertyIdToNameMap[Image_Menu],
             Any(
                 mbIsHighContrastMode
-                    ? A2S("private:graphicrepository/sfx2/res/menu_ch.png")
+                    ? A2S("private:graphicrepository/sfx2/res/menu_hc.png")
                     : A2S("private:graphicrepository/sfx2/res/menu.png")));
+        setPropertyValue(
+            maPropertyIdToNameMap[Image_ToolBoxItemSeparator],
+            Any(
+                A2S("private:graphicrepository/sfx2/res/separator.png")));
 
+        // ToolBox
         setPropertyValue(
-            maPropertyIdToNameMap[Bool_UseSymphonyIcons],
-            Any(true));
-    }
-    catch(beans::UnknownPropertyException&)
-    {
+            maPropertyIdToNameMap[Paint_ToolBoxBackground],
+            Any(Tools::VclToAwtGradient(Gradient(
+                        GRADIENT_LINEAR,
+                        Color(0xf2f2f2),
+                        Color(0xfefefe)
+                        ))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight],
+            mbIsHighContrastMode
+                ? Any(util::Color(sal_uInt32(0x00ff00)))
+                : Any(util::Color(sal_uInt32(0xf2f2f2))));
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxPadding],
+            Any(awt::Rectangle(2,2,2,2)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Rect_ToolBoxBorder],
+            Any(awt::Rectangle(1,1,1,1)));
+        setPropertyValue(
+            maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator],
+            Any(false));
+    }
+    catch(beans::UnknownPropertyException& rException)
+    {
+        OSL_TRACE("unknown property: %s",
+            OUStringToOString(
+                rException.Message,
+                RTL_TEXTENCODING_ASCII_US).getStr());
         OSL_ASSERT(false);
     }
 }
@@ -338,7 +431,7 @@ Reference<beans::XPropertySet> Theme::Ge
 Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void)
     throw(cssu::RuntimeException)
 {
-    return Reference<beans::XPropertySetInfo>();
+    return Reference<beans::XPropertySetInfo>(this);
 }
 
 
@@ -351,11 +444,11 @@ void SAL_CALL Theme::setPropertyValue (
 {
     PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
     if (iId == maPropertyNameToIdMap.end())
-        throw beans::UnknownPropertyException();
+        throw beans::UnknownPropertyException(rsPropertyName, NULL);
 
     const PropertyType eType (GetPropertyType(iId->second));
     if (eType == PT_Invalid)
-        throw beans::UnknownPropertyException();
+        throw beans::UnknownPropertyException(rsPropertyName, NULL);
 
     const ThemeItem eItem (iId->second);
         
@@ -544,20 +637,92 @@ void SAL_CALL Theme::removeVetoableChang
 
 
 
+cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void)
+    throw(cssu::RuntimeException)
+{
+    ::std::vector<beans::Property> aProperties;
+
+    for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem)
+    {
+        const ThemeItem eItem (static_cast<ThemeItem>(nItem));
+        const PropertyType eType (GetPropertyType(eItem));
+        if (eType == PT_Invalid)
+            continue;
+
+        const beans::Property aProperty(
+            maPropertyIdToNameMap[eItem],
+            eItem,
+            GetCppuType(eType),
+            0);
+        aProperties.push_back(aProperty);
+    }
+        
+    return cssu::Sequence<css::beans::Property>(
+        &aProperties.front(),
+        aProperties.size());
+}
+
+
+
+
+beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
+    throw(css::beans::UnknownPropertyException,
+        cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        throw beans::UnknownPropertyException();
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        throw beans::UnknownPropertyException();
+
+    const ThemeItem eItem (iId->second);
+
+    return beans::Property(
+        rsPropertyName,
+        eItem,
+        GetCppuType(eType),
+        0);
+}
+
+
+
+
+sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
+    throw(cssu::RuntimeException)
+{
+    PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
+    if (iId == maPropertyNameToIdMap.end())
+        return sal_False;
+
+    const PropertyType eType (GetPropertyType(iId->second));
+    if (eType == PT_Invalid)
+        return sal_False;
+
+    return sal_True;
+}
+
+
+
+
 void Theme::SetupPropertyMaps (void)
 {
-    maPropertyIdToNameMap.resize(__Post_Bool);
+    maPropertyIdToNameMap.resize(__Post_Rect);
     maImages.resize(__Image_Color - __Pre_Image - 1);
     maColors.resize(__Color_Paint - __Image_Color - 1);
     maPaints.resize(__Paint_Int - __Color_Paint - 1);
     maIntegers.resize(__Int_Bool - __Paint_Int - 1);
-    maBooleans.resize(__Post_Bool - __Int_Bool - 1);
+    maBooleans.resize(__Bool_Rect - __Int_Bool - 1);
+    maRectangles.resize(__Post_Rect - __Bool_Rect - 1);
     
     #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e)
+    
     AddEntry(Image_Grip);
     AddEntry(Image_Expand);
     AddEntry(Image_Collapse);
     AddEntry(Image_Menu);
+    AddEntry(Image_ToolBoxItemSeparator);
 
     AddEntry(Color_DeckTitleFont);
     AddEntry(Color_PanelTitleFont);
@@ -569,9 +734,14 @@ void Theme::SetupPropertyMaps (void)
     AddEntry(Paint_PanelBackground);
     AddEntry(Paint_PanelTitleBarBackground);
     AddEntry(Paint_TabBarBackground);
-    AddEntry(Paint_TabItemBackground);
+    AddEntry(Paint_TabItemBackgroundNormal);
+    AddEntry(Paint_TabItemBackgroundHighlight);
     AddEntry(Paint_HorizontalBorder);
     AddEntry(Paint_VerticalBorder);
+    AddEntry(Paint_ToolBoxBackground);
+    AddEntry(Paint_ToolBoxBorderTopLeft);
+    AddEntry(Paint_ToolBoxBorderCenterCorners);
+    AddEntry(Paint_ToolBoxBorderBottomRight);
 
     AddEntry(Int_DeckTitleBarHeight);
     AddEntry(Int_DeckBorderSize);
@@ -591,6 +761,13 @@ void Theme::SetupPropertyMaps (void)
     AddEntry(Int_TabBarBottomPadding);
 
     AddEntry(Bool_UseSymphonyIcons);
+    AddEntry(Bool_UseSystemColors);
+    AddEntry(Bool_UseToolBoxItemSeparator);
+    AddEntry(Bool_IsHighContrastModeActive);
+
+    AddEntry(Rect_ToolBoxPadding);
+    AddEntry(Rect_ToolBoxBorder);
+    
     #undef AddEntry
 
     maRawValues.resize(maPropertyIdToNameMap.size());
@@ -607,6 +784,7 @@ Theme::PropertyType Theme::GetPropertyTy
         case Image_Expand:
         case Image_Collapse:
         case Image_Menu:
+        case Image_ToolBoxItemSeparator:
             return PT_Image;
 
         case Color_DeckTitleFont:
@@ -620,9 +798,14 @@ Theme::PropertyType Theme::GetPropertyTy
         case Paint_PanelBackground:
         case Paint_PanelTitleBarBackground:
         case Paint_TabBarBackground:
-        case Paint_TabItemBackground:
+        case Paint_TabItemBackgroundNormal:
+        case Paint_TabItemBackgroundHighlight:
         case Paint_HorizontalBorder:
         case Paint_VerticalBorder:
+        case Paint_ToolBoxBackground:
+        case Paint_ToolBoxBorderTopLeft:
+        case Paint_ToolBoxBorderCenterCorners:
+        case Paint_ToolBoxBorderBottomRight:
             return PT_Paint;
 
         case Int_DeckTitleBarHeight:
@@ -644,8 +827,15 @@ Theme::PropertyType Theme::GetPropertyTy
             return PT_Integer;
 
         case Bool_UseSymphonyIcons:
+        case Bool_UseSystemColors:
+        case Bool_UseToolBoxItemSeparator:
+        case Bool_IsHighContrastModeActive:
             return PT_Boolean;
 
+        case Rect_ToolBoxBorder:
+        case Rect_ToolBoxPadding:
+            return PT_Rectangle;
+            
         default:
             return PT_Invalid;
     }
@@ -654,6 +844,37 @@ Theme::PropertyType Theme::GetPropertyTy
 
 
 
+cssu::Type Theme::GetCppuType (const PropertyType eType)
+{
+    switch(eType)
+    {
+        case PT_Image:
+            return getCppuType((rtl::OUString*)NULL);
+
+        case PT_Color:
+            return getCppuType((sal_uInt32*)NULL);
+
+        case PT_Paint:
+            return getCppuVoidType();
+
+        case PT_Integer:
+            return getCppuType((sal_Int32*)NULL);
+
+        case PT_Boolean:
+            return getCppuType((sal_Bool*)NULL);
+
+        case PT_Rectangle:
+            return getCppuType((awt::Rectangle*)NULL);
+
+        case PT_Invalid:
+        default:
+            return getCppuVoidType();
+    }
+}
+
+
+
+
 sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
 {
     switch(eType)
@@ -668,6 +889,8 @@ sal_Int32 Theme::GetIndex (const ThemeIt
             return eItem - __Paint_Int-1;
         case PT_Boolean:
             return eItem - __Int_Bool-1;
+        case PT_Rectangle:
+            return eItem - __Bool_Rect-1;
 
         default:
             OSL_ASSERT(false);
@@ -796,7 +1019,7 @@ void Theme::ProcessNewValue (
         }
         case PT_Color:
         {
-            sal_Int32 nColorValue;
+            sal_Int32 nColorValue (0);
             if (rValue >>= nColorValue)
             {
                 maColors[nIndex] = Color(nColorValue);
@@ -805,16 +1028,12 @@ void Theme::ProcessNewValue (
         }
         case PT_Paint:
         {
-            sal_Int32 nColorValue;
-            if (rValue >>= nColorValue)
-            {
-                maPaints[nIndex] = Paint(Color(nColorValue));
-            }
+            maPaints[nIndex] = Paint::Create(rValue);
             break;
         }
         case PT_Integer:
         {
-            sal_Int32 nValue;
+            sal_Int32 nValue (0);
             if (rValue >>= nValue)
             {
                 maIntegers[nIndex] = nValue;
@@ -823,10 +1042,33 @@ void Theme::ProcessNewValue (
         }
         case PT_Boolean:
         {
-            sal_Bool nValue;
+            sal_Bool nValue (0);
             if (rValue >>= nValue)
             {
                 maBooleans[nIndex] = (nValue==sal_True);
+                if (eItem == Bool_IsHighContrastModeActive)
+                {
+                    mbIsHighContrastModeSetManually = true;
+                    mbIsHighContrastMode = maBooleans[nIndex];
+                    HandleDataChange();
+                }
+                else if (eItem == Bool_UseSystemColors)
+                {
+                    HandleDataChange();
+                }
+            }
+            break;
+        }
+        case PT_Rectangle:
+        {
+            awt::Rectangle aBox;
+            if (rValue >>= aBox)
+            {
+                maRectangles[nIndex] = Rectangle(
+                    aBox.X,
+                    aBox.Y,
+                    aBox.Width,
+                    aBox.Height);
             }
             break;
         }

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/TitleBar.cxx Tue Jan 29 08:14:09 2013
@@ -53,25 +53,10 @@ TitleBar::~TitleBar (void)
 
 void TitleBar::Paint (const Rectangle& rUpdateArea)
 {
+    (void)rUpdateArea;
+
     // Paint title bar background.
     Size aWindowSize( GetOutputSizePixel() );
-    /*
-    int nOuterLeft = 0;
-    const SvBorder aBorder( 3, 1, 3, 3 );
-    const sal_Int32 m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
-    int nInnerLeft = nOuterLeft + aBorder.Left() - 1;
-    int nOuterRight = aWindowSize.Width() - 1;
-    int nInnerRight = nOuterRight - aBorder.Right() + 1;
-    int nInnerTop = m_nTitleBarHeight + aBorder.Top() - 1;
-    int nOuterBottom = aWindowSize.Height() - 1;
-    int nInnerBottom = nOuterBottom - aBorder.Bottom() + 1;
-    Rectangle aTitleBarBox(
-        nOuterLeft,
-        0, 
-        nOuterRight, 
-        nInnerTop-1
-        );
-    */
     Rectangle aTitleBarBox(
         0,
         0, 

Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx?rev=1439779&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx Tue Jan 29 08:14:09 2013
@@ -0,0 +1,148 @@
+/**************************************************************
+ * 
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+
+#include "ToolBoxBackground.hxx"
+#include "Paint.hxx"
+#include "DrawHelper.hxx"
+#include "Tools.hxx"
+#include "sfx2/sidebar/Theme.hxx"
+
+#include <vcl/toolbox.hxx>
+#include <vcl/gradient.hxx>
+
+
+namespace sfx2 { namespace sidebar {
+
+ToolBoxBackground::ToolBoxBackground (Window* pParentWindow)
+    : Window(pParentWindow),
+      maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)))
+{
+    SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+}
+
+
+
+
+ToolBoxBackground::~ToolBoxBackground (void)
+{
+    Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler));
+    if (GetChildCount() > 0)
+        GetChild(0)->RemoveEventListener(aEventListener);
+}
+
+
+
+
+Point ToolBoxBackground::SetToolBoxChild (
+    ToolBox* pChild,
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    sal_uInt16 nFlags)
+{
+    if (pChild == NULL)
+    {
+        OSL_ASSERT(pChild!=NULL);
+        return Point(nX, nY);
+    }
+
+    Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler));
+    pChild->AddEventListener(aEventListener);
+    
+    SetPosSizePixel(
+        nX - maPadding.Left(),
+        nY - maPadding.Top(),
+        nWidth + maPadding.Left() + maPadding.Right(),
+        nHeight + maPadding.Top() + maPadding.Bottom(),
+        nFlags);
+    return Point(
+        maPadding.Left(),
+        maPadding.Top());
+}
+
+
+
+
+void ToolBoxBackground::Paint (const Rectangle& rRect)
+{
+    Window::Paint(rRect);
+
+    OSL_TRACE("paint ToolBoxBackground at %d,%d",
+        GetPosPixel().X(),
+        GetPosPixel().Y());
+    Rectangle aBox (Point(0,0), GetSizePixel());
+    
+    const sidebar::Paint aTopLeftBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderTopLeft));
+    const sidebar::Paint aCenterBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderCenterCorners));
+    const sidebar::Paint aBottomRightBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderBottomRight));
+    const Rectangle aBorderSize (Theme::GetRectangle(Theme::Rect_ToolBoxBorder));
+    DrawHelper::DrawBevelBorder (
+        *this,
+        aBox,
+        Tools::RectangleToSvBorder(aBorderSize),
+        aTopLeftBorderPaint,
+        aCenterBorderPaint,
+        aBottomRightBorderPaint);
+}
+
+
+
+
+void ToolBoxBackground::DataChanged (const DataChangedEvent& rEvent)
+{
+    (void)rEvent;
+    
+    SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper());
+    maPadding = Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding));
+}
+
+
+
+
+IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent)
+{
+    if (pEvent != NULL)
+    {
+        switch (pEvent->GetId())
+        {
+            case VCLEVENT_WINDOW_SHOW:
+                if (GetChild(0)->IsVisible())
+                    Show();
+                break;
+
+            case VCLEVENT_WINDOW_HIDE:
+                if ( ! GetChild(0)->IsVisible())
+                    Hide();
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    return sal_True;
+}
+
+
+} } // end of namespace sfx2::sidebar

Propchange: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.cxx
------------------------------------------------------------------------------
    svn:executable = *

Added: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx?rev=1439779&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx (added)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx Tue Jan 29 08:14:09 2013
@@ -0,0 +1,68 @@
+/**************************************************************
+ * 
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX
+#define SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX
+
+#include "vcl/window.hxx"
+
+#include <tools/svborder.hxx>
+
+
+class ToolBox;
+
+namespace sfx2 { namespace sidebar {
+
+class ToolBoxBackground
+    : public Window
+{
+public:
+    ToolBoxBackground (Window* pParentWindow);
+    virtual ~ToolBoxBackground (void);
+
+    /** Call this method once to
+        a) let the ToolBoxBackground object know which ToolBox to
+           monitor and
+        b) so that position and sizes can be set up.
+        @return
+            The relative position of the child.
+    */
+    Point SetToolBoxChild (
+        ToolBox* pChild,
+        long nX,
+        long nY,
+        long nWidth,
+        long nHeight,
+        sal_uInt16 nFlags);
+    
+    virtual void Paint (const Rectangle& rRect);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+    SvBorder maPadding;
+
+    DECL_LINK(WindowEventHandler, VclWindowEvent*);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif

Propchange: openoffice/branches/sidebar/main/sfx2/source/sidebar/ToolBoxBackground.hxx
------------------------------------------------------------------------------
    svn:executable = *

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.cxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.cxx Tue Jan 29 08:14:09 2013
@@ -29,7 +29,11 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/namedvaluecollection.hxx>
+#include <vcl/gradient.hxx>
 
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+#include <cstring>
 
 using namespace css;
 using namespace cssu;
@@ -99,4 +103,54 @@ Image Tools::GetImage (
 }
 
 
+
+
+css::awt::Gradient Tools::VclToAwtGradient (const Gradient aVclGradient)
+{
+    css::awt::Gradient aAwtGradient (
+        awt::GradientStyle(aVclGradient.GetStyle()),
+        aVclGradient.GetStartColor().GetRGBColor(),
+        aVclGradient.GetEndColor().GetRGBColor(),
+        aVclGradient.GetAngle(),
+        aVclGradient.GetBorder(),
+        aVclGradient.GetOfsX(),
+        aVclGradient.GetOfsY(),
+        aVclGradient.GetStartIntensity(),
+        aVclGradient.GetEndIntensity(),
+        aVclGradient.GetSteps());
+    return aAwtGradient;
+}
+
+
+
+
+Gradient Tools::AwtToVclGradient (const css::awt::Gradient aAwtGradient)
+{
+    Gradient aVclGradient (
+        GradientStyle(aAwtGradient.Style),
+        aAwtGradient.StartColor,
+        aAwtGradient.EndColor);
+    aVclGradient.SetAngle(aAwtGradient.Angle);
+    aVclGradient.SetBorder(aAwtGradient.Border);
+    aVclGradient.SetOfsX(aAwtGradient.XOffset);
+    aVclGradient.SetOfsY(aAwtGradient.YOffset);
+    aVclGradient.SetStartIntensity(aAwtGradient.StartIntensity);
+    aVclGradient.SetEndIntensity(aAwtGradient.EndIntensity);
+    aVclGradient.SetSteps(aAwtGradient.StepCount);
+
+    return aVclGradient;
+}
+
+
+
+
+SvBorder Tools::RectangleToSvBorder (const Rectangle aBox)
+{
+    return SvBorder(
+        aBox.Left(),
+        aBox.Top(),
+        aBox.Right(),
+        aBox.Bottom());
+}
+
 } } // end of namespace sfx2::sidebar

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Tools.hxx Tue Jan 29 08:14:09 2013
@@ -22,7 +22,12 @@
 #ifndef SFX_SIDEBAR_TOOLS_HXX
 #define SFX_SIDEBAR_TOOLS_HXX
 
-#include "vcl/image.hxx"
+#include <vcl/image.hxx>
+#include <vcl/gradient.hxx>
+#include <tools/svborder.hxx>
+
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
 
 
 #define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
@@ -44,6 +49,11 @@ public:
     static Image GetImage (
         const ::rtl::OUString& rsURL,
         const cssu::Reference<css::frame::XFrame>& rxFrame);
+
+    static css::awt::Gradient VclToAwtGradient (const Gradient aGradient);
+    static Gradient AwtToVclGradient (const css::awt::Gradient aGradient);
+
+    static SvBorder RectangleToSvBorder (const Rectangle aBox);
 };
 
 

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx Tue Jan 29 08:14:09 2013
@@ -41,7 +41,7 @@ void ContextChangeEventMultiplexer::Noti
     const cssu::Reference<css::frame::XController>& rxController,
     const ::sfx2::sidebar::EnumContext::Context eContext)
 {
-    if (rxController.is())
+    if (rxController.is() && rxController->getFrame().is())
     {
         const css::ui::ContextChangeEventObject aEvent(
             rxController,
@@ -72,8 +72,10 @@ void ContextChangeEventMultiplexer::Noti
     }
     catch (const Exception&)
     {
-        DBG_UNHANDLED_EXCEPTION();
+        // An exception typically means that a context change is notified
+        // during initialization or destruction of a view.
+        // Ignore it.
     }
     return ::sfx2::sidebar::EnumContext::GetApplicationName(
-        ::sfx2::sidebar::EnumContext::Application_Other);
+        ::sfx2::sidebar::EnumContext::Application_Unknown);
 }

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx?rev=1439779&r1=1439778&r2=1439779&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx Tue Jan 29 08:14:09 2013
@@ -22,10 +22,10 @@
 #include "sidebar/PanelFactory.hxx"
 
 #include "text/TextPropertyPanel.hxx"
-
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/window.hxx>
-#include <sfx2/sfxbasecontroller.hxx>
 #include <rtl/ref.hxx>
 
 
@@ -51,7 +51,6 @@ namespace svx { namespace sidebar {
 
 cssu::Reference<cssu::XInterface> SAL_CALL PanelFactory::createInstance (
     const uno::Reference<lang::XMultiServiceFactory>& rxFactory)
-    throw(uno::Exception)
 {
     (void)rxFactory;
     
@@ -136,7 +135,13 @@ Reference<ui::XUIElement> SAL_CALL Panel
             NULL);
 
     if (rsResourceURL.endsWithAsciiL("/TextPropertyPanel", strlen("/TextPropertyPanel")))
-        xElement = TextPropertyPanel::Create(rsResourceURL, pParentWindow, xFrame, pBindings);
+    {
+        TextPropertyPanel* pPanel = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings);
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pPanel);
+    }
 
     return xElement;
 }