[Libreoffice-commits] core.git: sw/qa sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 19 21:37:25 UTC 2018
sw/qa/extras/ooxmlexport/data/tdf99631.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 15 ++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 28 ++++++++++++++++++++++++++-
3 files changed, 42 insertions(+), 1 deletion(-)
New commits:
commit fc50869a818f5411bf2bbd34db398078308f2ba3
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Wed Dec 19 14:58:38 2018 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Wed Dec 19 22:37:00 2018 +0100
tdf#99631 DOCX export: keep zoom of embedded XLSX
OLE objects by exporting their VisibleArea settings
Change-Id: Iaedc1901999dd203fc9961a4775f8d2452f3ccda
Reviewed-on: https://gerrit.libreoffice.org/65435
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf99631.docx b/sw/qa/extras/ooxmlexport/data/tdf99631.docx
new file mode 100644
index 000000000000..c72950b7240a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf99631.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 547afcd1a399..3e90ed1b4d9d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -921,6 +921,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117137, "tdf117137.docx")
CPPUNIT_ASSERT(xPara3->getPropertyValue("NumberingRules").hasValue());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf99631, "tdf99631.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "//w:object", 2);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 2);
+ // first XSLX OLE object (1:1 scale)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object[1]", "dxaOrig", "2560");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object[1]", "dyaOrig", "513");
+ // second XLSX OLE object (same content + 1 row, but zoomed)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:object[1]", "dxaOrig", "2560");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:object[1]", "dyaOrig", "768");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3791a6a8f7d8..1328a07151cb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -148,6 +148,8 @@
#include <algorithm>
#include <stdarg.h>
+#include <toolkit/helper/vclunohelper.hxx>
+
using ::editeng::SvxBorderLine;
using namespace oox;
@@ -5312,7 +5314,31 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S
m_rDrawingML.SetFS(m_pSerializer);
OUString sImageId = m_rDrawingML.WriteImage( *pGraphic );
- m_pSerializer->startElementNS( XML_w, XML_object, FSEND );
+ if ( sDrawAspect == "Content" )
+ {
+ awt::Size aSize;
+ try
+ {
+ aSize = xObj->getVisualAreaSize( rNode.GetAspect() );
+
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rNode.GetAspect() ) );
+ Size aOriginalSize( OutputDevice::LogicToLogic(Size( aSize.Width, aSize.Height),
+ MapMode(aUnit), MapMode(MapUnit::MapTwip)));
+
+ m_pSerializer->startElementNS( XML_w, XML_object,
+ FSNS(XML_w, XML_dxaOrig), OString::number(aOriginalSize.Width()),
+ FSNS(XML_w, XML_dyaOrig), OString::number(aOriginalSize.Height()),
+ FSEND );
+ }
+ catch ( uno::Exception& )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_object, FSEND );
+ }
+ }
+ else
+ {
+ m_pSerializer->startElementNS( XML_w, XML_object, FSEND );
+ }
OStringBuffer sShapeStyle, sShapeId;
sShapeStyle.append( "width:" ).append( double( rSize.Width() ) / 20 )
More information about the Libreoffice-commits
mailing list