summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-25 22:17:06 +0200
committerMichael Stahl <mstahl@redhat.com>2015-04-25 23:01:31 +0200
commitbdf3c9bff607e3977c8455927b21ba292530d25a (patch)
tree0e9556e4b77878bbe23c4232e9d47c06d1df08ef /sw
parentc55599fd0e7198773087c6433031f7119aaaca36 (diff)
sw: replace SwPaM's so-called "copy constructor"
Make explict that it links the new SwPaM into a Ring, by adding a 2nd parameter for the Ring. Change-Id: I8ac0bb1a8bede8b67a3a8874cf805bd88aad2819
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/pam.hxx9
-rw-r--r--sw/source/core/crsr/pam.cxx9
-rw-r--r--sw/source/core/crsr/swcrsr.cxx2
-rw-r--r--sw/source/core/text/frminf.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx6
-rw-r--r--sw/source/filter/basflt/shellio.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx6
10 files changed, 23 insertions, 21 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 30a19c313a10..916e4e0a585e 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -166,8 +166,10 @@ class SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
SwPaM* MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg = 0 );
+ SwPaM(SwPaM const& rPaM) SAL_DELETED_FUNCTION;
+
public:
- SwPaM( const SwPosition& rPos, SwPaM* pRing = 0 );
+ explicit SwPaM( const SwPosition& rPos, SwPaM* pRing = 0 );
SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing = 0 );
SwPaM( const SwNodeIndex& rMk, const SwNodeIndex& rPt,
long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = 0 );
@@ -181,8 +183,9 @@ public:
SwPaM( const SwNodeIndex& rNd, sal_Int32 nCntnt = 0, SwPaM* pRing = 0 );
virtual ~SwPaM();
- /// @@@ semantic: no copy ctor.
- SwPaM( SwPaM & );
+ /// this takes a second parameter, which indicates the Ring that
+ /// the new PaM should be part of (may be null)
+ SwPaM(SwPaM const& rPaM, SwPaM * pRing);
/// @@@ semantic: no copy assignment for super class Ring.
SwPaM& operator=( const SwPaM & );
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index e449f949bc8b..be811b4c03d3 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -436,9 +436,8 @@ SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, sal_Int32 nCntnt, SwPaM* pRing )
SwPaM::~SwPaM() {}
-// @@@ semantic: no copy ctor.
-SwPaM::SwPaM( SwPaM &rPam )
- : Ring( &rPam )
+SwPaM::SwPaM(SwPaM const& rPam, SwPaM *const pRing)
+ : Ring(pRing)
, m_Bound1( *(rPam.m_pPoint) )
, m_Bound2( *(rPam.m_pMark) )
, m_pPoint( &m_Bound1 ), m_pMark( rPam.HasMark() ? &m_Bound2 : m_pPoint )
@@ -504,7 +503,7 @@ bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
@param fnMove Contains information if beginning or end of document.
@param pOrigRg The given region.
- @return Newly created area.
+ @return Newly created range, in Ring with parameter pOrigRg.
*/
SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
{
@@ -520,7 +519,7 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
}
else
{
- pPam = new SwPaM( *const_cast<SwPaM*>(pOrigRg) ); // given search area
+ pPam = new SwPaM(*pOrigRg, const_cast<SwPaM*>(pOrigRg)); // given search range
// make sure that SPoint is on the "real" start position
// FORWARD: SPoint always smaller than GetMark
// BACKWARD: SPoint always bigger than GetMark
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 83e08708c90a..e0a1a9ce4734 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -124,7 +124,7 @@ SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing, bool bColumnSel )
// @@@ semantic: no copy ctor.
SwCursor::SwCursor( SwCursor& rCpy )
- : SwPaM( rCpy )
+ : SwPaM( rCpy, &rCpy )
, m_pSavePos(nullptr)
, m_nRowSpanOffset(rCpy.m_nRowSpanOffset)
, m_nCursorBidiLevel(rCpy.m_nCursorBidiLevel)
diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index 530e52ad2c45..61b5560b4501 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -156,7 +156,7 @@ SwPaM *AddPam( SwPaM *pPam, const SwTxtFrm* pTxtFrm,
pPam->GetPoint()->nContent += nLen;
return pPam;
}
- pPam = new SwPaM( *pPam );
+ pPam = new SwPaM(*pPam, pPam);
}
SwIndex &rContent = pPam->GetPoint()->nContent;
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 685e35609c54..18cb6a5deb66 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -144,7 +144,7 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
do
{
// create new PaM
- SwPaM *const pNew = new SwPaM(*pPam);
+ SwPaM *const pNew = new SwPaM(*pPam, nullptr);
// insert into ring
pNew->MoveTo(&rTarget);
pPam = pPam->GetNext();
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 9a6984fb62ea..1a7c162d4a14 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -125,10 +125,10 @@ void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUSt
}
else if (pCursor)
{
- SwPaM aPam(*pCursor->GetPaM());
+ SwPaM & rPam(*pCursor->GetPaM());
- SwPosition* startPos = aPam.Start();
- SwPosition* endPos = aPam.End();
+ SwPosition* startPos = rPam.Start();
+ SwPosition* endPos = rPam.End();
commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
}
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 567aad5cd8b5..2fcf22f80ed9 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -795,7 +795,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
}
else
{
- pPam = new SwPaM( *pPam );
+ pPam = new SwPaM( *pPam, pPam );
pPam->Move( fnMoveBackward, fnGoDoc );
pPam->SetMark();
pPam->Move( fnMoveForward, fnGoDoc );
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5dfd048b85ce..85922e7c75a5 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2474,7 +2474,7 @@ void SwWW8ImplReader::AppendTxtNode(SwPosition& rPos)
if(pPreviousNumPaM)
delete pPreviousNumPaM, pPreviousNumPaM = 0;
- pPreviousNumPaM = new SwPaM(*pPaM);
+ pPreviousNumPaM = new SwPaM(*pPaM, pPaM);
pPrevNumRule = pRule;
}
else if(!pRule && pPreviousNumPaM)
@@ -4503,7 +4503,7 @@ void wwSectionManager::InsertSegments()
if (bInsertSection)
{
// Start getting the bounds of this section
- SwPaM aSectPaM(*mrReader.pPaM);
+ SwPaM aSectPaM(*mrReader.pPaM, mrReader.pPaM);
SwNodeIndex aAnchor(aSectPaM.GetPoint()->nNode);
if (aNext != aEnd)
{
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 2a86c4ffaafe..97865c58829d 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3484,7 +3484,7 @@ void SwWW8ImplReader::StopTable()
// #i101116# - Keep PaM on table end only for nested tables
if ( nInTable > 1 )
{
- mpTableEndPaM.reset(new SwPaM(*pPaM));
+ mpTableEndPaM.reset(new SwPaM(*pPaM, pPaM));
}
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 521e7f843957..daef1e6c8095 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2204,7 +2204,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
WW8_CP nOldCp = pPlcxMan->Where();
WW8_CP nCp = nOldCp + nOffset;
- SwPaM aPaM(*pPaM);
+ SwPaM aPaM(*pPaM, pPaM);
aPaM.SetMark();
aPaM.Move(fnMoveBackward);
aPaM.Exchange();
@@ -3318,9 +3318,9 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
{
delete mpPosAfterTOC;
}
- mpPosAfterTOC = new SwPaM(*pPaM);
+ mpPosAfterTOC = new SwPaM(*pPaM, pPaM);
(*pPaM).Move(fnMoveBackward);
- SwPaM aRegion(*pPaM);
+ SwPaM aRegion(*pPaM, pPaM);
OSL_ENSURE(rDoc.GetCurTOX(*aRegion.GetPoint()), "Misunderstood how toc works");
if (SwTOXBase* pBase2 = (SwTOXBase*)rDoc.GetCurTOX(*aRegion.GetPoint()))