[Libreoffice-commits] .: 3 commits - sw/qa writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Mon Mar 19 01:09:22 PDT 2012
sw/qa/extras/rtftok/data/fdo43965.rtf | 16 +++++++++++
sw/qa/extras/rtftok/rtftok.cxx | 35 +++++++++++++++++++++++++
writerfilter/source/dmapper/BorderHandler.cxx | 2 -
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 13 ++-------
4 files changed, 55 insertions(+), 11 deletions(-)
New commits:
commit dd875e4f6a7b6c6bea7121f701821d7c7ba7f6d0
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Fri Mar 16 14:23:36 2012 +0100
testcase for fdo#43965
diff --git a/sw/qa/extras/rtftok/data/fdo43965.rtf b/sw/qa/extras/rtftok/data/fdo43965.rtf
new file mode 100644
index 0000000..968fe77
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo43965.rtf
@@ -0,0 +1,16 @@
+{\rtf1\ansi\ansicpg1252
+{\fonttbl \f0\froman\fcharset0 Times;\f1\fswiss\fcharset0 Helvetica;}
+{\info{\subject Test file for LibreOffice 3.5}}
+\margl1440\margr1440\margt1440\margb1440\deftab720\viewkind1\viewscale100
+\pard\pardeftab720\ql\qnatural
+\f0\fs36
+{
+{\fs22\up8 2}
+}\
+{\box\brdrs Box
+}\
+Page feeds:\
+ This is on the first page.\
+\page
+ This is on the second page.\
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 95fc51b..c376779 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -33,9 +33,11 @@
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <rtl/oustringostreaminserter.hxx>
#include <test/bootstrapfixture.hxx>
@@ -64,6 +66,7 @@ public:
void testFdo46662();
void testN750757();
void testFdo45563();
+ void testFdo43965();
CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT)
@@ -76,6 +79,7 @@ public:
CPPUNIT_TEST(testFdo46662);
CPPUNIT_TEST(testN750757);
CPPUNIT_TEST(testFdo45563);
+ CPPUNIT_TEST(testFdo43965);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -339,6 +343,37 @@ void RtfModelTest::testFdo45563()
CPPUNIT_ASSERT_EQUAL(4, i);
}
+void RtfModelTest::testFdo43965()
+{
+ load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo43965.rtf")));
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+
+ // First paragraph: the parameter of \up was ignored
+ uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
+ uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
+ sal_Int32 nValue;
+ xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapement"))) >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nValue);
+ xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapementHeight"))) >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue);
+
+ // Second paragraph: Word vs Writer border default problem
+ xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ table::BorderLine2 aBorder;
+ xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopBorder"))) >>= aBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), aBorder.LineWidth);
+
+ // Finally, make sure that we have two pages
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+ xCursor->jumpToLastPage();
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit dac6b7938173d0793810ee5731de51c440c1af5e
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Fri Mar 16 13:49:00 2012 +0100
fdo#43965 fix RTF import of \up and \dn with custom parameters
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3e0c9b9..f8da21d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2252,18 +2252,11 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aCharacterSprms->push_back(make_pair(0x6877, pValue));
}
break;
- case RTF_UP: // TODO handle when point size is not shrinking
- {
- OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript"));
- RTFValue::Pointer_t pValue(new RTFValue(aValue));
- m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
- }
- break;
+ case RTF_UP:
case RTF_DN:
{
- OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript"));
- RTFValue::Pointer_t pValue(new RTFValue(aValue));
- m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
+ RTFValue::Pointer_t pValue(new RTFValue(nParam * (nKeyword == RTF_UP ? 1 : -1)));
+ m_aStates.top().aCharacterSprms->push_back(make_pair(NS_sprm::LN_CHpsPos, pValue));
}
break;
case RTF_HORZVERT:
commit bb34b73730a3109bdcae0a03137c1faffab610d5
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Fri Mar 16 13:36:16 2012 +0100
fdo#43965 dmapper: fix line width default
Writer's default is 0, but Word's default is 26 (15 in 1/8 pt)
diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx
index 90e8456..f4858f5 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -44,7 +44,7 @@ using namespace ::com::sun::star;
BorderHandler::BorderHandler( bool bOOXML ) :
LoggedProperties(dmapper_logger, "BorderHandler"),
m_nCurrentBorderPosition( BORDER_TOP ),
-m_nLineWidth(0),
+m_nLineWidth(26), // Word default
m_nLineType(0),
m_nLineColor(0),
m_nLineDistance(0),
More information about the Libreoffice-commits
mailing list