summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-12-21 05:44:04 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-12-21 11:23:45 +0100
commit02ea9bc36ab47d68940da55f5012677dfaf0a8b8 (patch)
tree67c93e280c87fc08f566d37780d3ac3a8c741ded /oox
parent0678d8e315af75ba0c04501e72cdeeb896bae697 (diff)
tdf#114613: Repair function does not work after opening PPTX file
We need to disable undo handling during file import. Same is done for other file formats (e.g. PPT, XLSX). Change-Id: I1969c17b4a25b59b0d216ee847b3664e9c2207ca Reviewed-on: https://gerrit.libreoffice.org/46882 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/pptimport.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index f8fb72526e06..adab8e4f1b96 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -21,6 +21,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <comphelper/propertysequence.hxx>
#include <osl/diagnose.h>
#include <vcl/msgbox.hxx>
@@ -125,6 +127,19 @@ bool PowerPointImport::importDocument()
file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
+ uno::Reference< document::XUndoManagerSupplier > xUndoManagerSupplier (getModel(), UNO_QUERY );
+ uno::Reference< util::XLockable > xUndoManager;
+ bool bWasUnLocked = true;
+ if(xUndoManagerSupplier.is())
+ {
+ xUndoManager = xUndoManagerSupplier->getUndoManager();
+ if(xUndoManager.is())
+ {
+ bWasUnLocked = !xUndoManager->isLocked();
+ xUndoManager->lock();
+ }
+ }
+
importDocumentProperties();
OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" );
@@ -158,6 +173,9 @@ bool PowerPointImport::importDocument()
pBox->Execute();
}
+ if(xUndoManager.is() && bWasUnLocked)
+ xUndoManager->unlock();
+
return bRet;
}