summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ww8export/data/tdf75539_relativeWidth.docbin0 -> 50176 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx11
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx2
3 files changed, 12 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
new file mode 100644
index 000000000000..ac811a8f3599
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 131c8e85b329..38f41d83bf49 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -261,6 +261,17 @@ xray ThisComponent.DrawPage.getByIndex(0).BoundRect
CPPUNIT_ASSERT( abs( boundRect2.Width - boundRect4.Width ) < 5 );
}
+DECLARE_WW8EXPORT_TEST(testTdf75539_relativeWidth, "tdf75539_relativeWidth.doc")
+{
+ //divide everything by 10 to give a margin of error for rounding etc.
+ sal_Int32 pageWidth = parseDump("/root/page[1]/body/infos/bounds", "width").toInt32()/10;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Page width", sal_Int32(9354/10), pageWidth);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("100% width line", pageWidth, parseDump("/root/page[1]/body/txt[2]/Special", "nWidth").toInt32()/10);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("50% width line", pageWidth/2, parseDump("/root/page[1]/body/txt[4]/Special", "nWidth").toInt32()/10);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("25% width line", pageWidth/4, parseDump("/root/page[1]/body/txt[6]/Special", "nWidth").toInt32()/10);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("10% width line", pageWidth/10, parseDump("/root/page[1]/body/txt[8]/Special", "nWidth").toInt32()/10);
+}
+
DECLARE_WW8EXPORT_TEST(testN757905, "n757905.doc")
{
// The problem was that the paragraph had only a single fly
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index df199a69f87a..0ab278d9dbb4 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -580,7 +580,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj,
aPic.mx = msword_cast<sal_uInt16>(
m_aSectionManager.GetPageWidth() -
m_aSectionManager.GetPageRight() -
- m_aSectionManager.GetPageLeft()) * relativeWidth / 1000;
+ m_aSectionManager.GetPageLeft()) * relativeWidth / aPic.dxaGoal;
aPD = WW8PicDesc( aPic );
// This SetSnapRect() call adjusts the size of the
// object itself, no idea why it's this call (or even