diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-10-11 14:57:04 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-10-23 13:00:51 +0200 |
commit | bc5e4104e281b89c08df102851e5693f35772c40 (patch) | |
tree | 45370b9e55cabb3a3563d45a69663655b4898c04 /sw/source/core | |
parent | 7f2e61f884949ab27bcb7e1a02ece9a5cb4354b9 (diff) |
sw: DateFieldmark separator position: hack to put it at the start
DateFieldmark isn't created for an actual field with a command but for a
SDT (Date Picker Content Control), so it's somewhat pointless to insert a
separator for it in the first place; but better have an invariant that
every pair of FIELDSTART/FIELDEND has a FIELDSEP.
TODO: maybe add another pair of distinct START/END for this thing.
Change-Id: I37301b578c668ecbf9408a48c227db5991c33f9e
Reviewed-on: https://gerrit.libreoffice.org/80675
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 5 |
2 files changed, 4 insertions, 11 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index ba43b2158bd4..713d36d2d63d 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -704,13 +704,8 @@ namespace sw { namespace mark { const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode(); SwPosition const sepPos(sw::mark::FindFieldSep(*this)); -#if 0 const sal_Int32 nStart(sepPos.nContent.GetIndex()); const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex()); -#else - const sal_Int32 nStart(GetMarkStart().nContent.GetIndex()); - const sal_Int32 nEnd (sepPos.nContent.GetIndex() + 1); -#endif OUString sContent; if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() && @@ -726,13 +721,8 @@ namespace sw { namespace mark const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode(); SwPosition const sepPos(sw::mark::FindFieldSep(*this)); -#if 0 const sal_Int32 nStart(sepPos.nContent.GetIndex()); const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex()); -#else - const sal_Int32 nStart(GetMarkStart().nContent.GetIndex()); - const sal_Int32 nEnd (sepPos.nContent.GetIndex() + 1); -#endif if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() && nEnd > nStart + 2) diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 4f13bea2d79f..88a6019251b4 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1341,7 +1341,10 @@ namespace sw { namespace mark SwPosition aPos (aPaM.GetPoint()->nNode, aPaM.GetPoint()->nContent); SwPaM aNewPaM(pFieldmark->GetMarkStart(), pFieldmark->GetMarkEnd()); deleteFieldmarkAt(aPos); - return makeFieldBookmark(aNewPaM, sName, rNewType); + // HACK: hard-code the separator position here at the start because + // writerfilter put it in the wrong place (at the end) on attach() + SwPosition const sepPos(*aNewPaM.Start()); + return makeFieldBookmark(aNewPaM, sName, rNewType, &sepPos); } return nullptr; } |