[Libreoffice-commits] .: 2 commits - svtools/inc svtools/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Wed May 30 11:27:12 PDT 2012


 svtools/inc/svtools/svtreebx.hxx   |    2 ++
 svtools/source/contnr/svlbitm.cxx  |    2 ++
 svtools/source/contnr/svtreebx.cxx |   19 ++++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 61acb9beb2bd5c76df6136d4fb3871db7906a827
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Wed May 30 21:44:40 2012 +0400

    fdo#47752: first column of checkboxes is too small
    
    Change-Id: I199276a99063d5a125be1f2cd5d71574f078a82e

diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx
index 8f883c6..b6f1bab 100644
--- a/svtools/inc/svtools/svtreebx.hxx
+++ b/svtools/inc/svtools/svtreebx.hxx
@@ -78,6 +78,8 @@ class SVT_DLLPUBLIC SvTreeListBox : public SvLBox
     short           nFocusWidth;
     sal_uInt16          aContextBmpMode;
 
+    long mnCheckboxItemWidth;
+
 #ifdef _SVTREEBX_CXX
     DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData * );
 
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index 074ce94..8ad020e 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -88,6 +88,7 @@ void SvTreeListBox::InitTreeView()
     nFirstSelTab = 0;
     nLastSelTab = 0;
     nFocusWidth = -1;
+    mnCheckboxItemWidth = 0;
 
     Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) );
     pLBoxImpl->m_pLink = pLink;
@@ -212,9 +213,11 @@ void SvTreeListBox::SetTabs()
     long nStartPos = TAB_STARTPOS;
     long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
 
+    // pCheckButtonData->Width() knows nothing about the native checkbox width,
+    // so we have mnCheckboxItemWidth which becomes valid when something is added.
     long nCheckWidth = 0;
     if( nTreeFlags & TREEFLAG_CHKBTN )
-        nCheckWidth = pCheckButtonData->aBmps[0].GetSizePixel().Width();
+        nCheckWidth = mnCheckboxItemWidth;
     long nCheckWidthDIV2 = nCheckWidth / 2;
 
     long nContextWidth = nContextBmpWidthMax;
@@ -519,6 +522,20 @@ void SvTreeListBox::ImpEntryInserted( SvLBoxEntry* pEntry )
         }
     }
     SetEntryHeight( (SvLBoxEntry*)pEntry );
+
+    if( nTreeFlags & TREEFLAG_CHKBTN )
+    {
+        SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+        if( pItem )
+        {
+            long nWidth = pItem->GetSize(this, pEntry).Width();
+            if( mnCheckboxItemWidth < nWidth )
+            {
+                mnCheckboxItemWidth = nWidth;
+                nTreeFlags |= TREEFLAG_RECALCTABS;
+            }
+        }
+    }
 }
 
 
commit 628cec2afa41fa0cedc08bb5084e7b48e0d47918
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Wed May 30 21:43:50 2012 +0400

    fdo#47752: use native checkbox width
    
    Change-Id: Iac8049c49520a5fd119c4617144af302f924475b

diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index ba1ee4b..00c619e 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -459,6 +459,8 @@ void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, Windo
             // leave a little space around the box image (looks better)
             if( aContentSize.Height() + 2 > io_rSize.Height() )
                 io_rSize.Height() = aContentSize.Height() + 2;
+            if( aContentSize.Width() + 2 > io_rSize.Width() )
+                io_rSize.Width() = aContentSize.Width() + 2;
         }
     }
 }


More information about the Libreoffice-commits mailing list