sw/inc/IDocumentContentOperations.hxx | 18 ++++- sw/qa/extras/uiwriter/uiwriter.cxx | 4 - sw/source/core/doc/DocumentContentOperationsManager.cxx | 57 ++++++++-------- sw/source/core/doc/doccomp.cxx | 4 - sw/source/core/doc/docglos.cxx | 2 sw/source/core/doc/doclay.cxx | 2 sw/source/core/doc/docnew.cxx | 2 sw/source/core/doc/docnum.cxx | 2 sw/source/core/doc/docredln.cxx | 4 - sw/source/core/docnode/section.cxx | 2 sw/source/core/edit/acorrect.cxx | 2 sw/source/core/edit/eddel.cxx | 2 sw/source/core/edit/edglss.cxx | 7 + sw/source/core/frmedt/fecopy.cxx | 4 - sw/source/core/inc/DocumentContentOperationsManager.hxx | 10 +- sw/source/core/undo/untblk.cxx | 2 sw/source/core/unocore/unotext.cxx | 4 - sw/source/filter/docx/swdocxreader.cxx | 2 sw/source/filter/ww8/ww8glsy.cxx | 2 sw/source/filter/xml/xmltbli.cxx | 2 sw/source/uibase/uno/unoatxt.cxx | 3 21 files changed, 77 insertions(+), 60 deletions(-)
New commits: commit bd978e93fa0422384ace346665f532b2a714f423 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Feb 4 16:19:02 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Feb 5 09:06:17 2020 +0100 sw: convert CopyRange boolean parameters to enum Change-Id: Ic65753e1c6f5ef45494c1925cf2a5427427e5fe7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87985 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index b6857c346a33..14724eae3731 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -69,6 +69,19 @@ namespace o3tl template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {}; } +enum class SwCopyFlags +{ + Default = 0, + CopyAll = (1<<0), ///< copy break attributes even when source is single node + CheckPosInFly = (1<<1), ///< check if target position is in fly anchored at source range + IsMoveToFly = (1<<2), ///< MakeFlyAndMove + // TODO: mbCopyIsMove? mbIsRedlineMove? +}; +namespace o3tl +{ + template<> struct typed_flags<SwCopyFlags> : is_typed_flags<SwCopyFlags, 0x07> {}; +} + /** Text operation/manipulation interface */ class IDocumentContentOperations @@ -104,12 +117,13 @@ public: @param rPos The target copy destination - @param bCheckPos + @param flags + SwCopyFlags::CheckPos: If this function should check if rPos is in a fly frame anchored in rPam. If false, then no such check will be performed, and it is assumed that the caller took care of verifying this constraint already. */ - virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, const bool bCopyAll, bool bCheckPos, bool bCopyText ) const = 0; + virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, SwCopyFlags flags) const = 0; /** Delete section containing the node. */ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 0782cef8a209..4a737f4b9121 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -751,7 +751,7 @@ void SwUiWriterTest::testBookmarkCopy() aPaM.SttEndDoc(true/*start*/); aPaM.Move(fnMoveForward, GoInContent); // partially select 1st para - rIDCO.CopyRange(aPaM, target, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false); + rIDCO.CopyRange(aPaM, target, SwCopyFlags::CheckPosInFly); // check bookmark was copied to correct position CPPUNIT_ASSERT_EQUAL(sal_Int32(2), rIDMA.getBookmarksCount()); @@ -767,7 +767,7 @@ void SwUiWriterTest::testBookmarkCopy() rIDCO.SplitNode(*aPaM.GetPoint(), false); aPaM.SttEndDoc(true/*start*/); - rIDCO.CopyRange(aCopyPaM, *aPaM.GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false); + rIDCO.CopyRange(aCopyPaM, *aPaM.GetPoint(), SwCopyFlags::CheckPosInFly); // check bookmark was copied to correct position CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getBookmarksCount()); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 265ebd4d655e..c12faf54627e 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -92,7 +92,7 @@ using namespace ::com::sun::star::i18n; namespace { // Copy method from SwDoc - // Prevent copying in Flys that are anchored in the area + // Prevent copying into Flys that are anchored in the range bool lcl_ChkFlyFly( SwDoc* pDoc, sal_uLong nSttNd, sal_uLong nEndNd, sal_uLong nInsNd ) { @@ -1832,15 +1832,16 @@ DocumentContentOperationsManager::DocumentContentOperationsManager( SwDoc& i_rSw /** * Checks if rStart..rEnd mark a range that makes sense to copy. * - * bCopyText is misnamed and means that the copy is a move to create a fly + * IsMoveToFly means the copy is a move to create a fly * and so existing flys at the edge must not be copied. */ -static bool IsEmptyRange(const SwPosition& rStart, const SwPosition& rEnd, bool bCopyText) +static bool IsEmptyRange(const SwPosition& rStart, const SwPosition& rEnd, + SwCopyFlags const flags) { if (rStart == rEnd) { // check if a fly anchored there would be copied - then copy... return !IsDestroyFrameAnchoredAtChar(rStart, rStart, rEnd, - bCopyText + (flags & SwCopyFlags::IsMoveToFly) ? DelContentType::WriterfilterHack|DelContentType::AllMask : DelContentType::AllMask); } @@ -1852,7 +1853,8 @@ static bool IsEmptyRange(const SwPosition& rStart, const SwPosition& rEnd, bool // Copy an area into this document or into another document bool -DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll, bool bCheckPos, bool bCopyText ) const +DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, + SwCopyFlags const flags) const { const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); @@ -1860,11 +1862,11 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection(); // Catch if there's no copy to do - if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, bCopyText) && !bColumnSel)) + if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, flags) && !bColumnSel)) return false; - // Prevent copying in Flys that are anchored in the area - if( pDoc == &m_rDoc && bCheckPos ) + // Prevent copying into Flys that are anchored in the source range + if (pDoc == &m_rDoc && (flags & SwCopyFlags::CheckPosInFly)) { // Correct the Start-/EndNode sal_uLong nStt = pStt->nNode.GetIndex(), @@ -1900,7 +1902,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons if( pDoc != &m_rDoc ) { // ordinary copy - bRet = CopyImpl( rPam, rPos, bCopyAll, pRedlineRange, bCopyText ); + bRet = CopyImpl(rPam, rPos, flags & ~SwCopyFlags::CheckPosInFly, pRedlineRange); } else if( ! ( *pStt <= rPos && rPos < *pEnd && ( pStt->nNode != pEnd->nNode || @@ -1908,7 +1910,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons { // Copy to a position outside of the area, or copy a single TextNode // Do an ordinary copy - bRet = CopyImpl( rPam, rPos, bCopyAll, pRedlineRange, bCopyText ); + bRet = CopyImpl(rPam, rPos, flags & ~SwCopyFlags::CheckPosInFly, pRedlineRange); } else { @@ -3392,7 +3394,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( const bool bMakeNewFrames, const bool bDelRedlines, const bool bCopyFlyAtFly, - bool bCopyText ) const + SwCopyFlags const flags) const { assert(!pCopiedPaM || pCopiedPaM->first.End()->nNode == rRg.aEnd); assert(!pCopiedPaM || pCopiedPaM->second.nNode <= rInsPos); @@ -3443,7 +3445,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( ? pCopiedPaM->second.nNode : aSavePos, bCopyFlyAtFly, - bCopyText); + flags); } SwNodeRange aCpyRange( aSavePos, rInsPos ); @@ -3482,7 +3484,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( SwPaM const*const pCopiedPaM, const SwNodeIndex& rStartIdx, const bool bCopyFlyAtFly, - bool bCopyText ) const + SwCopyFlags const flags) const { assert(!pCopiedPaM || pCopiedPaM->End()->nNode == rRg.aEnd); @@ -3520,7 +3522,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( bAdd = IsSelectFrameAnchoredAtPara(*pAPos, pCopiedPaM ? *pCopiedPaM->Start() : SwPosition(rRg.aStart), pCopiedPaM ? *pCopiedPaM->End() : SwPosition(rRg.aEnd), - bCopyText + (flags & SwCopyFlags::IsMoveToFly) ? DelContentType::AllMask|DelContentType::WriterfilterHack : DelContentType::AllMask); } @@ -3530,7 +3532,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( bAdd = IsDestroyFrameAnchoredAtChar(*pAPos, pCopiedPaM ? *pCopiedPaM->Start() : SwPosition(rRg.aStart), pCopiedPaM ? *pCopiedPaM->End() : SwPosition(rRg.aEnd), - bCopyText + (flags & SwCopyFlags::IsMoveToFly) ? DelContentType::AllMask|DelContentType::WriterfilterHack : DelContentType::AllMask); } @@ -4476,9 +4478,8 @@ static void lcl_PopNumruleState( } bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, - const bool bCopyAll, - SwPaM *const pCopyRange, - bool bCopyText) const + SwCopyFlags const flags, + SwPaM *const pCopyRange) const { std::vector<std::pair<sal_uLong, sal_Int32>> Breaks; @@ -4486,7 +4487,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, if (Breaks.empty()) { - return CopyImplImpl(rPam, rPos, bCopyAll, pCopyRange, bCopyText); + return CopyImplImpl(rPam, rPos, flags, pCopyRange); } SwPosition const & rSelectionEnd( *rPam.End() ); @@ -4508,7 +4509,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, if (rStart < rEnd) // check if part is empty { // pass in copyRange member as rPos; should work ... - bRet &= CopyImplImpl(aPam, *copyRange.Start(), bCopyAll, ©Range, /*bCopyText=*/false); + bRet &= CopyImplImpl(aPam, *copyRange.Start(), flags & ~SwCopyFlags::IsMoveToFly, ©Range); nOffset = iter->first - rStart.nNode.GetIndex(); // fly nodes... if (pCopyRange) { @@ -4528,7 +4529,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, rStart = *rPam.Start(); // set to original start if (rStart < rEnd) // check if part is empty { - bRet &= CopyImplImpl(aPam, *copyRange.Start(), bCopyAll, ©Range, /*bCopyText=*/false); + bRet &= CopyImplImpl(aPam, *copyRange.Start(), flags & ~SwCopyFlags::IsMoveToFly, ©Range); if (pCopyRange) { if (bFirst) @@ -4544,8 +4545,8 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos, } bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPos, - const bool bCopyAll, - SwPaM *const pCpyRange, bool bCopyText ) const + SwCopyFlags const flags, + SwPaM *const pCpyRange) const { SwDoc* pDoc = rPos.nNode.GetNode().GetDoc(); const bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection(); @@ -4554,7 +4555,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo SwPosition *const pEnd = rPam.End(); // Catch when there's no copy to do. - if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, bCopyText) && !bColumnSel) || + if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, flags) && !bColumnSel) || //JP 29.6.2001: 88963 - don't copy if inspos is in region of start to end //JP 15.11.2001: don't test inclusive the end, ever exclusive ( pDoc == &m_rDoc && *pStt <= rPos && rPos < *pEnd )) @@ -4850,7 +4851,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo } SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange ); - if( bCopyAll || aRg.aStart != aRg.aEnd ) + if ((flags & SwCopyFlags::CopyAll) || aRg.aStart != aRg.aEnd) { if (pSttTextNd && bCopyCollFormat && pDestTextNd->HasSwAttrSet()) { @@ -4878,13 +4879,13 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo SwNodeIndex aSaveIdx( aInsPos, -1 ); assert(pStt->nNode != pEnd->nNode); pEnd->nContent = 0; // TODO why this? - CopyWithFlyInFly( aRg, aInsPos, &tmp, /*bMakeNewFrames*/true, false, /*bCopyFlyAtFly=*/false, bCopyText ); + CopyWithFlyInFly(aRg, aInsPos, &tmp, /*bMakeNewFrames*/true, false, /*bCopyFlyAtFly=*/false, flags); ++aSaveIdx; pEnd->nNode = aSaveIdx; pEnd->nContent.Assign( aSaveIdx.GetNode().GetTextNode(), 0 ); } else - CopyWithFlyInFly( aRg, aInsPos, &tmp, /*bMakeNewFrames*/true, false, /*bCopyFlyAtFly=*/false, bCopyText ); + CopyWithFlyInFly(aRg, aInsPos, &tmp, /*bMakeNewFrames*/true, false, /*bCopyFlyAtFly=*/false, flags); bCopyBookmarks = false; } @@ -4926,7 +4927,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo } } - if (bCopyAll || aRg.aStart != aRg.aEnd) + if ((flags & SwCopyFlags::CopyAll) || aRg.aStart != aRg.aEnd) { // Put the breaks back into the first node if( aBrkSet.Count() && nullptr != ( pDestTextNd = pDoc->GetNodes()[ diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 2cb46646d5b7..beaddb5851d4 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1379,7 +1379,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, aCpyPam.SetMark(); aCpyPam.GetPoint()->nContent = nSrcTo; aCpyPam.GetDoc()->getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(), - /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + SwCopyFlags::CheckPosInFly); pDstDoc->GetIDocumentUndoRedo().DoUndo( bUndo ); SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing.get() ); @@ -1946,7 +1946,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) pSrcRedl->GetDoc()->getIDocumentContentOperations().CopyRange( *const_cast<SwPaM*>(static_cast<const SwPaM*>(pSrcRedl)), - *pDestRedl->GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + *pDestRedl->GetPoint(), SwCopyFlags::CheckPosInFly); pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index f034d289a5ed..93d13933b9ae 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -189,7 +189,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, SwDontExpandItem aACD; aACD.SaveDontExpandItems( rInsPos ); - pGDoc->getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pGDoc->getIDocumentContentOperations().CopyRange(aCpyPam, rInsPos, SwCopyFlags::CheckPosInFly); aACD.RestoreDontExpandItems( rInsPos ); if( pShell ) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 4b43892c4abe..d741c14ba068 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -428,7 +428,7 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rS *rTmp.GetPoint() != *rTmp.GetMark() ) { // aPos is the newly created fly section, so definitely outside rPam, it's pointless to check that again. - getIDocumentContentOperations().CopyRange( *const_cast<SwPaM*>(&rTmp), aPos, /*bCopyAll=*/false, /*bCheckPos=*/false, /*bCopyText=*/true); + getIDocumentContentOperations().CopyRange(*const_cast<SwPaM*>(&rTmp), aPos, SwCopyFlags::IsMoveToFly); } } getIDocumentRedlineAccess().SetRedlineMove(bOldRedlineMove); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 8c64c6a2862c..9efcc13c0f52 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -1143,7 +1143,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu #ifdef DBG_UTIL SAL_INFO( "sw.docappend", "CopyRange In: " << CNTNT_DOC( this ) ); #endif - rSource.getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, /*bCopyAll=*/true, /*bCheckPos=*/true, /*bCopyText=*/false ); + rSource.getIDocumentContentOperations().CopyRange(aCpyPam, rInsPos, SwCopyFlags::CopyAll|SwCopyFlags::CheckPosInFly); // Note: aCpyPam is invalid now #ifdef DBG_UTIL SAL_INFO( "sw.docappend", "CopyRange Out: " << CNTNT_DOC( this ) ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index f4f83dcd56ab..af72d98b70bf 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2171,7 +2171,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset, --aIdx; // move before insertion - getIDocumentContentOperations().CopyRange( aPam, aInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + getIDocumentContentOperations().CopyRange(aPam, aInsPos, SwCopyFlags::CheckPosInFly); // now delete all the delete redlines that were copied #ifndef NDEBUG diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ee8e8b23d8c0..de78e2a35000 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1404,7 +1404,7 @@ void SwRangeRedline::CopyToSection() SwNodeIndex aNdIdx( *pSttNd, 1 ); SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode(); SwPosition aPos( aNdIdx, SwIndex( pTextNd )); - pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pDoc->getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); // Take over the style from the EndNode if needed // We don't want this in Doc::Copy @@ -1427,7 +1427,7 @@ void SwRangeRedline::CopyToSection() if( pCEndNd ) { SwPosition aPos( *pSttNd->EndOfSectionNode() ); - pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pDoc->getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); } else { diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index e38e196acff2..180b7b98c904 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1321,7 +1321,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) pCpyPam->Start()->nNode > rInsPos || rInsPos >= pCpyPam->End()->nNode ) { - pSrcDoc->getIDocumentContentOperations().CopyRange( *pCpyPam, *pPam->GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pSrcDoc->getIDocumentContentOperations().CopyRange(*pCpyPam, *pPam->GetPoint(), SwCopyFlags::CheckPosInFly); } delete pCpyPam; } diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 5cb118744d70..171d60da1f0a 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -467,7 +467,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, SwDontExpandItem aExpItem; aExpItem.SaveDontExpandItems( *aPam.GetPoint() ); - pAutoDoc->getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pAutoDoc->getIDocumentContentOperations().CopyRange(aCpyPam, *aPam.GetPoint(), SwCopyFlags::CheckPosInFly); aExpItem.RestoreDontExpandItems( *aPam.GetPoint() ); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index a9b4a502209b..af9a8e4d5674 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -245,7 +245,7 @@ bool SwEditShell::Copy( SwEditShell* pDestShell ) bFirstMove = false; } - const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, *pPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) ); + const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange(rPaM, *pPos, SwCopyFlags::CheckPosInFly) ); if (!bSuccess) continue; diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index b35c45a6fcf2..07697e6fb3e8 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -140,7 +140,7 @@ sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, aStt = pGDoc->GetNodes().GetEndOfExtras(); pContentNd = pGDoc->GetNodes().GoNext( &aStt ); SwPosition aInsPos( aStt, SwIndex( pContentNd )); - pMyDoc->getIDocumentContentOperations().CopyRange( aCpyPam, aInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pMyDoc->getIDocumentContentOperations().CopyRange(aCpyPam, aInsPos, SwCopyFlags::CheckPosInFly); nRet = rBlock.PutDoc(); } @@ -213,7 +213,7 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc ) { rPaM.SetMark(); rPaM.Move( fnMoveForward, GoInContent ); - bRet = GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) + bRet = GetDoc()->getIDocumentContentOperations().CopyRange(rPaM, aPos, SwCopyFlags::CheckPosInFly) || bRet; rPaM.Exchange(); rPaM.DeleteMark(); @@ -233,7 +233,8 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc ) aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex(); aPaM.Start()->nContent.Assign(nullptr, 0); } - bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) || bRet; + bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, SwCopyFlags::CheckPosInFly) + || bRet; } } } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index d0777144c039..c675e1fd48bc 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -798,7 +798,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bNestedTable ) { SwNodeIndex aIndexBefore(rInsPos.nNode); --aIndexBefore; - pClpDoc->getIDocumentContentOperations().CopyRange( rCopy, rInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pClpDoc->getIDocumentContentOperations().CopyRange(rCopy, rInsPos, SwCopyFlags::CheckPosInFly); { ++aIndexBefore; SwPaM aPaM(SwPosition(aIndexBefore), @@ -1037,7 +1037,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bNestedTable ) --aIndexBefore; - pClpDoc->getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pClpDoc->getIDocumentContentOperations().CopyRange(aCpyPam, rInsPos, SwCopyFlags::CheckPosInFly); // Note: aCpyPam is invalid now ++aIndexBefore; diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index 2d600b6ff8ba..3df39532978c 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -37,7 +37,7 @@ public: DocumentContentOperationsManager( SwDoc& i_rSwdoc ); //Interface methods: - bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll, bool bCheckPos, bool bCopyText ) const override; + bool CopyRange(SwPaM&, SwPosition&, SwCopyFlags) const override; void DeleteSection(SwNode* pNode) override; @@ -109,12 +109,12 @@ public: bool bMakeNewFrames = true, bool bDelRedlines = true, bool bCopyFlyAtFly = false, - bool bCopyText = false ) const; + SwCopyFlags flags = SwCopyFlags::Default) const; void CopyFlyInFlyImpl( const SwNodeRange& rRg, SwPaM const*const pCopiedPaM, const SwNodeIndex& rStartIdx, const bool bCopyFlyAtFly = false, - bool bCopyText = false ) const; + SwCopyFlags flags = SwCopyFlags::Default) const; /// Parameters for _Rst and lcl_SetTextFormatColl //originallyfrom docfmt.cxx @@ -171,9 +171,9 @@ private: /* Copy a range within the same or to another document. Position may not lie within range! */ bool CopyImpl( SwPaM&, SwPosition&, - const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/, bool bCopyText ) const; + SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const; bool CopyImplImpl(SwPaM&, SwPosition&, - const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/, bool bCopyText ) const; + SwCopyFlags flags, SwPaM *const pCpyRng /*= 0*/) const; DocumentContentOperationsManager(DocumentContentOperationsManager const&) = delete; DocumentContentOperationsManager& operator=(DocumentContentOperationsManager const&) = delete; diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 05a2080aec39..6af2f532c020 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -421,7 +421,7 @@ void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext) SwPaM aPam( rContext.GetDoc().GetNodes().GetEndOfContent() ); SetPaM( aPam ); SwPaM & rRepeatPaM( rContext.GetRepeatPaM() ); - aPam.GetDoc()->getIDocumentContentOperations().CopyRange( aPam, *rRepeatPaM.GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + aPam.GetDoc()->getIDocumentContentOperations().CopyRange( aPam, *rRepeatPaM.GetPoint(), SwCopyFlags::CheckPosInFly); } SwUndoInsDoc::SwUndoInsDoc( const SwPaM& rPam ) diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 36bb5f049b5f..1790b1862e23 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2252,7 +2252,7 @@ SwXText::copyText( // Explicitly request copy text mode, so // sw::DocumentContentOperationsManager::CopyFlyInFlyImpl() will copy shapes anchored to // us, even if we have only a single paragraph. - m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(temp, rPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false); + m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(temp, rPos, SwCopyFlags::CheckPosInFly); } if (!pFirstNode) { // the node at rPos was split; get rid of the first empty one so @@ -2263,7 +2263,7 @@ SwXText::copyText( } else { - m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(*pCursor->GetPaM(), rPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false); + m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(*pCursor->GetPaM(), rPos, SwCopyFlags::CheckPosInFly); } } diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index ce04767173ad..09dea9ba57be 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -233,7 +233,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ) SwNodeIndex aIdx( pGlDoc->GetNodes().GetEndOfContent(), -1 ); pCNd = aIdx.GetNode().GetContentNode(); SwPosition aPos( aIdx, SwIndex( pCNd, pCNd ? pCNd->Len() : 0 ) ); - pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pD->getIDocumentContentOperations().CopyRange(aPam, aPos, SwCopyFlags::CheckPosInFly); rBlocks.PutDoc(); } else diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index a60cfb202ad4..4e651ed6dbde 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -167,7 +167,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, -1 ); pCNd = aIdx.GetNode().GetContentNode(); SwPosition aPos(aIdx, SwIndex(pCNd, pCNd ? pCNd->Len() : 0)); - pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pD->getIDocumentContentOperations().CopyRange(aPam, aPos, SwCopyFlags::CheckPosInFly); rBlocks.PutDoc(); } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 922815d5f94e..4d617b8991e5 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -686,7 +686,7 @@ void SwXMLTableCellContext_Impl::EndElement() assert(pDstTextCursor && "SwXTextCursor missing"); SwPaM aSrcPaM(*pSrcPaM->GetMark(), *pSrcPaM->GetPoint()); SwPosition aDstPos( *pDstTextCursor->GetPaM()->GetPoint() ); - pDoc->getIDocumentContentOperations().CopyRange( aSrcPaM, aDstPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); + pDoc->getIDocumentContentOperations().CopyRange(aSrcPaM, aDstPos, SwCopyFlags::CheckPosInFly); m_nColRepeat--; } diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 0b2d341b309b..39315dfd72fe 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -311,7 +311,8 @@ static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTe } } if (!pPam) { return false; } - bRet = pDoc->getIDocumentContentOperations().CopyRange( *pPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) || bRet; + bRet = pDoc->getIDocumentContentOperations().CopyRange(*pPam, aPos, SwCopyFlags::CheckPosInFly) + || bRet; } pInsDoc->getIDocumentFieldsAccess().UnlockExpFields(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits