Resolves: #i122104# Fixed selection of sidebar button.

(cherry picked from commit 8d956f9ec332f818fbe49286ba8eec28179486f2)

Change-Id: If87b0dd13d1d333212d41f0a1e1122e4ef6c5ab2
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 55a384e..887e245 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -59,6 +59,7 @@ using namespace cssu;
using ::rtl::OUString;


#undef VERBOSE

namespace sfx2 { namespace sidebar {

@@ -149,7 +150,6 @@ void SAL_CALL SidebarController::disposing (void)
    if (mpCurrentDeck)
    {
        mpCurrentDeck->Dispose();
        OSL_TRACE("deleting deck window subtree");
        mpCurrentDeck->PrintWindowTree();
        mpCurrentDeck.reset();
    }
@@ -256,7 +256,7 @@ void SidebarController::NotifyResize (void)
        mnSavedSidebarWidth = nWidth;

    RestrictWidth();
#ifdef DEBUG
#ifdef VERBOSE
    if (mpCurrentDeck)
    {
        mpCurrentDeck->PrintWindowTree();
@@ -315,6 +315,10 @@ void SidebarController::UpdateConfigurations (const Context& rContext)
        {
            msCurrentDeckId = pDeckDescriptor->msId;
            SwitchToDeck(*pDeckDescriptor, rContext);

            // Tell the tab bar to highlight the button associated
            // with the deck.
            mpTabBar->HighlightDeck(msCurrentDeckId);
        }

#ifdef DEBUG
@@ -439,7 +443,6 @@ void SidebarController::SwitchToDeck (
        {
            // Panel already exists in current deck.  Reuse it.
            aNewPanels[nWriteIndex] = *iPanel;
            OSL_TRACE("    reusing panel %s", S2A(rPanelContexDescriptor.msId));
        }
        else
        {
@@ -448,7 +451,6 @@ void SidebarController::SwitchToDeck (
                rPanelContexDescriptor.msId,
                mpCurrentDeck->GetPanelParentWindow(),
                rPanelContexDescriptor.msMenuCommand);
            OSL_TRACE("    creating panel %s", S2A(rPanelContexDescriptor.msId));
            bHasPanelSetChanged = true;
        }
        if (aNewPanels[nWriteIndex] != NULL)
@@ -471,10 +473,6 @@ void SidebarController::SwitchToDeck (
    mpCurrentDeck->SetPanels(aNewPanels);
    mpCurrentDeck->Show();

    // Tell the tab bar to highlight the button associated with the
    // deck.
    mpTabBar->HighlightDeck(rDeckDescriptor.msId);

    mpParentWindow->SetText(rDeckDescriptor.msTitle);

    if (bHasPanelSetChanged)
@@ -493,7 +491,7 @@ bool SidebarController::ArePanelSetsEqual (
    const SharedPanelContainer& rCurrentPanels,
    const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
{
#ifdef DEBUG
#ifdef VERBOSE
    OSL_TRACE("current panel list:");
    for (SharedPanelContainer::const_iterator
             iPanel(rCurrentPanels.begin()),
@@ -539,12 +537,6 @@ SharedPanel SidebarController::CreatePanel (
    if (pPanelDescriptor == NULL)
        return SharedPanel();

#ifdef DEBUG
    // Prevent the panel not being created in the same memory of an old panel.
    ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]);
    OSL_TRACE("allocated memory at %x", pUnused.get());
#endif

    // Create the panel which is the parent window of the UIElement.
    SharedPanel pPanel (new Panel(
        *pPanelDescriptor,