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

Prashant Pandey prashant3.yishu at gmail.com
Mon Sep 30 12:51:56 PDT 2013


 sfx2/source/sidebar/SidebarController.cxx |   48 ++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 12 deletions(-)

New commits:
commit 8965bfda9753568a038303d9935f7a451282a857
Author: Prashant Pandey <prashant3.yishu at gmail.com>
Date:   Sat Sep 14 23:16:38 2013 +0530

    Fixing the problem with Sidebar-alignment
    
    Currently, when the sidebar is taken from right side of
    the screen to left side of the screen, the vertical tab
    -bar is still attached towards the right side of deck.
    Ideally, when the sidebar is attched towards the left
    side of the screen, the tab-bar should automatically set
    towards the left side of deck.
    
    Change-Id: I1f56e5f0b7dfef37760e6563e7d757f7901cf2cd
    Reviewed-on: https://gerrit.libreoffice.org/5979
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 9dbb178..02bd076 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -361,22 +361,45 @@ void SidebarController::NotifyResize (void)
     else
         bIsDeckVisible = false;
 
-    // Place the deck.
-    if (mpCurrentDeck)
+    SfxSplitWindow* pSplitWindow = GetSplitWindow();
+    if ( mpCurrentDeck && pSplitWindow )
     {
-        if (bIsDeckVisible)
+        // 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
         {
-            mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
-            mpCurrentDeck->Show();
-            mpCurrentDeck->RequestLayout();
+            // Place the deck first.
+            {
+                if (bIsDeckVisible)
+                {
+                    mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+                    mpCurrentDeck->Show();
+                    mpCurrentDeck->RequestLayout();
+                }
+                else
+                    mpCurrentDeck->Hide();
+            }
+
+            // Now place the tab bar.
+            mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
+            mpTabBar->Show();
         }
-        else
-            mpCurrentDeck->Hide();
-    }
+        else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
+        {
+            // Place the tab bar first.
+            mpTabBar->setPosSizePixel(0,0,TabBar::GetDefaultWidth(),nHeight);
+            mpTabBar->Show();
 
-    // Place the tab bar.
-    mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
-    mpTabBar->Show();
+            // Now place the deck.
+            if (bIsDeckVisible)
+            {
+                mpCurrentDeck->setPosSizePixel(TabBar::GetDefaultWidth(),0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+                mpCurrentDeck->Show();
+                mpCurrentDeck->RequestLayout();
+            }
+            else
+                mpCurrentDeck->Hide();
+        }
+    }
 
     // Determine if the closer of the deck can be shown.
     sal_Int32 nMinimalWidth = 0;
@@ -667,6 +690,7 @@ void SidebarController::SwitchToDeck (
         0,
         mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
         mpParentWindow->GetSizePixel().Height());
+
     mpCurrentDeck->SetPanels(aNewPanels);
     mpCurrentDeck->Show();
 


More information about the Libreoffice-commits mailing list