summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/treelist/svimpbox.cxx6
-rw-r--r--vcl/source/treelist/svlbitm.cxx15
-rw-r--r--vcl/source/treelist/treelistbox.cxx43
3 files changed, 42 insertions, 22 deletions
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;