diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-09-27 15:55:43 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-09-30 12:16:52 +0200 |
commit | fb741b48a4d11c1f91702a73ef600c7df976a298 (patch) | |
tree | 3359e5c553d6c332afa4f04a7ee24336ecbc35b6 /sw/source/core/doc/docbm.cxx | |
parent | 149f28e9a5d66db18ffb36547b2ba394c303fc4d (diff) |
tdf#112679 sw: fix copying of fieldmarks
Aha, now we know that the reason for the defensive programming
in lcl_AssureFieldMarksSet() was that there are actually 2
different use-cases for it: usually a new mark is inserted,
so there are no dummy characters and they must be inserted.
However when copying text, the dummy characters are copied too,
so they must not be inserted, or we get duplicate fieldmarks.
This also reverts commit d4036d3a89b65a4912f62e3930eb1a31cd90a16b
which fixed the problem only for CHECKBOX_FIELDMARK in a
different way.
(regression from bb069fe7b8b6a24f9ff4df4c7052961e17ea3a8c)
(cherry picked from commit 421a23bb36bbf51edfabc58b7d2cd28ad37719d0)
Silence --disable-assert-always-abort warnings
(cherry picked from commit 7e76b983301b02dd7020636905b764b981b1fff0)
loplugin:constparams
(cherry picked from commit 14e2a82002042a3fe4d8866b635ee84a436a7a7c)
Change-Id: I3c99b8c6d720951655198e682018794337859373
Reviewed-on: https://gerrit.libreoffice.org/42868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
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); |