summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx3
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/table-floating.docx (renamed from sw/qa/extras/ooxmlimport/data/table-floating.docx)bin14996 -> 14996 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx19
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx19
4 files changed, 21 insertions, 20 deletions
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
index 5df664ee66a4..9e011f302ae2 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -150,7 +150,8 @@ inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
{
- return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+ sal_Int32 nCorrection = (nValue > 0 ? 1 : -1) * EMU_PER_HMM / 2; // So that the implicit floor will round.
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + nCorrection) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
}
// ============================================================================
diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx b/sw/qa/extras/ooxmlexport/data/table-floating.docx
index 1e0cb30ece49..1e0cb30ece49 100755
--- a/sw/qa/extras/ooxmlimport/data/table-floating.docx
+++ b/sw/qa/extras/ooxmlexport/data/table-floating.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2129d9cd460b..89c3aabc18e3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -107,6 +107,7 @@ public:
void testFdo64350();
void testFdo67013();
void testParaShadow();
+ void testTableFloating();
void testTableFloatingMargins();
void testFdo44689_start_page_7();
@@ -192,6 +193,7 @@ void Test::run()
{"fdo64350.docx", &Test::testFdo64350},
{"fdo67013.docx", &Test::testFdo67013},
{"para-shadow.docx", &Test::testParaShadow},
+ {"table-floating.docx", &Test::testTableFloating},
{"table-floating-margins.docx", &Test::testTableFloatingMargins},
{"fdo44689_start_page_7.docx", &Test::testFdo44689_start_page_7},
};
@@ -1151,6 +1153,23 @@ void Test::testParaShadow()
CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(24/8*20)), aShadow.ShadowWidth);
}
+void Test::testTableFloating()
+{
+ // Both the size and the position of the table was incorrect.
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ // Second table was too wide: 16249, i.e. as wide as the first table.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), getProperty<sal_Int32>(xTables->getByIndex(1), "Width"));
+
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ // This was 0, should be the the opposite of (left margin + half of the border width).
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
+ // Was 0 as well, should be the right margin.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty<sal_Int32>(xFrame, "RightMargin"));
+}
+
void Test::testTableFloatingMargins()
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3f6293192ef5..524ef5896f66 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -128,7 +128,6 @@ public:
void testFdo66474();
void testGroupshapeRotation();
void testBnc780044Spacing();
- void testTableFloating();
void testTableFloatingMargins();
CPPUNIT_TEST_SUITE(Test);
@@ -223,7 +222,6 @@ void Test::run()
{"fdo66474.docx", &Test::testFdo66474},
{"groupshape-rotation.docx", &Test::testGroupshapeRotation},
{"bnc780044_spacing.docx", &Test::testBnc780044Spacing},
- {"table-floating.docx", &Test::testTableFloating},
{"table-floating-margins.docx", &Test::testTableFloatingMargins},
};
header();
@@ -1554,23 +1552,6 @@ void Test::testBnc780044Spacing()
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
}
-void Test::testTableFloating()
-{
- // Both the size and the position of the table was incorrect.
- uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
- // Second table was too wide: 16249, i.e. as wide as the first table.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), getProperty<sal_Int32>(xTables->getByIndex(1), "Width"));
-
- uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
- // This was 0, should be the the opposite of (left margin + half of the border width).
- CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
- // Was 0 as well, should be the right margin.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty<sal_Int32>(xFrame, "RightMargin"));
-}
-
void Test::testTableFloatingMargins()
{
// In case the table had custom left cell margin, the horizontal position was still incorrect (too small, -199).