diff options
author | Jim Raykowski <raykowj@gmail.com> | 2023-09-09 21:21:03 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2023-09-12 00:45:51 +0200 |
commit | 4b2543693ed3ffb4d9f0d70f53f32127115c128d (patch) | |
tree | 21336bf30b529db3b77a07f4d5f785aaab0a2622 /vcl/source | |
parent | d52feb11c7eab0adf82c1fb410adfd3127bf9497 (diff) |
tdf#156890 SalInstanceTreeView: Indent the entry context bitmap
when the bitmap is too large to center without it touching the expand
button
Change-Id: If4e307ed50eff9bdebe6c377847283ae2eea9543
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156787
Tested-by: Jenkins
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/treelist/treelistbox.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 94d561ced049..e944214c5b88 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1452,6 +1452,9 @@ void SvTreeListBox::SetTabs() else nStartPos += nContextWidthDIV2; AddTab( nStartPos, TABFLAGS_CONTEXTBMP ); + // add an indent if the context bitmap can't be centered without touching the expander + if (nContextBmpWidthMax > nIndent + (nNodeWidthPixel / 2)) + nStartPos += nIndent; nStartPos += nContextWidthDIV2; // right edge of context bitmap // only set a distance if there are bitmaps if( nContextBmpWidthMax ) @@ -2584,6 +2587,10 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl: SvViewDataEntry* pViewDataEntry = GetViewDataEntry( &rEntry ); const bool bSeparator(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR); + const auto nMaxContextBmpWidthBeforeIndentIsNeeded = + nIndent + GetExpandedNodeBmp().GetSizePixel().Width() / 2; + const bool bHasButtonsAtRoot = nWindowStyle & WB_HASBUTTONSATROOT; + const size_t nTabCount = aTabs.size(); const size_t nItemCount = rEntry.ItemCount(); size_t nCurTab = 0; @@ -2618,6 +2625,13 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl: else nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos); + // add an indent if the context bitmap can't be centered without touching the expander + if (nCurTab == 0 && !(nTreeFlags & SvTreeFlags::CHKBTN) && bHasButtonsAtRoot && + pTab->nFlags & SvLBoxTabFlags::ADJUST_CENTER && + !(pTab->nFlags & SvLBoxTabFlags::FORCE) && + aSize.Width() > nMaxContextBmpWidthBeforeIndentIsNeeded) + nX += nIndent; + aEntryPos.setX( nX ); aEntryPos.setY( nLine ); |