[Libreoffice-commits] .: Branch 'libreoffice-3-5' - vcl/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Sun Apr 1 22:41:30 PDT 2012


 vcl/source/window/toolbox.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 05d6bb3aed80d0284bdeaf4177c9883aa60ea169
Author: Noel Power <noel.power at novell.com>
Date:   Tue Mar 27 12:32:05 2012 +0100

    fix vertical align when switching mode in multibar fdo#44140
    
    switching between SumAssign & OkCancel mode in the multibar results in a slight 'jumping' of the toolbar items when end up out of allignment with the other toolbar items.
    
    Signed-off-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 2a0a089..0ae1ccb 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2722,7 +2722,19 @@ void ToolBox::ImplFormat( sal_Bool bResize )
                         // if special TBX_LAYOUT_LOCKVERT lock vertical position
                         // don't recalulate the vertical position of the item
                         if ( meLayoutMode == TBX_LAYOUT_LOCKVERT && mnLines == 1 )
-                            it->maCalcRect.Top()      =  it->maRect.Top();
+                        {
+                            // Somewhat of a hack here, calc deletes and re-adds
+                            // the sum/assign & ok/cancel items dynamically.
+                            // Because TBX_LAYOUT_LOCKVERT effectively prevents
+                            // recalculation of the vertical pos of an item the
+                            // it->maRect.Top() for those newly added items is
+                            // 0. The hack here is that we want to effectively
+                            // recalculate the vertical pos for those added
+                            // items here. ( Note: assume mnMaxItemHeight is
+                            // equal to the LineSize when multibar has a single
+                            // line size )
+                            it->maCalcRect.Top()      =  it->maRect.Top() ? it->maRect.Top() : ( nY + ( mnMaxItemHeight-aCurrentItemSize.Height())/2 );
+                        }
                         else
                             it->maCalcRect.Top()      = nY+(nLineSize-aCurrentItemSize.Height())/2;
                         it->maCalcRect.Right()    = nX+aCurrentItemSize.Width()-1;


More information about the Libreoffice-commits mailing list