summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-05-30 21:44:40 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-05-30 22:25:48 +0400
commit61acb9beb2bd5c76df6136d4fb3871db7906a827 (patch)
tree725137b709b278eba108cc4eed68a407843bc136
parent628cec2afa41fa0cedc08bb5084e7b48e0d47918 (diff)
fdo#47752: first column of checkboxes is too small
Change-Id: I199276a99063d5a125be1f2cd5d71574f078a82e
-rw-r--r--svtools/inc/svtools/svtreebx.hxx2
-rw-r--r--svtools/source/contnr/svtreebx.cxx19
2 files changed, 20 insertions, 1 deletions
diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx
index 8f883c62451a..b6f1bab4d07a 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 074ce945d08c..8ad020e0efed 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;
+ }
+ }
+ }
}