[Libreoffice-commits] core.git: dbaccess/source include/vcl sc/source sd/source sfx2/source svtools/source svx/source sw/source vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 20 16:02:08 UTC 2019
dbaccess/source/ui/app/AppDetailView.cxx | 2 -
dbaccess/source/ui/control/listviewitems.cxx | 3 +
include/vcl/treelistbox.hxx | 6 ++-
include/vcl/viewdataentry.hxx | 3 +
sc/source/ui/navipi/content.cxx | 2 -
sd/source/ui/animations/CustomAnimationList.cxx | 12 +++---
sfx2/source/dialog/templdlg.cxx | 4 +-
svtools/source/contnr/iconview.cxx | 11 +++---
svtools/source/uno/treecontrolpeer.cxx | 17 +++++----
svx/source/form/filtnav.cxx | 11 +++---
sw/source/ui/misc/glossary.cxx | 2 -
sw/source/uibase/utlui/content.cxx | 2 -
sw/source/uibase/utlui/glbltree.cxx | 2 -
vcl/source/treelist/svimpbox.cxx | 6 +--
vcl/source/treelist/svlbitm.cxx | 15 ++++++--
vcl/source/treelist/treelistbox.cxx | 43 +++++++++++++++---------
16 files changed, 87 insertions(+), 54 deletions(-)
New commits:
commit 2140dea1413c9ef8e6e35409a15b0a3ea7149e67
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 17 19:39:45 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 20 18:01:17 2019 +0200
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 5ca68ed90dc7..da1823ba8b4c 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -158,7 +158,7 @@ tools::Rectangle OCreationList::GetFocusRect( SvTreeListEntry* _pEntry, long _nL
SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : nullptr;
OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" );
if ( pTab && pItemData )
- aRect.SetLeft( pTab->GetPos() - pItemData->maSize.Width() / 2 );
+ aRect.SetLeft( pTab->GetPos() - pItemData->mnWidth / 2 );
// inflate the rectangle a little bit - looks better, too
aRect.SetLeft( std::max< long >( 0, aRect.Left() - 2 ) );
diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx
index d0a686992809..006f6f45a51a 100644
--- a/dbaccess/source/ui/control/listviewitems.cxx
+++ b/dbaccess/source/ui/control/listviewitems.cxx
@@ -35,7 +35,8 @@ namespace dbaui
vcl::Font aFont( pView->GetFont());
aFont.SetWeight(WEIGHT_BOLD);
pView->Control::SetFont( aFont );
- _pViewData->maSize = Size(pView->GetTextWidth(GetText()), pView->GetTextHeight());
+ _pViewData->mnWidth = pView->GetTextWidth(GetText());
+ _pViewData->mnHeight = pView->GetTextHeight();
pView->Pop();
}
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index 2f855e0a4b7b..d9c09d086b31 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -140,8 +140,10 @@ public:
SvLBoxItem();
virtual ~SvLBoxItem();
virtual SvLBoxItemType GetType() const = 0;
- const Size& GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
- static const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
+ int GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ int GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ static int GetWidth(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
+ static int GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0;
diff --git a/include/vcl/viewdataentry.hxx b/include/vcl/viewdataentry.hxx
index 5cbed9d6e3ea..7967f131b6c6 100644
--- a/include/vcl/viewdataentry.hxx
+++ b/include/vcl/viewdataentry.hxx
@@ -28,7 +28,8 @@
struct SvViewDataItem
{
- Size maSize;
+ int mnWidth = 0;
+ int mnHeight = 0;
};
/**
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 4ecbdf314376..536d398f482c 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -730,7 +730,7 @@ void ScContentTree::RequestHelp( const HelpEvent& rHEvt )
aPos = GetEntryPosition( pEntry );
aPos.setX( GetTabPos( pEntry, pTab ) );
aPos = OutputToScreenPixel(aPos);
- Size aSize( pItem->GetSize( this, pEntry ) );
+ Size aSize(pItem->GetWidth(this, pEntry), pItem->GetHeight(this, pEntry));
tools::Rectangle aItemRect( aPos, aSize );
Help::ShowQuickHelp( this, aItemRect, aHelpText );
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index e6cfb0c1d98f..c0b2086abac7 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -270,7 +270,8 @@ void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeLis
Size aSize( width, pView->GetTextHeight() );
if( aSize.Height() < nItemMinHeight )
aSize.setHeight( nItemMinHeight );
- pViewData->maSize = aSize;
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
@@ -280,7 +281,7 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev,
const SvViewDataItem* pViewData = mpParent->GetViewDataItem(&rEntry, this);
Point aPos(rPos);
- Size aSize(pViewData->maSize);
+ int nItemHeight = pViewData->mnHeight;
sal_Int16 nNodeType = mpEffect->getNodeType();
if (nNodeType == EffectNodeType::ON_CLICK )
@@ -336,12 +337,12 @@ void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev,
{
Image aImage(StockImage::Yes, sImage);
Point aImagePos(aPos);
- aImagePos.AdjustY((aSize.Height()/2 - aImage.GetSizePixel().Height()) >> 1 );
+ aImagePos.AdjustY((nItemHeight/2 - aImage.GetSizePixel().Height()) >> 1 );
rRenderContext.DrawImage(aImagePos, aImage);
}
aPos.AdjustX(nIconWidth );
- aPos.AdjustY((aSize.Height()/2 - rDev.GetTextHeight()) >> 1 );
+ aPos.AdjustY((nItemHeight/2 - rDev.GetTextHeight()) >> 1 );
rRenderContext.DrawText(aPos, rRenderContext.GetEllipsisString(msEffectName, rDev.GetOutputSizePixel().Width() - aPos.X()));
}
@@ -400,7 +401,8 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree
Size aSize(pView->GetTextWidth( msDescription ) + 2 * nIconWidth, pView->GetTextHeight() );
if( aSize.Height() < nIconWidth )
aSize.setHeight( nIconWidth );
- pViewData->maSize = aSize;
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
void CustomAnimationTriggerEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 772df9530ce5..e47900441476 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -143,7 +143,9 @@ void StyleLBoxString::Paint(
{
if (pStylePreviewRenderer->recalculate())
{
- mpViewData->maSize = pStylePreviewRenderer->getRenderSize();
+ Size aSize(pStylePreviewRenderer->getRenderSize());
+ mpViewData->mnWidth = aSize.Width();
+ mpViewData->mnHeight = aSize.Height();
}
else
{
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();
}
}
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 08a975fca685..c7b755317d89 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -965,7 +965,8 @@ void FmFilterItemsString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::Ren
rRenderContext.Push(PushFlags::LINECOLOR);
rRenderContext.SetLineColor(rRenderContext.GetTextColor());
- tools::Rectangle aRect(rPos, GetSize(&rDev, &rEntry));
+ Size aSize(GetWidth(&rDev, &rEntry), GetHeight(&rDev, &rEntry));
+ tools::Rectangle aRect(rPos, aSize);
Point aFirst(rPos.X(), aRect.Bottom() - 6);
Point aSecond(aFirst .X() + 2, aFirst.Y() + 3);
@@ -991,7 +992,8 @@ void FmFilterItemsString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pE
Size aSize(pView->GetTextWidth(GetText()), pView->GetTextHeight());
aSize.AdjustWidth(nxDBmp );
- pViewData->maSize = aSize;
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
class FmFilterString : public SvLBoxString
@@ -1013,7 +1015,6 @@ public:
const int nxD = 4;
-
void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData)
{
if( !pViewData )
@@ -1027,10 +1028,10 @@ void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry,
Size aSize(pView->GetTextWidth(m_aName), pView->GetTextHeight());
pView->Control::SetFont( aOldFont );
aSize.AdjustWidth(pView->GetTextWidth(GetText()) + nxD );
- pViewData->maSize = aSize;
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
-
void FmFilterString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/)
{
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 935242ed977c..867ed65b89f7 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -873,7 +873,7 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt )
if(pItem)
{
aPos = GetEntryPosition( pEntry );
- Size aSize(pItem->GetSize( this, pEntry ));
+ Size aSize(pItem->GetWidth(this, pEntry), pItem->GetHeight(this, pEntry));
aPos.setX( GetTabPos( pEntry, pTab ) );
if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 7ef2e0e48f93..2425ed1b079c 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3031,7 +3031,7 @@ void SwContentTree::RequestHelp( const HelpEvent& rHEvt )
aPos = GetEntryPosition( pEntry );
aPos.setX( GetTabPos( pEntry, pTab ) );
- Size aSize( pItem->GetSize( this, pEntry ) );
+ Size aSize(pItem->GetWidth(this, pEntry), pItem->GetHeight(this, pEntry));
if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
aSize.setWidth( GetSizePixel().Width() - aPos.X() );
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 13ec358cd0f7..df5d5656ab41 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -505,7 +505,7 @@ void SwGlobalTree::RequestHelp( const HelpEvent& rHEvt )
Point aEntryPos = GetEntryPosition( pEntry );
aEntryPos.setX( GetTabPos( pEntry, pTab ) );
- Size aSize( pItem->GetSize( this, pEntry ) );
+ Size aSize(pItem->GetWidth(this, pEntry), pItem->GetHeight(this, pEntry));
if((aEntryPos.X() + aSize.Width()) > GetSizePixel().Width())
aSize.setWidth( GetSizePixel().Width() - aEntryPos.X() );
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 0d906416f233..ede98aa18f7f 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -785,7 +785,7 @@ bool SvImpLBox::EntryReallyHit(SvTreeListEntry* pEntry, const Point& rPosPixel,
aRect.SetRight( GetOutputSize().Width() - pView->GetMapMode().GetOrigin().X() );
SvLBoxContextBmp* pBmp = static_cast<SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
- aRect.AdjustLeft( -(pBmp->GetSize(pView,pEntry).Width()) );
+ aRect.AdjustLeft( -pBmp->GetWidth(pView,pEntry) );
aRect.AdjustLeft( -4 ); // a little tolerance
Point aPos( rPosPixel );
@@ -3107,7 +3107,7 @@ bool SvImpLBox::RequestHelp( const HelpEvent& rHEvt )
aPos = GetEntryPosition( pEntry );
aPos.setX( pView->GetTabPos( pEntry, pTab ) ); //pTab->GetPos();
- Size aSize( pItem->GetSize( pView, pEntry ) );
+ Size aSize(pItem->GetWidth(pView, pEntry), pItem->GetHeight(pView, pEntry));
SvLBoxTab* pNextTab = NextTab( pTab );
bool bItemClipped = false;
// is the item cut off by its right neighbor?
@@ -3199,7 +3199,7 @@ bool SvImpLBox::SetMostRight( SvTreeListEntry* pEntry )
long nNextTab = nTabPos < nMaxRight ? nMaxRight : nMaxRight + 50;
long nTabWidth = nNextTab - nTabPos + 1;
- long nItemSize = rItem.GetSize(pView,pEntry).Width();
+ auto nItemSize = rItem.GetWidth(pView,pEntry);
long nOffset = pTab->CalcOffset( nItemSize, nTabWidth );
long nRight = nTabPos + nOffset + nItemSize;
diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx
index e7732f687d5b..764c8d6878df 100644
--- a/vcl/source/treelist/svlbitm.cxx
+++ b/vcl/source/treelist/svlbitm.cxx
@@ -196,7 +196,7 @@ void SvLBoxString::Paint(
const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry)
{
- Size aSize = GetSize(&rDev, &rEntry);
+ Size aSize;
DrawTextFlags nStyle = (rDev.IsEnabled() && !mbDisabled) ? DrawTextFlags::NONE : DrawTextFlags::Disable;
if (rDev.IsEntryMnemonicsEnabled())
nStyle |= DrawTextFlags::Mnemonic;
@@ -205,6 +205,9 @@ void SvLBoxString::Paint(
nStyle |= DrawTextFlags::PathEllipsis | DrawTextFlags::Center;
aSize.setWidth( rDev.GetEntryWidth() );
}
+ else
+ aSize.setWidth(GetWidth(&rDev, &rEntry));
+ aSize.setHeight(GetHeight(&rDev, &rEntry));
if (mbEmphasized)
{
@@ -241,7 +244,8 @@ void SvLBoxString::InitViewData(
pView->Control::SetFont( aFont );
}
- pViewData->maSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight());
+ pViewData->mnWidth = pView->GetTextWidth(maText);
+ pViewData->mnHeight = pView->GetTextHeight();
if (mbEmphasized)
pView->Pop();
@@ -379,7 +383,8 @@ void SvLBoxButton::InitViewData(SvTreeListBox* pView,SvTreeListEntry* pEntry, Sv
ControlType eCtrlType = (pData->IsRadio())? ControlType::Radiobutton : ControlType::Checkbox;
if ( eKind != SvLBoxButtonKind::StaticImage && pView )
ImplAdjustBoxSize(aSize, eCtrlType, *pView);
- pViewData->maSize = aSize;
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
bool SvLBoxButton::CheckModification() const
@@ -444,7 +449,9 @@ void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntr
{
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->maSize = m_pImpl->m_aImage1.GetSizePixel();
+ Size aSize = m_pImpl->m_aImage1.GetSizePixel();
+ pViewData->mnWidth = aSize.Width();
+ pViewData->mnHeight = aSize.Height();
}
void SvLBoxContextBmp::Paint(
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 007036b1012b..de328f8dde39 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -303,16 +303,28 @@ SvLBoxItem::~SvLBoxItem()
{
}
-const Size& SvLBoxItem::GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
+int SvLBoxItem::GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
{
const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
- return pViewData->maSize;
+ return pViewData->mnWidth;
}
-const Size& SvLBoxItem::GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos)
+int SvLBoxItem::GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
+{
+ const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
+ return pViewData->mnHeight;
+}
+
+int SvLBoxItem::GetWidth(const SvViewDataEntry* pData, sal_uInt16 nItemPos)
+{
+ const SvViewDataItem& rIData = pData->GetItem(nItemPos);
+ return rIData.mnWidth;
+}
+
+int SvLBoxItem::GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos)
{
const SvViewDataItem& rIData = pData->GetItem(nItemPos);
- return rIData.maSize;
+ return rIData.mnHeight;
}
struct SvTreeListBoxImpl
@@ -1679,7 +1691,7 @@ void SvTreeListBox::CheckBoxInserted(SvTreeListEntry* pEntry)
SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
if( pItem )
{
- long nWidth = pItem->GetSize(this, pEntry).Width();
+ auto nWidth = pItem->GetWidth(this, pEntry);
if( mnCheckboxItemWidth < nWidth )
{
mnCheckboxItemWidth = nWidth;
@@ -2028,7 +2040,7 @@ void SvTreeListBox::SetEntryHeight( SvTreeListEntry const * pEntry )
SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
while( nCur < nCount )
{
- short nHeight = static_cast<short>(SvLBoxItem::GetSize( pViewData, nCur ).Height());
+ auto nHeight = SvLBoxItem::GetHeight(pViewData, nCur);
if( nHeight > nHeightMax )
nHeightMax = nHeight;
nCur++;
@@ -2396,12 +2408,12 @@ void SvTreeListBox::EditItemText(SvTreeListEntry* pEntry, SvLBoxString* pItem, c
SvLBoxTab* pTab = GetTab( pEntry, pItem );
DBG_ASSERT(pTab,"EditItemText:Tab not found");
- Size aItemSize( pItem->GetSize(this, pEntry) );
+ auto nItemHeight( pItem->GetHeight(this, pEntry) );
Point aPos = GetEntryPosition( pEntry );
- aPos.AdjustY(( nEntryHeight - aItemSize.Height() ) / 2 );
+ aPos.AdjustY(( nEntryHeight - nItemHeight ) / 2 );
aPos.setX( GetTabPos( pEntry, pTab ) );
long nOutputWidth = pImpl->GetOutputSize().Width();
- Size aSize( nOutputWidth - aPos.X(), aItemSize.Height() );
+ Size aSize( nOutputWidth - aPos.X(), nItemHeight );
sal_uInt16 nPos = std::find_if( aTabs.begin(), aTabs.end(),
[pTab](const std::unique_ptr<SvLBoxTab>& p) { return p.get() == pTab; })
- aTabs.begin();
@@ -2633,7 +2645,8 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render
SvLBoxItem& rItem = rEntry.GetItem(nCurItem);
SvLBoxTabFlags nFlags = pTab->nFlags;
- Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nCurItem));
+ Size aSize(SvLBoxItem::GetWidth(pViewDataEntry, nCurItem),
+ SvLBoxItem::GetHeight(pViewDataEntry, nCurItem));
long nTabPos = GetTabPos(&rEntry, pTab);
long nNextTabPos;
@@ -2911,7 +2924,7 @@ tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLin
if( pTab && nCurTab < pEntry->ItemCount() )
{
SvLBoxItem& rItem = pEntry->GetItem( nCurTab );
- aSize.setWidth( rItem.GetSize( this, pEntry ).Width() );
+ aSize.setWidth(rItem.GetWidth(this, pEntry));
if( !aSize.Width() )
aSize.setWidth( 15 );
long nX = nTabPos; //GetTabPos( pEntry, pTab );
@@ -3013,9 +3026,9 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX,
nNextTabPos += 50;
}
- Size aItemSize( pItem->GetSize(this, pEntry));
- nStart += pTab->CalcOffset( aItemSize.Width(), nNextTabPos - nStart );
- long nLen = aItemSize.Width();
+ auto nItemWidth(pItem->GetWidth(this, pEntry));
+ nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
+ auto nLen = nItemWidth;
if( pNextTab )
{
long nTabWidth = GetTabPos( pEntry, pNextTab ) - nStart;
@@ -3055,7 +3068,7 @@ long SvTreeListBox::getPreferredDimensions(std::vector<long> &rWidths) const
while (nCurPos < nCount)
{
SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
- long nWidth = rItem.GetSize(this, pEntry).Width();
+ auto nWidth = rItem.GetWidth(this, pEntry);
if (nWidth)
{
nWidth += SV_TAB_BORDER * 2;
More information about the Libreoffice-commits
mailing list