[Libreoffice-commits] core.git: filter/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Mon Feb 19 22:45:59 UTC 2018


 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit b5b2628a280a820c83705f95f2eab561570cfd2d
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Fri Feb 16 11:01:10 2018 +0100

    filter: speedup nested importers by not notifying constantly
    
    For example the PDF import into Draw would otherwise waste many
    cycles on needlessly notifying several times per shape loaded.
    
    Change-Id: I7d28abb7886b5c1728726b7d42578459e56e7f62
    Reviewed-on: https://gerrit.libreoffice.org/49985
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 5db591bcf53e..dad36ee2922b 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <comphelper/fileurl.hxx>
 #include <comphelper/processfactory.hxx>
@@ -44,6 +45,7 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/propertysetinfo.hxx>
+#include <comphelper/scopeguard.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <unotools/pathoptions.hxx>
 
@@ -57,6 +59,7 @@ using namespace com::sun::star::document;
 using namespace com::sun::star::style;
 using namespace com::sun::star::xml;
 using namespace com::sun::star::xml::sax;
+using namespace com::sun::star::frame;
 using namespace ::com::sun::star::task;
 
 bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >& aDescriptor )
@@ -121,6 +124,15 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
 
     Reference< XImportFilter > xConverter( xConvBridge, UNO_QUERY );
 
+    // prevent unnecessary broadcasting when loading
+    Reference< XModel > xModel( mxDoc, UNO_QUERY );
+    if( xModel.is() )
+        xModel->lockControllers();
+    comphelper::ScopeGuard guard([&]() {
+        // cleanup when leaving
+        if( xModel.is() )
+            xModel->unlockControllers();
+    });
 
     //Template Loading if Required
 


More information about the Libreoffice-commits mailing list