summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/IDocumentMarkAccess.hxx5
-rw-r--r--sw/inc/IMark.hxx5
-rw-r--r--sw/qa/core/macros-test.cxx6
-rw-r--r--sw/qa/core/uwriter.cxx9
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx25
-rw-r--r--sw/source/core/crsr/annotationmark.cxx2
-rw-r--r--sw/source/core/crsr/bookmrk.cxx49
-rw-r--r--sw/source/core/crsr/crbm.cxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx22
-rw-r--r--sw/source/core/doc/docbm.cxx20
-rw-r--r--sw/source/core/inc/MarkManager.hxx4
-rw-r--r--sw/source/core/inc/annotationmark.hxx2
-rw-r--r--sw/source/core/inc/bookmrk.hxx8
-rw-r--r--sw/source/core/undo/rolbck.cxx3
-rw-r--r--sw/source/core/unocore/unobkm.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
-rw-r--r--sw/source/filter/basflt/fltshell.cxx2
-rw-r--r--sw/source/filter/html/swhtml.cxx3
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx3
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx3
20 files changed, 119 insertions, 58 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 6bd844d0c59f..ff0a13cccbc4 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -72,12 +72,15 @@ class IDocumentMarkAccess
@param eMark
[in] the type of the new mark.
+ @param eMode
+ [in] is the new mark part of a text copy operation
+
@returns
a pointer to the new mark (name might have changed).
*/
virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
const OUString& rProposedName,
- MarkType eMark) = 0;
+ MarkType eMark, ::sw::mark::InsertMode eMode) = 0;
virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
const OUString& rName,
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index 9ae6fb81d486..f4b38a9a189b 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -31,6 +31,11 @@ struct SwPosition;
namespace sw { namespace mark
{
+ enum class InsertMode
+ {
+ New,
+ CopyText,
+ };
class SW_DLLPUBLIC IMark
: virtual public SwModify // inherited as interface
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 88e4e1116304..05dea3607884 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -209,7 +209,8 @@ void SwMacrosTest::testBookmarkDeleteAndJoin()
aPaM.Move(fnMoveForward, GoInDoc);
IDocumentMarkAccess & rIDMA = *pDoc->getIDocumentMarkAccess();
sw::mark::IMark *pMark =
- rIDMA.makeMark(aPaM, "test", IDocumentMarkAccess::MarkType::BOOKMARK);
+ rIDMA.makeMark(aPaM, "test", IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT(pMark);
// select so pMark start position is on a node that is fully deleted
aPaM.Move(fnMoveBackward, GoInNode);
@@ -243,7 +244,8 @@ void SwMacrosTest::testBookmarkDeleteTdf90816()
aPaM.Move(fnMoveBackward, GoInContent);
IDocumentMarkAccess & rIDMA = *pDoc->getIDocumentMarkAccess();
sw::mark::IMark *pMark =
- rIDMA.makeMark(aPaM, "test", IDocumentMarkAccess::MarkType::BOOKMARK);
+ rIDMA.makeMark(aPaM, "test", IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT(pMark);
// delete the same selection as the bookmark
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 01c67e4f5395..ee0704824c2d 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1238,19 +1238,22 @@ void SwDocTest::testMarkMove()
m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "Paragraph 1");
aPaM.SetMark();
aPaM.GetMark()->nContent -= aPaM.GetMark()->nContent.GetIndex();
- pMarksAccess->makeMark(aPaM, "Para1", IDocumentMarkAccess::MarkType::BOOKMARK);
+ pMarksAccess->makeMark(aPaM, "Para1",
+ IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New);
m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint());
m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "Paragraph 2");
aPaM.SetMark();
aPaM.GetMark()->nContent -= aPaM.GetMark()->nContent.GetIndex();
- pMarksAccess->makeMark(aPaM, "Para2", IDocumentMarkAccess::MarkType::BOOKMARK);
+ pMarksAccess->makeMark(aPaM, "Para2",
+ IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New);
m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint());
m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "Paragraph 3");
aPaM.SetMark();
aPaM.GetMark()->nContent -= aPaM.GetMark()->nContent.GetIndex();
- pMarksAccess->makeMark(aPaM, "Para3", IDocumentMarkAccess::MarkType::BOOKMARK);
+ pMarksAccess->makeMark(aPaM, "Para3",
+ IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New);
}
// join paragraph 2 and 3 and check
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8495768570e1..378c9feb2852 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -471,7 +471,8 @@ void SwUiWriterTest::testBookmarkCopy()
rIDCO.InsertString(aPaM, "bar");
aPaM.SetMark();
aPaM.MovePara(GoCurrPara, fnParaStart);
- rIDMA.makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK);
+ rIDMA.makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
aPaM.Exchange();
aPaM.DeleteMark();
rIDCO.SplitNode(*aPaM.GetPoint(), false);
@@ -1340,7 +1341,8 @@ void SwUiWriterTest::testBookmarkUndo()
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) );
- pMarkAccess->makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK);
+ pMarkAccess->makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
rUndoManager.Undo();
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
@@ -1492,7 +1494,9 @@ void SwUiWriterTest::testTdf63214()
aPaM.SetMark();
aPaM.Move(fnMoveForward, GoInContent);
//Inserting a crossRefBookmark
- pMarkAccess->makeMark(aPaM, "Bookmark", IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
+ pMarkAccess->makeMark(aPaM, "Bookmark",
+ IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
}
//moving cursor to the end of paragraph
@@ -1521,7 +1525,8 @@ void SwUiWriterTest::testTdf51741()
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) );
//Modification 1
- pMarkAccess->makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK);
+ pMarkAccess->makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT(pWrtShell->IsModified());
pWrtShell->ResetModified();
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
@@ -3648,13 +3653,17 @@ void SwUiWriterTest::testTdf94804()
SwPaM* pCrsr = pDoc->GetEditShell()->GetCursor();
IDocumentMarkAccess* pIDMAccess(pDoc->getIDocumentMarkAccess());
//make first bookmark, CROSSREF_HEADING, with *empty* name
- sw::mark::IMark* pMark1(pIDMAccess->makeMark(*pCrsr, "", IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK));
+ sw::mark::IMark* pMark1(pIDMAccess->makeMark(*pCrsr, "",
+ IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK,
+ ::sw::mark::InsertMode::New));
//get the new(autogenerated) bookmark name
rtl::OUString bookmark1name = pMark1->GetName();
//match the bookmark name, it should be like "__RefHeading__**"
CPPUNIT_ASSERT(bookmark1name.match("__RefHeading__"));
//make second bookmark, CROSSREF_NUMITEM, with *empty* name
- sw::mark::IMark* pMark2(pIDMAccess->makeMark(*pCrsr, "", IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK));
+ sw::mark::IMark* pMark2(pIDMAccess->makeMark(*pCrsr, "",
+ IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK,
+ ::sw::mark::InsertMode::New));
//get the new(autogenerated) bookmark name
rtl::OUString bookmark2name = pMark2->GetName();
//match the bookmark name, it should be like "__RefNumPara__**"
@@ -3923,7 +3932,9 @@ void SwUiWriterTest::testTdf96479()
SwPaM aPaM(aIdx);
IDocumentMarkAccess &rIDMA = *pDoc->getIDocumentMarkAccess();
sw::mark::IMark *pMark =
- rIDMA.makeMark(aPaM, "original", IDocumentMarkAccess::MarkType::BOOKMARK);
+ rIDMA.makeMark(aPaM, "original",
+ IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
CPPUNIT_ASSERT(!pMark->IsExpanded());
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), rIDMA.getBookmarksCount());
diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx
index c2ad1f4e7f02..82d0bd54279c 100644
--- a/sw/source/core/crsr/annotationmark.cxx
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -49,7 +49,7 @@ namespace sw { namespace mark
{
}
- void AnnotationMark::InitDoc(SwDoc* const io_pDoc)
+ void AnnotationMark::InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode const)
{
SwTextNode *pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index bb3f7626c590..cd553d0add38 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -65,7 +65,20 @@ namespace
}
}
- void lcl_AssureFieldMarksSet(Fieldmark* const pField,
+ void lcl_AssertFieldMarksSet(Fieldmark* const pField,
+ const sal_Unicode aStartMark,
+ const sal_Unicode aEndMark)
+ {
+ if (aEndMark != CH_TXT_ATR_FORMELEMENT)
+ {
+ SwPosition const& rStart(pField->GetMarkStart());
+ assert(rStart.nNode.GetNode().GetTextNode()->GetText()[rStart.nContent.GetIndex()] == aStartMark);
+ }
+ SwPosition const& rEnd(pField->GetMarkEnd());
+ assert(rEnd.nNode.GetNode().GetTextNode()->GetText()[rEnd.nContent.GetIndex() - 1] == aEndMark);
+ }
+
+ void lcl_SetFieldMarks(Fieldmark* const pField,
SwDoc* const io_pDoc,
const sal_Unicode aStartMark,
const sal_Unicode aEndMark)
@@ -280,7 +293,7 @@ namespace sw { namespace mark
m_aName = rName;
}
- void Bookmark::InitDoc(SwDoc* const io_pDoc)
+ void Bookmark::InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode const)
{
if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
{
@@ -399,9 +412,16 @@ namespace sw { namespace mark
: Fieldmark(rPaM)
{ }
- void TextFieldmark::InitDoc(SwDoc* const io_pDoc)
+ void TextFieldmark::InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode const eMode)
{
- lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ if (eMode == sw::mark::InsertMode::New)
+ {
+ lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ }
+ else
+ {
+ lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ }
}
void TextFieldmark::ReleaseDoc(SwDoc* const pDoc)
@@ -413,15 +433,22 @@ namespace sw { namespace mark
: Fieldmark(rPaM)
{ }
- void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc)
+ void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode const eMode)
{
- lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
+ if (eMode == sw::mark::InsertMode::New)
+ {
+ lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
- // For some reason the end mark is moved from 1 by the Insert: we don't
- // want this for checkboxes
- SwPosition aNewEndPos = this->GetMarkEnd();
- aNewEndPos.nContent--;
- SetMarkEndPos( aNewEndPos );
+ // For some reason the end mark is moved from 1 by the Insert:
+ // we don't want this for checkboxes
+ SwPosition aNewEndPos = GetMarkEnd();
+ aNewEndPos.nContent--;
+ SetMarkEndPos( aNewEndPos );
+ }
+ else
+ {
+ lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
+ }
}
void CheckboxFieldmark::ReleaseDoc(SwDoc* const pDoc)
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 946af35c5cae..f1a50fad65ea 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -87,7 +87,7 @@ namespace
::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark(
*GetCursor(),
rName,
- eMark);
+ eMark, sw::mark::InsertMode::New);
::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark);
if(pBookmark)
{
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 1f281830bb35..cd8258db8b00 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -266,19 +266,11 @@ namespace
lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount);
}
- const IDocumentMarkAccess::MarkType aMarkType = IDocumentMarkAccess::GetType(*pMark);
- if (aMarkType == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK)
- {
- // Node's CopyText() copies also dummy characters, which need to be removed
- // (they will be added later in MarkBase::InitDoc inside IDocumentMarkAccess::makeMark)
- // CHECKBOX_FIELDMARK doesn't contain any other data in its range, so just clear it
- pDestDoc->getIDocumentContentOperations().DeleteRange(aTmpPam);
- }
-
::sw::mark::IMark* const pNewMark = pDestDoc->getIDocumentMarkAccess()->makeMark(
aTmpPam,
pMark->GetName(),
- IDocumentMarkAccess::GetType(*pMark));
+ IDocumentMarkAccess::GetType(*pMark),
+ ::sw::mark::InsertMode::CopyText);
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
@@ -3870,7 +3862,10 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
m_rDoc.GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, nullptr);
// If any Redline will change (split!) the node
- const ::sw::mark::IMark* pBkmk = m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam, OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
+ const ::sw::mark::IMark* pBkmk =
+ m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam,
+ OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
+ ::sw::mark::InsertMode::New);
//JP 06.01.98: MUSS noch optimiert werden!!!
m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(
@@ -3962,7 +3957,10 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
m_rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, nullptr);
// If any Redline will change (split!) the node
- const ::sw::mark::IMark* pBkmk = m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam, OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
+ const ::sw::mark::IMark* pBkmk =
+ m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam,
+ OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
+ ::sw::mark::InsertMode::New);
SwIndex& rIdx = aDelPam.GetPoint()->nContent;
rIdx.Assign( nullptr, 0 );
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 1604d7ccf35c..99eec9fe1e37 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -369,7 +369,8 @@ namespace sw { namespace mark
::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM,
const OUString& rName,
- const IDocumentMarkAccess::MarkType eType)
+ const IDocumentMarkAccess::MarkType eType,
+ sw::mark::InsertMode const eMode)
{
#if OSL_DEBUG_LEVEL > 0
{
@@ -468,7 +469,7 @@ namespace sw { namespace mark
// no special array for these
break;
}
- pMarkBase->InitDoc(m_pDoc);
+ pMarkBase->InitDoc(m_pDoc, eMode);
SAL_INFO("sw.core", "--- makeType ---");
SAL_INFO("sw.core", "Marks");
lcl_DebugMarks(m_vAllMarks);
@@ -486,7 +487,8 @@ namespace sw { namespace mark
const OUString& rType )
{
sw::mark::IMark* pMark = makeMark( rPaM, rName,
- IDocumentMarkAccess::MarkType::TEXT_FIELDMARK );
+ IDocumentMarkAccess::MarkType::TEXT_FIELDMARK,
+ sw::mark::InsertMode::New);
sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
if (pFieldMark)
pFieldMark->SetFieldname( rType );
@@ -500,7 +502,8 @@ namespace sw { namespace mark
const OUString& rType)
{
sw::mark::IMark* pMark = makeMark( rPaM, rName,
- IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK );
+ IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK,
+ sw::mark::InsertMode::New);
sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
if (pFieldMark)
pFieldMark->SetFieldname( rType );
@@ -518,14 +521,15 @@ namespace sw { namespace mark
if(ppExistingMark != m_vBookmarks.end())
return ppExistingMark->get();
const SwPaM aPaM(aPos);
- return makeMark(aPaM, OUString(), eType);
+ return makeMark(aPaM, OUString(), eType, sw::mark::InsertMode::New);
}
sw::mark::IMark* MarkManager::makeAnnotationMark(
const SwPaM& rPaM,
const OUString& rName )
{
- return makeMark( rPaM, rName, IDocumentMarkAccess::MarkType::ANNOTATIONMARK );
+ return makeMark(rPaM, rName, IDocumentMarkAccess::MarkType::ANNOTATIONMARK,
+ sw::mark::InsertMode::New);
}
void MarkManager::repositionMark(
@@ -1289,7 +1293,9 @@ void SaveBookmark::SetInDoc(
if(!aPam.HasMark()
|| CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true))
{
- ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, m_eOrigBkmType));
+ ::sw::mark::IBookmark* const pBookmark = dynamic_cast<::sw::mark::IBookmark*>(
+ pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName,
+ m_eOrigBkmType, sw::mark::InsertMode::New));
if(pBookmark)
{
pBookmark->SetKeyCode(m_aCode);
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 093e11855bcb..ecfbd0975017 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -35,7 +35,9 @@ namespace sw {
public:
MarkManager(/*[in/out]*/ SwDoc& rDoc);
// IDocumentMarkAccess
- virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const OUString& rName, IDocumentMarkAccess::MarkType eMark) override;
+ virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
+ const OUString& rName, IDocumentMarkAccess::MarkType eMark,
+ sw::mark::InsertMode eMode) override;
virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
const OUString& rName,
diff --git a/sw/source/core/inc/annotationmark.hxx b/sw/source/core/inc/annotationmark.hxx
index a6075ae26017..c4d164ed5158 100644
--- a/sw/source/core/inc/annotationmark.hxx
+++ b/sw/source/core/inc/annotationmark.hxx
@@ -36,7 +36,7 @@ namespace sw { namespace mark
virtual ~AnnotationMark() override;
- virtual void InitDoc(SwDoc* const io_Doc) override;
+ virtual void InitDoc(SwDoc* const io_Doc, sw::mark::InsertMode eMode) override;
const SwFormatField* GetAnnotationFormatField() const;
};
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 6e1866002f0f..42323e1f6222 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -95,7 +95,7 @@ namespace sw {
m_pPos1.swap(m_pPos2);
}
- virtual void InitDoc(SwDoc* const)
+ virtual void InitDoc(SwDoc* const, sw::mark::InsertMode)
{
}
@@ -163,7 +163,7 @@ namespace sw {
const vcl::KeyCode& rCode,
const OUString& rName,
const OUString& rShortName);
- virtual void InitDoc(SwDoc* const io_Doc) override;
+ virtual void InitDoc(SwDoc* const io_Doc, sw::mark::InsertMode eMode) override;
virtual void DeregisterFromDoc(SwDoc* const io_pDoc) override;
@@ -231,7 +231,7 @@ namespace sw {
{
public:
TextFieldmark(const SwPaM& rPaM);
- virtual void InitDoc(SwDoc* const io_pDoc) override;
+ virtual void InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode eMode) override;
virtual void ReleaseDoc(SwDoc* const pDoc) override;
};
@@ -241,7 +241,7 @@ namespace sw {
{
public:
CheckboxFieldmark(const SwPaM& rPaM);
- virtual void InitDoc(SwDoc* const io_pDoc) override;
+ virtual void InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode eMode) override;
virtual void ReleaseDoc(SwDoc* const pDoc) override;
bool IsChecked() const override;
void SetChecked(bool checked) override;
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 3e553387dfe0..ad4fcaa9f525 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -648,7 +648,8 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
pMarkAccess->deleteMark( pMark );
}
::sw::mark::IBookmark* const pBookmark =
- dynamic_cast< ::sw::mark::IBookmark* >( pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType) );
+ dynamic_cast<::sw::mark::IBookmark*>(
+ pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType, sw::mark::InsertMode::New));
if ( pBookmark != nullptr )
{
pBookmark->SetKeyCode(m_aKeycode);
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index feca7d3cdee8..7ae5136f4acf 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -244,7 +244,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
m_pImpl->registerInMark(*this,
m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark(
- aPam, m_pImpl->m_sMarkName, eType));
+ aPam, m_pImpl->m_sMarkName, eType, ::sw::mark::InsertMode::New));
// #i81002#
// Check, if bookmark has been created.
// E.g., the creation of a cross-reference bookmark is suppress,
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index da92fcaa2ad5..b0d697ea3f10 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -794,7 +794,7 @@ void SwXTextRange::SetPositions(const SwPaM& rPam)
m_pImpl->Invalidate();
IDocumentMarkAccess* const pMA = m_pImpl->m_rDoc.getIDocumentMarkAccess();
m_pImpl->m_pMark = pMA->makeMark(rPam, OUString(),
- IDocumentMarkAccess::MarkType::UNO_BOOKMARK);
+ IDocumentMarkAccess::MarkType::UNO_BOOKMARK, sw::mark::InsertMode::New);
m_pImpl->m_pMark->Add(m_pImpl.get());
}
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e95c8fa7a5a6..fcf7a9731aea 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -615,7 +615,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookmark( aRegion ) )
? IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK
: IDocumentMarkAccess::MarkType::BOOKMARK;
- pDoc->getIDocumentMarkAccess()->makeMark( aRegion, rName, eBookmarkType );
+ pDoc->getIDocumentMarkAccess()->makeMark(aRegion, rName, eBookmarkType, sw::mark::InsertMode::New);
}
}
break;
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 7d81018855be..058c39ad0b89 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2815,7 +2815,8 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
const ::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark(
*pAttrPam,
sName,
- IDocumentMarkAccess::MarkType::BOOKMARK );
+ IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
// jump to bookmark
if( JUMPTO_MARK == m_eJumpTo && pNewMark->GetName() == m_sJmpMark )
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index d469691cbe23..2c116217ba5d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1490,7 +1490,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
SwDocMergeInfo aMergeInfo;
// Name of the mark is actually irrelevant, UNO bookmarks have internals names.
aMergeInfo.startPageInTarget = pTargetDoc->getIDocumentMarkAccess()->makeMark(
- appendedDocStart, "", IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
+ appendedDocStart, "", IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
+ ::sw::mark::InsertMode::New);
aMergeInfo.nDBRow = nStartRow;
rMergeDescriptor.pMailMergeConfigItem->AddMergedDocument( aMergeInfo );
}
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 5e58c085519c..11bf214019f7 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3773,7 +3773,8 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark(
aPaM,
sMarkName,
- IDocumentMarkAccess::MarkType::BOOKMARK);
+ IDocumentMarkAccess::MarkType::BOOKMARK,
+ ::sw::mark::InsertMode::New);
rServerObject.SetDdeBookmark(*pNewMark);
}