e0e6f10
From df630b8f8c2c92ec2cd1e4be6a3f54a4e4960e92 Mon Sep 17 00:00:00 2001
e0e6f10
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
e0e6f10
Date: Fri, 27 Jun 2014 15:52:33 +0100
e0e6f10
Subject: [PATCH] Related: fdo#65634 make sidebar react to resizes when
e0e6f10
 floating
e0e6f10
e0e6f10
the parent isn't a SfxSplitWindow in this case, but it should
e0e6f10
still react to the resize
e0e6f10
e0e6f10
Change-Id: Ia298d45b33fc272d6169df12cf2c58a881255163
e0e6f10
---
e0e6f10
 sfx2/source/sidebar/SidebarController.cxx | 70 ++++++++++++++++++-------------
e0e6f10
 1 file changed, 41 insertions(+), 29 deletions(-)
e0e6f10
e0e6f10
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
e0e6f10
index a5dbcfd..cb26640 100644
e0e6f10
--- a/sfx2/source/sidebar/SidebarController.cxx
e0e6f10
+++ b/sfx2/source/sidebar/SidebarController.cxx
e0e6f10
@@ -315,9 +315,6 @@ void SAL_CALL SidebarController::requestLayout (void)
e0e6f10
     RestrictWidth(nMinimalWidth);
e0e6f10
 }
e0e6f10
 
e0e6f10
-
e0e6f10
-
e0e6f10
-
e0e6f10
 void SidebarController::BroadcastPropertyChange (void)
e0e6f10
 {
e0e6f10
     DataChangedEvent aEvent (DATACHANGED_USER);
e0e6f10
@@ -325,9 +322,6 @@ void SidebarController::BroadcastPropertyChange (void)
e0e6f10
     mpParentWindow->Invalidate(INVALIDATE_CHILDREN);
e0e6f10
 }
e0e6f10
 
e0e6f10
-
e0e6f10
-
e0e6f10
-
e0e6f10
 void SidebarController::NotifyResize (void)
e0e6f10
 {
e0e6f10
     if (mpTabBar == 0)
e0e6f10
@@ -361,11 +355,48 @@ void SidebarController::NotifyResize (void)
e0e6f10
     else
e0e6f10
         bIsDeckVisible = false;
e0e6f10
 
e0e6f10
-    SfxSplitWindow* pSplitWindow = GetSplitWindow();
e0e6f10
-    if ( mpCurrentDeck && pSplitWindow )
e0e6f10
+    if (mpCurrentDeck)
e0e6f10
     {
e0e6f10
-        // Find out that which side of the Window do we need to attach the Sidebar?
e0e6f10
-        if ( pSplitWindow->GetAlign() == WINDOWALIGN_RIGHT )        // attach the Sidebar towards the right-side of screen
e0e6f10
+        SfxSplitWindow* pSplitWindow = GetSplitWindow();
e0e6f10
+        if (pSplitWindow)   //in sidebar mode
e0e6f10
+        {
e0e6f10
+            // Find out that which side of the Window do we need to attach the Sidebar?
e0e6f10
+            if ( pSplitWindow->GetAlign() == WINDOWALIGN_RIGHT )        // attach the Sidebar towards the right-side of screen
e0e6f10
+            {
e0e6f10
+                // Place the deck first.
e0e6f10
+                {
e0e6f10
+                    if (bIsDeckVisible)
e0e6f10
+                    {
e0e6f10
+                        mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight);
e0e6f10
+                        mpCurrentDeck->Show();
e0e6f10
+                        mpCurrentDeck->RequestLayout();
e0e6f10
+                    }
e0e6f10
+                    else
e0e6f10
+                        mpCurrentDeck->Hide();
e0e6f10
+                }
e0e6f10
+
e0e6f10
+                // Now place the tab bar.
e0e6f10
+                mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
e0e6f10
+                mpTabBar->Show();
e0e6f10
+            }
e0e6f10
+            else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
e0e6f10
+            {
e0e6f10
+                // Place the tab bar first.
e0e6f10
+                mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight);
e0e6f10
+                mpTabBar->Show();
e0e6f10
+
e0e6f10
+                // Now place the deck.
e0e6f10
+                if (bIsDeckVisible)
e0e6f10
+                {
e0e6f10
+                    mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight);
e0e6f10
+                    mpCurrentDeck->Show();
e0e6f10
+                    mpCurrentDeck->RequestLayout();
e0e6f10
+                }
e0e6f10
+                else
e0e6f10
+                    mpCurrentDeck->Hide();
e0e6f10
+            }
e0e6f10
+        }
e0e6f10
+        else //floating window mode
e0e6f10
         {
e0e6f10
             // Place the deck first.
e0e6f10
             {
e0e6f10
@@ -383,22 +414,6 @@ void SidebarController::NotifyResize (void)
e0e6f10
             mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
e0e6f10
             mpTabBar->Show();
e0e6f10
         }
e0e6f10
-        else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
e0e6f10
-        {
e0e6f10
-            // Place the tab bar first.
e0e6f10
-            mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight);
e0e6f10
-            mpTabBar->Show();
e0e6f10
-
e0e6f10
-            // Now place the deck.
e0e6f10
-            if (bIsDeckVisible)
e0e6f10
-            {
e0e6f10
-                mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight);
e0e6f10
-                mpCurrentDeck->Show();
e0e6f10
-                mpCurrentDeck->RequestLayout();
e0e6f10
-            }
e0e6f10
-            else
e0e6f10
-                mpCurrentDeck->Hide();
e0e6f10
-        }
e0e6f10
     }
e0e6f10
 
e0e6f10
     // Determine if the closer of the deck can be shown.
e0e6f10
@@ -414,9 +429,6 @@ void SidebarController::NotifyResize (void)
e0e6f10
     RestrictWidth(nMinimalWidth);
e0e6f10
 }
e0e6f10
 
e0e6f10
-
e0e6f10
-
e0e6f10
-
e0e6f10
 void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
e0e6f10
 {
e0e6f10
     if ( ! mbIsDeckRequestedOpen)
e0e6f10
-- 
e0e6f10
1.9.3
e0e6f10