[Libreoffice-commits] core.git: sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 14:20:23 UTC 2018


 sw/qa/extras/odfexport/data/tdf99631.docx |binary
 sw/qa/extras/odfexport/odfexport.cxx      |    9 +++++++++
 sw/source/uibase/wrtsh/wrtsh1.cxx         |   13 ++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 75656a933e7a503f114aa64c67397cb375c9dbe8
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Dec 12 12:58:07 2018 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Dec 17 15:20:02 2018 +0100

    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 at numbertext.org>

diff --git a/sw/qa/extras/odfexport/data/tdf99631.docx b/sw/qa/extras/odfexport/data/tdf99631.docx
new file mode 100644
index 000000000000..7fcb612c7f6d
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf99631.docx differ
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() )


More information about the Libreoffice-commits mailing list