diff options
author | László Németh <nemeth@numbertext.org> | 2018-12-12 12:58:07 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-12-17 15:20:02 +0100 |
commit | 75656a933e7a503f114aa64c67397cb375c9dbe8 (patch) | |
tree | 2f41701a909feefb6fcbb615fb723db12decbf02 /sw | |
parent | e25f270d45e78399cbbf4d66d4d02af064ad4f79 (diff) |
tdf#99631 DOCX import: set 1:1 scale in embedded XLSX
based on the OLE object size, instead of applying
different scales for the bad (non-imported) VisibleArea
settings.
Change-Id: I3f246b779afd145fe260af83173c1944df21fb1a
Reviewed-on: https://gerrit.libreoffice.org/65244
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/odfexport/data/tdf99631.docx | bin | 0 -> 9049 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 13 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf99631.docx b/sw/qa/extras/odfexport/data/tdf99631.docx Binary files differnew file mode 100644 index 000000000000..7fcb612c7f6d --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf99631.docx diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 6bc9b8fa006b..c8468eb90cdd 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2123,6 +2123,15 @@ DECLARE_ODFEXPORT_TEST(tdf118502, "tdf118502.odt") CPPUNIT_ASSERT(xReplacementGraphic.is()); } +DECLARE_ODFEXPORT_TEST(tdf99631, "tdf99631.docx") +{ + // File asserting while saving in LO. + xmlDocPtr pXmlDoc = parseExport("Object 1/settings.xml"); + if (!pXmlDoc) + return; + assertXPathContent(pXmlDoc, "//config:config-item[@config:name='VisibleAreaWidth']", "4515"); + assertXPathContent(pXmlDoc, "//config:config-item[@config:name='VisibleAreaHeight']", "903"); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 57fb431a5cc5..23319adb5691 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -49,6 +49,7 @@ #include <sfx2/printer.hxx> #include <unotools/charclass.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/classids.hxx> #include <svx/svxdlg.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> @@ -631,11 +632,20 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, try { + SvGlobalName aCLSID( xObj->getClassID() ); + // tdf#99631 VisibleArea settings of embedded XLSX haven't been imported in DOCX, yet: + // set the 1:1 scale based on the OLE object size instead of bad scaling in non-modified documents + bool bUpdateDOCXSheet = !GetDoc()->GetDocShell()->IsModified() && + // embedded spreadsheet + aCLSID == SvGlobalName( SO3_SC_CLASSID_60 ) && + // in docx + GetView().GetViewFrame()->GetFrame().GetCurrentDocument()->GetModel()->getURL().endsWithIgnoreAsciiCase(".docx"); + nMisc = xObj->getStatus( nAspect ); // This can surely only be a non-active object, if desired they // get the new size set as VisArea (StarChart). - if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc ) + if ((embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc) || bUpdateDOCXSheet) { // TODO/MBA: testing SwRect aRect( pFlyPrtRect ? *pFlyPrtRect @@ -672,6 +682,7 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, // nothing has been changed. // If the replacement graphic changes by this action, the document // will be already modified via other mechanisms. + if (embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc) { bool bResetEnableSetModified(false); if ( GetDoc()->GetDocShell()->IsEnableSetModified() ) |