[Libreoffice-commits] core.git: oox/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 14 06:03:21 UTC 2019
oox/source/ppt/pptimport.cxx | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
New commits:
commit 03ec3b7dd11656c8b64a94efb172e17d97ea662e
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Oct 14 00:12:23 2019 +0300
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Mon Oct 14 08:02:31 2019 +0200
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 at gmail.com>
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;
}
}
More information about the Libreoffice-commits
mailing list