From a92ce1ed68b3f6522db76e8caa7e69cf2f66fc22 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 29 Sep 2021 14:56:43 +0200 Subject: embeddedobj: add a status indicator for the Further objects dialog Inserting a large file can take a while, and we do it on the main thread, so the UI is frozen during the operation. Create the progressbar in cui, which is allowed to link against sfx2/ and then pass it down to embeddedobj/. Similarly for the label of the progressbar, again because cui is allowed to link against svx/. Change-Id: I53fec4e14df647b140647d9ff5a3a37c0aa9e72e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122825 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- embeddedobj/source/msole/xdialogcreator.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'embeddedobj') diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx index 226528516953..d5ecdf587909 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include "xdialogcreator.hxx" #include @@ -215,8 +217,31 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia if ( !xEmbCreator.is() ) throw uno::RuntimeException(); + uno::Reference xProgress; + OUString aProgressText; + comphelper::SequenceAsHashMap aMap(aInObjArgs); + auto it = aMap.find("StatusIndicator"); + if (it != aMap.end()) + { + it->second >>= xProgress; + } + it = aMap.find("StatusIndicatorText"); + if (it != aMap.end()) + { + it->second >>= aProgressText; + } + if (xProgress.is()) + { + xProgress->start(aProgressText, 100); + } + aObjectInfo.Object.set( xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ), uno::UNO_QUERY ); + + if (xProgress.is()) + { + xProgress->end(); + } } if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != nullptr ) -- cgit