summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-16 11:03:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-20 16:47:33 +0000
commitbcafd193e743fca4ab6198092b34d000787e06f0 (patch)
tree90881b1e5b1a3e7e9184395feff2f3004de05325 /svtools
parent3f2f4f15e20b7f295f26cddadfc712c189719aee (diff)
convert xslt filter dialog to .ui
Change-Id: Ia07df75b00b7d34da9dfeeddb47280ddba23b897
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/treelist.hxx14
-rw-r--r--svtools/inc/svtools/treelistbox.hxx16
-rw-r--r--svtools/source/contnr/treelistbox.cxx70
3 files changed, 75 insertions, 25 deletions
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 77ad16f9a317..96c78bb6b38b 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -406,7 +406,7 @@ public:
sal_Bool IsSelected( SvTreeListEntry* pEntry ) const;
sal_Bool HasEntryFocus( SvTreeListEntry* pEntry ) const;
void SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus );
- const SvViewData* GetViewData( SvTreeListEntry* pEntry ) const;
+ const SvViewData* GetViewData( const SvTreeListEntry* pEntry ) const;
SvViewData* GetViewData( SvTreeListEntry* pEntry );
sal_Bool HasViewData() const
{ return maDataTable.size() > 1; } // There's always a ROOT
@@ -460,26 +460,18 @@ inline void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus
itr->second->SetFocus(bFocus);
}
-inline const SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry ) const
+inline const SvViewData* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
{
-#ifndef DBG_UTIL
- return maDataTable.find( pEntry )->second;
-#else
- SvDataTable::const_iterator itr = maDataTable.find( pEntry );
+ SvDataTable::const_iterator itr = maDataTable.find( const_cast<SvTreeListEntry*>(pEntry) );
DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
return itr->second;
-#endif
}
inline SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry )
{
-#ifndef DBG_UTIL
- return maDataTable.find( pEntry )->second;
-#else
SvDataTable::iterator itr = maDataTable.find( pEntry );
DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
return itr->second;
-#endif
}
#endif
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index fda95eb6cbbf..308b2b255f5a 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -23,6 +23,7 @@
#include "svtools/svtdllapi.h"
#include <deque>
+#include <vector>
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
@@ -165,10 +166,10 @@ public:
SvLBoxItem();
virtual ~SvLBoxItem();
virtual sal_uInt16 GetType() const = 0;
- const Size& GetSize( SvTreeListBox* pView, SvTreeListEntry* pEntry );
- const Size& GetSize( SvViewDataEntry* pData, sal_uInt16 nItemPos )
+ const Size& GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos) const
{
- SvViewDataItem* pIData=pData->pItemData+nItemPos;
+ const SvViewDataItem* pIData = pData->pItemData + nItemPos;
return pIData->aSize;
}
@@ -411,7 +412,8 @@ public:
sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
SvViewDataEntry* GetViewDataEntry( SvTreeListEntry* pEntry ) const { return (SvViewDataEntry*)SvListView::GetViewData(pEntry); }
- SvViewDataItem* GetViewDataItem( SvTreeListEntry*, SvLBoxItem* ) const;
+ SvViewDataItem* GetViewDataItem(SvTreeListEntry*, SvLBoxItem*);
+ const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
bool IsInplaceEditingEnabled() const { return ((nImpFlags & SVLBOX_EDT_ENABLED) != 0); }
bool IsEditingActive() const { return ((nImpFlags & SVLBOX_IN_EDT) != 0); }
@@ -787,9 +789,13 @@ public:
void EnableContextMenuHandling( void );
void EnableContextMenuHandling( sal_Bool bEnable );
- sal_Bool IsContextMenuHandlingEnabled( void ) const;
+ sal_Bool IsContextMenuHandlingEnabled( void ) const;
void EnableList( bool _bEnable );
+
+ long getPreferredDimensions(std::vector<long> &rWidths) const;
+
+ virtual Size GetOptimalSize(WindowSizeType i_eType) const;
};
#define SV_LBOX_DD_FORMAT "SV_LBOX_DD_FORMAT"
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;