Kaydet (Commit) fc50869a authored tarafından László Németh's avatar László Németh

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: 's avatarLászló Németh <nemeth@numbertext.org>
üst 3c96e997
......@@ -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: */
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment