[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed May 9 03:04:43 PDT 2012
sw/qa/extras/rtftok/data/fdo49501.rtf | 5 ++++
sw/qa/extras/rtftok/rtftok.cxx | 26 ++++++++++++++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 27 ++++++++++++-------------
3 files changed, 44 insertions(+), 14 deletions(-)
New commits:
commit d6acd86fe1d2924a378e3053f83d47084a8bb108
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 9 11:30:13 2012 +0200
fdo#49501 RTF_MARGL/R/T/B should also set the current margin
Change-Id: I I69b92d0cd07c9f08f14affb447b55b26b2556186
diff --git a/sw/qa/extras/rtftok/data/fdo49501.rtf b/sw/qa/extras/rtftok/data/fdo49501.rtf
new file mode 100644
index 0000000..47bd691
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo49501.rtf
@@ -0,0 +1,5 @@
+{\rtf
+\landscape \paperw15309 \paperh11907 \margl567 \margr567 \margt567 \margb567
+Department
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 605a20d..e6de843 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -95,6 +95,7 @@ public:
void testFdo47764();
void testFdo38786();
void testN757651();
+ void testFdo49501();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -127,6 +128,7 @@ public:
CPPUNIT_TEST(testFdo47764);
CPPUNIT_TEST(testFdo38786);
CPPUNIT_TEST(testN757651);
+ CPPUNIT_TEST(testFdo49501);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -701,6 +703,30 @@ void Test::testN757651()
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+void Test::testFdo49501()
+{
+ load("fdo49501.rtf");
+
+ uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName("PageStyles"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY);
+
+ sal_Bool bIsLandscape = sal_False;
+ xStyle->getPropertyValue("IsLandscape") >>= bIsLandscape;
+ CPPUNIT_ASSERT_EQUAL(sal_True, bIsLandscape);
+ sal_Int32 nExpected(TWIP_TO_MM100(567));
+ sal_Int32 nValue = 0;
+ xStyle->getPropertyValue("LeftMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+ xStyle->getPropertyValue("RightMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+ xStyle->getPropertyValue("TopMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+ xStyle->getPropertyValue("BottomMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b2f6c88..957174e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2620,34 +2620,30 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true);
break;
- case RTF_MARGL:
+ case RTF_MARGL: // fall through: set the default + current value
lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true);
- break;
- case RTF_MARGR:
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
- break;
- case RTF_MARGT:
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true);
- break;
- case RTF_MARGB:
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true);
- break;
case RTF_MARGLSXN:
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true);
break;
+ case RTF_MARGR: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
case RTF_MARGRSXN:
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true);
break;
+ case RTF_MARGT: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true);
case RTF_MARGTSXN:
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true);
break;
+ case RTF_MARGB: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true);
case RTF_MARGBSXN:
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true);
commit 46fee7c2b23e9f252e9f223950718430c0990e61
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 9 11:24:55 2012 +0200
implement RTF_LANDSCAPE
Change-Id: Icc7f0b06f8fe31f31df728920ecb96dc40849b4e
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 16ca2ec..b2f6c88 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2164,6 +2164,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aTableSprms->push_back(make_pair(NS_rtf::LN_NFC, RTFValue::Pointer_t(new RTFValue(23)))); // bullets, same as \levelnfc23
}
break;
+ case RTF_LANDSCAPE:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, RTFValue::Pointer_t(new RTFValue(1)));
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false);
More information about the Libreoffice-commits
mailing list