diff options
author | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-15 19:09:49 +0200 |
---|---|---|
committer | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-19 21:57:06 +0200 |
commit | 15295ab6db7cb46ea5f155d33a08027c62fb0e41 (patch) | |
tree | 89ad8ebaee3f7821299b944c378d60a11aa20d64 /sw/source/core/doc/doccorr.cxx | |
parent | 5a05115ee25683b5fc7c79ab418eaeed120bd3b0 (diff) |
Refactored SwDoc::GetEditShell .
Removed its output paramater as GetCurrentViewShell should be
used instead and added a const version.
Change-Id: Iad8b57553b6e93e3472ce8c6905d08e8d49af770
Diffstat (limited to 'sw/source/core/doc/doccorr.cxx')
-rw-r--r-- | sw/source/core/doc/doccorr.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 5430bb6d51a6..074eafca4314 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -39,14 +39,14 @@ #define PCURSH ((SwCrsrShell*)_pStartShell) #define FOREACHSHELL_START( pEShell ) \ {\ - SwViewShell *_pStartShell = pEShell; \ + SwViewShell const *_pStartShell = pEShell; \ do { \ if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \ { #define FOREACHSHELL_END( pEShell ) \ } \ - } while((_pStartShell=(SwViewShell*)_pStartShell->GetNext())!= pEShell ); \ + } while((_pStartShell=(SwViewShell const*)_pStartShell->GetNext())!= pEShell ); \ } namespace @@ -259,7 +259,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, const sal_Int32 nCntIdx = rNewPos.nContent.GetIndex() + nOffset; - SwCrsrShell* pShell = pDoc->GetEditShell(); + SwCrsrShell const* pShell = pDoc->GetEditShell(); if( pShell ) { FOREACHSHELL_START( pShell ) @@ -322,32 +322,33 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode, ::PaMCorrRel(rOldNode, rNewPos, nOffset); } -SwEditShell* SwDoc::GetEditShell( SwViewShell** ppSh ) const +SwEditShell const * SwDoc::GetEditShell() const { - SwViewShell *pCurrentView = const_cast<SwViewShell*>( getIDocumentLayoutAccess().GetCurrentViewShell() ); + SwViewShell const *pCurrentView = getIDocumentLayoutAccess().GetCurrentViewShell(); // Layout and OLE shells should be available if( pCurrentView ) { - SwViewShell *pSh = pCurrentView, *pVSh = pSh; - if( ppSh ) - *ppSh = pSh; - + SwViewShell const *pFirstVSh = pCurrentView; + SwViewShell const *pCurrentVSh = pFirstVSh; // look for an EditShell (if it exists) do { - if( pSh->IsA( TYPE( SwEditShell ) ) ) - return (SwEditShell*)pSh; - - } while( pVSh != ( pSh = (SwViewShell*)pSh->GetNext() )); + if( pCurrentVSh->IsA( TYPE( SwEditShell ) ) ) + { + return (SwEditShell*)pCurrentVSh; + } + } while( pFirstVSh != ( pCurrentVSh = (SwViewShell*)pCurrentVSh->GetNext() )); } - else if( ppSh ) - *ppSh = 0; - return 0; } +SwEditShell* SwDoc::GetEditShell() +{ + return const_cast<SwEditShell*>( const_cast<SwDoc const *>( this )->GetEditShell() ); +} + ::sw::IShellCursorSupplier * SwDoc::GetIShellCursorSupplier() { - return GetEditShell(0); + return GetEditShell(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |