summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-01-24 09:09:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-01-25 12:50:49 +0000
commita235ea7a376959a462a285a2ad3cb7b74afe532f (patch)
tree8016efb7e5ca72afe27c606186be2349a9bbc657
parent6c6528828c5ca1da6a1ccc98d1aa5b42d84152a4 (diff)
tdf#104334 DOC import: don't map STYLREF with switches to SwChapterField
Commit d635b351849b8b576c907abf22500d0fa89ab54f (tdf#99100 DOC import: handle subset of STYLEREF natively, 2016-04-06) started to import the STYLEREF field code as SwChapterField in case it had \[a-z] switches after the field argument. The bugdoc has a \s switch, which is not documented in ISO/IEC 29500-1:2012 17.16.5.59 "STYLEREF", nor is really clear what it would do. The original use-case was for the " STYLEREF 1 \* MERGEFORMAT " syntax, so just keep using fieldmarks for the " STYLEREF <field argument> \[a-z] " case. (cherry picked from commit 44cb1d16f265565d6f77184f7c0d828d3d278dbf) Change-Id: Ibd094e72be4e179c779a79a75769b599d4d9bba8 Reviewed-on: https://gerrit.libreoffice.org/33493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/qa/extras/ww8export/data/tdf104334.docbin0 -> 25600 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx8
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf104334.doc b/sw/qa/extras/ww8export/data/tdf104334.doc
new file mode 100644
index 000000000000..877caff0c581
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104334.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index f2f5aa7cd991..bf6b36feef99 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -57,6 +57,14 @@ DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
}
}
+DECLARE_WW8EXPORT_TEST(testTdf104334, "tdf104334.doc")
+{
+ // This failed with a container::NoSuchElementException: STYLEREF was
+ // mapped to SwChapterField, and the field result was "This is a Heading 1"
+ // instead of just "1".
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), getRun(getParagraph(2), 3)->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index c9a0dc5c9ecb..e8b6307ba21e 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -915,6 +915,14 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
if (nRet == -2 && !aReadParam.GetResult().isEmpty())
// Single numeric argument: this can be handled by SwChapterField.
bHasHandler = rtl::isAsciiDigit(aReadParam.GetResult()[0]);
+
+ if (bHasHandler)
+ {
+ nRet = aReadParam.SkipToNextToken();
+ // Handle using SwChapterField only in case there is no \[a-z]
+ // switch after the field argument.
+ bHasHandler = nRet < 0 || nRet == '*';
+ }
}
// keine Routine vorhanden