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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 24 18:23:59 UTC 2020


 svx/source/sidebar/PanelLayout.cxx |   32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

New commits:
commit 3b5e0316f755b9981ed4f4032c2c362407b808f6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 24 13:47:00 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 24 20:23:20 2020 +0200

    all PanelLayout are layout aware
    
    Change-Id: I11609c3b4e0783bc7dfc64467ba675761886859b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92859
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index fe0ffbee12f7..39659687d218 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -50,24 +50,19 @@ void PanelLayout::dispose()
 
 Size PanelLayout::GetOptimalSize() const
 {
-    if (isLayoutEnabled(this))
+    Size aSize = m_xContainer->get_preferred_size();
+
+    if (mxFrame)
     {
-        Size aSize = m_xContainer ? m_xContainer->get_preferred_size()
-                                  : VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
-        if (mxFrame)
-        {
-            SidebarController* pController
-                = SidebarController::GetSidebarControllerForFrame(mxFrame);
-            if (pController)
-                aSize.setWidth(std::min<long>(
-                    aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth())
-                                       * GetDPIScaleFactor()));
-        }
-
-        return aSize;
+        SidebarController* pController
+            = SidebarController::GetSidebarControllerForFrame(mxFrame);
+        if (pController)
+            aSize.setWidth(std::min<long>(
+                aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth())
+                                   * GetDPIScaleFactor()));
     }
 
-    return Control::GetOptimalSize();
+    return aSize;
 }
 
 void PanelLayout::queue_resize(StateChangedType /*eReason*/)
@@ -76,8 +71,6 @@ void PanelLayout::queue_resize(StateChangedType /*eReason*/)
         return;
     if (m_aPanelLayoutIdle.IsActive())
         return;
-    if (!isLayoutEnabled(this))
-        return;
     InvalidateSizeCache();
     m_aPanelLayoutIdle.Start();
 }
@@ -94,10 +87,9 @@ void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
     bool bCanHandleSmallerWidth = false;
     bool bCanHandleSmallerHeight = false;
 
-    bool bIsLayoutEnabled = isLayoutEnabled(this);
     vcl::Window *pChild = GetWindow(GetWindowType::FirstChild);
 
-    if (bIsLayoutEnabled && pChild->GetType() == WindowType::SCROLLWINDOW)
+    if (pChild->GetType() == WindowType::SCROLLWINDOW)
     {
         WinBits nStyle = pChild->GetStyle();
         if (nStyle & (WB_AUTOHSCROLL | WB_HSCROLL))
@@ -114,7 +106,7 @@ void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
 
     Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
 
-    if (bIsLayoutEnabled && (nFlags & PosSizeFlags::Size))
+    if (nFlags & PosSizeFlags::Size)
         VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight));
 }
 


More information about the Libreoffice-commits mailing list