fdo#46966 dmapper: fix headery/footery default value

The docx spec doesn't say what is the default value, the rtf spec says
it's 720, not 1440.

Change-Id: Icb331591d4f2f96a7786f808d99af5974e645f8e
This commit is contained in:
Miklos Vajna
2012-06-22 18:55:15 +02:00
parent 52a0b3fade
commit 4148d1bd40
3 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
{\rtf1\ansi
{\fonttbl{\f0 Times New Roman;}}
{\stylesheet{\s0\snext0\f0\fs24 Normal;}}
\margl720\margr1440\margt720\margb1440
\sectd
\marglsxn720\margrsxn1440\margtsxn720\margbsxn1440
{\header Header}
Text
\par }

View File

@@ -96,6 +96,7 @@ public:
void testFdo50539();
void testFdo50665();
void testFdo49659();
void testFdo46966();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -135,6 +136,7 @@ public:
CPPUNIT_TEST(testFdo50539);
CPPUNIT_TEST(testFdo50665);
CPPUNIT_TEST(testFdo49659);
CPPUNIT_TEST(testFdo46966);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -794,6 +796,21 @@ void Test::testFdo49659()
CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, nValue);
}
void Test::testFdo46966()
{
/*
* The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
*
* xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
*/
load("fdo46966.rtf");
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
sal_Int32 nValue = 0;
xPropertySet->getPropertyValue("TopMargin") >>= nValue;
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), nValue);
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@@ -3370,7 +3370,8 @@ void DomainMapper_Impl::SetPageMarginTwip( PageMarElement eElement, sal_Int32 nV
_PageMar::_PageMar()
{
header = footer = top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720));
top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1800));
gutter = 0;
}