diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-23 17:42:17 +0200 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-23 17:58:47 +0200 |
commit | 3fa955d701ee5c1bf74a216873390fb402ac7cb0 (patch) | |
tree | aa80291d63517d73247278f79229b78de1c5901d /svtools | |
parent | d7a19a7e04c3ec2099ec5df562558f51327e8179 (diff) |
Make SvTreeEntryList private to svtools.
Change-Id: I283d897cd5a7c15b5b60e99c90c04b696d20c2a3
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/treelist.hxx | 49 | ||||
-rw-r--r-- | svtools/inc/svtools/treelistbox.hxx | 16 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 87 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 40 |
4 files changed, 135 insertions, 57 deletions
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 2f4e06a323a7..86d403e10907 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -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: */ diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx index 06a4e54c05a1..82842609be6e 100644 --- a/svtools/inc/svtools/treelistbox.hxx +++ b/svtools/inc/svtools/treelistbox.hxx @@ -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); } diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 8cf16a9f6b8a..48e6df78e26b 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -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: */ diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index a24d6fbb6920..2806d30f55f4 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -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); |