diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-05-09 11:30:13 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-05-09 12:04:45 +0200 |
commit | d6acd86fe1d2924a378e3053f83d47084a8bb108 (patch) | |
tree | 2c05c06c8f2d7fba941d4a981111a72026a3eaa9 | |
parent | 46fee7c2b23e9f252e9f223950718430c0990e61 (diff) |
fdo#49501 RTF_MARGL/R/T/B should also set the current margin
Change-Id: I I69b92d0cd07c9f08f14affb447b55b26b2556186
-rw-r--r-- | sw/qa/extras/rtftok/data/fdo49501.rtf | 5 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 26 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 24 |
3 files changed, 41 insertions, 14 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo49501.rtf b/sw/qa/extras/rtftok/data/fdo49501.rtf new file mode 100644 index 000000000000..47bd691b8e62 --- /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 605a20dde583..e6de8431a34c 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 b2f6c88fde99..957174ee37da 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); |