From 44cb1d16f265565d6f77184f7c0d828d3d278dbf Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 24 Jan 2017 09:09:41 +0100 Subject: [PATCH] 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 \[a-z] " case. Change-Id: Ibd094e72be4e179c779a79a75769b599d4d9bba8 Reviewed-on: https://gerrit.libreoffice.org/33489 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/ww8export/data/tdf104334.doc | Bin 0 -> 25600 bytes sw/qa/extras/ww8export/ww8export2.cxx | 8 ++++++++ sw/source/filter/ww8/ww8par5.cxx | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 sw/qa/extras/ww8export/data/tdf104334.doc diff --git a/sw/qa/extras/ww8export/data/tdf104334.doc b/sw/qa/extras/ww8export/data/tdf104334.doc new file mode 100644 index 0000000000000000000000000000000000000000..877caff0c5815f8a4c8f8fa8852a4b7152027db4 GIT binary patch literal 25600 zcmeHP30#fY`#*Q9+nzR2xRPXR5tVF3NJLV0>9*<8rb3J*lqF+iU#6i+mO(UQ9eb8A zwlEZC$U64PGGdbc-{-x(x;4to{D1$?=RfniC(nJ(`hCuM&Uv5ryw7=G`RD5tef@3y zTdZ2>%tY*cxfat<$rm6_#05jf>=B{#`||Q~WhP^Ys>44>17+x|4JJM)P(4t6kOjyR)Br?yjlgA~#vm(D z6Oc8iDTvC6Y!Pn`Y5{5qY6WTyvIFsTh^xcj*MJ|3!CwOAqC1NQk7E;|-9I19uwr=W zWD7L3gk0mpN{AjxR`u6`lFDjq5TwVkQ0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export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -74,6 +74,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 cb14e24c7b2e..5d9606392d3d 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -914,6 +914,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