desktop/source/deployment/gui/dp_gui_extlistbox.cxx |   60 +++++++++-----------
 1 file changed, 28 insertions(+), 32 deletions(-)

New commits:
commit d78803e1128198c0dbbb126e9e4e3ca3557972ff
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Oct 28 15:51:36 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Oct 28 19:50:46 2025 +0100

    extension mgr: Merge 2 conditions/if blocks
    
    For the case of m_bAdjustActive being false case,
    nothing would effectively be done, so merge the
    condition of the inner if block with the outer
    one and get rid of one indentation level.
    
    Change-Id: I904a696f25600248ee5a1920ab6d8e09a2909e4a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193108
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx 
b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 84ec46bf93e5..17117b00bf0f 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -525,44 +525,40 @@ void ExtensionBox::RecalcAll()
 
     SetupScrollBar();
 
-    if (m_nActive >= 0)
+    if (m_nActive >= 0 && m_bAdjustActive)
     {
-        tools::Rectangle aEntryRect = GetEntryRect(m_nActive);
+        m_bAdjustActive = false;
 
-        if ( m_bAdjustActive )
+        // If the top of the selected entry isn't visible, make it visible
+        tools::Rectangle aEntryRect = GetEntryRect(m_nActive);
+        if (aEntryRect.Top() < 0)
         {
-            m_bAdjustActive = false;
-
-            // If the top of the selected entry isn't visible, make it visible
-            if ( aEntryRect.Top() < 0 )
-            {
-                m_nTopIndex += aEntryRect.Top();
-                aEntryRect.Move( 0, -aEntryRect.Top() );
-            }
-
-            // If the bottom of the selected entry isn't visible, make it 
visible even if now the top
-            // isn't visible any longer ( the buttons are more important )
-            Size aOutputSize = GetOutputSizePixel();
-            if ( aEntryRect.Bottom() > aOutputSize.Height() )
-            {
-                m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
-                aEntryRect.Move( 0, -( aEntryRect.Bottom() - 
aOutputSize.Height() ) );
-            }
+            m_nTopIndex += aEntryRect.Top();
+            aEntryRect.Move(0, -aEntryRect.Top());
+        }
 
-            // If there is unused space below the last entry but all entries 
don't fit into the box,
-            // move the content down to use the whole space
-            const tools::Long nTotalHeight = GetTotalHeight();
-            if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > 
nTotalHeight ) )
-            {
-                tools::Long nOffset = m_nTopIndex;
-                m_nTopIndex = nTotalHeight - aOutputSize.Height();
-                nOffset -= m_nTopIndex;
-                aEntryRect.Move( 0, nOffset );
-            }
+        // If the bottom of the selected entry isn't visible, make it visible 
even if now the top
+        // isn't visible any longer ( the buttons are more important )
+        Size aOutputSize = GetOutputSizePixel();
+        if (aEntryRect.Bottom() > aOutputSize.Height())
+        {
+            m_nTopIndex += (aEntryRect.Bottom() - aOutputSize.Height());
+            aEntryRect.Move(0, -(aEntryRect.Bottom() - aOutputSize.Height()));
+        }
 
-            if ( m_bHasScrollBar )
-                m_xScrollBar->vadjustment_set_value( m_nTopIndex );
+        // If there is unused space below the last entry but all entries don't 
fit into the box,
+        // move the content down to use the whole space
+        const tools::Long nTotalHeight = GetTotalHeight();
+        if (m_bHasScrollBar && (aOutputSize.Height() + m_nTopIndex > 
nTotalHeight))
+        {
+            tools::Long nOffset = m_nTopIndex;
+            m_nTopIndex = nTotalHeight - aOutputSize.Height();
+            nOffset -= m_nTopIndex;
+            aEntryRect.Move(0, nOffset);
         }
+
+        if (m_bHasScrollBar)
+            m_xScrollBar->vadjustment_set_value(m_nTopIndex);
     }
 
     m_bNeedsRecalc = false;

Reply via email to