Kaydet (Commit) e93f0852 authored tarafından Michael Stahl's avatar Michael Stahl

fdo#78502: writerfilter: RTF import: handle \u keyword inside levelnumbers

The ";" terminates an entry and shall not be inserted as text,
even if some over-engineered producer encodes it as {\uc1 \u59 ?}.

Also, remove the special-casing of the \leveltext destination, since the
bugdoc does contain \uc inside it and it's not obvious why that should
be ignored.

Change-Id: I1e19c9df39597cb1b22bbda97853c829d7812e29
üst b94bd40b
{\rtf \ansi \ansicpg0 \deff0
{\fonttbl {\f0 \froman \fcharset0 \fprq2 Times New Roman{\*\falt Times New Roman};}{\f1 \fnil \fcharset134 \fprq0 {\uc1 \u23435 ?}{\uc1 \u20307 ?}{\*\falt {\uc1 \u23435 ?}{\uc1 \u20307 ?}};}{\f2 \froman \fcharset0 \fprq0 Symbol{\*\falt Symbol};}}
{\*\listtable
{\list \listtemplateid300746803 \listhybrid
{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 {\leveltext {\uc1 \u1 ?}{\uc1 \u61623 ?}{\uc1 \u59 ?}}{\levelnumbers {\uc1 \u59 ?}}\fs20 \dbch \af1 \hich \af2 \loch \f2 \li720 \lin720 \fi-360 \jclisttab \tx720 }
{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 {\leveltext {\uc1 \u1 ?}{\uc1 \u61623 ?}{\uc1 \u59 ?}}{\levelnumbers {\uc1 \u59 ?}}\fs20 \dbch \af1 \hich \af2 \loch \f2 \li1440 \lin1440 \fi-360 \jclisttab \tx1440 }
{\listlevel \levelnfc23 \levelnfcn23 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 {\leveltext {\uc1 \u1 ?}{\uc1 \u61623 ?}{\uc1 \u59 ?}}{\levelnumbers {\uc1 \u59 ?}}\fs20 \dbch \af1 \hich \af2 \loch \f2 \li2160 \lin2160 \fi-360 \jclisttab \tx2160 }
{\listname ;}
\listid297210762 }
}
\par }
...@@ -1041,6 +1041,12 @@ DECLARE_RTFIMPORT_TEST(testFdo58646line, "fdo58646line.rtf") ...@@ -1041,6 +1041,12 @@ DECLARE_RTFIMPORT_TEST(testFdo58646line, "fdo58646line.rtf")
getParagraph(1, "foo\nbar"); getParagraph(1, "foo\nbar");
} }
DECLARE_RTFIMPORT_TEST(testFdo78502, "fdo78502.rtf")
{
// ";" separators were inserted as text
getParagraph(1, "");
}
DECLARE_RTFIMPORT_TEST(testFdo58646, "fdo58646.rtf") DECLARE_RTFIMPORT_TEST(testFdo58646, "fdo58646.rtf")
{ {
// Page break was ignored inside a continuous section, on title page. // Page break was ignored inside a continuous section, on title page.
......
...@@ -3810,9 +3810,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -3810,9 +3810,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// static_cast() will do the right thing. // static_cast() will do the right thing.
if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16)) if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
{ {
m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam)); if (m_aStates.top().nDestinationState == DESTINATION_LEVELNUMBERS)
if (m_aStates.top().nDestinationState != DESTINATION_LEVELTEXT) {
m_aStates.top().nCharsToSkip = m_aStates.top().nUc; if (nParam != ';')
m_aStates.top().aLevelNumbers.push_back(sal_Int32(nParam));
}
else
m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam));
m_aStates.top().nCharsToSkip = m_aStates.top().nUc;
} }
break; break;
case RTF_LEVELFOLLOW: case RTF_LEVELFOLLOW:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment