[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - oox/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Feb 15 16:47:06 UTC 2017


 oox/source/drawingml/graphicshapecontext.cxx |   12 ++++++++++++
 oox/source/ppt/extdrawingfragmenthandler.cxx |    5 ++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 4bef184a4b88b7dbb4edf0ccde6bd5bff668e729
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Feb 10 14:33:51 2017 +0100

    Related: tdf#105707 PPTX import: warn on invalid/empty SmartArt fallback relid
    
    We already warn when the SmartArt doesn't have a drawingML fallback, but
    having a reference to a fallback that is not a valid one (so resolves to
    an empty fragment path) is also unusable. So warn in that case as well.
    
    (cherry picked from commit 2d732b498bab244cde6978e9389511a940101995)
    
    This second related situation is about when there is drawingML fallback
    for the SmartArt, but it's ampty shape tree, which is never created with
    MSO2010+ (those shape trees always have at least one element). This is
    as bad as the missing drawingML fallback, so warn on it.
    
    (cherry picked from commit 8c6776f27cef1e2b7b40957f1801b08707bc3230)
    
    Change-Id: I03b2325003b4eb38b1347a88899799c6d5c33606
    Reviewed-on: https://gerrit.libreoffice.org/34197
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index b58bf56..e211d73 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -275,6 +275,18 @@ ContextHandlerRef DiagramGraphicDataContext::onCreateContext( ::sal_Int32 aEleme
         // No DrawingML fallback, need to warn the user at the end.
         if (mpShapePtr->getExtDrawings().empty())
             getFilter().setMissingExtDrawing();
+        else
+        {
+            for (const auto& rRelId : mpShapePtr->getExtDrawings())
+            {
+                // An invalid fallback reference is as bad as a missing one.
+                if (getFragmentPathFromRelId(rRelId).isEmpty())
+                {
+                    getFilter().setMissingExtDrawing();
+                    break;
+                }
+            }
+        }
 
         break;
     }
diff --git a/oox/source/ppt/extdrawingfragmenthandler.cxx b/oox/source/ppt/extdrawingfragmenthandler.cxx
index eae641e..9f402f8 100644
--- a/oox/source/ppt/extdrawingfragmenthandler.cxx
+++ b/oox/source/ppt/extdrawingfragmenthandler.cxx
@@ -11,6 +11,7 @@
 
 #include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
+#include <oox/core/xmlfilterbase.hxx>
 
 using namespace ::oox::core;
 using namespace ::com::sun::star::xml::sax;
@@ -35,7 +36,9 @@ ExtDrawingFragmentHandler::ExtDrawingFragmentHandler( XmlFilterBase& rFilter,
 
 ExtDrawingFragmentHandler::~ExtDrawingFragmentHandler( ) throw ()
 {
-
+    // Empty DrawingML fallback, need to warn the user at the end.
+    if (mpShapePtr && mpShapePtr->getChildren().empty())
+        getFilter().setMissingExtDrawing();
 }
 
 ContextHandlerRef


More information about the Libreoffice-commits mailing list