summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx12
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx12
-rw-r--r--sw/source/core/docnode/ndtbl.cxx4
-rw-r--r--sw/source/core/inc/mvsave.hxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx10
-rw-r--r--sw/source/core/undo/untbl.cxx4
7 files changed, 24 insertions, 22 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 29ea21a33adb..5dbbbc721f37 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -347,7 +347,7 @@ public:
/// Virtual methods from ContentNode.
virtual SwContentFrame *MakeFrame( SwFrame* ) override;
SwTextNode * SplitContentNode(const SwPosition &,
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> const* pContentIndexRestore);
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const* pContentIndexRestore);
virtual SwContentNode *JoinNext() override;
void JoinPrev();
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 989fae5b4abe..6fc683fe9800 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -148,7 +148,7 @@ namespace
SaveUnoCursors(rDoc, nNode, nContent);
SaveShellCursors(rDoc, nNode, nContent);
}
- virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode eMode = RestoreMode::All) override
+ virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode eMode = RestoreMode::All) override
{
SwContentNode* pCNd = rDoc.GetNodes()[ nNode ]->GetContentNode();
updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
@@ -161,7 +161,7 @@ namespace
}
if (eMode & RestoreMode::Flys)
{
- RestoreFlys(rDoc, aUpdater, bAuto);
+ RestoreFlys(rDoc, aUpdater, bAuto, bAtStart);
}
}
virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode eMode = RestoreMode::All) override
@@ -178,7 +178,7 @@ namespace
}
if (eMode & RestoreMode::Flys)
{
- RestoreFlys(rDoc, aUpdater, false);
+ RestoreFlys(rDoc, aUpdater, false, false);
}
}
@@ -188,7 +188,7 @@ namespace
void SaveRedlines(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent);
void RestoreRedlines(SwDoc& rDoc, updater_t const & rUpdater);
void SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit);
- void RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto);
+ void RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto, bool bAtStart);
void SaveUnoCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent);
void RestoreUnoCursors(updater_t const & rUpdater);
void SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent);
@@ -369,7 +369,7 @@ void ContentIdxStoreImpl::SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nCont
}
}
-void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto)
+void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto, bool bAtStart)
{
SwFrameFormats* pSpz = rDoc.GetSpzFrameFormats();
for (const MarkEntry& aEntry : m_aFlyEntries)
@@ -380,6 +380,8 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, b
const SwFormatAnchor& rFlyAnchor = pFrameFormat->GetAnchor();
if( rFlyAnchor.GetContentAnchor() )
{
+ if(bAtStart && RndStdIds::FLY_AT_PARA == rFlyAnchor.GetAnchorId())
+ continue;
SwFormatAnchor aNew( rFlyAnchor );
SwPosition aNewPos( *rFlyAnchor.GetContentAnchor() );
rUpdater(aNewPos, aEntry.m_nContent);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 93646ac74565..b9846d852a2a 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2272,12 +2272,12 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex());
assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex());
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
- [&](SwTextNode *const, sw::mark::RestoreMode const eMode)
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool)> restoreFunc(
+ [&](SwTextNode *const, sw::mark::RestoreMode const eMode, bool)
{
if (!pContentStore->Empty())
{
- pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-1, 0, true, eMode);
+ pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-1, 0, true, false, eMode);
}
});
pTNd = pTNd->SplitContentNode(rPos, &restoreFunc)->GetTextNode();
@@ -3177,12 +3177,12 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
pContentStore->Save( m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
assert(pNode->IsTextNode());
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
- [&](SwTextNode *const, sw::mark::RestoreMode const eMode)
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool bAtStart)> restoreFunc(
+ [&](SwTextNode *const, sw::mark::RestoreMode const eMode, bool const bAtStart)
{
if (!pContentStore->Empty())
{ // move all bookmarks, TOXMarks, FlyAtCnt
- pContentStore->Restore(m_rDoc, rPos.nNode.GetIndex()-1, 0, true, eMode);
+ pContentStore->Restore(m_rDoc, rPos.nNode.GetIndex()-1, 0, true, bAtStart && (eMode & sw::mark::RestoreMode::Flys), eMode);
}
if (eMode & sw::mark::RestoreMode::NonFlys)
{
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index c1e4d5040184..5be819329f90 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1074,8 +1074,8 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
if (pTextNd->GetText()[nChPos] == cCh)
{
aCntPos.nContent = nChPos;
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
- [&](SwTextNode *const pNewNode, sw::mark::RestoreMode const eMode)
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool)> restoreFunc(
+ [&](SwTextNode *const pNewNode, sw::mark::RestoreMode const eMode, bool)
{
if (!pContentStore->Empty())
{
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index 6aeefcd950d3..2debeab38aea 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -79,7 +79,7 @@ namespace sw::mark
virtual void Clear() =0;
virtual bool Empty() =0;
virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0;
- virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode = RestoreMode::All) =0;
+ virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, bool bAtStart = false, RestoreMode = RestoreMode::All) =0;
virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode = RestoreMode::All) =0;
virtual ~ContentIdxStore() {};
static std::shared_ptr<ContentIdxStore> Create();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 908587b32ea3..e156291d6478 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -410,7 +410,7 @@ void MoveMergedFlysAndFootnotes(std::vector<SwTextFrame*> const& rFrames,
} // namespace
SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> const*const pContentIndexRestore)
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const*const pContentIndexRestore)
{
bool isHide(false);
SwNode::Merge const eOldMergeFlag(GetRedlineMergeFlag());
@@ -523,7 +523,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
if (pContentIndexRestore)
{ // call before making frames and before RegisterToNode
- (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::NonFlys);
+ (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::NonFlys, false);
}
if (eOldMergeFlag != SwNode::Merge::None)
{ // clear before making frames and before RegisterToNode
@@ -560,7 +560,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
lcl_ChangeFootnoteRef( *this );
if (pContentIndexRestore)
{ // call after making frames; listeners will take care of adding to the right frame
- (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::Flys);
+ (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::Flys, false);
}
if (eOldMergeFlag != SwNode::Merge::None)
{
@@ -623,7 +623,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
if (pContentIndexRestore)
{ // call before making frames and before RegisterToNode
- (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::NonFlys);
+ (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::NonFlys, false);
}
std::vector<SwTextFrame*> frames;
@@ -690,7 +690,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
if (pContentIndexRestore)
{ // call after making frames; listeners will take care of adding to the right frame
- (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::Flys);
+ (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::Flys, nSplitPos == 0);
}
if (bRecreateThis)
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 3197ddbc4d64..707ae38541e6 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -572,8 +572,8 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
pTextNd->EraseText( aCntPos, 1 );
- std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
- [&](SwTextNode *const pNewNode, sw::mark::RestoreMode const eMode)
+ std::function<void (SwTextNode *, sw::mark::RestoreMode, bool)> restoreFunc(
+ [&](SwTextNode *const pNewNode, sw::mark::RestoreMode const eMode, bool)
{
if (!pContentStore->Empty())
{