summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-09-28 17:54:27 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-28 19:45:40 +0200
commit0713d278f5bf232bad819dd46dc19d34ed807b12 (patch)
treed09e510031e734d66be02820f675d9122f0a8a5d /cui/source
parentd72511eda923c827a6175bec9b8f24c237f82730 (diff)
cui: add a status indicator for the OLE insert 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 a statusbar and tell the user what's happening, even if the underlying CreateObjectFromFile() and OleSave() functions don't report their progress, so effectively this is more like a spinner than a progressbar. Change-Id: Ib5d90e214c556b43f170538fc152a9e27193773f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122781 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/dialogs/insdlg.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 7e411d3c021d..e811ad033f69 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <insdlg.hxx>
@@ -48,6 +49,9 @@
#include <sfx2/frmdescr.hxx>
#include <sfx2/viewsh.hxx>
#include <comphelper/seqstream.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/strings.hrc>
+#include <svx/dialmgr.hxx>
#include <strings.hrc>
@@ -276,10 +280,34 @@ short SvInsertOleDlg::run()
aMedium[1].Value <<= xInteraction;
// create object from media descriptor
+
+ uno::Reference<task::XStatusIndicator> xProgress;
+ SfxViewFrame* pFrame = SfxViewFrame::Current();
+ if (pFrame)
+ {
+ // Have a current frame, create visual indication that insert is in progress.
+ 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)
+ {
+ OUString aDocLoad(SvxResId(RID_SVXSTR_DOC_LOAD));
+ xProgress->start(aDocLoad, 100);
+ }
+ }
+ }
+
if ( bLink )
m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName );
else
m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
+
+ if (xProgress.is())
+ {
+ xProgress->end();
+ }
}
if ( !m_xObj.is() )