1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_desktop.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "dp_gui_updatedata.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "sal/config.h" 34*cdf0e10cSrcweir #include "osl/file.hxx" 35*cdf0e10cSrcweir #include "osl/conditn.hxx" 36*cdf0e10cSrcweir #include "cppuhelper/exc_hlp.hxx" 37*cdf0e10cSrcweir #include "tools/resid.hxx" 38*cdf0e10cSrcweir #include "tools/resmgr.hxx" 39*cdf0e10cSrcweir #include "tools/solar.h" 40*cdf0e10cSrcweir #include "tools/string.hxx" 41*cdf0e10cSrcweir #include "vcl/dialog.hxx" 42*cdf0e10cSrcweir #include "vcl/msgbox.hxx" 43*cdf0e10cSrcweir #include "vcl/svapp.hxx" 44*cdf0e10cSrcweir #include "vos/mutex.hxx" 45*cdf0e10cSrcweir #include "vcl/dialog.hxx" 46*cdf0e10cSrcweir #include "cppuhelper/implbase3.hxx" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include "com/sun/star/beans/PropertyValue.hpp" 49*cdf0e10cSrcweir #include "com/sun/star/beans/NamedValue.hpp" 50*cdf0e10cSrcweir #include "com/sun/star/xml/dom/XElement.hpp" 51*cdf0e10cSrcweir #include "com/sun/star/xml/dom/XNode.hpp" 52*cdf0e10cSrcweir #include "com/sun/star/xml/dom/XNodeList.hpp" 53*cdf0e10cSrcweir #include "com/sun/star/ucb/NameClash.hpp" 54*cdf0e10cSrcweir #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" 55*cdf0e10cSrcweir #include "com/sun/star/ucb/XCommandEnvironment.hpp" 56*cdf0e10cSrcweir #include "com/sun/star/ucb/XProgressHandler.hpp" 57*cdf0e10cSrcweir #include "com/sun/star/deployment/XExtensionManager.hpp" 58*cdf0e10cSrcweir #include "com/sun/star/deployment/ExtensionManager.hpp" 59*cdf0e10cSrcweir #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" 60*cdf0e10cSrcweir #include "com/sun/star/deployment/DependencyException.hpp" 61*cdf0e10cSrcweir #include "com/sun/star/deployment/LicenseException.hpp" 62*cdf0e10cSrcweir #include "com/sun/star/deployment/VersionException.hpp" 63*cdf0e10cSrcweir #include "com/sun/star/deployment/ui/LicenseDialog.hpp" 64*cdf0e10cSrcweir #include "com/sun/star/task/XInteractionHandler.hpp" 65*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" 66*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp" 67*cdf0e10cSrcweir #include "com/sun/star/task/XInteractionAbort.hpp" 68*cdf0e10cSrcweir #include "com/sun/star/task/XInteractionApprove.hpp" 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir #include "dp_descriptioninfoset.hxx" 71*cdf0e10cSrcweir #include "dp_gui.hrc" 72*cdf0e10cSrcweir #include "dp_gui_updateinstalldialog.hxx" 73*cdf0e10cSrcweir #include "dp_gui_shared.hxx" 74*cdf0e10cSrcweir #include "dp_gui_updatedata.hxx" 75*cdf0e10cSrcweir #include "dp_ucb.h" 76*cdf0e10cSrcweir #include "dp_misc.h" 77*cdf0e10cSrcweir #include "dp_version.hxx" 78*cdf0e10cSrcweir #include "dp_gui_thread.hxx" 79*cdf0e10cSrcweir #include "dp_gui_extensioncmdqueue.hxx" 80*cdf0e10cSrcweir #include "ucbhelper/content.hxx" 81*cdf0e10cSrcweir #include "osl/mutex.hxx" 82*cdf0e10cSrcweir #include "vos/mutex.hxx" 83*cdf0e10cSrcweir #include "rtl/ref.hxx" 84*cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.h" 85*cdf0e10cSrcweir #include "comphelper/anytostring.hxx" 86*cdf0e10cSrcweir #include "toolkit/helper/vclunohelper.hxx" 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir #include <vector> 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir class Window; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir namespace cssu = ::com::sun::star::uno; 93*cdf0e10cSrcweir namespace css = ::com::sun::star; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir using ::rtl::OUString; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir namespace dp_gui { 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir class UpdateInstallDialog::Thread: public dp_gui::Thread { 101*cdf0e10cSrcweir friend class UpdateCommandEnv; 102*cdf0e10cSrcweir public: 103*cdf0e10cSrcweir Thread(cssu::Reference< cssu::XComponentContext > ctx, 104*cdf0e10cSrcweir UpdateInstallDialog & dialog, std::vector< dp_gui::UpdateData > & aVecUpdateData); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir void stop(); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir private: 111*cdf0e10cSrcweir Thread(Thread &); // not defined 112*cdf0e10cSrcweir void operator =(Thread &); // not defined 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir virtual ~Thread(); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir virtual void execute(); 117*cdf0e10cSrcweir void downloadExtensions(); 118*cdf0e10cSrcweir void download(::rtl::OUString const & aUrls, UpdateData & aUpdatData); 119*cdf0e10cSrcweir void installExtensions(); 120*cdf0e10cSrcweir void removeTempDownloads(); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir UpdateInstallDialog & m_dialog; 123*cdf0e10cSrcweir cssu::Reference< css::deployment::XUpdateInformationProvider > 124*cdf0e10cSrcweir m_updateInformation; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // guarded by Application::GetSolarMutex(): 127*cdf0e10cSrcweir cssu::Reference< css::task::XAbortChannel > m_abort; 128*cdf0e10cSrcweir cssu::Reference< cssu::XComponentContext > m_xComponentContext; 129*cdf0e10cSrcweir std::vector< dp_gui::UpdateData > & m_aVecUpdateData; 130*cdf0e10cSrcweir ::rtl::Reference<UpdateCommandEnv> m_updateCmdEnv; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir //A folder which is created in the temp directory in which then the updates are downloaded 133*cdf0e10cSrcweir ::rtl::OUString m_sDownloadFolder; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir bool m_stop; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir }; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir class UpdateCommandEnv 140*cdf0e10cSrcweir : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment, 141*cdf0e10cSrcweir css::task::XInteractionHandler, 142*cdf0e10cSrcweir css::ucb::XProgressHandler > 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir friend class UpdateInstallDialog::Thread; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir UpdateInstallDialog & m_updateDialog; 147*cdf0e10cSrcweir ::rtl::Reference<UpdateInstallDialog::Thread> m_installThread; 148*cdf0e10cSrcweir cssu::Reference< cssu::XComponentContext > m_xContext; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir public: 151*cdf0e10cSrcweir virtual ~UpdateCommandEnv(); 152*cdf0e10cSrcweir UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, 153*cdf0e10cSrcweir UpdateInstallDialog & updateDialog, 154*cdf0e10cSrcweir ::rtl::Reference<UpdateInstallDialog::Thread>const & thread); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir // XCommandEnvironment 157*cdf0e10cSrcweir virtual cssu::Reference<css::task::XInteractionHandler > SAL_CALL 158*cdf0e10cSrcweir getInteractionHandler() throw (cssu::RuntimeException); 159*cdf0e10cSrcweir virtual cssu::Reference<css::ucb::XProgressHandler > 160*cdf0e10cSrcweir SAL_CALL getProgressHandler() throw (cssu::RuntimeException); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // XInteractionHandler 163*cdf0e10cSrcweir virtual void SAL_CALL handle( 164*cdf0e10cSrcweir cssu::Reference<css::task::XInteractionRequest > const & xRequest ) 165*cdf0e10cSrcweir throw (cssu::RuntimeException); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // XProgressHandler 168*cdf0e10cSrcweir virtual void SAL_CALL push( cssu::Any const & Status ) 169*cdf0e10cSrcweir throw (cssu::RuntimeException); 170*cdf0e10cSrcweir virtual void SAL_CALL update( cssu::Any const & Status ) 171*cdf0e10cSrcweir throw (cssu::RuntimeException); 172*cdf0e10cSrcweir virtual void SAL_CALL pop() throw (cssu::RuntimeException); 173*cdf0e10cSrcweir }; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir UpdateInstallDialog::Thread::Thread( 177*cdf0e10cSrcweir cssu::Reference< cssu::XComponentContext> xCtx, 178*cdf0e10cSrcweir UpdateInstallDialog & dialog, 179*cdf0e10cSrcweir std::vector< dp_gui::UpdateData > & aVecUpdateData): 180*cdf0e10cSrcweir m_dialog(dialog), 181*cdf0e10cSrcweir m_xComponentContext(xCtx), 182*cdf0e10cSrcweir m_aVecUpdateData(aVecUpdateData), 183*cdf0e10cSrcweir m_updateCmdEnv(new UpdateCommandEnv(xCtx, m_dialog, this)), 184*cdf0e10cSrcweir m_stop(false) 185*cdf0e10cSrcweir {} 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void UpdateInstallDialog::Thread::stop() { 188*cdf0e10cSrcweir cssu::Reference< css::task::XAbortChannel > abort; 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir vos::OGuard g(Application::GetSolarMutex()); 191*cdf0e10cSrcweir abort = m_abort; 192*cdf0e10cSrcweir m_stop = true; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir if (abort.is()) { 195*cdf0e10cSrcweir abort->sendAbort(); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir UpdateInstallDialog::Thread::~Thread() {} 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir void UpdateInstallDialog::Thread::execute() 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir try { 204*cdf0e10cSrcweir downloadExtensions(); 205*cdf0e10cSrcweir installExtensions(); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir catch (...) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir //clean up the temp directories 212*cdf0e10cSrcweir try { 213*cdf0e10cSrcweir removeTempDownloads(); 214*cdf0e10cSrcweir } catch( ... ) { 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir //make sure m_dialog is still alive 219*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 220*cdf0e10cSrcweir if (! m_stop) 221*cdf0e10cSrcweir m_dialog.updateDone(); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir //UpdateCommandEnv keeps a reference to Thread and prevents destruction. Therefore remove it. 224*cdf0e10cSrcweir m_updateCmdEnv->m_installThread.clear(); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir UpdateInstallDialog::UpdateInstallDialog( 229*cdf0e10cSrcweir Window * parent, 230*cdf0e10cSrcweir std::vector<dp_gui::UpdateData> & aVecUpdateData, 231*cdf0e10cSrcweir cssu::Reference< cssu::XComponentContext > const & xCtx): 232*cdf0e10cSrcweir ModalDialog( 233*cdf0e10cSrcweir parent, 234*cdf0e10cSrcweir DpGuiResId(RID_DLG_UPDATEINSTALL)), 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir m_thread(new Thread(xCtx, *this, aVecUpdateData)), 237*cdf0e10cSrcweir m_xComponentContext(xCtx), 238*cdf0e10cSrcweir m_bError(false), 239*cdf0e10cSrcweir m_bNoEntry(true), 240*cdf0e10cSrcweir m_bActivated(false), 241*cdf0e10cSrcweir m_sInstalling(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_INSTALLING))), 242*cdf0e10cSrcweir m_sFinished(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_FINISHED))), 243*cdf0e10cSrcweir m_sNoErrors(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_NO_ERRORS))), 244*cdf0e10cSrcweir m_sErrorDownload(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_DOWNLOAD))), 245*cdf0e10cSrcweir m_sErrorInstallation(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_INSTALLATION))), 246*cdf0e10cSrcweir m_sErrorLicenseDeclined(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_LIC_DECLINED))), 247*cdf0e10cSrcweir m_sNoInstall(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_EXTENSION_NOINSTALL))), 248*cdf0e10cSrcweir m_sThisErrorOccurred(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_THIS_ERROR_OCCURRED))), 249*cdf0e10cSrcweir m_ft_action(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_DOWNLOADING)), 250*cdf0e10cSrcweir m_statusbar(this,DpGuiResId(RID_DLG_UPDATE_INSTALL_STATUSBAR)), 251*cdf0e10cSrcweir m_ft_extension_name(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_EXTENSION_NAME)), 252*cdf0e10cSrcweir m_ft_results(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_RESULTS)), 253*cdf0e10cSrcweir m_mle_info(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_INFO)), 254*cdf0e10cSrcweir m_line(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_LINE)), 255*cdf0e10cSrcweir m_help(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_HELP)), 256*cdf0e10cSrcweir m_ok(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_OK)), 257*cdf0e10cSrcweir m_cancel(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_ABORT)) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir FreeResource(); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir m_xExtensionManager = css::deployment::ExtensionManager::get( xCtx ); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir m_cancel.SetClickHdl(LINK(this, UpdateInstallDialog, cancelHandler)); 264*cdf0e10cSrcweir m_mle_info.EnableCursor(sal_False); 265*cdf0e10cSrcweir if ( ! dp_misc::office_is_running()) 266*cdf0e10cSrcweir m_help.Disable(); 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir UpdateInstallDialog::~UpdateInstallDialog() {} 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir sal_Bool UpdateInstallDialog::Close() 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir m_thread->stop(); 274*cdf0e10cSrcweir return ModalDialog::Close(); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir short UpdateInstallDialog::Execute() 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir m_thread->launch(); 280*cdf0e10cSrcweir return ModalDialog::Execute(); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // make sure the solar mutex is locked before calling 285*cdf0e10cSrcweir void UpdateInstallDialog::updateDone() 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir if (!m_bError) 288*cdf0e10cSrcweir m_mle_info.InsertText(m_sNoErrors); 289*cdf0e10cSrcweir m_ok.Enable(); 290*cdf0e10cSrcweir m_ok.GrabFocus(); 291*cdf0e10cSrcweir m_cancel.Disable(); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir // make sure the solar mutex is locked before calling 294*cdf0e10cSrcweir //sets an error message in the text area 295*cdf0e10cSrcweir void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sExtension, 296*cdf0e10cSrcweir OUString const & exceptionMessage) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir String sError; 299*cdf0e10cSrcweir m_bError = true; 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir switch (err) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir case ERROR_DOWNLOAD: 304*cdf0e10cSrcweir sError = m_sErrorDownload; 305*cdf0e10cSrcweir break; 306*cdf0e10cSrcweir case ERROR_INSTALLATION: 307*cdf0e10cSrcweir sError = m_sErrorInstallation; 308*cdf0e10cSrcweir break; 309*cdf0e10cSrcweir case ERROR_LICENSE_DECLINED: 310*cdf0e10cSrcweir sError = m_sErrorLicenseDeclined; 311*cdf0e10cSrcweir break; 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir default: 314*cdf0e10cSrcweir OSL_ASSERT(0); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir sError.SearchAndReplace(String(OUSTR("%NAME")), String(sExtension), 0); 318*cdf0e10cSrcweir //We want to have an empty line between the error messages. However, 319*cdf0e10cSrcweir //there shall be no empty line after the last entry. 320*cdf0e10cSrcweir if (m_bNoEntry) 321*cdf0e10cSrcweir m_bNoEntry = false; 322*cdf0e10cSrcweir else 323*cdf0e10cSrcweir m_mle_info.InsertText(OUSTR("\n")); 324*cdf0e10cSrcweir m_mle_info.InsertText(sError); 325*cdf0e10cSrcweir //Insert more information about the error 326*cdf0e10cSrcweir if (exceptionMessage.getLength()) 327*cdf0e10cSrcweir m_mle_info.InsertText(m_sThisErrorOccurred + exceptionMessage + OUSTR("\n")); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir m_mle_info.InsertText(m_sNoInstall); 330*cdf0e10cSrcweir m_mle_info.InsertText(OUSTR("\n")); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir void UpdateInstallDialog::setError(OUString const & exceptionMessage) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir m_bError = true; 336*cdf0e10cSrcweir m_mle_info.InsertText(exceptionMessage + OUSTR("\n")); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir IMPL_LINK(UpdateInstallDialog, cancelHandler, void *, EMPTYARG) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir m_thread->stop(); 342*cdf0e10cSrcweir EndDialog(RET_CANCEL); 343*cdf0e10cSrcweir return 0; 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------ 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir void UpdateInstallDialog::Thread::downloadExtensions() 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir try 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir //create the download directory in the temp folder 353*cdf0e10cSrcweir OUString sTempDir; 354*cdf0e10cSrcweir if (::osl::FileBase::getTempDirURL(sTempDir) != ::osl::FileBase::E_None) 355*cdf0e10cSrcweir throw cssu::Exception(OUSTR("Could not get URL for the temp directory. No extensions will be installed."), 0); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir //create a unique name for the directory 358*cdf0e10cSrcweir OUString tempEntry, destFolder; 359*cdf0e10cSrcweir if (::osl::File::createTempFile(&sTempDir, 0, &tempEntry ) != ::osl::File::E_None) 360*cdf0e10cSrcweir throw cssu::Exception(OUSTR("Could not create a temporary file in ") + sTempDir + 361*cdf0e10cSrcweir OUSTR(". No extensions will be installed"), 0 ); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 ); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir destFolder = dp_misc::makeURL( sTempDir, tempEntry ); 366*cdf0e10cSrcweir destFolder += OUSTR("_"); 367*cdf0e10cSrcweir m_sDownloadFolder = destFolder; 368*cdf0e10cSrcweir try 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir dp_misc::create_folder(0, destFolder, m_updateCmdEnv.get(), true ); 371*cdf0e10cSrcweir } catch (cssu::Exception & e) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir throw cssu::Exception(e.Message + OUSTR(" No extensions will be installed."), 0); 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir sal_uInt16 count = 0; 378*cdf0e10cSrcweir typedef std::vector<UpdateData>::iterator It; 379*cdf0e10cSrcweir for (It i = m_aVecUpdateData.begin(); i != m_aVecUpdateData.end(); i++) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir UpdateData & curData = *i; 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir if (!curData.aUpdateInfo.is() || curData.aUpdateSource.is()) 384*cdf0e10cSrcweir continue; 385*cdf0e10cSrcweir //We assume that m_aVecUpdateData contains only information about extensions which 386*cdf0e10cSrcweir //can be downloaded directly. 387*cdf0e10cSrcweir OSL_ASSERT(curData.sWebsiteURL.getLength() == 0); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir //update the name of the extension which is to be downloaded 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 392*cdf0e10cSrcweir if (m_stop) { 393*cdf0e10cSrcweir return; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir m_dialog.m_ft_extension_name.SetText(curData.aInstalledPackage->getDisplayName()); 396*cdf0e10cSrcweir sal_uInt16 prog = (sal::static_int_cast<sal_uInt16>(100) * ++count) / 397*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(m_aVecUpdateData.size()); 398*cdf0e10cSrcweir m_dialog.m_statusbar.SetValue(prog); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir dp_misc::DescriptionInfoset info(m_xComponentContext, curData.aUpdateInfo); 401*cdf0e10cSrcweir //remember occurring exceptions in case we need to print out error information 402*cdf0e10cSrcweir ::std::vector< ::std::pair<OUString, cssu::Exception> > vecExceptions; 403*cdf0e10cSrcweir cssu::Sequence<OUString> seqDownloadURLs = info.getUpdateDownloadUrls(); 404*cdf0e10cSrcweir OSL_ENSURE(seqDownloadURLs.getLength() > 0, "No download URL provided!"); 405*cdf0e10cSrcweir for (sal_Int32 j = 0; j < seqDownloadURLs.getLength(); j++) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir try 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir OSL_ENSURE(seqDownloadURLs[j].getLength() > 0, "Download URL is empty!"); 410*cdf0e10cSrcweir download(seqDownloadURLs[j], curData); 411*cdf0e10cSrcweir if (curData.sLocalURL.getLength() > 0) 412*cdf0e10cSrcweir break; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir catch ( cssu::Exception & e ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir vecExceptions.push_back( ::std::make_pair(seqDownloadURLs[j], e)); 417*cdf0e10cSrcweir //There can be several different errors, for example, the URL is wrong, webserver cannot be reached, 418*cdf0e10cSrcweir //name cannot be resolved. The UCB helper API does not specify different special exceptions for these 419*cdf0e10cSrcweir //cases. Therefore ignore and continue. 420*cdf0e10cSrcweir continue; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir //update the progress and display download error 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 426*cdf0e10cSrcweir if (m_stop) { 427*cdf0e10cSrcweir return; 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir if (curData.sLocalURL.getLength() == 0) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir //Construct a string of all messages contained in the exceptions plus the respective download URLs 432*cdf0e10cSrcweir ::rtl::OUStringBuffer buf(256); 433*cdf0e10cSrcweir typedef ::std::vector< ::std::pair<OUString, cssu::Exception > >::const_iterator CIT; 434*cdf0e10cSrcweir for (CIT j = vecExceptions.begin(); j != vecExceptions.end(); j++) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir if (j != vecExceptions.begin()) 437*cdf0e10cSrcweir buf.appendAscii("\n"); 438*cdf0e10cSrcweir buf.append(OUSTR("Could not download ")); 439*cdf0e10cSrcweir buf.append(j->first); 440*cdf0e10cSrcweir buf.appendAscii(". "); 441*cdf0e10cSrcweir buf.append(j->second.Message); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir m_dialog.setError(UpdateInstallDialog::ERROR_DOWNLOAD, curData.aInstalledPackage->getDisplayName(), 444*cdf0e10cSrcweir buf.makeStringAndClear()); 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir catch (cssu::Exception & e) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 453*cdf0e10cSrcweir if (m_stop) { 454*cdf0e10cSrcweir return; 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir m_dialog.setError(e.Message); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir void UpdateInstallDialog::Thread::installExtensions() 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir //Update the fix text in the dialog to "Installing extensions..." 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir vos::OGuard g(Application::GetSolarMutex()); 464*cdf0e10cSrcweir if (m_stop) { 465*cdf0e10cSrcweir return; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir m_dialog.m_ft_action.SetText(m_dialog.m_sInstalling); 468*cdf0e10cSrcweir m_dialog.m_statusbar.SetValue(0); 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir sal_uInt16 count = 0; 472*cdf0e10cSrcweir typedef std::vector<UpdateData>::iterator It; 473*cdf0e10cSrcweir for (It i = m_aVecUpdateData.begin(); i != m_aVecUpdateData.end(); i++, count++) 474*cdf0e10cSrcweir { 475*cdf0e10cSrcweir //update the name of the extension which is to be installed 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 478*cdf0e10cSrcweir if (m_stop) { 479*cdf0e10cSrcweir return; 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir //we only show progress after an extension has been installed. 482*cdf0e10cSrcweir if (count > 0) { 483*cdf0e10cSrcweir m_dialog.m_statusbar.SetValue( 484*cdf0e10cSrcweir (sal::static_int_cast<sal_uInt16>(100) * count) / 485*cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(m_aVecUpdateData.size())); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir m_dialog.m_ft_extension_name.SetText(i->aInstalledPackage->getDisplayName()); 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir // TimeValue v = {1, 0}; 490*cdf0e10cSrcweir // osl::Thread::wait(v); 491*cdf0e10cSrcweir bool bError = false; 492*cdf0e10cSrcweir bool bLicenseDeclined = false; 493*cdf0e10cSrcweir cssu::Reference<css::deployment::XPackage> xExtension; 494*cdf0e10cSrcweir UpdateData & curData = *i; 495*cdf0e10cSrcweir cssu::Exception exc; 496*cdf0e10cSrcweir try 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir cssu::Reference< css::task::XAbortChannel > xAbortChannel( 499*cdf0e10cSrcweir curData.aInstalledPackage->createAbortChannel() ); 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir vos::OGuard g(Application::GetSolarMutex()); 502*cdf0e10cSrcweir if (m_stop) { 503*cdf0e10cSrcweir return; 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir m_abort = xAbortChannel; 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir if (!curData.aUpdateSource.is() && curData.sLocalURL.getLength()) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1"))); 510*cdf0e10cSrcweir if (!curData.bIsShared) 511*cdf0e10cSrcweir xExtension = m_dialog.getExtensionManager()->addExtension( 512*cdf0e10cSrcweir curData.sLocalURL, css::uno::Sequence<css::beans::NamedValue>(&prop, 1), 513*cdf0e10cSrcweir OUSTR("user"), xAbortChannel, m_updateCmdEnv.get()); 514*cdf0e10cSrcweir else 515*cdf0e10cSrcweir xExtension = m_dialog.getExtensionManager()->addExtension( 516*cdf0e10cSrcweir curData.sLocalURL, css::uno::Sequence<css::beans::NamedValue>(&prop, 1), 517*cdf0e10cSrcweir OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get()); 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir else if (curData.aUpdateSource.is()) 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir OSL_ASSERT(curData.aUpdateSource.is()); 522*cdf0e10cSrcweir //I am not sure if we should obtain the install properties and pass them into 523*cdf0e10cSrcweir //add extension. Currently it contains only "SUPPRESS_LICENSE". So it it could happen 524*cdf0e10cSrcweir //that a license is displayed when updating from the shared repository, although the 525*cdf0e10cSrcweir //shared extension was installed using "SUPPRESS_LICENSE". 526*cdf0e10cSrcweir css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1"))); 527*cdf0e10cSrcweir if (!curData.bIsShared) 528*cdf0e10cSrcweir xExtension = m_dialog.getExtensionManager()->addExtension( 529*cdf0e10cSrcweir curData.aUpdateSource->getURL(), css::uno::Sequence<css::beans::NamedValue>(&prop, 1), 530*cdf0e10cSrcweir OUSTR("user"), xAbortChannel, m_updateCmdEnv.get()); 531*cdf0e10cSrcweir else 532*cdf0e10cSrcweir xExtension = m_dialog.getExtensionManager()->addExtension( 533*cdf0e10cSrcweir curData.aUpdateSource->getURL(), css::uno::Sequence<css::beans::NamedValue>(&prop, 1), 534*cdf0e10cSrcweir OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get()); 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir catch (css::deployment::DeploymentException & de) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir if (de.Cause.has<css::deployment::LicenseException>()) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir bLicenseDeclined = true; 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir else 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir exc = de.Cause.get<cssu::Exception>(); 546*cdf0e10cSrcweir bError = true; 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir catch (cssu::Exception& e) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir exc = e; 552*cdf0e10cSrcweir bError = true; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir if (bLicenseDeclined) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 558*cdf0e10cSrcweir if (m_stop) { 559*cdf0e10cSrcweir return; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED, 562*cdf0e10cSrcweir curData.aInstalledPackage->getDisplayName(), OUString()); 563*cdf0e10cSrcweir } 564*cdf0e10cSrcweir else if (!xExtension.is() || bError) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 567*cdf0e10cSrcweir if (m_stop) { 568*cdf0e10cSrcweir return; 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir m_dialog.setError(UpdateInstallDialog::ERROR_INSTALLATION, 571*cdf0e10cSrcweir curData.aInstalledPackage->getDisplayName(), exc.Message); 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir { 575*cdf0e10cSrcweir vos::OGuard g(Application::GetSolarMutex()); 576*cdf0e10cSrcweir if (m_stop) { 577*cdf0e10cSrcweir return; 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir m_dialog.m_statusbar.SetValue(100); 580*cdf0e10cSrcweir m_dialog.m_ft_extension_name.SetText(OUString()); 581*cdf0e10cSrcweir m_dialog.m_ft_action.SetText(m_dialog.m_sFinished); 582*cdf0e10cSrcweir } 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir void UpdateInstallDialog::Thread::removeTempDownloads() 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir if (m_sDownloadFolder.getLength()) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir dp_misc::erase_path(m_sDownloadFolder, 590*cdf0e10cSrcweir cssu::Reference<css::ucb::XCommandEnvironment>(),false /* no throw: ignore errors */ ); 591*cdf0e10cSrcweir //remove also the temp file which we have used to create the unique name 592*cdf0e10cSrcweir OUString tempFile = m_sDownloadFolder.copy(0, m_sDownloadFolder.getLength() - 1); 593*cdf0e10cSrcweir dp_misc::erase_path(tempFile, cssu::Reference<css::ucb::XCommandEnvironment>(),false); 594*cdf0e10cSrcweir m_sDownloadFolder = OUString(); 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir void UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, UpdateData & aUpdateData) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 603*cdf0e10cSrcweir if (m_stop) { 604*cdf0e10cSrcweir return; 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir 608*cdf0e10cSrcweir OSL_ASSERT(m_sDownloadFolder.getLength()); 609*cdf0e10cSrcweir OUString destFolder, tempEntry; 610*cdf0e10cSrcweir if (::osl::File::createTempFile( 611*cdf0e10cSrcweir &m_sDownloadFolder, 612*cdf0e10cSrcweir 0, &tempEntry ) != ::osl::File::E_None) 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir //ToDo feedback in window that download of this component failed 615*cdf0e10cSrcweir throw cssu::Exception(OUSTR("Could not create temporary file in folder ") + destFolder + OUSTR("."), 0); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 ); 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir destFolder = dp_misc::makeURL( m_sDownloadFolder, tempEntry ); 620*cdf0e10cSrcweir destFolder += OUSTR("_"); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir ::ucbhelper::Content destFolderContent; 623*cdf0e10cSrcweir dp_misc::create_folder( &destFolderContent, destFolder, m_updateCmdEnv.get() ); 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir ::ucbhelper::Content sourceContent; 626*cdf0e10cSrcweir dp_misc::create_ucb_content( &sourceContent, sDownloadURL, m_updateCmdEnv.get() ); 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir const OUString sTitle(sourceContent.getPropertyValue( 629*cdf0e10cSrcweir dp_misc::StrTitle::get() ).get<OUString>() ); 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir if (destFolderContent.transferContent( 632*cdf0e10cSrcweir sourceContent, ::ucbhelper::InsertOperation_COPY, 633*cdf0e10cSrcweir sTitle, css::ucb::NameClash::OVERWRITE )) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir //the user may have cancelled the dialog because downloading took to long 636*cdf0e10cSrcweir { 637*cdf0e10cSrcweir ::vos::OGuard g(Application::GetSolarMutex()); 638*cdf0e10cSrcweir if (m_stop) { 639*cdf0e10cSrcweir return; 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir //all errors should be handeld by the command environment. 642*cdf0e10cSrcweir aUpdateData.sLocalURL = destFolder + OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) + sTitle; 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir } 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir // ------------------------------------------------------------------------------------------------------- 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir UpdateCommandEnv::UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, 651*cdf0e10cSrcweir UpdateInstallDialog & updateDialog, 652*cdf0e10cSrcweir ::rtl::Reference<UpdateInstallDialog::Thread>const & thread) 653*cdf0e10cSrcweir : m_updateDialog( updateDialog ), 654*cdf0e10cSrcweir m_installThread(thread), 655*cdf0e10cSrcweir m_xContext(xCtx) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir UpdateCommandEnv::~UpdateCommandEnv() 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir // XCommandEnvironment 665*cdf0e10cSrcweir //______________________________________________________________________________ 666*cdf0e10cSrcweir cssu::Reference<css::task::XInteractionHandler> UpdateCommandEnv::getInteractionHandler() 667*cdf0e10cSrcweir throw (cssu::RuntimeException) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir return this; 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir //______________________________________________________________________________ 673*cdf0e10cSrcweir cssu::Reference<css::ucb::XProgressHandler> UpdateCommandEnv::getProgressHandler() 674*cdf0e10cSrcweir throw (cssu::RuntimeException) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir return this; 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir // XInteractionHandler 680*cdf0e10cSrcweir void UpdateCommandEnv::handle( 681*cdf0e10cSrcweir cssu::Reference< css::task::XInteractionRequest> const & xRequest ) 682*cdf0e10cSrcweir throw (cssu::RuntimeException) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir cssu::Any request( xRequest->getRequest() ); 685*cdf0e10cSrcweir OSL_ASSERT( request.getValueTypeClass() == cssu::TypeClass_EXCEPTION ); 686*cdf0e10cSrcweir dp_misc::TRACE(OUSTR("[dp_gui_cmdenv.cxx] incoming request:\n") 687*cdf0e10cSrcweir + ::comphelper::anyToString(request) + OUSTR("\n\n")); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir css::deployment::VersionException verExc; 690*cdf0e10cSrcweir bool approve = false; 691*cdf0e10cSrcweir bool abort = false; 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir if (request >>= verExc) 694*cdf0e10cSrcweir { //We must catch the version exception during the update, 695*cdf0e10cSrcweir //because otherwise the user would be confronted with the dialogs, asking 696*cdf0e10cSrcweir //them if they want to replace an already installed version of the same extension. 697*cdf0e10cSrcweir //During an update we assume that we always want to replace the old version with the 698*cdf0e10cSrcweir //new version. 699*cdf0e10cSrcweir approve = true; 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir if (approve == false && abort == false) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir //forward to interaction handler for main dialog. 705*cdf0e10cSrcweir handleInteractionRequest( m_xContext, xRequest ); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir else 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir // select: 710*cdf0e10cSrcweir cssu::Sequence< cssu::Reference< css::task::XInteractionContinuation > > conts( 711*cdf0e10cSrcweir xRequest->getContinuations() ); 712*cdf0e10cSrcweir cssu::Reference< css::task::XInteractionContinuation > const * pConts = 713*cdf0e10cSrcweir conts.getConstArray(); 714*cdf0e10cSrcweir sal_Int32 len = conts.getLength(); 715*cdf0e10cSrcweir for ( sal_Int32 pos = 0; pos < len; ++pos ) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir if (approve) { 718*cdf0e10cSrcweir cssu::Reference< css::task::XInteractionApprove > xInteractionApprove( 719*cdf0e10cSrcweir pConts[ pos ], cssu::UNO_QUERY ); 720*cdf0e10cSrcweir if (xInteractionApprove.is()) { 721*cdf0e10cSrcweir xInteractionApprove->select(); 722*cdf0e10cSrcweir // don't query again for ongoing continuations: 723*cdf0e10cSrcweir approve = false; 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir else if (abort) { 727*cdf0e10cSrcweir cssu::Reference< css::task::XInteractionAbort > xInteractionAbort( 728*cdf0e10cSrcweir pConts[ pos ], cssu::UNO_QUERY ); 729*cdf0e10cSrcweir if (xInteractionAbort.is()) { 730*cdf0e10cSrcweir xInteractionAbort->select(); 731*cdf0e10cSrcweir // don't query again for ongoing continuations: 732*cdf0e10cSrcweir abort = false; 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir // XProgressHandler 740*cdf0e10cSrcweir void UpdateCommandEnv::push( cssu::Any const & /*Status*/ ) 741*cdf0e10cSrcweir throw (cssu::RuntimeException) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir void UpdateCommandEnv::update( cssu::Any const & /*Status */) 747*cdf0e10cSrcweir throw (cssu::RuntimeException) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir void UpdateCommandEnv::pop() throw (cssu::RuntimeException) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir } //end namespace dp_gui 757