diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-02-16 11:01:10 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-02-19 23:45:38 +0100 |
commit | b5b2628a280a820c83705f95f2eab561570cfd2d (patch) | |
tree | fd9583407bcc787d07092340176cd729e6cdc6ad /filter | |
parent | f0485ba2d90aae0312f5775588f22789016165d2 (diff) |
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@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
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 |