diff options
-rw-r--r-- | cui/source/dialogs/insdlg.cxx | 25 | ||||
-rw-r--r-- | embeddedobj/source/msole/xdialogcreator.cxx | 25 |
2 files changed, 49 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; 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 <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 ) |