summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-17 19:39:45 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-20 18:01:17 +0200
commit2140dea1413c9ef8e6e35409a15b0a3ea7149e67 (patch)
treef2f28dfda11cdd4dc982299669be56ec81fc0aab /svtools
parent259d01a34d27df2fbfd11c3bf6fe9dc508ff6ac2 (diff)
split width/height to allow intercept of how width is calculated
in order to possibly get width on demand Change-Id: I1e6fcb6849705f2b166821516ebe72b179e00ee7 Reviewed-on: https://gerrit.libreoffice.org/72513 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/iconview.cxx11
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx17
2 files changed, 16 insertions, 12 deletions
diff --git a/svtools/source/contnr/iconview.cxx b/svtools/source/contnr/iconview.cxx
index c50aaab9b904..7138efdbddeb 100644
--- a/svtools/source/contnr/iconview.cxx
+++ b/svtools/source/contnr/iconview.cxx
@@ -130,7 +130,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, long nX, long nY,
continue;
}
- Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nCurItem));
+ auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nCurItem);
aEntryPos.setX( nX );
aEntryPos.setY( nY );
@@ -189,7 +189,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, long nX, long nY,
}
// center vertically
- aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
+ aEntryPos.AdjustY((nTempEntryHeight - nItemHeight) / 2 );
// draw item
pViewDataEntry->SetPaintRectangle(aRect);
@@ -206,15 +206,16 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, long nX, long nY,
// draw icon
if(nIconItem != nItemCount && nIconItem < nItemCount)
{
- Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nIconItem));
+ auto nItemWidth = SvLBoxItem::GetWidth(pViewDataEntry, nIconItem);
+ auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nIconItem);
aEntryPos.setX( nX );
aEntryPos.setY( nY );
// center horizontally
- aEntryPos.AdjustX((nTempEntryWidth - aSize.Width()) / 2 );
+ aEntryPos.AdjustX((nTempEntryWidth - nItemWidth) / 2 );
// center vertically
- aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
+ aEntryPos.AdjustY((nTempEntryHeight - nItemHeight) / 2 );
aEntryPos.AdjustY( -10 );
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 5620686ac60c..974ee8edabab 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -1497,7 +1497,7 @@ void UnoTreeListItem::Paint(
const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry)
{
Point aPos(rPos);
- Size aSize(GetSize(&rDev, &rEntry));
+ Size aSize(GetWidth(&rDev, &rEntry), GetHeight(&rDev, &rEntry));
if (!!maImage)
{
rRenderContext.DrawImage(aPos, maImage, rDev.IsEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable);
@@ -1536,18 +1536,21 @@ void UnoTreeListItem::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->maSize = maImage.GetSizePixel();
+ Size aSize(maImage.GetSizePixel());
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
const Size aTextSize(pView->GetTextWidth( maText ), pView->GetTextHeight());
- if( pViewData->maSize.Width() )
+ if( pViewData->mnWidth )
{
- pViewData->maSize.AdjustWidth(6 + aTextSize.Width() );
- if( pViewData->maSize.Height() < aTextSize.Height() )
- pViewData->maSize.setHeight( aTextSize.Height() );
+ pViewData->mnWidth += (6 + aTextSize.Width());
+ if( pViewData->mnHeight < aTextSize.Height() )
+ pViewData->mnHeight = aTextSize.Height();
}
else
{
- pViewData->maSize = aTextSize;
+ pViewData->mnWidth = aTextSize.Width();
+ pViewData->mnHeight = aTextSize.Height();
}
}