filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit b5b2628a280a820c83705f95f2eab561570cfd2d Author: Thorsten Behrens <thorsten.behr...@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.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits