diff options
author | Justin Luth <justin.luth@collabora.com> | 2023-01-19 15:28:14 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-01-20 20:22:13 +0000 |
commit | c6cf80af60d23fc52502f88f24dc23ad85462e77 (patch) | |
tree | 82f3de2559c53e3eabd5811cd7f74742b4f083b9 /writerfilter/source | |
parent | de1d75a0cd25f239cdc751dec75c9019fbcabd8e (diff) |
related tdf#125038 FORMTEXT/REF:fix spurious text outside IF field
This builds on top of commit d09336fbdceaafd9320466b660a2b32a07dcc16a
(tdf#125038 DOCX import: fix lost MERGEFIELD result inside an IF field,
2019-10-31), and extends it for FORMTEXT and REF.
With this, all unexpected content is gone from the paragraph.
Actually this is all somewhat irrelevant since DOCX doesn't import
IF fields at all anyway - they are just left blank.
So AFAICS, we should ALWAYS return false at this point.
I also took the opportunity to be able to remove multiple
spaces from the front of the command.
Change-Id: Ib7e7971bce86bdda545166e398fbb620ca515b91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145832
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0b73640fd57f..b849f453034c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -264,10 +264,8 @@ static bool IsFieldNestingAllowed(const FieldContextPtr& pOuter, const FieldCont OUString aCommand = pOuter->GetCommand(); // Ignore leading space before the field name, but don't accept IFF when we check for IF. - if (!aCommand.isEmpty() && aCommand[0] == ' ') - { + while (aCommand.getLength() > 3 && aCommand[0] == ' ') aCommand = aCommand.subView(1); - } if (aCommand.startsWith("IF ")) { @@ -288,10 +286,13 @@ static bool IsFieldNestingAllowed(const FieldContextPtr& pOuter, const FieldCont switch (*pInner->GetFieldId()) { case FIELD_DOCVARIABLE: + case FIELD_FORMTEXT: case FIELD_FORMULA: case FIELD_IF: case FIELD_MERGEFIELD: + case FIELD_REF: { + // LO does not currently know how to evaluate these as conditions or results return false; } default: |