summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2015-04-02 13:42:11 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-12 20:14:03 +0000
commit266b593d1b7b30003aefc311e1635fcd721a71aa (patch)
treed79a83063e1278bc2db649529449af2f5ebbad28
parenta025af8f1713a826067a4a351d47d29d1342693f (diff)
tdf#90403 PPTX import: use real table size
PowerPoint ignores a:ext cx and cy value of p:xfrm, and uses real table width and height. PowerPoint 2010 saves files where cx and cy contains good values, but I found files in the wild whose cx and cy values did not match to actual table width and height, and there was a visible difference between rendering of Impress and PowerPoint. Change-Id: I3f80c0cea4cac46763d449f918bb78dca1a6562d Reviewed-on: https://gerrit.libreoffice.org/15123 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 037fe3671cbdad51f52d2f69f72f47f463dba7c2) Reviewed-on: https://gerrit.libreoffice.org/15132 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--oox/source/drawingml/shape.cxx17
-rw-r--r--sd/qa/unit/data/tdf90403.pptxbin0 -> 39815 bytes
-rw-r--r--sd/qa/unit/data/xml/tdf90403_0.xml4
-rw-r--r--sd/qa/unit/import-tests.cxx1
4 files changed, 22 insertions, 0 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 81249e59236f..81251f2964c5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -405,6 +405,23 @@ Reference< XShape > Shape::createAndInsert(
bool bIsEmbMedia = false;
SAL_INFO("oox.drawingml", OSL_THIS_FUNC << " id: " << msId);
+ // tdf#90403 PowerPoint ignores a:ext cx and cy values of p:xfrm, and uses real table width and height
+ if ( mpTablePropertiesPtr.get() && rServiceName == "com.sun.star.drawing.TableShape" )
+ {
+ maSize.Width = 0;
+ for( std::vector< sal_Int32 >::const_iterator aTableColIter(mpTablePropertiesPtr->getTableGrid().begin());
+ aTableColIter != mpTablePropertiesPtr->getTableGrid().end(); aTableColIter++ )
+ {
+ maSize.Width += *aTableColIter;
+ }
+ maSize.Height = 0;
+ for( std::vector< ::oox::drawingml::table::TableRow >::const_iterator aTableRowIter(mpTablePropertiesPtr->getTableRows().begin());
+ aTableRowIter != mpTablePropertiesPtr->getTableRows().end(); aTableRowIter++ )
+ {
+ maSize.Height += (*aTableRowIter).getHeight();
+ }
+ }
+
awt::Rectangle aShapeRectHmm( maPosition.X / EMU_PER_HMM, maPosition.Y / EMU_PER_HMM, maSize.Width / EMU_PER_HMM, maSize.Height / EMU_PER_HMM );
OUString aServiceName;
diff --git a/sd/qa/unit/data/tdf90403.pptx b/sd/qa/unit/data/tdf90403.pptx
new file mode 100644
index 000000000000..fd48d058a260
--- /dev/null
+++ b/sd/qa/unit/data/tdf90403.pptx
Binary files differ
diff --git a/sd/qa/unit/data/xml/tdf90403_0.xml b/sd/qa/unit/data/xml/tdf90403_0.xml
new file mode 100644
index 000000000000..297504d4bed3
--- /dev/null
+++ b/sd/qa/unit/data/xml/tdf90403_0.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<XShapes>
+ <XShape positionX="4233" positionY="3881" sizeX="16932" sizeY="14044" type="com.sun.star.drawing.TableShape" name="Table 1"/>
+</XShapes>
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c9de7bdf8534..7103e3f2206d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -179,6 +179,7 @@ void SdImportTest::testDocumentLayout()
{ "n593612.pptx", "xml/n593612_", PPTX, -1 },
{ "fdo71434.pptx", "xml/fdo71434_", PPTX, -1 },
{ "n902652.pptx", "xml/n902652_", PPTX, -1 },
+ { "tdf90403.pptx", "xml/tdf90403_", PPTX, -1 },
// { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
};