Make SvTreeEntryList private to svtools.

Change-Id: I283d897cd5a7c15b5b60e99c90c04b696d20c2a3
This commit is contained in:
Kohei Yoshida
2012-10-23 17:42:17 +02:00
parent d7a19a7e04
commit 3fa955d701
6 changed files with 159 additions and 79 deletions

View File

@@ -3866,16 +3866,17 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry( const String& _rDataSour
"SbaTableQueryBrowser::impl_cleanupDataSourceEntry: inconsistence (2)!");
// delete any user data of the child entries of the to-be-removed entry
SvTreeEntryList* pList = m_pTreeModel->GetChildList( pDataSourceEntry );
if ( pList )
std::pair<SvTreeEntryList::iterator,SvTreeEntryList::iterator> aIters =
m_pTreeModel->GetChildIterators(pDataSourceEntry);
SvTreeEntryList::const_iterator it = aIters.first, itEnd = aIters.second;
for (; it != itEnd; ++it)
{
for ( size_t i = 0, n = pList->size(); i < n; ++i )
{
SvTreeListEntry* pEntryLoop = static_cast<SvTreeListEntry*>((*pList)[ i ]);
DBTreeListUserData* pData = static_cast< DBTreeListUserData* >( pEntryLoop->GetUserData() );
pEntryLoop->SetUserData( NULL );
delete pData;
}
SvTreeListEntry* pEntry = *it;
const DBTreeListUserData* pData = static_cast<const DBTreeListUserData*>(pEntry->GetUserData());
pEntry->SetUserData(NULL);
delete pData;
}
// remove the entry

View File

