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_fpicker.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //------------------------------------------------------------------------ 32*cdf0e10cSrcweir // includes 33*cdf0e10cSrcweir //------------------------------------------------------------------------ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <tchar.h> 36*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 37*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 38*cdf0e10cSrcweir #include <osl/diagnose.h> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #ifndef _FILEPICKER_HXX_ 41*cdf0e10cSrcweir #include "filepicker.hxx" 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #include "WinFileOpenImpl.hxx" 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "FPServiceInfo.hxx" 46*cdf0e10cSrcweir #include "..\misc\WinImplHelper.hxx" 47*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> 48*cdf0e10cSrcweir #include "filepickereventnotification.hxx" 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir #include <comphelper/sequenceasvector.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //------------------------------------------------------------------------ 53*cdf0e10cSrcweir // namespace directives 54*cdf0e10cSrcweir //------------------------------------------------------------------------ 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir using namespace com::sun::star; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs; 59*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::TemplateDescription; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir //------------------------------------------------------------------------ 62*cdf0e10cSrcweir // defines 63*cdf0e10cSrcweir //------------------------------------------------------------------------ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #define FILE_PICKER_DLL_NAME TEXT("fps.dll") 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir //------------------------------------------------------------------------ 68*cdf0e10cSrcweir // helper functions 69*cdf0e10cSrcweir //------------------------------------------------------------------------ 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir namespace 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir // controling event notifications 74*cdf0e10cSrcweir const bool STARTUP_SUSPENDED = true; 75*cdf0e10cSrcweir const bool STARTUP_ALIVE = false; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(2); 80*cdf0e10cSrcweir aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); 81*cdf0e10cSrcweir aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); 82*cdf0e10cSrcweir return aRet; 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 87*cdf0e10cSrcweir // 88*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir CFilePicker::CFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) : 91*cdf0e10cSrcweir cppu::WeakComponentImplHelper10< 92*cdf0e10cSrcweir XFilterManager, 93*cdf0e10cSrcweir XFilterGroupManager, 94*cdf0e10cSrcweir XFilePickerControlAccess, 95*cdf0e10cSrcweir XFilePickerNotifier, 96*cdf0e10cSrcweir XFilePreview, 97*cdf0e10cSrcweir XFilePicker2, 98*cdf0e10cSrcweir lang::XInitialization, 99*cdf0e10cSrcweir util::XCancellable, 100*cdf0e10cSrcweir lang::XEventListener, 101*cdf0e10cSrcweir lang::XServiceInfo>(m_rbHelperMtx), 102*cdf0e10cSrcweir m_xServiceMgr(xServiceMgr), 103*cdf0e10cSrcweir m_aAsyncEventNotifier(rBHelper) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir HINSTANCE hInstance = GetModuleHandle(FILE_PICKER_DLL_NAME); 106*cdf0e10cSrcweir OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // create a default FileOpen dialog without any additional ui elements 109*cdf0e10cSrcweir m_pImpl = std::auto_ptr< CWinFileOpenImpl >( 110*cdf0e10cSrcweir new CWinFileOpenImpl( 111*cdf0e10cSrcweir this, 112*cdf0e10cSrcweir true, 113*cdf0e10cSrcweir 0, 114*cdf0e10cSrcweir 0, 115*cdf0e10cSrcweir hInstance ) ); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 119*cdf0e10cSrcweir // XFPEventListenerManager 120*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir void SAL_CALL CFilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener) 123*cdf0e10cSrcweir throw(uno::RuntimeException) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir if ( rBHelper.bDisposed ) 126*cdf0e10cSrcweir throw lang::DisposedException( 127*cdf0e10cSrcweir rtl::OUString::createFromAscii( "object is already disposed" ), 128*cdf0e10cSrcweir static_cast< XFilePicker2* >( this ) ); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir if ( !rBHelper.bInDispose && !rBHelper.bDisposed ) 131*cdf0e10cSrcweir rBHelper.aLC.addInterface( getCppuType( &xListener ), xListener ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 135*cdf0e10cSrcweir // 136*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir void SAL_CALL CFilePicker::removeFilePickerListener(const uno::Reference<XFilePickerListener>& xListener ) 139*cdf0e10cSrcweir throw(uno::RuntimeException) 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir if ( rBHelper.bDisposed ) 142*cdf0e10cSrcweir throw lang::DisposedException( 143*cdf0e10cSrcweir rtl::OUString::createFromAscii( "object is already disposed" ), 144*cdf0e10cSrcweir static_cast< XFilePicker2* >( this ) ); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir rBHelper.aLC.removeInterface( getCppuType( &xListener ), xListener ); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir // ------------------------------------------------- 150*cdf0e10cSrcweir // XEventListener 151*cdf0e10cSrcweir // ------------------------------------------------- 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir void SAL_CALL CFilePicker::disposing(const lang::EventObject& aEvent) throw(uno::RuntimeException) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir uno::Reference<XFilePickerListener> xFilePickerListener(aEvent.Source, ::com::sun::star::uno::UNO_QUERY); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir if (xFilePickerListener.is()) 158*cdf0e10cSrcweir removeFilePickerListener(xFilePickerListener); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 162*cdf0e10cSrcweir // 163*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir void SAL_CALL CFilePicker::fileSelectionChanged(FilePickerEvent aEvent) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this)); 168*cdf0e10cSrcweir m_aAsyncEventNotifier.notifyEvent( 169*cdf0e10cSrcweir new CFilePickerParamEventNotification(&XFilePickerListener::fileSelectionChanged,aEvent)); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 173*cdf0e10cSrcweir // 174*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir void SAL_CALL CFilePicker::directoryChanged(FilePickerEvent aEvent) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this)); 179*cdf0e10cSrcweir m_aAsyncEventNotifier.notifyEvent( 180*cdf0e10cSrcweir new CFilePickerParamEventNotification(&XFilePickerListener::directoryChanged,aEvent)); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 184*cdf0e10cSrcweir // 185*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void SAL_CALL CFilePicker::controlStateChanged(FilePickerEvent aEvent) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir aEvent.Source = uno::Reference<uno::XInterface>(static_cast<XFilePickerNotifier*>(this)); 190*cdf0e10cSrcweir m_aAsyncEventNotifier.notifyEvent( 191*cdf0e10cSrcweir new CFilePickerParamEventNotification(&XFilePickerListener::controlStateChanged,aEvent)); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 195*cdf0e10cSrcweir // 196*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir void SAL_CALL CFilePicker::dialogSizeChanged() 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir m_aAsyncEventNotifier.notifyEvent( 201*cdf0e10cSrcweir new CFilePickerEventNotification(&XFilePickerListener::dialogSizeChanged)); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 205*cdf0e10cSrcweir // If there are more then one listener the return value of the last one wins 206*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir rtl::OUString SAL_CALL CFilePicker::helpRequested(FilePickerEvent aEvent) const 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir rtl::OUString aHelpText; 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pICHelper = 213*cdf0e10cSrcweir rBHelper.getContainer( getCppuType((uno::Reference<XFilePickerListener>*)0)); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir if (pICHelper) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper iter(*pICHelper); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir while(iter.hasMoreElements()) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir try 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir /* 224*cdf0e10cSrcweir if there are multiple listeners responding 225*cdf0e10cSrcweir to this notification the next response 226*cdf0e10cSrcweir overwrittes the one before if it is not empty 227*cdf0e10cSrcweir */ 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir rtl::OUString temp; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir uno::Reference<XFilePickerListener> xFPListener(iter.next(), uno::UNO_QUERY); 232*cdf0e10cSrcweir if (xFPListener.is()) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir temp = xFPListener->helpRequested(aEvent); 235*cdf0e10cSrcweir if (temp.getLength()) 236*cdf0e10cSrcweir aHelpText = temp; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir catch(uno::RuntimeException&) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir OSL_ENSURE( false, "RuntimeException during event dispatching" ); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir return aHelpText; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir //------------------------------------- 251*cdf0e10cSrcweir // 252*cdf0e10cSrcweir //------------------------------------- 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir bool CFilePicker::startupEventNotification(bool bStartupSuspended) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir return m_aAsyncEventNotifier.startup(bStartupSuspended); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //------------------------------------- 260*cdf0e10cSrcweir // 261*cdf0e10cSrcweir //------------------------------------- 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir void CFilePicker::shutdownEventNotification() 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir m_aAsyncEventNotifier.shutdown(); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir //------------------------------------- 269*cdf0e10cSrcweir // 270*cdf0e10cSrcweir //------------------------------------- 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir void CFilePicker::suspendEventNotification() 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir m_aAsyncEventNotifier.suspend(); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir //------------------------------------- 278*cdf0e10cSrcweir // 279*cdf0e10cSrcweir //------------------------------------- 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir void CFilePicker::resumeEventNotification() 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir m_aAsyncEventNotifier.resume(); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 287*cdf0e10cSrcweir // XFilePicker functions 288*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir void SAL_CALL CFilePicker::setMultiSelectionMode(sal_Bool bMode) throw(uno::RuntimeException) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 293*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 294*cdf0e10cSrcweir m_pImpl->setMultiSelectionMode(bMode); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 298*cdf0e10cSrcweir // 299*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir void SAL_CALL CFilePicker::setTitle(const rtl::OUString& aTitle) throw(uno::RuntimeException) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 304*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 305*cdf0e10cSrcweir m_pImpl->setTitle(aTitle); 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 309*cdf0e10cSrcweir // 310*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir void SAL_CALL CFilePicker::appendFilter(const rtl::OUString& aTitle, const rtl::OUString& aFilter) 313*cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 316*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 317*cdf0e10cSrcweir m_pImpl->appendFilter(aTitle, aFilter); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 321*cdf0e10cSrcweir // 322*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir void SAL_CALL CFilePicker::setCurrentFilter(const rtl::OUString& aTitle) 325*cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 328*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 329*cdf0e10cSrcweir m_pImpl->setCurrentFilter(aTitle); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 333*cdf0e10cSrcweir // 334*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir rtl::OUString SAL_CALL CFilePicker::getCurrentFilter() throw(uno::RuntimeException) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 339*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 340*cdf0e10cSrcweir return m_pImpl->getCurrentFilter(); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 344*cdf0e10cSrcweir // 345*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir void SAL_CALL CFilePicker::appendFilterGroup(const rtl::OUString& sGroupTitle, const uno::Sequence<beans::StringPair>& aFilters) 348*cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 351*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 352*cdf0e10cSrcweir m_pImpl->appendFilterGroup(sGroupTitle, aFilters); 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 356*cdf0e10cSrcweir // 357*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir void SAL_CALL CFilePicker::setDefaultName(const rtl::OUString& aName) 360*cdf0e10cSrcweir throw(uno::RuntimeException) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 363*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 364*cdf0e10cSrcweir m_pImpl->setDefaultName(aName); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 368*cdf0e10cSrcweir // 369*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir void SAL_CALL CFilePicker::setDisplayDirectory(const rtl::OUString& aDirectory) 372*cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 375*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 376*cdf0e10cSrcweir m_pImpl->setDisplayDirectory(aDirectory); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 380*cdf0e10cSrcweir // 381*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir rtl::OUString SAL_CALL CFilePicker::getDisplayDirectory() throw(uno::RuntimeException) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 386*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 387*cdf0e10cSrcweir return m_pImpl->getDisplayDirectory(); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 391*cdf0e10cSrcweir // 392*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL CFilePicker::getFiles() throw(uno::RuntimeException) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 397*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 398*cdf0e10cSrcweir return m_pImpl->getFiles(); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 402*cdf0e10cSrcweir // 403*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 404*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL CFilePicker::getSelectedFiles() throw (uno::RuntimeException) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 407*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir const uno::Sequence< ::rtl::OUString > lSource = m_pImpl->getFiles(); 410*cdf0e10cSrcweir const ::sal_Int32 c = lSource.getLength(); 411*cdf0e10cSrcweir if (c < 2) 412*cdf0e10cSrcweir return lSource; 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir const ::rtl::OUString sPath = lSource[0]; 415*cdf0e10cSrcweir ::comphelper::SequenceAsVector< ::rtl::OUString > lTarget; 416*cdf0e10cSrcweir ::sal_Int32 i = 1; 417*cdf0e10cSrcweir for (i=1; i<c; ++i) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir const ::rtl::OUString sFile = lSource[i]; 420*cdf0e10cSrcweir if (sFile.indexOf ('/') > 0) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir // a) file contains own path ! 423*cdf0e10cSrcweir lTarget.push_back(sFile); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir else 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir // b) file is relative to given path 428*cdf0e10cSrcweir ::rtl::OUStringBuffer sFull(256); 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir sFull.append (sPath); 431*cdf0e10cSrcweir sFull.appendAscii("/" ); 432*cdf0e10cSrcweir sFull.append (sFile); 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir lTarget.push_back(sFull.makeStringAndClear()); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir return lTarget.getAsConstList(); 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 442*cdf0e10cSrcweir // 443*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir sal_Int16 SAL_CALL CFilePicker::execute() throw(uno::RuntimeException) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir sal_Int16 ret; 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir if (startupEventNotification(STARTUP_SUSPENDED)) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir // we should not block in this call else 454*cdf0e10cSrcweir // in the case of an event the client can't 455*cdf0e10cSrcweir // call another function an we run into a 456*cdf0e10cSrcweir // deadlock !!!!! 457*cdf0e10cSrcweir ret = m_pImpl->execute( ); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir shutdownEventNotification(); 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir else 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir OSL_ENSURE(sal_False, "Could not start event notifier thread!"); 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir throw uno::RuntimeException( 466*cdf0e10cSrcweir rtl::OUString::createFromAscii("Error executing dialog"), 467*cdf0e10cSrcweir static_cast<XFilePicker2*>(this)); 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir return ret; 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 474*cdf0e10cSrcweir // XFilePicker functions 475*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir void SAL_CALL CFilePicker::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue) 478*cdf0e10cSrcweir throw(uno::RuntimeException) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 483*cdf0e10cSrcweir m_pImpl->setValue(aControlId, aControlAction, aValue); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 487*cdf0e10cSrcweir // 488*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir uno::Any SAL_CALL CFilePicker::getValue(sal_Int16 aControlId, sal_Int16 aControlAction) 491*cdf0e10cSrcweir throw(uno::RuntimeException) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 496*cdf0e10cSrcweir return m_pImpl->getValue(aControlId, aControlAction); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 500*cdf0e10cSrcweir // 501*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir void SAL_CALL CFilePicker::enableControl(sal_Int16 aControlId, sal_Bool bEnable) 504*cdf0e10cSrcweir throw(uno::RuntimeException) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir OSL_ASSERT( 0 != m_pImpl.get( ) ); 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir osl::MutexGuard aGuard( m_aMutex ); 509*cdf0e10cSrcweir m_pImpl->enableControl( aControlId, bEnable ); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 513*cdf0e10cSrcweir // 514*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir void SAL_CALL CFilePicker::setLabel(sal_Int16 aControlId, const ::rtl::OUString& aLabel) 517*cdf0e10cSrcweir throw (uno::RuntimeException) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 522*cdf0e10cSrcweir m_pImpl->setLabel(aControlId, aLabel); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 526*cdf0e10cSrcweir // 527*cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir rtl::OUString SAL_CALL CFilePicker::getLabel(sal_Int16 aControlId) 530*cdf0e10cSrcweir throw (uno::RuntimeException) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 535*cdf0e10cSrcweir return m_pImpl->getLabel(aControlId); 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 539*cdf0e10cSrcweir // 540*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir uno::Sequence<sal_Int16> SAL_CALL CFilePicker::getSupportedImageFormats() throw (uno::RuntimeException) 543*cdf0e10cSrcweir { 544*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 547*cdf0e10cSrcweir return m_pImpl->getSupportedImageFormats(); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 551*cdf0e10cSrcweir // 552*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir sal_Int32 SAL_CALL CFilePicker::getTargetColorDepth() throw (uno::RuntimeException) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 559*cdf0e10cSrcweir return m_pImpl->getTargetColorDepth(); 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 563*cdf0e10cSrcweir // 564*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir sal_Int32 SAL_CALL CFilePicker::getAvailableWidth() throw (uno::RuntimeException) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 571*cdf0e10cSrcweir return m_pImpl->getAvailableWidth(); 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 575*cdf0e10cSrcweir // 576*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir sal_Int32 SAL_CALL CFilePicker::getAvailableHeight() throw (uno::RuntimeException) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 583*cdf0e10cSrcweir return m_pImpl->getAvailableHeight(); 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 587*cdf0e10cSrcweir // 588*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir void SAL_CALL CFilePicker::setImage(sal_Int16 aImageFormat, const uno::Any& aImage) 591*cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 592*cdf0e10cSrcweir { 593*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 596*cdf0e10cSrcweir m_pImpl->setImage(aImageFormat, aImage); 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 600*cdf0e10cSrcweir // 601*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir sal_Bool SAL_CALL CFilePicker::setShowState(sal_Bool bShowState) throw (uno::RuntimeException) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 608*cdf0e10cSrcweir return m_pImpl->setShowState(bShowState); 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 612*cdf0e10cSrcweir // 613*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir sal_Bool SAL_CALL CFilePicker::getShowState() throw (uno::RuntimeException) 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir OSL_ASSERT(0 != m_pImpl.get()); 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 620*cdf0e10cSrcweir return m_pImpl->getShowState(); 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 624*cdf0e10cSrcweir // 625*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) 628*cdf0e10cSrcweir throw( uno::Exception, uno::RuntimeException) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir // parameter checking 631*cdf0e10cSrcweir uno::Any aAny; 632*cdf0e10cSrcweir if ( 0 == aArguments.getLength( ) ) 633*cdf0e10cSrcweir throw lang::IllegalArgumentException( 634*cdf0e10cSrcweir rtl::OUString::createFromAscii( "no arguments" ), 635*cdf0e10cSrcweir static_cast<XFilePicker2*>(this), 1); 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir aAny = aArguments[0]; 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir if ( (aAny.getValueType() != ::getCppuType((sal_Int16*)0)) && 640*cdf0e10cSrcweir (aAny.getValueType() != ::getCppuType((sal_Int8*)0)) ) 641*cdf0e10cSrcweir throw lang::IllegalArgumentException( 642*cdf0e10cSrcweir rtl::OUString::createFromAscii("invalid argument type"), 643*cdf0e10cSrcweir static_cast<XFilePicker2*>(this), 1); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir sal_Int16 templateId = -1; 646*cdf0e10cSrcweir aAny >>= templateId; 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir sal_Bool bFileOpenDialog = sal_True; 649*cdf0e10cSrcweir sal_uInt32 winResTemplateId = 0; 650*cdf0e10cSrcweir sal_Bool bIsWin2000 = IsWindows2000Platform(); 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir switch ( templateId ) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir case FILEOPEN_SIMPLE: 655*cdf0e10cSrcweir bFileOpenDialog = sal_True; 656*cdf0e10cSrcweir break; 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir case FILESAVE_SIMPLE: 659*cdf0e10cSrcweir bFileOpenDialog = sal_False; 660*cdf0e10cSrcweir break; 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_PASSWORD: 663*cdf0e10cSrcweir bFileOpenDialog = sal_False; 664*cdf0e10cSrcweir if ( bIsWin2000 ) 665*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILESAVE_AUTOEXT_PASSWORD_BOX_ID; 666*cdf0e10cSrcweir else 667*cdf0e10cSrcweir winResTemplateId = TMPL95_FILESAVE_AUTOEXT_PASSWORD_BOX_ID; 668*cdf0e10cSrcweir break; 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: 671*cdf0e10cSrcweir bFileOpenDialog = sal_False; 672*cdf0e10cSrcweir if ( bIsWin2000 ) 673*cdf0e10cSrcweir winResTemplateId = TMPL2000_AUTOEXT_PASSWORD_FILTEROPTION_BOX; 674*cdf0e10cSrcweir else 675*cdf0e10cSrcweir winResTemplateId = TMPL95_AUTOEXT_PASSWORD_FILTEROPTION_BOX; 676*cdf0e10cSrcweir break; 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_SELECTION: 679*cdf0e10cSrcweir bFileOpenDialog = sal_False; 680*cdf0e10cSrcweir if ( bIsWin2000 ) 681*cdf0e10cSrcweir winResTemplateId = TMPL2000_AUTOEXT_SELECTION_BOX; 682*cdf0e10cSrcweir else 683*cdf0e10cSrcweir winResTemplateId = TMPL95_AUTOEXT_SELECTION_BOX; 684*cdf0e10cSrcweir break; 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_TEMPLATE: 687*cdf0e10cSrcweir bFileOpenDialog = sal_False; 688*cdf0e10cSrcweir if ( bIsWin2000 ) 689*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILEOPEN_AUTOEXT_TEMPLATE_BOX_ID; 690*cdf0e10cSrcweir else 691*cdf0e10cSrcweir winResTemplateId = TMPL95_FILEOPEN_AUTOEXT_TEMPLATE_BOX_ID; 692*cdf0e10cSrcweir break; 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: 695*cdf0e10cSrcweir if ( bIsWin2000 ) 696*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILEOPEN_LINK_PREVIEW_BOX_ID; 697*cdf0e10cSrcweir else 698*cdf0e10cSrcweir winResTemplateId = TMPL95_FILEOPEN_LINK_PREVIEW_BOX_ID; 699*cdf0e10cSrcweir break; 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir case FILEOPEN_PLAY: 702*cdf0e10cSrcweir if ( bIsWin2000 ) 703*cdf0e10cSrcweir winResTemplateId = TMPL2000_PLAY_PUSHBUTTON; 704*cdf0e10cSrcweir else 705*cdf0e10cSrcweir winResTemplateId = TMPL95_PLAY_PUSHBUTTON; 706*cdf0e10cSrcweir break; 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir case FILEOPEN_READONLY_VERSION: 709*cdf0e10cSrcweir if ( bIsWin2000 ) 710*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILEOPEN_READONLY_VERSION_BOX_ID; 711*cdf0e10cSrcweir else 712*cdf0e10cSrcweir winResTemplateId = TMPL95_FILEOPEN_READONLY_VERSION_BOX_ID; 713*cdf0e10cSrcweir break; 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir case FILEOPEN_LINK_PREVIEW: 716*cdf0e10cSrcweir if ( bIsWin2000 ) 717*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILEOPEN_LINK_PREVIEW_BOX_SIMPLE_ID; 718*cdf0e10cSrcweir else 719*cdf0e10cSrcweir winResTemplateId = TMPL95_FILEOPEN_LINK_PREVIEW_BOX_SIMPLE_ID; 720*cdf0e10cSrcweir break; 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION: 723*cdf0e10cSrcweir bFileOpenDialog = sal_False; 724*cdf0e10cSrcweir if ( bIsWin2000 ) 725*cdf0e10cSrcweir winResTemplateId = TMPL2000_FILESAVE_AUTOEXT; 726*cdf0e10cSrcweir else 727*cdf0e10cSrcweir winResTemplateId = TMPL95_FILESAVE_AUTOEXT; 728*cdf0e10cSrcweir break; 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir default: 731*cdf0e10cSrcweir throw lang::IllegalArgumentException( 732*cdf0e10cSrcweir rtl::OUString::createFromAscii( "Unknown template" ), 733*cdf0e10cSrcweir static_cast< XFilePicker2* >( this ), 734*cdf0e10cSrcweir 1 ); 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir HINSTANCE hInstance = GetModuleHandle( FILE_PICKER_DLL_NAME ); 738*cdf0e10cSrcweir OSL_POSTCOND( hInstance, "The name of the service dll must have changed" ); 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir // create a new impl-class here based on the 741*cdf0e10cSrcweir // given string, if the given string is empty 742*cdf0e10cSrcweir // we do nothing 743*cdf0e10cSrcweir m_pImpl = std::auto_ptr< CWinFileOpenImpl >( 744*cdf0e10cSrcweir new CWinFileOpenImpl( 745*cdf0e10cSrcweir this, 746*cdf0e10cSrcweir bFileOpenDialog, 747*cdf0e10cSrcweir 0, 748*cdf0e10cSrcweir winResTemplateId, 749*cdf0e10cSrcweir hInstance ) ); 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 753*cdf0e10cSrcweir // 754*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir void SAL_CALL CFilePicker::cancel() 757*cdf0e10cSrcweir throw(uno::RuntimeException) 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir OSL_ASSERT(m_pImpl.get()); 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir osl::MutexGuard aGuard(m_aMutex); 762*cdf0e10cSrcweir m_pImpl->cancel(); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir // ------------------------------------------------- 766*cdf0e10cSrcweir // XServiceInfo 767*cdf0e10cSrcweir // ------------------------------------------------- 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir rtl::OUString SAL_CALL CFilePicker::getImplementationName() 770*cdf0e10cSrcweir throw(uno::RuntimeException) 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir return rtl::OUString::createFromAscii(FILE_PICKER_IMPL_NAME); 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir // ------------------------------------------------- 776*cdf0e10cSrcweir // XServiceInfo 777*cdf0e10cSrcweir // ------------------------------------------------- 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir sal_Bool SAL_CALL CFilePicker::supportsService(const rtl::OUString& ServiceName) 780*cdf0e10cSrcweir throw(uno::RuntimeException ) 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir uno::Sequence <rtl::OUString> SupportedServicesNames = FilePicker_getSupportedServiceNames(); 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir for (sal_Int32 n = SupportedServicesNames.getLength(); n--;) 785*cdf0e10cSrcweir if (SupportedServicesNames[n].compareTo(ServiceName) == 0) 786*cdf0e10cSrcweir return sal_True; 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir return sal_False; 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir // ------------------------------------------------- 792*cdf0e10cSrcweir // XServiceInfo 793*cdf0e10cSrcweir // ------------------------------------------------- 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL CFilePicker::getSupportedServiceNames() 796*cdf0e10cSrcweir throw(uno::RuntimeException) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir return FilePicker_getSupportedServiceNames(); 799*cdf0e10cSrcweir } 800