[Libreoffice-commits] core.git: sfx2/source

Caolán McNamara caolanm at redhat.com
Thu May 7 06:39:05 PDT 2015


 sfx2/source/sidebar/SidebarController.cxx |   90 ++++++++++++------------------
 1 file changed, 37 insertions(+), 53 deletions(-)

New commits:
commit 4073afa350387f9fc9194347ad78c6cbdabbb812
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 7 14:37:36 2015 +0100

    Resolves: tdf#72007: on switching decks keep our left indent, don't assume 0
    
    Change-Id: I878c999611e1294d5107f1cf2c000d9ed5f88cb1

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 682049c..e34f44c 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -324,62 +324,33 @@ void SidebarController::NotifyResize()
     if (mpCurrentDeck)
     {
         SfxSplitWindow* pSplitWindow = GetSplitWindow();
-        if (pSplitWindow)   //in sidebar mode
+        WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_LEFT;
+        long nDeckX, nTabX;
+        if (eAlign == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
         {
-            // Find out that which side of the Window do we need to attach the Sidebar?
-            if ( pSplitWindow->GetAlign() == WINDOWALIGN_RIGHT )        // attach the Sidebar towards the right-side of screen
-            {
-                // Place the deck first.
-                {
-                    if (bIsDeckVisible)
-                    {
-                        mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight);
-                        mpCurrentDeck->Show();
-                        mpCurrentDeck->RequestLayout();
-                    }
-                    else
-                        mpCurrentDeck->Hide();
-                }
-
-                // Now place the tab bar.
-                mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
-                mpTabBar->Show();
-            }
-            else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
-            {
-                // Place the tab bar first.
-                mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight);
-                mpTabBar->Show();
-
-                // Now place the deck.
-                if (bIsDeckVisible)
-                {
-                    mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight);
-                    mpCurrentDeck->Show();
-                    mpCurrentDeck->RequestLayout();
-                }
-                else
-                    mpCurrentDeck->Hide();
-            }
+            nDeckX = nTabBarDefaultWidth;
+            nTabX = 0;
         }
-        else //floating window mode
+        else   // attach the Sidebar towards the right-side of screen
         {
-            // Place the deck first.
-            {
-                if (bIsDeckVisible)
-                {
-                    mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight);
-                    mpCurrentDeck->Show();
-                    mpCurrentDeck->RequestLayout();
-                }
-                else
-                    mpCurrentDeck->Hide();
-            }
+            nDeckX = 0;
+            nTabX = nWidth-nTabBarDefaultWidth;
+        }
 
-            // Now place the tab bar.
-            mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
-            mpTabBar->Show();
+        // Place the deck first.
+        if (bIsDeckVisible)
+        {
+            mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - nTabBarDefaultWidth, nHeight);
+            mpCurrentDeck->Show();
+            mpCurrentDeck->RequestLayout();
         }
+        else
+            mpCurrentDeck->Hide();
+
+        // Now place the tab bar.
+        mpTabBar->setPosSizePixel(nTabX, 0, nTabBarDefaultWidth, nHeight);
+        mpTabBar->Show();
+
     }
 
     // Determine if the closer of the deck can be shown.
@@ -658,11 +629,24 @@ void SidebarController::SwitchToDeck (
     // mpCurrentPanels - may miss stuff (?)
     aNewPanels.resize(nWriteIndex);
 
+    SfxSplitWindow* pSplitWindow = GetSplitWindow();
+    sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
+    WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_LEFT;
+    long nDeckX;
+    if (eAlign == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
+    {
+        nDeckX = nTabBarDefaultWidth;
+    }
+    else   // attach the Sidebar towards the right-side of screen
+    {
+        nDeckX = 0;
+    }
+
     // Activate the deck and the new set of panels.
     mpCurrentDeck->setPosSizePixel(
+        nDeckX,
         0,
-        0,
-        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(),
+        mpParentWindow->GetSizePixel().Width() - nTabBarDefaultWidth,
         mpParentWindow->GetSizePixel().Height());
 
     mpCurrentDeck->ResetPanels(aNewPanels);


More information about the Libreoffice-commits mailing list