summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2015-08-30 16:08:20 +0800
committerNorbert Thiebaud <nthiebaud@gmail.com>2015-11-02 11:08:46 +0000
commit52f3eb47aa42bd1a2a61088706cd3c729e274fc0 (patch)
treed1c7f3d6b57935112f8d079e9553844874ca1b83 /svtools
parent6cdf7e00da6c3fb7698afcc41c166f1d9d7b33b8 (diff)
Fix tdf#93438 Impress generate abnormal style when copy-pasting
from Writer with Chinese UI. When user configure UI language as Chinese, style names are also translated. However when Copy-pasting from Writer to Impress ( select RTF fromat with paste-special), Chinese (unicode) style names are borken into multiparts, where some of them are empty string. Neither deleting the abnormal style nor saving the file can be achieved. The only remedy is to remove style with emtpy name with macro. With this patch: 1) Catch NoSuchElementException and ignores it, so user still has chance saving file. 2) Make sure style has valid number before inserting it. 3) Prevent text breaking into multiple tokens by handling ucN in ScanText(). Change-Id: I417f70b81c23ac63c175cc13c548068873d13a38 Reviewed-on: https://gerrit.libreoffice.org/18148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/19685
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svrtf/parrtf.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index fc98b8781e60..e7be520573c0 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -431,6 +431,24 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
aToken = sSave;
bRTF_InTextRead = false;
}
+ else if ( 'c' == nNextCh )
+ {
+ // Prevent text breaking into multiple tokens.
+ rInput.SeekRel( 2 );
+ nNextCh = GetNextChar();
+ if (RTF_ISDIGIT( nNextCh ))
+ {
+ sal_uInt8 nNewOverread = 0 ;
+ do {
+ nNewOverread *= 10;
+ nNewOverread += nNextCh - '0';
+ nNextCh = GetNextChar();
+ } while ( RTF_ISDIGIT( nNextCh ) );
+ nUCharOverread = nNewOverread;
+ aParserStates.top().nUCharOverread = nNewOverread;
+ }
+ bNextCh = 0x20 == nNextCh;
+ }
else
{
nNextCh = '\\';
@@ -448,8 +466,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
}
break;
- case sal_Unicode(EOF):
- eState = SVPAR_ERROR;
+ case sal_Unicode(EOF): eState = SVPAR_ERROR;
// continue
case '{':
case '}':