summaryrefslogtreecommitdiff
path: root/editeng
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 /editeng
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 'editeng')
-rw-r--r--editeng/source/rtf/svxrtf.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 56ef7368e8fc..ec633c8c3fa3 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -300,6 +300,7 @@ void SvxRTFParser::ReadStyleTable()
{
int nToken, bSaveChkStyleAttr = bChkStyleAttr ? 1 : 0;
sal_uInt16 nStyleNo = 0;
+ bool bHasStyleNo = false;
int _nOpenBrakets = 1; // the first was already detected earlier!!
SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
pStyle->aAttrSet.Put( GetRTFDefaults() );
@@ -340,12 +341,16 @@ void SvxRTFParser::ReadStyleTable()
case RTF_SNEXT: pStyle->nNext = sal_uInt16(nTokenValue); break;
case RTF_OUTLINELEVEL:
case RTF_SOUTLVL: pStyle->nOutlineNo = sal_uInt8(nTokenValue); break;
- case RTF_S: nStyleNo = (short)nTokenValue; break;
+ case RTF_S: nStyleNo = (short)nTokenValue;
+ bHasStyleNo = true;
+ break;
case RTF_CS: nStyleNo = (short)nTokenValue;
+ bHasStyleNo = true;
pStyle->bIsCharFmt = true;
break;
case RTF_TEXTTOKEN:
+ if (bHasStyleNo)
{
pStyle->sName = DelCharAtEnd( aToken, ';' );
@@ -358,6 +363,7 @@ void SvxRTFParser::ReadStyleTable()
pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
pStyle->aAttrSet.Put( GetRTFDefaults() );
nStyleNo = 0;
+ bHasStyleNo = false;
}
break;
default: