diff options
author | Mark Hung <marklh9@gmail.com> | 2014-11-14 18:03:20 -0800 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-16 15:42:13 +0100 |
commit | 93b9a2381f2fc93f47a5b36c181741cc5f88e6fc (patch) | |
tree | 31ede5e03c3e3dd852817571fc68e4158387fbae /writerfilter | |
parent | 19866932ccda9b143c1c4cd66cf3dbaac7e607ad (diff) |
Improve rtf import filter to handle Chinese suffixes of numbered lists.
Currently rtftok doesn't handle multibyte string as destination
text very well. For example, RTF files created by MSO 2010 Traditional
Chinese version use CP950 (aka BIG5) for unicode to ansi conversion.
When a Chinsese numbered list was picked, the Chinese dot ( unicode
0x3001, big5 0xa142 ), was used by default as a list number suffix.
However when it is imported , only a single B (0x42) were left.
The theory of the patch is to collect both hex string and normal
character with m_aHexBuffer, and convert it into OUString as late
as possible. It allows prefixes and suffixes to be imported from
RTF files created by MSO 2010 TC correctly.
Reviewed on:
https://gerrit.libreoffice.org/12435
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
Change-Id: I63062da39bf36ea27ec11e5d0eb1d1abf5018d96
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e51e23376262..a7045db36b39 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1005,8 +1005,6 @@ int RTFDocumentImpl::resolveChars(char ch) return 0; } - if (m_aStates.top().nInternalState != INTERNAL_HEX) - checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true); OStringBuffer aBuf; @@ -1096,9 +1094,10 @@ int RTFDocumentImpl::resolveChars(char ch) // set components back to zero m_aStates.top().aCurrentColor = RTFColorTableEntry(); } - else if (!aOUStr.isEmpty()) - text(aOUStr); + else if (!aStr.isEmpty()) + m_aHexBuffer.append(aStr); + checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true); return 0; } |