diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-14 00:12:23 +0300 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2019-10-14 08:02:31 +0200 |
commit | 03ec3b7dd11656c8b64a94efb172e17d97ea662e (patch) | |
tree | 332a21c47539ec69656ad2b2de2ed09562a97cf2 /oox/source | |
parent | 70db7576c05800c986c46514b41548743e531b87 (diff) |
tdf#125191: Disable Undo during pptx save
Change-Id: I07fe6895cc2ba43dfa1716e67bdbb4e697e3420c
Reviewed-on: https://gerrit.libreoffice.org/80727
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index b154196de2ac..01f572a54dcf 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/document/XUndoManager.hpp> #include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <comphelper/propertysequence.hxx> +#include <comphelper/scopeguard.hxx> #include <osl/diagnose.h> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -231,17 +232,28 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe Reference<css::lang::XMultiServiceFactory> aFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW); Reference< XExporter > xExporter(aFactory->createInstanceWithArguments("com.sun.star.comp.Impress.oox.PowerPointExport", aArguments), UNO_QUERY); - if (xExporter.is()) + if (Reference<XFilter> xFilter{ xExporter, UNO_QUERY }) { - Reference< XComponent > xDocument( getModel(), UNO_QUERY ); - Reference< XFilter > xFilter( xExporter, UNO_QUERY ); - - if (xFilter.is()) + Reference<util::XLockable> xUndoManager; + bool bWasUnLocked = true; + if (Reference<document::XUndoManagerSupplier> xUMS{ getModel(), UNO_QUERY }) { - xExporter->setSourceDocument( xDocument ); - if( xFilter->filter( rDescriptor ) ) - return true; + xUndoManager = xUMS->getUndoManager(); + if (xUndoManager.is()) + { + bWasUnLocked = !xUndoManager->isLocked(); + xUndoManager->lock(); + } } + comphelper::ScopeGuard aGuard([xUndoManager, bWasUnLocked] { + if (xUndoManager && bWasUnLocked) + xUndoManager->unlock(); + }); + + Reference< XComponent > xDocument(getModel(), UNO_QUERY); + xExporter->setSourceDocument(xDocument); + if (xFilter->filter(rDescriptor)) + return true; } } |