sw/qa/core/data/rtf/pass/ooo121333-1.rtf | 43 +++++++++++++++++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 13 ++----- 2 files changed, 48 insertions(+), 8 deletions(-)
New commits: commit c51c39ddf6d513afda83d4f15549c6277a0cc211 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Nov 26 12:44:10 2014 +0000 always pass bookmark name through to domainmapper the rtf doc has three bookmark starts but only two matching bookmark ends. The tokenizer has three starts 0, 1, 2, but 0 is missing an end. Without the end of 0, the mapper never inserts an entry for it, so later inserts the start of rtftok index 1 as mapper index 0, and passing the end for a bare "1" cannot be found by index. If we pass the name then it finds it by name as mapper index 0 and all is well. Change-Id: I344db84e4f1c7d55fca59cdfe692080c7d0b8033 (cherry picked from commit 2b54caceab9d975bffa7e24bf732cb877b16632f) Reviewed-on: https://gerrit.libreoffice.org/13133 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/core/data/rtf/pass/ooo121333-1.rtf b/sw/qa/core/data/rtf/pass/ooo121333-1.rtf new file mode 100644 index 0000000..7f3b531 --- /dev/null +++ b/sw/qa/core/data/rtf/pass/ooo121333-1.rtf @@ -0,0 +1,43 @@ +{\rtf1\ansi\deff0\adeflang1025 +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\fswiss\fprq2\fcharset0 Trebuchet MS;}{\f4\fswiss\fprq2\fcharset128 Arial;}{\f5\fswiss\fprq2\fcharset0 Arial Unicode MS;}{\f6\fnil\fprq2\fcharset0 Mangal;}{\f7\fnil\fprq0\fcharset0 Mangal;}} +{\colortbl;\red0\green0\blue0;\red128\green128\blue128;} +{\stylesheet{\s0\snext0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033 Default;} +{\s15\sbasedon0\snext16\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb240\sa120\keepn\ltrpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\loch\f2\fs28\lang1033 Heading;} +{\s16\sbasedon0\snext16\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af0\loch\f0\fs24\lang1033 Text body;} +{\s17\sbasedon16\snext17\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb0\sa120\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af7\loch\f0\fs24\lang1033 List;} +{\s18\sbasedon0\snext18\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\sb120\sa120\ltrpar\cf0\i\kerning1\hich\af0\langfe2052\dbch\af7\ai\loch\f0\fs24\lang1033 Caption;} +{\s19\sbasedon0\snext19\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\ltrpar\cf0\kerning1\hich\af0\langfe2052\dbch\af7\loch\f0\fs24\lang1033 Index;} +}{\info{\author Lisa Stroyan}{\creatim\yr2012\mo11\dy10\hr15\min44}{\revtim\yr2012\mo11\dy10\hr16\min16}{\printim\yr0\mo0\dy0\hr0\min0}{\comment OpenOffice.org}{\vern3410}}\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709\deftab709 + +{\*\pgdsctbl +{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Default;}} +\formshade{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\pgndec\pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch +\'93}{\rtlch \ltrch\loch +test\'94} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch +} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\f3 +\'93}{\rtlch \ltrch\loch\loch\f4 +Another }{\rtlch \ltrch\dbch\loch\f4 +\u21520\'3f}{\rtlch \ltrch\loch\loch\f4 +oo}{\rtlch \ltrch\loch\loch\f3 + test\'94} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch +} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{{\*\bkmkstart __DdeLink__132_187012832}\rtlch \ltrch\loch\loch\f3 +Created (or opened) testoocharacters.odt file with angled double quotes, using both Times and Trebuchet. Saved as RTF, closed, and reopened.} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\loch\f3 +File still looks fine. } +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\loch\f3 +} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\loch\f3 +Added <\'93foo\'94> (without angle brackets) above. }{{\*\bkmkstart __DdeLink__101_1367934706}{\*\bkmkend __DdeLink__101_1367934706}\rtlch \ltrch\loch\loch\f3 +Save/close/reopen. } +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\loch\f3 +Looks fine. Can edit as long as you don't change fonts. } +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{\rtlch \ltrch\loch\loch\f3 +} +\par \pard\plain \s0\ql{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\aspalpha\ltrpar\nowidctlpar\cf0\kerning1\hich\af5\langfe2052\dbch\af6\afs24\lang1081\loch\f0\fs24\lang1033{{\*\bkmkstart __DdeLink__132_187012832}\rtlch \ltrch\loch\loch\f3{\*\bkmkend __DdeLink__132_187012832} +Changed <Another \'93foo\'94 > to Arial. Save/close/reopen. Weird characters appear around \'93foo\'94} +\par } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 859ca82..5bab89b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -170,12 +170,6 @@ static writerfilter::Reference<Properties>::Pointer_t lcl_getBookmarkProperties( return writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAttributes)); } -static writerfilter::Reference<Properties>::Pointer_t lcl_getBookmarkProperties(int nPos) -{ - OUString aStr; - return lcl_getBookmarkProperties(nPos, aStr); -} - static const char* lcl_RtfToString(RTFKeyword nKeyword) { for (int i = 0; i < nRTFControlWords; i++) @@ -5191,10 +5185,13 @@ int RTFDocumentImpl::popState() } break; case DESTINATION_BOOKMARKEND: + { if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) break; // not for nested group - Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().pDestinationText->makeStringAndClear()])); - break; + OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)); + } + break; case DESTINATION_FORMFIELDNAME: { if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits