summaryrefslogtreecommitdiffstats
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
commit91fe6b97952aa6f7cef58327fd085a17db38ad95 (patch)
tree7a4412295bfb80e15a4936fe67d4bd7b96458ce8 /sw/source/core/doc
parentReleasing progress-linux version 4:24.2.1-4~progress7.99u1. (diff)
downloadlibreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.tar.xz
libreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.zip
Merging upstream version 4:24.2.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx14
-rw-r--r--sw/source/core/doc/docedt.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx12
-rw-r--r--sw/source/core/doc/doctxm.cxx2
4 files changed, 20 insertions, 12 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 09e0a1233e..57b8e58310 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3788,11 +3788,16 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
SwDoc& rDest = rInsPos.GetDoc();
SwNodeIndex aSavePos( rInsPos );
+ SwPaM aCopiedPaM(rRg.aStart, rRg.aEnd);
+ if (pCopiedPaM)
+ aCopiedPaM = pCopiedPaM->first;
+
if (rRg.aStart != rRg.aEnd)
{
bool bEndIsEqualEndPos = rInsPos == rRg.aEnd.GetNode();
--aSavePos;
SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 );
+ auto savedEndContentIndex = aCopiedPaM.End()->GetContentIndex();
// insert behind the already copied start node
m_rDoc.GetNodes().CopyNodes( rRg, rInsPos, false, true );
@@ -3801,6 +3806,10 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
if (bEndIsEqualEndPos)
{
const_cast<SwNodeIndex&>(rRg.aEnd).Assign(aSavePos.GetNode(), +1);
+ // pCopiedPaM->first now spans a range from the start of the original selection
+ // to the end of newly added text, and the insertion point is in the middle of
+ // that range. Adjust the local copy to cover the original copied PaM.
+ aCopiedPaM.End()->Assign(rRg.aEnd, savedEndContentIndex);
}
}
@@ -3810,7 +3819,6 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
// sw_fieldmarkhide: also needs to be done before making frames
if (m_rDoc.getIDocumentMarkAccess()->getAllMarksCount())
{
- SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPosition targetPos(aSavePos, SwNodeOffset(rRg.aStart != rRg.aEnd ? +1 : 0));
if (pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->GetNode())
{
@@ -3823,7 +3831,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
targetPos = pCopiedPaM->second;
}
- sw::CopyBookmarks(pCopiedPaM ? pCopiedPaM->first : aRgTmp, targetPos, flags);
+ sw::CopyBookmarks(aCopiedPaM, targetPos, flags);
}
if (rRg.aStart != rRg.aEnd)
@@ -3914,7 +3922,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
{
::sw::UndoGuard const undoGuard(rDest.GetIDocumentUndoRedo());
- CopyFlyInFlyImpl(rRg, pCopiedPaM ? &pCopiedPaM->first : nullptr,
+ CopyFlyInFlyImpl(rRg, pCopiedPaM ? &aCopiedPaM : nullptr,
// see comment below regarding use of pCopiedPaM->second
(pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->GetNode())
? pCopiedPaM->second.GetNode()
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index c78d8e18b6..2a5aad64de 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -553,7 +553,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
{
nCurrNd = pNd->EndOfSectionIndex();
}
- else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
+ else if( !pContentFrame->IsHiddenNow() )
{
if( pPageCnt && *pPageCnt && pPageSt )
{
@@ -766,7 +766,7 @@ static bool lcl_HyphenateNode( SwNode* pNd, void* pArgs )
// sw_redlinehide: this will be called once per node for merged nodes;
// the fully deleted ones won't have frames so are skipped.
SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
- if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
+ if( pContentFrame && !pContentFrame->IsHiddenNow() )
{
sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d6c943dbcd..1c696bebb6 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1553,21 +1553,21 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
{
if (pStashedFormatSrc->GetDoc() != this)
{
- SwFrameFormat* pNewFormat = new SwFrameFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat());
+ SwFrameFormat newFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat());
SfxItemSet aAttrSet(pStashedFormatSrc->GetAttrSet());
aAttrSet.ClearItem(RES_HEADER);
aAttrSet.ClearItem(RES_FOOTER);
- pNewFormat->DelDiffs( aAttrSet );
- pNewFormat->SetFormatAttr( aAttrSet );
+ newFormat.DelDiffs(aAttrSet);
+ newFormat.SetFormatAttr(aAttrSet);
if (bHeader)
- CopyHeader(*pStashedFormatSrc, *pNewFormat);
+ CopyHeader(*pStashedFormatSrc, newFormat);
else
- CopyFooter(*pStashedFormatSrc, *pNewFormat);
+ CopyFooter(*pStashedFormatSrc, newFormat);
- rDstDesc.StashFrameFormat(*pNewFormat, bHeader, bLeft, bFirst);
+ rDstDesc.StashFrameFormat(newFormat, bHeader, bLeft, bFirst);
}
else
{
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index f03687d810..d29223050b 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1057,7 +1057,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
rDoc.GetNodes().InsertTextSection(
*pHeadNd, *pSectFormat, headerData, nullptr, &aIdx.GetNode(), true, false);
-
+ pSectFormat->GetSection()->SetProtect(SwTOXBase::IsProtected());
if (pUndo)
{
pUndo->TitleSectionInserted(*pSectFormat);