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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2021-09-29 15:49:12 +02:00
parent e9564f1d72
commit a92ce1ed68
2 changed files with 49 additions and 1 deletions
@@ -29,6 +29,7 @@
#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <osl/thread.h>
#include <osl/file.hxx>
@@ -40,6 +41,7 @@
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include "xdialogcreator.hxx"
#include <oleembobj.hxx>
@@ -215,8 +217,31 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
if ( !xEmbCreator.is() )
throw uno::RuntimeException();
uno::Reference<task::XStatusIndicator> 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 )