summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-11-13 09:45:47 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-11-13 14:54:36 +0100
commit65d6173152deab49f9c9ed138f6d9fa56008b800 (patch)
tree641247c55616d5eb89bb1bbbea30340ac406d824 /writerfilter/source/dmapper
parentdd2532203b7928d5f06de96da7f15d45d9c38d80 (diff)
DOCX import: lost cached result of fields: fix leading whitespace
" IF " and "IF " is the same, but "IFF " is something different. Change-Id: Ieb2d128d28ed3daa3df73128804bcc40dda9878d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105783 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0a7ae26d937e..d1d0309a6b83 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -206,7 +206,15 @@ static FieldContextPtr GetParentFieldContext(const std::deque<FieldContextPtr>&
static bool IsFieldNestingAllowed(const FieldContextPtr& pOuter, const FieldContextPtr& pInner)
{
std::optional<FieldId> oOuterFieldId = pOuter->GetFieldId();
- if (!oOuterFieldId && pOuter->GetCommand().startsWith(" IF "))
+ 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] == ' ')
+ {
+ aCommand = aCommand.subView(1);
+ }
+
+ if (!oOuterFieldId && aCommand.startsWith("IF "))
{
// This will be FIELD_IF once the command is closed.
oOuterFieldId = FIELD_IF;