diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-02-03 08:35:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-09 09:28:06 +0000 |
commit | e0759e728436052e560285849b30a9ec8a13bef5 (patch) | |
tree | 9a757ff4a17be2ed081f350af5c40e3b83e3407d /oox | |
parent | 059f6f1916c17ee3d78b2b815d01b59d7abf3924 (diff) |
tdf#105707 PPTX import: warn when SmartArt is missing DrawingML fallback
By the time DiagramGraphicDataContext::onCreateContext() completes, we
know if there will be a DrawingML fallback for the SmartArt (called
ExtDrawing in the code) or not.
Warn about this case once at the end of the import when in interactive
mode. Headless mode silently ignores the warning as expected.
(cherry picked from commit ae828495be9c2ac5fdb4c1747ed7bdd51e5d87a7)
Conflicts:
include/svx/dialogs.hrc
oox/source/core/xmlfilterbase.cxx
Change-Id: I2bfeeedcaa244f08d8a0c208167e79d7bb697e6d
Reviewed-on: https://gerrit.libreoffice.org/33872
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/graphicshapecontext.cxx | 5 | ||||
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 28 |
3 files changed, 39 insertions, 2 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 952bf5ead0e2..c5eb5d3d7c7f 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -201,7 +201,8 @@ XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) mxImpl( new XmlFilterBaseImpl( rxContext ) ), mnRelId( 1 ), mnMaxDocId( 0 ), - mbMSO2007(false) + mbMSO2007(false), + mbMissingExtDrawing(false) { } @@ -910,6 +911,11 @@ bool XmlFilterBase::isMSO2007Document() const return mbMSO2007; } +void XmlFilterBase::setMissingExtDrawing() +{ + mbMissingExtDrawing = true; +} + } // namespace core } // namespace oox diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 73c2fdc0c227..b58bf56bdda7 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -271,6 +271,11 @@ ContextHandlerRef DiagramGraphicDataContext::onCreateContext( ::sal_Int32 aEleme << "," << mpShapePtr->getSize().Width << "," << mpShapePtr->getSize().Height <<")"); + + // No DrawingML fallback, need to warn the user at the end. + if (mpShapePtr->getExtDrawings().empty()) + getFilter().setMissingExtDrawing(); + break; } default: diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index d2764b865372..792e677b088a 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -22,6 +22,13 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <osl/diagnose.h> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <svtools/sfxecode.hxx> +#include <svtools/ehdl.hxx> +#include <svtools/svtools.hrc> +#include <tools/urlobj.hxx> +#include <svx/dialogs.hrc> #include "oox/ppt/pptimport.hxx" #include "oox/drawingml/chart/chartconverter.hxx" #include "oox/dump/pptxdumper.hxx" @@ -91,7 +98,26 @@ bool PowerPointImport::importDocument() OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" ); FragmentHandlerRef xPresentationFragmentHandler( new PresentationFragmentHandler( *this, aFragmentPath ) ); maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "tableStyles" ); - return importFragment( xPresentationFragmentHandler ); + bool bRet = importFragment(xPresentationFragmentHandler); + + if (mbMissingExtDrawing) + { + // Construct a warning message. + INetURLObject aURL(getFileUrl()); + SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, aURL.getName(INetURLObject::LAST_SEGMENT), nullptr, RID_ERRCTX); + OUString aWarning; + aContext.GetString(ERRCODE_WARNING_MASK, aWarning); + aWarning += ":\n"; + static ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag()); + aWarning += ResId(RID_SVXSTR_WARN_MISSING_SMARTART, *pResMgr).toString(); + + // Show it. + WinBits eBits = WB_OK | WB_DEF_OK; + ScopedVclPtrInstance<WarningBox> pBox(nullptr, eBits, aWarning); + pBox->Execute(); + } + + return bRet; } |