diff options
Diffstat (limited to 'sw/source/core/crsr')
-rw-r--r-- | sw/source/core/crsr/BlockCursor.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/BlockCursor.hxx | 16 | ||||
-rw-r--r-- | sw/source/core/crsr/callnk.cxx | 74 | ||||
-rw-r--r-- | sw/source/core/crsr/callnk.hxx | 14 | ||||
-rw-r--r-- | sw/source/core/crsr/crbm.cxx | 124 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 1904 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 818 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl1.cxx | 56 | ||||
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/crsr/findcoll.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 74 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 320 | ||||
-rw-r--r-- | sw/source/core/crsr/trvlcol.cxx | 58 | ||||
-rw-r--r-- | sw/source/core/crsr/trvlfnfl.cxx | 116 | ||||
-rw-r--r-- | sw/source/core/crsr/trvlreg.cxx | 54 | ||||
-rw-r--r-- | sw/source/core/crsr/trvltbl.cxx | 358 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 296 |
18 files changed, 2168 insertions, 2168 deletions
diff --git a/sw/source/core/crsr/BlockCursor.cxx b/sw/source/core/crsr/BlockCursor.cxx index e8a21ccdb74c..89c8d8f745fe 100644 --- a/sw/source/core/crsr/BlockCursor.cxx +++ b/sw/source/core/crsr/BlockCursor.cxx @@ -26,7 +26,7 @@ SwBlockCursor::~SwBlockCursor() delete pEndPt; } -SwShellCrsr& SwBlockCursor::getShellCrsr() +SwShellCursor& SwBlockCursor::getShellCursor() { return aCursor; } diff --git a/sw/source/core/crsr/BlockCursor.hxx b/sw/source/core/crsr/BlockCursor.hxx index a68b1117cc51..3238993c87cd 100644 --- a/sw/source/core/crsr/BlockCursor.hxx +++ b/sw/source/core/crsr/BlockCursor.hxx @@ -21,34 +21,34 @@ #include <crsrsh.hxx> -class SwCrsrShell; +class SwCursorShell; struct SwPosition; class Point; /** Access to the block cursor - A block cursor contains a SwShellCrsr and additional information about + A block cursor contains a SwShellCursor and additional information about the rectangle which has been created by pressing the mouse button and moving the mouse. - It's simply an aggregation of a SwShellCrsr and a rectangle defined by + It's simply an aggregation of a SwShellCursor and a rectangle defined by a start and an end point. */ class SwBlockCursor { - SwShellCrsr aCursor; + SwShellCursor aCursor; Point *pStartPt; Point *pEndPt; public: - SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) : - aCursor( rCrsrSh, rPos ), pStartPt(nullptr), pEndPt(nullptr) {} + SwBlockCursor( const SwCursorShell& rCursorSh, const SwPosition &rPos ) : + aCursor( rCursorSh, rPos ), pStartPt(nullptr), pEndPt(nullptr) {} /** Access to the shell cursor - @return SwShellCrsr& which represents the start and end position of the + @return SwShellCursor& which represents the start and end position of the current block selection */ - SwShellCrsr& getShellCrsr(); + SwShellCursor& getShellCursor(); /** Defines the starting vertex of the block selection @param rPt diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index f24c6fb9f3a5..e93a6c9d7014 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -36,31 +36,31 @@ #include <breakit.hxx> #include <vcl/window.hxx> -SwCallLink::SwCallLink( SwCrsrShell & rSh, sal_uLong nAktNode, sal_Int32 nAktContent, +SwCallLink::SwCallLink( SwCursorShell & rSh, sal_uLong nAktNode, sal_Int32 nAktContent, sal_uInt8 nAktNdTyp, long nLRPos, bool bAktSelection ) : rShell( rSh ), nNode( nAktNode ), nContent( nAktContent ), - nNdTyp( nAktNdTyp ), nLeftFrmPos( nLRPos ), + nNdTyp( nAktNdTyp ), nLeftFramePos( nLRPos ), bHasSelection( bAktSelection ) { } -SwCallLink::SwCallLink( SwCrsrShell & rSh ) +SwCallLink::SwCallLink( SwCursorShell & rSh ) : rShell( rSh ) { // remember SPoint-values of current cursor - SwPaM* pCrsr = rShell.IsTableMode() ? rShell.GetTableCrs() : rShell.GetCrsr(); - SwNode& rNd = pCrsr->GetPoint()->nNode.GetNode(); + SwPaM* pCursor = rShell.IsTableMode() ? rShell.GetTableCrs() : rShell.GetCursor(); + SwNode& rNd = pCursor->GetPoint()->nNode.GetNode(); nNode = rNd.GetIndex(); - nContent = pCrsr->GetPoint()->nContent.GetIndex(); + nContent = pCursor->GetPoint()->nContent.GetIndex(); nNdTyp = rNd.GetNodeType(); - bHasSelection = ( *pCrsr->GetPoint() != *pCrsr->GetMark() ); + bHasSelection = ( *pCursor->GetPoint() != *pCursor->GetMark() ); if( rNd.IsTextNode() ) - nLeftFrmPos = SwCallLink::getLayoutFrm( rShell.GetLayout(), *rNd.GetTextNode(), nContent, + nLeftFramePos = SwCallLink::getLayoutFrame( rShell.GetLayout(), *rNd.GetTextNode(), nContent, !rShell.ActionPend() ); else { - nLeftFrmPos = 0; + nLeftFramePos = 0; // A special treatment for SwFeShell: // When deleting the header/footer, footnotes SwFeShell sets the @@ -72,30 +72,30 @@ SwCallLink::SwCallLink( SwCrsrShell & rSh ) } } -static void lcl_notifyRow(const SwContentNode* pNode, SwCrsrShell& rShell) +static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell& rShell) { if ( !pNode ) return; - SwFrm *const pMyFrm = pNode->getLayoutFrm( rShell.GetLayout() ); - if ( !pMyFrm ) + SwFrame *const pMyFrame = pNode->getLayoutFrame( rShell.GetLayout() ); + if ( !pMyFrame ) return; // We need to emulated a change of the row height in order // to have the complete row redrawn - SwRowFrm *const pRow = pMyFrm->FindRowFrm(); + SwRowFrame *const pRow = pMyFrame->FindRowFrame(); if ( !pRow ) return; const SwTableLine* pLine = pRow->GetTabLine( ); // Avoid redrawing the complete row if there are no nested tables - for (SwFrm *pCell = pRow->GetLower(); pCell; pCell = pCell->GetNext()) + for (SwFrame *pCell = pRow->GetLower(); pCell; pCell = pCell->GetNext()) { - for (SwFrm *pContent = pCell->GetLower(); pContent; pContent = pContent->GetNext()) + for (SwFrame *pContent = pCell->GetLower(); pContent; pContent = pContent->GetNext()) { if (pContent->GetType() == FRM_TAB) { - SwFormatFrmSize pSize = pLine->GetFrameFormat()->GetFrmSize(); + SwFormatFrameSize pSize = pLine->GetFrameFormat()->GetFrameSize(); pRow->ModifyNotification(nullptr, &pSize); return; } @@ -110,8 +110,8 @@ SwCallLink::~SwCallLink() // If travelling over Nodes check formats and register them anew at the // new Node. - SwPaM* pCurCrsr = rShell.IsTableMode() ? rShell.GetTableCrs() : rShell.GetCrsr(); - SwContentNode * pCNd = pCurCrsr->GetContentNode(); + SwPaM* pCurrentCursor = rShell.IsTableMode() ? rShell.GetTableCrs() : rShell.GetCursor(); + SwContentNode * pCNd = pCurrentCursor->GetContentNode(); if( !pCNd ) return; @@ -125,9 +125,9 @@ SwCallLink::~SwCallLink() } lcl_notifyRow(pNode, rShell); - sal_Int32 nCmp, nAktContent = pCurCrsr->GetPoint()->nContent.GetIndex(); + sal_Int32 nCmp, nAktContent = pCurrentCursor->GetPoint()->nContent.GetIndex(); sal_uInt16 nNdWhich = pCNd->GetNodeType(); - sal_uLong nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex(); + sal_uLong nAktNode = pCurrentCursor->GetPoint()->nNode.GetIndex(); // Register the Shell as dependent at the current Node. By doing this all // attribute changes can be signaled over the link. @@ -141,7 +141,7 @@ SwCallLink::~SwCallLink() // That can be done in one go by the handler. rShell.CallChgLnk(); } - else if( !bHasSelection != !(*pCurCrsr->GetPoint() != *pCurCrsr->GetMark()) ) + else if( !bHasSelection != !(*pCurrentCursor->GetPoint() != *pCurrentCursor->GetMark()) ) { // always call change link when selection changes rShell.CallChgLnk(); @@ -151,12 +151,12 @@ SwCallLink::~SwCallLink() { // If travelling with left/right only and the frame is // unchanged (columns!) then check text hints. - if( nLeftFrmPos == SwCallLink::getLayoutFrm( rShell.GetLayout(), *pCNd->GetTextNode(), nAktContent, + if( nLeftFramePos == SwCallLink::getLayoutFrame( rShell.GetLayout(), *pCNd->GetTextNode(), nAktContent, !rShell.ActionPend() ) && (( nCmp = nContent ) + 1 == nAktContent || // Right nContent -1 == ( nCmp = nAktContent )) ) // Left { - if( nCmp == nAktContent && pCurCrsr->HasMark() ) // left & select + if( nCmp == nAktContent && pCurrentCursor->HasMark() ) // left & select ++nCmp; if ( pCNd->GetTextNode()->HasHints() ) @@ -210,12 +210,12 @@ SwCallLink::~SwCallLink() rShell.CallChgLnk(); } - const SwFrm* pFrm; - const SwFlyFrm *pFlyFrm; - if( !rShell.ActionPend() && nullptr != ( pFrm = pCNd->getLayoutFrm(rShell.GetLayout(), nullptr, nullptr, false) ) && - nullptr != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() ) + const SwFrame* pFrame; + const SwFlyFrame *pFlyFrame; + if( !rShell.ActionPend() && nullptr != ( pFrame = pCNd->getLayoutFrame(rShell.GetLayout(), nullptr, nullptr, false) ) && + nullptr != ( pFlyFrame = pFrame->FindFlyFrame() ) && !rShell.IsTableMode() ) { - const SwNodeIndex* pIndex = pFlyFrm->GetFormat()->GetContent().GetContentIdx(); + const SwNodeIndex* pIndex = pFlyFrame->GetFormat()->GetContent().GetContentIdx(); OSL_ENSURE( pIndex, "Fly without Content" ); if (!pIndex) @@ -225,22 +225,22 @@ SwCallLink::~SwCallLink() if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode || nNode > rStNd.EndOfSectionIndex() ) - rShell.GetFlyMacroLnk().Call( pFlyFrm->GetFormat() ); + rShell.GetFlyMacroLnk().Call( pFlyFrame->GetFormat() ); } } -long SwCallLink::getLayoutFrm( const SwRootFrm* pRoot, SwTextNode& rNd, sal_Int32 nCntPos, bool bCalcFrm ) +long SwCallLink::getLayoutFrame( const SwRootFrame* pRoot, SwTextNode& rNd, sal_Int32 nCntPos, bool bCalcFrame ) { - SwTextFrm* pFrm = static_cast<SwTextFrm*>(rNd.getLayoutFrm(pRoot,nullptr,nullptr,bCalcFrm)); - SwTextFrm* pNext; - if ( pFrm && !pFrm->IsHiddenNow() ) + SwTextFrame* pFrame = static_cast<SwTextFrame*>(rNd.getLayoutFrame(pRoot,nullptr,nullptr,bCalcFrame)); + SwTextFrame* pNext; + if ( pFrame && !pFrame->IsHiddenNow() ) { - if( pFrm->HasFollow() ) - while( nullptr != ( pNext = pFrm->GetFollow() ) && + if( pFrame->HasFollow() ) + while( nullptr != ( pNext = pFrame->GetFollow() ) && nCntPos >= pNext->GetOfst() ) - pFrm = pNext; + pFrame = pNext; - return pFrm->Frm().Left(); + return pFrame->Frame().Left(); } return 0; } diff --git a/sw/source/core/crsr/callnk.hxx b/sw/source/core/crsr/callnk.hxx index b0aebe7aa21b..d2a7b4df4643 100644 --- a/sw/source/core/crsr/callnk.hxx +++ b/sw/source/core/crsr/callnk.hxx @@ -22,27 +22,27 @@ #include <tools/solar.h> -class SwCrsrShell; +class SwCursorShell; class SwTextNode; -class SwRootFrm; +class SwRootFrame; class SwCallLink { public: - SwCrsrShell & rShell; + SwCursorShell & rShell; sal_uLong nNode; sal_Int32 nContent; sal_uInt8 nNdTyp; - long nLeftFrmPos; + long nLeftFramePos; bool bHasSelection; - explicit SwCallLink( SwCrsrShell & rSh ); - SwCallLink( SwCrsrShell & rSh, sal_uLong nAktNode, sal_Int32 nAktContent, + explicit SwCallLink( SwCursorShell & rSh ); + SwCallLink( SwCursorShell & rSh, sal_uLong nAktNode, sal_Int32 nAktContent, sal_uInt8 nAktNdTyp, long nLRPos, bool bAktSelection ); ~SwCallLink(); - static long getLayoutFrm( const SwRootFrm*, SwTextNode& rNd, sal_Int32 nCntPos, bool bCalcFrm ); + static long getLayoutFrame( const SwRootFrame*, SwTextNode& rNd, sal_Int32 nCntPos, bool bCalcFrame ); }; #endif // INCLUDED_SW_SOURCE_CORE_CRSR_CALLNK_HXX diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 8b55c24d62e9..91b6f3f10617 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -30,40 +30,40 @@ using namespace std; namespace { - struct CrsrStateHelper + struct CursorStateHelper { - explicit CrsrStateHelper(SwCrsrShell& rShell) + explicit CursorStateHelper(SwCursorShell& rShell) : m_aLink(rShell) - , m_pCrsr(rShell.GetSwCrsr()) - , m_aSaveState(*m_pCrsr) + , m_pCursor(rShell.GetSwCursor()) + , m_aSaveState(*m_pCursor) { } - void SetCrsrToMark(::sw::mark::IMark const * const pMark) + void SetCursorToMark(::sw::mark::IMark const * const pMark) { - *(m_pCrsr->GetPoint()) = pMark->GetMarkStart(); + *(m_pCursor->GetPoint()) = pMark->GetMarkStart(); if(pMark->IsExpanded()) { - m_pCrsr->SetMark(); - *(m_pCrsr->GetMark()) = pMark->GetMarkEnd(); + m_pCursor->SetMark(); + *(m_pCursor->GetMark()) = pMark->GetMarkEnd(); } } /// returns true if the Cursor had been rolled back bool RollbackIfIllegal() { - if(m_pCrsr->IsSelOvr(nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION + if(m_pCursor->IsSelOvr(nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE)) { - m_pCrsr->DeleteMark(); - m_pCrsr->RestoreSavePos(); + m_pCursor->DeleteMark(); + m_pCursor->RestoreSavePos(); return true; } return false; } SwCallLink m_aLink; - SwCursor* m_pCrsr; - SwCrsrSaveState m_aSaveState; + SwCursor* m_pCursor; + SwCursorSaveState m_aSaveState; }; static bool lcl_ReverseMarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst, @@ -78,8 +78,8 @@ namespace } } -// at CurCrsr.SPoint -::sw::mark::IMark* SwCrsrShell::SetBookmark( +// at CurrentCursor.SPoint +::sw::mark::IMark* SwCursorShell::SetBookmark( const vcl::KeyCode& rCode, const OUString& rName, const OUString& rShortName, @@ -87,7 +87,7 @@ namespace { StartAction(); ::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark( - *GetCrsr(), + *GetCursor(), rName, eMark); ::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark); @@ -99,36 +99,36 @@ namespace EndAction(); return pMark; } -// set CurCrsr.SPoint +// set CurrentCursor.SPoint -bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart) +bool SwCursorShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart) { - // watch Crsr-Moves - CrsrStateHelper aCrsrSt(*this); + // watch Cursor-Moves + CursorStateHelper aCursorSt(*this); if ( bAtStart ) - *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkStart(); + *(aCursorSt.m_pCursor)->GetPoint() = pMark->GetMarkStart(); else - *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkEnd(); + *(aCursorSt.m_pCursor)->GetPoint() = pMark->GetMarkEnd(); - if(aCrsrSt.RollbackIfIllegal()) return false; + if(aCursorSt.RollbackIfIllegal()) return false; - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } -bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark) +bool SwCursorShell::GotoMark(const ::sw::mark::IMark* const pMark) { - // watch Crsr-Moves - CrsrStateHelper aCrsrSt(*this); - aCrsrSt.SetCrsrToMark(pMark); + // watch Cursor-Moves + CursorStateHelper aCursorSt(*this); + aCursorSt.SetCursorToMark(pMark); - if(aCrsrSt.RollbackIfIllegal()) return false; + if(aCursorSt.RollbackIfIllegal()) return false; - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } -bool SwCrsrShell::GoNextBookmark() +bool SwCursorShell::GoNextBookmark() { IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); IDocumentMarkAccess::container_t vCandidates; @@ -136,19 +136,19 @@ bool SwCrsrShell::GoNextBookmark() upper_bound( // finds the first that is starting after pMarkAccess->getBookmarksBegin(), pMarkAccess->getBookmarksEnd(), - *GetCrsr()->GetPoint(), + *GetCursor()->GetPoint(), sw::mark::CompareIMarkStartsAfter()), pMarkAccess->getBookmarksEnd(), back_inserter(vCandidates), &lcl_IsInvisibleBookmark); - // watch Crsr-Moves - CrsrStateHelper aCrsrSt(*this); + // watch Cursor-Moves + CursorStateHelper aCursorSt(*this); IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin(); for(; ppMark!=vCandidates.end(); ++ppMark) { - aCrsrSt.SetCrsrToMark(ppMark->get()); - if(!aCrsrSt.RollbackIfIllegal()) + aCursorSt.SetCursorToMark(ppMark->get()); + if(!aCursorSt.RollbackIfIllegal()) break; // found legal move } if(ppMark==vCandidates.end()) @@ -157,11 +157,11 @@ bool SwCrsrShell::GoNextBookmark() return false; } - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } -bool SwCrsrShell::GoPrevBookmark() +bool SwCursorShell::GoPrevBookmark() { IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess(); // candidates from which to choose the mark before @@ -172,7 +172,7 @@ bool SwCrsrShell::GoPrevBookmark() upper_bound( pMarkAccess->getBookmarksBegin(), pMarkAccess->getBookmarksEnd(), - *GetCrsr()->GetPoint(), + *GetCursor()->GetPoint(), sw::mark::CompareIMarkStartsAfter()), back_inserter(vCandidates), &lcl_IsInvisibleBookmark); @@ -181,19 +181,19 @@ bool SwCrsrShell::GoPrevBookmark() vCandidates.end(), &lcl_ReverseMarkOrderingByEnd); - // watch Crsr-Moves - CrsrStateHelper aCrsrSt(*this); + // watch Cursor-Moves + CursorStateHelper aCursorSt(*this); IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin(); for(; ppMark!=vCandidates.end(); ++ppMark) { - // ignoring those not ending before the Crsr + // ignoring those not ending before the Cursor // (we were only able to eliminate those starting - // behind the Crsr by the upper_bound(..) + // behind the Cursor by the upper_bound(..) // above) - if(!(**ppMark).EndsBefore(*GetCrsr()->GetPoint())) + if(!(**ppMark).EndsBefore(*GetCursor()->GetPoint())) continue; - aCrsrSt.SetCrsrToMark(ppMark->get()); - if(!aCrsrSt.RollbackIfIllegal()) + aCursorSt.SetCursorToMark(ppMark->get()); + if(!aCursorSt.RollbackIfIllegal()) break; // found legal move } if(ppMark==vCandidates.end()) @@ -202,47 +202,47 @@ bool SwCrsrShell::GoPrevBookmark() return false; } - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } -bool SwCrsrShell::IsFormProtected() +bool SwCursorShell::IsFormProtected() { return getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM); } -::sw::mark::IFieldmark* SwCrsrShell::GetCurrentFieldmark() +::sw::mark::IFieldmark* SwCursorShell::GetCurrentFieldmark() { // TODO: Refactor - SwPosition pos(*GetCrsr()->GetPoint()); + SwPosition pos(*GetCursor()->GetPoint()); return getIDocumentMarkAccess()->getFieldmarkFor(pos); } -::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkAfter() +::sw::mark::IFieldmark* SwCursorShell::GetFieldmarkAfter() { - SwPosition pos(*GetCrsr()->GetPoint()); + SwPosition pos(*GetCursor()->GetPoint()); return getIDocumentMarkAccess()->getFieldmarkAfter(pos); } -::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkBefore() +::sw::mark::IFieldmark* SwCursorShell::GetFieldmarkBefore() { - SwPosition pos(*GetCrsr()->GetPoint()); + SwPosition pos(*GetCursor()->GetPoint()); return getIDocumentMarkAccess()->getFieldmarkBefore(pos); } -bool SwCrsrShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) +bool SwCursorShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { if(pMark==nullptr) return false; - // watch Crsr-Moves - CrsrStateHelper aCrsrSt(*this); - aCrsrSt.SetCrsrToMark(pMark); - ++aCrsrSt.m_pCrsr->GetPoint()->nContent; - --aCrsrSt.m_pCrsr->GetMark()->nContent; + // watch Cursor-Moves + CursorStateHelper aCursorSt(*this); + aCursorSt.SetCursorToMark(pMark); + ++aCursorSt.m_pCursor->GetPoint()->nContent; + --aCursorSt.m_pCursor->GetMark()->nContent; - if(aCrsrSt.RollbackIfIllegal()) return false; + if(aCursorSt.RollbackIfIllegal()) return false; - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 2ad23ba28c39..a3375beceeb0 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -78,19 +78,19 @@ using namespace util; void CheckRange( SwCursor* ); /** - * Check if pCurCrsr points into already existing ranges and delete those. + * Check if pCurrentCursor points into already existing ranges and delete those. * @param Pointer to SwCursor object */ -void CheckRange( SwCursor* pCurCrsr ) +void CheckRange( SwCursor* pCurrentCursor ) { - const SwPosition *pStt = pCurCrsr->Start(), - *pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint(); + const SwPosition *pStt = pCurrentCursor->Start(), + *pEnd = pCurrentCursor->GetPoint() == pStt ? pCurrentCursor->GetMark() : pCurrentCursor->GetPoint(); SwPaM *pTmpDel = nullptr, - *pTmp = pCurCrsr->GetNext(); + *pTmp = pCurrentCursor->GetNext(); // Search the complete ring - while( pTmp != pCurCrsr ) + while( pTmp != pCurrentCursor ) { const SwPosition *pTmpStt = pTmp->Start(), *pTmpEnd = pTmp->GetPoint() == pTmpStt ? @@ -105,7 +105,7 @@ void CheckRange( SwCursor* pCurCrsr ) if( *pStt < *pTmpEnd ) pTmpDel = pTmp; - // If Point or Mark is within the Crsr range, we need to remove the old + // If Point or Mark is within the Cursor range, we need to remove the old // range. Take note that Point does not belong to the range anymore. pTmp = pTmp->GetNext(); delete pTmpDel; // Remove old range @@ -113,24 +113,24 @@ void CheckRange( SwCursor* pCurCrsr ) } } -// SwCrsrShell +// SwCursorShell -SwPaM * SwCrsrShell::CreateCrsr() +SwPaM * SwCursorShell::CreateCursor() { - // don't create Crsr in a table Selection (sic!) + // don't create Cursor in a table Selection (sic!) OSL_ENSURE( !IsTableMode(), "in table Selection" ); // New cursor as copy of current one. Add to the ring. // Links point to previously created one, ie forward. - SwShellCrsr* pNew = new SwShellCrsr( *m_pCurCrsr ); + SwShellCursor* pNew = new SwShellCursor( *m_pCurrentCursor ); // Hide PaM logically, to avoid undoing the inverting from // copied PaM (#i75172#) - pNew->swapContent(*m_pCurCrsr); + pNew->swapContent(*m_pCurrentCursor); - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); - UpdateCrsr( SwCrsrShell::SCROLLWIN ); + UpdateCursor( SwCursorShell::SCROLLWIN ); return pNew; } @@ -139,20 +139,20 @@ SwPaM * SwCrsrShell::CreateCrsr() * Note, this function does not delete anything if there is no other cursor. * @return - returns true if there was another cursor and we deleted one. */ -bool SwCrsrShell::DestroyCrsr() +bool SwCursorShell::DestroyCursor() { - // don't delete Crsr within table selection + // don't delete Cursor within table selection OSL_ENSURE( !IsTableMode(), "in table Selection" ); // Is there a next one? Don't do anything if not. - if(!m_pCurCrsr->IsMultiSelection()) + if(!m_pCurrentCursor->IsMultiSelection()) return false; - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCursor* pNextCrsr = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); - delete m_pCurCrsr; - m_pCurCrsr = dynamic_cast<SwShellCrsr*>(pNextCrsr); - UpdateCrsr(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursor* pNextCursor = static_cast<SwCursor*>(m_pCurrentCursor->GetNext()); + delete m_pCurrentCursor; + m_pCurrentCursor = dynamic_cast<SwShellCursor*>(pNextCursor); + UpdateCursor(); return true; } @@ -161,87 +161,87 @@ bool SwCrsrShell::DestroyCrsr() * Simply returns the current shell cursor if there is no selection * (HasSelection()). */ -SwPaM & SwCrsrShell::CreateNewShellCursor() +SwPaM & SwCursorShell::CreateNewShellCursor() { if (HasSelection()) { - (void) CreateCrsr(); // n.b. returns old cursor + (void) CreateCursor(); // n.b. returns old cursor } - return *GetCrsr(); + return *GetCursor(); } /** * Return the current shell cursor * @return - returns current `SwPaM` shell cursor */ -SwPaM & SwCrsrShell::GetCurrentShellCursor() +SwPaM & SwCursorShell::GetCurrentShellCursor() { - return *GetCrsr(); + return *GetCursor(); } /** * Return pointer to the current shell cursor * @return - returns pointer to current `SwPaM` shell cursor */ -SwPaM* SwCrsrShell::GetCrsr( bool bMakeTableCrsr ) const +SwPaM* SwCursorShell::GetCursor( bool bMakeTableCursor ) const { - if( m_pTableCrsr ) + if( m_pTableCursor ) { - if( bMakeTableCrsr && m_pTableCrsr->IsCrsrMovedUpdate() ) + if( bMakeTableCursor && m_pTableCursor->IsCursorMovedUpdate() ) { //don't re-create 'parked' cursors const SwContentNode* pCNd; - if( m_pTableCrsr->GetPoint()->nNode.GetIndex() && - m_pTableCrsr->GetMark()->nNode.GetIndex() && - nullptr != ( pCNd = m_pTableCrsr->GetContentNode() ) && pCNd->getLayoutFrm( GetLayout() ) && - nullptr != ( pCNd = m_pTableCrsr->GetContentNode(false) ) && pCNd->getLayoutFrm( GetLayout() ) ) + if( m_pTableCursor->GetPoint()->nNode.GetIndex() && + m_pTableCursor->GetMark()->nNode.GetIndex() && + nullptr != ( pCNd = m_pTableCursor->GetContentNode() ) && pCNd->getLayoutFrame( GetLayout() ) && + nullptr != ( pCNd = m_pTableCursor->GetContentNode(false) ) && pCNd->getLayoutFrame( GetLayout() ) ) { - SwShellTableCrsr* pTC = m_pTableCrsr; - GetLayout()->MakeTableCrsrs( *pTC ); + SwShellTableCursor* pTC = m_pTableCursor; + GetLayout()->MakeTableCursors( *pTC ); } } - if( m_pTableCrsr->IsChgd() ) + if( m_pTableCursor->IsChgd() ) { - const_cast<SwCrsrShell*>(this)->m_pCurCrsr = - dynamic_cast<SwShellCrsr*>(m_pTableCrsr->MakeBoxSels( m_pCurCrsr )); + const_cast<SwCursorShell*>(this)->m_pCurrentCursor = + dynamic_cast<SwShellCursor*>(m_pTableCursor->MakeBoxSels( m_pCurrentCursor )); } } - return m_pCurCrsr; + return m_pCurrentCursor; } -void SwCrsrShell::StartAction() +void SwCursorShell::StartAction() { if( !ActionPend() ) { // save for update of the ribbon bar - const SwNode& rNd = m_pCurCrsr->GetPoint()->nNode.GetNode(); + const SwNode& rNd = m_pCurrentCursor->GetPoint()->nNode.GetNode(); m_nAktNode = rNd.GetIndex(); - m_nAktContent = m_pCurCrsr->GetPoint()->nContent.GetIndex(); + m_nAktContent = m_pCurrentCursor->GetPoint()->nContent.GetIndex(); m_nAktNdTyp = rNd.GetNodeType(); - m_bAktSelection = *m_pCurCrsr->GetPoint() != *m_pCurCrsr->GetMark(); + m_bAktSelection = *m_pCurrentCursor->GetPoint() != *m_pCurrentCursor->GetMark(); if( rNd.IsTextNode() ) - m_nLeftFrmPos = SwCallLink::getLayoutFrm( GetLayout(), const_cast<SwTextNode&>(*rNd.GetTextNode()), m_nAktContent, true ); + m_nLeftFramePos = SwCallLink::getLayoutFrame( GetLayout(), const_cast<SwTextNode&>(*rNd.GetTextNode()), m_nAktContent, true ); else - m_nLeftFrmPos = 0; + m_nLeftFramePos = 0; } SwViewShell::StartAction(); // to the SwViewShell } -void SwCrsrShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) +void SwCursorShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) { comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false)); - bool bVis = m_bSVCrsrVis; + bool bVis = m_bSVCursorVis; - sal_uInt16 eFlags = SwCrsrShell::CHKRANGE; + sal_uInt16 eFlags = SwCursorShell::CHKRANGE; if ( !DoSetPosX ) - eFlags |= SwCrsrShell::UPDOWN; + eFlags |= SwCursorShell::UPDOWN; // Idle-formatting? if( bIdleEnd && Imp()->GetRegion() ) { - m_pCurCrsr->Hide(); + m_pCurrentCursor->Hide(); } // Update all invalid numberings before the last action @@ -249,18 +249,18 @@ void SwCrsrShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) GetDoc()->UpdateNumRule(); // #i76923#: Don't show the cursor in the SwViewShell::EndAction() - call. - // Only the UpdateCrsr shows the cursor. - bool bSavSVCrsrVis = m_bSVCrsrVis; - m_bSVCrsrVis = false; + // Only the UpdateCursor shows the cursor. + bool bSavSVCursorVis = m_bSVCursorVis; + m_bSVCursorVis = false; SwViewShell::EndAction( bIdleEnd ); // have SwViewShell go first - m_bSVCrsrVis = bSavSVCrsrVis; + m_bSVCursorVis = bSavSVCursorVis; if( ActionPend() ) { if( bVis ) // display SV-Cursor again - m_pVisCrsr->Show(); + m_pVisibleCursor->Show(); // If there is still a ChgCall and just the "basic // parenthiszing(?) (Basic-Klammerung)" exists, call it. This @@ -270,13 +270,13 @@ void SwCrsrShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) { // Within a Basic action, one needs to update the cursor, // to e.g. create the table cursor. This is being done in - // UpdateCrsr. - UpdateCrsr( eFlags, bIdleEnd ); + // UpdateCursor. + UpdateCursor( eFlags, bIdleEnd ); { - // watch Crsr-Moves, call Link if needed, the DTOR is key here! + // watch Cursor-Moves, call Link if needed, the DTOR is key here! SwCallLink aLk( *this, m_nAktNode, m_nAktContent, (sal_uInt8)m_nAktNdTyp, - m_nLeftFrmPos, m_bAktSelection ); + m_nLeftFramePos, m_bAktSelection ); } if( m_bCallChgLnk && m_bChgCallFlag && m_aChgLnk.IsSet() ) @@ -289,21 +289,21 @@ void SwCrsrShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) } if ( !bIdleEnd ) - eFlags |= SwCrsrShell::SCROLLWIN; + eFlags |= SwCursorShell::SCROLLWIN; - UpdateCrsr( eFlags, bIdleEnd ); // Show Cursor changes + UpdateCursor( eFlags, bIdleEnd ); // Show Cursor changes { - SwCallLink aLk( *this ); // watch Crsr-Moves + SwCallLink aLk( *this ); // watch Cursor-Moves aLk.nNode = m_nAktNode; // call Link if needed aLk.nNdTyp = (sal_uInt8)m_nAktNdTyp; aLk.nContent = m_nAktContent; - aLk.nLeftFrmPos = m_nLeftFrmPos; + aLk.nLeftFramePos = m_nLeftFramePos; - if( !m_nCrsrMove || - ( 1 == m_nCrsrMove && m_bInCMvVisportChgd ) ) + if( !m_nCursorMove || + ( 1 == m_nCursorMove && m_bInCMvVisportChgd ) ) // display Cursor & Selektions again - ShowCrsrs( m_bSVCrsrVis ); + ShowCursors( m_bSVCursorVis ); } // call ChgCall if there is still one if( m_bCallChgLnk && m_bChgCallFlag && m_aChgLnk.IsSet() ) @@ -313,56 +313,56 @@ void SwCrsrShell::EndAction( const bool bIdleEnd, const bool DoSetPosX ) } } -void SwCrsrShell::SttCrsrMove() +void SwCursorShell::SttCursorMove() { #ifdef DBG_UTIL - OSL_ENSURE( m_nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." ); + OSL_ENSURE( m_nCursorMove < USHRT_MAX, "To many nested CursorMoves." ); #endif - ++m_nCrsrMove; + ++m_nCursorMove; StartAction(); } -void SwCrsrShell::EndCrsrMove( const bool bIdleEnd ) +void SwCursorShell::EndCursorMove( const bool bIdleEnd ) { #ifdef DBG_UTIL - OSL_ENSURE( m_nCrsrMove, "EndCrsrMove() without SttCrsrMove()." ); + OSL_ENSURE( m_nCursorMove, "EndCursorMove() without SttCursorMove()." ); #endif EndAction( bIdleEnd, true ); - --m_nCrsrMove; + --m_nCursorMove; #ifdef DBG_UTIL - if( !m_nCrsrMove ) + if( !m_nCursorMove ) m_bInCMvVisportChgd = false; #endif } -bool SwCrsrShell::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, +bool SwCursorShell::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, bool bVisualAllowed ) { if( IsTableMode() ) return bLeft ? GoPrevCell() : GoNextCell(); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed bool bRet = false; // #i27615# Handle cursor in front of label. const SwTextNode* pTextNd = nullptr; - if( m_pBlockCrsr ) - m_pBlockCrsr->clearPoints(); + if( m_pBlockCursor ) + m_pBlockCursor->clearPoints(); // 1. CASE: Cursor is in front of label. A move to the right // will simply reset the bInFrontOfLabel flag: - SwShellCrsr* pShellCrsr = getShellCrsr( true ); - if ( !bLeft && pShellCrsr->IsInFrontOfLabel() ) + SwShellCursor* pShellCursor = getShellCursor( true ); + if ( !bLeft && pShellCursor->IsInFrontOfLabel() ) { SetInFrontOfLabel( false ); bRet = true; } // 2. CASE: Cursor is at beginning of numbered paragraph. A move // to the left will simply set the bInFrontOfLabel flag: - else if ( bLeft && 0 == pShellCrsr->GetPoint()->nContent.GetIndex() && - !pShellCrsr->IsInFrontOfLabel() && !pShellCrsr->HasMark() && - nullptr != ( pTextNd = pShellCrsr->GetNode().GetTextNode() ) && + else if ( bLeft && 0 == pShellCursor->GetPoint()->nContent.GetIndex() && + !pShellCursor->IsInFrontOfLabel() && !pShellCursor->HasMark() && + nullptr != ( pTextNd = pShellCursor->GetNode().GetTextNode() ) && pTextNd->HasVisibleNumberingOrBullet() ) { SetInFrontOfLabel( true ); @@ -376,8 +376,8 @@ bool SwCrsrShell::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, // To avoid loop the reset of <bInFrontOfLabel> flag is no longer // reflected in the return value <bRet>. const bool bResetOfInFrontOfLabel = SetInFrontOfLabel( false ); - bRet = pShellCrsr->LeftRight( bLeft, nCnt, nMode, bVisualAllowed, - bSkipHidden, !IsOverwriteCrsr() ); + bRet = pShellCursor->LeftRight( bLeft, nCnt, nMode, bVisualAllowed, + bSkipHidden, !IsOverwriteCursor() ); if ( !bRet && bLeft && bResetOfInFrontOfLabel ) { // undo reset of <bInFrontOfLabel> flag @@ -387,13 +387,13 @@ bool SwCrsrShell::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, if( bRet ) { - UpdateCrsr(); + UpdateCursor(); } return bRet; } -void SwCrsrShell::MarkListLevel( const OUString& sListId, +void SwCursorShell::MarkListLevel( const OUString& sListId, const int nListLevel ) { if ( sListId != m_sMarkedListId || @@ -412,18 +412,18 @@ void SwCrsrShell::MarkListLevel( const OUString& sListId, } } -void SwCrsrShell::UpdateMarkedListLevel() +void SwCursorShell::UpdateMarkedListLevel() { - SwTextNode * pTextNd = _GetCrsr()->GetNode().GetTextNode(); + SwTextNode * pTextNd = _GetCursor()->GetNode().GetTextNode(); if ( pTextNd ) { if ( !pTextNd->IsNumbered() ) { - m_pCurCrsr->_SetInFrontOfLabel( false ); + m_pCurrentCursor->_SetInFrontOfLabel( false ); MarkListLevel( OUString(), 0 ); } - else if ( m_pCurCrsr->IsInFrontOfLabel() ) + else if ( m_pCurrentCursor->IsInFrontOfLabel() ) { if ( pTextNd->IsInList() ) { @@ -440,7 +440,7 @@ void SwCrsrShell::UpdateMarkedListLevel() } } -void SwCrsrShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage) +void SwCursorShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage) { #ifdef ACCESSIBLE_LAYOUT if( Imp()->IsAccessible() ) @@ -451,7 +451,7 @@ void SwCrsrShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage) #endif } -void SwCrsrShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn) +void SwCursorShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn) { #ifdef ACCESSIBLE_LAYOUT if( Imp()->IsAccessible() ) @@ -462,7 +462,7 @@ void SwCrsrShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewCo #endif } -void SwCrsrShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection) +void SwCursorShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection) { #ifdef ACCESSIBLE_LAYOUT if( Imp()->IsAccessible() ) @@ -473,24 +473,24 @@ void SwCrsrShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNew #endif } -bool SwCrsrShell::bColumnChange() +bool SwCursorShell::bColumnChange() { - SwFrm* pCurrFrm = GetCurrFrm(false); + SwFrame* pCurrFrame = GetCurrFrame(false); - if (pCurrFrm == nullptr) + if (pCurrFrame == nullptr) { return false; } - SwFrm* pCurrCol=static_cast<SwFrm*>(pCurrFrm)->FindColFrm(); + SwFrame* pCurrCol=static_cast<SwFrame*>(pCurrFrame)->FindColFrame(); - while(pCurrCol== nullptr && pCurrFrm!=nullptr ) + while(pCurrCol== nullptr && pCurrFrame!=nullptr ) { - SwLayoutFrm* pParent = pCurrFrm->GetUpper(); + SwLayoutFrame* pParent = pCurrFrame->GetUpper(); if(pParent!=nullptr) { - pCurrCol=static_cast<SwFrm*>(pParent)->FindColFrm(); - pCurrFrm = static_cast<SwFrm*>(pParent); + pCurrCol=static_cast<SwFrame*>(pParent)->FindColFrame(); + pCurrFrame = static_cast<SwFrame*>(pParent); } else { @@ -498,65 +498,65 @@ bool SwCrsrShell::bColumnChange() } } - if(m_oldColFrm == pCurrCol) + if(m_oldColFrame == pCurrCol) return false; else { - m_oldColFrm = pCurrCol; + m_oldColFrame = pCurrCol; return true; } } -bool SwCrsrShell::UpDown( bool bUp, sal_uInt16 nCnt ) +bool SwCursorShell::UpDown( bool bUp, sal_uInt16 nCnt ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed bool bTableMode = IsTableMode(); - SwShellCrsr* pTmpCrsr = getShellCrsr( true ); + SwShellCursor* pTmpCursor = getShellCursor( true ); - bool bRet = pTmpCrsr->UpDown( bUp, nCnt ); + bool bRet = pTmpCursor->UpDown( bUp, nCnt ); // #i40019# UpDown should always reset the bInFrontOfLabel flag: bRet |= SetInFrontOfLabel(false); - if( m_pBlockCrsr ) - m_pBlockCrsr->clearPoints(); + if( m_pBlockCursor ) + m_pBlockCursor->clearPoints(); if( bRet ) { - m_eMvState = MV_UPDOWN; // status for Crsr travelling - GetCrsrOfst + m_eMvState = MV_UPDOWN; // status for Cursor travelling - GetCursorOfst if( !ActionPend() ) { - CrsrFlag eUpdateMode = SwCrsrShell::SCROLLWIN; + CursorFlag eUpdateMode = SwCursorShell::SCROLLWIN; if( !bTableMode ) - eUpdateMode = (CrsrFlag) (eUpdateMode - | SwCrsrShell::UPDOWN | SwCrsrShell::CHKRANGE); - UpdateCrsr( static_cast<sal_uInt16>(eUpdateMode) ); + eUpdateMode = (CursorFlag) (eUpdateMode + | SwCursorShell::UPDOWN | SwCursorShell::CHKRANGE); + UpdateCursor( static_cast<sal_uInt16>(eUpdateMode) ); } } return bRet; } -bool SwCrsrShell::LRMargin( bool bLeft, bool bAPI) +bool SwCursorShell::LRMargin( bool bLeft, bool bAPI) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed SET_CURR_SHELL( this ); - m_eMvState = MV_LEFTMARGIN; // status for Crsr travelling - GetCrsrOfst + m_eMvState = MV_LEFTMARGIN; // status for Cursor travelling - GetCursorOfst const bool bTableMode = IsTableMode(); - SwShellCrsr* pTmpCrsr = getShellCrsr( true ); + SwShellCursor* pTmpCursor = getShellCursor( true ); - if( m_pBlockCrsr ) - m_pBlockCrsr->clearPoints(); + if( m_pBlockCursor ) + m_pBlockCursor->clearPoints(); const bool bWasAtLM = - ( 0 == _GetCrsr()->GetPoint()->nContent.GetIndex() ); + ( 0 == _GetCursor()->GetPoint()->nContent.GetIndex() ); - bool bRet = pTmpCrsr->LeftRightMargin( bLeft, bAPI ); + bool bRet = pTmpCursor->LeftRightMargin( bLeft, bAPI ); - if ( bLeft && !bTableMode && bRet && bWasAtLM && !_GetCrsr()->HasMark() ) + if ( bLeft && !bTableMode && bRet && bWasAtLM && !_GetCursor()->HasMark() ) { - const SwTextNode * pTextNd = _GetCrsr()->GetNode().GetTextNode(); + const SwTextNode * pTextNd = _GetCursor()->GetNode().GetTextNode(); if ( pTextNd && pTextNd->HasVisibleNumberingOrBullet() ) SetInFrontOfLabel( true ); } @@ -567,51 +567,51 @@ bool SwCrsrShell::LRMargin( bool bLeft, bool bAPI) if( bRet ) { - UpdateCrsr(); + UpdateCursor(); } return bRet; } -bool SwCrsrShell::IsAtLRMargin( bool bLeft, bool bAPI ) const +bool SwCursorShell::IsAtLRMargin( bool bLeft, bool bAPI ) const { - const SwShellCrsr* pTmpCrsr = getShellCrsr( true ); - return pTmpCrsr->IsAtLeftRightMargin( bLeft, bAPI ); + const SwShellCursor* pTmpCursor = getShellCursor( true ); + return pTmpCursor->IsAtLeftRightMargin( bLeft, bAPI ); } -bool SwCrsrShell::SttEndDoc( bool bStt ) +bool SwCursorShell::SttEndDoc( bool bStt ) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed - SwShellCrsr* pTmpCrsr = m_pBlockCrsr ? &m_pBlockCrsr->getShellCrsr() : m_pCurCrsr; - bool bRet = pTmpCrsr->SttEndDoc( bStt ); + SwShellCursor* pTmpCursor = m_pBlockCursor ? &m_pBlockCursor->getShellCursor() : m_pCurrentCursor; + bool bRet = pTmpCursor->SttEndDoc( bStt ); if( bRet ) { if( bStt ) - pTmpCrsr->GetPtPos().Y() = 0; // set to 0 explicitly (table header) - if( m_pBlockCrsr ) + pTmpCursor->GetPtPos().Y() = 0; // set to 0 explicitly (table header) + if( m_pBlockCursor ) { - m_pBlockCrsr->clearPoints(); + m_pBlockCursor->clearPoints(); RefreshBlockCursor(); } - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } -void SwCrsrShell::ExtendedSelectAll(bool bFootnotes) +void SwCursorShell::ExtendedSelectAll(bool bFootnotes) { SwNodes& rNodes = GetDoc()->GetNodes(); - SwPosition* pPos = m_pCurCrsr->GetPoint(); + SwPosition* pPos = m_pCurrentCursor->GetPoint(); pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext(); pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 ); - pPos = m_pCurCrsr->GetMark(); + pPos = m_pCurrentCursor->GetMark(); pPos->nNode = rNodes.GetEndOfContent(); SwContentNode* pCNd = SwNodes::GoPrevious( &pPos->nNode ); pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 ); } -bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes) +bool SwCursorShell::ExtendedSelectedAll(bool bFootnotes) { SwNodes& rNodes = GetDoc()->GetNodes(); SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext(); @@ -625,11 +625,11 @@ bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes) SwPosition aStart(*pStart, 0); SwPosition aEnd(*pEnd, pEnd->Len()); - SwShellCrsr* pShellCrsr = getShellCrsr(false); - return aStart == *pShellCrsr->Start() && aEnd == *pShellCrsr->End(); + SwShellCursor* pShellCursor = getShellCursor(false); + return aStart == *pShellCursor->Start() && aEnd == *pShellCursor->End(); } -bool SwCrsrShell::StartsWithTable() +bool SwCursorShell::StartsWithTable() { SwNodes& rNodes = GetDoc()->GetNodes(); SwNodeIndex nNode(rNodes.GetEndOfExtras()); @@ -637,117 +637,117 @@ bool SwCrsrShell::StartsWithTable() return pContentNode->FindTableNode(); } -bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) +bool SwCursorShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) { bool bRet = false; // never jump of section borders at selection - if( !m_pCurCrsr->HasMark() || !m_pCurCrsr->IsNoContent() ) + if( !m_pCurrentCursor->HasMark() || !m_pCurrentCursor->IsNoContent() ) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed SET_CURR_SHELL( this ); - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - Point& rPt = m_pCurCrsr->GetPtPos(); - SwContentFrm * pFrm = m_pCurCrsr->GetContentNode()-> - getLayoutFrm( GetLayout(), &rPt, m_pCurCrsr->GetPoint(), false ); - if( pFrm && ( bRet = GetFrmInPage( pFrm, fnWhichPage, - fnPosPage, m_pCurCrsr ) ) && - !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + Point& rPt = m_pCurrentCursor->GetPtPos(); + SwContentFrame * pFrame = m_pCurrentCursor->GetContentNode()-> + getLayoutFrame( GetLayout(), &rPt, m_pCurrentCursor->GetPoint(), false ); + if( pFrame && ( bRet = GetFrameInPage( pFrame, fnWhichPage, + fnPosPage, m_pCurrentCursor ) ) && + !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS )) - UpdateCrsr(); + UpdateCursor(); else bRet = false; } return bRet; } -bool SwCrsrShell::isInHiddenTextFrm(SwShellCrsr* pShellCrsr) +bool SwCursorShell::isInHiddenTextFrame(SwShellCursor* pShellCursor) { - SwContentNode *pCNode = pShellCrsr->GetContentNode(); - SwContentFrm *pFrm = pCNode ? - pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), false ) : nullptr; - return !pFrm || (pFrm->IsTextFrm() && static_cast<SwTextFrm*>(pFrm)->IsHiddenNow()); + SwContentNode *pCNode = pShellCursor->GetContentNode(); + SwContentFrame *pFrame = pCNode ? + pCNode->getLayoutFrame( GetLayout(), &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ) : nullptr; + return !pFrame || (pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsHiddenNow()); } -bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) +bool SwCursorShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - SwShellCrsr* pTmpCrsr = getShellCrsr( true ); - bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara ); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + SwShellCursor* pTmpCursor = getShellCursor( true ); + bool bRet = pTmpCursor->MovePara( fnWhichPara, fnPosPara ); if( bRet ) { //keep going until we get something visible, i.e. skip //over hidden paragraphs, don't get stuck at the start - //which is what SwCrsrShell::UpdateCrsrPos will reset + //which is what SwCursorShell::UpdateCursorPos will reset //the position to if we pass it a position in an //invisible hidden paragraph field - while (isInHiddenTextFrm(pTmpCrsr)) + while (isInHiddenTextFrame(pTmpCursor)) { - if (!pTmpCrsr->MovePara(fnWhichPara, fnPosPara)) + if (!pTmpCursor->MovePara(fnWhichPara, fnPosPara)) break; } - UpdateCrsr(); + UpdateCursor(); } return bRet; } -bool SwCrsrShell::MoveSection( SwWhichSection fnWhichSect, +bool SwCursorShell::MoveSection( SwWhichSection fnWhichSect, SwPosSection fnPosSect) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - SwCursor* pTmpCrsr = getShellCrsr( true ); - bool bRet = pTmpCrsr->MoveSection( fnWhichSect, fnPosSect ); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + SwCursor* pTmpCursor = getShellCursor( true ); + bool bRet = pTmpCursor->MoveSection( fnWhichSect, fnPosSect ); if( bRet ) - UpdateCrsr(); + UpdateCursor(); return bRet; } // position cursor -static SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) +static SwFrame* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) { - SwFrm* pFrm = nullptr; + SwFrame* pFrame = nullptr; SwContentNode* pCNd = rIdx.GetNode().GetContentNode(); if( pCNd ) { - SwContentFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, nullptr, false ); - pFrm = pCntFrm ? pCntFrm->GetUpper() : nullptr; - while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) - pFrm = pFrm->IsFlyFrm() ? static_cast<SwFlyFrm*>(pFrm)->AnchorFrm() - : pFrm->GetUpper(); + SwContentFrame *pContentFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, nullptr, false ); + pFrame = pContentFrame ? pContentFrame->GetUpper() : nullptr; + while( pFrame && !pFrame->IsHeaderFrame() && !pFrame->IsFooterFrame() ) + pFrame = pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->AnchorFrame() + : pFrame->GetUpper(); } - return pFrm; + return pFrame; } -bool SwCrsrShell::IsInHeaderFooter( bool* pbInHeader ) const +bool SwCursorShell::IsInHeaderFooter( bool* pbInHeader ) const { Point aPt; - SwFrm* pFrm = ::lcl_IsInHeaderFooter( m_pCurCrsr->GetPoint()->nNode, aPt ); - if( pFrm && pbInHeader ) - *pbInHeader = pFrm->IsHeaderFrm(); - return nullptr != pFrm; + SwFrame* pFrame = ::lcl_IsInHeaderFooter( m_pCurrentCursor->GetPoint()->nNode, aPt ); + if( pFrame && pbInHeader ) + *pbInHeader = pFrame->IsHeaderFrame(); + return nullptr != pFrame; } -int SwCrsrShell::SetCrsr( const Point &rLPt, bool bOnlyText, bool bBlock ) +int SwCursorShell::SetCursor( const Point &rLPt, bool bOnlyText, bool bBlock ) { SET_CURR_SHELL( this ); - SwShellCrsr* pCrsr = getShellCrsr( bBlock ); - SwPosition aPos( *pCrsr->GetPoint() ); + SwShellCursor* pCursor = getShellCursor( bBlock ); + SwPosition aPos( *pCursor->GetPoint() ); Point aPt( rLPt ); - Point & rAktCrsrPt = pCrsr->GetPtPos(); - SwCrsrMoveState aTmpState( IsTableMode() ? MV_TBLSEL : + Point & rAktCursorPt = pCursor->GetPtPos(); + SwCursorMoveState aTmpState( IsTableMode() ? MV_TBLSEL : bOnlyText ? MV_SETONLYTEXT : MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - SwTextNode * pTextNd = pCrsr->GetNode().GetTextNode(); + SwTextNode * pTextNd = pCursor->GetNode().GetTextNode(); if ( pTextNd && !IsTableMode() && // #i37515# No bInFrontOfLabel during selection - !pCrsr->HasMark() && + !pCursor->HasMark() && pTextNd->HasVisibleNumberingOrBullet() ) { aTmpState.m_bInFrontOfLabel = true; // #i27615# @@ -758,48 +758,48 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, bool bOnlyText, bool bBlock ) } int bRet = CRSR_POSOLD | - ( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) + ( GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ) ? 0 : CRSR_POSCHG ); const bool bOldInFrontOfLabel = IsInFrontOfLabel(); const bool bNewInFrontOfLabel = aTmpState.m_bInFrontOfLabel; - pCrsr->SetCrsrBidiLevel( aTmpState.m_nCursorBidiLevel ); + pCursor->SetCursorBidiLevel( aTmpState.m_nCursorBidiLevel ); if( MV_RIGHTMARGIN == aTmpState.m_eState ) m_eMvState = MV_RIGHTMARGIN; // is the new position in header or footer? - SwFrm* pFrm = lcl_IsInHeaderFooter( aPos.nNode, aPt ); - if( IsTableMode() && !pFrm && aPos.nNode.GetNode().StartOfSectionNode() == - pCrsr->GetPoint()->nNode.GetNode().StartOfSectionNode() ) + SwFrame* pFrame = lcl_IsInHeaderFooter( aPos.nNode, aPt ); + if( IsTableMode() && !pFrame && aPos.nNode.GetNode().StartOfSectionNode() == + pCursor->GetPoint()->nNode.GetNode().StartOfSectionNode() ) // same table column and not in header/footer -> back return bRet; - if( m_pBlockCrsr && bBlock ) + if( m_pBlockCursor && bBlock ) { - m_pBlockCrsr->setEndPoint( rLPt ); - if( !pCrsr->HasMark() ) - m_pBlockCrsr->setStartPoint( rLPt ); - else if( !m_pBlockCrsr->getStartPoint() ) - m_pBlockCrsr->setStartPoint( pCrsr->GetMkPos() ); + m_pBlockCursor->setEndPoint( rLPt ); + if( !pCursor->HasMark() ) + m_pBlockCursor->setStartPoint( rLPt ); + else if( !m_pBlockCursor->getStartPoint() ) + m_pBlockCursor->setStartPoint( pCursor->GetMkPos() ); } - if( !pCrsr->HasMark() ) + if( !pCursor->HasMark() ) { // is at the same position and if in header/footer -> in the same - if( aPos == *pCrsr->GetPoint() && + if( aPos == *pCursor->GetPoint() && bOldInFrontOfLabel == bNewInFrontOfLabel ) { - if( pFrm ) + if( pFrame ) { - if( pFrm->Frm().IsInside( rAktCrsrPt )) + if( pFrame->Frame().IsInside( rAktCursorPt )) return bRet; } else if( aPos.nNode.GetNode().IsContentNode() ) { // in the same frame? - SwFrm* pOld = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrm( + SwFrame* pOld = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrame( GetLayout(), &m_aCharRect.Pos(), nullptr, false ); - SwFrm* pNew = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrm( + SwFrame* pNew = static_cast<SwContentNode&>(aPos.nNode.GetNode()).getLayoutFrame( GetLayout(), &aPt, nullptr, false ); if( pNew == pOld ) return bRet; @@ -809,51 +809,51 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, bool bOnlyText, bool bBlock ) else { // SSelection over not allowed sections or if in header/footer -> different - if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, true ) - || ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) )) + if( !CheckNodesRange( aPos.nNode, pCursor->GetMark()->nNode, true ) + || ( pFrame && !pFrame->Frame().IsInside( pCursor->GetMkPos() ) )) return bRet; // is at same position but not in header/footer - if( aPos == *pCrsr->GetPoint() ) + if( aPos == *pCursor->GetPoint() ) return bRet; } - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + SwCursorSaveState aSaveState( *pCursor ); - *pCrsr->GetPoint() = aPos; - rAktCrsrPt = aPt; + *pCursor->GetPoint() = aPos; + rAktCursorPt = aPt; // #i41424# Only update the marked number levels if necessary // Force update of marked number levels if necessary. if ( bNewInFrontOfLabel || bOldInFrontOfLabel ) - m_pCurCrsr->_SetInFrontOfLabel( !bNewInFrontOfLabel ); + m_pCurrentCursor->_SetInFrontOfLabel( !bNewInFrontOfLabel ); SetInFrontOfLabel( bNewInFrontOfLabel ); - if( !pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) + if( !pCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) { - sal_uInt16 nFlag = SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE; - UpdateCrsr( nFlag ); + sal_uInt16 nFlag = SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE; + UpdateCursor( nFlag ); bRet &= ~CRSR_POSOLD; } - else if( bOnlyText && !m_pCurCrsr->HasMark() ) + else if( bOnlyText && !m_pCurrentCursor->HasMark() ) { if( FindValidContentNode( bOnlyText ) ) { // position cursor in a valid content - if( aPos == *pCrsr->GetPoint() ) + if( aPos == *pCursor->GetPoint() ) bRet = CRSR_POSOLD; else { - UpdateCrsr(); + UpdateCursor(); bRet &= ~CRSR_POSOLD; } } else { // there is no valid content -> hide cursor - m_pVisCrsr->Hide(); // always hide visible cursor - m_eMvState = MV_NONE; // status for Crsr travelling + m_pVisibleCursor->Hide(); // always hide visible cursor + m_eMvState = MV_NONE; // status for Cursor travelling m_bAllProtect = true; if( GetDoc()->GetDocShell() ) { @@ -865,87 +865,87 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, bool bOnlyText, bool bBlock ) return bRet; } -void SwCrsrShell::TableCrsrToCursor() +void SwCursorShell::TableCursorToCursor() { - OSL_ENSURE( m_pTableCrsr, "TableCrsrToCursor: Why?" ); - delete m_pTableCrsr, m_pTableCrsr = nullptr; + OSL_ENSURE( m_pTableCursor, "TableCursorToCursor: Why?" ); + delete m_pTableCursor, m_pTableCursor = nullptr; } -void SwCrsrShell::BlockCrsrToCrsr() +void SwCursorShell::BlockCursorToCursor() { - OSL_ENSURE( m_pBlockCrsr, "BlockCrsrToCrsr: Why?" ); - if( m_pBlockCrsr && !HasSelection() ) + OSL_ENSURE( m_pBlockCursor, "BlockCursorToCursor: Why?" ); + if( m_pBlockCursor && !HasSelection() ) { - SwPaM& rPam = m_pBlockCrsr->getShellCrsr(); - m_pCurCrsr->SetMark(); - *m_pCurCrsr->GetPoint() = *rPam.GetPoint(); + SwPaM& rPam = m_pBlockCursor->getShellCursor(); + m_pCurrentCursor->SetMark(); + *m_pCurrentCursor->GetPoint() = *rPam.GetPoint(); if( rPam.HasMark() ) - *m_pCurCrsr->GetMark() = *rPam.GetMark(); + *m_pCurrentCursor->GetMark() = *rPam.GetMark(); else - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); } - delete m_pBlockCrsr, m_pBlockCrsr = nullptr; + delete m_pBlockCursor, m_pBlockCursor = nullptr; } -void SwCrsrShell::CrsrToBlockCrsr() +void SwCursorShell::CursorToBlockCursor() { - if( !m_pBlockCrsr ) + if( !m_pBlockCursor ) { - SwPosition aPos( *m_pCurCrsr->GetPoint() ); - m_pBlockCrsr = new SwBlockCursor( *this, aPos ); - SwShellCrsr &rBlock = m_pBlockCrsr->getShellCrsr(); - rBlock.GetPtPos() = m_pCurCrsr->GetPtPos(); - if( m_pCurCrsr->HasMark() ) + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); + m_pBlockCursor = new SwBlockCursor( *this, aPos ); + SwShellCursor &rBlock = m_pBlockCursor->getShellCursor(); + rBlock.GetPtPos() = m_pCurrentCursor->GetPtPos(); + if( m_pCurrentCursor->HasMark() ) { rBlock.SetMark(); - *rBlock.GetMark() = *m_pCurCrsr->GetMark(); - rBlock.GetMkPos() = m_pCurCrsr->GetMkPos(); + *rBlock.GetMark() = *m_pCurrentCursor->GetMark(); + rBlock.GetMkPos() = m_pCurrentCursor->GetMkPos(); } } - m_pBlockCrsr->clearPoints(); + m_pBlockCursor->clearPoints(); RefreshBlockCursor(); } -void SwCrsrShell::ClearMark() +void SwCursorShell::ClearMark() { // is there any GetMark? - if( m_pTableCrsr ) + if( m_pTableCursor ) { - std::vector<SwPaM*> vCrsrs; - for(auto& rCrsr : m_pCurCrsr->GetRingContainer()) - if(&rCrsr != m_pCurCrsr) - vCrsrs.push_back(&rCrsr); - for(auto pCrsr : vCrsrs) - delete pCrsr; - m_pTableCrsr->DeleteMark(); + std::vector<SwPaM*> vCursors; + for(auto& rCursor : m_pCurrentCursor->GetRingContainer()) + if(&rCursor != m_pCurrentCursor) + vCursors.push_back(&rCursor); + for(auto pCursor : vCursors) + delete pCursor; + m_pTableCursor->DeleteMark(); - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); - *m_pCurCrsr->GetPoint() = *m_pTableCrsr->GetPoint(); - m_pCurCrsr->GetPtPos() = m_pTableCrsr->GetPtPos(); - delete m_pTableCrsr, m_pTableCrsr = nullptr; - m_pCurCrsr->SwSelPaintRects::Show(); + *m_pCurrentCursor->GetPoint() = *m_pTableCursor->GetPoint(); + m_pCurrentCursor->GetPtPos() = m_pTableCursor->GetPtPos(); + delete m_pTableCursor, m_pTableCursor = nullptr; + m_pCurrentCursor->SwSelPaintRects::Show(); } else { - if( !m_pCurCrsr->HasMark() ) + if( !m_pCurrentCursor->HasMark() ) return; - m_pCurCrsr->DeleteMark(); - if( !m_nCrsrMove ) - m_pCurCrsr->SwSelPaintRects::Show(); + m_pCurrentCursor->DeleteMark(); + if( !m_nCursorMove ) + m_pCurrentCursor->SwSelPaintRects::Show(); } } -void SwCrsrShell::NormalizePam(bool bPointFirst) +void SwCursorShell::NormalizePam(bool bPointFirst) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - m_pCurCrsr->Normalize(bPointFirst); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + m_pCurrentCursor->Normalize(bPointFirst); } -void SwCrsrShell::SwapPam() +void SwCursorShell::SwapPam() { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - m_pCurCrsr->Exchange(); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + m_pCurrentCursor->Exchange(); } //TODO: provide documentation @@ -959,7 +959,7 @@ void SwCrsrShell::SwapPam() @param bTstOnly Should I only do a test run? If true so do not move cursor. @param bTstHit ??? */ -bool SwCrsrShell::ChgCurrPam( +bool SwCursorShell::ChgCurrPam( const Point & rPt, bool bTstOnly, bool bTstHit ) @@ -967,98 +967,98 @@ bool SwCrsrShell::ChgCurrPam( SET_CURR_SHELL( this ); // check if the SPoint is in a table selection - if( bTstOnly && m_pTableCrsr ) - return m_pTableCrsr->IsInside( rPt ); + if( bTstOnly && m_pTableCursor ) + return m_pTableCursor->IsInside( rPt ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed // search position <rPt> in document - SwPosition aPtPos( *m_pCurCrsr->GetPoint() ); + SwPosition aPtPos( *m_pCurrentCursor->GetPoint() ); Point aPt( rPt ); - SwCrsrMoveState aTmpState( MV_NONE ); + SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - if ( !GetLayout()->GetCrsrOfst( &aPtPos, aPt, &aTmpState ) && bTstHit ) + if ( !GetLayout()->GetCursorOfst( &aPtPos, aPt, &aTmpState ) && bTstHit ) return false; // search in all selections for this position - SwShellCrsr* pCmp = m_pCurCrsr; // keep the pointer on cursor + SwShellCursor* pCmp = m_pCurrentCursor; // keep the pointer on cursor do { if( pCmp && pCmp->HasMark() && *pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos ) { - if( bTstOnly || m_pCurCrsr == pCmp ) // is the current + if( bTstOnly || m_pCurrentCursor == pCmp ) // is the current return true; // return without update - m_pCurCrsr = pCmp; - UpdateCrsr(); // cursor is already at the right position + m_pCurrentCursor = pCmp; + UpdateCursor(); // cursor is already at the right position return true; } - } while( m_pCurCrsr != - ( pCmp = dynamic_cast<SwShellCrsr*>(pCmp->GetNext()) ) ); + } while( m_pCurrentCursor != + ( pCmp = dynamic_cast<SwShellCursor*>(pCmp->GetNext()) ) ); return false; } -void SwCrsrShell::KillPams() +void SwCursorShell::KillPams() { // Does any exist for deletion? - if( !m_pTableCrsr && !m_pBlockCrsr && !m_pCurCrsr->IsMultiSelection() ) + if( !m_pTableCursor && !m_pBlockCursor && !m_pCurrentCursor->IsMultiSelection() ) return; - while( m_pCurCrsr->GetNext() != m_pCurCrsr ) - delete m_pCurCrsr->GetNext(); - m_pCurCrsr->SetColumnSelection( false ); + while( m_pCurrentCursor->GetNext() != m_pCurrentCursor ) + delete m_pCurrentCursor->GetNext(); + m_pCurrentCursor->SetColumnSelection( false ); - if( m_pTableCrsr ) + if( m_pTableCursor ) { // delete the ring of cursors - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = *m_pTableCrsr->GetPoint(); - m_pCurCrsr->GetPtPos() = m_pTableCrsr->GetPtPos(); - delete m_pTableCrsr; - m_pTableCrsr = nullptr; + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = *m_pTableCursor->GetPoint(); + m_pCurrentCursor->GetPtPos() = m_pTableCursor->GetPtPos(); + delete m_pTableCursor; + m_pTableCursor = nullptr; } - else if( m_pBlockCrsr ) + else if( m_pBlockCursor ) { // delete the ring of cursors - m_pCurCrsr->DeleteMark(); - SwShellCrsr &rBlock = m_pBlockCrsr->getShellCrsr(); - *m_pCurCrsr->GetPoint() = *rBlock.GetPoint(); - m_pCurCrsr->GetPtPos() = rBlock.GetPtPos(); + m_pCurrentCursor->DeleteMark(); + SwShellCursor &rBlock = m_pBlockCursor->getShellCursor(); + *m_pCurrentCursor->GetPoint() = *rBlock.GetPoint(); + m_pCurrentCursor->GetPtPos() = rBlock.GetPtPos(); rBlock.DeleteMark(); - m_pBlockCrsr->clearPoints(); + m_pBlockCursor->clearPoints(); } - UpdateCrsr( SwCrsrShell::SCROLLWIN ); + UpdateCursor( SwCursorShell::SCROLLWIN ); } -int SwCrsrShell::CompareCursor( CrsrCompareType eType ) const +int SwCursorShell::CompareCursor( CursorCompareType eType ) const { int nRet = 0; const SwPosition *pFirst = nullptr, *pSecond = nullptr; - const SwPaM *pCur = GetCrsr(), *pStk = m_pCrsrStk; + const SwPaM *pCur = GetCursor(), *pStack = m_pCursorStack; // cursor on stack is needed if we compare against stack - if( pStk || ( eType == CurrPtCurrMk ) ) + if( pStack || ( eType == CurrPtCurrMk ) ) { switch ( eType) { case StackPtStackMk: - pFirst = pStk->GetPoint(); - pSecond = pStk->GetMark(); + pFirst = pStack->GetPoint(); + pSecond = pStack->GetMark(); break; case StackPtCurrPt: - pFirst = pStk->GetPoint(); + pFirst = pStack->GetPoint(); pSecond = pCur->GetPoint(); break; case StackPtCurrMk: - pFirst = pStk->GetPoint(); + pFirst = pStack->GetPoint(); pSecond = pCur->GetMark(); break; case StackMkCurrPt: - pFirst = pStk->GetMark(); + pFirst = pStack->GetMark(); pSecond = pCur->GetPoint(); break; case StackMkCurrMk: - pFirst = pStk->GetMark(); - pSecond = pStk->GetMark(); + pFirst = pStack->GetMark(); + pSecond = pStack->GetMark(); break; case CurrPtCurrMk: pFirst = pCur->GetPoint(); @@ -1077,19 +1077,19 @@ int SwCrsrShell::CompareCursor( CrsrCompareType eType ) const return nRet; } -bool SwCrsrShell::IsSttPara() const -{ return m_pCurCrsr->GetPoint()->nContent == 0; } +bool SwCursorShell::IsSttPara() const +{ return m_pCurrentCursor->GetPoint()->nContent == 0; } -bool SwCrsrShell::IsEndPara() const -{ return m_pCurCrsr->GetPoint()->nContent == m_pCurCrsr->GetContentNode()->Len(); } +bool SwCursorShell::IsEndPara() const +{ return m_pCurrentCursor->GetPoint()->nContent == m_pCurrentCursor->GetContentNode()->Len(); } -bool SwCrsrShell::IsEndOfTable() const +bool SwCursorShell::IsEndOfTable() const { if (IsTableMode() || IsBlockMode() || !IsEndPara()) { return false; } - SwTableNode const*const pTableNode( IsCrsrInTable() ); + SwTableNode const*const pTableNode( IsCursorInTable() ); if (!pTableNode) { return false; @@ -1098,122 +1098,122 @@ bool SwCrsrShell::IsEndOfTable() const SwNodeIndex const lastNode(*pEndTableNode, -2); SAL_WARN_IF(!lastNode.GetNode().GetTextNode(), "sw.core", "text node expected"); - return (lastNode == m_pCurCrsr->GetPoint()->nNode); + return (lastNode == m_pCurrentCursor->GetPoint()->nNode); } -bool SwCrsrShell::IsInFrontOfLabel() const +bool SwCursorShell::IsInFrontOfLabel() const { - return m_pCurCrsr->IsInFrontOfLabel(); + return m_pCurrentCursor->IsInFrontOfLabel(); } -bool SwCrsrShell::SetInFrontOfLabel( bool bNew ) +bool SwCursorShell::SetInFrontOfLabel( bool bNew ) { if ( bNew != IsInFrontOfLabel() ) { - m_pCurCrsr->_SetInFrontOfLabel( bNew ); + m_pCurrentCursor->_SetInFrontOfLabel( bNew ); UpdateMarkedListLevel(); return true; } return false; } -bool SwCrsrShell::GotoPage( sal_uInt16 nPage ) +bool SwCursorShell::GotoPage( sal_uInt16 nPage ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - bool bRet = GetLayout()->SetCurrPage( m_pCurCrsr, nPage ) && - !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + bool bRet = GetLayout()->SetCurrPage( m_pCurrentCursor, nPage ) && + !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return bRet; } -bool SwCrsrShell::GetCharRectAt(SwRect& rRect, const SwPosition* pPos) +bool SwCursorShell::GetCharRectAt(SwRect& rRect, const SwPosition* pPos) { - SwContentFrm* pFrm = GetCurrFrm(); - return pFrm->GetCharRect( rRect, *pPos ); + SwContentFrame* pFrame = GetCurrFrame(); + return pFrame->GetCharRect( rRect, *pPos ); } -void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, - bool bAtCrsrPos, const bool bCalcFrm ) +void SwCursorShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, + bool bAtCursorPos, const bool bCalcFrame ) { SET_CURR_SHELL( this ); // page number: first visible page or the one at the cursor - const SwContentFrm* pCFrm; - const SwPageFrm *pPg = nullptr; + const SwContentFrame* pCFrame; + const SwPageFrame *pPg = nullptr; - if( !bAtCrsrPos || nullptr == (pCFrm = GetCurrFrm( bCalcFrm )) || - nullptr == (pPg = pCFrm->FindPageFrm()) ) + if( !bAtCursorPos || nullptr == (pCFrame = GetCurrFrame( bCalcFrame )) || + nullptr == (pPg = pCFrame->FindPageFrame()) ) { pPg = Imp()->GetFirstVisPage(GetOut()); while( pPg && pPg->IsEmptyPage() ) - pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); + pPg = static_cast<const SwPageFrame *>(pPg->GetNext()); } // pPg has to exist with a default of 1 for the special case "Writerstart" rnPhyNum = pPg? pPg->GetPhyPageNum() : 1; rnVirtNum = pPg? pPg->GetVirtPageNum() : 1; } -sal_uInt16 SwCrsrShell::GetNextPrevPageNum( bool bNext ) +sal_uInt16 SwCursorShell::GetNextPrevPageNum( bool bNext ) { SET_CURR_SHELL( this ); // page number: first visible page or the one at the cursor - const SwPageFrm *pPg = Imp()->GetFirstVisPage(GetOut()); + const SwPageFrame *pPg = Imp()->GetFirstVisPage(GetOut()); if( pPg ) { - const SwTwips nPageTop = pPg->Frm().Top(); + const SwTwips nPageTop = pPg->Frame().Top(); if( bNext ) { // go to next view layout row: do { - pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); + pPg = static_cast<const SwPageFrame *>(pPg->GetNext()); } - while( pPg && pPg->Frm().Top() == nPageTop ); + while( pPg && pPg->Frame().Top() == nPageTop ); while( pPg && pPg->IsEmptyPage() ) - pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); + pPg = static_cast<const SwPageFrame *>(pPg->GetNext()); } else { // go to previous view layout row: do { - pPg = static_cast<const SwPageFrm *>(pPg->GetPrev()); + pPg = static_cast<const SwPageFrame *>(pPg->GetPrev()); } - while( pPg && pPg->Frm().Top() == nPageTop ); + while( pPg && pPg->Frame().Top() == nPageTop ); while( pPg && pPg->IsEmptyPage() ) - pPg = static_cast<const SwPageFrm *>(pPg->GetPrev()); + pPg = static_cast<const SwPageFrame *>(pPg->GetPrev()); } } // pPg has to exist with a default of 1 for the special case "Writerstart" return pPg ? pPg->GetPhyPageNum() : USHRT_MAX; } -sal_uInt16 SwCrsrShell::GetPageCnt() +sal_uInt16 SwCursorShell::GetPageCnt() { SET_CURR_SHELL( this ); // return number of pages return GetLayout()->GetPageNum(); } -OUString SwCrsrShell::getPageRectangles() +OUString SwCursorShell::getPageRectangles() { CurrShell aCurr(this); - SwRootFrm* pLayout = GetLayout(); + SwRootFrame* pLayout = GetLayout(); std::vector<OString> v; - for (const SwFrm* pFrm = pLayout->GetLower(); pFrm; pFrm = pFrm->GetNext()) + for (const SwFrame* pFrame = pLayout->GetLower(); pFrame; pFrame = pFrame->GetNext()) { std::vector<OString> aRectangle { - OString::number(pFrm->Frm().Left()), - OString::number(pFrm->Frm().Top()), - OString::number(pFrm->Frm().Width()), - OString::number(pFrm->Frm().Height()) + OString::number(pFrame->Frame().Left()), + OString::number(pFrame->Frame().Top()), + OString::number(pFrame->Frame().Width()), + OString::number(pFrame->Frame().Height()) }; v.push_back(comphelper::string::join(", ", aRectangle)); } @@ -1221,44 +1221,44 @@ OUString SwCrsrShell::getPageRectangles() } /// go to the next SSelection -bool SwCrsrShell::GoNextCrsr() +bool SwCursorShell::GoNextCursor() { - if( !m_pCurCrsr->IsMultiSelection() ) + if( !m_pCurrentCursor->IsMultiSelection() ) return false; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - m_pCurCrsr = dynamic_cast<SwShellCrsr*>(m_pCurCrsr->GetNext()); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + m_pCurrentCursor = dynamic_cast<SwShellCursor*>(m_pCurrentCursor->GetNext()); // #i24086#: show also all others if( !ActionPend() ) { - UpdateCrsr(); - m_pCurCrsr->Show(); + UpdateCursor(); + m_pCurrentCursor->Show(); } return true; } /// go to the previous SSelection -bool SwCrsrShell::GoPrevCrsr() +bool SwCursorShell::GoPrevCursor() { - if( !m_pCurCrsr->IsMultiSelection() ) + if( !m_pCurrentCursor->IsMultiSelection() ) return false; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - m_pCurCrsr = dynamic_cast<SwShellCrsr*>(m_pCurCrsr->GetPrev()); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + m_pCurrentCursor = dynamic_cast<SwShellCursor*>(m_pCurrentCursor->GetPrev()); // #i24086#: show also all others if( !ActionPend() ) { - UpdateCrsr(); - m_pCurCrsr->Show(); + UpdateCursor(); + m_pCurrentCursor->Show(); } return true; } -void SwCrsrShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect) +void SwCursorShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect) { comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false)); SET_CURR_SHELL( this ); @@ -1268,27 +1268,27 @@ void SwCrsrShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRe bool bVis = false; // if a cursor is visible then hide the SV cursor - if( m_pVisCrsr->IsVisible() && !aRect.IsOver( m_aCharRect ) ) + if( m_pVisibleCursor->IsVisible() && !aRect.IsOver( m_aCharRect ) ) { bVis = true; - m_pVisCrsr->Hide(); + m_pVisibleCursor->Hide(); } // re-paint area SwViewShell::Paint(rRenderContext, rRect); - if( m_bHasFocus && !m_bBasicHideCrsr ) + if( m_bHasFocus && !m_bBasicHideCursor ) { - SwShellCrsr* pAktCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; + SwShellCursor* pAktCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; if( !ActionPend() ) { // so that right/bottom borders will not be cropped - pAktCrsr->Invalidate( VisArea() ); - pAktCrsr->Show(); + pAktCursor->Invalidate( VisArea() ); + pAktCursor->Show(); } else - pAktCrsr->Invalidate( aRect ); + pAktCursor->Invalidate( aRect ); } @@ -1300,18 +1300,18 @@ void SwCrsrShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRe bVis = !pPostItMgr->HasActiveSidebarWin(); } - if( m_bSVCrsrVis && bVis ) // also show SV cursor again - m_pVisCrsr->Show(); + if( m_bSVCursorVis && bVis ) // also show SV cursor again + m_pVisibleCursor->Show(); } -void SwCrsrShell::VisPortChgd( const SwRect & rRect ) +void SwCursorShell::VisPortChgd( const SwRect & rRect ) { SET_CURR_SHELL( this ); bool bVis; // switch off all cursors when scrolling // if a cursor is visible then hide the SV cursor - if( ( bVis = m_pVisCrsr->IsVisible() ) ) - m_pVisCrsr->Hide(); + if( ( bVis = m_pVisibleCursor->IsVisible() ) ) + m_pVisibleCursor->Hide(); m_bVisPortChgd = true; m_aOldRBPos.setX(VisArea().Right()); @@ -1322,10 +1322,10 @@ void SwCrsrShell::VisPortChgd( const SwRect & rRect ) // During painting no selections should be shown, thus the call is encapsulated. <- TODO: old artefact? SwViewShell::VisPortChgd( rRect ); // move area - if( m_bSVCrsrVis && bVis ) // show SV cursor again - m_pVisCrsr->Show(); + if( m_bSVCursorVis && bVis ) // show SV cursor again + m_pVisibleCursor->Show(); - if( m_nCrsrMove ) + if( m_nCursorMove ) m_bInCMvVisportChgd = true; m_bVisPortChgd = false; @@ -1337,24 +1337,24 @@ void SwCrsrShell::VisPortChgd( const SwRect & rRect ) deleting a border). The new position is calculated from its current position in the layout. */ -void SwCrsrShell::UpdateCrsrPos() +void SwCursorShell::UpdateCursorPos() { SET_CURR_SHELL( this ); ++mnStartAction; - SwShellCrsr* pShellCrsr = getShellCrsr( true ); + SwShellCursor* pShellCursor = getShellCursor( true ); Size aOldSz( GetDocSize() ); - if( isInHiddenTextFrm(pShellCrsr) ) + if( isInHiddenTextFrame(pShellCursor) ) { - SwCrsrMoveState aTmpState( MV_NONE ); + SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - GetLayout()->GetCrsrOfst( pShellCrsr->GetPoint(), pShellCrsr->GetPtPos(), + GetLayout()->GetCursorOfst( pShellCursor->GetPoint(), pShellCursor->GetPtPos(), &aTmpState ); - pShellCrsr->DeleteMark(); + pShellCursor->DeleteMark(); } IGrammarContact *pGrammarContact = GetDoc() ? GetDoc()->getGrammarContact() : nullptr; if( pGrammarContact ) - pGrammarContact->updateCursorPosition( *m_pCurCrsr->GetPoint() ); + pGrammarContact->updateCursorPosition( *m_pCurrentCursor->GetPoint() ); --mnStartAction; if( aOldSz != GetDocSize() ) SizeChgNotify(); @@ -1368,9 +1368,9 @@ static bool lcl_CheckHiddenSection( SwNodeIndex& rIdx ) if( pSectNd && pSectNd->GetSection().IsHiddenFlag() ) { SwNodeIndex aTmp( *pSectNd ); - const SwNode* pFrmNd = - rIdx.GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() ); - bOk = pFrmNd != nullptr; + const SwNode* pFrameNd = + rIdx.GetNodes().FindPrvNxtFrameNode( aTmp, pSectNd->EndOfSectionNode() ); + bOk = pFrameNd != nullptr; SAL_WARN_IF(!bOk, "sw", "found no Node with Frames"); rIdx = aTmp; } @@ -1400,29 +1400,29 @@ static void lcl_CheckHiddenPara( SwPosition& rPos ) class SwNotifyAccAboutInvalidTextSelections { private: - SwCrsrShell& mrCrsrSh; + SwCursorShell& mrCursorSh; public: - explicit SwNotifyAccAboutInvalidTextSelections( SwCrsrShell& _rCrsrSh ) - : mrCrsrSh( _rCrsrSh ) + explicit SwNotifyAccAboutInvalidTextSelections( SwCursorShell& _rCursorSh ) + : mrCursorSh( _rCursorSh ) {} ~SwNotifyAccAboutInvalidTextSelections() { - mrCrsrSh.InvalidateAccessibleParaTextSelection(); + mrCursorSh.InvalidateAccessibleParaTextSelection(); } }; -void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) +void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { SET_CURR_SHELL( this ); - ClearUpCrsrs(); + ClearUpCursors(); // In a BasicAction the cursor must be updated, e.g. to create the - // TableCursor. EndAction now calls UpdateCrsr! + // TableCursor. EndAction now calls UpdateCursor! if( ActionPend() && BasicActionPend() ) { - if ( eFlags & SwCrsrShell::READONLY ) + if ( eFlags & SwCursorShell::READONLY ) m_bIgnoreReadonly = true; return; // if not then no update } @@ -1432,70 +1432,70 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) if ( m_bIgnoreReadonly ) { m_bIgnoreReadonly = false; - eFlags |= SwCrsrShell::READONLY; + eFlags |= SwCursorShell::READONLY; } - if( eFlags & SwCrsrShell::CHKRANGE ) // check all cursor moves for - CheckRange( m_pCurCrsr ); // overlapping ranges + if( eFlags & SwCursorShell::CHKRANGE ) // check all cursor moves for + CheckRange( m_pCurrentCursor ); // overlapping ranges if( !bIdleEnd ) CheckTableBoxContent(); // If the current cursor is in a table and point/mark in different boxes, - // then the table mode is active (also if it is already active: m_pTableCrsr) - SwPaM* pTstCrsr = getShellCrsr( true ); - if( pTstCrsr->HasMark() && !m_pBlockCrsr && - mpDoc->IsIdxInTable( pTstCrsr->GetPoint()->nNode ) && - ( m_pTableCrsr || - pTstCrsr->GetNode().StartOfSectionNode() != - pTstCrsr->GetNode( false ).StartOfSectionNode() ) && !mbSelectAll) - { - SwShellCrsr* pITmpCrsr = getShellCrsr( true ); - Point aTmpPt( pITmpCrsr->GetPtPos() ); - Point aTmpMk( pITmpCrsr->GetMkPos() ); - SwPosition* pPos = pITmpCrsr->GetPoint(); + // then the table mode is active (also if it is already active: m_pTableCursor) + SwPaM* pTstCursor = getShellCursor( true ); + if( pTstCursor->HasMark() && !m_pBlockCursor && + mpDoc->IsIdxInTable( pTstCursor->GetPoint()->nNode ) && + ( m_pTableCursor || + pTstCursor->GetNode().StartOfSectionNode() != + pTstCursor->GetNode( false ).StartOfSectionNode() ) && !mbSelectAll) + { + SwShellCursor* pITmpCursor = getShellCursor( true ); + Point aTmpPt( pITmpCursor->GetPtPos() ); + Point aTmpMk( pITmpCursor->GetMkPos() ); + SwPosition* pPos = pITmpCursor->GetPoint(); // Bug 65475 (1999) - if Point/Mark in hidden sections, move them out lcl_CheckHiddenSection( pPos->nNode ); - lcl_CheckHiddenSection( pITmpCrsr->GetMark()->nNode ); + lcl_CheckHiddenSection( pITmpCursor->GetMark()->nNode ); // Move cursor out of hidden paragraphs if ( !GetViewOptions()->IsShowHiddenChar() ) { lcl_CheckHiddenPara( *pPos ); - lcl_CheckHiddenPara( *pITmpCrsr->GetMark() ); + lcl_CheckHiddenPara( *pITmpCursor->GetMark() ); } - SwContentFrm *pTableFrm = pPos->nNode.GetNode().GetContentNode()-> - getLayoutFrm( GetLayout(), &aTmpPt, pPos, false ); + SwContentFrame *pTableFrame = pPos->nNode.GetNode().GetContentNode()-> + getLayoutFrame( GetLayout(), &aTmpPt, pPos, false ); - OSL_ENSURE( pTableFrm, "Tabelle Crsr nicht im Content ??" ); + OSL_ENSURE( pTableFrame, "Tabelle Cursor nicht im Content ??" ); // --> Make code robust. The table cursor may point // to a table in a currently inactive header. - SwTabFrm *pTab = pTableFrm ? pTableFrm->FindTabFrm() : nullptr; + SwTabFrame *pTab = pTableFrame ? pTableFrame->FindTabFrame() : nullptr; if ( pTab && pTab->GetTable()->GetRowsToRepeat() > 0 ) { // First check if point is in repeated headline: - bool bInRepeatedHeadline = pTab->IsFollow() && pTab->IsInHeadline( *pTableFrm ); + bool bInRepeatedHeadline = pTab->IsFollow() && pTab->IsInHeadline( *pTableFrame ); // Second check if mark is in repeated headline: if ( !bInRepeatedHeadline ) { - SwContentFrm* pMarkTableFrm = pITmpCrsr->GetContentNode( false )-> - getLayoutFrm( GetLayout(), &aTmpMk, pITmpCrsr->GetMark(), false ); - OSL_ENSURE( pMarkTableFrm, "Tabelle Crsr nicht im Content ??" ); + SwContentFrame* pMarkTableFrame = pITmpCursor->GetContentNode( false )-> + getLayoutFrame( GetLayout(), &aTmpMk, pITmpCursor->GetMark(), false ); + OSL_ENSURE( pMarkTableFrame, "Tabelle Cursor nicht im Content ??" ); - if ( pMarkTableFrm ) + if ( pMarkTableFrame ) { - SwTabFrm* pMarkTab = pMarkTableFrm->FindTabFrm(); - OSL_ENSURE( pMarkTab, "Tabelle Crsr nicht im Content ??" ); + SwTabFrame* pMarkTab = pMarkTableFrame->FindTabFrame(); + OSL_ENSURE( pMarkTab, "Tabelle Cursor nicht im Content ??" ); // Make code robust: if ( pMarkTab ) { - bInRepeatedHeadline = pMarkTab->IsFollow() && pMarkTab->IsInHeadline( *pMarkTableFrm ); + bInRepeatedHeadline = pMarkTab->IsFollow() && pMarkTab->IsInHeadline( *pMarkTableFrame ); } } } @@ -1503,40 +1503,40 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) // No table cursor in repeated headlines: if ( bInRepeatedHeadline ) { - pTableFrm = nullptr; + pTableFrame = nullptr; - SwPosSection fnPosSect = *pPos < *pITmpCrsr->GetMark() + SwPosSection fnPosSect = *pPos < *pITmpCursor->GetMark() ? fnSectionStart : fnSectionEnd; // then only select inside the Box - if( m_pTableCrsr ) + if( m_pTableCursor ) { - m_pCurCrsr->SetMark(); - *m_pCurCrsr->GetMark() = *m_pTableCrsr->GetMark(); - m_pCurCrsr->GetMkPos() = m_pTableCrsr->GetMkPos(); - m_pTableCrsr->DeleteMark(); - m_pTableCrsr->SwSelPaintRects::Hide(); + m_pCurrentCursor->SetMark(); + *m_pCurrentCursor->GetMark() = *m_pTableCursor->GetMark(); + m_pCurrentCursor->GetMkPos() = m_pTableCursor->GetMkPos(); + m_pTableCursor->DeleteMark(); + m_pTableCursor->SwSelPaintRects::Hide(); } - *m_pCurCrsr->GetPoint() = *m_pCurCrsr->GetMark(); - (*fnSectionCurr)( *m_pCurCrsr, fnPosSect ); + *m_pCurrentCursor->GetPoint() = *m_pCurrentCursor->GetMark(); + (*fnSectionCurr)( *m_pCurrentCursor, fnPosSect ); } } // we really want a table selection - if( pTab && pTableFrm ) + if( pTab && pTableFrame ) { - if( !m_pTableCrsr ) + if( !m_pTableCursor ) { - m_pTableCrsr = new SwShellTableCrsr( *this, - *m_pCurCrsr->GetMark(), m_pCurCrsr->GetMkPos(), + m_pTableCursor = new SwShellTableCursor( *this, + *m_pCurrentCursor->GetMark(), m_pCurrentCursor->GetMkPos(), *pPos, aTmpPt ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SwSelPaintRects::Hide(); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SwSelPaintRects::Hide(); CheckTableBoxContent(); - if(!m_pTableCrsr) + if(!m_pTableCursor) { SAL_WARN("sw", "fdo#74854: " "this should not happen, but better lose the selection " @@ -1545,76 +1545,76 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) } } - SwCrsrMoveState aTmpState( MV_NONE ); + SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bRealHeight = true; - if( !pTableFrm->GetCharRect( m_aCharRect, *m_pTableCrsr->GetPoint(), &aTmpState ) ) + if( !pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint(), &aTmpState ) ) { Point aCentrPt( m_aCharRect.Center() ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - pTableFrm->GetCrsrOfst( m_pTableCrsr->GetPoint(), aCentrPt, &aTmpState ); + pTableFrame->GetCursorOfst( m_pTableCursor->GetPoint(), aCentrPt, &aTmpState ); bool const bResult = - pTableFrm->GetCharRect( m_aCharRect, *m_pTableCrsr->GetPoint() ); + pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint() ); OSL_ENSURE( bResult, "GetCharRect failed." ); (void) bResult; // non-debug: unused } - m_pVisCrsr->Hide(); // always hide visible Cursor + m_pVisibleCursor->Hide(); // always hide visible Cursor // scroll Cursor to visible area - if( (eFlags & SwCrsrShell::SCROLLWIN) && - (HasSelection() || eFlags & SwCrsrShell::READONLY || - !IsCrsrReadonly()) ) + if( (eFlags & SwCursorShell::SCROLLWIN) && + (HasSelection() || eFlags & SwCursorShell::READONLY || + !IsCursorReadonly()) ) { - SwFrm* pBoxFrm = pTableFrm; - while( pBoxFrm && !pBoxFrm->IsCellFrm() ) - pBoxFrm = pBoxFrm->GetUpper(); - if( pBoxFrm && pBoxFrm->Frm().HasArea() ) - MakeVisible( pBoxFrm->Frm() ); + SwFrame* pBoxFrame = pTableFrame; + while( pBoxFrame && !pBoxFrame->IsCellFrame() ) + pBoxFrame = pBoxFrame->GetUpper(); + if( pBoxFrame && pBoxFrame->Frame().HasArea() ) + MakeVisible( pBoxFrame->Frame() ); else MakeVisible( m_aCharRect ); } // let Layout create the Cursors in the Boxes - if( m_pTableCrsr->IsCrsrMovedUpdate() ) - GetLayout()->MakeTableCrsrs( *m_pTableCrsr ); - if( m_bHasFocus && !m_bBasicHideCrsr ) - m_pTableCrsr->Show(); + if( m_pTableCursor->IsCursorMovedUpdate() ) + GetLayout()->MakeTableCursors( *m_pTableCursor ); + if( m_bHasFocus && !m_bBasicHideCursor ) + m_pTableCursor->Show(); // set Cursor-Points to the new Positions - m_pTableCrsr->GetPtPos().setX(m_aCharRect.Left()); - m_pTableCrsr->GetPtPos().setY(m_aCharRect.Top()); + m_pTableCursor->GetPtPos().setX(m_aCharRect.Left()); + m_pTableCursor->GetPtPos().setY(m_aCharRect.Top()); - if( m_bSVCrsrVis ) + if( m_bSVCursorVis ) { - m_aCrsrHeight.setX(0); - m_aCrsrHeight.setY(aTmpState.m_aRealHeight.getY() < 0 ? + m_aCursorHeight.setX(0); + m_aCursorHeight.setY(aTmpState.m_aRealHeight.getY() < 0 ? -m_aCharRect.Width() : m_aCharRect.Height()); - m_pVisCrsr->Show(); // show again + m_pVisibleCursor->Show(); // show again } - m_eMvState = MV_NONE; // state for cursor travelling - GetCrsrOfst - if( pTableFrm && Imp()->IsAccessible() ) - Imp()->InvalidateAccessibleCursorPosition( pTableFrm ); + m_eMvState = MV_NONE; // state for cursor travelling - GetCursorOfst + if( pTableFrame && Imp()->IsAccessible() ) + Imp()->InvalidateAccessibleCursorPosition( pTableFrame ); return; } } - if( m_pTableCrsr ) + if( m_pTableCursor ) { // delete Ring - while( m_pCurCrsr->GetNext() != m_pCurCrsr ) - delete m_pCurCrsr->GetNext(); - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = *m_pTableCrsr->GetPoint(); - m_pCurCrsr->GetPtPos() = m_pTableCrsr->GetPtPos(); - delete m_pTableCrsr, m_pTableCrsr = nullptr; + while( m_pCurrentCursor->GetNext() != m_pCurrentCursor ) + delete m_pCurrentCursor->GetNext(); + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = *m_pTableCursor->GetPoint(); + m_pCurrentCursor->GetPtPos() = m_pTableCursor->GetPtPos(); + delete m_pTableCursor, m_pTableCursor = nullptr; } - m_pVisCrsr->Hide(); // always hide visible Cursor + m_pVisibleCursor->Hide(); // always hide visible Cursor // are we perhaps in a protected / hidden Section ? { - SwShellCrsr* pShellCrsr = getShellCrsr( true ); + SwShellCursor* pShellCursor = getShellCursor( true ); bool bChgState = true; - const SwSectionNode* pSectNd = pShellCrsr->GetNode().FindSectionNode(); + const SwSectionNode* pSectNd = pShellCursor->GetNode().FindSectionNode(); if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() || ( !IsReadOnlyAvailable() && pSectNd->GetSection().IsProtectFlag() && @@ -1654,14 +1654,14 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) } } - UpdateCrsrPos(); + UpdateCursorPos(); // The cursor must always point into content; there's some code // that relies on this. (E.g. in SwEditShell::GetScriptType, which always // loops _behind_ the last node in the selection, which always works if you // are in content.) To achieve this, we'll force cursor(s) to point into - // content, if UpdateCrsrPos() hasn't already done so. - for(SwPaM& rCmp : m_pCurCrsr->GetRingContainer()) + // content, if UpdateCursorPos() hasn't already done so. + for(SwPaM& rCmp : m_pCurrentCursor->GetRingContainer()) { // start will move forwards, end will move backwards bool bPointIsStart = ( rCmp.Start() == rCmp.GetPoint() ); @@ -1686,33 +1686,33 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) SwRect aOld( m_aCharRect ); bool bFirst = true; - SwContentFrm *pFrm; + SwContentFrame *pFrame; int nLoopCnt = 100; - SwShellCrsr* pShellCrsr = getShellCrsr( true ); + SwShellCursor* pShellCursor = getShellCursor( true ); do { bool bAgainst; do { bAgainst = false; - pFrm = pShellCrsr->GetContentNode()->getLayoutFrm( GetLayout(), - &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), false ); - // if the Frm doesn't exist anymore, the complete Layout has to be - // created, because there used to be a Frm here! - if ( !pFrm ) + pFrame = pShellCursor->GetContentNode()->getLayoutFrame( GetLayout(), + &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ); + // if the Frame doesn't exist anymore, the complete Layout has to be + // created, because there used to be a Frame here! + if ( !pFrame ) { do { CalcLayout(); - pFrm = pShellCrsr->GetContentNode()->getLayoutFrm( GetLayout(), - &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), false ); - } while( !pFrm ); + pFrame = pShellCursor->GetContentNode()->getLayoutFrame( GetLayout(), + &pShellCursor->GetPtPos(), pShellCursor->GetPoint(), false ); + } while( !pFrame ); } else if ( Imp()->IsIdleAction() ) // Guarantee everything's properly formatted - pFrm->PrepareCrsr(); + pFrame->PrepareCursor(); // In protected Fly? but ignore in case of frame selection - if( !IsReadOnlyAvailable() && pFrm->IsProtected() && + if( !IsReadOnlyAvailable() && pFrame->IsProtected() && ( !Imp()->GetDrawView() || !Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() ) && (!mpDoc->GetDocShell() || @@ -1750,40 +1750,40 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) CallChgLnk(); // notify UI! } m_bAllProtect = false; - bAgainst = true; // look for the right Frm again + bAgainst = true; // look for the right Frame again } } } while( bAgainst ); - SwCrsrMoveState aTmpState( m_eMvState ); + SwCursorMoveState aTmpState( m_eMvState ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); aTmpState.m_bRealHeight = true; - aTmpState.m_bRealWidth = IsOverwriteCrsr(); - aTmpState.m_nCursorBidiLevel = pShellCrsr->GetCrsrBidiLevel(); + aTmpState.m_bRealWidth = IsOverwriteCursor(); + aTmpState.m_nCursorBidiLevel = pShellCursor->GetCursorBidiLevel(); // #i27615#,#i30453# SwSpecialPos aSpecialPos; aSpecialPos.nExtendRange = SwSPExtendRange::BEFORE; - if (pShellCrsr->IsInFrontOfLabel()) + if (pShellCursor->IsInFrontOfLabel()) { aTmpState.m_pSpecialPos = &aSpecialPos; } ++mnStartAction; // tdf#91602 prevent recursive Action! - if( !pFrm->GetCharRect( m_aCharRect, *pShellCrsr->GetPoint(), &aTmpState ) ) + if( !pFrame->GetCharRect( m_aCharRect, *pShellCursor->GetPoint(), &aTmpState ) ) { - Point& rPt = pShellCrsr->GetPtPos(); + Point& rPt = pShellCursor->GetPtPos(); rPt = m_aCharRect.Center(); - pFrm->GetCrsrOfst( pShellCrsr->GetPoint(), rPt, &aTmpState ); + pFrame->GetCursorOfst( pShellCursor->GetPoint(), rPt, &aTmpState ); } --mnStartAction; - if( !pShellCrsr->HasMark() ) - m_aCrsrHeight = aTmpState.m_aRealHeight; + if( !pShellCursor->HasMark() ) + m_aCursorHeight = aTmpState.m_aRealHeight; else { - m_aCrsrHeight.setX(0); - m_aCrsrHeight.setY(aTmpState.m_aRealHeight.getY() < 0 ? + m_aCursorHeight.setX(0); + m_aCursorHeight.setY(aTmpState.m_aRealHeight.getY() < 0 ? -m_aCharRect.Width() : m_aCharRect.Height()); } @@ -1802,64 +1802,64 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) bFirst = false; // update cursor Points to the new Positions - pShellCrsr->GetPtPos().setX(m_aCharRect.Left()); - pShellCrsr->GetPtPos().setY(m_aCharRect.Top()); + pShellCursor->GetPtPos().setX(m_aCharRect.Left()); + pShellCursor->GetPtPos().setY(m_aCharRect.Top()); - if( !(eFlags & SwCrsrShell::UPDOWN )) // delete old Pos. of Up/Down + if( !(eFlags & SwCursorShell::UPDOWN )) // delete old Pos. of Up/Down { - pFrm->Calc(GetOut()); - m_nUpDownX = pFrm->IsVertical() ? - m_aCharRect.Top() - pFrm->Frm().Top() : - m_aCharRect.Left() - pFrm->Frm().Left(); + pFrame->Calc(GetOut()); + m_nUpDownX = pFrame->IsVertical() ? + m_aCharRect.Top() - pFrame->Frame().Top() : + m_aCharRect.Left() - pFrame->Frame().Left(); } // scroll Cursor to visible area - if( m_bHasFocus && eFlags & SwCrsrShell::SCROLLWIN && - (HasSelection() || eFlags & SwCrsrShell::READONLY || - !IsCrsrReadonly() || GetViewOptions()->IsSelectionInReadonly()) ) + if( m_bHasFocus && eFlags & SwCursorShell::SCROLLWIN && + (HasSelection() || eFlags & SwCursorShell::READONLY || + !IsCursorReadonly() || GetViewOptions()->IsSelectionInReadonly()) ) { // in case of scrolling this EndAction doesn't show the SV cursor // again, thus save and reset the flag here - bool bSav = m_bSVCrsrVis; - m_bSVCrsrVis = false; + bool bSav = m_bSVCursorVis; + m_bSVCursorVis = false; MakeSelVisible(); - m_bSVCrsrVis = bSav; + m_bSVCursorVis = bSav; } - } while( eFlags & SwCrsrShell::SCROLLWIN ); + } while( eFlags & SwCursorShell::SCROLLWIN ); - if( m_pBlockCrsr ) + if( m_pBlockCursor ) RefreshBlockCursor(); - if( !bIdleEnd && m_bHasFocus && !m_bBasicHideCrsr ) + if( !bIdleEnd && m_bHasFocus && !m_bBasicHideCursor ) { - if( m_pTableCrsr ) - m_pTableCrsr->SwSelPaintRects::Show(); + if( m_pTableCursor ) + m_pTableCursor->SwSelPaintRects::Show(); else { - m_pCurCrsr->SwSelPaintRects::Show(); - if( m_pBlockCrsr ) + m_pCurrentCursor->SwSelPaintRects::Show(); + if( m_pBlockCursor ) { - SwShellCrsr* pNxt = dynamic_cast<SwShellCrsr*>(m_pCurCrsr->GetNext()); - while( pNxt && pNxt != m_pCurCrsr ) + SwShellCursor* pNxt = dynamic_cast<SwShellCursor*>(m_pCurrentCursor->GetNext()); + while( pNxt && pNxt != m_pCurrentCursor ) { pNxt->SwSelPaintRects::Show(); - pNxt = dynamic_cast<SwShellCrsr*>(pNxt->GetNext()); + pNxt = dynamic_cast<SwShellCursor*>(pNxt->GetNext()); } } } } - m_eMvState = MV_NONE; // state for cursor tavelling - GetCrsrOfst + m_eMvState = MV_NONE; // state for cursor tavelling - GetCursorOfst - if( pFrm && Imp()->IsAccessible() ) - Imp()->InvalidateAccessibleCursorPosition( pFrm ); + if( pFrame && Imp()->IsAccessible() ) + Imp()->InvalidateAccessibleCursorPosition( pFrame ); // switch from blinking cursor to read-only-text-selection cursor const sal_uInt64 nBlinkTime = GetOut()->GetSettings().GetStyleSettings(). GetCursorBlinkTime(); - if ( (IsCrsrReadonly() && GetViewOptions()->IsSelectionInReadonly()) == + if ( (IsCursorReadonly() && GetViewOptions()->IsSelectionInReadonly()) == ( nBlinkTime != STYLE_CURSOR_NOBLINKTIME ) ) { // non blinking cursor in read only - text selection mode @@ -1873,195 +1873,195 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) GetOut()->SetSettings( aSettings ); } - if( m_bSVCrsrVis ) - m_pVisCrsr->Show(); // show again + if( m_bSVCursorVis ) + m_pVisibleCursor->Show(); // show again } -void SwCrsrShell::RefreshBlockCursor() +void SwCursorShell::RefreshBlockCursor() { - OSL_ENSURE( m_pBlockCrsr, "Don't call me without a block cursor" ); - SwShellCrsr &rBlock = m_pBlockCrsr->getShellCrsr(); + OSL_ENSURE( m_pBlockCursor, "Don't call me without a block cursor" ); + SwShellCursor &rBlock = m_pBlockCursor->getShellCursor(); Point aPt = rBlock.GetPtPos(); - SwContentFrm* pFrm = rBlock.GetContentNode()->getLayoutFrm( GetLayout(), &aPt, rBlock.GetPoint(), false ); + SwContentFrame* pFrame = rBlock.GetContentNode()->getLayoutFrame( GetLayout(), &aPt, rBlock.GetPoint(), false ); Point aMk; - if( m_pBlockCrsr->getEndPoint() && m_pBlockCrsr->getStartPoint() ) + if( m_pBlockCursor->getEndPoint() && m_pBlockCursor->getStartPoint() ) { - aPt = *m_pBlockCrsr->getStartPoint(); - aMk = *m_pBlockCrsr->getEndPoint(); + aPt = *m_pBlockCursor->getStartPoint(); + aMk = *m_pBlockCursor->getEndPoint(); } else { aPt = rBlock.GetPtPos(); - if( pFrm ) + if( pFrame ) { - if( pFrm->IsVertical() ) - aPt.setY(pFrm->Frm().Top() + GetUpDownX()); + if( pFrame->IsVertical() ) + aPt.setY(pFrame->Frame().Top() + GetUpDownX()); else - aPt.setX(pFrm->Frm().Left() + GetUpDownX()); + aPt.setX(pFrame->Frame().Left() + GetUpDownX()); } aMk = rBlock.GetMkPos(); } SwRect aRect( aMk, aPt ); aRect.Justify(); - SwSelectionList aSelList( pFrm ); + SwSelectionList aSelList( pFrame ); if( GetLayout()->FillSelection( aSelList, aRect ) ) { - SwCursor* pNxt = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); - while( pNxt != m_pCurCrsr ) + SwCursor* pNxt = static_cast<SwCursor*>(m_pCurrentCursor->GetNext()); + while( pNxt != m_pCurrentCursor ) { delete pNxt; - pNxt = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); + pNxt = static_cast<SwCursor*>(m_pCurrentCursor->GetNext()); } std::list<SwPaM*>::iterator pStart = aSelList.getStart(); std::list<SwPaM*>::iterator pPam = aSelList.getEnd(); OSL_ENSURE( pPam != pStart, "FillSelection should deliver at least one PaM" ); - m_pCurCrsr->SetMark(); + m_pCurrentCursor->SetMark(); --pPam; // If there is only one text portion inside the rectangle, a simple // selection is created if( pPam == pStart ) { - *m_pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); + *m_pCurrentCursor->GetPoint() = *(*pPam)->GetPoint(); if( (*pPam)->HasMark() ) - *m_pCurCrsr->GetMark() = *(*pPam)->GetMark(); + *m_pCurrentCursor->GetMark() = *(*pPam)->GetMark(); else - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); delete *pPam; - m_pCurCrsr->SetColumnSelection( false ); + m_pCurrentCursor->SetColumnSelection( false ); } else { // The order of the SwSelectionList has to be preserved but - // the order inside the ring created by CreateCrsr() is not like + // the order inside the ring created by CreateCursor() is not like // expected => First create the selections before the last one // downto the first selection. // At least create the cursor for the last selection --pPam; - *m_pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-1 (if n == number of selections) + *m_pCurrentCursor->GetPoint() = *(*pPam)->GetPoint(); // n-1 (if n == number of selections) if( (*pPam)->HasMark() ) - *m_pCurCrsr->GetMark() = *(*pPam)->GetMark(); + *m_pCurrentCursor->GetMark() = *(*pPam)->GetMark(); else - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); delete *pPam; - m_pCurCrsr->SetColumnSelection( true ); + m_pCurrentCursor->SetColumnSelection( true ); while( pPam != pStart ) { --pPam; - SwShellCrsr* pNew = new SwShellCrsr( *m_pCurCrsr ); - pNew->insert( pNew->begin(), m_pCurCrsr->begin(), m_pCurCrsr->end()); - m_pCurCrsr->clear(); - m_pCurCrsr->DeleteMark(); + SwShellCursor* pNew = new SwShellCursor( *m_pCurrentCursor ); + pNew->insert( pNew->begin(), m_pCurrentCursor->begin(), m_pCurrentCursor->end()); + m_pCurrentCursor->clear(); + m_pCurrentCursor->DeleteMark(); - *m_pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1 + *m_pCurrentCursor->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1 if( (*pPam)->HasMark() ) { - m_pCurCrsr->SetMark(); - *m_pCurCrsr->GetMark() = *(*pPam)->GetMark(); + m_pCurrentCursor->SetMark(); + *m_pCurrentCursor->GetMark() = *(*pPam)->GetMark(); } else - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SetColumnSelection( true ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SetColumnSelection( true ); delete *pPam; } { - SwShellCrsr* pNew = new SwShellCrsr( *m_pCurCrsr ); - pNew->insert( pNew->begin(), m_pCurCrsr->begin(), m_pCurCrsr->end() ); - m_pCurCrsr->clear(); - m_pCurCrsr->DeleteMark(); + SwShellCursor* pNew = new SwShellCursor( *m_pCurrentCursor ); + pNew->insert( pNew->begin(), m_pCurrentCursor->begin(), m_pCurrentCursor->end() ); + m_pCurrentCursor->clear(); + m_pCurrentCursor->DeleteMark(); } pPam = aSelList.getEnd(); --pPam; - *m_pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n, the last selection + *m_pCurrentCursor->GetPoint() = *(*pPam)->GetPoint(); // n, the last selection if( (*pPam)->HasMark() ) { - m_pCurCrsr->SetMark(); - *m_pCurCrsr->GetMark() = *(*pPam)->GetMark(); + m_pCurrentCursor->SetMark(); + *m_pCurrentCursor->GetMark() = *(*pPam)->GetMark(); } else - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SetColumnSelection( true ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SetColumnSelection( true ); delete *pPam; } } } /// create a copy of the cursor and save it in the stack -void SwCrsrShell::Push() +void SwCursorShell::Push() { // fdo#60513: if we have a table cursor, copy that; else copy current. - // This seems to work because UpdateCrsr() will fix this up on Pop(), - // then MakeBoxSels() will re-create the current m_pCurCrsr cell ring. - SwShellCrsr *const pCurrent((m_pTableCrsr) ? m_pTableCrsr : m_pCurCrsr); - m_pCrsrStk = new SwShellCrsr( *this, *pCurrent->GetPoint(), - pCurrent->GetPtPos(), m_pCrsrStk ); + // This seems to work because UpdateCursor() will fix this up on Pop(), + // then MakeBoxSels() will re-create the current m_pCurrentCursor cell ring. + SwShellCursor *const pCurrent((m_pTableCursor) ? m_pTableCursor : m_pCurrentCursor); + m_pCursorStack = new SwShellCursor( *this, *pCurrent->GetPoint(), + pCurrent->GetPtPos(), m_pCursorStack ); if (pCurrent->HasMark()) { - m_pCrsrStk->SetMark(); - *m_pCrsrStk->GetMark() = *pCurrent->GetMark(); + m_pCursorStack->SetMark(); + *m_pCursorStack->GetMark() = *pCurrent->GetMark(); } } /** delete cursor - @param bOldCrsr If <true> so delete from stack, if <false> delete current + @param bOldCursor If <true> so delete from stack, if <false> delete current and assign the one from stack as the new current cursor. @return <true> if there was one on the stack, <false> otherwise */ -bool SwCrsrShell::Pop( bool bOldCrsr ) +bool SwCursorShell::Pop( bool bOldCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed // are there any left? - if( nullptr == m_pCrsrStk ) + if( nullptr == m_pCursorStack ) return false; - SwShellCrsr *pTmp = nullptr, *pOldStk = m_pCrsrStk; + SwShellCursor *pTmp = nullptr, *pOldStack = m_pCursorStack; // the successor becomes the current one - if( m_pCrsrStk->GetNext() != m_pCrsrStk ) + if( m_pCursorStack->GetNext() != m_pCursorStack ) { - pTmp = dynamic_cast<SwShellCrsr*>(m_pCrsrStk->GetNext()); + pTmp = dynamic_cast<SwShellCursor*>(m_pCursorStack->GetNext()); } - if( bOldCrsr ) // delete from stack - delete m_pCrsrStk; + if( bOldCursor ) // delete from stack + delete m_pCursorStack; - m_pCrsrStk = pTmp; // assign new one + m_pCursorStack = pTmp; // assign new one - if( !bOldCrsr ) + if( !bOldCursor ) { - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCursorSaveState aSaveState( *m_pCurrentCursor ); // If the visible SSelection was not changed - const Point& rPoint = pOldStk->GetPtPos(); - if (rPoint == m_pCurCrsr->GetPtPos() || rPoint == m_pCurCrsr->GetMkPos()) + const Point& rPoint = pOldStack->GetPtPos(); + if (rPoint == m_pCurrentCursor->GetPtPos() || rPoint == m_pCurrentCursor->GetMkPos()) { // move "Selections Rectangles" - m_pCurCrsr->insert( m_pCurCrsr->begin(), pOldStk->begin(), pOldStk->end() ); - pOldStk->clear(); + m_pCurrentCursor->insert( m_pCurrentCursor->begin(), pOldStack->begin(), pOldStack->end() ); + pOldStack->clear(); } - if( pOldStk->HasMark() ) + if( pOldStack->HasMark() ) { - m_pCurCrsr->SetMark(); - *m_pCurCrsr->GetMark() = *pOldStk->GetMark(); - m_pCurCrsr->GetMkPos() = pOldStk->GetMkPos(); + m_pCurrentCursor->SetMark(); + *m_pCurrentCursor->GetMark() = *pOldStack->GetMark(); + m_pCurrentCursor->GetMkPos() = pOldStack->GetMkPos(); } else // no selection so revoke old one and set to old position - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = *pOldStk->GetPoint(); - m_pCurCrsr->GetPtPos() = pOldStk->GetPtPos(); - delete pOldStk; + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = *pOldStack->GetPoint(); + m_pCurrentCursor->GetPtPos() = pOldStack->GetPtPos(); + delete pOldStack; - if( !m_pCurCrsr->IsInProtectTable( true ) && - !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | + if( !m_pCurrentCursor->IsInProtectTable( true ) && + !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) - UpdateCrsr(); // update current cursor + UpdateCursor(); // update current cursor } return true; } @@ -2070,75 +2070,75 @@ bool SwCrsrShell::Pop( bool bOldCrsr ) Delete topmost from stack and use its GetMark in the current. */ -void SwCrsrShell::Combine() +void SwCursorShell::Combine() { // any others left? - if( nullptr == m_pCrsrStk ) + if( nullptr == m_pCursorStack ) return; - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed // rhbz#689053: IsSelOvr must restore the saved stack position, not the // current one, because current point + stack mark may be invalid PaM - SwCrsrSaveState aSaveState(*m_pCrsrStk); + SwCursorSaveState aSaveState(*m_pCursorStack); // stack cursor & current cursor in same Section? - assert(!m_pCrsrStk->HasMark() || - CheckNodesRange(m_pCrsrStk->GetMark()->nNode, - m_pCurCrsr->GetPoint()->nNode, true)); - *m_pCrsrStk->GetPoint() = *m_pCurCrsr->GetPoint(); - m_pCrsrStk->GetPtPos() = m_pCurCrsr->GetPtPos(); - - SwShellCrsr * pTmp = nullptr; - if( m_pCrsrStk->GetNext() != m_pCrsrStk ) - { - pTmp = dynamic_cast<SwShellCrsr*>(m_pCrsrStk->GetNext()); - } - delete m_pCurCrsr; - m_pCurCrsr = m_pCrsrStk; - m_pCrsrStk->MoveTo(nullptr); // remove from ring - m_pCrsrStk = pTmp; - if( !m_pCurCrsr->IsInProtectTable( true ) && - !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | + assert(!m_pCursorStack->HasMark() || + CheckNodesRange(m_pCursorStack->GetMark()->nNode, + m_pCurrentCursor->GetPoint()->nNode, true)); + *m_pCursorStack->GetPoint() = *m_pCurrentCursor->GetPoint(); + m_pCursorStack->GetPtPos() = m_pCurrentCursor->GetPtPos(); + + SwShellCursor * pTmp = nullptr; + if( m_pCursorStack->GetNext() != m_pCursorStack ) + { + pTmp = dynamic_cast<SwShellCursor*>(m_pCursorStack->GetNext()); + } + delete m_pCurrentCursor; + m_pCurrentCursor = m_pCursorStack; + m_pCursorStack->MoveTo(nullptr); // remove from ring + m_pCursorStack = pTmp; + if( !m_pCurrentCursor->IsInProtectTable( true ) && + !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) { - UpdateCrsr(); // update current cursor + UpdateCursor(); // update current cursor } } -void SwCrsrShell::HideCrsrs() +void SwCursorShell::HideCursors() { - if( !m_bHasFocus || m_bBasicHideCrsr ) + if( !m_bHasFocus || m_bBasicHideCursor ) return; // if cursor is visible then hide SV cursor - if( m_pVisCrsr->IsVisible() ) + if( m_pVisibleCursor->IsVisible() ) { SET_CURR_SHELL( this ); - m_pVisCrsr->Hide(); + m_pVisibleCursor->Hide(); } // revoke inversion of SSelection - SwShellCrsr* pAktCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; - pAktCrsr->Hide(); + SwShellCursor* pAktCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; + pAktCursor->Hide(); } -void SwCrsrShell::ShowCrsrs( bool bCrsrVis ) +void SwCursorShell::ShowCursors( bool bCursorVis ) { - if( !m_bHasFocus || m_bAllProtect || m_bBasicHideCrsr ) + if( !m_bHasFocus || m_bAllProtect || m_bBasicHideCursor ) return; SET_CURR_SHELL( this ); - SwShellCrsr* pAktCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; - pAktCrsr->Show(); + SwShellCursor* pAktCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; + pAktCursor->Show(); - if( m_bSVCrsrVis && bCrsrVis ) // also show SV cursor again - m_pVisCrsr->Show(); + if( m_bSVCursorVis && bCursorVis ) // also show SV cursor again + m_pVisibleCursor->Show(); } -void SwCrsrShell::ShowCrsr() +void SwCursorShell::ShowCursor() { - if( !m_bBasicHideCrsr ) + if( !m_bBasicHideCursor ) { - m_bSVCrsrVis = true; - m_pCurCrsr->SetShowTextInputFieldOverlay( true ); + m_bSVCursorVis = true; + m_pCurrentCursor->SetShowTextInputFieldOverlay( true ); if (comphelper::LibreOfficeKit::isActive()) { @@ -2148,19 +2148,19 @@ void SwCrsrShell::ShowCrsr() libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); } - UpdateCrsr(); + UpdateCursor(); } } -void SwCrsrShell::HideCrsr() +void SwCursorShell::HideCursor() { - if( !m_bBasicHideCrsr ) + if( !m_bBasicHideCursor ) { - m_bSVCrsrVis = false; + m_bSVCursorVis = false; // possibly reverse selected areas!! SET_CURR_SHELL( this ); - m_pCurCrsr->SetShowTextInputFieldOverlay( false ); - m_pVisCrsr->Hide(); + m_pCurrentCursor->SetShowTextInputFieldOverlay( false ); + m_pVisibleCursor->Hide(); if (comphelper::LibreOfficeKit::isActive()) { @@ -2172,45 +2172,45 @@ void SwCrsrShell::HideCrsr() } } -void SwCrsrShell::ShLooseFcs() +void SwCursorShell::ShLooseFcs() { - if( !m_bBasicHideCrsr ) - HideCrsrs(); + if( !m_bBasicHideCursor ) + HideCursors(); m_bHasFocus = false; } -void SwCrsrShell::ShGetFcs( bool bUpdate ) +void SwCursorShell::ShGetFcs( bool bUpdate ) { m_bHasFocus = true; - if( !m_bBasicHideCrsr && VisArea().Width() ) + if( !m_bBasicHideCursor && VisArea().Width() ) { - UpdateCrsr( static_cast<sal_uInt16>( bUpdate ? - SwCrsrShell::CHKRANGE|SwCrsrShell::SCROLLWIN - : SwCrsrShell::CHKRANGE ) ); - ShowCrsrs( m_bSVCrsrVis ); + UpdateCursor( static_cast<sal_uInt16>( bUpdate ? + SwCursorShell::CHKRANGE|SwCursorShell::SCROLLWIN + : SwCursorShell::CHKRANGE ) ); + ShowCursors( m_bSVCursorVis ); } } /** Get current frame in which the cursor is positioned. */ -SwContentFrm *SwCrsrShell::GetCurrFrm( const bool bCalcFrm ) const +SwContentFrame *SwCursorShell::GetCurrFrame( const bool bCalcFrame ) const { - SET_CURR_SHELL( static_cast<SwViewShell*>(const_cast<SwCrsrShell *>(this)) ); - SwContentFrm *pRet = nullptr; - SwContentNode *pNd = m_pCurCrsr->GetContentNode(); + SET_CURR_SHELL( static_cast<SwViewShell*>(const_cast<SwCursorShell *>(this)) ); + SwContentFrame *pRet = nullptr; + SwContentNode *pNd = m_pCurrentCursor->GetContentNode(); if ( pNd ) { - if ( bCalcFrm ) + if ( bCalcFrame ) { sal_uInt16* pST = const_cast<sal_uInt16*>(&mnStartAction); ++(*pST); const Size aOldSz( GetDocSize() ); - pRet = pNd->getLayoutFrm( GetLayout(), &m_pCurCrsr->GetPtPos(), m_pCurCrsr->GetPoint() ); + pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint() ); --(*pST); if( aOldSz != GetDocSize() ) - const_cast<SwCrsrShell*>(this)->SizeChgNotify(); + const_cast<SwCursorShell*>(this)->SizeChgNotify(); } else - pRet = pNd->getLayoutFrm( GetLayout(), &m_pCurCrsr->GetPtPos(), m_pCurCrsr->GetPoint(), false); + pRet = pNd->getLayoutFrame( GetLayout(), &m_pCurrentCursor->GetPtPos(), m_pCurrentCursor->GetPoint(), false); } return pRet; } @@ -2221,7 +2221,7 @@ SwContentFrm *SwCrsrShell::GetCurrFrm( const bool bCalcFrm ) const @param pOld ??? @param pNew ??? */ -void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) +void SwCursorShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { const sal_uInt16 nWhich = pOld ? pOld->Which() : @@ -2248,13 +2248,13 @@ void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) This means checking if GetMark is set and if SPoint and GetMark differ. */ -bool SwCrsrShell::HasSelection() const +bool SwCursorShell::HasSelection() const { - const SwPaM* pCrsr = getShellCrsr( true ); - return IsTableMode() || ( pCrsr->HasMark() && *pCrsr->GetPoint() != *pCrsr->GetMark() ); + const SwPaM* pCursor = getShellCursor( true ); + return IsTableMode() || ( pCursor->HasMark() && *pCursor->GetPoint() != *pCursor->GetMark() ); } -void SwCrsrShell::CallChgLnk() +void SwCursorShell::CallChgLnk() { // Do not make any call in start/end action but just remember the change. // This will be taken care of in the end action. @@ -2269,34 +2269,34 @@ void SwCrsrShell::CallChgLnk() } /// get selected text of a node at current cursor -OUString SwCrsrShell::GetSelText() const +OUString SwCursorShell::GetSelText() const { OUString aText; - if( m_pCurCrsr->GetPoint()->nNode.GetIndex() == - m_pCurCrsr->GetMark()->nNode.GetIndex() ) + if( m_pCurrentCursor->GetPoint()->nNode.GetIndex() == + m_pCurrentCursor->GetMark()->nNode.GetIndex() ) { - SwTextNode* pTextNd = m_pCurCrsr->GetNode().GetTextNode(); + SwTextNode* pTextNd = m_pCurrentCursor->GetNode().GetTextNode(); if( pTextNd ) { - const sal_Int32 nStt = m_pCurCrsr->Start()->nContent.GetIndex(); + const sal_Int32 nStt = m_pCurrentCursor->Start()->nContent.GetIndex(); aText = pTextNd->GetExpandText( nStt, - m_pCurCrsr->End()->nContent.GetIndex() - nStt ); + m_pCurrentCursor->End()->nContent.GetIndex() - nStt ); } } return aText; } /// get text only from current cursor position (until end of node) -OUString SwCrsrShell::GetText() const +OUString SwCursorShell::GetText() const { OUString aText; - if( m_pCurCrsr->GetPoint()->nNode.GetIndex() == - m_pCurCrsr->GetMark()->nNode.GetIndex() ) + if( m_pCurrentCursor->GetPoint()->nNode.GetIndex() == + m_pCurrentCursor->GetMark()->nNode.GetIndex() ) { - SwTextNode* pTextNd = m_pCurCrsr->GetNode().GetTextNode(); + SwTextNode* pTextNd = m_pCurrentCursor->GetNode().GetTextNode(); if( pTextNd ) aText = pTextNd->GetText().copy( - m_pCurCrsr->GetPoint()->nContent.GetIndex() ); + m_pCurrentCursor->GetPoint()->nContent.GetIndex() ); } return aText; } @@ -2306,13 +2306,13 @@ OUString SwCrsrShell::GetText() const @param bEnd Start counting from the end? From start otherwise. @param nOffset position of the character */ -sal_Unicode SwCrsrShell::GetChar( bool bEnd, long nOffset ) +sal_Unicode SwCursorShell::GetChar( bool bEnd, long nOffset ) { if( IsTableMode() ) // not possible in table mode return 0; - const SwPosition* pPos = !m_pCurCrsr->HasMark() ? m_pCurCrsr->GetPoint() - : bEnd ? m_pCurCrsr->End() : m_pCurCrsr->Start(); + const SwPosition* pPos = !m_pCurrentCursor->HasMark() ? m_pCurrentCursor->GetPoint() + : bEnd ? m_pCurrentCursor->End() : m_pCurrentCursor->Start(); SwTextNode* pTextNd = pPos->nNode.GetNode().GetTextNode(); if( !pTextNd ) return 0; @@ -2332,12 +2332,12 @@ sal_Unicode SwCrsrShell::GetChar( bool bEnd, long nOffset ) @param bEnd Start counting from the end? From start otherwise. @param nCount Number of characters. */ -bool SwCrsrShell::ExtendSelection( bool bEnd, sal_Int32 nCount ) +bool SwCursorShell::ExtendSelection( bool bEnd, sal_Int32 nCount ) { - if( !m_pCurCrsr->HasMark() || IsTableMode() ) + if( !m_pCurrentCursor->HasMark() || IsTableMode() ) return false; // no selection - SwPosition* pPos = bEnd ? m_pCurCrsr->End() : m_pCurCrsr->Start(); + SwPosition* pPos = bEnd ? m_pCurrentCursor->End() : m_pCurrentCursor->Start(); SwTextNode* pTextNd = pPos->nNode.GetNode().GetTextNode(); OSL_ENSURE( pTextNd, "no text node; how should this then be extended?" ); @@ -2354,10 +2354,10 @@ bool SwCrsrShell::ExtendSelection( bool bEnd, sal_Int32 nCount ) else return false; // not possible anymore - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed pPos->nContent = nPos; - UpdateCrsr(); + UpdateCursor(); return true; } @@ -2367,16 +2367,16 @@ bool SwCrsrShell::ExtendSelection( bool bEnd, sal_Int32 nCount ) @param rPt The position to move the visible cursor to. @return <false> if SPoint was corrected by the layout. */ -bool SwCrsrShell::SetVisCrsr( const Point &rPt ) +bool SwCursorShell::SetVisibleCursor( const Point &rPt ) { SET_CURR_SHELL( this ); Point aPt( rPt ); - SwPosition aPos( *m_pCurCrsr->GetPoint() ); - SwCrsrMoveState aTmpState( MV_SETONLYTEXT ); + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); + SwCursorMoveState aTmpState( MV_SETONLYTEXT ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); aTmpState.m_bRealHeight = true; - const bool bRet = GetLayout()->GetCrsrOfst( &aPos, aPt /*, &aTmpState*/ ); + const bool bRet = GetLayout()->GetCursorOfst( &aPos, aPt /*, &aTmpState*/ ); SetInFrontOfLabel( false ); // #i27615# @@ -2391,44 +2391,44 @@ bool SwCrsrShell::SetVisCrsr( const Point &rPt ) pSectNd->GetSection().IsProtectFlag())) ) return false; - SwContentFrm *pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt, &aPos ); + SwContentFrame *pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, &aPos ); if ( Imp()->IsIdleAction() ) - pFrm->PrepareCrsr(); + pFrame->PrepareCursor(); SwRect aTmp( m_aCharRect ); - pFrm->GetCharRect( m_aCharRect, aPos, &aTmpState ); + pFrame->GetCharRect( m_aCharRect, aPos, &aTmpState ); // #i10137# - if( aTmp == m_aCharRect && m_pVisCrsr->IsVisible() ) + if( aTmp == m_aCharRect && m_pVisibleCursor->IsVisible() ) return true; - m_pVisCrsr->Hide(); // always hide visible cursor + m_pVisibleCursor->Hide(); // always hide visible cursor if( IsScrollMDI( this, m_aCharRect )) { MakeVisible( m_aCharRect ); - m_pCurCrsr->Show(); + m_pCurrentCursor->Show(); } { if( aTmpState.m_bRealHeight ) - m_aCrsrHeight = aTmpState.m_aRealHeight; + m_aCursorHeight = aTmpState.m_aRealHeight; else { - m_aCrsrHeight.setX(0); - m_aCrsrHeight.setY(m_aCharRect.Height()); + m_aCursorHeight.setX(0); + m_aCursorHeight.setY(m_aCharRect.Height()); } - m_pVisCrsr->SetDragCrsr(); - m_pVisCrsr->Show(); // show again + m_pVisibleCursor->SetDragCursor(); + m_pVisibleCursor->Show(); // show again } return bRet; } -bool SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const +bool SwCursorShell::IsOverReadOnlyPos( const Point& rPt ) const { Point aPt( rPt ); - SwPaM aPam( *m_pCurCrsr->GetPoint() ); - GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt ); + SwPaM aPam( *m_pCurrentCursor->GetPoint() ); + GetLayout()->GetCursorOfst( aPam.GetPoint(), aPt ); // Formular view return aPam.HasReadonlySel( GetViewOptions()->IsFormView() ); } @@ -2437,12 +2437,12 @@ bool SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const @param bAll If <false> get only spanned ones (= with selections) (Basic). */ -sal_uInt16 SwCrsrShell::GetCrsrCnt( bool bAll ) const +sal_uInt16 SwCursorShell::GetCursorCnt( bool bAll ) const { - SwPaM* pTmp = GetCrsr()->GetNext(); - sal_uInt16 n = (bAll || ( m_pCurCrsr->HasMark() && - *m_pCurCrsr->GetPoint() != *m_pCurCrsr->GetMark())) ? 1 : 0; - while( pTmp != m_pCurCrsr ) + SwPaM* pTmp = GetCursor()->GetNext(); + sal_uInt16 n = (bAll || ( m_pCurrentCursor->HasMark() && + *m_pCurrentCursor->GetPoint() != *m_pCurrentCursor->GetMark())) ? 1 : 0; + while( pTmp != m_pCurrentCursor ) { if( bAll || ( static_cast<SwPaM*>(pTmp)->HasMark() && *static_cast<SwPaM*>(pTmp)->GetPoint() != *static_cast<SwPaM*>(pTmp)->GetMark())) @@ -2452,54 +2452,54 @@ sal_uInt16 SwCrsrShell::GetCrsrCnt( bool bAll ) const return n; } -bool SwCrsrShell::IsStartOfDoc() const +bool SwCursorShell::IsStartOfDoc() const { - if( m_pCurCrsr->GetPoint()->nContent.GetIndex() ) + if( m_pCurrentCursor->GetPoint()->nContent.GetIndex() ) return false; // after EndOfIcons comes the content selection (EndNd+StNd+ContentNd) SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfExtras(), 2 ); if( !aIdx.GetNode().IsContentNode() ) GetDoc()->GetNodes().GoNext( &aIdx ); - return aIdx == m_pCurCrsr->GetPoint()->nNode; + return aIdx == m_pCurrentCursor->GetPoint()->nNode; } -bool SwCrsrShell::IsEndOfDoc() const +bool SwCursorShell::IsEndOfDoc() const { SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfContent(), -1 ); SwContentNode* pCNd = aIdx.GetNode().GetContentNode(); if( !pCNd ) pCNd = SwNodes::GoPrevious( &aIdx ); - return aIdx == m_pCurCrsr->GetPoint()->nNode && - pCNd->Len() == m_pCurCrsr->GetPoint()->nContent.GetIndex(); + return aIdx == m_pCurrentCursor->GetPoint()->nNode && + pCNd->Len() == m_pCurrentCursor->GetPoint()->nContent.GetIndex(); } /** Invalidate cursors Delete all created cursors, set table crsr and last crsr to their TextNode - (or StartNode?). They will then all re-created at the next ::GetCrsr() call. + (or StartNode?). They will then all re-created at the next ::GetCursor() call. This is needed for Drag&Drop/ Clipboard-paste in tables. */ -bool SwCrsrShell::ParkTableCrsr() +bool SwCursorShell::ParkTableCursor() { - if( !m_pTableCrsr ) + if( !m_pTableCursor ) return false; - m_pTableCrsr->ParkCrsr(); + m_pTableCursor->ParkCursor(); - while( m_pCurCrsr->GetNext() != m_pCurCrsr ) - delete m_pCurCrsr->GetNext(); + while( m_pCurrentCursor->GetNext() != m_pCurrentCursor ) + delete m_pCurrentCursor->GetNext(); // *always* move cursor's Point and Mark - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = *m_pTableCrsr->GetPoint(); + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = *m_pTableCursor->GetPoint(); return true; } -void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) +void SwCursorShell::_ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ) { const SwPosition *pStt = pDelRg->Start(), *pEnd = pDelRg->GetPoint() == pStt ? pDelRg->GetMark() : pDelRg->GetPoint(); @@ -2534,16 +2534,16 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) bool bDelete = true; if( *ppDelRing == pTmpDel ) { - if( *ppDelRing == m_pCurCrsr ) + if( *ppDelRing == m_pCurrentCursor ) { - if( ( bDelete = GoNextCrsr() ) ) + if( ( bDelete = GoNextCursor() ) ) { bGoNext = false; pTmp = pTmp->GetNext(); } } else - bDelete = false; // never delete the StackCrsr + bDelete = false; // never delete the StackCursor } if( bDelete ) @@ -2571,12 +2571,12 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) @param rIdx ??? */ -void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) +void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx ) { SwNode *pNode = &rIdx.GetNode(); // create a new PaM - SwPaM * pNew = new SwPaM( *GetCrsr()->GetPoint() ); + SwPaM * pNew = new SwPaM( *GetCursor()->GetPoint() ); if( pNode->GetStartNode() ) { if( ( pNode = pNode->StartOfSectionNode())->IsTableNode() ) @@ -2599,23 +2599,23 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) // take care of all shells for(SwViewShell& rTmp : GetRingContainer()) { - if( dynamic_cast<const SwCrsrShell *>(&rTmp) != nullptr) + if( dynamic_cast<const SwCursorShell *>(&rTmp) != nullptr) { - SwCrsrShell* pSh = static_cast<SwCrsrShell*>(&rTmp); - if( pSh->m_pCrsrStk ) - pSh->_ParkPams( pNew, &pSh->m_pCrsrStk ); + SwCursorShell* pSh = static_cast<SwCursorShell*>(&rTmp); + if( pSh->m_pCursorStack ) + pSh->_ParkPams( pNew, &pSh->m_pCursorStack ); - pSh->_ParkPams( pNew, &pSh->m_pCurCrsr ); - if( pSh->m_pTableCrsr ) + pSh->_ParkPams( pNew, &pSh->m_pCurrentCursor ); + if( pSh->m_pTableCursor ) { // set table cursor always to 0 and the current one always to // the beginning of the table - SwPaM* pTCrsr = pSh->GetTableCrs(); - SwNode* pTableNd = pTCrsr->GetPoint()->nNode.GetNode().FindTableNode(); + SwPaM* pTCursor = pSh->GetTableCrs(); + SwNode* pTableNd = pTCursor->GetPoint()->nNode.GetNode().FindTableNode(); if ( pTableNd ) { - pTCrsr->DeleteMark(); - pSh->m_pCurCrsr->GetPoint()->nNode = *pTableNd; + pTCursor->DeleteMark(); + pSh->m_pCurrentCursor->GetPoint()->nNode = *pTableNd; } } } @@ -2628,68 +2628,68 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) Copy cursor position and add it to the ring. All views of a document are in the ring of the shell. */ -SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, vcl::Window *pInitWin ) +SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin ) : SwViewShell( rShell, pInitWin ) , SwModify( nullptr ) - , m_pCrsrStk( nullptr ) - , m_pBlockCrsr( nullptr ) - , m_pTableCrsr( nullptr ) + , m_pCursorStack( nullptr ) + , m_pBlockCursor( nullptr ) + , m_pTableCursor( nullptr ) , m_pBoxIdx( nullptr ) , m_pBoxPtr( nullptr ) , m_nUpDownX(0) - , m_nLeftFrmPos(0) + , m_nLeftFramePos(0) , m_nAktNode(0) , m_nAktContent(0) , m_nAktNdTyp(0) , m_bAktSelection(false) - , m_nCrsrMove( 0 ) + , m_nCursorMove( 0 ) , m_nBasicActionCnt( 0 ) , m_eMvState( MV_NONE ) , m_sMarkedListId() , m_nMarkedListLevel( 0 ) - , m_oldColFrm(nullptr) + , m_oldColFrame(nullptr) { SET_CURR_SHELL( this ); // only keep the position of the current cursor of the copy shell - m_pCurCrsr = new SwShellCrsr( *this, *(rShell.m_pCurCrsr->GetPoint()) ); - m_pCurCrsr->GetContentNode()->Add( this ); + m_pCurrentCursor = new SwShellCursor( *this, *(rShell.m_pCurrentCursor->GetPoint()) ); + m_pCurrentCursor->GetContentNode()->Add( this ); m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = - m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCrsr = - m_bOverwriteCrsr = false; + m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor = + m_bOverwriteCursor = false; m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true; - m_bSVCrsrVis = true; - m_bSetCrsrInReadOnly = true; - m_pVisCrsr = new SwVisCrsr( this ); + m_bSVCursorVis = true; + m_bSetCursorInReadOnly = true; + m_pVisibleCursor = new SwVisibleCursor( this ); m_bMacroExecAllowed = rShell.IsMacroExecAllowed(); #if defined(IOS) - HideCrsr(); + HideCursor(); #endif } /// default constructor -SwCrsrShell::SwCrsrShell( SwDoc& rDoc, vcl::Window *pInitWin, +SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window *pInitWin, const SwViewOption *pInitOpt ) : SwViewShell( rDoc, pInitWin, pInitOpt ) , SwModify( nullptr ) - , m_pCrsrStk( nullptr ) - , m_pBlockCrsr( nullptr ) - , m_pTableCrsr( nullptr ) + , m_pCursorStack( nullptr ) + , m_pBlockCursor( nullptr ) + , m_pTableCursor( nullptr ) , m_pBoxIdx( nullptr ) , m_pBoxPtr( nullptr ) , m_nUpDownX(0) - , m_nLeftFrmPos(0) + , m_nLeftFramePos(0) , m_nAktNode(0) , m_nAktContent(0) , m_nAktNdTyp(0) , m_bAktSelection(false) - , m_nCrsrMove( 0 ) + , m_nCursorMove( 0 ) , m_nBasicActionCnt( 0 ) - , m_eMvState( MV_NONE ) // state for crsr-travelling - GetCrsrOfst + , m_eMvState( MV_NONE ) // state for crsr-travelling - GetCursorOfst , m_sMarkedListId() , m_nMarkedListLevel( 0 ) - , m_oldColFrm(nullptr) + , m_oldColFrame(nullptr) { SET_CURR_SHELL( this ); // create initial cursor and set it to first content position @@ -2698,50 +2698,50 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, vcl::Window *pInitWin, SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() ); SwContentNode* pCNd = rNds.GoNext( &aNodeIdx ); // go to the first ContentNode - m_pCurCrsr = new SwShellCrsr( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 ))); + m_pCurrentCursor = new SwShellCursor( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 ))); // Register shell as dependent at current node. As a result all attribute // changes can be forwarded via the Link. pCNd->Add( this ); m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = - m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCrsr = - m_bOverwriteCrsr = false; + m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor = + m_bOverwriteCursor = false; m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true; - m_bSVCrsrVis = true; - m_bSetCrsrInReadOnly = true; + m_bSVCursorVis = true; + m_bSetCursorInReadOnly = true; - m_pVisCrsr = new SwVisCrsr( this ); + m_pVisibleCursor = new SwVisibleCursor( this ); m_bMacroExecAllowed = true; #if defined(IOS) - HideCrsr(); + HideCursor(); #endif } -SwCrsrShell::~SwCrsrShell() +SwCursorShell::~SwCursorShell() { // if it is not the last view then at least the field should be updated if( !unique() ) - CheckTableBoxContent( m_pCurCrsr->GetPoint() ); + CheckTableBoxContent( m_pCurrentCursor->GetPoint() ); else ClearTableBoxContent(); - delete m_pVisCrsr; - delete m_pBlockCrsr; - delete m_pTableCrsr; + delete m_pVisibleCursor; + delete m_pBlockCursor; + delete m_pTableCursor; // release cursors - while(m_pCurCrsr->GetNext() != m_pCurCrsr) - delete m_pCurCrsr->GetNext(); - delete m_pCurCrsr; + while(m_pCurrentCursor->GetNext() != m_pCurrentCursor) + delete m_pCurrentCursor->GetNext(); + delete m_pCurrentCursor; // free stack - if( m_pCrsrStk ) + if( m_pCursorStack ) { - while( m_pCrsrStk->GetNext() != m_pCrsrStk ) - delete m_pCrsrStk->GetNext(); - delete m_pCrsrStk; + while( m_pCursorStack->GetNext() != m_pCursorStack ) + delete m_pCursorStack->GetNext(); + delete m_pCursorStack; } // #i54025# - do not give a HTML parser that might potentially hang as @@ -2750,55 +2750,55 @@ SwCrsrShell::~SwCrsrShell() GetRegisteredInNonConst()->Remove( this ); } -SwShellCrsr* SwCrsrShell::getShellCrsr( bool bBlock ) +SwShellCursor* SwCursorShell::getShellCursor( bool bBlock ) { - if( m_pTableCrsr ) - return m_pTableCrsr; - if( m_pBlockCrsr && bBlock ) - return &m_pBlockCrsr->getShellCrsr(); - return m_pCurCrsr; + if( m_pTableCursor ) + return m_pTableCursor; + if( m_pBlockCursor && bBlock ) + return &m_pBlockCursor->getShellCursor(); + return m_pCurrentCursor; } /** Should WaitPtr be switched on for the clipboard? Wait for TableMode, multiple selections and more than x selected paragraphs. */ -bool SwCrsrShell::ShouldWait() const +bool SwCursorShell::ShouldWait() const { - if ( IsTableMode() || GetCrsrCnt() > 1 ) + if ( IsTableMode() || GetCursorCnt() > 1 ) return true; if( HasDrawView() && GetDrawView()->GetMarkedObjectList().GetMarkCount() ) return true; - SwPaM* pPam = GetCrsr(); + SwPaM* pPam = GetCursor(); return pPam->Start()->nNode.GetIndex() + 10 < pPam->End()->nNode.GetIndex(); } -size_t SwCrsrShell::UpdateTableSelBoxes() +size_t SwCursorShell::UpdateTableSelBoxes() { - if (m_pTableCrsr && (m_pTableCrsr->IsChgd() || !m_pTableCrsr->GetSelectedBoxesCount())) + if (m_pTableCursor && (m_pTableCursor->IsChgd() || !m_pTableCursor->GetSelectedBoxesCount())) { - GetLayout()->MakeTableCrsrs( *m_pTableCrsr ); + GetLayout()->MakeTableCursors( *m_pTableCursor ); } - return (m_pTableCrsr) ? m_pTableCrsr->GetSelectedBoxesCount() : 0; + return (m_pTableCursor) ? m_pTableCursor->GetSelectedBoxesCount() : 0; } /// show the current selected "object" -void SwCrsrShell::MakeSelVisible() +void SwCursorShell::MakeSelVisible() { OSL_ENSURE( m_bHasFocus, "no focus but cursor should be made visible?" ); - if( m_aCrsrHeight.Y() < m_aCharRect.Height() && m_aCharRect.Height() > VisArea().Height() ) + if( m_aCursorHeight.Y() < m_aCharRect.Height() && m_aCharRect.Height() > VisArea().Height() ) { SwRect aTmp( m_aCharRect ); long nDiff = m_aCharRect.Height() - VisArea().Height(); - if( nDiff < m_aCrsrHeight.getX() ) + if( nDiff < m_aCursorHeight.getX() ) aTmp.Top( nDiff + m_aCharRect.Top() ); else { - aTmp.Top( m_aCrsrHeight.getX() + m_aCharRect.Top() ); - aTmp.Height( m_aCrsrHeight.getY() ); + aTmp.Top( m_aCursorHeight.getX() + m_aCharRect.Top() ); + aTmp.Height( m_aCursorHeight.getY() ); } if( !aTmp.HasArea() ) { @@ -2821,9 +2821,9 @@ void SwCrsrShell::MakeSelVisible() } /// search a valid content position (not protected/hidden) -bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) +bool SwCursorShell::FindValidContentNode( bool bOnlyText ) { - if( m_pTableCrsr ) + if( m_pTableCursor ) { OSL_ENSURE( false, "Did not remove table selection!" ); return false; @@ -2834,22 +2834,22 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) GetDoc()->GetDocShell()->IsReadOnlyUI() ) return true; - if( m_pCurCrsr->HasMark() ) + if( m_pCurrentCursor->HasMark() ) ClearMark(); // first check for frames - SwNodeIndex& rNdIdx = m_pCurCrsr->GetPoint()->nNode; + SwNodeIndex& rNdIdx = m_pCurrentCursor->GetPoint()->nNode; sal_uLong nNdIdx = rNdIdx.GetIndex(); // keep backup SwNodes& rNds = mpDoc->GetNodes(); SwContentNode* pCNd = rNdIdx.GetNode().GetContentNode(); - const SwContentFrm * pFrm; + const SwContentFrame * pFrame; - if( pCNd && nullptr != (pFrm = pCNd->getLayoutFrm( GetLayout(), nullptr, m_pCurCrsr->GetPoint(), false)) && - !IsReadOnlyAvailable() && pFrm->IsProtected() && + if( pCNd && nullptr != (pFrame = pCNd->getLayoutFrame( GetLayout(), nullptr, m_pCurrentCursor->GetPoint(), false)) && + !IsReadOnlyAvailable() && pFrame->IsProtected() && nNdIdx < rNds.GetEndOfExtras().GetIndex() ) { // skip protected frame - SwPaM aPam( *m_pCurCrsr->GetPoint() ); + SwPaM aPam( *m_pCurrentCursor->GetPoint() ); aPam.SetMark(); aPam.GetMark()->nNode = rNds.GetEndOfContent(); aPam.GetPoint()->nNode = *pCNd->EndOfSectionNode(); @@ -2866,13 +2866,13 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) rNdIdx = nNdIdx; // back to old node return false; } - *m_pCurCrsr->GetPoint() = *aPam.GetPoint(); + *m_pCurrentCursor->GetPoint() = *aPam.GetPoint(); } else if( bOnlyText && pCNd && pCNd->IsNoTextNode() ) { // set to beginning of document rNdIdx = mpDoc->GetNodes().GetEndOfExtras(); - m_pCurCrsr->GetPoint()->nContent.Assign( mpDoc->GetNodes().GoNext( + m_pCurrentCursor->GetPoint()->nContent.Assign( mpDoc->GetNodes().GoNext( &rNdIdx ), 0 ); nNdIdx = rNdIdx.GetIndex(); } @@ -2907,7 +2907,7 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) // if we're successful, set the new position if( ! aPam.GetNode().IsProtect() ) { - *m_pCurCrsr->GetPoint() = *aPam.GetPoint(); + *m_pCurrentCursor->GetPoint() = *aPam.GetPoint(); } } @@ -2937,9 +2937,9 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) if( pCNd->FindTableNode() ) { SwCallLink aTmp( *this ); - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCursorSaveState aSaveState( *m_pCurrentCursor ); aTmp.nNdTyp = 0; // don't do anything in DTOR - if( !m_pCurCrsr->IsInProtectTable( true ) ) + if( !m_pCurrentCursor->IsInProtectTable( true ) ) { const SwSectionNode* pSNd = pCNd->FindSectionNode(); if( !pSNd || !pSNd->GetSection().IsHiddenFlag() @@ -2962,8 +2962,8 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() ) { // also check for Fly - might be protected as well - if( nullptr == (pFrm = pCNd->getLayoutFrm( GetLayout(), nullptr, nullptr, false)) || - ( !IsReadOnlyAvailable() && pFrm->IsProtected() ) || + if( nullptr == (pFrame = pCNd->getLayoutFrame( GetLayout(), nullptr, nullptr, false)) || + ( !IsReadOnlyAvailable() && pFrame->IsProtected() ) || ( bOnlyText && pCNd->IsNoTextNode() ) ) { // continue search @@ -2985,48 +2985,48 @@ bool SwCrsrShell::FindValidContentNode( bool bOnlyText ) { pCNd = rNdIdx.GetNode().GetContentNode(); const sal_Int32 nContent = rNdIdx.GetIndex() < nNdIdx ? pCNd->Len() : 0; - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, nContent ); + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, nContent ); } else { pCNd = rNdIdx.GetNode().GetContentNode(); // if cursor in hidden frame, always move it - if( !pCNd || !pCNd->getLayoutFrm( GetLayout(), nullptr, nullptr, false) ) + if( !pCNd || !pCNd->getLayoutFrame( GetLayout(), nullptr, nullptr, false) ) { - SwCrsrMoveState aTmpState( MV_NONE ); + SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - GetLayout()->GetCrsrOfst( m_pCurCrsr->GetPoint(), m_pCurCrsr->GetPtPos(), + GetLayout()->GetCursorOfst( m_pCurrentCursor->GetPoint(), m_pCurrentCursor->GetPtPos(), &aTmpState ); } } return bOk; } -bool SwCrsrShell::IsCrsrReadonly() const +bool SwCursorShell::IsCursorReadonly() const { if ( GetViewOptions()->IsReadonly() || GetViewOptions()->IsFormView() /* Formula view */ ) { - SwFrm *pFrm = GetCurrFrm( false ); - const SwFlyFrm* pFly; + SwFrame *pFrame = GetCurrFrame( false ); + const SwFlyFrame* pFly; const SwSection* pSection; - if( pFrm && pFrm->IsInFly() && - (pFly = pFrm->FindFlyFrm())->GetFormat()->GetEditInReadonly().GetValue() && + if( pFrame && pFrame->IsInFly() && + (pFly = pFrame->FindFlyFrame())->GetFormat()->GetEditInReadonly().GetValue() && pFly->Lower() && - !pFly->Lower()->IsNoTextFrm() && + !pFly->Lower()->IsNoTextFrame() && !GetDrawView()->GetMarkedObjectList().GetMarkCount() ) { return false; } // edit in readonly sections - else if ( pFrm && pFrm->IsInSct() && - nullptr != ( pSection = pFrm->FindSctFrm()->GetSection() ) && + else if ( pFrame && pFrame->IsInSct() && + nullptr != ( pSection = pFrame->FindSctFrame()->GetSection() ) && pSection->IsEditInReadonlyFlag() ) { return false; } - else if ( !IsMultiSelection() && CrsrInsideInputField() ) + else if ( !IsMultiSelection() && CursorInsideInputField() ) { return false; } @@ -3037,12 +3037,12 @@ bool SwCrsrShell::IsCrsrReadonly() const } /// is the cursor allowed to enter ReadOnly sections? -void SwCrsrShell::SetReadOnlyAvailable( bool bFlag ) +void SwCursorShell::SetReadOnlyAvailable( bool bFlag ) { // *never* switch in GlobalDoc if( (!GetDoc()->GetDocShell() || dynamic_cast<const SwGlobalDocShell*>(GetDoc()->GetDocShell()) == nullptr ) && - bFlag != m_bSetCrsrInReadOnly ) + bFlag != m_bSetCursorInReadOnly ) { // If the flag is switched off then all selections need to be // invalidated. Otherwise we would trust that nothing protected is selected. @@ -3050,27 +3050,27 @@ void SwCrsrShell::SetReadOnlyAvailable( bool bFlag ) { ClearMark(); } - m_bSetCrsrInReadOnly = bFlag; - UpdateCrsr(); + m_bSetCursorInReadOnly = bFlag; + UpdateCursor(); } } -bool SwCrsrShell::HasReadonlySel(bool bAnnotationMode) const +bool SwCursorShell::HasReadonlySel(bool bAnnotationMode) const { bool bRet = false; // If protected area is to be ignored, then selections are never read-only. if ((IsReadOnlyAvailable() || GetViewOptions()->IsFormView()) && !GetViewOptions()->IsIgnoreProtectedArea()) { - if ( m_pTableCrsr != nullptr ) + if ( m_pTableCursor != nullptr ) { - bRet = m_pTableCrsr->HasReadOnlyBoxSel() - || m_pTableCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ); + bRet = m_pTableCursor->HasReadOnlyBoxSel() + || m_pTableCursor->HasReadonlySel( GetViewOptions()->IsFormView() ); } else { - for(const SwPaM& rCrsr : m_pCurCrsr->GetRingContainer()) + for(const SwPaM& rCursor : m_pCurrentCursor->GetRingContainer()) { - if( rCrsr.HasReadonlySel( GetViewOptions()->IsFormView(), bAnnotationMode ) ) + if( rCursor.HasReadonlySel( GetViewOptions()->IsFormView(), bAnnotationMode ) ) { bRet = true; break; @@ -3081,49 +3081,49 @@ bool SwCrsrShell::HasReadonlySel(bool bAnnotationMode) const return bRet; } -bool SwCrsrShell::IsSelFullPara() const +bool SwCursorShell::IsSelFullPara() const { bool bRet = false; - if( m_pCurCrsr->GetPoint()->nNode.GetIndex() == - m_pCurCrsr->GetMark()->nNode.GetIndex() && !m_pCurCrsr->IsMultiSelection() ) + if( m_pCurrentCursor->GetPoint()->nNode.GetIndex() == + m_pCurrentCursor->GetMark()->nNode.GetIndex() && !m_pCurrentCursor->IsMultiSelection() ) { - sal_Int32 nStt = m_pCurCrsr->GetPoint()->nContent.GetIndex(); - sal_Int32 nEnd = m_pCurCrsr->GetMark()->nContent.GetIndex(); + sal_Int32 nStt = m_pCurrentCursor->GetPoint()->nContent.GetIndex(); + sal_Int32 nEnd = m_pCurrentCursor->GetMark()->nContent.GetIndex(); if( nStt > nEnd ) { sal_Int32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; } - const SwContentNode* pCNd = m_pCurCrsr->GetContentNode(); + const SwContentNode* pCNd = m_pCurrentCursor->GetContentNode(); bRet = pCNd && !nStt && nEnd == pCNd->Len(); } return bRet; } -short SwCrsrShell::GetTextDirection( const Point* pPt ) const +short SwCursorShell::GetTextDirection( const Point* pPt ) const { - SwPosition aPos( *m_pCurCrsr->GetPoint() ); - Point aPt( pPt ? *pPt : m_pCurCrsr->GetPtPos() ); + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); + Point aPt( pPt ? *pPt : m_pCurrentCursor->GetPtPos() ); if( pPt ) { - SwCrsrMoveState aTmpState( MV_NONE ); + SwCursorMoveState aTmpState( MV_NONE ); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); - GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ); + GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ); } return mpDoc->GetTextDirection( aPos, &aPt ); } -bool SwCrsrShell::IsInVerticalText( const Point* pPt ) const +bool SwCursorShell::IsInVerticalText( const Point* pPt ) const { const short nDir = GetTextDirection( pPt ); return FRMDIR_VERT_TOP_RIGHT == nDir || FRMDIR_VERT_TOP_LEFT == nDir; } -bool SwCrsrShell::IsInRightToLeftText( const Point* pPt ) const +bool SwCursorShell::IsInRightToLeftText( const Point* pPt ) const { const short nDir = GetTextDirection( pPt ); // GetTextDirection uses FRMDIR_VERT_TOP_LEFT to indicate RTL in @@ -3133,12 +3133,12 @@ bool SwCrsrShell::IsInRightToLeftText( const Point* pPt ) const /// If the current cursor position is inside a hidden range, the hidden range /// is selected. -bool SwCrsrShell::SelectHiddenRange() +bool SwCursorShell::SelectHiddenRange() { bool bRet = false; - if ( !GetViewOptions()->IsShowHiddenChar() && !m_pCurCrsr->HasMark() ) + if ( !GetViewOptions()->IsShowHiddenChar() && !m_pCurrentCursor->HasMark() ) { - SwPosition& rPt = *m_pCurCrsr->GetPoint(); + SwPosition& rPt = *m_pCurrentCursor->GetPoint(); const SwTextNode* pNode = rPt.nNode.GetNode().GetTextNode(); if ( pNode ) { @@ -3151,8 +3151,8 @@ bool SwCrsrShell::SelectHiddenRange() if ( COMPLETE_STRING != nHiddenStart ) { // make selection: - m_pCurCrsr->SetMark(); - m_pCurCrsr->GetMark()->nContent = nHiddenEnd; + m_pCurrentCursor->SetMark(); + m_pCurrentCursor->GetMark()->nContent = nHiddenEnd; bRet = true; } } @@ -3161,42 +3161,42 @@ bool SwCrsrShell::SelectHiddenRange() return bRet; } -sal_uLong SwCrsrShell::Find( const SearchOptions& rSearchOpt, +sal_uLong SwCursorShell::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, bool bReplace ) { - if( m_pTableCrsr ) - GetCrsr(); - delete m_pTableCrsr, m_pTableCrsr = nullptr; - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - sal_uLong nRet = m_pCurCrsr->Find( rSearchOpt, bSearchInNotes, eStart, eEnd, + if( m_pTableCursor ) + GetCursor(); + delete m_pTableCursor, m_pTableCursor = nullptr; + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + sal_uLong nRet = m_pCurrentCursor->Find( rSearchOpt, bSearchInNotes, eStart, eEnd, bCancel, eRng, bReplace ); if( nRet || bCancel ) - UpdateCrsr(); + UpdateCursor(); return nRet; } -sal_uLong SwCrsrShell::Find( const SwTextFormatColl& rFormatColl, +sal_uLong SwCursorShell::Find( const SwTextFormatColl& rFormatColl, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, const SwTextFormatColl* pReplFormat ) { - if( m_pTableCrsr ) - GetCrsr(); - delete m_pTableCrsr, m_pTableCrsr = nullptr; - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - sal_uLong nRet = m_pCurCrsr->Find( rFormatColl, eStart, eEnd, bCancel, eRng, + if( m_pTableCursor ) + GetCursor(); + delete m_pTableCursor, m_pTableCursor = nullptr; + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + sal_uLong nRet = m_pCurrentCursor->Find( rFormatColl, eStart, eEnd, bCancel, eRng, pReplFormat ); if( nRet ) - UpdateCrsr(); + UpdateCursor(); return nRet; } -sal_uLong SwCrsrShell::Find( const SfxItemSet& rSet, +sal_uLong SwCursorShell::Find( const SfxItemSet& rSet, bool bNoCollections, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, @@ -3204,40 +3204,40 @@ sal_uLong SwCrsrShell::Find( const SfxItemSet& rSet, const SearchOptions* pSearchOpt, const SfxItemSet* rReplSet ) { - if( m_pTableCrsr ) - GetCrsr(); - delete m_pTableCrsr, m_pTableCrsr = nullptr; - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - sal_uLong nRet = m_pCurCrsr->Find( rSet, bNoCollections, eStart, eEnd, + if( m_pTableCursor ) + GetCursor(); + delete m_pTableCursor, m_pTableCursor = nullptr; + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + sal_uLong nRet = m_pCurrentCursor->Find( rSet, bNoCollections, eStart, eEnd, bCancel, eRng, pSearchOpt, rReplSet ); if( nRet ) - UpdateCrsr(); + UpdateCursor(); return nRet; } -void SwCrsrShell::SetSelection( const SwPaM& rCrsr ) +void SwCursorShell::SetSelection( const SwPaM& rCursor ) { StartAction(); - SwPaM* pCrsr = GetCrsr(); - *pCrsr->GetPoint() = *rCrsr.GetPoint(); - if(rCrsr.HasMark()) + SwPaM* pCursor = GetCursor(); + *pCursor->GetPoint() = *rCursor.GetPoint(); + if(rCursor.HasMark()) { - pCrsr->SetMark(); - *pCrsr->GetMark() = *rCrsr.GetMark(); + pCursor->SetMark(); + *pCursor->GetMark() = *rCursor.GetMark(); } - if(rCrsr.GetNext() != &rCrsr) + if(rCursor.GetNext() != &rCursor) { - const SwPaM *_pStartCrsr = rCrsr.GetNext(); + const SwPaM *_pStartCursor = rCursor.GetNext(); do { - SwPaM* pCurrentCrsr = CreateCrsr(); - *pCurrentCrsr->GetPoint() = *_pStartCrsr->GetPoint(); - if(_pStartCrsr->HasMark()) + SwPaM* pCurrentCursor = CreateCursor(); + *pCurrentCursor->GetPoint() = *_pStartCursor->GetPoint(); + if(_pStartCursor->HasMark()) { - pCurrentCrsr->SetMark(); - *pCurrentCrsr->GetMark() = *_pStartCrsr->GetMark(); + pCurrentCursor->SetMark(); + *pCurrentCursor->GetMark() = *_pStartCursor->GetMark(); } - } while( (_pStartCrsr = _pStartCrsr->GetNext()) != &rCrsr ); + } while( (_pStartCursor = _pStartCursor->GetNext()) != &rCursor ); } EndAction(); } @@ -3271,44 +3271,44 @@ bool sw_PosOk(const SwPosition & aPos) @param aPam the PaM to check */ -static bool lcl_CrsrOk(SwPaM & aPam) +static bool lcl_CursorOk(SwPaM & aPam) { return sw_PosOk(*aPam.GetPoint()) && (! aPam.HasMark() || sw_PosOk(*aPam.GetMark())); } -void SwCrsrShell::ClearUpCrsrs() +void SwCursorShell::ClearUpCursors() { // start of the ring - SwPaM * pStartCrsr = GetCrsr(); + SwPaM * pStartCursor = GetCursor(); // start loop with second entry of the ring - SwPaM * pCrsr = pStartCrsr->GetNext(); - SwPaM * pTmpCrsr; + SwPaM * pCursor = pStartCursor->GetNext(); + SwPaM * pTmpCursor; bool bChanged = false; // For all entries in the ring except the start entry delete the entry if // it is invalid. - while (pCrsr != pStartCrsr) + while (pCursor != pStartCursor) { - pTmpCrsr = pCrsr->GetNext(); - if ( ! lcl_CrsrOk(*pCrsr)) + pTmpCursor = pCursor->GetNext(); + if ( ! lcl_CursorOk(*pCursor)) { - delete pCrsr; + delete pCursor; bChanged = true; } - pCrsr = pTmpCrsr; + pCursor = pTmpCursor; } - if( pStartCrsr->HasMark() && !sw_PosOk( *pStartCrsr->GetMark() ) ) + if( pStartCursor->HasMark() && !sw_PosOk( *pStartCursor->GetMark() ) ) { - pStartCrsr->DeleteMark(); + pStartCursor->DeleteMark(); bChanged = true; } - if( !sw_PosOk( *pStartCrsr->GetPoint() ) ) + if( !sw_PosOk( *pStartCursor->GetPoint() ) ) { SwNodes & aNodes = GetDoc()->GetNodes(); - const SwNode* pStart = lcl_NodeContext( pStartCrsr->GetPoint()->nNode.GetNode() ); - SwNodeIndex aIdx( pStartCrsr->GetPoint()->nNode ); + const SwNode* pStart = lcl_NodeContext( pStartCursor->GetPoint()->nNode.GetNode() ); + SwNodeIndex aIdx( pStartCursor->GetPoint()->nNode ); SwNode * pNode = SwNodes::GoPrevious(&aIdx); if( pNode == nullptr || lcl_NodeContext( *pNode ) != pStart ) aNodes.GoNext( &aIdx ); @@ -3327,7 +3327,7 @@ void SwCrsrShell::ClearUpCrsrs() if (bFound) { SwPaM aTmpPam(*pNode); - *pStartCrsr = aTmpPam; + *pStartCursor = aTmpPam; } bChanged = true; @@ -3335,30 +3335,30 @@ void SwCrsrShell::ClearUpCrsrs() // If at least one of the cursors in the ring have been deleted or replaced, // remove the table cursor. - if (m_pTableCrsr != nullptr && bChanged) - TableCrsrToCursor(); + if (m_pTableCursor != nullptr && bChanged) + TableCursorToCursor(); } -OUString SwCrsrShell::GetCrsrDescr() const +OUString SwCursorShell::GetCursorDescr() const { OUString aResult; if (IsMultiSelection()) aResult += SW_RES(STR_MULTISEL); else - aResult = SwDoc::GetPaMDescr(*GetCrsr()); + aResult = SwDoc::GetPaMDescr(*GetCursor()); return aResult; } -void SwCrsrShell::dumpAsXml(xmlTextWriterPtr pWriter) const +void SwCursorShell::dumpAsXml(xmlTextWriterPtr pWriter) const { - xmlTextWriterStartElement(pWriter, BAD_CAST("swCrsrShell")); + xmlTextWriterStartElement(pWriter, BAD_CAST("swCursorShell")); SwViewShell::dumpAsXml(pWriter); - xmlTextWriterStartElement(pWriter, BAD_CAST("m_pCurCrsr")); - for (SwPaM& rPaM : m_pCurCrsr->GetRingContainer()) + xmlTextWriterStartElement(pWriter, BAD_CAST("m_pCurrentCursor")); + for (SwPaM& rPaM : m_pCurrentCursor->GetRingContainer()) rPaM.dumpAsXml(pWriter); xmlTextWriterEndElement(pWriter); @@ -3423,15 +3423,15 @@ static void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange, rRange = xRange; } -void SwCrsrShell::GetSmartTagTerm( uno::Sequence< OUString >& rSmartTagTypes, +void SwCursorShell::GetSmartTagTerm( uno::Sequence< OUString >& rSmartTagTypes, uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps, uno::Reference< text::XTextRange>& rRange ) const { if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() ) return; - SwPaM* pCrsr = GetCrsr(); - SwPosition aPos( *pCrsr->GetPoint() ); + SwPaM* pCursor = GetCursor(); + SwPosition aPos( *pCursor->GetPoint() ); SwTextNode *pNode = aPos.nNode.GetNode().GetTextNode(); if ( pNode && !pNode->IsInProtectSect() ) { @@ -3460,7 +3460,7 @@ void SwCrsrShell::GetSmartTagTerm( uno::Sequence< OUString >& rSmartTagTypes, } // see also SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect ) -void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, +void SwCursorShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, uno::Sequence< OUString >& rSmartTagTypes, uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps, uno::Reference<text::XTextRange>& rRange ) @@ -3468,16 +3468,16 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() ) return; - SwPaM* pCrsr = GetCrsr(); - SwPosition aPos( *pCrsr->GetPoint() ); + SwPaM* pCursor = GetCursor(); + SwPosition aPos( *pCursor->GetPoint() ); Point aPt( rPt ); - SwCrsrMoveState eTmpState( MV_SETONLYTEXT ); + SwCursorMoveState eTmpState( MV_SETONLYTEXT ); SwSpecialPos aSpecialPos; eTmpState.m_pSpecialPos = &aSpecialPos; SwTextNode *pNode; const SwWrongList *pSmartTagList; - if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) && + if( GetLayout()->GetCursorOfst( &aPos, aPt, &eTmpState ) && nullptr != (pNode = aPos.nNode.GetNode().GetTextNode()) && nullptr != (pSmartTagList = pNode->GetSmartTags()) && !pNode->IsInProtectSect() ) @@ -3505,9 +3505,9 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, //save the start and end positions of the line and the starting point Push(); LeftMargin(); - const sal_Int32 nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex(); + const sal_Int32 nLineStart = GetCursor()->GetPoint()->nContent.GetIndex(); RightMargin(); - const sal_Int32 nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex(); + const sal_Int32 nLineEnd = GetCursor()->GetPoint()->nContent.GetIndex(); Pop(false); // make sure the selection build later from the data below does not @@ -3524,9 +3524,9 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, ++nRight; aPos.nContent = nBegin + nLeft; - pCrsr = GetCrsr(); - *pCrsr->GetPoint() = aPos; - pCrsr->SetMark(); + pCursor = GetCursor(); + *pCursor->GetPoint() = aPos; + pCursor->SetMark(); ExtendSelection( true, nLen - nLeft - nRight ); // do not determine the rectangle in the current line const sal_Int32 nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft; @@ -3534,19 +3534,19 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, // be calculated const sal_Int32 nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd : (nBegin + nLen - nLeft - nRight); Push(); - pCrsr->DeleteMark(); - SwIndex& rContent = GetCrsr()->GetPoint()->nContent; + pCursor->DeleteMark(); + SwIndex& rContent = GetCursor()->GetPoint()->nContent; rContent = nWordStart; SwRect aStartRect; - SwCrsrMoveState aState; + SwCursorMoveState aState; aState.m_bRealWidth = true; - SwContentNode* pContentNode = pCrsr->GetContentNode(); - SwContentFrm *pContentFrame = pContentNode->getLayoutFrm( GetLayout(), &rPt, pCrsr->GetPoint(), false); + SwContentNode* pContentNode = pCursor->GetContentNode(); + SwContentFrame *pContentFrame = pContentNode->getLayoutFrame( GetLayout(), &rPt, pCursor->GetPoint(), false); - pContentFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState ); + pContentFrame->GetCharRect( aStartRect, *pCursor->GetPoint(), &aState ); rContent = nWordEnd - 1; SwRect aEndRect; - pContentFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState ); + pContentFrame->GetCharRect( aEndRect, *pCursor->GetPoint(),&aState ); rSelectRect = aStartRect.Union( aEndRect ); Pop(false); } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index a7f1d341cd93..f9ce84c17371 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -71,123 +71,123 @@ using namespace ::com::sun::star; -void SwCrsrShell::MoveCrsrToNum() +void SwCursorShell::MoveCursorToNum() { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); if( ActionPend() ) return; SET_CURR_SHELL( this ); // try to set cursor onto this position, at half of the char- // SRectangle's height - Point aPt( m_pCurCrsr->GetPtPos() ); - SwContentFrm * pFrm = m_pCurCrsr->GetContentNode()->getLayoutFrm( GetLayout(), &aPt, - m_pCurCrsr->GetPoint() ); - pFrm->GetCharRect( m_aCharRect, *m_pCurCrsr->GetPoint() ); - pFrm->Calc(GetOut()); - if( pFrm->IsVertical() ) + Point aPt( m_pCurrentCursor->GetPtPos() ); + SwContentFrame * pFrame = m_pCurrentCursor->GetContentNode()->getLayoutFrame( GetLayout(), &aPt, + m_pCurrentCursor->GetPoint() ); + pFrame->GetCharRect( m_aCharRect, *m_pCurrentCursor->GetPoint() ); + pFrame->Calc(GetOut()); + if( pFrame->IsVertical() ) { aPt.setX(m_aCharRect.Center().getX()); - aPt.setY(pFrm->Frm().Top() + GetUpDownX()); + aPt.setY(pFrame->Frame().Top() + GetUpDownX()); } else { aPt.setY(m_aCharRect.Center().getY()); - aPt.setX(pFrm->Frm().Left() + GetUpDownX()); + aPt.setX(pFrame->Frame().Left() + GetUpDownX()); } - pFrm->GetCrsrOfst( m_pCurCrsr->GetPoint(), aPt ); - if ( !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | + pFrame->GetCursorOfst( m_pCurrentCursor->GetPoint(), aPt ); + if ( !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS )) { - UpdateCrsr(SwCrsrShell::UPDOWN | - SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor(SwCursorShell::UPDOWN | + SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } } /// go to next/previous point on the same level -bool SwCrsrShell::GotoNextNum() +bool SwCursorShell::GotoNextNum() { - if (!SwDoc::GotoNextNum( *m_pCurCrsr->GetPoint() )) + if (!SwDoc::GotoNextNum( *m_pCurrentCursor->GetPoint() )) return false; - MoveCrsrToNum(); + MoveCursorToNum(); return true; } -bool SwCrsrShell::GotoPrevNum() +bool SwCursorShell::GotoPrevNum() { - if (!SwDoc::GotoPrevNum( *m_pCurCrsr->GetPoint() )) + if (!SwDoc::GotoPrevNum( *m_pCurrentCursor->GetPoint() )) return false; - MoveCrsrToNum(); + MoveCursorToNum(); return true; } /// jump from content to header -bool SwCrsrShell::GotoHeaderText() +bool SwCursorShell::GotoHeaderText() { - const SwFrm* pFrm = GetCurrFrm()->FindPageFrm(); - while( pFrm && !pFrm->IsHeaderFrm() ) - pFrm = pFrm->GetLower(); + const SwFrame* pFrame = GetCurrFrame()->FindPageFrame(); + while( pFrame && !pFrame->IsHeaderFrame() ) + pFrame = pFrame->GetLower(); // found header, search 1. content frame - while( pFrm && !pFrm->IsContentFrm() ) - pFrm = pFrm->GetLower(); + while( pFrame && !pFrame->IsContentFrame() ) + pFrame = pFrame->GetLower(); - if( pFrm ) + if( pFrame ) { SET_CURR_SHELL( this ); // get header frame - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCursor *pTmpCrsr = getShellCrsr( true ); - SwCrsrSaveState aSaveState( *pTmpCrsr ); - pFrm->Calc(GetOut()); - Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() ); - pFrm->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt ); - if( !pTmpCrsr->IsSelOvr() ) - UpdateCrsr(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursor *pTmpCursor = getShellCursor( true ); + SwCursorSaveState aSaveState( *pTmpCursor ); + pFrame->Calc(GetOut()); + Point aPt( pFrame->Frame().Pos() + pFrame->Prt().Pos() ); + pFrame->GetCursorOfst( pTmpCursor->GetPoint(), aPt ); + if( !pTmpCursor->IsSelOvr() ) + UpdateCursor(); else - pFrm = nullptr; + pFrame = nullptr; } - return nullptr != pFrm; + return nullptr != pFrame; } /// jump from content to footer -bool SwCrsrShell::GotoFooterText() +bool SwCursorShell::GotoFooterText() { - const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm(); - if( pFrm ) + const SwPageFrame* pFrame = GetCurrFrame()->FindPageFrame(); + if( pFrame ) { - const SwFrm* pLower = pFrm->GetLastLower(); + const SwFrame* pLower = pFrame->GetLastLower(); - while( pLower && !pLower->IsFooterFrm() ) + while( pLower && !pLower->IsFooterFrame() ) pLower = pLower->GetLower(); // found footer, search 1. content frame - while( pLower && !pLower->IsContentFrm() ) + while( pLower && !pLower->IsContentFrame() ) pLower = pLower->GetLower(); if( pLower ) { - SwCursor *pTmpCrsr = getShellCrsr( true ); + SwCursor *pTmpCursor = getShellCursor( true ); SET_CURR_SHELL( this ); // get position in footer - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pTmpCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pTmpCursor ); pLower->Calc(GetOut()); - Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() ); - pLower->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt ); - if( !pTmpCrsr->IsSelOvr() ) - UpdateCrsr(); + Point aPt( pLower->Frame().Pos() + pLower->Prt().Pos() ); + pLower->GetCursorOfst( pTmpCursor->GetPoint(), aPt ); + if( !pTmpCursor->IsSelOvr() ) + UpdateCursor(); else - pFrm = nullptr; + pFrame = nullptr; } else - pFrm = nullptr; + pFrame = nullptr; } else - pFrm = nullptr; - return nullptr != pFrm; + pFrame = nullptr; + return nullptr != pFrame; } -bool SwCrsrShell::SetCrsrInHdFt( size_t nDescNo, bool bInHeader ) +bool SwCursorShell::SetCursorInHdFt( size_t nDescNo, bool bInHeader ) { bool bRet = false; SwDoc *pMyDoc = GetDoc(); @@ -198,7 +198,7 @@ bool SwCrsrShell::SetCrsrInHdFt( size_t nDescNo, bool bInHeader ) if( SIZE_MAX == nDescNo ) { // take the current one - const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm(); + const SwPageFrame* pPage = GetCurrFrame()->FindPageFrame(); if( pPage && pMyDoc->ContainsPageDesc( pPage->GetPageDesc(), &nDescNo) ) pDesc = pPage->GetPageDesc(); @@ -232,24 +232,24 @@ bool SwCrsrShell::SetCrsrInHdFt( size_t nDescNo, bool bInHeader ) if( !pCNd ) pCNd = pMyDoc->GetNodes().GoNext( &aIdx ); - Point aPt( m_pCurCrsr->GetPtPos() ); + Point aPt( m_pCurrentCursor->GetPtPos() ); - if( pCNd && nullptr != pCNd->getLayoutFrm( GetLayout(), &aPt, nullptr, false ) ) + if( pCNd && nullptr != pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) { // then we can set the cursor in here - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); ClearMark(); - SwPosition& rPos = *m_pCurCrsr->GetPoint(); + SwPosition& rPos = *m_pCurrentCursor->GetPoint(); rPos.nNode = *pCNd; rPos.nContent.Assign( pCNd, 0 ); - bRet = !m_pCurCrsr->IsSelOvr(); + bRet = !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } } } @@ -257,7 +257,7 @@ bool SwCrsrShell::SetCrsrInHdFt( size_t nDescNo, bool bInHeader ) } /// jump to the next index -bool SwCrsrShell::GotoNextTOXBase( const OUString* pName ) +bool SwCursorShell::GotoNextTOXBase( const OUString* pName ) { bool bRet = false; @@ -271,7 +271,7 @@ bool SwCrsrShell::GotoNextTOXBase( const OUString* pName ) SwSectionNode const*const pSectNd( pSect->GetFormat()->GetSectionNode()); if ( pSectNd - && m_pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() + && m_pCurrentCursor->GetPoint()->nNode < pSectNd->GetIndex() && (!pFnd || pFnd->GetIndex() > pSectNd->GetIndex()) && (!pName || *pName == static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName())) @@ -283,10 +283,10 @@ bool SwCrsrShell::GotoNextTOXBase( const OUString* pName ) if (pCNd && pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex()) { - SwContentFrm const*const pCFrm( - pCNd->getLayoutFrm(GetLayout())); - if (pCFrm && - (IsReadOnlyAvailable() || !pCFrm->IsProtected())) + SwContentFrame const*const pCFrame( + pCNd->getLayoutFrame(GetLayout())); + if (pCFrame && + (IsReadOnlyAvailable() || !pCFrame->IsProtected())) { pFnd = pCNd; } @@ -296,19 +296,19 @@ bool SwCrsrShell::GotoNextTOXBase( const OUString* pName ) } if( pFnd ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->GetPoint()->nNode = *pFnd; - m_pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 ); - bRet = !m_pCurCrsr->IsSelOvr(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->GetPoint()->nNode = *pFnd; + m_pCurrentCursor->GetPoint()->nContent.Assign( pFnd, 0 ); + bRet = !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } /// jump to previous index -bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName ) +bool SwCursorShell::GotoPrevTOXBase( const OUString* pName ) { bool bRet = false; @@ -322,7 +322,7 @@ bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName ) SwSectionNode const*const pSectNd( pSect->GetFormat()->GetSectionNode()); if ( pSectNd - && m_pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() + && m_pCurrentCursor->GetPoint()->nNode > pSectNd->EndOfSectionIndex() && (!pFnd || pFnd->GetIndex() < pSectNd->GetIndex()) && (!pName || *pName == static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName())) @@ -334,10 +334,10 @@ bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName ) if (pCNd && pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex()) { - SwContentFrm const*const pCFrm( - pCNd->getLayoutFrm(GetLayout())); - if (pCFrm && - (IsReadOnlyAvailable() || !pCFrm->IsProtected())) + SwContentFrame const*const pCFrame( + pCNd->getLayoutFrame(GetLayout())); + if (pCFrame && + (IsReadOnlyAvailable() || !pCFrame->IsProtected())) { pFnd = pCNd; } @@ -348,24 +348,24 @@ bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName ) if( pFnd ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->GetPoint()->nNode = *pFnd; - m_pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 ); - bRet = !m_pCurCrsr->IsSelOvr(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->GetPoint()->nNode = *pFnd; + m_pCurrentCursor->GetPoint()->nContent.Assign( pFnd, 0 ); + bRet = !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } /// jump to index of TOXMark -bool SwCrsrShell::GotoTOXMarkBase() +bool SwCursorShell::GotoTOXMarkBase() { bool bRet = false; SwTOXMarks aMarks; - sal_uInt16 nCnt = SwDoc::GetCurTOXMark( *m_pCurCrsr->GetPoint(), aMarks ); + sal_uInt16 nCnt = SwDoc::GetCurTOXMark( *m_pCurrentCursor->GetPoint(), aMarks ); if( nCnt ) { // Take the 1. and get the index type. Search in its dependency list @@ -385,20 +385,20 @@ bool SwCrsrShell::GotoTOXMarkBase() SwContentNode* pCNd = aIdx.GetNode().GetContentNode(); if( !pCNd ) pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - const SwContentFrm* pCFrm; + const SwContentFrame* pCFrame; if( pCNd && pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() && - nullptr != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) && - ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) + nullptr != ( pCFrame = pCNd->getLayoutFrame( GetLayout() ) ) && + ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->GetPoint()->nNode = *pCNd; - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 ); - bRet = !m_pCurCrsr->IsInProtectTable() && - !m_pCurCrsr->IsSelOvr(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->GetPoint()->nNode = *pCNd; + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 ); + bRet = !m_pCurrentCursor->IsInProtectTable() && + !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); break; } } @@ -409,13 +409,13 @@ bool SwCrsrShell::GotoTOXMarkBase() /// Jump to next/previous table formula /// Optionally it is possible to also jump to broken formulas -bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) +bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) { if( IsTableMode() ) return false; bool bFnd = false; - SwPosition& rPos = *m_pCurCrsr->GetPoint(); + SwPosition& rPos = *m_pCurrentCursor->GetPoint(); Point aPt; SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() ); @@ -436,7 +436,7 @@ bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() ) // also at collection use only the first frame - aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetContentNode()->getLayoutFrm( GetLayout(), + aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetContentNode()->getLayoutFrame( GetLayout(), &aPt, &rPos, false ) ); { sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA ); @@ -453,14 +453,14 @@ bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) ( !bOnlyErrors || !static_cast<const SwTableBoxFormula*>(pItem)->HasValidBoxes() ) ) { - const SwContentFrm* pCFrm; + const SwContentFrame* pCFrame; SwNodeIndex aIdx( *pTBox->GetSttNd() ); const SwContentNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - if( pCNd && nullptr != ( pCFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, nullptr, false ) ) && - (IsReadOnlyAvailable() || !pCFrm->IsProtected() )) + if( pCNd && nullptr != ( pCFrame = pCNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false ) ) && + (IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { _SetGetExpField aCmp( *pTBox ); - aCmp.SetBodyPos( *pCFrm ); + aCmp.SetBodyPos( *pCFrame ); if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF ) : ( aCmp < aCurGEF && aFndGEF < aCmp )) @@ -476,28 +476,28 @@ bool SwCrsrShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) if( bFnd ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); aFndGEF.GetPosOfContent( rPos ); - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); - bFnd = !m_pCurCrsr->IsSelOvr(); + bFnd = !m_pCurrentCursor->IsSelOvr(); if( bFnd ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } return bFnd; } /// jump to next/previous index marker -bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext ) +bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) { if( IsTableMode() ) return false; bool bFnd = false; - SwPosition& rPos = *m_pCurCrsr->GetPoint(); + SwPosition& rPos = *m_pCurrentCursor->GetPoint(); Point aPt; SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() ); @@ -508,7 +508,7 @@ bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext ) if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() ) // also at collection use only the first frame aCurGEF.SetBodyPos( *rPos.nNode.GetNode(). - GetContentNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) ); + GetContentNode()->getLayoutFrame( GetLayout(), &aPt, &rPos, false ) ); { const SwTextNode* pTextNd; @@ -518,18 +518,18 @@ bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext ) for( n = 0; n < nMaxItems; ++n ) { const SfxPoolItem* pItem; - const SwContentFrm* pCFrm; + const SwContentFrame* pCFrame; if( nullptr != (pItem = GetDoc()->GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, n ) ) && nullptr != (pTextTOX = static_cast<const SwTOXMark*>(pItem)->GetTextTOXMark() ) && ( pTextNd = &pTextTOX->GetTextNode())->GetNodes().IsDocNodes() && - nullptr != ( pCFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt, nullptr, false )) && - ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) + nullptr != ( pCFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt, nullptr, false )) && + ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object _SetGetExpField aCmp( aNdIndex, *pTextTOX, nullptr ); - aCmp.SetBodyPos( *pCFrm ); + aCmp.SetBodyPos( *pCFrame ); if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF ) : ( aCmp < aCurGEF && aFndGEF < aCmp )) @@ -544,38 +544,38 @@ bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext ) if( bFnd ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); aFndGEF.GetPosOfContent( rPos ); - bFnd = !m_pCurCrsr->IsSelOvr(); + bFnd = !m_pCurrentCursor->IsSelOvr(); if( bFnd ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } return bFnd; } /// traveling between marks -const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart, +const SwTOXMark& SwCursorShell::GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir, IsReadOnlyAvailable() ); // set position - SwPosition& rPos = *GetCrsr()->GetPoint(); + SwPosition& rPos = *GetCursor()->GetPoint(); rPos.nNode = rNewMark.GetTextTOXMark()->GetTextNode(); rPos.nContent.Assign( rPos.nNode.GetNode().GetContentNode(), rNewMark.GetTextTOXMark()->GetStart() ); - if( !m_pCurCrsr->IsSelOvr() ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + if( !m_pCurrentCursor->IsSelOvr() ) + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); return rNewMark; } @@ -599,13 +599,13 @@ void lcl_MakeFieldLst( || static_cast<const SwSetExpField*>(pTextField->GetFormatField().GetField())->GetInputFlag() ) ) { const SwTextNode& rTextNode = pTextField->GetTextNode(); - const SwContentFrm* pCFrm = - rTextNode.getLayoutFrm( rTextNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); - if ( pCFrm != nullptr - && ( bInReadOnly || !pCFrm->IsProtected() ) ) + const SwContentFrame* pCFrame = + rTextNode.getLayoutFrame( rTextNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, nullptr, false ); + if ( pCFrame != nullptr + && ( bInReadOnly || !pCFrame->IsProtected() ) ) { _SetGetExpField* pNew = new _SetGetExpField( SwNodeIndex( rTextNode ), pTextField ); - pNew->SetBodyPos( *pCFrm ); + pNew->SetBodyPos( *pCFrame ); rLst.insert( pNew ); } } @@ -614,7 +614,7 @@ void lcl_MakeFieldLst( static _SetGetExpFields::const_iterator lcl_FindField(bool & o_rFound, _SetGetExpFields const& rSrtLst, - SwRootFrm *const pLayout, SwTextNode *const pTextNode, + SwRootFrame *const pLayout, SwTextNode *const pTextNode, SwTextField *const pTextField, SwPosition const& rPos, sal_Int32 const nContentOffset) { @@ -634,7 +634,7 @@ lcl_FindField(bool & o_rFound, _SetGetExpFields const& rSrtLst, { // also at collection use only the first frame Point aPt; - pSrch->SetBodyPos(*pTextNode->getLayoutFrm(pLayout, &aPt, &rPos, false)); + pSrch->SetBodyPos(*pTextNode->getLayoutFrame(pLayout, &aPt, &rPos, false)); } _SetGetExpFields::const_iterator it = rSrtLst.lower_bound(pSrch.get()); @@ -643,7 +643,7 @@ lcl_FindField(bool & o_rFound, _SetGetExpFields const& rSrtLst, return it; } -bool SwCrsrShell::MoveFieldType( +bool SwCursorShell::MoveFieldType( const SwFieldType* pFieldType, const bool bNext, const sal_uInt16 nResType, @@ -696,12 +696,12 @@ bool SwCrsrShell::MoveFieldType( return false; _SetGetExpFields::const_iterator it; - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); { // (1998): Always use field for search so that the right one is found as // well some are in frames that are anchored to a paragraph that has a // field - const SwPosition& rPos = *pCrsr->GetPoint(); + const SwPosition& rPos = *pCursor->GetPoint(); SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode(); OSL_ENSURE( pTNd, "No ContentNode" ); @@ -770,40 +770,40 @@ bool SwCrsrShell::MoveFieldType( const _SetGetExpField& rFnd = **it; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); - rFnd.GetPosOfContent( *pCrsr->GetPoint() ); - bool bRet = !m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | + rFnd.GetPosOfContent( *pCursor->GetPoint() ); + bool bRet = !m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return bRet; } -bool SwCrsrShell::GotoFormatField( const SwFormatField& rField ) +bool SwCursorShell::GotoFormatField( const SwFormatField& rField ) { bool bRet = false; if( rField.GetTextField() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves + SwCallLink aLk( *this ); // watch Cursor-Moves - SwCursor* pCrsr = getShellCrsr( true ); - SwCrsrSaveState aSaveState( *pCrsr ); + SwCursor* pCursor = getShellCursor( true ); + SwCursorSaveState aSaveState( *pCursor ); SwTextNode* pTNd = rField.GetTextField()->GetpTextNode(); - pCrsr->GetPoint()->nNode = *pTNd; - pCrsr->GetPoint()->nContent.Assign( pTNd, rField.GetTextField()->GetStart() ); + pCursor->GetPoint()->nNode = *pTNd; + pCursor->GetPoint()->nContent.Assign( pTNd, rField.GetTextField()->GetStart() ); - bRet = !pCrsr->IsSelOvr(); + bRet = !pCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } -SwTextField * SwCrsrShell::GetTextFieldAtPos( +SwTextField * SwCursorShell::GetTextFieldAtPos( const SwPosition* pPos, const bool bIncludeInputFieldAtStart ) { @@ -818,77 +818,77 @@ SwTextField * SwCrsrShell::GetTextFieldAtPos( return pTextField; } -SwField* SwCrsrShell::GetFieldAtCrsr( - const SwPaM* pCrsr, +SwField* SwCursorShell::GetFieldAtCursor( + const SwPaM* pCursor, const bool bIncludeInputFieldAtStart ) { - SwField* pFieldAtCrsr = nullptr; + SwField* pFieldAtCursor = nullptr; - SwTextField* pTextField = GetTextFieldAtPos( pCrsr->Start(), bIncludeInputFieldAtStart ); + SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), bIncludeInputFieldAtStart ); if ( pTextField != nullptr - && pCrsr->Start()->nNode == pCrsr->End()->nNode ) + && pCursor->Start()->nNode == pCursor->End()->nNode ) { const sal_Int32 nTextFieldLength = pTextField->End() != nullptr ? *(pTextField->End()) - pTextField->GetStart() : 1; - if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTextFieldLength ) + if ( ( pCursor->End()->nContent.GetIndex() - pCursor->Start()->nContent.GetIndex() ) <= nTextFieldLength ) { - pFieldAtCrsr = const_cast<SwField*>(pTextField->GetFormatField().GetField()); + pFieldAtCursor = const_cast<SwField*>(pTextField->GetFormatField().GetField()); } } - return pFieldAtCrsr; + return pFieldAtCursor; } -SwField* SwCrsrShell::GetCurField( const bool bIncludeInputFieldAtStart ) const +SwField* SwCursorShell::GetCurField( const bool bIncludeInputFieldAtStart ) const { - SwPaM* pCrsr = GetCrsr(); - if ( pCrsr->IsMultiSelection() ) + SwPaM* pCursor = GetCursor(); + if ( pCursor->IsMultiSelection() ) { // multi selection not handled. return nullptr; } - SwField* pCurField = GetFieldAtCrsr( pCrsr, bIncludeInputFieldAtStart );; + SwField* pCurField = GetFieldAtCursor( pCursor, bIncludeInputFieldAtStart );; if ( pCurField != nullptr && RES_TABLEFLD == pCurField->GetTyp()->Which() ) { // TabellenFormel ? wandel internen in externen Namen um - const SwTableNode* pTableNd = IsCrsrInTable(); + const SwTableNode* pTableNd = IsCursorInTable(); static_cast<SwTableField*>(pCurField)->PtrToBoxNm( pTableNd ? &pTableNd->GetTable() : nullptr ); } return pCurField; } -bool SwCrsrShell::CrsrInsideInputField() const +bool SwCursorShell::CursorInsideInputField() const { - for(SwPaM& rCrsr : GetCrsr()->GetRingContainer()) + for(SwPaM& rCursor : GetCursor()->GetRingContainer()) { - if(dynamic_cast<const SwInputField*>(GetFieldAtCrsr( &rCrsr, false ))) + if(dynamic_cast<const SwInputField*>(GetFieldAtCursor( &rCursor, false ))) return true; } return false; } -bool SwCrsrShell::PosInsideInputField( const SwPosition& rPos ) +bool SwCursorShell::PosInsideInputField( const SwPosition& rPos ) { return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, false )) != nullptr; } -bool SwCrsrShell::DocPtInsideInputField( const Point& rDocPt ) const +bool SwCursorShell::DocPtInsideInputField( const Point& rDocPt ) const { - SwPosition aPos( *(GetCrsr()->Start()) ); + SwPosition aPos( *(GetCursor()->Start()) ); Point aDocPt( rDocPt ); - if ( GetLayout()->GetCrsrOfst( &aPos, aDocPt ) ) + if ( GetLayout()->GetCursorOfst( &aPos, aDocPt ) ) { return PosInsideInputField( aPos ); } return false; } -sal_Int32 SwCrsrShell::StartOfInputFieldAtPos( const SwPosition& rPos ) +sal_Int32 SwCursorShell::StartOfInputFieldAtPos( const SwPosition& rPos ) { const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true )); if ( pTextInputField == nullptr ) @@ -899,7 +899,7 @@ sal_Int32 SwCrsrShell::StartOfInputFieldAtPos( const SwPosition& rPos ) return pTextInputField->GetStart(); } -sal_Int32 SwCrsrShell::EndOfInputFieldAtPos( const SwPosition& rPos ) +sal_Int32 SwCursorShell::EndOfInputFieldAtPos( const SwPosition& rPos ) { const SwTextInputField* pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, true )); if ( pTextInputField == nullptr ) @@ -910,47 +910,47 @@ sal_Int32 SwCrsrShell::EndOfInputFieldAtPos( const SwPosition& rPos ) return *(pTextInputField->End()); } -void SwCrsrShell::GotoOutline( sal_uInt16 nIdx ) +void SwCursorShell::GotoOutline( sal_uInt16 nIdx ) { - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); const SwNodes& rNds = GetDoc()->GetNodes(); SwTextNode* pTextNd = rNds.GetOutLineNds()[ nIdx ]->GetTextNode(); - pCrsr->GetPoint()->nNode = *pTextNd; - pCrsr->GetPoint()->nContent.Assign( pTextNd, 0 ); + pCursor->GetPoint()->nNode = *pTextNd; + pCursor->GetPoint()->nContent.Assign( pTextNd, 0 ); - if( !pCrsr->IsSelOvr() ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + if( !pCursor->IsSelOvr() ) + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } -bool SwCrsrShell::GotoOutline( const OUString& rName ) +bool SwCursorShell::GotoOutline( const OUString& rName ) { - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); bool bRet = false; - if( mpDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() ) + if( mpDoc->GotoOutline( *pCursor->GetPoint(), rName ) && !pCursor->IsSelOvr() ) { - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); bRet = true; } return bRet; } /// jump to next node with outline num. -bool SwCrsrShell::GotoNextOutline() +bool SwCursorShell::GotoNextOutline() { - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); const SwNodes& rNds = GetDoc()->GetNodes(); - SwNode* pNd = &(pCrsr->GetNode()); + SwNode* pNd = &(pCursor->GetNode()); sal_uInt16 nPos; if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos )) ++nPos; @@ -961,24 +961,24 @@ bool SwCrsrShell::GotoNextOutline() pNd = rNds.GetOutLineNds()[ nPos ]; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); - pCrsr->GetPoint()->nNode = *pNd; - pCrsr->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); + pCursor->GetPoint()->nNode = *pNd; + pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 ); - bool bRet = !pCrsr->IsSelOvr(); + bool bRet = !pCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return bRet; } /// jump to previous node with outline num. -bool SwCrsrShell::GotoPrevOutline() +bool SwCursorShell::GotoPrevOutline() { - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); const SwNodes& rNds = GetDoc()->GetNodes(); - SwNode* pNd = &(pCrsr->GetNode()); + SwNode* pNd = &(pCursor->GetNode()); sal_uInt16 nPos; bool bRet = rNds.GetOutLineNds().Seek_Entry(pNd, &nPos); if (bRet && nPos) @@ -986,29 +986,29 @@ bool SwCrsrShell::GotoPrevOutline() --nPos; // before pNd = rNds.GetOutLineNds()[ nPos ]; - if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() ) + if( pNd->GetIndex() > pCursor->GetPoint()->nNode.GetIndex() ) return false; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); - pCrsr->GetPoint()->nNode = *pNd; - pCrsr->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); + pCursor->GetPoint()->nNode = *pNd; + pCursor->GetPoint()->nContent.Assign( pNd->GetTextNode(), 0 ); - bRet = !pCrsr->IsSelOvr(); + bRet = !pCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } /// search "outline position" before previous outline node at given level -sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel ) +sal_uInt16 SwCursorShell::GetOutlinePos( sal_uInt8 nLevel ) { - SwPaM* pCrsr = getShellCrsr( true ); + SwPaM* pCursor = getShellCursor( true ); const SwNodes& rNds = GetDoc()->GetNodes(); - SwNode* pNd = &(pCrsr->GetNode()); + SwNode* pNd = &(pCursor->GetNode()); sal_uInt16 nPos; if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos )) nPos++; // is at correct position; take next for while @@ -1024,7 +1024,7 @@ sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel ) return USHRT_MAX; // no more left } -bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, +bool SwCursorShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, bool bWithChildren ) { const SwNodes& rNds = GetDoc()->GetNodes(); @@ -1033,7 +1033,7 @@ bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, return false; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves + SwCallLink aLk( *this ); // watch Cursor-Moves if( nSttPos > nEndPos ) // parameters switched? { @@ -1066,57 +1066,57 @@ bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, KillPams(); - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCursorSaveState aSaveState( *m_pCurrentCursor ); // set end to the end of the previous content node - m_pCurCrsr->GetPoint()->nNode = *pSttNd; - m_pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetContentNode(), 0 ); - m_pCurCrsr->SetMark(); - m_pCurCrsr->GetPoint()->nNode = *pEndNd; - m_pCurCrsr->Move( fnMoveBackward, fnGoNode ); // end of predecessor + m_pCurrentCursor->GetPoint()->nNode = *pSttNd; + m_pCurrentCursor->GetPoint()->nContent.Assign( pSttNd->GetContentNode(), 0 ); + m_pCurrentCursor->SetMark(); + m_pCurrentCursor->GetPoint()->nNode = *pEndNd; + m_pCurrentCursor->Move( fnMoveBackward, fnGoNode ); // end of predecessor // and everything is already selected - bool bRet = !m_pCurCrsr->IsSelOvr(); + bool bRet = !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return bRet; } /// jump to reference marker -bool SwCrsrShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, +bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); sal_Int32 nPos = -1; SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark, nSubType, nSeqNo, &nPos ); if( pTextNd && pTextNd->GetNodes().IsDocNodes() ) { - m_pCurCrsr->GetPoint()->nNode = *pTextNd; - m_pCurCrsr->GetPoint()->nContent.Assign( pTextNd, nPos ); + m_pCurrentCursor->GetPoint()->nNode = *pTextNd; + m_pCurrentCursor->GetPoint()->nContent.Assign( pTextNd, nPos ); - if( !m_pCurCrsr->IsSelOvr() ) + if( !m_pCurrentCursor->IsSelOvr() ) { - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return true; } } return false; } -bool SwCrsrShell::IsPageAtPos( const Point &rPt ) const +bool SwCursorShell::IsPageAtPos( const Point &rPt ) const { if( GetLayout() ) return nullptr != GetLayout()->GetPageAtPos( rPt ); return false; } -bool SwCrsrShell::GetContentAtPos( const Point& rPt, +bool SwCursorShell::GetContentAtPos( const Point& rPt, SwContentAtPos& rContentAtPos, - bool bSetCrsr, + bool bSetCursor, SwRect* pFieldRect ) { SET_CURR_SHELL( this ); @@ -1125,12 +1125,12 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( !IsTableMode() ) { Point aPt( rPt ); - SwPosition aPos( *m_pCurCrsr->GetPoint() ); + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); SwTextNode* pTextNd; - SwContentFrm *pFrm(nullptr); + SwContentFrame *pFrame(nullptr); SwTextAttr* pTextAttr; - SwCrsrMoveState aTmpState; + SwCursorMoveState aTmpState; aTmpState.m_bFieldInfo = true; aTmpState.m_bExactOnly = !( SwContentAtPos::SW_OUTLINE & rContentAtPos.eContentAtPos ); aTmpState.m_bContentCheck = (SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos) != 0; @@ -1140,7 +1140,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, aTmpState.m_pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rContentAtPos.eContentAtPos ) ? &aSpecialPos : nullptr; - const bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ); + const bool bCursorFoundExact = GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ); pTextNd = aPos.nNode.GetNode().GetTextNode(); const SwNodes& rNds = GetDoc()->GetNodes(); @@ -1157,7 +1157,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, } } else if ( SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos - && bCrsrFoundExact ) + && bCursorFoundExact ) { bRet = true; } @@ -1171,7 +1171,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic); rContentAtPos.nDist = aSizePixel.Width(); } - else if( bCrsrFoundExact && pTextNd ) + else if( bCursorFoundExact && pTextNd ) { if( !aTmpState.m_bPosCorr ) { @@ -1198,23 +1198,23 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, else bRet = true; - if( bRet && bSetCrsr ) + if( bRet && bSetCursor ) { - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - SwCallLink aLk( *this ); // watch Crsr-Moves - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = aPos; - if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) ) + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + SwCallLink aLk( *this ); // watch Cursor-Moves + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = aPos; + if( m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) ) bRet = false; else - UpdateCrsr(); + UpdateCursor(); } if( bRet ) { rContentAtPos.eContentAtPos = SwContentAtPos::SW_SMARTTAG; - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } } @@ -1235,16 +1235,16 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, if ( pField ) { - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); - if( bSetCrsr ) + if( bSetCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = aPos; - if( m_pCurCrsr->IsSelOvr() ) + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = aPos; + if( m_pCurrentCursor->IsSelOvr() ) { // allow click fields in protected sections // only placeholder is not possible @@ -1253,7 +1253,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, pField = nullptr; } else - UpdateCrsr(); + UpdateCursor(); } else if( RES_TABLEFLD == pField->Which() && static_cast<const SwTableField*>(pField)->IsIntrnlName() ) @@ -1279,7 +1279,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, { IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos ); - if( bCrsrFoundExact && pTextNd && pFieldBookmark) { + if( bCursorFoundExact && pTextNd && pFieldBookmark) { rContentAtPos.eContentAtPos = SwContentAtPos::SW_FORMCTRL; rContentAtPos.aFnd.pFieldmark = pFieldBookmark; bRet=true; @@ -1292,9 +1292,9 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, { // over the footnote's char bRet = true; - if( bSetCrsr ) + if( bSetCursor ) { - *m_pCurCrsr->GetPoint() = aPos; + *m_pCurrentCursor->GetPoint() = aPos; if( !GotoFootnoteAnchor() ) bRet = false; } @@ -1305,23 +1305,23 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, aPos.nContent.GetIndex(), RES_TXTATR_FTN )) ) { bRet = true; - if( bSetCrsr ) + if( bSetCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode(); SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( - &m_pCurCrsr->GetPoint()->nNode, + &m_pCurrentCursor->GetPoint()->nNode, true, !IsReadOnlyAvailable() ); if( pCNd ) { - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 ); - if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 ); + if( m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE )) bRet = false; else - UpdateCrsr(); + UpdateCursor(); } else bRet = false; @@ -1333,8 +1333,8 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } } @@ -1370,16 +1370,16 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( pTextAttr ) { bRet = true; - if( bSetCrsr ) + if( bSetCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = aPos; - if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = aPos; + if( m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) bRet = false; else - UpdateCrsr(); + UpdateCursor(); } if( bRet ) @@ -1399,8 +1399,8 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } } @@ -1415,17 +1415,17 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( pTextAttr && !pTextAttr->GetINetFormat().GetValue().isEmpty() ) { bRet = true; - if( bSetCrsr ) + if( bSetCursor ) { - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - SwCallLink aLk( *this ); // watch Crsr-Moves - m_pCurCrsr->DeleteMark(); - *m_pCurCrsr->GetPoint() = aPos; - if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + SwCallLink aLk( *this ); // watch Cursor-Moves + m_pCurrentCursor->DeleteMark(); + *m_pCurrentCursor->GetPoint() = aPos; + if( m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) ) bRet = false; else - UpdateCrsr(); + UpdateCursor(); } if( bRet ) { @@ -1437,8 +1437,8 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, rContentAtPos.eContentAtPos = SwContentAtPos::SW_INETATTR; rContentAtPos.pFndTextAttr = pTextAttr; - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } } @@ -1453,8 +1453,8 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, rContentAtPos.pFndTextAttr = nullptr; bRet = true; - if( pFieldRect && nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt ) ) ) - pFrm->GetCharRect( *pFieldRect, aPos, &aTmpState ); + if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) + pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); } } } @@ -1484,22 +1484,22 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, #endif ) { - SwFrm* pF = pTextNd->getLayoutFrm( GetLayout(), &aPt ); + SwFrame* pF = pTextNd->getLayoutFrame( GetLayout(), &aPt ); if( pF ) { // then the CellFrame - pFrm = static_cast<SwContentFrm*>(pF); - while( pF && !pF->IsCellFrm() ) + pFrame = static_cast<SwContentFrame*>(pF); + while( pF && !pF->IsCellFrame() ) pF = pF->GetUpper(); } if( aTmpState.m_bPosCorr ) { - if( pF && !pF->Frm().IsInside( aPt )) + if( pF && !pF->Frame().IsInside( aPt )) pF = nullptr; } else if( !pF ) - pF = pFrm; + pF = pFrame; if( pF ) // only then it is valid { @@ -1514,16 +1514,16 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, const_cast<SwTableBoxFormula*>(static_cast<const SwTableBoxFormula*>(pItem))->PtrToBoxNm( &pTableNd->GetTable() ); bRet = true; - if( bSetCrsr ) + if( bSetCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); - *m_pCurCrsr->GetPoint() = aPos; - if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); + *m_pCurrentCursor->GetPoint() = aPos; + if( m_pCurrentCursor->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) ) bRet = false; else - UpdateCrsr(); + UpdateCursor(); } if( bRet ) @@ -1531,7 +1531,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( pFieldRect ) { *pFieldRect = pF->Prt(); - *pFieldRect += pF->Frm().Pos(); + *pFieldRect += pF->Frame().Pos(); } rContentAtPos.pFndTextAttr = nullptr; rContentAtPos.aFnd.pAttr = pItem; @@ -1633,13 +1633,13 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, } // #i90516# -const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const +const SwPostItField* SwCursorShell::GetPostItFieldAtCursor() const { const SwPostItField* pPostItField = nullptr; if ( !IsTableMode() ) { - const SwPosition* pCursorPos = _GetCrsr()->GetPoint(); + const SwPosition* pCursorPos = _GetCursor()->GetPoint(); const SwTextNode* pTextNd = pCursorPos->nNode.GetNode().GetTextNode(); if ( pTextNd ) { @@ -1681,10 +1681,10 @@ bool SwContentAtPos::IsInProtectSect() const } } - const SwContentFrm* pFrm; + const SwContentFrame* pFrame; return pNd && ( pNd->IsInProtectSect() || - ( nullptr != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false)) && - pFrm->IsProtected() )); + ( nullptr != ( pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr, false)) && + pFrame->IsProtected() )); } bool SwContentAtPos::IsInRTLText()const @@ -1706,46 +1706,46 @@ bool SwContentAtPos::IsInRTLText()const } if(pNd) { - SwIterator<SwTextFrm,SwTextNode> aIter(*pNd); - SwTextFrm* pTmpFrm = aIter.First(); - while( pTmpFrm ) + SwIterator<SwTextFrame,SwTextNode> aIter(*pNd); + SwTextFrame* pTmpFrame = aIter.First(); + while( pTmpFrame ) { - if ( !pTmpFrm->IsFollow()) + if ( !pTmpFrame->IsFollow()) { - bRet = pTmpFrm->IsRightToLeft(); + bRet = pTmpFrame->IsRightToLeft(); break; } - pTmpFrm = aIter.Next(); + pTmpFrame = aIter.Next(); } } return bRet; } -bool SwCrsrShell::SelectText( const sal_Int32 nStart, +bool SwCursorShell::SelectText( const sal_Int32 nStart, const sal_Int32 nEnd ) { SET_CURR_SHELL( this ); bool bRet = false; SwCallLink aLk( *this ); - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCursorSaveState aSaveState( *m_pCurrentCursor ); - SwPosition& rPos = *m_pCurCrsr->GetPoint(); - m_pCurCrsr->DeleteMark(); + SwPosition& rPos = *m_pCurrentCursor->GetPoint(); + m_pCurrentCursor->DeleteMark(); rPos.nContent = nStart; - m_pCurCrsr->SetMark(); + m_pCurrentCursor->SetMark(); rPos.nContent = nEnd; - if( !m_pCurCrsr->IsSelOvr() ) + if( !m_pCurrentCursor->IsSelOvr() ) { - UpdateCrsr(); + UpdateCursor(); bRet = true; } return bRet; } -bool SwCrsrShell::SelectTextAttr( sal_uInt16 nWhich, +bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich, bool bExpand, const SwTextAttr* pTextAttr ) { @@ -1756,7 +1756,7 @@ bool SwCrsrShell::SelectTextAttr( sal_uInt16 nWhich, { if( !pTextAttr ) { - SwPosition& rPos = *m_pCurCrsr->GetPoint(); + SwPosition& rPos = *m_pCurrentCursor->GetPoint(); SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode(); pTextAttr = (pTextNd) ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(), @@ -1774,33 +1774,33 @@ bool SwCrsrShell::SelectTextAttr( sal_uInt16 nWhich, return bRet; } -bool SwCrsrShell::GotoINetAttr( const SwTextINetFormat& rAttr ) +bool SwCursorShell::GotoINetAttr( const SwTextINetFormat& rAttr ) { bool bRet = false; if( rAttr.GetpTextNode() ) { - SwCursor* pCrsr = getShellCrsr( true ); + SwCursor* pCursor = getShellCursor( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *pCursor ); - pCrsr->GetPoint()->nNode = *rAttr.GetpTextNode(); - pCrsr->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(rAttr.GetpTextNode()), + pCursor->GetPoint()->nNode = *rAttr.GetpTextNode(); + pCursor->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(rAttr.GetpTextNode()), rAttr.GetStart() ); - bRet = !pCrsr->IsSelOvr(); + bRet = !pCursor->IsSelOvr(); if( bRet ) - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); } return bRet; } -const SwFormatINetFormat* SwCrsrShell::FindINetAttr( const OUString& rName ) const +const SwFormatINetFormat* SwCursorShell::FindINetAttr( const OUString& rName ) const { return mpDoc->FindINetAttr( rName ); } -bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode, +bool SwCursorShell::GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode, SwRect& rRect, sal_Int16& rOrient ) { @@ -1811,16 +1811,16 @@ bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode, && GetDoc()->GetIDocumentUndoRedo().DoesUndo()) { Point aPt( rPt ); - SwPosition aPos( *m_pCurCrsr->GetPoint() ); + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); - SwFillCrsrPos aFPos( eFillMode ); - SwCrsrMoveState aTmpState( &aFPos ); + SwFillCursorPos aFPos( eFillMode ); + SwCursorMoveState aTmpState( &aFPos ); - if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) && + if( GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ) && !aPos.nNode.GetNode().IsProtect()) { // start position in protected section? - rRect = aFPos.aCrsr; + rRect = aFPos.aCursor; rOrient = aFPos.eOrient; bRet = true; } @@ -1828,7 +1828,7 @@ bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode, return bRet; } -bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) +bool SwCursorShell::SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode ) { SET_CURR_SHELL( this ); bool bRet = false; @@ -1837,14 +1837,14 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) && GetDoc()->GetIDocumentUndoRedo().DoesUndo()) { Point aPt( rPt ); - SwPosition aPos( *m_pCurCrsr->GetPoint() ); + SwPosition aPos( *m_pCurrentCursor->GetPoint() ); - SwFillCrsrPos aFPos( eFillMode ); - SwCrsrMoveState aTmpState( &aFPos ); + SwFillCursorPos aFPos( eFillMode ); + SwCursorMoveState aTmpState( &aFPos ); - if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) ) + if( GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ) ) { - SwCallLink aLk( *this ); // watch Crsr-Moves + SwCallLink aLk( *this ); // watch Cursor-Moves StartAction(); SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode(); @@ -1884,18 +1884,18 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) GetDoc()->getIDocumentContentOperations().AppendTextNode( aPos ); if( !n && pNextFormat ) { - *m_pCurCrsr->GetPoint() = aPos; - GetDoc()->SetTextFormatColl( *m_pCurCrsr, pNextFormat, false ); + *m_pCurrentCursor->GetPoint() = aPos; + GetDoc()->SetTextFormatColl( *m_pCurrentCursor, pNextFormat, false ); } if( n < aFPos.nColumnCnt ) { - *m_pCurCrsr->GetPoint() = aPos; - GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurCrsr, + *m_pCurrentCursor->GetPoint() = aPos; + GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurrentCursor, SvxFormatBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ) ); } } - *m_pCurCrsr->GetPoint() = aPos; + *m_pCurrentCursor->GetPoint() = aPos; switch( aFPos.eMode ) { case FILL_INDENT: @@ -1916,7 +1916,7 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) if( SVX_ADJUST_LEFT != rAdj.GetAdjust() ) aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) ); - GetDoc()->getIDocumentContentOperations().InsertItemSet( *m_pCurCrsr, aSet ); + GetDoc()->getIDocumentContentOperations().InsertItemSet( *m_pCurrentCursor, aSet ); } else { OSL_ENSURE( false, "No ContentNode" ); @@ -1932,7 +1932,7 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) if (aFPos.nSpaceCnt) comphelper::string::padToLength(sInsert, sInsert.getLength() + aFPos.nSpaceCnt, ' '); if (!sInsert.isEmpty()) - GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurCrsr, sInsert.makeStringAndClear()); + GetDoc()->getIDocumentContentOperations().InsertString( *m_pCurrentCursor, sInsert.makeStringAndClear()); } // no break - still need to set orientation case FILL_MARGIN: @@ -1950,7 +1950,7 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) default: break; } - GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurCrsr, aAdj ); + GetDoc()->getIDocumentContentOperations().InsertPoolItem( *m_pCurrentCursor, aAdj ); } break; } @@ -1964,84 +1964,84 @@ bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) return bRet; } -const SwRangeRedline* SwCrsrShell::SelNextRedline() +const SwRangeRedline* SwCursorShell::SelNextRedline() { const SwRangeRedline* pFnd = nullptr; if( !IsTableMode() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); - pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( *m_pCurCrsr ); - if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() ) - UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( *m_pCurrentCursor ); + if( pFnd && !m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr() ) + UpdateCursor( SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); else pFnd = nullptr; } return pFnd; } -const SwRangeRedline* SwCrsrShell::SelPrevRedline() +const SwRangeRedline* SwCursorShell::SelPrevRedline() { const SwRangeRedline* pFnd = nullptr; if( !IsTableMode() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); - pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( *m_pCurCrsr ); - if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() ) - UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( *m_pCurrentCursor ); + if( pFnd && !m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr() ) + UpdateCursor( SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); else pFnd = nullptr; } return pFnd; } -const SwRangeRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, bool bSelect ) +const SwRangeRedline* SwCursorShell::_GotoRedline( sal_uInt16 nArrPos, bool bSelect ) { const SwRangeRedline* pFnd = nullptr; - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nArrPos ]; if( pFnd ) { - *m_pCurCrsr->GetPoint() = *pFnd->Start(); + *m_pCurrentCursor->GetPoint() = *pFnd->Start(); SwContentNode* pCNd; - SwNodeIndex* pIdx = &m_pCurCrsr->GetPoint()->nNode; + SwNodeIndex* pIdx = &m_pCurrentCursor->GetPoint()->nNode; if( !pIdx->GetNode().IsContentNode() && nullptr != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx, true, IsReadOnlyAvailable() )) ) { if( *pIdx <= pFnd->End()->nNode ) - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 ); + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, 0 ); else pFnd = nullptr; } if( pFnd && bSelect ) { - m_pCurCrsr->SetMark(); + m_pCurrentCursor->SetMark(); if( nsRedlineType_t::REDLINE_FMTCOLL == pFnd->GetType() ) { pCNd = pIdx->GetNode().GetContentNode(); - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); - m_pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 ); + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + m_pCurrentCursor->GetMark()->nContent.Assign( pCNd, 0 ); } else - *m_pCurCrsr->GetPoint() = *pFnd->End(); + *m_pCurrentCursor->GetPoint() = *pFnd->End(); - pIdx = &m_pCurCrsr->GetPoint()->nNode; + pIdx = &m_pCurrentCursor->GetPoint()->nNode; if( !pIdx->GetNode().IsContentNode() && nullptr != ( pCNd = SwNodes::GoPrevSection( pIdx, true, IsReadOnlyAvailable() )) ) { - if( *pIdx >= m_pCurCrsr->GetMark()->nNode ) - m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + if( *pIdx >= m_pCurrentCursor->GetMark()->nNode ) + m_pCurrentCursor->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); else pFnd = nullptr; } @@ -2049,26 +2049,26 @@ const SwRangeRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, bool bSelec if( !pFnd ) { - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->RestoreSavePos(); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->RestoreSavePos(); } - else if( bSelect && *m_pCurCrsr->GetMark() == *m_pCurCrsr->GetPoint() ) - m_pCurCrsr->DeleteMark(); + else if( bSelect && *m_pCurrentCursor->GetMark() == *m_pCurrentCursor->GetPoint() ) + m_pCurrentCursor->DeleteMark(); - if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE - | SwCrsrShell::READONLY ); + if( pFnd && !m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr() ) + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE + | SwCursorShell::READONLY ); else { pFnd = nullptr; if( bSelect ) - m_pCurCrsr->DeleteMark(); + m_pCurrentCursor->DeleteMark(); } } return pFnd; } -const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect ) +const SwRangeRedline* SwCursorShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect ) { const SwRangeRedline* pFnd = nullptr; if( !IsTableMode() ) @@ -2094,7 +2094,7 @@ const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect { // Check for overlaps. These can happen when FormatColl- // Redlines were stretched over a whole paragraph - SwPaM* pCur = m_pCurCrsr; + SwPaM* pCur = m_pCurrentCursor; SwPaM* pNextPam = pCur->GetNext(); SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End(); while( pCur != pNextPam ) @@ -2161,7 +2161,7 @@ const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect if( pTmp ) { // create new cursor - CreateCrsr(); + CreateCursor(); bCheck = true; } nArrPos = nFndPos; @@ -2177,7 +2177,7 @@ const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect return pFnd; } -bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) +bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) { SwNodes& rNds = GetDoc()->GetNodes(); const SwNode* pBodyEndNd = &rNds.GetEndOfContent(); @@ -2186,13 +2186,13 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) Point aPt; _SetGetExpField aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) ); - _SetGetExpField aCurPos( bNext ? *m_pCurCrsr->End() : *m_pCurCrsr->Start() ); + _SetGetExpField aCurPos( bNext ? *m_pCurrentCursor->End() : *m_pCurrentCursor->Start() ); if( aCurPos.GetNode() < nBodySttNdIdx ) { const SwContentNode* pCNd = aCurPos.GetNodeFromContent()->GetContentNode(); - SwContentFrm* pFrm; - if( pCNd && nullptr != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt )) ) - aCurPos.SetBodyPos( *pFrm ); + SwContentFrame* pFrame; + if( pCNd && nullptr != ( pFrame = pCNd->getLayoutFrame( GetLayout(), &aPt )) ) + aCurPos.SetBodyPos( *pFrame ); } // check first all the hyperlink fields @@ -2210,10 +2210,10 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) SwTextINetFormat& rAttr = *pFnd; SwPosition aTmpPos( *pTextNd ); _SetGetExpField aPos( aTmpPos.nNode, rAttr ); - SwContentFrm* pFrm; + SwContentFrame* pFrame; if( pTextNd->GetIndex() < nBodySttNdIdx && - nullptr != ( pFrm = pTextNd->getLayoutFrm( GetLayout(), &aPt )) ) - aPos.SetBodyPos( *pFrm ); + nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt )) ) + aPos.SetBodyPos( *pFrame ); if( bNext ? ( aPos < aCmpPos && aCurPos < aPos ) @@ -2241,7 +2241,7 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) const SwFormatURL& rURLItem = pFormat->GetURL(); if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() ) { - SwFlyFrm* pFly = pFormat->GetFrm( &aPt ); + SwFlyFrame* pFly = pFormat->GetFrame( &aPt ); SwPosition aTmpPos( *pBodySttNd ); if( pFly && GetBodyTextNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) ) @@ -2269,17 +2269,17 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) // found a text attribute ? if( pFndAttr ) { - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCursorSaveState aSaveState( *m_pCurrentCursor ); - aCmpPos.GetPosOfContent( *m_pCurCrsr->GetPoint() ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SetMark(); - m_pCurCrsr->GetPoint()->nContent = *pFndAttr->End(); + aCmpPos.GetPosOfContent( *m_pCurrentCursor->GetPoint() ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SetMark(); + m_pCurrentCursor->GetPoint()->nContent = *pFndAttr->End(); - if( !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() ) + if( !m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr() ) { - UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE| - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE| + SwCursorShell::READONLY ); bRet = true; } } @@ -2296,10 +2296,10 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) } else // then is it a fly { - SwFlyFrm* pFly = pFndFormat->GetFrm(&aPt); + SwFlyFrame* pFly = pFndFormat->GetFrame(&aPt); if( pFly ) { - static_cast<SwFEShell*>(this)->SelectFlyFrm( *pFly, true ); + static_cast<SwFEShell*>(this)->SelectFlyFrame( *pFly, true ); MakeSelVisible(); bRet = true; } diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx index 699302a7e4e1..1ac7374d12db 100644 --- a/sw/source/core/crsr/crstrvl1.cxx +++ b/sw/source/core/crsr/crstrvl1.cxx @@ -21,69 +21,69 @@ #include <viscrs.hxx> #include <callnk.hxx> -bool SwCrsrShell::IsStartWord( sal_Int16 nWordType ) const +bool SwCursorShell::IsStartWord( sal_Int16 nWordType ) const { - return m_pCurCrsr->IsStartWord( nWordType ); + return m_pCurrentCursor->IsStartWord( nWordType ); } -bool SwCrsrShell::IsEndWord( sal_Int16 nWordType ) const +bool SwCursorShell::IsEndWord( sal_Int16 nWordType ) const { - return m_pCurCrsr->IsEndWord( nWordType ); + return m_pCurrentCursor->IsEndWord( nWordType ); } -bool SwCrsrShell::IsInWord( sal_Int16 nWordType ) const +bool SwCursorShell::IsInWord( sal_Int16 nWordType ) const { - return m_pCurCrsr->IsInWord( nWordType ); + return m_pCurrentCursor->IsInWord( nWordType ); } -bool SwCrsrShell::IsStartSentence() const +bool SwCursorShell::IsStartSentence() const { - return m_pCurCrsr->IsStartEndSentence( false ); + return m_pCurrentCursor->IsStartEndSentence( false ); } -bool SwCrsrShell::IsEndSentence() const +bool SwCursorShell::IsEndSentence() const { - return m_pCurCrsr->IsStartEndSentence( true ); + return m_pCurrentCursor->IsStartEndSentence( true ); } -bool SwCrsrShell::GoStartWord() +bool SwCursorShell::GoStartWord() { - return CallCrsrFN( &SwCursor::GoStartWord ); + return CallCursorFN( &SwCursor::GoStartWord ); } -bool SwCrsrShell::GoEndWord() +bool SwCursorShell::GoEndWord() { - return CallCrsrFN( &SwCursor::GoEndWord ); + return CallCursorFN( &SwCursor::GoEndWord ); } -bool SwCrsrShell::GoNextWord() +bool SwCursorShell::GoNextWord() { - return CallCrsrFN( &SwCursor::GoNextWord ); + return CallCursorFN( &SwCursor::GoNextWord ); } -bool SwCrsrShell::GoPrevWord() +bool SwCursorShell::GoPrevWord() { - return CallCrsrFN( &SwCursor::GoPrevWord ); + return CallCursorFN( &SwCursor::GoPrevWord ); } -bool SwCrsrShell::GoNextSentence() +bool SwCursorShell::GoNextSentence() { - return CallCrsrFN( &SwCursor::GoNextSentence ); + return CallCursorFN( &SwCursor::GoNextSentence ); } -bool SwCrsrShell::GoEndSentence() +bool SwCursorShell::GoEndSentence() { - return CallCrsrFN( &SwCursor::GoEndSentence ); + return CallCursorFN( &SwCursor::GoEndSentence ); } -bool SwCrsrShell::GoStartSentence() +bool SwCursorShell::GoStartSentence() { - return CallCrsrFN( &SwCursor::GoStartSentence ); + return CallCursorFN( &SwCursor::GoStartSentence ); } -bool SwCrsrShell::SelectWord( const Point* pPt ) +bool SwCursorShell::SelectWord( const Point* pPt ) { - return m_pCurCrsr->SelectWord( this, pPt ); + return m_pCurrentCursor->SelectWord( this, pPt ); } -bool SwCrsrShell::ExpandToSentenceBorders() +bool SwCursorShell::ExpandToSentenceBorders() { - return m_pCurCrsr->ExpandToSentenceBorders(); + return m_pCurrentCursor->ExpandToSentenceBorders(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 24c66d454b4e..3cbd168b35ff 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -1062,9 +1062,9 @@ struct SwFindParaAttr : public SwFindParas SwFindParaAttr( const SfxItemSet& rSet, bool bNoCollection, const SearchOptions* pOpt, const SfxItemSet* pRSet, - SwCursor& rCrsr ) + SwCursor& rCursor ) : bValue( bNoCollection ), pSet( &rSet ), pReplSet( pRSet ), - pSearchOpt( pOpt ), m_rCursor( rCrsr ),pSText( nullptr ) {} + pSearchOpt( pOpt ), m_rCursor( rCursor ),pSText( nullptr ) {} virtual ~SwFindParaAttr() { delete pSText; } @@ -1072,7 +1072,7 @@ struct SwFindParaAttr : public SwFindParas virtual bool IsReplaceMode() const override; }; -int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, +int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, bool bInReadOnly ) { // replace string (only if text given and search is not parameterized)? @@ -1087,7 +1087,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, { SwPaM aRegion( *pRegion->GetMark(), *pRegion->GetPoint() ); SwPaM* pTextRegion = &aRegion; - SwPaM aSrchPam( *pCrsr->GetPoint() ); + SwPaM aSrchPam( *pCursor->GetPoint() ); while( true ) { @@ -1133,16 +1133,16 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, *aRegion.GetMark() = *aSrchPam.GetPoint(); } - *pCrsr->GetPoint() = *aSrchPam.GetPoint(); - pCrsr->SetMark(); - *pCrsr->GetMark() = *aSrchPam.GetMark(); + *pCursor->GetPoint() = *aSrchPam.GetPoint(); + pCursor->SetMark(); + *pCursor->GetMark() = *aSrchPam.GetMark(); } if( bReplaceText ) { const bool bRegExp( SearchAlgorithms_REGEXP == pSearchOpt->algorithmType); - SwIndex& rSttCntIdx = pCrsr->Start()->nContent; + SwIndex& rSttCntIdx = pCursor->Start()->nContent; const sal_Int32 nSttCnt = rSttCntIdx.GetIndex(); // add to shell-cursor-ring so that the regions will be moved eventually @@ -1154,11 +1154,11 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, } std::unique_ptr<OUString> pRepl( (bRegExp) ? - ReplaceBackReferences( *pSearchOpt, pCrsr ) : nullptr ); - m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( *pCrsr, + ReplaceBackReferences( *pSearchOpt, pCursor ) : nullptr ); + m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( *pCursor, (pRepl.get()) ? *pRepl : pSearchOpt->replaceString, bRegExp ); - m_rCursor.SaveTableBoxContent( pCrsr->GetPoint() ); + m_rCursor.SaveTableBoxContent( pCursor->GetPoint() ); if( bRegExp ) { @@ -1181,7 +1181,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, // they are not in ReplaceSet if( !pSet->Count() ) { - pCrsr->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCrsr, *pReplSet ); + pCursor->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, *pReplSet ); } else { @@ -1202,7 +1202,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, pItem = aIter.NextItem(); } aSet.Put( *pReplSet ); - pCrsr->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCrsr, aSet ); + pCursor->GetDoc()->getIDocumentContentOperations().InsertItemSet( *pCursor, aSet ); } return FIND_NO_RING; diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index dea31786b436..0be773e139b6 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -39,18 +39,18 @@ struct SwFindParaFormatColl : public SwFindParas virtual bool IsReplaceMode() const override; }; -int SwFindParaFormatColl::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, +int SwFindParaFormatColl::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, bool bInReadOnly ) { int nRet = FIND_FOUND; if( bInReadOnly && pReplColl ) bInReadOnly = false; - if( !pCrsr->Find( *pFormatColl, fnMove, pRegion, bInReadOnly ) ) + if( !pCursor->Find( *pFormatColl, fnMove, pRegion, bInReadOnly ) ) nRet = FIND_NOT_FOUND; else if( pReplColl ) { - pCrsr->GetDoc()->SetTextFormatColl( *pCrsr, const_cast<SwTextFormatColl*>(pReplColl) ); + pCursor->GetDoc()->SetTextFormatColl( *pCursor, const_cast<SwTextFormatColl*>(pReplColl) ); nRet = FIND_NO_RING; } return nRet; diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9bd8ca174cbf..abd3763b47e6 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -634,8 +634,8 @@ struct SwFindParaText : public SwFindParas bool m_bReplace; bool m_bSearchInNotes; - SwFindParaText( const SearchOptions& rOpt, bool bSearchInNotes, bool bRepl, SwCursor& rCrsr ) - : m_rSearchOpt( rOpt ), m_rCursor( rCrsr ), m_aSText( rOpt ), m_bReplace( bRepl ), m_bSearchInNotes( bSearchInNotes ) + SwFindParaText( const SearchOptions& rOpt, bool bSearchInNotes, bool bRepl, SwCursor& rCursor ) + : m_rSearchOpt( rOpt ), m_rCursor( rCursor ), m_aSText( rOpt ), m_bReplace( bRepl ), m_bSearchInNotes( bSearchInNotes ) {} virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, bool bInReadOnly ) override; virtual bool IsReplaceMode() const override; @@ -646,19 +646,19 @@ SwFindParaText::~SwFindParaText() { } -int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, +int SwFindParaText::Find( SwPaM* pCursor, SwMoveFn fnMove, const SwPaM* pRegion, bool bInReadOnly ) { if( bInReadOnly && m_bReplace ) bInReadOnly = false; - const bool bFnd = pCrsr->Find( m_rSearchOpt, m_bSearchInNotes, m_aSText, fnMove, pRegion, bInReadOnly ); + const bool bFnd = pCursor->Find( m_rSearchOpt, m_bSearchInNotes, m_aSText, fnMove, pRegion, bInReadOnly ); if( bFnd && m_bReplace ) // replace string { // use replace method in SwDoc const bool bRegExp(SearchAlgorithms_REGEXP == m_rSearchOpt.algorithmType); - SwIndex& rSttCntIdx = pCrsr->Start()->nContent; + SwIndex& rSttCntIdx = pCursor->Start()->nContent; const sal_Int32 nSttCnt = rSttCntIdx.GetIndex(); // add to shell-cursor-ring so that the regions will be moved eventually SwPaM* pPrev(nullptr); @@ -669,13 +669,13 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, } std::unique_ptr<OUString> pRepl( (bRegExp) - ? ReplaceBackReferences( m_rSearchOpt, pCrsr ) : nullptr ); + ? ReplaceBackReferences( m_rSearchOpt, pCursor ) : nullptr ); bool const bReplaced = m_rCursor.GetDoc()->getIDocumentContentOperations().ReplaceRange( - *pCrsr, + *pCursor, (pRepl.get()) ? *pRepl : m_rSearchOpt.replaceString, bRegExp ); - m_rCursor.SaveTableBoxContent( pCrsr->GetPoint() ); + m_rCursor.SaveTableBoxContent( pCursor->GetPoint() ); if( bRegExp ) { @@ -691,12 +691,12 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, if (bRegExp && !bReplaced) { // fdo#80715 avoid infinite loop if join failed bool bRet = ((fnMoveForward == fnMove) ? &GoNextPara : &GoPrevPara) - (*pCrsr, fnMove); + (*pCursor, fnMove); (void) bRet; assert(bRet); // if join failed, next node must be SwTextNode } else - pCrsr->Start()->nContent = nSttCnt; + pCursor->Start()->nContent = nSttCnt; return FIND_NO_RING; } return bFnd ? FIND_FOUND : FIND_NOT_FOUND; diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 3a0bb284f63e..65b347c6be11 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -543,38 +543,38 @@ SwPaM & SwPaM::Normalize(bool bPointFirst) /// return page number at cursor (for reader and page bound frames) sal_uInt16 SwPaM::GetPageNum( bool bAtPoint, const Point* pLayPos ) { - const SwContentFrm* pCFrm; - const SwPageFrm *pPg; + const SwContentFrame* pCFrame; + const SwPageFrame *pPg; const SwContentNode *pNd ; const SwPosition* pPos = bAtPoint ? m_pPoint : m_pMark; if( nullptr != ( pNd = pPos->nNode.GetNode().GetContentNode() ) && - nullptr != ( pCFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pLayPos, pPos, false )) && - nullptr != ( pPg = pCFrm->FindPageFrm() )) + nullptr != ( pCFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pLayPos, pPos, false )) && + nullptr != ( pPg = pCFrame->FindPageFrame() )) return pPg->GetPhyPageNum(); return 0; } -// Formular view - See also SwCrsrShell::IsCrsrReadonly() -static const SwFrm* lcl_FindEditInReadonlyFrm( const SwFrm& rFrm ) +// Formular view - See also SwCursorShell::IsCursorReadonly() +static const SwFrame* lcl_FindEditInReadonlyFrame( const SwFrame& rFrame ) { - const SwFrm* pRet = nullptr; + const SwFrame* pRet = nullptr; - const SwFlyFrm* pFly; - const SwSectionFrm* pSectionFrm; + const SwFlyFrame* pFly; + const SwSectionFrame* pSectionFrame; - if( rFrm.IsInFly() && - (pFly = rFrm.FindFlyFrm())->GetFormat()->GetEditInReadonly().GetValue() && + if( rFrame.IsInFly() && + (pFly = rFrame.FindFlyFrame())->GetFormat()->GetEditInReadonly().GetValue() && pFly->Lower() && - !pFly->Lower()->IsNoTextFrm() ) + !pFly->Lower()->IsNoTextFrame() ) { pRet = pFly; } - else if ( rFrm.IsInSct() && - nullptr != ( pSectionFrm = rFrm.FindSctFrm() )->GetSection() && - pSectionFrm->GetSection()->IsEditInReadonlyFlag() ) + else if ( rFrame.IsInSct() && + nullptr != ( pSectionFrame = rFrame.FindSctFrame() )->GetSection() && + pSectionFrame->GetSection()->IsEditInReadonlyFlag() ) { - pRet = pSectionFrm; + pRet = pSectionFrame; } return pRet; @@ -586,19 +586,19 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const bool bRet = false; const SwContentNode* pNd = GetPoint()->nNode.GetNode().GetContentNode(); - const SwContentFrm *pFrm = nullptr; + const SwContentFrame *pFrame = nullptr; if ( pNd != nullptr ) { Point aTmpPt; - pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetPoint(), false ); + pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetPoint(), false ); } // Will be set if point are inside edit-in-readonly environment - const SwFrm* pPointEditInReadonlyFrm = nullptr; - if ( pFrm != nullptr - && ( pFrm->IsProtected() + const SwFrame* pPointEditInReadonlyFrame = nullptr; + if ( pFrame != nullptr + && ( pFrame->IsProtected() || ( bFormView - && nullptr == ( pPointEditInReadonlyFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) + && nullptr == ( pPointEditInReadonlyFrame = lcl_FindEditInReadonlyFrame( *pFrame ) ) ) ) ) { bRet = true; } @@ -619,18 +619,18 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const && GetPoint()->nNode != GetMark()->nNode ) { pNd = GetMark()->nNode.GetNode().GetContentNode(); - pFrm = nullptr; + pFrame = nullptr; if ( pNd != nullptr ) { Point aTmpPt; - pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetMark(), false ); + pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aTmpPt, GetMark(), false ); } - const SwFrm* pMarkEditInReadonlyFrm = nullptr; - if ( pFrm != nullptr - && ( pFrm->IsProtected() + const SwFrame* pMarkEditInReadonlyFrame = nullptr; + if ( pFrame != nullptr + && ( pFrame->IsProtected() || ( bFormView - && nullptr == ( pMarkEditInReadonlyFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) ) + && nullptr == ( pMarkEditInReadonlyFrame = lcl_FindEditInReadonlyFrame( *pFrame ) ) ) ) ) { bRet = true; } @@ -650,7 +650,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const { // Check if start and end frame are inside the _same_ // edit-in-readonly-environment. Otherwise we better return 'true' - if ( pPointEditInReadonlyFrm != pMarkEditInReadonlyFrm ) + if ( pPointEditInReadonlyFrame != pMarkEditInReadonlyFrame ) bRet = true; } @@ -756,7 +756,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, if( ((*rPam.GetPoint()).*fnMove->fnCmpOp)( *rPam.GetMark() ) || ( *rPam.GetPoint() == *rPam.GetMark() && rbFirst ) ) { - SwContentFrm* pFrm; + SwContentFrame* pFrame; if( rbFirst ) { rbFirst = false; @@ -765,9 +765,9 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, { if( ( - nullptr == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || - ( !bInReadOnly && pFrm->IsProtected() ) || - (pFrm->IsTextFrm() && static_cast<SwTextFrm*>(pFrm)->IsHiddenNow()) + nullptr == ( pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || + ( !bInReadOnly && pFrame->IsProtected() ) || + (pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsHiddenNow()) ) || ( !bInReadOnly && pNd->FindSectionNode() && pNd->FindSectionNode()->GetSection().IsProtect() @@ -798,10 +798,10 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFn fnMove, if( (aPos.*fnMove->fnCmpOp)( *rPam.GetMark() ) ) { // only in AutoTextSection can be nodes that are hidden - if( nullptr == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || - ( !bInReadOnly && pFrm->IsProtected() ) || - ( pFrm->IsTextFrm() && - static_cast<SwTextFrm*>(pFrm)->IsHiddenNow() ) ) + if( nullptr == ( pFrame = pNd->getLayoutFrame( pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ) || + ( !bInReadOnly && pFrame->IsProtected() ) || + ( pFrame->IsTextFrame() && + static_cast<SwTextFrame*>(pFrame)->IsHiddenNow() ) ) { pNd = nullptr; continue; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 578af2c3ecc5..dfba8e38369d 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -340,34 +340,34 @@ bool SwCursor::IsSelOvr( int eFlags ) } const SwNode* pNd = &GetPoint()->nNode.GetNode(); - if( pNd->IsContentNode() && !dynamic_cast<SwUnoCrsr*>(this) ) + if( pNd->IsContentNode() && !dynamic_cast<SwUnoCursor*>(this) ) { - const SwContentFrm* pFrm = static_cast<const SwContentNode*>(pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); + const SwContentFrame* pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); if ( (nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags) //allowed to change position if it's a bad one - && pFrm && pFrm->IsValid() && !pFrm->Frm().Height() //a bad zero height position + && pFrame && pFrame->IsValid() && !pFrame->Frame().Height() //a bad zero height position && !InputFieldAtPos(GetPoint()) ) //unless it's a (vertical) input field { // skip to the next/prev valid paragraph with a layout SwNodeIndex& rPtIdx = GetPoint()->nNode; bool bGoNxt = m_pSavePos->nNode < rPtIdx.GetIndex(); - while( nullptr != ( pFrm = ( bGoNxt ? pFrm->GetNextContentFrm() : pFrm->GetPrevContentFrm() )) - && 0 == pFrm->Frm().Height() ) + while( nullptr != ( pFrame = ( bGoNxt ? pFrame->GetNextContentFrame() : pFrame->GetPrevContentFrame() )) + && 0 == pFrame->Frame().Height() ) ; // #i72394# skip to prev/next valid paragraph with a layout in case // the first search did not succeed: - if( !pFrm ) + if( !pFrame ) { bGoNxt = !bGoNxt; - pFrm = static_cast<const SwContentNode*>(pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); - while ( pFrm && 0 == pFrm->Frm().Height() ) + pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); + while ( pFrame && 0 == pFrame->Frame().Height() ) { - pFrm = bGoNxt ? pFrm->GetNextContentFrm() - : pFrm->GetPrevContentFrm(); + pFrame = bGoNxt ? pFrame->GetNextContentFrame() + : pFrame->GetPrevContentFrame(); } } - SwContentNode* pCNd = (pFrm != nullptr) ? const_cast<SwContentNode*>(pFrm->GetNode()) : nullptr; + SwContentNode* pCNd = (pFrame != nullptr) ? const_cast<SwContentNode*>(pFrame->GetNode()) : nullptr; if ( pCNd != nullptr ) { // set this ContentNode as new position @@ -381,20 +381,20 @@ bool SwCursor::IsSelOvr( int eFlags ) && nTmpPos == m_pSavePos->nContent) { // new position equals saved one - // --> trigger restore of saved pos by setting <pFrm> to NULL - see below - pFrm = nullptr; + // --> trigger restore of saved pos by setting <pFrame> to NULL - see below + pFrame = nullptr; } if ( IsInProtectTable( true ) ) { // new position in protected table - // --> trigger restore of saved pos by setting <pFrm> to NULL - see below - pFrm = nullptr; + // --> trigger restore of saved pos by setting <pFrame> to NULL - see below + pFrame = nullptr; } } } - if( !pFrm ) + if( !pFrame ) { DeleteMark(); RestoreSavePos(); @@ -422,8 +422,8 @@ bool SwCursor::IsSelOvr( int eFlags ) } if( (pNd = &GetMark()->nNode.GetNode())->IsContentNode() - && !static_cast<const SwContentNode*>(pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) - && !dynamic_cast<SwUnoCrsr*>(this) ) + && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) + && !dynamic_cast<SwUnoCursor*>(this) ) { DeleteMark(); RestoreSavePos(); @@ -479,7 +479,7 @@ bool SwCursor::IsSelOvr( int eFlags ) { // not allowed, so go back to old position RestoreSavePos(); - // Crsr stays at old position + // Cursor stays at old position return true; } @@ -544,7 +544,7 @@ bool SwCursor::IsSelOvr( int eFlags ) return true; } -bool SwCursor::IsInProtectTable( bool bMove, bool bChgCrsr ) +bool SwCursor::IsInProtectTable( bool bMove, bool bChgCursor ) { SwContentNode* pCNd = GetContentNode(); if( !pCNd ) @@ -583,11 +583,11 @@ bool SwCursor::IsInProtectTable( bool bMove, bool bChgCrsr ) if( !bMove ) { - if( bChgCrsr ) + if( bChgCursor ) // restore the last save position RestoreSavePos(); - return true; // Crsr stays at old position + return true; // Cursor stays at old position } // We are in a protected table cell. Traverse top to bottom? @@ -610,7 +610,7 @@ GoNextCell: aCellStt.Assign( *pCNd->FindTableBoxStartNode()->EndOfSectionNode(), 1 ); } while( bProt ); -SetNextCrsr: +SetNextCursor: if( !bProt ) // found free cell { GetPoint()->nNode = aCellStt; @@ -629,7 +629,7 @@ SetNextCrsr: if( ( pNd = &aCellStt.GetNode())->IsEndNode() || HasMark()) { // if only table in FlyFrame or SSelection then stay on old position - if( bChgCrsr ) + if( bChgCursor ) RestoreSavePos(); return true; } @@ -637,7 +637,7 @@ SetNextCrsr: goto GoNextCell; bProt = false; // index is now on a content node - goto SetNextCrsr; + goto SetNextCursor; } // search for the previous valid box @@ -659,7 +659,7 @@ GoPrevCell: aCellStt.Assign( *pNd->FindTableBoxStartNode(), -1 ); } while( bProt ); -SetPrevCrsr: +SetPrevCursor: if( !bProt ) // found free cell { GetPoint()->nNode = aCellStt; @@ -677,7 +677,7 @@ SetPrevCrsr: if( ( pNd = &aCellStt.GetNode())->IsStartNode() || HasMark() ) { // if only table in FlyFrame or SSelection then stay on old position - if( bChgCrsr ) + if( bChgCursor ) RestoreSavePos(); return true; } @@ -685,7 +685,7 @@ SetPrevCrsr: goto GoPrevCell; bProt = false; // index is now on a content node - goto SetPrevCrsr; + goto SetPrevCursor; } } @@ -696,8 +696,8 @@ bool SwCursor::IsAtValidPos( bool bPoint ) const const SwPosition* pPos = bPoint ? GetPoint() : GetMark(); const SwNode* pNd = &pPos->nNode.GetNode(); - if( pNd->IsContentNode() && !static_cast<const SwContentNode*>(pNd)->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && - !dynamic_cast<const SwUnoCrsr*>(this) ) + if( pNd->IsContentNode() && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && + !dynamic_cast<const SwUnoCursor*>(this) ) { return false; } @@ -706,13 +706,13 @@ bool SwCursor::IsAtValidPos( bool bPoint ) const if( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ) return true; - const bool bCrsrInReadOnly = IsReadOnlyAvailable(); - if( !bCrsrInReadOnly && pNd->IsProtect() ) + const bool bCursorInReadOnly = IsReadOnlyAvailable(); + if( !bCursorInReadOnly && pNd->IsProtect() ) return false; const SwSectionNode* pSectNd = pNd->FindSectionNode(); if( pSectNd && (pSectNd->GetSection().IsHiddenFlag() || - ( !bCrsrInReadOnly && pSectNd->GetSection().IsProtectFlag() ))) + ( !bCursorInReadOnly && pSectNd->GetSection().IsProtectFlag() ))) return false; return true; @@ -735,31 +735,31 @@ SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart, ? fnMoveForward : fnMoveBackward; } -static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, +static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCursor, SwMoveFn fnMove, SwCursor*& pFndRing, SwPaM& aRegion, FindRanges eFndRngs, bool bInReadOnly, bool& bCancel ) { - SwDoc* pDoc = pCurCrsr->GetDoc(); + SwDoc* pDoc = pCurrentCursor->GetDoc(); bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); int nFndRet = 0; sal_uLong nFound = 0; const bool bSrchBkwrd = fnMove == fnMoveBackward; - SwPaM *pTmpCrsr = pCurCrsr, *pSaveCrsr = pCurCrsr; + SwPaM *pTmpCursor = pCurrentCursor, *pSaveCursor = pCurrentCursor; - // only create progress bar for ShellCrsr - bool bIsUnoCrsr = dynamic_cast<SwUnoCrsr*>(pCurCrsr) != nullptr; + // only create progress bar for ShellCursor + bool bIsUnoCursor = dynamic_cast<SwUnoCursor*>(pCurrentCursor) != nullptr; std::unique_ptr<_PercentHdl> pPHdl; - sal_uInt16 nCrsrCnt = 0; + sal_uInt16 nCursorCnt = 0; if( FND_IN_SEL & eFndRngs ) { - while( pCurCrsr != ( pTmpCrsr = pTmpCrsr->GetNext() )) - ++nCrsrCnt; - if( nCrsrCnt && !bIsUnoCrsr ) - pPHdl.reset(new _PercentHdl( 0, nCrsrCnt, pDoc->GetDocShell() )); + while( pCurrentCursor != ( pTmpCursor = pTmpCursor->GetNext() )) + ++nCursorCnt; + if( nCursorCnt && !bIsUnoCursor ) + pPHdl.reset(new _PercentHdl( 0, nCursorCnt, pDoc->GetDocShell() )); } else - pSaveCrsr = static_cast<SwPaM*>(pSaveCrsr->GetPrev()); + pSaveCursor = static_cast<SwPaM*>(pSaveCursor->GetPrev()); bool bEnd = false; do { @@ -768,31 +768,31 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, // if the search area is valid SwPosition *pSttPos = aRegion.GetMark(), *pEndPos = aRegion.GetPoint(); - *pSttPos = *pTmpCrsr->Start(); - *pEndPos = *pTmpCrsr->End(); + *pSttPos = *pTmpCursor->Start(); + *pEndPos = *pTmpCursor->End(); if( bSrchBkwrd ) aRegion.Exchange(); - if( !nCrsrCnt && !pPHdl && !bIsUnoCrsr ) + if( !nCursorCnt && !pPHdl && !bIsUnoCursor ) pPHdl.reset(new _PercentHdl( aRegion )); // as long as found and not at same position while( *pSttPos <= *pEndPos && - 0 != ( nFndRet = rParas.Find( pCurCrsr, fnMove, + 0 != ( nFndRet = rParas.Find( pCurrentCursor, fnMove, &aRegion, bInReadOnly )) && ( !pFndRing || - *pFndRing->GetPoint() != *pCurCrsr->GetPoint() || - *pFndRing->GetMark() != *pCurCrsr->GetMark() )) + *pFndRing->GetPoint() != *pCurrentCursor->GetPoint() || + *pFndRing->GetMark() != *pCurrentCursor->GetMark() )) { if( !( FIND_NO_RING & nFndRet )) { - // #i24084# - create ring similar to the one in CreateCrsr - SwCursor* pNew = pCurCrsr->Create( pFndRing ); + // #i24084# - create ring similar to the one in CreateCursor + SwCursor* pNew = pCurrentCursor->Create( pFndRing ); if( !pFndRing ) pFndRing = pNew; pNew->SetMark(); - *pNew->GetMark() = *pCurCrsr->GetMark(); + *pNew->GetMark() = *pCurrentCursor->GetMark(); } ++nFound; @@ -807,7 +807,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, && pDoc->GetIDocumentUndoRedo().DoesUndo() && rParas.IsReplaceMode()) { - short nRet = pCurCrsr->MaxReplaceArived(); + short nRet = pCurrentCursor->MaxReplaceArived(); if( RET_YES == nRet ) { pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); @@ -826,16 +826,16 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, if( bSrchBkwrd ) // move pEndPos in front of the found area - *pEndPos = *pCurCrsr->Start(); + *pEndPos = *pCurrentCursor->Start(); else // move pSttPos behind the found area - *pSttPos = *pCurCrsr->End(); + *pSttPos = *pCurrentCursor->End(); if( *pSttPos == *pEndPos ) // in area but at the end => done break; - if( !nCrsrCnt && pPHdl ) + if( !nCursorCnt && pPHdl ) { pPHdl->NextPos( *aRegion.GetMark() ); } @@ -844,16 +844,16 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, if( bEnd || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) ) break; - pTmpCrsr = pTmpCrsr->GetNext(); - if( nCrsrCnt && pPHdl ) + pTmpCursor = pTmpCursor->GetNext(); + if( nCursorCnt && pPHdl ) { pPHdl->NextPos( ++pPHdl->nActPos ); } - } while( pTmpCrsr != pSaveCrsr ); + } while( pTmpCursor != pSaveCursor ); if( nFound && !pFndRing ) // if no ring should be created - pFndRing = pCurCrsr->Create(); + pFndRing = pCurrentCursor->Create(); pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); return nFound; @@ -929,7 +929,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, FindRanges eFndRngs, bool& bCancel ) { bCancel = false; - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); // create region without adding it to the ring SwPaM aRegion( *GetPoint() ); @@ -952,7 +952,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, bInReadOnly, bCancel ) )) return nFound; - // found string at least once; it's all in new Crsr ring thus delete old one + // found string at least once; it's all in new Cursor ring thus delete old one while( GetNext() != this ) delete GetNext(); @@ -1010,7 +1010,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, } else { - // found string at least once; it's all in new Crsr ring thus delete old one + // found string at least once; it's all in new Cursor ring thus delete old one while( GetNext() != this ) delete GetNext(); @@ -1223,10 +1223,10 @@ bool SwCursor::IsStartEndSentence( bool bEnd ) const if( !bRet ) { - SwCursor aCrsr(*GetPoint(), nullptr, false); - SwPosition aOrigPos = *aCrsr.GetPoint(); - aCrsr.GoSentence( bEnd ? SwCursor::END_SENT : SwCursor::START_SENT ); - bRet = aOrigPos == *aCrsr.GetPoint(); + SwCursor aCursor(*GetPoint(), nullptr, false); + SwPosition aOrigPos = *aCursor.GetPoint(); + aCursor.GoSentence( bEnd ? SwCursor::END_SENT : SwCursor::START_SENT ); + bRet = aOrigPos == *aCursor.GetPoint(); } return bRet; } @@ -1237,7 +1237,7 @@ bool SwCursor::GoStartWordWT( sal_Int16 nWordType ) const SwTextNode* pTextNd = GetNode().GetTextNode(); if( pTextNd && g_pBreakIt->GetBreakIter().is() ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); nPtPos = g_pBreakIt->GetBreakIter()->getWordBoundary( pTextNd->GetText(), nPtPos, @@ -1261,7 +1261,7 @@ bool SwCursor::GoEndWordWT( sal_Int16 nWordType ) const SwTextNode* pTextNd = GetNode().GetTextNode(); if( pTextNd && g_pBreakIt->GetBreakIter().is() ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); nPtPos = g_pBreakIt->GetBreakIter()->getWordBoundary( pTextNd->GetText(), nPtPos, @@ -1286,7 +1286,7 @@ bool SwCursor::GoNextWordWT( sal_Int16 nWordType ) const SwTextNode* pTextNd = GetNode().GetTextNode(); if( pTextNd && g_pBreakIt->GetBreakIter().is() ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); nPtPos = g_pBreakIt->GetBreakIter()->nextWord( @@ -1310,7 +1310,7 @@ bool SwCursor::GoPrevWordWT( sal_Int16 nWordType ) const SwTextNode* pTextNd = GetNode().GetTextNode(); if( pTextNd && g_pBreakIt->GetBreakIter().is() ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); const sal_Int32 nPtStart = nPtPos; @@ -1333,16 +1333,16 @@ bool SwCursor::GoPrevWordWT( sal_Int16 nWordType ) bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const Point* pPt ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); bool bRet = false; DeleteMark(); - const SwRootFrm* pLayout = pViewShell->GetLayout(); + const SwRootFrame* pLayout = pViewShell->GetLayout(); if( pPt && nullptr != pLayout ) { // set the cursor to the layout position Point aPt( *pPt ); - pLayout->GetCrsrOfst( GetPoint(), aPt ); + pLayout->GetCursorOfst( GetPoint(), aPt ); } const SwTextNode* pTextNd = GetNode().GetTextNode(); @@ -1465,7 +1465,7 @@ bool SwCursor::GoSentence( SentenceMoveType eMoveType ) { OUString sNodeText( lcl_MaskDeletedRedlines( pTextNd ) ); - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nPtPos = GetPoint()->nContent.GetIndex(); switch ( eMoveType ) { @@ -1532,7 +1532,7 @@ bool SwCursor::ExpandToSentenceBorders() OUString sStartText( lcl_MaskDeletedRedlines( pStartNd ) ); OUString sEndText( pStartNd == pEndNd? sStartText : lcl_MaskDeletedRedlines( pEndNd ) ); - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); sal_Int32 nStartPos = Start()->nContent.GetIndex(); sal_Int32 nEndPos = End()->nContent.GetIndex(); @@ -1563,19 +1563,19 @@ bool SwCursor::ExpandToSentenceBorders() } bool SwTableCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 /*nMode*/, - bool /*bVisualAllowed*/, bool /*bSkipHidden*/, bool /*bInsertCrsr*/ ) + bool /*bVisualAllowed*/, bool /*bSkipHidden*/, bool /*bInsertCursor*/ ) { return bLeft ? GoPrevCell( nCnt ) : GoNextCell( nCnt ); } // calculate cursor bidi level: extracted from LeftRight() -const SwContentFrm* +const SwContentFrame* SwCursor::DoSetBidiLevelLeftRight( - bool & io_rbLeft, bool bVisualAllowed, bool bInsertCrsr) + bool & io_rbLeft, bool bVisualAllowed, bool bInsertCursor) { // calculate cursor bidi level - const SwContentFrm* pSttFrm = nullptr; + const SwContentFrame* pSttFrame = nullptr; SwNode& rNode = GetPoint()->nNode.GetNode(); if( rNode.IsTextNode() ) @@ -1592,15 +1592,15 @@ SwCursor::DoSetBidiLevelLeftRight( // for visual cursor travelling (used in bidi layout) // we first have to convert the logic to a visual position Point aPt; - pSttFrm = rTNd.getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); - if( pSttFrm ) + pSttFrame = rTNd.getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + if( pSttFrame ) { - sal_uInt8 nCrsrLevel = GetCrsrBidiLevel(); + sal_uInt8 nCursorLevel = GetCursorBidiLevel(); bool bForward = ! io_rbLeft; - const_cast<SwTextFrm*>(static_cast<const SwTextFrm*>(pSttFrm))->PrepareVisualMove( nPos, nCrsrLevel, - bForward, bInsertCrsr ); + const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pSttFrame))->PrepareVisualMove( nPos, nCursorLevel, + bForward, bInsertCursor ); rIdx = nPos; - SetCrsrBidiLevel( nCrsrLevel ); + SetCursorBidiLevel( nCursorLevel ); io_rbLeft = ! bForward; } } @@ -1612,23 +1612,23 @@ SwCursor::DoSetBidiLevelLeftRight( const sal_Int32 nMoveOverPos = io_rbLeft ? ( nPos ? nPos - 1 : 0 ) : nPos; - SetCrsrBidiLevel( pSI->DirType( nMoveOverPos ) ); + SetCursorBidiLevel( pSI->DirType( nMoveOverPos ) ); } } } - return pSttFrm; + return pSttFrame; } bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, - bool bVisualAllowed,bool bSkipHidden, bool bInsertCrsr ) + bool bVisualAllowed,bool bSkipHidden, bool bInsertCursor ) { // calculate cursor bidi level SwNode& rNode = GetPoint()->nNode.GetNode(); - const SwContentFrm* pSttFrm = // may side-effect bLeft! - DoSetBidiLevelLeftRight(bLeft, bVisualAllowed, bInsertCrsr); + const SwContentFrame* pSttFrame = // may side-effect bLeft! + DoSetBidiLevelLeftRight(bLeft, bVisualAllowed, bInsertCursor); // can the cursor be moved n times? - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); SwMoveFn fnMove = bLeft ? fnMoveBackward : fnMoveForward; SwGoInDoc fnGo; @@ -1718,21 +1718,21 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, } // here come some special rules for visual cursor travelling - if ( pSttFrm ) + if ( pSttFrame ) { SwNode& rTmpNode = GetPoint()->nNode.GetNode(); if ( &rTmpNode != &rNode && rTmpNode.IsTextNode() ) { Point aPt; - const SwContentFrm* pEndFrm = rTmpNode.GetTextNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); - if ( pEndFrm ) + const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + if ( pEndFrame ) { - if ( ! pEndFrm->IsRightToLeft() != ! pSttFrm->IsRightToLeft() ) + if ( ! pEndFrame->IsRightToLeft() != ! pSttFrame->IsRightToLeft() ) { if ( ! bLeft ) - pEndFrm->RightMargin( this ); + pEndFrame->RightMargin( this ); else - pEndFrm->LeftMargin( this ); + pEndFrame->LeftMargin( this ); } } } @@ -1764,10 +1764,10 @@ void SwCursor::DoSetBidiLevelUpDown() if ( nCurrLevel % 2 != nPrevLevel % 2 ) { // set cursor level to the lower of the two levels - SetCrsrBidiLevel( std::min( nCurrLevel, nPrevLevel ) ); + SetCursorBidiLevel( std::min( nCurrLevel, nPrevLevel ) ); } else - SetCrsrBidiLevel( nCurrLevel ); + SetCursorBidiLevel( nCurrLevel ); } } } @@ -1776,69 +1776,69 @@ void SwCursor::DoSetBidiLevelUpDown() bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, Point* pPt, long nUpDownX ) { - SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(this); - bool bAdjustTableCrsr = false; + SwTableCursor* pTableCursor = dynamic_cast<SwTableCursor*>(this); + bool bAdjustTableCursor = false; // If the point/mark of the table cursor in the same box then set cursor to // beginning of the box - if( pTableCrsr && GetNode().StartOfSectionNode() == + if( pTableCursor && GetNode().StartOfSectionNode() == GetNode( false ).StartOfSectionNode() ) { if ( End() != GetPoint() ) Exchange(); - bAdjustTableCrsr = true; + bAdjustTableCursor = true; } bool bRet = false; Point aPt; if( pPt ) aPt = *pPt; - SwContentFrm* pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + SwContentFrame* pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); - if( pFrm ) + if( pFrame ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); if( !pPt ) { SwRect aTmpRect; - pFrm->GetCharRect( aTmpRect, *GetPoint() ); + pFrame->GetCharRect( aTmpRect, *GetPoint() ); aPt = aTmpRect.Pos(); - nUpDownX = pFrm->IsVertical() ? - aPt.getY() - pFrm->Frm().Top() : - aPt.getX() - pFrm->Frm().Left(); + nUpDownX = pFrame->IsVertical() ? + aPt.getY() - pFrame->Frame().Top() : + aPt.getX() - pFrame->Frame().Left(); } // It is allowed to move footnotes in other footnotes but not sections - const bool bChkRange = !pFrm->IsInFootnote() || HasMark(); + const bool bChkRange = !pFrame->IsInFootnote() || HasMark(); const SwPosition aOldPos( *GetPoint() ); const bool bInReadOnly = IsReadOnlyAvailable(); - if ( bAdjustTableCrsr && !bUp ) + if ( bAdjustTableCursor && !bUp ) { // Special case: We have a table cursor but the start box has more // than one paragraph. If we want to go down, we have to set the // point to the last frame in the table box. This is only necessary // if we do not already have a table selection const SwStartNode* pTableNd = GetNode().FindTableBoxStartNode(); - OSL_ENSURE( pTableNd, "pTableCrsr without SwTableNode?" ); + OSL_ENSURE( pTableNd, "pTableCursor without SwTableNode?" ); if ( pTableNd ) // safety first { const SwNode* pEndNd = pTableNd->EndOfSectionNode(); GetPoint()->nNode = *pEndNd; - pTableCrsr->Move( fnMoveBackward, fnGoNode ); - pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + pTableCursor->Move( fnMoveBackward, fnGoNode ); + pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); } } while( nCnt && - (bUp ? pFrm->UnitUp( this, nUpDownX, bInReadOnly ) - : pFrm->UnitDown( this, nUpDownX, bInReadOnly ) ) && + (bUp ? pFrame->UnitUp( this, nUpDownX, bInReadOnly ) + : pFrame->UnitDown( this, nUpDownX, bInReadOnly ) ) && CheckNodesRange( aOldPos.nNode, GetPoint()->nNode, bChkRange )) { - pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); --nCnt; } @@ -1846,27 +1846,27 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, if( !nCnt && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) { - if( !pTableCrsr ) + if( !pTableCursor ) { // try to position the cursor at half of the char-rect's height - pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); - SwCrsrMoveState eTmpState( MV_UPDOWN ); + pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + SwCursorMoveState eTmpState( MV_UPDOWN ); eTmpState.m_bSetInReadOnly = bInReadOnly; SwRect aTmpRect; - pFrm->GetCharRect( aTmpRect, *GetPoint(), &eTmpState ); - if ( pFrm->IsVertical() ) + pFrame->GetCharRect( aTmpRect, *GetPoint(), &eTmpState ); + if ( pFrame->IsVertical() ) { aPt.setX(aTmpRect.Center().getX()); - pFrm->Calc(pFrm->getRootFrm()->GetCurrShell()->GetOut()); - aPt.setY(pFrm->Frm().Top() + nUpDownX); + pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut()); + aPt.setY(pFrame->Frame().Top() + nUpDownX); } else { aPt.setY(aTmpRect.Center().getY()); - pFrm->Calc(pFrm->getRootFrm()->GetCurrShell()->GetOut()); - aPt.setX(pFrm->Frm().Left() + nUpDownX); + pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut()); + aPt.setX(pFrame->Frame().Left() + nUpDownX); } - pFrm->GetCrsrOfst( GetPoint(), aPt, &eTmpState ); + pFrame->GetCursorOfst( GetPoint(), aPt, &eTmpState ); } bRet = !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ); } @@ -1881,15 +1881,15 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, bool SwCursor::LeftRightMargin( bool bLeft, bool bAPI ) { Point aPt; - SwContentFrm * pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); // calculate cursor bidi level - if ( pFrm ) - SetCrsrBidiLevel( pFrm->IsRightToLeft() ? 1 : 0 ); + if ( pFrame ) + SetCursorBidiLevel( pFrame->IsRightToLeft() ? 1 : 0 ); - SwCrsrSaveState aSave( *this ); - return pFrm - && (bLeft ? pFrm->LeftMargin( this ) : pFrm->RightMargin( this, bAPI ) ) + SwCursorSaveState aSave( *this ); + return pFrame + && (bLeft ? pFrame->LeftMargin( this ) : pFrame->RightMargin( this, bAPI ) ) && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ); } @@ -1897,14 +1897,14 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const { bool bRet = false; Point aPt; - SwContentFrm * pFrm = GetContentNode()->getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); - if( pFrm ) + SwContentFrame * pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() ); + if( pFrame ) { SwPaM aPam( *GetPoint() ); if( !bLeft && aPam.GetPoint()->nContent.GetIndex() ) --aPam.GetPoint()->nContent; - bRet = (bLeft ? pFrm->LeftMargin( &aPam ) - : pFrm->RightMargin( &aPam, bAPI )) + bRet = (bLeft ? pFrame->LeftMargin( &aPam ) + : pFrame->RightMargin( &aPam, bAPI )) && *aPam.GetPoint() == *GetPoint(); } return bRet; @@ -1912,7 +1912,7 @@ bool SwCursor::IsAtLeftRightMargin( bool bLeft, bool bAPI ) const bool SwCursor::SttEndDoc( bool bStt ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); // Never jump over section boundaries during selection! // Can the cursor still moved on? SwMoveFn fnMove = bStt ? fnMoveBackward : fnMoveForward; @@ -1933,7 +1933,7 @@ bool SwCursor::GoPrevNextCell( bool bNext, sal_uInt16 nCnt ) // If there is another EndNode in front of the cell's StartNode then there // exists a previous cell - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); SwNodeIndex& rPtIdx = GetPoint()->nNode; while( nCnt-- ) @@ -2001,7 +2001,7 @@ bool SwCursor::GotoTable( const OUString& rName ) if( pTmpTable ) { // a table in a normal nodes array - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); GetPoint()->nNode = *pTmpTable->GetTabSortBoxes()[ 0 ]-> GetSttNd()->FindTableNode(); Move( fnMoveForward, fnGoContent ); @@ -2023,7 +2023,7 @@ bool SwCursor::GotoTableBox( const OUString& rName ) ( !pTableBox->GetFrameFormat()->GetProtect().IsContentProtected() || IsReadOnlyAvailable() ) ) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); GetPoint()->nNode = *pTableBox->GetSttNd(); Move( fnMoveForward, fnGoContent ); bRet = !IsSelOvr(); @@ -2064,7 +2064,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) // else we must use the SaveStructure, because the next/prev is not // a same node type. - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); return (*fnWhichPara)( *this, fnPosPara ) && !IsInProtectTable( true ) && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | @@ -2074,7 +2074,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) bool SwCursor::MoveSection( SwWhichSection fnWhichSect, SwPosSection fnPosSect) { - SwCrsrSaveState aSave( *this ); + SwCursorSaveState aSave( *this ); return (*fnWhichSect)( *this, fnPosSect ) && !IsInProtectTable( true ) && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | @@ -2088,7 +2088,7 @@ void SwCursor::RestoreSavePos() sal_uLong uNodeCount = GetPoint()->nNode.GetNodes().Count(); OSL_ENSURE(!m_pSavePos || m_pSavePos->nNode < uNodeCount, "SwCursor::RestoreSavePos: invalid node: " - "probably something was deleted; consider using SwUnoCrsr instead"); + "probably something was deleted; consider using SwUnoCursor instead"); if (m_pSavePos && m_pSavePos->nNode < uNodeCount) { GetPoint()->nNode = m_pSavePos->nNode; @@ -2149,7 +2149,7 @@ lcl_SeekEntry(const SwSelBoxes& rTmp, SwStartNode const*const pSrch, return false; } -SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) +SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCursor ) { if (m_bChanged) { @@ -2170,9 +2170,9 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) SwSelBoxes aTmp(m_SelectedBoxes); // compare old and new ones - SwNodes& rNds = pAktCrsr->GetDoc()->GetNodes(); + SwNodes& rNds = pAktCursor->GetDoc()->GetNodes(); const SwStartNode* pSttNd; - SwPaM* pCur = pAktCrsr; + SwPaM* pCur = pAktCursor; do { size_t nPos; bool bDel = false; @@ -2212,12 +2212,12 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) { SwPaM* pDel = pCur->GetPrev(); - if( pDel == pAktCrsr ) - pAktCrsr->DeleteMark(); + if( pDel == pAktCursor ) + pAktCursor->DeleteMark(); else delete pDel; } - } while ( pAktCrsr != pCur ); + } while ( pAktCursor != pCur ); for (size_t nPos = 0; nPos < aTmp.size(); ++nPos) { @@ -2230,9 +2230,9 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) if( !pNd->IsContentNode() ) pNd = rNds.GoNextSection( &aIdx, true, false ); - SwPaM *const pNew = (!pAktCrsr->IsMultiSelection() && !pAktCrsr->HasMark()) - ? pAktCrsr - : pAktCrsr->Create( pAktCrsr ); + SwPaM *const pNew = (!pAktCursor->IsMultiSelection() && !pAktCursor->HasMark()) + ? pAktCursor + : pAktCursor->Create( pAktCursor ); pNew->GetPoint()->nNode = *pNd; pNew->GetPoint()->nContent.Assign( static_cast<SwContentNode*>(pNd), 0 ); pNew->SetMark(); @@ -2245,7 +2245,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) pPos->nContent.Assign(static_cast<SwContentNode*>(pNd), pNd ? static_cast<SwContentNode*>(pNd)->Len() : 0); } } - return pAktCrsr; + return pAktCursor; } void SwTableCursor::InsertBox( const SwTableBox& rTableBox ) @@ -2317,9 +2317,9 @@ void SwTableCursor::ActualizeSelection( const SwSelBoxes &rNew ) } } -bool SwTableCursor::IsCrsrMovedUpdate() +bool SwTableCursor::IsCursorMovedUpdate() { - if( !IsCrsrMoved() ) + if( !IsCursorMoved() ) return false; m_nTableMkNd = GetMark()->nNode.GetIndex(); @@ -2330,7 +2330,7 @@ bool SwTableCursor::IsCrsrMovedUpdate() } /// park table cursor on the boxes' start node -void SwTableCursor::ParkCrsr() +void SwTableCursor::ParkCursor() { // de-register index from text node SwNode* pNd = &GetPoint()->nNode.GetNode(); diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx index 2bd322f77794..fcfeb3053947 100644 --- a/sw/source/core/crsr/trvlcol.cxx +++ b/sw/source/core/crsr/trvlcol.cxx @@ -25,41 +25,41 @@ #include <viscrs.hxx> #include <callnk.hxx> -SwLayoutFrm* GetCurrColumn( const SwLayoutFrm* pLayFrm ) +SwLayoutFrame* GetCurrColumn( const SwLayoutFrame* pLayFrame ) { - while( pLayFrm && !pLayFrm->IsColumnFrm() ) - pLayFrm = pLayFrm->GetUpper(); - return const_cast<SwLayoutFrm*>(pLayFrm); + while( pLayFrame && !pLayFrame->IsColumnFrame() ) + pLayFrame = pLayFrame->GetUpper(); + return const_cast<SwLayoutFrame*>(pLayFrame); } -SwLayoutFrm* GetNextColumn( const SwLayoutFrm* pLayFrm ) +SwLayoutFrame* GetNextColumn( const SwLayoutFrame* pLayFrame ) { - SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm ); - return pActCol ? static_cast<SwLayoutFrm*>(pActCol->GetNext()) : nullptr; + SwLayoutFrame* pActCol = GetCurrColumn( pLayFrame ); + return pActCol ? static_cast<SwLayoutFrame*>(pActCol->GetNext()) : nullptr; } -SwLayoutFrm* GetPrevColumn( const SwLayoutFrm* pLayFrm ) +SwLayoutFrame* GetPrevColumn( const SwLayoutFrame* pLayFrame ) { - SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm ); - return pActCol ? static_cast<SwLayoutFrm*>(pActCol->GetPrev()) : nullptr; + SwLayoutFrame* pActCol = GetCurrColumn( pLayFrame ); + return pActCol ? static_cast<SwLayoutFrame*>(pActCol->GetPrev()) : nullptr; } -SwContentFrm* GetColumnStt( const SwLayoutFrm* pColFrm ) +SwContentFrame* GetColumnStt( const SwLayoutFrame* pColFrame ) { - return pColFrm ? const_cast<SwContentFrm*>(pColFrm->ContainsContent()) : nullptr; + return pColFrame ? const_cast<SwContentFrame*>(pColFrame->ContainsContent()) : nullptr; } -SwContentFrm* GetColumnEnd( const SwLayoutFrm* pColFrm ) +SwContentFrame* GetColumnEnd( const SwLayoutFrame* pColFrame ) { - SwContentFrm *pRet = GetColumnStt( pColFrm ); + SwContentFrame *pRet = GetColumnStt( pColFrame ); if( !pRet ) return nullptr; - SwContentFrm *pNxt = pRet->GetNextContentFrm(); - while( pNxt && pColFrm->IsAnLower( pNxt ) ) + SwContentFrame *pNxt = pRet->GetNextContentFrame(); + while( pNxt && pColFrame->IsAnLower( pNxt ) ) { pRet = pNxt; - pNxt = pNxt->GetNextContentFrm(); + pNxt = pNxt->GetNextContentFrame(); } return pRet; } @@ -70,36 +70,36 @@ SwWhichColumn fnColumnNext = &GetNextColumn; SwPosColumn fnColumnStart = &GetColumnStt; SwPosColumn fnColumnEnd = &GetColumnEnd; -bool SwCrsrShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol ) +bool SwCursorShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol ) { bool bRet = false; - if( !m_pTableCrsr ) + if( !m_pTableCursor ) { - SwLayoutFrm* pLayFrm = GetCurrFrm()->GetUpper(); - if( pLayFrm && nullptr != ( pLayFrm = (*fnWhichCol)( pLayFrm )) ) + SwLayoutFrame* pLayFrame = GetCurrFrame()->GetUpper(); + if( pLayFrame && nullptr != ( pLayFrame = (*fnWhichCol)( pLayFrame )) ) { - SwContentFrm* pCnt = (*fnPosCol)( pLayFrm ); + SwContentFrame* pCnt = (*fnPosCol)( pLayFrame ); if( pCnt ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed + SwCursorSaveState aSaveState( *m_pCurrentCursor ); pCnt->Calc(GetOut()); - Point aPt( pCnt->Frm().Pos() + pCnt->Prt().Pos() ); + Point aPt( pCnt->Frame().Pos() + pCnt->Prt().Pos() ); if( fnPosCol == GetColumnEnd ) { aPt.setX(aPt.getX() + pCnt->Prt().Width()); aPt.setY(aPt.getY() + pCnt->Prt().Height()); } - pCnt->GetCrsrOfst( m_pCurCrsr->GetPoint(), aPt ); + pCnt->GetCursorOfst( m_pCurrentCursor->GetPoint(), aPt ); - if( !m_pCurCrsr->IsInProtectTable( true ) && - !m_pCurCrsr->IsSelOvr() ) + if( !m_pCurrentCursor->IsInProtectTable( true ) && + !m_pCurrentCursor->IsSelOvr() ) { - UpdateCrsr(); + UpdateCursor(); bRet = true; } } diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 2bd5e3772fa4..d1d78b85939b 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -35,14 +35,14 @@ #include <viscrs.hxx> #include <callnk.hxx> -bool SwCrsrShell::CallCrsrFN( FNCrsr fnCrsr ) +bool SwCursorShell::CallCursorFN( FNCursor fnCursor ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCursor* pCrsr = getShellCrsr( true ); - bool bRet = (pCrsr->*fnCrsr)(); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursor* pCursor = getShellCursor( true ); + bool bRet = (pCursor->*fnCursor)(); if( bRet ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); return bRet; } @@ -58,7 +58,7 @@ bool SwCursor::GotoFootnoteText() : nullptr); if (pFootnote) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); GetPoint()->nNode = *static_cast<SwTextFootnote*>(pFootnote)->GetStartNode(); SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( @@ -74,47 +74,47 @@ bool SwCursor::GotoFootnoteText() return bRet; } -bool SwCrsrShell::GotoFootnoteText() +bool SwCursorShell::GotoFootnoteText() { - bool bRet = CallCrsrFN( &SwCursor::GotoFootnoteText ); + bool bRet = CallCursorFN( &SwCursor::GotoFootnoteText ); if( !bRet ) { - SwTextNode* pTextNd = _GetCrsr() ? - _GetCrsr()->GetPoint()->nNode.GetNode().GetTextNode() : nullptr; + SwTextNode* pTextNd = _GetCursor() ? + _GetCursor()->GetPoint()->nNode.GetNode().GetTextNode() : nullptr; if( pTextNd ) { - const SwFrm *pFrm = pTextNd->getLayoutFrm( GetLayout(), &_GetCrsr()->GetSttPos(), - _GetCrsr()->Start() ); - const SwFootnoteBossFrm* pFootnoteBoss; - bool bSkip = pFrm && pFrm->IsInFootnote(); - while( pFrm && nullptr != ( pFootnoteBoss = pFrm->FindFootnoteBossFrm() ) ) + const SwFrame *pFrame = pTextNd->getLayoutFrame( GetLayout(), &_GetCursor()->GetSttPos(), + _GetCursor()->Start() ); + const SwFootnoteBossFrame* pFootnoteBoss; + bool bSkip = pFrame && pFrame->IsInFootnote(); + while( pFrame && nullptr != ( pFootnoteBoss = pFrame->FindFootnoteBossFrame() ) ) { - if( nullptr != ( pFrm = pFootnoteBoss->FindFootnoteCont() ) ) + if( nullptr != ( pFrame = pFootnoteBoss->FindFootnoteCont() ) ) { if( bSkip ) bSkip = false; else { - const SwContentFrm* pCnt = static_cast<const SwLayoutFrm*> - (pFrm)->ContainsContent(); + const SwContentFrame* pCnt = static_cast<const SwLayoutFrame*> + (pFrame)->ContainsContent(); if( pCnt ) { const SwContentNode* pNode = pCnt->GetNode(); - _GetCrsr()->GetPoint()->nNode = *pNode; - _GetCrsr()->GetPoint()->nContent.Assign( + _GetCursor()->GetPoint()->nNode = *pNode; + _GetCursor()->GetPoint()->nContent.Assign( const_cast<SwContentNode*>(pNode), - static_cast<const SwTextFrm*>(pCnt)->GetOfst() ); - UpdateCrsr( SwCrsrShell::SCROLLWIN | - SwCrsrShell::CHKRANGE | SwCrsrShell::READONLY ); + static_cast<const SwTextFrame*>(pCnt)->GetOfst() ); + UpdateCursor( SwCursorShell::SCROLLWIN | + SwCursorShell::CHKRANGE | SwCursorShell::READONLY ); bRet = true; break; } } } - if( pFootnoteBoss->GetNext() && !pFootnoteBoss->IsPageFrm() ) - pFrm = pFootnoteBoss->GetNext(); + if( pFootnoteBoss->GetNext() && !pFootnoteBoss->IsPageFrame() ) + pFrame = pFootnoteBoss->GetNext(); else - pFrm = pFootnoteBoss->GetUpper(); + pFrame = pFootnoteBoss->GetUpper(); } } } @@ -134,7 +134,7 @@ bool SwCursor::GotoFootnoteAnchor() if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() && pSttNd == &pTextFootnote->GetStartNode()->GetNode() ) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); GetPoint()->nNode = rTNd; @@ -147,17 +147,17 @@ bool SwCursor::GotoFootnoteAnchor() return false; } -bool SwCrsrShell::GotoFootnoteAnchor() +bool SwCursorShell::GotoFootnoteAnchor() { // jump from footnote to anchor - SwCallLink aLk( *this ); // watch Crsr-Moves - bool bRet = m_pCurCrsr->GotoFootnoteAnchor(); + SwCallLink aLk( *this ); // watch Cursor-Moves + bool bRet = m_pCurrentCursor->GotoFootnoteAnchor(); if( bRet ) { // special treatment for table header row - m_pCurCrsr->GetPtPos() = Point(); - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + m_pCurrentCursor->GetPtPos() = Point(); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } return bRet; } @@ -223,7 +223,7 @@ bool SwCursor::GotoNextFootnoteAnchor() bool bRet = nullptr != pTextFootnote; if( bRet ) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); GetPoint()->nNode = rTNd; @@ -280,7 +280,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() bool bRet = nullptr != pTextFootnote; if( bRet ) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); GetPoint()->nNode = rTNd; @@ -290,49 +290,49 @@ bool SwCursor::GotoPrevFootnoteAnchor() return bRet; } -bool SwCrsrShell::GotoNextFootnoteAnchor() +bool SwCursorShell::GotoNextFootnoteAnchor() { - return CallCrsrFN( &SwCursor::GotoNextFootnoteAnchor ); + return CallCursorFN( &SwCursor::GotoNextFootnoteAnchor ); } -bool SwCrsrShell::GotoPrevFootnoteAnchor() +bool SwCursorShell::GotoPrevFootnoteAnchor() { - return CallCrsrFN( &SwCursor::GotoPrevFootnoteAnchor ); + return CallCursorFN( &SwCursor::GotoPrevFootnoteAnchor ); } /// jump from border to anchor -bool SwCrsrShell::GotoFlyAnchor() +bool SwCursorShell::GotoFlyAnchor() { SET_CURR_SHELL( this ); - const SwFrm* pFrm = GetCurrFrm(); + const SwFrame* pFrame = GetCurrFrame(); do { - pFrm = pFrm->GetUpper(); - } while( pFrm && !pFrm->IsFlyFrm() ); + pFrame = pFrame->GetUpper(); + } while( pFrame && !pFrame->IsFlyFrame() ); - if( !pFrm ) // no FlyFrame + if( !pFrame ) // no FlyFrame return false; - SwCallLink aLk( *this ); // watch Crsr-Moves - SwCrsrSaveState aSaveState( *m_pCurCrsr ); + SwCallLink aLk( *this ); // watch Cursor-Moves + SwCursorSaveState aSaveState( *m_pCurrentCursor ); // jump in BodyFrame closest to FlyFrame SwRect aTmpRect( m_aCharRect ); - if( !pFrm->Frm().IsInside( aTmpRect )) - aTmpRect = pFrm->Frm(); + if( !pFrame->Frame().IsInside( aTmpRect )) + aTmpRect = pFrame->Frame(); Point aPt( aTmpRect.Left(), aTmpRect.Top() + ( aTmpRect.Bottom() - aTmpRect.Top() ) / 2 ); - aPt.setX(aPt.getX() > (pFrm->Frm().Left() + (pFrm->Frm().SSize().Width() / 2 )) - ? pFrm->Frm().Right() - : pFrm->Frm().Left()); + aPt.setX(aPt.getX() > (pFrame->Frame().Left() + (pFrame->Frame().SSize().Width() / 2 )) + ? pFrame->Frame().Right() + : pFrame->Frame().Left()); - const SwPageFrm* pPageFrm = pFrm->FindPageFrm(); - const SwContentFrm* pFndFrm = pPageFrm->GetContentPos( aPt, false, true ); - pFndFrm->GetCrsrOfst( m_pCurCrsr->GetPoint(), aPt ); + const SwPageFrame* pPageFrame = pFrame->FindPageFrame(); + const SwContentFrame* pFndFrame = pPageFrame->GetContentPos( aPt, false, true ); + pFndFrame->GetCursorOfst( m_pCurrentCursor->GetPoint(), aPt ); - bool bRet = !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr(); + bool bRet = !m_pCurrentCursor->IsInProtectTable() && !m_pCurrentCursor->IsSelOvr(); if( bRet ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); return bRet; } diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 6e332c5da6e8..2aef93f8a8ae 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -28,10 +28,10 @@ #include <section.hxx> #include <trvlreg.hxx> -bool GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, +bool GotoPrevRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, bool bInReadOnly ) { - SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwSectionNode* pNd = aIdx.GetNode().FindSectionNode(); if( pNd ) aIdx.Assign( *pNd, - 1 ); @@ -60,7 +60,7 @@ bool GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, --aIdx; continue; } - rCurCrsr.GetPoint()->nContent.Assign( pCNd, 0 ); + rCurrentCursor.GetPoint()->nContent.Assign( pCNd, 0 ); } else { @@ -72,19 +72,19 @@ bool GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, aIdx.Assign( *pNd, - 1 ); continue; } - rCurCrsr.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + rCurrentCursor.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); } - rCurCrsr.GetPoint()->nNode = aIdx; + rCurrentCursor.GetPoint()->nNode = aIdx; return true; } } while( pNd ); return false; } -bool GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, +bool GotoNextRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, bool bInReadOnly ) { - SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwSectionNode* pNd = aIdx.GetNode().FindSectionNode(); if( pNd ) aIdx.Assign( *pNd->EndOfSectionNode(), - 1 ); @@ -114,7 +114,7 @@ bool GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, aIdx.Assign( *pNd->EndOfSectionNode(), +1 ); continue; } - rCurCrsr.GetPoint()->nContent.Assign( pCNd, 0 ); + rCurrentCursor.GetPoint()->nContent.Assign( pCNd, 0 ); } else { @@ -126,23 +126,23 @@ bool GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, ++aIdx; continue; } - rCurCrsr.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + rCurrentCursor.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); } - rCurCrsr.GetPoint()->nNode = aIdx; + rCurrentCursor.GetPoint()->nNode = aIdx; return true; } } while( pNd ); return false; } -bool GotoCurrRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, +bool GotoCurrRegion( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, bool bInReadOnly ) { - SwSectionNode* pNd = rCurCrsr.GetNode().FindSectionNode(); + SwSectionNode* pNd = rCurrentCursor.GetNode().FindSectionNode(); if( !pNd ) return false; - SwPosition* pPos = rCurCrsr.GetPoint(); + SwPosition* pPos = rCurrentCursor.GetPoint(); bool bMoveBackward = fnPosRegion == fnMoveBackward; SwContentNode* pCNd; @@ -165,15 +165,15 @@ bool GotoCurrRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, return nullptr != pCNd; } -bool GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, +bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwPosRegion fnPosRegion, bool bInReadOnly ) { - SwNode& rCurrNd = rCurCrsr.GetNode(); + SwNode& rCurrNd = rCurrentCursor.GetNode(); SwSectionNode* pNd = rCurrNd.FindSectionNode(); if( !pNd ) return false; - SwPosition* pPos = rCurCrsr.GetPoint(); + SwPosition* pPos = rCurrentCursor.GetPoint(); const sal_Int32 nCurrCnt = pPos->nContent.GetIndex(); bool bMoveBackward = fnPosRegion == fnMoveBackward; @@ -212,7 +212,7 @@ bool GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); return !dynamic_cast<SwTableCursor*>(this) && (*fnWhichRegion)( *this, fnPosRegion, IsReadOnlyAvailable() ) && !IsSelOvr() && @@ -220,12 +220,12 @@ bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion GetPoint()->nContent.GetIndex() != m_pSavePos->nContent); } -bool SwCrsrShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) +bool SwCursorShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) { - SwCallLink aLk( *this ); // watch Crsr-Moves;call Link if needed - bool bRet = !m_pTableCrsr && m_pCurCrsr->MoveRegion( fnWhichRegion, fnPosRegion ); + SwCallLink aLk( *this ); // watch Cursor-Moves;call Link if needed + bool bRet = !m_pTableCursor && m_pCurrentCursor->MoveRegion( fnWhichRegion, fnPosRegion ); if( bRet ) - UpdateCrsr(); + UpdateCursor(); return bRet; } @@ -244,7 +244,7 @@ bool SwCursor::GotoRegion( const OUString& rName ) pIdx->GetNode().GetNodes().IsDocNodes() ) { // area in normal nodes array - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); GetPoint()->nNode = *pIdx; Move( fnMoveForward, fnGoContent ); @@ -254,13 +254,13 @@ bool SwCursor::GotoRegion( const OUString& rName ) return bRet; } -bool SwCrsrShell::GotoRegion( const OUString& rName ) +bool SwCursorShell::GotoRegion( const OUString& rName ) { - SwCallLink aLk( *this ); // watch Crsr-Moves;call Link if needed - bool bRet = !m_pTableCrsr && m_pCurCrsr->GotoRegion( rName ); + SwCallLink aLk( *this ); // watch Cursor-Moves;call Link if needed + bool bRet = !m_pTableCursor && m_pCurrentCursor->GotoRegion( rName ); if( bRet ) - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); return bRet; } diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 8e3dbe6b7d1b..1aa1e581bf68 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -41,32 +41,32 @@ #include <IDocumentLayoutAccess.hxx> /// set cursor into next/previous cell -bool SwCrsrShell::GoNextCell( bool bAppendLine ) +bool SwCursorShell::GoNextCell( bool bAppendLine ) { bool bRet = false; const SwTableNode* pTableNd = nullptr; - if( IsTableMode() || nullptr != ( pTableNd = IsCrsrInTable() )) + if( IsTableMode() || nullptr != ( pTableNd = IsCursorInTable() )) { - SwCursor* pCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; - SwCallLink aLk( *this ); // watch Crsr-Moves + SwCursor* pCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; + SwCallLink aLk( *this ); // watch Cursor-Moves bRet = true; // Check if we have to move the cursor to a covered cell before // proceeding: - const SwNode* pTableBoxStartNode = pCrsr->GetNode().FindTableBoxStartNode(); + const SwNode* pTableBoxStartNode = pCursor->GetNode().FindTableBoxStartNode(); const SwTableBox* pTableBox = nullptr; - if ( pCrsr->GetCrsrRowSpanOffset() ) + if ( pCursor->GetCursorRowSpanOffset() ) { pTableBox = pTableBoxStartNode->GetTableBox(); if ( pTableBox->getRowSpan() > 1 ) { if ( !pTableNd ) - pTableNd = IsCrsrInTable(); + pTableNd = IsCursorInTable(); assert (pTableNd); pTableBox = & pTableBox->FindEndOfRowSpan( pTableNd->GetTable(), - (sal_uInt16)(pTableBox->getRowSpan() + pCrsr->GetCrsrRowSpanOffset() ) ); + (sal_uInt16)(pTableBox->getRowSpan() + pCursor->GetCursorRowSpanOffset() ) ); pTableBoxStartNode = pTableBox->GetSttNd(); } } @@ -77,14 +77,14 @@ bool SwCrsrShell::GoNextCell( bool bAppendLine ) // there is another cell if( !aCellStt.GetNode().IsStartNode() ) { - if( pCrsr->HasMark() || !bAppendLine ) + if( pCursor->HasMark() || !bAppendLine ) bRet = false; else if (pTableNd) { // if there is no list anymore then create new one if ( !pTableBox ) pTableBox = pTableNd->GetTable().GetTableBox( - pCrsr->GetPoint()->nNode.GetNode(). + pCursor->GetPoint()->nNode.GetNode(). StartOfSectionIndex() ); OSL_ENSURE( pTableBox, "Box is not in this table" ); @@ -96,48 +96,48 @@ bool SwCrsrShell::GoNextCell( bool bAppendLine ) static_cast<SwEditShell*>(this)->EndAllAction(); } } - if( bRet && ( bRet = pCrsr->GoNextCell() ) ) - UpdateCrsr(); + if( bRet && ( bRet = pCursor->GoNextCell() ) ) + UpdateCursor(); } return bRet; } -bool SwCrsrShell::GoPrevCell() +bool SwCursorShell::GoPrevCell() { bool bRet = false; - if( IsTableMode() || IsCrsrInTable() ) + if( IsTableMode() || IsCursorInTable() ) { - SwCursor* pCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; - SwCallLink aLk( *this ); // watch Crsr-Moves - bRet = pCrsr->GoPrevCell(); + SwCursor* pCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; + SwCallLink aLk( *this ); // watch Cursor-Moves + bRet = pCursor->GoPrevCell(); if( bRet ) - UpdateCrsr(); // update current cursor + UpdateCursor(); // update current cursor } return bRet; } -static const SwFrm* lcl_FindMostUpperCellFrm( const SwFrm* pFrm ) +static const SwFrame* lcl_FindMostUpperCellFrame( const SwFrame* pFrame ) { - while ( pFrm && - ( !pFrm->IsCellFrm() || - !pFrm->GetUpper()->GetUpper()->IsTabFrm() || - pFrm->GetUpper()->GetUpper()->GetUpper()->IsInTab() ) ) + while ( pFrame && + ( !pFrame->IsCellFrame() || + !pFrame->GetUpper()->GetUpper()->IsTabFrame() || + pFrame->GetUpper()->GetUpper()->GetUpper()->IsInTab() ) ) { - pFrm = pFrm->GetUpper(); + pFrame = pFrame->GetUpper(); } - return pFrm; + return pFrame; } -bool SwCrsrShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) +bool SwCursorShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) { // check if the current cursor's SPoint/Mark are in a table - SwFrm *pFrm = GetCurrFrm(); - if( !pFrm->IsInTab() ) + SwFrame *pFrame = GetCurrFrame(); + if( !pFrame->IsInTab() ) return false; - const SwTabFrm* pTabFrm = pFrm->FindTabFrm(); - const SwTabFrm* pMasterTabFrm = pTabFrm->IsFollow() ? pTabFrm->FindMaster( true ) : pTabFrm; - const SwTable* pTable = pTabFrm->GetTable(); + const SwTabFrame* pTabFrame = pFrame->FindTabFrame(); + const SwTabFrame* pMasterTabFrame = pTabFrame->IsFollow() ? pTabFrame->FindMaster( true ) : pTabFrame; + const SwTable* pTable = pTabFrame->GetTable(); SET_CURR_SHELL( this ); @@ -165,9 +165,9 @@ bool SwCrsrShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) // #i32329# Enhanced table selection else if ( pTable->IsNewModel() ) { - const SwShellCrsr *pCrsr = _GetCrsr(); + const SwShellCursor *pCursor = _GetCursor(); SwTable::SearchType eSearchType = bRow ? SwTable::SEARCH_ROW : SwTable::SEARCH_COL; - pTable->CreateSelection( *pCrsr, aBoxes, eSearchType, bCheckProtected ); + pTable->CreateSelection( *pCursor, aBoxes, eSearchType, bCheckProtected ); if( aBoxes.empty() ) return false; @@ -176,21 +176,21 @@ bool SwCrsrShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) } else { - const SwShellCrsr *pCrsr = _GetCrsr(); - const SwFrm* pStartFrm = pFrm; - const SwContentNode *pCNd = pCrsr->GetContentNode( false ); - const SwFrm* pEndFrm = pCNd ? pCNd->getLayoutFrm( GetLayout(), &pCrsr->GetMkPos() ) : nullptr; + const SwShellCursor *pCursor = _GetCursor(); + const SwFrame* pStartFrame = pFrame; + const SwContentNode *pCNd = pCursor->GetContentNode( false ); + const SwFrame* pEndFrame = pCNd ? pCNd->getLayoutFrame( GetLayout(), &pCursor->GetMkPos() ) : nullptr; if ( bRow ) { - pStartFrm = lcl_FindMostUpperCellFrm( pStartFrm ); - pEndFrm = lcl_FindMostUpperCellFrm( pEndFrm ); + pStartFrame = lcl_FindMostUpperCellFrame( pStartFrame ); + pEndFrame = lcl_FindMostUpperCellFrame( pEndFrame ); } - if ( !pStartFrm || !pEndFrm ) + if ( !pStartFrame || !pEndFrame ) return false; - const bool bVert = pFrm->ImplFindTabFrm()->IsVertical(); + const bool bVert = pFrame->ImplFindTabFrame()->IsVertical(); // If we select upwards it is sufficient to set pStt and pEnd // to the first resp. last box of the selection obtained from @@ -198,10 +198,10 @@ bool SwCrsrShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) // located at the corners of the selection. This does not work // for column selections in vertical tables: const bool bSelectUp = ( bVert && !bRow ) || - *pCrsr->GetPoint() <= *pCrsr->GetMark(); - SwCellFrms aCells; - GetTableSel( static_cast<const SwCellFrm*>(pStartFrm), - static_cast<const SwCellFrm*>(pEndFrm), + *pCursor->GetPoint() <= *pCursor->GetMark(); + SwCellFrames aCells; + GetTableSel( static_cast<const SwCellFrame*>(pStartFrame), + static_cast<const SwCellFrame*>(pEndFrame), aBoxes, bSelectUp ? nullptr : &aCells, eType ); if( aBoxes.empty() || ( !bSelectUp && 4 != aCells.size() ) ) @@ -222,81 +222,81 @@ bool SwCrsrShell::_SelTableRowOrCol( bool bRow, bool bRowSimple ) } // if no table cursor exists, create one - if( !m_pTableCrsr ) + if( !m_pTableCursor ) { - m_pTableCrsr = new SwShellTableCrsr( *this, *m_pCurCrsr->GetPoint() ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SwSelPaintRects::Hide(); + m_pTableCursor = new SwShellTableCursor( *this, *m_pCurrentCursor->GetPoint() ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SwSelPaintRects::Hide(); } - m_pTableCrsr->DeleteMark(); + m_pTableCursor->DeleteMark(); // set start and end of a column - m_pTableCrsr->GetPoint()->nNode = *pEnd->GetSttNd(); - m_pTableCrsr->Move( fnMoveForward, fnGoContent ); - m_pTableCrsr->SetMark(); - m_pTableCrsr->GetPoint()->nNode = *pStt->GetSttNd()->EndOfSectionNode(); - m_pTableCrsr->Move( fnMoveBackward, fnGoContent ); + m_pTableCursor->GetPoint()->nNode = *pEnd->GetSttNd(); + m_pTableCursor->Move( fnMoveForward, fnGoContent ); + m_pTableCursor->SetMark(); + m_pTableCursor->GetPoint()->nNode = *pStt->GetSttNd()->EndOfSectionNode(); + m_pTableCursor->Move( fnMoveBackward, fnGoContent ); // set PtPos 'close' to the reference table, otherwise we might get problems - // with the repeated headlines check in UpdateCrsr(): + // with the repeated headlines check in UpdateCursor(): if ( !bRow ) - m_pTableCrsr->GetPtPos() = pMasterTabFrm->IsVertical() - ? pMasterTabFrm->Frm().TopRight() - : pMasterTabFrm->Frm().TopLeft(); + m_pTableCursor->GetPtPos() = pMasterTabFrame->IsVertical() + ? pMasterTabFrame->Frame().TopRight() + : pMasterTabFrame->Frame().TopLeft(); - UpdateCrsr(); + UpdateCursor(); return true; } -bool SwCrsrShell::SelTable() +bool SwCursorShell::SelTable() { // check if the current cursor's SPoint/Mark are in a table - SwFrm *pFrm = GetCurrFrm(); - if( !pFrm->IsInTab() ) + SwFrame *pFrame = GetCurrFrame(); + if( !pFrame->IsInTab() ) return false; - const SwTabFrm *pTableFrm = pFrm->ImplFindTabFrm(); - const SwTabFrm* pMasterTabFrm = pTableFrm->IsFollow() ? pTableFrm->FindMaster( true ) : pTableFrm; - const SwTableNode* pTableNd = pTableFrm->GetTable()->GetTableNode(); + const SwTabFrame *pTableFrame = pFrame->ImplFindTabFrame(); + const SwTabFrame* pMasterTabFrame = pTableFrame->IsFollow() ? pTableFrame->FindMaster( true ) : pTableFrame; + const SwTableNode* pTableNd = pTableFrame->GetTable()->GetTableNode(); SET_CURR_SHELL( this ); - if( !m_pTableCrsr ) + if( !m_pTableCursor ) { - m_pTableCrsr = new SwShellTableCrsr( *this, *m_pCurCrsr->GetPoint() ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SwSelPaintRects::Hide(); + m_pTableCursor = new SwShellTableCursor( *this, *m_pCurrentCursor->GetPoint() ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SwSelPaintRects::Hide(); } - m_pTableCrsr->DeleteMark(); - m_pTableCrsr->GetPoint()->nNode = *pTableNd; - m_pTableCrsr->Move( fnMoveForward, fnGoContent ); - m_pTableCrsr->SetMark(); + m_pTableCursor->DeleteMark(); + m_pTableCursor->GetPoint()->nNode = *pTableNd; + m_pTableCursor->Move( fnMoveForward, fnGoContent ); + m_pTableCursor->SetMark(); // set MkPos 'close' to the master table, otherwise we might get problems - // with the repeated headlines check in UpdateCrsr(): - m_pTableCrsr->GetMkPos() = pMasterTabFrm->IsVertical() ? pMasterTabFrm->Frm().TopRight() : pMasterTabFrm->Frm().TopLeft(); - m_pTableCrsr->GetPoint()->nNode = *pTableNd->EndOfSectionNode(); - m_pTableCrsr->Move( fnMoveBackward, fnGoContent ); - UpdateCrsr(); + // with the repeated headlines check in UpdateCursor(): + m_pTableCursor->GetMkPos() = pMasterTabFrame->IsVertical() ? pMasterTabFrame->Frame().TopRight() : pMasterTabFrame->Frame().TopLeft(); + m_pTableCursor->GetPoint()->nNode = *pTableNd->EndOfSectionNode(); + m_pTableCursor->Move( fnMoveBackward, fnGoContent ); + UpdateCursor(); return true; } -bool SwCrsrShell::SelTableBox() +bool SwCursorShell::SelTableBox() { // if we're in a table, create a table cursor, and select the cell // that the current cursor's point resides in // search for start node of our table box. If not found, exit really const SwStartNode* pStartNode = - m_pCurCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode(); + m_pCurrentCursor->GetPoint()->nNode.GetNode().FindTableBoxStartNode(); #if OSL_DEBUG_LEVEL > 0 // the old code checks whether we're in a table by asking the // frame. This should yield the same result as searching for the // table box start node, right? - SwFrm *pFrm = GetCurrFrm(); - OSL_ENSURE( !pFrm->IsInTab() == !(pStartNode != nullptr), + SwFrame *pFrame = GetCurrFrame(); + OSL_ENSURE( !pFrame->IsInTab() == !(pStartNode != nullptr), "Schroedinger's table: We're in a box, and also we aren't." ); #endif if( pStartNode == nullptr ) @@ -305,30 +305,30 @@ bool SwCrsrShell::SelTableBox() SET_CURR_SHELL( this ); // create a table cursor, if there isn't one already - if( !m_pTableCrsr ) + if( !m_pTableCursor ) { - m_pTableCrsr = new SwShellTableCrsr( *this, *m_pCurCrsr->GetPoint() ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SwSelPaintRects::Hide(); + m_pTableCursor = new SwShellTableCursor( *this, *m_pCurrentCursor->GetPoint() ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SwSelPaintRects::Hide(); } - // select the complete box with our shiny new m_pTableCrsr + // select the complete box with our shiny new m_pTableCursor // 1. delete mark, and move point to first content node in box - m_pTableCrsr->DeleteMark(); - *(m_pTableCrsr->GetPoint()) = SwPosition( *pStartNode ); - m_pTableCrsr->Move( fnMoveForward, fnGoNode ); + m_pTableCursor->DeleteMark(); + *(m_pTableCursor->GetPoint()) = SwPosition( *pStartNode ); + m_pTableCursor->Move( fnMoveForward, fnGoNode ); // 2. set mark, and move point to last content node in box - m_pTableCrsr->SetMark(); - *(m_pTableCrsr->GetPoint()) = SwPosition( *(pStartNode->EndOfSectionNode()) ); - m_pTableCrsr->Move( fnMoveBackward, fnGoNode ); + m_pTableCursor->SetMark(); + *(m_pTableCursor->GetPoint()) = SwPosition( *(pStartNode->EndOfSectionNode()) ); + m_pTableCursor->Move( fnMoveBackward, fnGoNode ); // 3. exchange - m_pTableCrsr->Exchange(); + m_pTableCursor->Exchange(); - // with some luck, UpdateCrsr() will now update everything that + // with some luck, UpdateCursor() will now update everything that // needs updating - UpdateCrsr(); + UpdateCursor(); return true; } @@ -369,10 +369,10 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - SwContentFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); + SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); - if ( nullptr == pFrm || pCNd->FindTableNode() != pTableNd || - (!bInReadOnly && pFrm->IsProtected() ) ) + if ( nullptr == pFrame || pCNd->FindTableNode() != pTableNd || + (!bInReadOnly && pFrame->IsProtected() ) ) { // we are not located inside a 'valid' cell. We have to continue searching... @@ -401,10 +401,10 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly ) return false; // check if we have found a suitable table cell: - pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); + pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); - if ( nullptr != pFrm && pCNd->FindTableNode() == pTableNd && - (bInReadOnly || !pFrm->IsProtected() ) ) + if ( nullptr != pFrame && pCNd->FindTableNode() == pTableNd && + (bInReadOnly || !pFrame->IsProtected() ) ) { // finally, we have found a suitable table cell => set index and return rIdx = *pCNd; @@ -441,10 +441,10 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - SwContentFrm* pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); + SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); - if( nullptr == pFrm || pCNd->FindTableNode() != pTableNd || - (!bInReadOnly && pFrm->IsProtected() )) + if( nullptr == pFrame || pCNd->FindTableNode() != pTableNd || + (!bInReadOnly && pFrame->IsProtected() )) { // skip before current section aTmp.Assign( *pCNd->StartOfSectionNode(), -1 ); @@ -462,10 +462,10 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) if ( !pCNd ) return false; - pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); + pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); - if( nullptr != pFrm && pCNd->FindTableNode() == pTableNd && - (bInReadOnly || !pFrm->IsProtected() ) ) + if( nullptr != pFrame && pCNd->FindTableNode() == pTableNd && + (bInReadOnly || !pFrame->IsProtected() ) ) { rIdx = *pCNd; return true; // ok, not protected @@ -477,10 +477,10 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly ) return true; } -bool GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, +bool GotoPrevTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, bool bInReadOnly ) { - SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwTableNode* pTableNd = aIdx.GetNode().FindTableNode(); if( pTableNd ) @@ -528,8 +528,8 @@ bool GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); if ( pTextNode ) { - rCurCrsr.GetPoint()->nNode = *pTextNode; - rCurCrsr.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nNode = *pTextNode; + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -540,16 +540,16 @@ bool GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, return false; } -bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, +bool GotoNextTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, bool bInReadOnly ) { - SwNodeIndex aIdx( rCurCrsr.GetPoint()->nNode ); + SwNodeIndex aIdx( rCurrentCursor.GetPoint()->nNode ); SwTableNode* pTableNd = aIdx.GetNode().FindTableNode(); if( pTableNd ) aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); - sal_uLong nLastNd = rCurCrsr.GetDoc()->GetNodes().Count() - 1; + sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; do { while( aIdx.GetIndex() < nLastNd && nullptr == ( pTableNd = aIdx.GetNode().GetTableNode()) ) @@ -580,8 +580,8 @@ bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); if ( pTextNode ) { - rCurCrsr.GetPoint()->nNode = *pTextNode; - rCurCrsr.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nNode = *pTextNode; + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -592,10 +592,10 @@ bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, return false; } -bool GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, +bool GotoCurrTable( SwPaM& rCurrentCursor, SwPosTable fnPosTable, bool bInReadOnly ) { - SwTableNode* pTableNd = rCurCrsr.GetPoint()->nNode.GetNode().FindTableNode(); + SwTableNode* pTableNd = rCurrentCursor.GetPoint()->nNode.GetNode().FindTableNode(); if( !pTableNd ) return false; @@ -617,8 +617,8 @@ bool GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, if ( pTextNode ) { - rCurCrsr.GetPoint()->nNode = *pTextNode; - rCurCrsr.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? + rCurrentCursor.GetPoint()->nNode = *pTextNode; + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, fnPosTable == fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -629,11 +629,11 @@ bool GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTable, bool SwCursor::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) { bool bRet = false; - SwTableCursor* m_pTableCrsr = dynamic_cast<SwTableCursor*>(this); + SwTableCursor* m_pTableCursor = dynamic_cast<SwTableCursor*>(this); - if( m_pTableCrsr || !HasMark() ) + if( m_pTableCursor || !HasMark() ) { - SwCrsrSaveState aSaveState( *this ); + SwCursorSaveState aSaveState( *this ); bRet = (*fnWhichTable)( *this, fnPosTable, IsReadOnlyAvailable() ) && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ); @@ -641,62 +641,62 @@ bool SwCursor::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) return bRet; } -bool SwCrsrShell::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) +bool SwCursorShell::MoveTable( SwWhichTable fnWhichTable, SwPosTable fnPosTable ) { - SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed - SwShellCrsr* pCrsr = m_pTableCrsr ? m_pTableCrsr : m_pCurCrsr; + SwShellCursor* pCursor = m_pTableCursor ? m_pTableCursor : m_pCurrentCursor; bool bCheckPos; bool bRet; sal_uLong nPtNd = 0; sal_Int32 nPtCnt = 0; - if ( !m_pTableCrsr && m_pCurCrsr->HasMark() ) + if ( !m_pTableCursor && m_pCurrentCursor->HasMark() ) { // switch to table mode - m_pTableCrsr = new SwShellTableCrsr( *this, *m_pCurCrsr->GetPoint() ); - m_pCurCrsr->DeleteMark(); - m_pCurCrsr->SwSelPaintRects::Hide(); - m_pTableCrsr->SetMark(); - pCrsr = m_pTableCrsr; + m_pTableCursor = new SwShellTableCursor( *this, *m_pCurrentCursor->GetPoint() ); + m_pCurrentCursor->DeleteMark(); + m_pCurrentCursor->SwSelPaintRects::Hide(); + m_pTableCursor->SetMark(); + pCursor = m_pTableCursor; bCheckPos = false; } else { bCheckPos = true; - nPtNd = pCrsr->GetPoint()->nNode.GetIndex(); - nPtCnt = pCrsr->GetPoint()->nContent.GetIndex(); + nPtNd = pCursor->GetPoint()->nNode.GetIndex(); + nPtCnt = pCursor->GetPoint()->nContent.GetIndex(); } - bRet = pCrsr->MoveTable( fnWhichTable, fnPosTable ); + bRet = pCursor->MoveTable( fnWhichTable, fnPosTable ); if( bRet ) { // #i45028# - set "top" position for repeated headline rows - pCrsr->GetPtPos() = Point(); + pCursor->GetPtPos() = Point(); - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); if( bCheckPos && - pCrsr->GetPoint()->nNode.GetIndex() == nPtNd && - pCrsr->GetPoint()->nContent.GetIndex() == nPtCnt ) + pCursor->GetPoint()->nNode.GetIndex() == nPtNd && + pCursor->GetPoint()->nContent.GetIndex() == nPtCnt ) bRet = false; } return bRet; } -bool SwCrsrShell::IsTableComplexForChart() +bool SwCursorShell::IsTableComplexForChart() { bool bRet = false; // Here we may trigger table formatting so we better do that inside an action StartAction(); - const SwTableNode* pTNd = m_pCurCrsr->GetPoint()->nNode.GetNode().FindTableNode(); + const SwTableNode* pTNd = m_pCurrentCursor->GetPoint()->nNode.GetNode().FindTableNode(); if( pTNd ) { // in a table; check if table or section is balanced OUString sSel; - if( m_pTableCrsr ) + if( m_pTableCursor ) sSel = GetBoxNms(); bRet = pTNd->GetTable().IsTableComplexForChart( sSel ); } @@ -705,69 +705,69 @@ bool SwCrsrShell::IsTableComplexForChart() return bRet; } -OUString SwCrsrShell::GetBoxNms() const +OUString SwCursorShell::GetBoxNms() const { OUString sNm; const SwPosition* pPos; - SwFrm* pFrm; + SwFrame* pFrame; if( IsTableMode() ) { - SwContentNode *pCNd = m_pTableCrsr->Start()->nNode.GetNode().GetContentNode(); - pFrm = pCNd ? pCNd->getLayoutFrm( GetLayout() ) : nullptr; - if( !pFrm ) + SwContentNode *pCNd = m_pTableCursor->Start()->nNode.GetNode().GetContentNode(); + pFrame = pCNd ? pCNd->getLayoutFrame( GetLayout() ) : nullptr; + if( !pFrame ) return sNm; do { - pFrm = pFrm->GetUpper(); - } while ( pFrm && !pFrm->IsCellFrm() ); + pFrame = pFrame->GetUpper(); + } while ( pFrame && !pFrame->IsCellFrame() ); - OSL_ENSURE( pFrm, "no frame for this box" ); + OSL_ENSURE( pFrame, "no frame for this box" ); - if( !pFrm ) + if( !pFrame ) return sNm; - sNm = static_cast<SwCellFrm*>(pFrm)->GetTabBox()->GetName(); + sNm = static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetName(); sNm += ":"; - pPos = m_pTableCrsr->End(); + pPos = m_pTableCursor->End(); } else { - const SwTableNode* pTableNd = IsCrsrInTable(); + const SwTableNode* pTableNd = IsCursorInTable(); if( !pTableNd ) return sNm; - pPos = GetCrsr()->GetPoint(); + pPos = GetCursor()->GetPoint(); } SwContentNode* pCNd = pPos->nNode.GetNode().GetContentNode(); - pFrm = pCNd ? pCNd->getLayoutFrm( GetLayout() ) : nullptr; + pFrame = pCNd ? pCNd->getLayoutFrame( GetLayout() ) : nullptr; - if( pFrm ) + if( pFrame ) { do { - pFrm = pFrm->GetUpper(); - } while ( pFrm && !pFrm->IsCellFrm() ); + pFrame = pFrame->GetUpper(); + } while ( pFrame && !pFrame->IsCellFrame() ); - if( pFrm ) - sNm += static_cast<SwCellFrm*>(pFrm)->GetTabBox()->GetName(); + if( pFrame ) + sNm += static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetName(); } return sNm; } -bool SwCrsrShell::GotoTable( const OUString& rName ) +bool SwCursorShell::GotoTable( const OUString& rName ) { - SwCallLink aLk( *this ); // watch Crsr-Moves - bool bRet = !m_pTableCrsr && m_pCurCrsr->GotoTable( rName ); + SwCallLink aLk( *this ); // watch Cursor-Moves + bool bRet = !m_pTableCursor && m_pCurrentCursor->GotoTable( rName ); if( bRet ) { - m_pCurCrsr->GetPtPos() = Point(); - UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); + m_pCurrentCursor->GetPtPos() = Point(); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | + SwCursorShell::READONLY ); } return bRet; } -bool SwCrsrShell::CheckTableBoxContent( const SwPosition* pPos ) +bool SwCursorShell::CheckTableBoxContent( const SwPosition* pPos ) { if( !m_pBoxIdx || !m_pBoxPtr || IsSelTableCells() || !IsAutoUpdateCells() ) return false; @@ -801,8 +801,8 @@ bool SwCrsrShell::CheckTableBoxContent( const SwPosition* pPos ) // cursor not anymore in this section? if( pChkBox && !pPos && - ( m_pCurCrsr->HasMark() || m_pCurCrsr->GetNext() != m_pCurCrsr || - pSttNd->GetIndex() + 1 == m_pCurCrsr->GetPoint()->nNode.GetIndex() )) + ( m_pCurrentCursor->HasMark() || m_pCurrentCursor->GetNext() != m_pCurrentCursor || + pSttNd->GetIndex() + 1 == m_pCurrentCursor->GetPoint()->nNode.GetIndex() )) pChkBox = nullptr; // Did the content of a box change at all? This is important if e.g. Undo @@ -830,13 +830,13 @@ bool SwCrsrShell::CheckTableBoxContent( const SwPosition* pPos ) return nullptr != pChkBox; } -void SwCrsrShell::SaveTableBoxContent( const SwPosition* pPos ) +void SwCursorShell::SaveTableBoxContent( const SwPosition* pPos ) { if( IsSelTableCells() || !IsAutoUpdateCells() ) return ; if( !pPos ) - pPos = m_pCurCrsr->GetPoint(); + pPos = m_pCurrentCursor->GetPoint(); SwStartNode* pSttNd = pPos->nNode.GetNode().FindSttNodeByType( SwTableBoxStartNode ); @@ -869,20 +869,20 @@ void SwCrsrShell::SaveTableBoxContent( const SwPosition* pPos ) } } -void SwCrsrShell::ClearTableBoxContent() +void SwCursorShell::ClearTableBoxContent() { delete m_pBoxIdx, m_pBoxIdx = nullptr; m_pBoxPtr = nullptr; } -bool SwCrsrShell::EndAllTableBoxEdit() +bool SwCursorShell::EndAllTableBoxEdit() { bool bRet = false; for(SwViewShell& rSh : GetRingContainer()) { - if( dynamic_cast<const SwCrsrShell *>(&rSh) != nullptr ) - bRet |= static_cast<SwCrsrShell*>(&rSh)->CheckTableBoxContent( - static_cast<SwCrsrShell*>(&rSh)->m_pCurCrsr->GetPoint() ); + if( dynamic_cast<const SwCursorShell *>(&rSh) != nullptr ) + bRet |= static_cast<SwCursorShell*>(&rSh)->CheckTableBoxContent( + static_cast<SwCursorShell*>(&rSh)->m_pCurrentCursor->GetPoint() ); } return bRet; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 1c6135a26f3d..044083b0431e 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -59,7 +59,7 @@ #include <paintfrm.hxx> // Here static members are defined. They will get changed on alteration of the -// MapMode. This is done so that on ShowCrsr the same size does not have to be +// MapMode. This is done so that on ShowCursor the same size does not have to be // expensively determined again and again. long SwSelPaintRects::s_nPixPtX = 0; @@ -67,94 +67,94 @@ long SwSelPaintRects::s_nPixPtY = 0; MapMode* SwSelPaintRects::s_pMapMode = nullptr; // Starting from here: classes / methods for the non-text-cursor -SwVisCrsr::SwVisCrsr( const SwCrsrShell * pCShell ) - : m_pCrsrShell( pCShell ) +SwVisibleCursor::SwVisibleCursor( const SwCursorShell * pCShell ) + : m_pCursorShell( pCShell ) , m_nPageLastTime(0) { - pCShell->GetWin()->SetCursor( &m_aTextCrsr ); - m_bIsVisible = m_aTextCrsr.IsVisible(); - m_bIsDragCrsr = false; - m_aTextCrsr.SetWidth( 0 ); + pCShell->GetWin()->SetCursor( &m_aTextCursor ); + m_bIsVisible = m_aTextCursor.IsVisible(); + m_bIsDragCursor = false; + m_aTextCursor.SetWidth( 0 ); } -SwVisCrsr::~SwVisCrsr() +SwVisibleCursor::~SwVisibleCursor() { - if( m_bIsVisible && m_aTextCrsr.IsVisible() ) - m_aTextCrsr.Hide(); + if( m_bIsVisible && m_aTextCursor.IsVisible() ) + m_aTextCursor.Hide(); - m_pCrsrShell->GetWin()->SetCursor( nullptr ); + m_pCursorShell->GetWin()->SetCursor( nullptr ); } -void SwVisCrsr::Show() +void SwVisibleCursor::Show() { if( !m_bIsVisible ) { m_bIsVisible = true; // display at all? - if( m_pCrsrShell->VisArea().IsOver( m_pCrsrShell->m_aCharRect ) || m_pCrsrShell->isTiledRendering() ) + if( m_pCursorShell->VisArea().IsOver( m_pCursorShell->m_aCharRect ) || m_pCursorShell->isTiledRendering() ) _SetPosAndShow(); } } -void SwVisCrsr::Hide() +void SwVisibleCursor::Hide() { if( m_bIsVisible ) { m_bIsVisible = false; - if( m_aTextCrsr.IsVisible() ) // Shouldn't the flags be in effect? - m_aTextCrsr.Hide(); + if( m_aTextCursor.IsVisible() ) // Shouldn't the flags be in effect? + m_aTextCursor.Hide(); } } -void SwVisCrsr::_SetPosAndShow() +void SwVisibleCursor::_SetPosAndShow() { SwRect aRect; - long nTmpY = m_pCrsrShell->m_aCrsrHeight.getY(); + long nTmpY = m_pCursorShell->m_aCursorHeight.getY(); if( 0 > nTmpY ) { nTmpY = -nTmpY; - m_aTextCrsr.SetOrientation( 900 ); - aRect = SwRect( m_pCrsrShell->m_aCharRect.Pos(), - Size( m_pCrsrShell->m_aCharRect.Height(), nTmpY ) ); - aRect.Pos().setX(aRect.Pos().getX() + m_pCrsrShell->m_aCrsrHeight.getX()); - if( m_pCrsrShell->IsOverwriteCrsr() ) + m_aTextCursor.SetOrientation( 900 ); + aRect = SwRect( m_pCursorShell->m_aCharRect.Pos(), + Size( m_pCursorShell->m_aCharRect.Height(), nTmpY ) ); + aRect.Pos().setX(aRect.Pos().getX() + m_pCursorShell->m_aCursorHeight.getX()); + if( m_pCursorShell->IsOverwriteCursor() ) aRect.Pos().setY(aRect.Pos().getY() + aRect.Width()); } else { - m_aTextCrsr.SetOrientation(); - aRect = SwRect( m_pCrsrShell->m_aCharRect.Pos(), - Size( m_pCrsrShell->m_aCharRect.Width(), nTmpY ) ); - aRect.Pos().setY(aRect.Pos().getY() + m_pCrsrShell->m_aCrsrHeight.getX()); + m_aTextCursor.SetOrientation(); + aRect = SwRect( m_pCursorShell->m_aCharRect.Pos(), + Size( m_pCursorShell->m_aCharRect.Width(), nTmpY ) ); + aRect.Pos().setY(aRect.Pos().getY() + m_pCursorShell->m_aCursorHeight.getX()); } // check if cursor should show the current cursor bidi level - m_aTextCrsr.SetDirection(); - const SwCursor* pTmpCrsr = m_pCrsrShell->_GetCrsr(); + m_aTextCursor.SetDirection(); + const SwCursor* pTmpCursor = m_pCursorShell->_GetCursor(); - if ( pTmpCrsr && !m_pCrsrShell->IsOverwriteCrsr() ) + if ( pTmpCursor && !m_pCursorShell->IsOverwriteCursor() ) { - SwNode& rNode = pTmpCrsr->GetPoint()->nNode.GetNode(); + SwNode& rNode = pTmpCursor->GetPoint()->nNode.GetNode(); if( rNode.IsTextNode() ) { const SwTextNode& rTNd = *rNode.GetTextNode(); - const SwFrm* pFrm = rTNd.getLayoutFrm( m_pCrsrShell->GetLayout(), nullptr, nullptr, false ); - if ( pFrm ) + const SwFrame* pFrame = rTNd.getLayoutFrame( m_pCursorShell->GetLayout(), nullptr, nullptr, false ); + if ( pFrame ) { - const SwScriptInfo* pSI = static_cast<const SwTextFrm*>(pFrm)->GetScriptInfo(); + const SwScriptInfo* pSI = static_cast<const SwTextFrame*>(pFrame)->GetScriptInfo(); // cursor level has to be shown if ( pSI && pSI->CountDirChg() > 1 ) { - m_aTextCrsr.SetDirection( - ( pTmpCrsr->GetCrsrBidiLevel() % 2 ) ? + m_aTextCursor.SetDirection( + ( pTmpCursor->GetCursorBidiLevel() % 2 ) ? CursorDirection::RTL : CursorDirection::LTR ); } - if ( pFrm->IsRightToLeft() ) + if ( pFrame->IsRightToLeft() ) { - const OutputDevice *pOut = m_pCrsrShell->GetOut(); + const OutputDevice *pOut = m_pCursorShell->GetOut(); if ( pOut ) { long nSize = pOut->GetSettings().GetStyleSettings().GetCursorSize(); @@ -169,56 +169,56 @@ void SwVisCrsr::_SetPosAndShow() if( aRect.Height() ) { - ::SwCalcPixStatics( m_pCrsrShell->GetOut() ); - ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCrsrShell), m_pCrsrShell->GetOut() ); + ::SwCalcPixStatics( m_pCursorShell->GetOut() ); + ::SwAlignRect( aRect, static_cast<SwViewShell const *>(m_pCursorShell), m_pCursorShell->GetOut() ); } - if( !m_pCrsrShell->IsOverwriteCrsr() || m_bIsDragCrsr || - m_pCrsrShell->IsSelection() ) + if( !m_pCursorShell->IsOverwriteCursor() || m_bIsDragCursor || + m_pCursorShell->IsSelection() ) aRect.Width( 0 ); - m_aTextCrsr.SetSize( aRect.SSize() ); + m_aTextCursor.SetSize( aRect.SSize() ); - m_aTextCrsr.SetPos( aRect.Pos() ); + m_aTextCursor.SetPos( aRect.Pos() ); if (comphelper::LibreOfficeKit::isActive()) { // notify about page number change (if that happened) sal_uInt16 nPage, nVirtPage; - const_cast<SwCrsrShell*>(m_pCrsrShell)->GetPageNum(nPage, nVirtPage); + const_cast<SwCursorShell*>(m_pCursorShell)->GetPageNum(nPage, nVirtPage); if (nPage != m_nPageLastTime) { m_nPageLastTime = nPage; OString aPayload = OString::number(nPage - 1); - m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } // notify about the cursor position & size Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height()); OString sRect = aSVRect.toString(); if (comphelper::LibreOfficeKit::isViewCallback()) - m_pCrsrShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); else - m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); } - if ( !m_pCrsrShell->IsCrsrReadonly() || m_pCrsrShell->GetViewOptions()->IsSelectionInReadonly() ) + if ( !m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() ) { - if ( m_pCrsrShell->GetDrawView() ) - const_cast<SwDrawView*>(static_cast<const SwDrawView*>(m_pCrsrShell->GetDrawView()))->SetAnimationEnabled( - !m_pCrsrShell->IsSelection() ); + if ( m_pCursorShell->GetDrawView() ) + const_cast<SwDrawView*>(static_cast<const SwDrawView*>(m_pCursorShell->GetDrawView()))->SetAnimationEnabled( + !m_pCursorShell->IsSelection() ); - sal_uInt16 nStyle = m_bIsDragCrsr ? CURSOR_SHADOW : 0; - if( nStyle != m_aTextCrsr.GetStyle() ) + sal_uInt16 nStyle = m_bIsDragCursor ? CURSOR_SHADOW : 0; + if( nStyle != m_aTextCursor.GetStyle() ) { - m_aTextCrsr.SetStyle( nStyle ); - m_aTextCrsr.SetWindow( m_bIsDragCrsr ? m_pCrsrShell->GetWin() : nullptr ); + m_aTextCursor.SetStyle( nStyle ); + m_aTextCursor.SetWindow( m_bIsDragCursor ? m_pCursorShell->GetWin() : nullptr ); } - m_aTextCrsr.Show(); + m_aTextCursor.Show(); } } -SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh ) +SwSelPaintRects::SwSelPaintRects( const SwCursorShell& rCSh ) : SwRects() , m_pCursorShell( &rCSh ) #if HAVE_FEATURE_DESKTOP @@ -284,15 +284,15 @@ void SwSelPaintRects::Hide() static SwRect lcl_getLayoutRect(const Point& rPoint, const SwPosition& rPosition) { const SwContentNode* pNode = rPosition.nNode.GetNode().GetContentNode(); - const SwContentFrm* pFrm = pNode->getLayoutFrm(pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPoint, &rPosition); + const SwContentFrame* pFrame = pNode->getLayoutFrame(pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPoint, &rPosition); SwRect aRect; - pFrm->GetCharRect(aRect, rPosition); + pFrame->GetCharRect(aRect, rPosition); return aRect; } -void SwShellCrsr::FillStartEnd(SwRect& rStart, SwRect& rEnd) const +void SwShellCursor::FillStartEnd(SwRect& rStart, SwRect& rEnd) const { - const SwShellCrsr* pCursor = GetShell()->getShellCrsr(false); + const SwShellCursor* pCursor = GetShell()->getShellCursor(false); rStart = lcl_getLayoutRect(pCursor->GetSttPos(), *pCursor->Start()); rEnd = lcl_getLayoutRect(pCursor->GetEndPos(), *pCursor->End()); } @@ -419,19 +419,19 @@ void SwSelPaintRects::HighlightInputField() if (m_bShowTextInputFieldOverlay) { - SwTextInputField* pCurTextInputFieldAtCrsr = - dynamic_cast<SwTextInputField*>(SwCrsrShell::GetTextFieldAtPos( GetShell()->GetCrsr()->Start(), false )); - if ( pCurTextInputFieldAtCrsr != nullptr ) + SwTextInputField* pCurTextInputFieldAtCursor = + dynamic_cast<SwTextInputField*>(SwCursorShell::GetTextFieldAtPos( GetShell()->GetCursor()->Start(), false )); + if ( pCurTextInputFieldAtCursor != nullptr ) { - SwTextNode* pTextNode = pCurTextInputFieldAtCrsr->GetpTextNode(); - std::unique_ptr<SwShellCrsr> pCrsrForInputTextField( - new SwShellCrsr( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCrsr->GetStart() ) ) ); - pCrsrForInputTextField->SetMark(); - pCrsrForInputTextField->GetMark()->nNode = *pTextNode; - pCrsrForInputTextField->GetMark()->nContent.Assign( pTextNode, *(pCurTextInputFieldAtCrsr->End()) ); - - pCrsrForInputTextField->FillRects(); - SwRects* pRects = static_cast<SwRects*>(pCrsrForInputTextField.get()); + SwTextNode* pTextNode = pCurTextInputFieldAtCursor->GetpTextNode(); + std::unique_ptr<SwShellCursor> pCursorForInputTextField( + new SwShellCursor( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCursor->GetStart() ) ) ); + pCursorForInputTextField->SetMark(); + pCursorForInputTextField->GetMark()->nNode = *pTextNode; + pCursorForInputTextField->GetMark()->nContent.Assign( pTextNode, *(pCurTextInputFieldAtCursor->End()) ); + + pCursorForInputTextField->FillRects(); + SwRects* pRects = static_cast<SwRects*>(pCursorForInputTextField.get()); for (size_t a(0); a < pRects->size(); ++a) { const SwRect aNextRect((*pRects)[a]); @@ -536,16 +536,16 @@ void SwSelPaintRects::Get1PixelInLogic( const SwViewShell& rSh, *pY = s_nPixPtY; } -SwShellCrsr::SwShellCrsr( - const SwCrsrShell& rCShell, +SwShellCursor::SwShellCursor( + const SwCursorShell& rCShell, const SwPosition &rPos ) : SwCursor(rPos,nullptr,false) , SwSelPaintRects(rCShell) , m_pInitialPoint(SwPaM::GetPoint()) {} -SwShellCrsr::SwShellCrsr( - const SwCrsrShell& rCShell, +SwShellCursor::SwShellCursor( + const SwCursorShell& rCShell, const SwPosition &rPos, const Point& rPtPos, SwPaM* pRing ) @@ -556,23 +556,23 @@ SwShellCrsr::SwShellCrsr( , m_pInitialPoint(SwPaM::GetPoint()) {} -SwShellCrsr::SwShellCrsr( SwShellCrsr& rICrsr ) - : SwCursor(rICrsr, &rICrsr) - , SwSelPaintRects(*rICrsr.GetShell()) - , m_MarkPt(rICrsr.GetMkPos()) - , m_PointPt(rICrsr.GetPtPos()) +SwShellCursor::SwShellCursor( SwShellCursor& rICursor ) + : SwCursor(rICursor, &rICursor) + , SwSelPaintRects(*rICursor.GetShell()) + , m_MarkPt(rICursor.GetMkPos()) + , m_PointPt(rICursor.GetPtPos()) , m_pInitialPoint(SwPaM::GetPoint()) {} -SwShellCrsr::~SwShellCrsr() +SwShellCursor::~SwShellCursor() {} -bool SwShellCrsr::IsReadOnlyAvailable() const +bool SwShellCursor::IsReadOnlyAvailable() const { return GetShell()->IsReadOnlyAvailable(); } -void SwShellCrsr::SetMark() +void SwShellCursor::SetMark() { if (SwPaM::GetPoint() == m_pInitialPoint) m_MarkPt = m_PointPt; @@ -581,26 +581,26 @@ void SwShellCrsr::SetMark() SwPaM::SetMark(); } -void SwShellCrsr::FillRects() +void SwShellCursor::FillRects() { // calculate the new rectangles if( HasMark() && GetPoint()->nNode.GetNode().IsContentNode() && - GetPoint()->nNode.GetNode().GetContentNode()->getLayoutFrm( GetShell()->GetLayout() ) && + GetPoint()->nNode.GetNode().GetContentNode()->getLayoutFrame( GetShell()->GetLayout() ) && (GetMark()->nNode == GetPoint()->nNode || (GetMark()->nNode.GetNode().IsContentNode() && - GetMark()->nNode.GetNode().GetContentNode()->getLayoutFrm( GetShell()->GetLayout() ) ) )) - GetShell()->GetLayout()->CalcFrmRects( *this ); + GetMark()->nNode.GetNode().GetContentNode()->getLayoutFrame( GetShell()->GetLayout() ) ) )) + GetShell()->GetLayout()->CalcFrameRects( *this ); } -void SwShellCrsr::Show() +void SwShellCursor::Show() { std::vector<OString> aSelectionRectangles; for(SwPaM& rPaM : GetRingContainer()) { - SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rPaM); - if(pShCrsr) - pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles); + SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM); + if(pShCursor) + pShCursor->SwSelPaintRects::Show(&aSelectionRectangles); } if (comphelper::LibreOfficeKit::isActive()) @@ -623,34 +623,34 @@ void SwShellCrsr::Show() // This rectangle gets painted anew, therefore the SSelection in this // area is invalid. -void SwShellCrsr::Invalidate( const SwRect& rRect ) +void SwShellCursor::Invalidate( const SwRect& rRect ) { for(SwPaM& rPaM : GetRingContainer()) { - SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rPaM); - // skip any non SwShellCrsr objects in the ring + SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM); + // skip any non SwShellCursor objects in the ring // see also: SwAutoFormat::DeleteSel() - if(pShCrsr) - pShCrsr->SwSelPaintRects::Invalidate(rRect); + if(pShCursor) + pShCursor->SwSelPaintRects::Invalidate(rRect); } } -void SwShellCrsr::Hide() +void SwShellCursor::Hide() { for(SwPaM& rPaM : GetRingContainer()) { - SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rPaM); - if(pShCrsr) - pShCrsr->SwSelPaintRects::Hide(); + SwShellCursor* pShCursor = dynamic_cast<SwShellCursor*>(&rPaM); + if(pShCursor) + pShCursor->SwSelPaintRects::Hide(); } } -SwCursor* SwShellCrsr::Create( SwPaM* pRing ) const +SwCursor* SwShellCursor::Create( SwPaM* pRing ) const { - return new SwShellCrsr( *GetShell(), *GetPoint(), GetPtPos(), pRing ); + return new SwShellCursor( *GetShell(), *GetPoint(), GetPtPos(), pRing ); } -short SwShellCrsr::MaxReplaceArived() +short SwShellCursor::MaxReplaceArived() { short nRet = RET_YES; vcl::Window* pDlg = SwView::GetSearchDialog(); @@ -659,7 +659,7 @@ short SwShellCrsr::MaxReplaceArived() // Terminate old actions. The table-frames get constructed and // a SSelection can be created. std::vector<sal_uInt16> vActionCounts; - for(SwViewShell& rShell : const_cast< SwCrsrShell* >( GetShell() )->GetRingContainer()) + for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer()) { sal_uInt16 nActCnt = 0; while(rShell.ActionPend()) @@ -672,7 +672,7 @@ short SwShellCrsr::MaxReplaceArived() nRet = ScopedVclPtrInstance<MessageDialog>::Create(pDlg, "AskSearchDialog", "modules/swriter/ui/asksearchdialog.ui")->Execute(); auto pActionCount = vActionCounts.begin(); - for(SwViewShell& rShell : const_cast< SwCrsrShell* >( GetShell() )->GetRingContainer()) + for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer()) { while(*pActionCount) { @@ -689,19 +689,19 @@ short SwShellCrsr::MaxReplaceArived() return nRet; } -void SwShellCrsr::SaveTableBoxContent( const SwPosition* pPos ) +void SwShellCursor::SaveTableBoxContent( const SwPosition* pPos ) { - const_cast<SwCrsrShell*>(GetShell())->SaveTableBoxContent( pPos ); + const_cast<SwCursorShell*>(GetShell())->SaveTableBoxContent( pPos ); } -bool SwShellCrsr::UpDown( bool bUp, sal_uInt16 nCnt ) +bool SwShellCursor::UpDown( bool bUp, sal_uInt16 nCnt ) { return SwCursor::UpDown( bUp, nCnt, &GetPtPos(), GetShell()->GetUpDownX() ); } // if <true> than the cursor can be set to the position. -bool SwShellCrsr::IsAtValidPos( bool bPoint ) const +bool SwShellCursor::IsAtValidPos( bool bPoint ) const { if( GetShell() && ( GetShell()->IsAllProtect() || GetShell()->GetViewOptions()->IsReadonly() || @@ -712,16 +712,16 @@ bool SwShellCrsr::IsAtValidPos( bool bPoint ) const return SwCursor::IsAtValidPos( bPoint ); } -SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh, +SwShellTableCursor::SwShellTableCursor( const SwCursorShell& rCursorSh, const SwPosition& rPos ) - : SwCursor(rPos,nullptr,false), SwShellCrsr(rCrsrSh, rPos), SwTableCursor(rPos) + : SwCursor(rPos,nullptr,false), SwShellCursor(rCursorSh, rPos), SwTableCursor(rPos) { } -SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh, +SwShellTableCursor::SwShellTableCursor( const SwCursorShell& rCursorSh, const SwPosition& rMkPos, const Point& rMkPt, const SwPosition& rPtPos, const Point& rPtPt ) - : SwCursor(rPtPos,nullptr,false), SwShellCrsr(rCrsrSh, rPtPos), SwTableCursor(rPtPos) + : SwCursor(rPtPos,nullptr,false), SwShellCursor(rCursorSh, rPtPos), SwTableCursor(rPtPos) { SetMark(); *GetMark() = rMkPos; @@ -729,26 +729,26 @@ SwShellTableCrsr::SwShellTableCrsr( const SwCrsrShell& rCrsrSh, GetPtPos() = rPtPt; } -SwShellTableCrsr::~SwShellTableCrsr() {} +SwShellTableCursor::~SwShellTableCursor() {} -void SwShellTableCrsr::SetMark() { SwShellCrsr::SetMark(); } +void SwShellTableCursor::SetMark() { SwShellCursor::SetMark(); } -SwCursor* SwShellTableCrsr::Create( SwPaM* pRing ) const +SwCursor* SwShellTableCursor::Create( SwPaM* pRing ) const { - return SwShellCrsr::Create( pRing ); + return SwShellCursor::Create( pRing ); } -short SwShellTableCrsr::MaxReplaceArived() +short SwShellTableCursor::MaxReplaceArived() { - return SwShellCrsr::MaxReplaceArived(); + return SwShellCursor::MaxReplaceArived(); } -void SwShellTableCrsr::SaveTableBoxContent( const SwPosition* pPos ) +void SwShellTableCursor::SaveTableBoxContent( const SwPosition* pPos ) { - SwShellCrsr::SaveTableBoxContent( pPos ); + SwShellCursor::SaveTableBoxContent( pPos ); } -void SwShellTableCrsr::FillRects() +void SwShellTableCursor::FillRects() { // Calculate the new rectangles. If the cursor is still "parked" do nothing if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->nNode.GetIndex()) @@ -757,9 +757,9 @@ void SwShellTableCrsr::FillRects() bool bStart = true; SwRegionRects aReg( GetShell()->VisArea() ); if (GetShell()->isTiledRendering()) - aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->Frm(); + aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->Frame(); SwNodes& rNds = GetDoc()->GetNodes(); - SwFrm* pEndFrm = nullptr; + SwFrame* pEndFrame = nullptr; for (size_t n = 0; n < m_SelectedBoxes.size(); ++n) { const SwStartNode* pSttNd = m_SelectedBoxes[n]->GetSttNd(); @@ -782,42 +782,42 @@ void SwShellTableCrsr::FillRects() if( !pCNd ) continue; - SwFrm* pFrm = pCNd->getLayoutFrm( GetShell()->GetLayout(), &GetSttPos() ); - while( pFrm && !pFrm->IsCellFrm() ) - pFrm = pFrm->GetUpper(); + SwFrame* pFrame = pCNd->getLayoutFrame( GetShell()->GetLayout(), &GetSttPos() ); + while( pFrame && !pFrame->IsCellFrame() ) + pFrame = pFrame->GetUpper(); - OSL_ENSURE( pFrm, "Node not in a table" ); + OSL_ENSURE( pFrame, "Node not in a table" ); - while ( pFrm ) + while ( pFrame ) { - if( aReg.GetOrigin().IsOver( pFrm->Frm() ) ) + if( aReg.GetOrigin().IsOver( pFrame->Frame() ) ) { - aReg -= pFrm->Frm(); + aReg -= pFrame->Frame(); if (bStart) { bStart = false; - m_aStart = SwRect(pFrm->Frm().Left(), pFrm->Frm().Top(), 1, pFrm->Frm().Height()); + m_aStart = SwRect(pFrame->Frame().Left(), pFrame->Frame().Top(), 1, pFrame->Frame().Height()); } } - pEndFrm = pFrm; - pFrm = pFrm->GetNextCellLeaf( MAKEPAGE_NONE ); + pEndFrame = pFrame; + pFrame = pFrame->GetNextCellLeaf( MAKEPAGE_NONE ); } } - if (pEndFrm) - m_aEnd = SwRect(pEndFrm->Frm().Right(), pEndFrm->Frm().Top(), 1, pEndFrm->Frm().Height()); + if (pEndFrame) + m_aEnd = SwRect(pEndFrame->Frame().Right(), pEndFrame->Frame().Top(), 1, pEndFrame->Frame().Height()); aReg.Invert(); insert( begin(), aReg.begin(), aReg.end() ); } -void SwShellTableCrsr::FillStartEnd(SwRect& rStart, SwRect& rEnd) const +void SwShellTableCursor::FillStartEnd(SwRect& rStart, SwRect& rEnd) const { rStart = m_aStart; rEnd = m_aEnd; } // Check if the SPoint is within the Table-SSelection. -bool SwShellTableCrsr::IsInside( const Point& rPt ) const +bool SwShellTableCursor::IsInside( const Point& rPt ) const { // Calculate the new rectangles. If the cursor is still "parked" do nothing if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->nNode.GetIndex()) @@ -831,19 +831,19 @@ bool SwShellTableCrsr::IsInside( const Point& rPt ) const if( !pCNd ) continue; - SwFrm* pFrm = pCNd->getLayoutFrm( GetShell()->GetLayout(), &GetPtPos() ); - while( pFrm && !pFrm->IsCellFrm() ) - pFrm = pFrm->GetUpper(); - OSL_ENSURE( pFrm, "Node not in a table" ); - if( pFrm && pFrm->Frm().IsInside( rPt ) ) + SwFrame* pFrame = pCNd->getLayoutFrame( GetShell()->GetLayout(), &GetPtPos() ); + while( pFrame && !pFrame->IsCellFrame() ) + pFrame = pFrame->GetUpper(); + OSL_ENSURE( pFrame, "Node not in a table" ); + if( pFrame && pFrame->Frame().IsInside( rPt ) ) return true; } return false; } -bool SwShellTableCrsr::IsAtValidPos( bool bPoint ) const +bool SwShellTableCursor::IsAtValidPos( bool bPoint ) const { - return SwShellCrsr::IsAtValidPos( bPoint ); + return SwShellCursor::IsAtValidPos( bPoint ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |