[Libreoffice-commits] core.git: Branch 'feature/sidebar' - sfx2/source

Andre Fischer af at apache.org
Fri May 17 11:45:38 PDT 2013


 sfx2/source/sidebar/SidebarController.cxx    |   28 ++++++++++++++++---------
 sfx2/source/sidebar/SidebarDockingWindow.cxx |   30 +++++++++++++++++++++++++++
 sfx2/source/sidebar/SidebarDockingWindow.hxx |    4 +++
 3 files changed, 52 insertions(+), 10 deletions(-)

New commits:
commit 3c451f893663c118201ccdd4688fe97f1524d21e
Author: Andre Fischer <af at apache.org>
Date:   Thu May 16 09:51:11 2013 +0000

    Resolves: #i122320# Show closer after docking sidebar.
    
    Prevent sidebar from being docked above or below edit view.
    
    (cherry picked from commit ca7264d7ab7e8b70693362d60227c7dd7626df8b)
    
    Change-Id: I634e0b68c27039613054160b7add5d2d07b666cd

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index c4ea537..c3d4262 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1014,11 +1014,13 @@ bool SidebarController::CanModifyChildWindowWidth (void)
 
     sal_uInt16 nRow (0xffff);
     sal_uInt16 nColumn (0xffff);
-    pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow);
-
-    sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));
-
-    return nRowCount==1;
+    if (pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow))
+    {
+        sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn));
+        return nRowCount==1;
+    }
+    else
+        return false;
 }
 
 
@@ -1070,17 +1072,23 @@ void SidebarController::RestrictWidth (void)
 
 SfxSplitWindow* SidebarController::GetSplitWindow (void)
 {
-    if (mpSplitWindow == NULL)
+    if (mpParentWindow != NULL)
     {
-        if (mpParentWindow != NULL)
+        SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+        if (pSplitWindow != mpSplitWindow)
         {
-            mpSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
+            if (mpSplitWindow != NULL)
+                mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
+
+            mpSplitWindow = pSplitWindow;
+
             if (mpSplitWindow != NULL)
                 mpSplitWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
         }
+        return mpSplitWindow;
     }
-
-    return mpSplitWindow;
+    else
+        return NULL;
 }
 
 
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index f991c7a5..3b6a61d 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -102,4 +102,34 @@ sal_Bool SidebarDockingWindow::Close (void)
 }
 
 
+
+
+SfxChildAlignment SidebarDockingWindow::CheckAlignment (
+    SfxChildAlignment eCurrentAlignment,
+    SfxChildAlignment eRequestedAlignment)
+{
+    switch (eRequestedAlignment)
+    {
+        case SFX_ALIGN_TOP:
+        case SFX_ALIGN_HIGHESTTOP:
+        case SFX_ALIGN_LOWESTTOP:
+        case SFX_ALIGN_BOTTOM:
+        case SFX_ALIGN_LOWESTBOTTOM:
+        case SFX_ALIGN_HIGHESTBOTTOM:
+            return eCurrentAlignment;
+
+        case SFX_ALIGN_LEFT:
+        case SFX_ALIGN_RIGHT:
+        case SFX_ALIGN_FIRSTLEFT:
+        case SFX_ALIGN_LASTLEFT:
+        case SFX_ALIGN_FIRSTRIGHT:
+        case SFX_ALIGN_LASTRIGHT:
+            return eRequestedAlignment;
+
+        default:
+            return eRequestedAlignment;
+    }
+}
+
+
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index 2125212..5a54f11 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -49,6 +49,10 @@ protected:
     // Window overridables
     virtual void GetFocus (void);
 
+    virtual SfxChildAlignment CheckAlignment (
+        SfxChildAlignment eCurrentAlignment,
+        SfxChildAlignment eRequestedAlignment);
+
 private:
     ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
 


More information about the Libreoffice-commits mailing list