diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-11-16 11:03:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-20 16:47:33 +0000 |
commit | bcafd193e743fca4ab6198092b34d000787e06f0 (patch) | |
tree | 90881b1e5b1a3e7e9184395feff2f3004de05325 /svtools/source/contnr | |
parent | 3f2f4f15e20b7f295f26cddadfc712c189719aee (diff) |
convert xslt filter dialog to .ui
Change-Id: Ia07df75b00b7d34da9dfeeddb47280ddba23b897
Diffstat (limited to 'svtools/source/contnr')
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 70 |
1 files changed, 61 insertions, 9 deletions
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 86fb6a5e57b9..bf9493d5b16b 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -359,10 +359,10 @@ SvLBoxItem::~SvLBoxItem() DBG_DTOR(SvLBoxItem,0); } -const Size& SvLBoxItem::GetSize( SvTreeListBox* pView,SvTreeListEntry* pEntry ) +const Size& SvLBoxItem::GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const { DBG_CHKTHIS(SvLBoxItem,0); - SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this ); + const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this ); return pViewData->aSize; } @@ -964,14 +964,18 @@ sal_uLong SvTreeListBox::GetLevelChildCount( SvTreeListEntry* _pParent ) const return nCount; } -SvViewDataItem* SvTreeListBox::GetViewDataItem( SvTreeListEntry* pEntry, SvLBoxItem* pItem ) const +SvViewDataItem* SvTreeListBox::GetViewDataItem(SvTreeListEntry* pEntry, SvLBoxItem* pItem) { - SvViewDataEntry* pEntryData = - (SvViewDataEntry*)SvListView::GetViewData(pEntry); + return const_cast<SvViewDataItem*>(static_cast<const SvTreeListBox*>(this)->GetViewDataItem(pEntry, pItem)); +} + +const SvViewDataItem* SvTreeListBox::GetViewDataItem(const SvTreeListEntry* pEntry, const SvLBoxItem* pItem) const +{ + const SvViewDataEntry* pEntryData = (const SvViewDataEntry*)SvListView::GetViewData(pEntry); DBG_ASSERT(pEntryData,"Entry not in View"); DBG_ASSERT(pEntryData->pItemData,"No ItemData"); sal_uInt16 nItemPos = pEntry->GetPos(pItem); - return (pEntryData->pItemData+nItemPos); + return (pEntryData->pItemData + nItemPos); } SvViewData* SvTreeListBox::CreateViewData( SvTreeListEntry* ) @@ -2914,14 +2918,11 @@ void SvTreeListBox::InvalidateEntry( SvTreeListEntry* pEntry ) } } - long SvTreeListBox::PaintEntry(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nTabFlags) { return PaintEntry1(pEntry,nLine,nTabFlags); } -#define SV_TAB_BORDER 8 - long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nTabFlags, sal_Bool bHasClipRegion ) { @@ -3397,6 +3398,56 @@ SvLBoxItem* SvTreeListBox::GetItem_Impl( SvTreeListEntry* pEntry, long nX, return pItemClicked; } +long SvTreeListBox::getPreferredDimensions(std::vector<long> &rWidths) const +{ + long nHeight = 0; + rWidths.clear(); + SvTreeListEntry* pEntry = First(); + while (pEntry) + { + sal_uInt16 nCount = pEntry->ItemCount(); + sal_uInt16 nCurPos = 0; + if (nCount > rWidths.size()) + rWidths.resize(nCount); + while (nCurPos < nCount) + { + SvLBoxItem* pItem = pEntry->GetItem( nCurPos ); + long nWidth = pItem->GetSize(this, pEntry).Width(); + if (nWidth) + { + nWidth += SV_TAB_BORDER * 2; + if (nWidth > rWidths[nCurPos]) + rWidths[nCurPos] = nWidth; + } + ++nCurPos; + } + pEntry = Next( pEntry ); + nHeight += GetEntryHeight(); + } + return nHeight; +} + +Size SvTreeListBox::GetOptimalSize(WindowSizeType eType) const +{ + Size aRet; + switch (eType) + { + case WINDOWSIZE_MINIMUM: + case WINDOWSIZE_PREFERRED: + { + std::vector<long> aWidths; + aRet.Height() = getPreferredDimensions(aWidths); + for (size_t i = 0; i < aWidths.size(); ++i) + aRet.Width() += aWidths[i]; + break; + } + default: + aRet = Control::GetOptimalSize(eType); + break; + } + return aRet; +} + SvLBoxItem* SvTreeListBox::GetItem(SvTreeListEntry* pEntry,long nX,SvLBoxTab** ppTab) { return GetItem_Impl( pEntry, nX, ppTab, 0 ); @@ -3685,6 +3736,7 @@ void SvTreeListBox::ModelNotification( sal_uInt16 nActionId, SvTreeListEntry* pE nContextBmpWidthMax = nMaxWidth; SetTabs(); } + queue_resize(); } break; |