summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-24 13:21:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-24 21:02:02 +0200
commit7cd5b35caa8d4fa9d0ba2b2c6ce4b88726ed2be6 (patch)
tree014d9f0fde1b5383eb0bd82327d3bb4aa8268027 /sw/source
parenta93c3f2eb07fc15d1ebb0fd70ab58ecea27bd4f1 (diff)
return SwCursor from IShellCursorSupplier
rather than casting it Change-Id: Ia950f521c8f73d8a0da59344db9b5aacb727aca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122576 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/crbm.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx12
-rw-r--r--sw/source/core/edit/autofmt.cxx2
-rw-r--r--sw/source/core/edit/edlingu.cxx2
-rw-r--r--sw/source/core/frmedt/fefly1.cxx2
-rw-r--r--sw/source/core/frmedt/fetab.cxx2
-rw-r--r--sw/source/core/undo/unattr.cxx3
-rw-r--r--sw/source/core/undo/undobj.cxx3
-rw-r--r--sw/source/core/undo/unins.cxx9
-rw-r--r--sw/source/core/undo/unovwr.cxx5
-rw-r--r--sw/source/core/undo/unspnd.cxx5
-rw-r--r--sw/source/core/undo/untblk.cxx3
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx2
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx12
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx2
-rw-r--r--sw/source/uibase/utlui/content.cxx2
-rw-r--r--sw/source/uibase/wrtsh/delete.cxx8
17 files changed, 41 insertions, 35 deletions
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 1b60a3f7e290..30d2d6b7eb01 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -33,7 +33,7 @@ namespace
struct CursorStateHelper
{
explicit CursorStateHelper(SwCursorShell const & rShell)
- : m_pCursor(rShell.GetSwCursor())
+ : m_pCursor(rShell.GetCursor())
, m_aSaveState(*m_pCursor)
{ }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 7c6b94df2da4..07092e1100ad 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -170,7 +170,7 @@ void SwCursorShell::DestroyCursor()
* Simply returns the current shell cursor if there is no selection
* (HasSelection()).
*/
-SwPaM & SwCursorShell::CreateNewShellCursor()
+SwCursor & SwCursorShell::CreateNewShellCursor()
{
if (HasSelection())
{
@@ -183,16 +183,16 @@ SwPaM & SwCursorShell::CreateNewShellCursor()
* Return the current shell cursor
* @return - returns current `SwPaM` shell cursor
*/
-SwPaM & SwCursorShell::GetCurrentShellCursor()
+SwCursor & SwCursorShell::GetCurrentShellCursor()
{
return *GetCursor();
}
/**
* Return pointer to the current shell cursor
- * @return - returns pointer to current `SwPaM` shell cursor
+ * @return - returns pointer to current `SwCursor` shell cursor
*/
-SwPaM* SwCursorShell::GetCursor( bool bMakeTableCursor ) const
+SwCursor* SwCursorShell::GetCursor( bool bMakeTableCursor ) const
{
if( m_pTableCursor )
{
@@ -1055,7 +1055,7 @@ int SwCursorShell::CompareCursorStackMkCurrPt() const
{
int nRet = 0;
const SwPosition *pFirst = nullptr, *pSecond = nullptr;
- const SwPaM *pCur = GetCursor(), *pStack = m_pStackCursor;
+ const SwCursor *pCur = GetCursor(), *pStack = m_pStackCursor;
// cursor on stack is needed if we compare against stack
if( pStack )
{
@@ -3538,7 +3538,7 @@ sal_uLong SwCursorShell::FindAttrs( const SfxItemSet& rSet,
void SwCursorShell::SetSelection( const SwPaM& rCursor )
{
StartAction();
- SwPaM* pCursor = GetCursor();
+ SwCursor* pCursor = GetCursor();
*pCursor->GetPoint() = *rCursor.GetPoint();
if(rCursor.GetNext() != &rCursor)
{
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 7b4a467166e1..a5d8d64c4a27 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2377,7 +2377,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const &
{
//JP 30.09.96: DoTable() builds on PopCursor and MoveCursor after AutoFormat!
pEdShell->Pop(SwCursorShell::PopMode::DeleteCurrent);
- *pEdShell->GetCursor() = m_aDelPam;
+ *pEdShell->GetCursor() = static_cast<SwCursor&>(m_aDelPam);
pEdShell->Push();
eStat = IS_END;
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 71a5ae401010..76d9e8899934 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -652,7 +652,7 @@ void SwEditShell::SpellStart(
if (pLinguIter)
{
- SwCursor* pSwCursor = GetSwCursor();
+ SwCursor* pSwCursor = GetCursor();
SwPosition *pTmp = new SwPosition( *pSwCursor->GetPoint() );
pSwCursor->FillFindPos( eCurr, *pTmp );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 821b5b53e5ff..280f901cc5d3 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -840,7 +840,7 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName,
SwFlyFrameFormat* pFormat = nullptr;
CurrShell aCurr( this );
StartAllAction();
- SwShellCursor *pStartCursor = dynamic_cast<SwShellCursor*>(GetSwCursor());
+ SwShellCursor *pStartCursor = dynamic_cast<SwShellCursor*>(GetCursor());
SwShellCursor *pCursor = pStartCursor;
do
{
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 352ba86f587c..170b17f40364 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -90,7 +90,7 @@ public:
void SwFEShell::ParkCursorInTab()
{
- SwCursor * pSwCursor = GetSwCursor();
+ SwCursor * pSwCursor = GetCursor();
OSL_ENSURE(pSwCursor, "no SwCursor");
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 09b7e44bc7b8..1407437c4e0a 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -39,6 +39,7 @@
#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
#include <docary.hxx>
+#include <swcrsr.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -1035,7 +1036,7 @@ SwUndoDontExpandFormat::SwUndoDontExpandFormat( const SwPosition& rPos )
void SwUndoDontExpandFormat::UndoImpl(::sw::UndoRedoContext & rContext)
{
- SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
SwDoc *const pDoc = & rContext.GetDoc();
SwPosition& rPos = *pPam->GetPoint();
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index ba32c509b019..27d6c5e6d1c7 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -28,6 +28,7 @@
#include <UndoManager.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
+#include <swcrsr.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -109,7 +110,7 @@ void SwUndRng::SetPaM( SwPaM & rPam, bool bCorrToContent ) const
SwPaM & SwUndRng::AddUndoRedoPaM(
::sw::UndoRedoContext & rContext, bool const bCorrToContent) const
{
- SwPaM & rPaM( rContext.GetCursorSupplier().CreateNewShellCursor() );
+ SwCursor & rPaM( rContext.GetCursorSupplier().CreateNewShellCursor() );
SetPaM( rPaM, bCorrToContent );
return rPaM;
}
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index f5cc03b93857..f1fc4b28a551 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -45,6 +45,7 @@
#include <grfatr.hxx>
#include <cntfrm.hxx>
#include <flyfrm.hxx>
+#include <swcrsr.hxx>
#include <swtable.hxx>
#include <redline.hxx>
#include <docary.hxx>
@@ -202,7 +203,7 @@ SwUndoInsert::~SwUndoInsert()
void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pTmpDoc = & rContext.GetDoc();
- SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
if( m_bIsAppend )
{
@@ -289,7 +290,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pTmpDoc = & rContext.GetDoc();
- SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
pPam->DeleteMark();
if( m_bIsAppend )
@@ -638,7 +639,7 @@ SwUndoReplace::Impl::Impl(
void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pDoc = & rContext.GetDoc();
- SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
rPam.DeleteMark();
SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
@@ -720,7 +721,7 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoReplace::Impl::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc & rDoc = rContext.GetDoc();
- SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
rPam.DeleteMark();
rPam.GetPoint()->nNode = m_nSttNd;
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index 214ada23b3a3..4605acaf4fdc 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -25,6 +25,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
+#include <swcrsr.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -178,7 +179,7 @@ bool SwUndoOverwrite::CanGrouping( SwDoc& rDoc, SwPosition& rPos,
void SwUndoOverwrite::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc& rDoc = rContext.GetDoc();
- SwPaM& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor());
rCurrentPam.DeleteMark();
rCurrentPam.GetPoint()->nNode = m_nStartNode;
@@ -260,7 +261,7 @@ void SwUndoOverwrite::RepeatImpl(::sw::RepeatContext & rContext)
void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc& rDoc = rContext.GetDoc();
- SwPaM& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor());
rCurrentPam.DeleteMark();
rCurrentPam.GetPoint()->nNode = m_nStartNode;
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index 771c2650de86..1e8bbf02b8a4 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -23,6 +23,7 @@
#include <pam.hxx>
#include <swtable.hxx>
#include <ndtxt.hxx>
+#include <swcrsr.hxx>
#include <swundo.hxx>
#include <frmfmt.hxx>
#include <UndoCore.hxx>
@@ -71,7 +72,7 @@ SwUndoSplitNode::~SwUndoSplitNode()
void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pDoc = & rContext.GetDoc();
- SwPaM & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() );
+ SwCursor & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() );
rPam.DeleteMark();
if( m_bTableFlag )
{
@@ -149,7 +150,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
{
- SwPaM & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() );
+ SwCursor & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() );
rPam.GetPoint()->nNode = m_nNode;
SwTextNode * pTNd = rPam.GetNode().GetTextNode();
OSL_ENSURE(pTNd, "SwUndoSplitNode::RedoImpl(): SwTextNode expected");
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index fc30657333b9..ff25eb387c08 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -25,6 +25,7 @@
#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
#include <docary.hxx>
+#include <swcrsr.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <mvsave.hxx>
@@ -372,7 +373,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
{
// position cursor onto REDO section
- SwPaM& rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+ SwCursor& rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
SwDoc& rDoc = rPam.GetDoc();
rPam.DeleteMark();
rPam.GetPoint()->nNode = m_nSttNode - m_nNodeDiff;
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index f5ed67967644..13c0584fb562 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -4101,7 +4101,7 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
{
rSrcSh.CalcLayout();
rSrcSh.SwCursorShell::SetCursor(rDragPt);
- rSrcSh.GetSwCursor()->SetMark();
+ rSrcSh.GetCursor()->SetMark();
}
}
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index ba86732a82a3..c6d42d7830dd 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -653,8 +653,8 @@ void SwView::Replace()
{
/* check that the selection match the search string*/
//save state
- SwPosition aStartPos = * m_pWrtShell->GetSwCursor()->Start();
- SwPosition aEndPos = * m_pWrtShell->GetSwCursor()->End();
+ SwPosition aStartPos = * m_pWrtShell->GetCursor()->Start();
+ SwPosition aEndPos = * m_pWrtShell->GetCursor()->End();
bool bHasSelection = s_pSrchItem->GetSelection();
SvxSearchCmd nOldCmd = s_pSrchItem->GetCommand();
@@ -672,13 +672,13 @@ void SwView::Replace()
if(! s_pSrchItem->GetBackward() )
{
- (* m_pWrtShell->GetSwCursor()->Start()) = aStartPos;
- (* m_pWrtShell->GetSwCursor()->End()) = aEndPos;
+ (* m_pWrtShell->GetCursor()->Start()) = aStartPos;
+ (* m_pWrtShell->GetCursor()->End()) = aEndPos;
}
else
{
- (* m_pWrtShell->GetSwCursor()->Start()) = aEndPos;
- (* m_pWrtShell->GetSwCursor()->End()) = aStartPos;
+ (* m_pWrtShell->GetCursor()->Start()) = aEndPos;
+ (* m_pWrtShell->GetCursor()->End()) = aStartPos;
}
bReqReplace = false;
}
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index fc6891adc277..7e133b9e78c2 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1448,7 +1448,7 @@ void SwXTextViewCursor::setString(const OUString& aString)
case ShellMode::Text :
{
SwWrtShell& rSh = m_pView->GetWrtShell();
- SwCursor* pShellCursor = rSh.GetSwCursor();
+ SwCursor* pShellCursor = rSh.GetCursor();
SwUnoCursorHelper::SetString(*pShellCursor, aString);
break;
}
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 9fb2367e0d39..2acbcc679ef8 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3651,7 +3651,7 @@ void SwContentTree::UpdateTracking()
void SwContentTree::SelectOutlinesWithSelection()
{
- SwCursor* pFirstCursor = m_pActiveShell->GetSwCursor();
+ SwCursor* pFirstCursor = m_pActiveShell->GetCursor();
SwCursor* pCursor = pFirstCursor;
std::vector<SwOutlineNodes::size_type> aOutlinePositions;
do
diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx
index dae15a96364e..0c1cd4f23d6f 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -200,7 +200,7 @@ bool SwWrtShell::DelLeft()
// #i4032# Don't actually call a 'delete' if we
// changed the table cell, compare DelRight().
const SwStartNode * pSNdOld = pWasInTableNd ?
- GetSwCursor()->GetNode().FindTableBoxStartNode() :
+ GetCursor()->GetNode().FindTableBoxStartNode() :
nullptr;
// If the cursor is at the beginning of a paragraph, try to step
@@ -216,7 +216,7 @@ bool SwWrtShell::DelLeft()
if (bDoSomething)
{
const SwStartNode* pSNdNew = pIsInTableNd ?
- GetSwCursor()->GetNode().FindTableBoxStartNode() :
+ GetCursor()->GetNode().FindTableBoxStartNode() :
nullptr;
// #i4032# Don't actually call a 'delete' if we
@@ -345,7 +345,7 @@ bool SwWrtShell::DelRight()
const SwTableNode* pWasInTableNd = IsCursorInTable();
// #108049# Save the startnode of the current cell
const SwStartNode* pSNdOld = pWasInTableNd ?
- GetSwCursor()->GetNode().FindTableBoxStartNode() : nullptr;
+ GetCursor()->GetNode().FindTableBoxStartNode() : nullptr;
bool bCheckDelFull = SelectionType::Text & nSelection && SwCursorShell::IsSttPara();
bool bDelFull = false;
bool bDoNothing = false;
@@ -366,7 +366,7 @@ bool SwWrtShell::DelRight()
// #108049# Save the startnode of the current cell.
// May be different to pSNdOld as we have moved.
const SwStartNode* pSNdNew = pCurrTableNd ?
- GetSwCursor()->GetNode().FindTableBoxStartNode() : nullptr;
+ GetCursor()->GetNode().FindTableBoxStartNode() : nullptr;
// tdf#115132 Only keep cursor position instead of deleting
// if we have moved to a different cell