diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-12-17 18:02:34 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-12-18 19:21:38 +0100 |
commit | e6529220107660dcbdb8bddfba394568740e2082 (patch) | |
tree | 3832126b337b53246b322eb3fe4e3d970ac524eb /sw/source/filter/basflt | |
parent | aa0ef3859d88419477572aaa2bf351dec77807c4 (diff) |
ofz#18534 sw: WW8 import: avoid creating redlines that overlap...
...with fieldmarks, as the editing operations already do.
This was triggering ~SwIndexReg assert when creating this redline:
$4 = " \b\nfür \a\003 \b\nKlasse \a\003 \b\t\tSchuljahr \a\003 \b\t\a\003 \b. Halbjahr\nLeistungsbeurteilung lt. Konferenzbeschluss vom "
Change-Id: I904be93e044c4b98bb8c806357ed061692303c7a
Reviewed-on: https://gerrit.libreoffice.org/85149
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 9e63d328691014bc97f6b66b708ed9dec53618e6)
Reviewed-on: https://gerrit.libreoffice.org/85370
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/filter/basflt')
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 950a3b0c2029..b95c9fa232ae 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -66,6 +66,7 @@ #include <swtable.hxx> #include <tox.hxx> #include <expfld.hxx> +#include <bookmrk.hxx> #include <section.hxx> #include <tblsel.hxx> #include <pagedesc.hxx> @@ -131,7 +132,7 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos) m_aPtPos.SetPos(rEndPos); } -bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, +bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, RegionMode const eCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd, sal_uInt16 nWhich) { @@ -180,16 +181,22 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode, rRegion.End()->nNode, true ), "attribute or similar crosses section-boundaries" ); - if( bCheck ) - return CheckNodesRange( rRegion.Start()->nNode, - rRegion.End()->nNode, true ); - else - return true; + bool bRet = true; + if (eCheck & RegionMode::CheckNodes) + { + bRet &= CheckNodesRange(rRegion.Start()->nNode, + rRegion.End()->nNode, true); + } + if (eCheck & RegionMode::CheckFieldmark) + { + bRet &= !sw::mark::IsFieldmarkOverlap(rRegion); + } + return bRet; } -bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const +bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, RegionMode eCheck) const { - return MakeRegion(pDoc, rRegion, bCheck, m_aMkPos, m_aPtPos, bIsParaEnd, + return MakeRegion(pDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, bIsParaEnd, pAttr->Which()); } @@ -489,7 +496,7 @@ static bool MakePoint(const SwFltStackEntry& rEntry, SwDoc* pDoc, static bool MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc* pDoc, SwPaM& rRegion ) { - if (rEntry.MakeRegion(pDoc, rRegion, true/*bCheck*/ )) + if (rEntry.MakeRegion(pDoc, rRegion, SwFltStackEntry::RegionMode::CheckNodes)) { if (rRegion.GetPoint()->nNode.GetNode().FindTableBoxStartNode() != rRegion.GetMark()->nNode.GetNode().FindTableBoxStartNode()) @@ -591,7 +598,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwNumRule* pNumRule = pDoc->FindNumRulePtr( rNumNm ); if( pNumRule ) { - if( rEntry.MakeRegion(pDoc, aRegion, true)) + if (rEntry.MakeRegion(pDoc, aRegion, SwFltStackEntry::RegionMode::CheckNodes)) { SwNodeIndex aTmpStart( aRegion.Start()->nNode ); SwNodeIndex aTmpEnd( aTmpStart ); @@ -757,7 +764,8 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, break; case RES_FLTR_REDLINE: { - if (rEntry.MakeRegion(pDoc, aRegion, true)) + if (rEntry.MakeRegion(pDoc, aRegion, + SwFltStackEntry::RegionMode::CheckNodes|SwFltStackEntry::RegionMode::CheckFieldmark)) { pDoc->getIDocumentRedlineAccess().SetRedlineFlags( RedlineFlags::On | RedlineFlags::ShowInsert @@ -791,7 +799,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, { rEntry.SetIsParaEnd( IsParaEndInCPs(nStart,nEnd,bHasSdOD) ); } - if (rEntry.MakeRegion(pDoc, aRegion, false)) + if (rEntry.MakeRegion(pDoc, aRegion, SwFltStackEntry::RegionMode::NoCheck)) { if (rEntry.IsParaEnd()) { |