[Libreoffice-commits] core.git: Branch 'distro/vector/vector-7.0' - 2 commits - cui/source embeddedobj/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 1 07:56:29 UTC 2021
cui/source/dialogs/insdlg.cxx | 54 +++++++++++++++++++++++++++-
embeddedobj/source/msole/xdialogcreator.cxx | 25 ++++++++++++
2 files changed, 78 insertions(+), 1 deletion(-)
New commits:
commit cc50655e9b5b8a08d35dfac59fd3d7f1d1b50cf3
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Sep 29 14:56:43 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Oct 1 09:45:12 2021 +0200
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/.
(cherry picked from commit a92ce1ed68b3f6522db76e8caa7e69cf2f66fc22)
Conflicts:
embeddedobj/source/msole/xdialogcreator.cxx
Change-Id: I53fec4e14df647b140647d9ff5a3a37c0aa9e72e
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 071cfe9599aa..ac00c5949acd 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -30,6 +30,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>
@@ -190,10 +191,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;
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index 819168567a6f..716ca9facffb 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -25,6 +25,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>
@@ -35,6 +36,7 @@
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include "xdialogcreator.hxx"
#include <oleembobj.hxx>
@@ -231,8 +233,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 )
commit 09886ea6687e92d5e27120f43ac0055003157206
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Sep 28 17:54:27 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Oct 1 09:44:15 2021 +0200
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.
(cherry picked from commit 0713d278f5bf232bad819dd46dc19d34ed807b12)
Change-Id: Ib5d90e214c556b43f170538fc152a9e27193773f
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 4f34b461eba5..071cfe9599aa 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -22,11 +22,13 @@
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/embed/XInsertObjectDialog.hpp>
#include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#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 +50,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>
@@ -272,10 +277,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() )
More information about the Libreoffice-commits
mailing list