summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-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
15 files changed, 82 insertions, 45 deletions
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);
}