[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source

Tamás Zolnai tamas.zolnai at collabora.com
Fri Dec 22 13:47:14 UTC 2017


 oox/source/ppt/pptimport.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 867cbce9d2b272bd56e505d2a12762c8384ec7ea
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Thu Dec 21 05:44:04 2017 +0100

    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 at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 02ea9bc36ab47d68940da55f5012677dfaf0a8b8)
    Reviewed-on: https://gerrit.libreoffice.org/46973
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index f76805235a88..9b68afe98974 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>
@@ -94,6 +96,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" );
@@ -118,6 +133,9 @@ bool PowerPointImport::importDocument()
         pBox->Execute();
     }
 
+    if(xUndoManager.is() && bWasUnLocked)
+        xUndoManager->unlock();
+
     return bRet;
 
 }


More information about the Libreoffice-commits mailing list