diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-02 17:23:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-03 08:16:19 +0200 |
commit | 904c97bbdf4c76709dbcacb11292668b98a9efd8 (patch) | |
tree | 42855fdaf74aca15c6674836a8f603d22aa87744 /svtools | |
parent | bb1d5780226bb1b9156580972eea9aa849178742 (diff) |
move SvTreeList::*Sibling to SvTreeListEntry
since they don't depend on SvTreeList at all
Change-Id: If48c83976a95943e5cfa92490d68f74281cf4b5f
Reviewed-on: https://gerrit.libreoffice.org/56819
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/foldertree.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/svimpbox.cxx | 12 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 38 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 14 | ||||
-rw-r--r-- | svtools/source/contnr/treelistentry.cxx | 25 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 4 |
6 files changed, 36 insertions, 59 deletions
diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx index 0384b0a47693..438b764ac949 100644 --- a/svtools/source/contnr/foldertree.cxx +++ b/svtools/source/contnr/foldertree.cxx @@ -146,7 +146,7 @@ void FolderTree::SetTreePath( OUString const & sUrl ) } else { - pEntry = NextSibling( pEntry ); + pEntry = pEntry->NextSibling(); } } else diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 24e735a11a0e..6f7d0f23720a 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1076,7 +1076,7 @@ void SvImpLBox::DrawNet(vcl::RenderContext& rRenderContext) pChild = pView->FirstChild( pEntry ); DBG_ASSERT(pChild,"Child?"); - pChild = SvTreeList::LastSibling( pChild ); + pChild = pChild->LastSibling(); nDistance = static_cast<sal_uInt16>(pView->GetVisiblePos(pChild) - pView->GetVisiblePos(pEntry)); aPos2 = aPos1; aPos2.AdjustY(nDistance * nEntryHeight ); @@ -1116,7 +1116,7 @@ void SvImpLBox::DrawNet(vcl::RenderContext& rRenderContext) aPos1.AdjustX( -(pView->GetIndent()) ); aPos1.setY( GetEntryLine( pEntry ) ); aPos1.AdjustY(nEntryHeightDIV2 ); - pChild = SvTreeList::LastSibling( pEntry ); + pChild = pEntry->LastSibling(); aPos2.setX( aPos1.X() ); aPos2.setY( GetEntryLine( pChild ) ); aPos2.AdjustY(nEntryHeightDIV2 ); @@ -1650,7 +1650,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry ) pView->Select( pCursor, false ); ShowCursor( false ); // focus rectangle gone // NextSibling, because we also delete the children of the cursor - pTemp = SvTreeListBox::NextSibling( pCursor ); + pTemp = pCursor->NextSibling(); if( !pTemp ) pTemp = pView->PrevVisible(pCursor); @@ -1658,7 +1658,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry ) } if( pStartEntry && pStartEntry == pEntry ) { - pTemp = SvTreeListBox::NextSibling( pStartEntry ); + pTemp = pStartEntry->NextSibling(); if( !pTemp ) pTemp = pView->PrevVisible(pStartEntry); pStartEntry = pTemp; @@ -1749,9 +1749,9 @@ void SvImpLBox::MovingEntry( SvTreeListEntry* pEntry ) } else { - pNew = SvTreeList::NextSibling( pEntry ); + pNew = pEntry->NextSibling(); if( !pNew ) - pNew = SvTreeList::PrevSibling( pEntry ); + pNew = pEntry->PrevSibling(); } pStartEntry = pNew; } diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 2b1f3eff5a3e..e4d66eec25e0 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -805,44 +805,6 @@ SvTreeListEntry* SvTreeList::FirstChild( SvTreeListEntry* pParent ) const return pResult; } -SvTreeListEntry* SvTreeList::NextSibling( SvTreeListEntry* pEntry ) -{ - DBG_ASSERT(pEntry,"Entry?"); - if( !pEntry ) - return nullptr; - - SvTreeListEntries& rList = pEntry->pParent->m_Children; - sal_uLong nPos = pEntry->GetChildListPos(); - nPos++; - return (nPos < rList.size()) ? rList[nPos].get() : nullptr; -} - -SvTreeListEntry* SvTreeList::PrevSibling( SvTreeListEntry* pEntry ) -{ - DBG_ASSERT(pEntry,"Entry?"); - if( !pEntry ) - return nullptr; - - SvTreeListEntries& rList = pEntry->pParent->m_Children; - sal_uLong nPos = pEntry->GetChildListPos(); - if ( nPos == 0 ) - return nullptr; - nPos--; - pEntry = rList[nPos].get(); - return pEntry; -} - - -SvTreeListEntry* SvTreeList::LastSibling( SvTreeListEntry* pEntry ) -{ - DBG_ASSERT(pEntry,"LastSibling:Entry?"); - if( !pEntry ) - return nullptr; - - SvTreeListEntries& rChildren = pEntry->pParent->m_Children; - return (rChildren.empty()) ? nullptr : rChildren.back().get(); -} - SvTreeListEntry* SvTreeList::NextSelected( const SvListView* pView, SvTreeListEntry* pEntry ) const { DBG_ASSERT(pView&&pEntry,"NextSel:View/Entry?"); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index c236e432e227..8338033e2263 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -530,16 +530,6 @@ SvTreeListEntry* SvTreeListBox::FirstChild( SvTreeListEntry* pParent ) const return pModel->FirstChild(pParent); } -SvTreeListEntry* SvTreeListBox::NextSibling( SvTreeListEntry* pEntry ) -{ - return SvTreeList::NextSibling(pEntry); -} - -SvTreeListEntry* SvTreeListBox::PrevSibling( SvTreeListEntry* pEntry ) -{ - return SvTreeList::PrevSibling(pEntry); -} - // return: all entries copied bool SvTreeListBox::CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget ) { @@ -967,7 +957,7 @@ const void* SvTreeListBox::NextSearchEntry( const void* _pCurrentSearchEntry, OU && !IsExpanded( pEntry ) ) { - pEntry = NextSibling( pEntry ); + pEntry = pEntry->NextSibling(); } else { @@ -3179,7 +3169,7 @@ void SvTreeListBox::SetAlternatingRowColors( bool bEnable ) if( IsExpanded( pEntry ) ) pNextEntry = pModel->FirstChild( pEntry ); else - pNextEntry = SvTreeList::NextSibling( pEntry ); + pNextEntry = pEntry->NextSibling(); if( !pNextEntry ) pEntry = pModel->Next( pEntry ); diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index bbf8a49a11c9..708aaae1d116 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -213,4 +213,29 @@ void SvTreeListEntry::SetFlags( SvTLEntryFlags nFlags ) nEntryFlags = nFlags; } +SvTreeListEntry* SvTreeListEntry::NextSibling() const +{ + SvTreeListEntries& rList = pParent->m_Children; + sal_uLong nPos = GetChildListPos(); + nPos++; + return (nPos < rList.size()) ? rList[nPos].get() : nullptr; +} + +SvTreeListEntry* SvTreeListEntry::PrevSibling() const +{ + SvTreeListEntries& rList = pParent->m_Children; + sal_uLong nPos = GetChildListPos(); + if ( nPos == 0 ) + return nullptr; + nPos--; + return rList[nPos].get(); +} + + +SvTreeListEntry* SvTreeListEntry::LastSibling() const +{ + SvTreeListEntries& rChildren = pParent->m_Children; + return (rChildren.empty()) ? nullptr : rChildren.back().get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index b481ebfb7025..37434a04eaad 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -1055,13 +1055,13 @@ void TreeControlPeer::updateChildNodes( UnoTreeListBoxImpl const & rTree, const updateEntry( pCurrentChild ); } - pCurrentChild = dynamic_cast< UnoTreeListEntry* >( SvTreeListBox::NextSibling( pCurrentChild ) ); + pCurrentChild = dynamic_cast< UnoTreeListEntry* >( pCurrentChild->NextSibling() ); } // check if we have entries without nodes left, we need to remove them while( pCurrentChild ) { - UnoTreeListEntry* pNextChild = dynamic_cast< UnoTreeListEntry* >( SvTreeListBox::NextSibling( pCurrentChild ) ); + UnoTreeListEntry* pNextChild = dynamic_cast< UnoTreeListEntry* >( pCurrentChild->NextSibling() ); rTree.GetModel()->Remove( pCurrentChild ); pCurrentChild = pNextChild; } |