1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * This file is part of OpenOffice.org. 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 11*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 12*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 15*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 16*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 18*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 19*cdf0e10cSrcweir * 20*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 21*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 22*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 23*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 24*cdf0e10cSrcweir * 25*cdf0e10cSrcweir ************************************************************************/ 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir #include "../unowizard.hxx" 30*cdf0e10cSrcweir #include "wizardshell.hxx" 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir /** === begin UNO includes === **/ 33*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/ucb/AlreadyInitializedException.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XWizardController.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/WizardButton.hpp> 39*cdf0e10cSrcweir /** === end UNO includes === **/ 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 42*cdf0e10cSrcweir #include <rtl/strbuf.hxx> 43*cdf0e10cSrcweir #include <vos/mutex.hxx> 44*cdf0e10cSrcweir #include <vcl/svapp.hxx> 45*cdf0e10cSrcweir #include <tools/urlobj.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //...................................................................................................................... 48*cdf0e10cSrcweir namespace svt { namespace uno 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir //...................................................................................................................... 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir /** === begin UNO using === **/ 53*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 54*cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 55*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 56*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 57*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 58*cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 59*cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 60*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 61*cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 62*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 63*cdf0e10cSrcweir using ::com::sun::star::uno::Type; 64*cdf0e10cSrcweir using ::com::sun::star::lang::XServiceInfo; 65*cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XWizard; 66*cdf0e10cSrcweir using ::com::sun::star::lang::XInitialization; 67*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySetInfo; 68*cdf0e10cSrcweir using ::com::sun::star::uno::XComponentContext; 69*cdf0e10cSrcweir using ::com::sun::star::beans::Property; 70*cdf0e10cSrcweir using ::com::sun::star::lang::IllegalArgumentException; 71*cdf0e10cSrcweir using ::com::sun::star::ucb::AlreadyInitializedException; 72*cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XWizardController; 73*cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XWizardPage; 74*cdf0e10cSrcweir using ::com::sun::star::container::NoSuchElementException; 75*cdf0e10cSrcweir using ::com::sun::star::util::InvalidStateException; 76*cdf0e10cSrcweir using ::com::sun::star::awt::XWindow; 77*cdf0e10cSrcweir /** === end UNO using === **/ 78*cdf0e10cSrcweir namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 81*cdf0e10cSrcweir namespace 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir sal_uInt32 lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir switch ( i_nWizardButton ) 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir case WizardButton::NONE: return WZB_NONE; 88*cdf0e10cSrcweir case WizardButton::NEXT: return WZB_NEXT; 89*cdf0e10cSrcweir case WizardButton::PREVIOUS: return WZB_PREVIOUS; 90*cdf0e10cSrcweir case WizardButton::FINISH: return WZB_FINISH; 91*cdf0e10cSrcweir case WizardButton::CANCEL: return WZB_CANCEL; 92*cdf0e10cSrcweir case WizardButton::HELP: return WZB_HELP; 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); 95*cdf0e10cSrcweir return WZB_NONE; 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir //================================================================================================================== 100*cdf0e10cSrcweir //= Wizard - implementation 101*cdf0e10cSrcweir //================================================================================================================== 102*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 103*cdf0e10cSrcweir Wizard::Wizard( const Reference< XComponentContext >& _rxContext ) 104*cdf0e10cSrcweir :Wizard_Base( _rxContext ) 105*cdf0e10cSrcweir ,m_aContext( _rxContext ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir //-------------------------------------------------------------------- 110*cdf0e10cSrcweir Wizard::~Wizard() 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor, 113*cdf0e10cSrcweir // so this virtual-method-call the base class does does not work, we're already dead then ... 114*cdf0e10cSrcweir if ( m_pDialog ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 117*cdf0e10cSrcweir if ( m_pDialog ) 118*cdf0e10cSrcweir destroyDialog(); 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir //-------------------------------------------------------------------- 123*cdf0e10cSrcweir Reference< XInterface > SAL_CALL Wizard::Create( const Reference< XComponentContext >& _rxContext ) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir return *(new Wizard( _rxContext ) ); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir //-------------------------------------------------------------------- 129*cdf0e10cSrcweir namespace 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir static void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir // need at least one path 134*cdf0e10cSrcweir if ( i_rPaths.getLength() == 0 ) 135*cdf0e10cSrcweir throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // each path must be of length 1, at least 138*cdf0e10cSrcweir for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir if ( i_rPaths[i].getLength() == 0 ) 141*cdf0e10cSrcweir throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir // page IDs must be in ascending order 144*cdf0e10cSrcweir sal_Int16 nPreviousPageID = i_rPaths[i][0]; 145*cdf0e10cSrcweir for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir if ( i_rPaths[i][j] <= nPreviousPageID ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir ::rtl::OStringBuffer message; 150*cdf0e10cSrcweir message.append( "Path " ); 151*cdf0e10cSrcweir message.append( i ); 152*cdf0e10cSrcweir message.append( ": invalid page ID sequence - each page ID must be greater than the previous one." ); 153*cdf0e10cSrcweir throw IllegalArgumentException( 154*cdf0e10cSrcweir ::rtl::OStringToOUString( message.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ), 155*cdf0e10cSrcweir i_rContext, 2 ); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir nPreviousPageID = i_rPaths[i][j]; 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // if we have one path, that's okay 162*cdf0e10cSrcweir if ( i_rPaths.getLength() == 1 ) 163*cdf0e10cSrcweir return; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir // if we have multiple paths, they must start with the same page id 166*cdf0e10cSrcweir const sal_Int16 nFirstPageId = i_rPaths[0][0]; 167*cdf0e10cSrcweir for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir if ( i_rPaths[i][0] != nFirstPageId ) 170*cdf0e10cSrcweir throw IllegalArgumentException( 171*cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "All paths must start with the same page id." ) ), 172*cdf0e10cSrcweir i_rContext, 2 ); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir //-------------------------------------------------------------------- 178*cdf0e10cSrcweir void SAL_CALL Wizard::initialize( const Sequence< Any >& i_Arguments ) throw (Exception, RuntimeException) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 181*cdf0e10cSrcweir if ( m_bInitialized ) 182*cdf0e10cSrcweir throw AlreadyInitializedException( ::rtl::OUString(), *this ); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir if ( i_Arguments.getLength() != 2 ) 185*cdf0e10cSrcweir throw IllegalArgumentException( ::rtl::OUString(), *this, -1 ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir // the second argument must be a XWizardController, for each constructor 188*cdf0e10cSrcweir m_xController.set( i_Arguments[1], UNO_QUERY ); 189*cdf0e10cSrcweir if ( !m_xController.is() ) 190*cdf0e10cSrcweir throw IllegalArgumentException( ::rtl::OUString(), *this, 2 ); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // the first arg is either a single path (short[]), or multiple paths (short[][]) 193*cdf0e10cSrcweir Sequence< sal_Int16 > aSinglePath; 194*cdf0e10cSrcweir i_Arguments[0] >>= aSinglePath; 195*cdf0e10cSrcweir Sequence< Sequence< sal_Int16 > > aMultiplePaths; 196*cdf0e10cSrcweir i_Arguments[0] >>= aMultiplePaths; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir if ( !aMultiplePaths.getLength() ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir aMultiplePaths.realloc(1); 201*cdf0e10cSrcweir aMultiplePaths[0] = aSinglePath; 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir lcl_checkPaths( aMultiplePaths, *this ); 204*cdf0e10cSrcweir // if we survived this, the paths are valid, and we're done here ... 205*cdf0e10cSrcweir m_aWizardSteps = aMultiplePaths; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir m_bInitialized = true; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir static rtl::OString lcl_getHelpId( const ::rtl::OUString& _rHelpURL ) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir INetURLObject aHID( _rHelpURL ); 213*cdf0e10cSrcweir if ( aHID.GetProtocol() == INET_PROT_HID ) 214*cdf0e10cSrcweir return rtl::OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ); 215*cdf0e10cSrcweir else 216*cdf0e10cSrcweir return rtl::OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir //------------------------------------------------------------------------ 220*cdf0e10cSrcweir static ::rtl::OUString lcl_getHelpURL( const rtl::OString& sHelpId ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir ::rtl::OUStringBuffer aBuffer; 223*cdf0e10cSrcweir ::rtl::OUString aTmp( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 ); 224*cdf0e10cSrcweir INetURLObject aHID( aTmp ); 225*cdf0e10cSrcweir if ( aHID.GetProtocol() == INET_PROT_NOT_VALID ) 226*cdf0e10cSrcweir aBuffer.appendAscii( INET_HID_SCHEME ); 227*cdf0e10cSrcweir aBuffer.append( aTmp.getStr() ); 228*cdf0e10cSrcweir return aBuffer.makeStringAndClear(); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir //-------------------------------------------------------------------- 232*cdf0e10cSrcweir Dialog* Wizard::createDialog( Window* i_pParent ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); 235*cdf0e10cSrcweir pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) ); 236*cdf0e10cSrcweir pDialog->setTitleBase( m_sTitle ); 237*cdf0e10cSrcweir return pDialog; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir //-------------------------------------------------------------------- 241*cdf0e10cSrcweir void Wizard::destroyDialog() 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir if ( m_pDialog ) 244*cdf0e10cSrcweir m_sHelpURL = lcl_getHelpURL( m_pDialog->GetHelpId() ); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir Wizard_Base::destroyDialog(); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //-------------------------------------------------------------------- 250*cdf0e10cSrcweir ::rtl::OUString SAL_CALL Wizard::getImplementationName_static() throw(RuntimeException) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.uno.Wizard" ) ); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir //-------------------------------------------------------------------- 256*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames_static() throw(RuntimeException) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir Sequence< ::rtl::OUString > aServices(1); 259*cdf0e10cSrcweir aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Wizard" ) ); 260*cdf0e10cSrcweir return aServices; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir //-------------------------------------------------------------------- 264*cdf0e10cSrcweir ::rtl::OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir return getImplementationName_static(); 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir //-------------------------------------------------------------------- 270*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames() throw(RuntimeException) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir return getSupportedServiceNames_static(); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir //-------------------------------------------------------------------- 276*cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo() throw(RuntimeException) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir return createPropertySetInfo( getInfoHelper() ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir //-------------------------------------------------------------------- 282*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper() 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir return *const_cast< Wizard* >( this )->getArrayHelper(); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir //-------------------------------------------------------------------- 288*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir Sequence< Property > aProps; 291*cdf0e10cSrcweir describeProperties( aProps ); 292*cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper( aProps ); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 296*cdf0e10cSrcweir ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 299*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir if ( !m_pDialog ) 302*cdf0e10cSrcweir return m_sHelpURL; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir return lcl_getHelpURL( m_pDialog->GetHelpId() ); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 308*cdf0e10cSrcweir void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 311*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir if ( !m_pDialog ) 314*cdf0e10cSrcweir m_sHelpURL = i_HelpURL; 315*cdf0e10cSrcweir else 316*cdf0e10cSrcweir m_pDialog->SetHelpId( lcl_getHelpId( i_HelpURL ) ); 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 320*cdf0e10cSrcweir Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 323*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL ); 326*cdf0e10cSrcweir return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY ); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 330*cdf0e10cSrcweir void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 333*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 336*cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 342*cdf0e10cSrcweir void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 345*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 348*cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 354*cdf0e10cSrcweir sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 357*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 360*cdf0e10cSrcweir ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir return pWizardImpl->travelNext(); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 366*cdf0e10cSrcweir sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 369*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 372*cdf0e10cSrcweir ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir return pWizardImpl->travelPrevious(); 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 378*cdf0e10cSrcweir void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 381*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 384*cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir if ( !pWizardImpl->knowsPage( i_PageID ) ) 387*cdf0e10cSrcweir throw NoSuchElementException( ::rtl::OUString(), *this ); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if ( i_PageID == pWizardImpl->getCurrentPage() ) 390*cdf0e10cSrcweir throw InvalidStateException( ::rtl::OUString(), *this ); 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir pWizardImpl->enablePage( i_PageID, i_Enable ); 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 396*cdf0e10cSrcweir void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 399*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 402*cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir pWizardImpl->updateTravelUI(); 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 408*cdf0e10cSrcweir ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 411*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 414*cdf0e10cSrcweir ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir return pWizardImpl->advanceTo( i_PageId ); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 420*cdf0e10cSrcweir ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 423*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 426*cdf0e10cSrcweir ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir return pWizardImpl->goBackTo( i_PageId ); 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 432*cdf0e10cSrcweir Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 435*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 438*cdf0e10cSrcweir ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir return pWizardImpl->getCurrentWizardPage(); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 444*cdf0e10cSrcweir void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 447*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) 450*cdf0e10cSrcweir throw NoSuchElementException( ::rtl::OUString(), *this ); 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); 453*cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir pWizardImpl->activatePath( i_PathIndex, i_Final ); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 459*cdf0e10cSrcweir void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir // simply disambiguate 462*cdf0e10cSrcweir Wizard_Base::OGenericUnoDialog::setTitle( i_Title ); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 466*cdf0e10cSrcweir ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException) 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir return Wizard_Base::OGenericUnoDialog::execute(); 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir //...................................................................................................................... 472*cdf0e10cSrcweir } } // namespace svt::uno 473*cdf0e10cSrcweir //...................................................................................................................... 474