@@ -111,23 +111,24 @@ DBTreeListBox::~DBTreeListBox()
SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const String& aName, SvTreeListEntry* pStart, const IEntryFilter* _pFilter ) const
{
SvTreeList* myModel = GetModel();
SvTreeEntryList* pChildren = myModel->GetChildList(pStart);
std::pair<SvTreeEntryList::iterator,SvTreeEntryList::iterator> aIters =
myModel->GetChildIterators(pStart);
SvTreeListEntry* pEntry = NULL;
if ( pChildren )
SvTreeEntryList::const_iterator it = aIters.first, itEnd = aIters.second;
for (; it != itEnd; ++it)
{
size_t nCount = pChildren->size();
for (size_t i = 0; i < nCount; ++i)
pEntry = *it;
const SvLBoxString* pItem = static_cast<const SvLBoxString*>(
pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
if (pItem && pItem->GetText().equals(aName))
{
pEntry = static_cast<SvTreeListEntry*>((*pChildren)[ i ]);
SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
if ( pItem->GetText().equals(aName) )
{
if ( !_pFilter || _pFilter->includeEntry( pEntry ) )
// found
break;
}
pEntry = NULL;
if (!_pFilter || _pFilter->includeEntry(pEntry))
// found
break;
}
pEntry = NULL;
}
return pEntry;

View File

@@ -64,7 +64,7 @@
class SvTreeListEntry;
class SVT_DLLPUBLIC SvTreeEntryList
class SvTreeEntryList
{
private:
typedef std::vector<SvTreeListEntry*> ListType;
@@ -297,6 +297,12 @@ public:
SvTreeListEntry* GetRootLevelParent( SvTreeListEntry* pEntry ) const;
SvTreeEntryList* GetChildList( SvTreeListEntry* pParent ) const;
std::pair<SvTreeEntryList::const_iterator,SvTreeEntryList::const_iterator>
GetChildIterators(const SvTreeListEntry* pParent) const;
std::pair<SvTreeEntryList::iterator,SvTreeEntryList::iterator>
GetChildIterators(SvTreeListEntry* pParent);
sal_uLong GetAbsPos( SvTreeListEntry* pEntry ) const;
sal_uLong GetRelPos( SvTreeListEntry* pChild ) const
{ return pChild->GetChildListPos(); }
@@ -365,7 +371,7 @@ public:
SvListView(); // !!! setzt das Model auf 0
virtual ~SvListView();
void Clear();
SvTreeList* GetModel() const { return pModel; }
SvTreeList* GetModel() const;
virtual void SetModel( SvTreeList* );
virtual void ModelNotification(
sal_uInt16 nActionId,
@@ -523,45 +529,6 @@ inline SvViewData* SvListView::GetViewData( SvTreeListEntry* pEntry )
#endif
}
inline sal_Bool SvTreeList::HasChildren( SvTreeListEntry* pEntry ) const
{
if ( !pEntry )
pEntry = pRootItem;
return (sal_Bool)(pEntry->pChildren != 0);
}
inline SvTreeListEntry* SvTreeList::GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const
{ if ( !pParent )
pParent = pRootItem;
SvTreeListEntry* pRet = 0;
if ( pParent->pChildren )
pRet = (*pParent->pChildren)[ nPos ];
return pRet;
}
inline SvTreeListEntry* SvTreeList::GetEntry( sal_uLong nRootPos ) const
{
SvTreeListEntry* pRet = 0;
if ( nEntryCount )
pRet = (*pRootItem->pChildren)[ nRootPos ];
return pRet;
}
inline SvTreeEntryList* SvTreeList::GetChildList( SvTreeListEntry* pParent ) const
{
if ( !pParent )
pParent = pRootItem;
return pParent->pChildren;
}
inline SvTreeListEntry* SvTreeList::GetParent( SvTreeListEntry* pEntry ) const
{
SvTreeListEntry* pParent = pEntry->pParent;
if ( pParent==pRootItem )
pParent = 0;
return pParent;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -383,9 +383,9 @@ public:
SvTreeListEntry* Prev( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const { return pModel->Prev(pEntry,pDepth); }
SvTreeListEntry* Last() const { return pModel->Last(); }
SvTreeListEntry* FirstChild(SvTreeListEntry* pParent ) const { return pModel->FirstChild(pParent); }
SvTreeListEntry* NextSibling(SvTreeListEntry* pEntry ) const { return pModel->NextSibling(pEntry); }
SvTreeListEntry* PrevSibling(SvTreeListEntry* pEntry ) const { return pModel->PrevSibling(pEntry); }
SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
SvTreeListEntry* NextSibling( SvTreeListEntry* pEntry ) const;
SvTreeListEntry* PrevSibling( SvTreeListEntry* pEntry ) const;
sal_Bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
sal_Bool MoveSelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
@@ -396,18 +396,18 @@ public:
SelectionMode GetSelectionMode() const { return eSelMode; }
// pParent==0 -> Root-Ebene
SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const { return pModel->GetEntry(pParent, nPos); }
SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const { return pModel->GetEntry(nRootPos); }
SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const;
SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const;
SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
using Window::GetParent;
SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const { return pModel->GetParent(pEntry); }
SvTreeListEntry* GetRootLevelParent(SvTreeListEntry* pEntry ) const { return pModel->GetRootLevelParent(pEntry);}
SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
SvTreeListEntry* GetRootLevelParent(SvTreeListEntry* pEntry ) const;
using Window::GetChildCount;
sal_uLong GetChildCount( SvTreeListEntry* pParent ) const { return pModel->GetChildCount(pParent); }
sal_uLong GetChildCount( SvTreeListEntry* pParent ) const;
sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
SvViewDataEntry* GetViewDataEntry( SvTreeListEntry* pEntry ) const { return (SvViewDataEntry*)SvListView::GetViewData(pEntry); }

View File

@@ -1439,17 +1439,45 @@ SvTreeListEntry* SvTreeList::GetRootLevelParent( SvTreeListEntry* pEntry ) const
return pCurParent;
}
std::pair<SvTreeEntryList::const_iterator,SvTreeEntryList::const_iterator>
SvTreeList::GetChildIterators(const SvTreeListEntry* pParent) const
{
typedef std::pair<SvTreeEntryList::const_iterator,SvTreeEntryList::const_iterator> IteratorPair;
IteratorPair aRet;
if (!pParent)
pParent = pRootItem;
//*************************************************************************
//*************************************************************************
//*************************************************************************
//*************************************************************************
//*************************************************************************
//*************************************************************************
//*************************************************************************
//*************************************************************************
if (!pParent->pChildren || pParent->pChildren->empty())
// This entry has no children.
return aRet;
aRet.first = pParent->pChildren->begin();
aRet.second = pParent->pChildren->end();
return aRet;
}
std::pair<SvTreeEntryList::iterator,SvTreeEntryList::iterator>
SvTreeList::GetChildIterators(SvTreeListEntry* pParent)
{
typedef std::pair<SvTreeEntryList::iterator,SvTreeEntryList::iterator> IteratorPair;
IteratorPair aRet;
if (!pParent)
pParent = pRootItem;
if (!pParent->pChildren || pParent->pChildren->empty())
// This entry has no children.
return aRet;
aRet.first = pParent->pChildren->begin();
aRet.second = pParent->pChildren->end();
return aRet;
}
DBG_NAME(SvListView);
@@ -1526,6 +1554,11 @@ void SvListView::Clear()
}
}
SvTreeList* SvListView::GetModel() const
{
return pModel;
}
void SvListView::SetModel( SvTreeList* pNewModel )
{
DBG_CHKTHIS(SvListView,0);
@@ -1864,5 +1897,43 @@ void SvTreeList::GetInsertionPos( SvTreeListEntry* pEntry, SvTreeListEntry* pPar
}
}
sal_Bool SvTreeList::HasChildren( SvTreeListEntry* pEntry ) const
{
if ( !pEntry )
pEntry = pRootItem;
return (sal_Bool)(pEntry->pChildren != 0);
}
SvTreeListEntry* SvTreeList::GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const
{ if ( !pParent )
pParent = pRootItem;
SvTreeListEntry* pRet = 0;
if ( pParent->pChildren )
pRet = (*pParent->pChildren)[ nPos ];
return pRet;
}
SvTreeListEntry* SvTreeList::GetEntry( sal_uLong nRootPos ) const
{
SvTreeListEntry* pRet = 0;
if ( nEntryCount )
pRet = (*pRootItem->pChildren)[ nRootPos ];
return pRet;
}
SvTreeEntryList* SvTreeList::GetChildList( SvTreeListEntry* pParent ) const
{
if ( !pParent )
pParent = pRootItem;
return pParent->pChildren;
}
SvTreeListEntry* SvTreeList::GetParent( SvTreeListEntry* pEntry ) const
{
SvTreeListEntry* pParent = pEntry->pParent;
if ( pParent==pRootItem )
pParent = 0;
return pParent;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -667,6 +667,21 @@ sal_Bool SvTreeListBox::NotifyCopying(
return NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
}
SvTreeListEntry* SvTreeListBox::FirstChild( SvTreeListEntry* pParent ) const
{
return pModel->FirstChild(pParent);
}
SvTreeListEntry* SvTreeListBox::NextSibling( SvTreeListEntry* pEntry ) const
{
return pModel->NextSibling(pEntry);
}
SvTreeListEntry* SvTreeListBox::PrevSibling( SvTreeListEntry* pEntry ) const
{
return pModel->PrevSibling(pEntry);
}
// return: all entries copied
sal_Bool SvTreeListBox::CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget )
{
@@ -867,6 +882,16 @@ void SvTreeListBox::OnCurrentEntryChanged()
mpImpl->m_aQuickSelectionEngine.Reset();
}
SvTreeListEntry* SvTreeListBox::GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const
{
return pModel->GetEntry(pParent, nPos);
}
SvTreeListEntry* SvTreeListBox::GetEntry( sal_uLong nRootPos ) const
{
return pModel->GetEntry(nRootPos);
}
SvTreeListEntry* SvTreeListBox::GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const
{
DBG_CHKTHIS(SvTreeListBox,0);
@@ -916,6 +941,21 @@ void SvTreeListBox::FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_In
}
}
SvTreeListEntry* SvTreeListBox::GetParent( SvTreeListEntry* pEntry ) const
{
return pModel->GetParent(pEntry);
}
SvTreeListEntry* SvTreeListBox::GetRootLevelParent( SvTreeListEntry* pEntry ) const
{
return pModel->GetRootLevelParent(pEntry);
}
sal_uLong SvTreeListBox::GetChildCount( SvTreeListEntry* pParent ) const
{
return pModel->GetChildCount(pParent);
}
sal_uLong SvTreeListBox::GetLevelChildCount( SvTreeListEntry* _pParent ) const
{
DBG_CHKTHIS(SvTreeListBox,0);