[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - include/svtools svtools/source

Caolán McNamara caolanm at redhat.com
Fri Feb 24 08:48:21 UTC 2017


 include/svtools/brwbox.hxx              |    2 +-
 svtools/source/brwbox/brwbox1.cxx       |   10 ++++------
 svtools/source/brwbox/editbrowsebox.cxx |   14 ++++++++++----
 3 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 95eff15aa6e02ab875bd898f6be4f23343ba6b9b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 20 16:51:17 2017 +0000

    Resolves: tdf#97731 allow status bar to adapt to its own preferred size
    
    Change-Id: I4390f61a21eef21371ce7399bf746e60234b8db8
    (cherry picked from commit 917d5b8b26a7428f7b7dd495a8db14a3ce16aa55)
    Reviewed-on: https://gerrit.libreoffice.org/34484
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 6a97897..ae38810 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -523,7 +523,7 @@ public:
     void            RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
 
     // miscellaneous
-    void            ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX );
+    bool            ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
     Rectangle       GetControlArea() const;
     bool            ProcessKey( const KeyEvent& rEvt );
     void            Dispatch( sal_uInt16 nId );
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 8a7b1fa..bd6b16b 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2091,19 +2091,18 @@ sal_uInt16 BrowseBox::GetColumnAtXPosPixel( long nX, bool ) const
     return BROWSER_INVALIDID;
 }
 
-
-void BrowseBox::ReserveControlArea( sal_uInt16 nWidth )
+bool BrowseBox::ReserveControlArea(sal_uInt16 nWidth)
 {
-
-    if ( nWidth != nControlAreaWidth )
+    if (nWidth != nControlAreaWidth)
     {
         OSL_ENSURE(nWidth,"Control area of 0 is not allowed, Use USHRT_MAX instead!");
         nControlAreaWidth = nWidth;
         UpdateScrollbars();
+        return true;
     }
+    return false;
 }
 
-
 Rectangle BrowseBox::GetControlArea() const
 {
 
@@ -2113,7 +2112,6 @@ Rectangle BrowseBox::GetControlArea() const
              aHScroll->GetSizePixel().Height() ) );
 }
 
-
 void BrowseBox::SetMode( BrowserMode nMode )
 {
 
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index df1df08..9299102 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -1103,7 +1103,6 @@ namespace svt
         return nId;
     }
 
-
     void EditBrowseBox::Resize()
     {
         BrowseBox::Resize();
@@ -1122,15 +1121,22 @@ namespace svt
 
         if (!nX)
             nX = USHRT_MAX;
-        ReserveControlArea((sal_uInt16)nX);
-    }
 
+        bool bChanged = ReserveControlArea(nX);
+
+        //tdf#97731 if the reserved area changed size, give the controls a
+        //chance to adapt to the new size
+        if (bChanged)
+        {
+            nX = (sal_uInt16)aPoint.X();
+            ArrangeControls(nX, (sal_uInt16)aPoint.Y());
+        }
+    }
 
     void EditBrowseBox::ArrangeControls(sal_uInt16&, sal_uInt16)
     {
     }
 
-
     CellController* EditBrowseBox::GetController(long, sal_uInt16)
     {
         return nullptr;


More information about the Libreoffice-commits mailing list