diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-09-29 14:56:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-09-29 15:49:12 +0200 |
commit | a92ce1ed68b3f6522db76e8caa7e69cf2f66fc22 (patch) | |
tree | bf268e500c1822d778dd1a19e6d026e5caffa6aa /cui | |
parent | e9564f1d727e89e8ab7c441a80a3944de10b3d3d (diff) |
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
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/insdlg.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index e811ad033f69..a8b9507db640 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/ui/dialogs/XFilePicker3.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <insdlg.hxx> #include <dialmgr.hxx> @@ -193,10 +194,32 @@ short SvInsertOleDlg::run() if ( xDialogCreator.is() ) { aName = aCnt.CreateUniqueObjectName(); + + uno::Reference<task::XStatusIndicator> xProgress; + OUString aProgressText; + SfxViewFrame* pFrame = SfxViewFrame::Current(); + if (pFrame) + { + // Have a current frame, create a matching progressbar, but don't start it yet. + uno::Reference<frame::XFrame> xFrame + = pFrame->GetFrame().GetFrameInterface(); + uno::Reference<task::XStatusIndicatorFactory> xProgressFactory( + xFrame, uno::UNO_QUERY); + if (xProgressFactory.is()) + { + xProgress = xProgressFactory->createStatusIndicator(); + if (xProgress) + { + aProgressText = SvxResId(RID_SVXSTR_DOC_LOAD); + } + } + } + const embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog( m_xStorage, aName, - uno::Sequence < beans::PropertyValue >() ); + {comphelper::makePropertyValue("StatusIndicator", xProgress), + comphelper::makePropertyValue("StatusIndicatorText", aProgressText)} ); OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" ); m_xObj = aNewInf.Object; |