[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - 2 commits - sc/source sw/qa writerfilter/source
Andras Timar
andras.timar at collabora.com
Mon Nov 24 08:34:54 PST 2014
sc/source/filter/lotus/lotform.cxx | 46 +++++++++++++++++++------
sw/qa/extras/rtfimport/data/fdo85889-mac.rtf | 3 +
sw/qa/extras/rtfimport/data/fdo85889-pc.rtf | 3 +
sw/qa/extras/rtfimport/data/fdo85889-pca.rtf | 3 +
sw/qa/extras/rtfimport/rtfimport.cxx | 26 ++++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 ++++++
6 files changed, 82 insertions(+), 11 deletions(-)
New commits:
commit ff56b125ecf8c7781fe38047cf8cfbf3e52c37d0
Author: Andras Timar <andras.timar at collabora.com>
Date: Mon Nov 24 16:04:20 2014 +0100
import @TERM and @CTERM functions from Lotus 1-2-3 files (related: fdo#86241)
Change-Id: I864ad87aa0455c323a5235fa1230d3f2ac3ffbb4
(cherry picked from commit 70ae5bb4182a99c17da8eb32b36baec3e7a48723)
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 3e1fe49..7c6fc45 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -137,6 +137,30 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri
eParam[ 2 ] = n0Token; // -> 2. as Default
}
break;
+ case ocZZR:
+ {
+ OSL_ENSURE( nAnz == 3,
+ "*LotusToSc::DoFunc(): TERM() or CTERM() need 3 parameters!" );
+ nAnz = 4;
+ if ( OString(pExtString) == "TERM" )
+ {
+ // @TERM(pmt,int,fv) -> NPER(int,-pmt,pv=0,fv)
+ NegToken( eParam[ 2 ] );
+ eParam[ 3 ] = eParam[ 1 ];
+ eParam[ 1 ] = aPool.Store( 0.0 );
+ }
+ else //CTERM()
+ {
+ // @CTERM(int,fv,pv) -> NPER(int,pmt=0,-pv,fv)
+ NegToken( eParam[ 0 ] );
+ nMerk0 = eParam[ 1 ];
+ eParam[ 1 ] = eParam[ 0 ];
+ eParam[ 0 ] = nMerk0;
+ eParam[ 3 ] = eParam[ 2 ];
+ eParam[ 2 ] = aPool.Store( 0.0 );
+ }
+ }
+ break;
default:;
}
@@ -393,7 +417,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
eType = ( pIndexToType )( nOc );
eOc = ( pIndexToToken)( nOc );
- if( eOc == ocNoName )
+ if( eOc == ocNoName || eOc == ocZZR )
pExtName = GetAddInName( nOc );
switch( eType )
@@ -742,8 +766,8 @@ FUNC_TYPE LotusToSc::IndexToType( sal_uInt8 nIndex )
FT_NotImpl, // 114 Call()
FT_FuncFix1, // 115 @@()
FT_FuncFix3, // 116 Rate()
- FT_FuncFix1, // 117 Term()
- FT_FuncFix1, // 118 Cterm()
+ FT_FuncFix3, // 117 Term()
+ FT_FuncFix3, // 118 Cterm()
FT_FuncFix3, // 119 Sln()
FT_FuncFix4, // 120 Syd(), Soy()
FT_FuncFix4, // 121 Ddb()
@@ -1006,8 +1030,8 @@ DefTokenId LotusToSc::IndexToToken( sal_uInt8 nIndex )
ocNoName, // 114 Call()
ocIndirect, // 115 @@()
ocZins, // 116 Rate()
- ocNoName, // 117 Term()
- ocNoName, // 118 Cterm()
+ ocZZR, // 117 Term()
+ ocZZR, // 118 Cterm()
ocLIA, // 119 Sln()
ocDIA, // 120 Syd(), Soy()
ocGDA, // 121 Ddb()
@@ -1271,8 +1295,8 @@ FUNC_TYPE LotusToSc::IndexToTypeWK123( sal_uInt8 nIndex )
FT_NotImpl, // 114 App <- change in name
FT_FuncFix1, // 115 @@() <- new
FT_FuncFix3, // 116 Rate() <- new
- FT_FuncFix3, // 117 Term() <- change in quantity
- FT_FuncFix3, // 118 Cterm() <- change in quantity
+ FT_FuncFix3, // 117 Term()
+ FT_FuncFix3, // 118 Cterm()
FT_FuncFix3, // 119 Sln() <- new
FT_FuncFix4, // 120 Syd() <- new
FT_FuncFix4, // 121 Ddb() <- new
@@ -1535,8 +1559,8 @@ DefTokenId LotusToSc::IndexToTokenWK123( sal_uInt8 nIndex )
ocNoName, // 114 Call()
ocIndirect, // 115 @@()
ocZins, // 116 Rate()
- ocNoName, // 117 Term()
- ocNoName, // 118 Cterm()
+ ocZZR, // 117 Term()
+ ocZZR, // 118 Cterm()
ocLIA, // 119 Sln()
ocDIA, // 120 Syd(), Soy()
ocGDA, // 121 Ddb()
@@ -1800,8 +1824,8 @@ const sal_Char* GetAddInName( const sal_uInt8 n )
NULL, // 114 Call()
NULL, // 115 @@()
NULL, // 116 Rate()
- "ANN", // 117 Term()
- NULL, // 118 Cterm()
+ "TERM", // 117 Term()
+ "CTERM", // 118 Cterm()
NULL, // 119 Sln()
NULL, // 120 Syd(), Soy()
NULL, // 121 Ddb()
commit 064ae0887e7c215cb078e5cc4d73f23dcf3be5ef
Author: Andras Timar <andras.timar at collabora.com>
Date: Mon Nov 24 11:33:17 2014 +0100
fdo#85889 handle pc, pca and mac rtf keywords in writerfilter
Change-Id: Ic54f2233a37562bdc516e440af0b4b7973f56342
(cherry picked from commit 7839633fb356285652ed96f4bf3f85bcd5b561a4)
diff --git a/sw/qa/extras/rtfimport/data/fdo85889-mac.rtf b/sw/qa/extras/rtfimport/data/fdo85889-mac.rtf
new file mode 100644
index 0000000..8056d47
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo85889-mac.rtf
@@ -0,0 +1,3 @@
+{\rtf1\mac \deff0{\fonttbl{\f0\fmodern Helvetica;}}
+\pard\f0\fs20 \'f1\'f2\'f3\par
+}
diff --git a/sw/qa/extras/rtfimport/data/fdo85889-pc.rtf b/sw/qa/extras/rtfimport/data/fdo85889-pc.rtf
new file mode 100644
index 0000000..a3b9d27
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo85889-pc.rtf
@@ -0,0 +1,3 @@
+{\rtf1\pc \deff0{\fonttbl{\f0\fmodern Helvetica;}}
+\pard\f0\fs20 \'f1\'f2\'f3\par
+}
diff --git a/sw/qa/extras/rtfimport/data/fdo85889-pca.rtf b/sw/qa/extras/rtfimport/data/fdo85889-pca.rtf
new file mode 100644
index 0000000..34eeb18
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo85889-pca.rtf
@@ -0,0 +1,3 @@
+{\rtf1\pca \deff0{\fonttbl{\f0\fmodern Helvetica;}}
+\pard\f0\fs20 \'f1\'f2\'f3\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index b89472a..7dc67c3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2181,6 +2181,32 @@ DECLARE_RTFIMPORT_TEST(testChtOutlineNumberingRtf, "chtoutline.rtf")
CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix);
CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix);
}
+
+DECLARE_RTFIMPORT_TEST(testFdo85889pc, "fdo85889-pc.rtf")
+{
+ uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
+
+ OUString aExpected("\xc2\xb1\xe2\x89\xa5\xe2\x89\xa4", 8, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
+DECLARE_RTFIMPORT_TEST(testFdo85889pca, "fdo85889-pca.rtf")
+{
+ uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
+
+ OUString aExpected("\xc2\xb1\xe2\x80\x97\xc2\xbe", 7, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
+DECLARE_RTFIMPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
+{
+ uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
+
+ OUString aExpected("\xc3\x92\xc3\x9a\xc3\x9b", 6, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5e69009..859ca82 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2914,6 +2914,18 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_ANSI:
m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
break;
+ case RTF_MAC:
+ m_nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
+ m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ break;
+ case RTF_PC:
+ m_nCurrentEncoding = RTL_TEXTENCODING_IBM_437;
+ m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ break;
+ case RTF_PCA:
+ m_nCurrentEncoding = RTL_TEXTENCODING_IBM_850;
+ m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ break;
case RTF_PLAIN:
{
m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
More information about the Libreoffice-commits
mailing list