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 #ifndef FPICKER_WIN32_VISTA_FILEPICKER_HXX 29*cdf0e10cSrcweir #define FPICKER_WIN32_VISTA_FILEPICKER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //----------------------------------------------------------------------------- 32*cdf0e10cSrcweir // includes 33*cdf0e10cSrcweir //----------------------------------------------------------------------------- 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "asyncrequests.hxx" 36*cdf0e10cSrcweir #include "VistaFilePickerImpl.hxx" 37*cdf0e10cSrcweir #include "VistaFilePickerEventHandler.hxx" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker2.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePreview.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/util/XCancellable.hpp> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include <cppuhelper/compbase10.hxx> 52*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 53*cdf0e10cSrcweir #include <rtl/ustring.hxx> 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir //----------------------------------------------------------------------------- 56*cdf0e10cSrcweir // namespace 57*cdf0e10cSrcweir //----------------------------------------------------------------------------- 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #ifdef css 60*cdf0e10cSrcweir #error "Clash on using CSS as namespace define." 61*cdf0e10cSrcweir #else 62*cdf0e10cSrcweir #define css ::com::sun::star 63*cdf0e10cSrcweir #endif 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir namespace fpicker{ 66*cdf0e10cSrcweir namespace win32{ 67*cdf0e10cSrcweir namespace vista{ 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir //----------------------------------------------------------------------------- 70*cdf0e10cSrcweir // types 71*cdf0e10cSrcweir //----------------------------------------------------------------------------- 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper10< 74*cdf0e10cSrcweir css::ui::dialogs::XFilePicker2, 75*cdf0e10cSrcweir css::ui::dialogs::XFilterManager, 76*cdf0e10cSrcweir css::ui::dialogs::XFilterGroupManager, 77*cdf0e10cSrcweir css::ui::dialogs::XFilePickerControlAccess, 78*cdf0e10cSrcweir css::ui::dialogs::XFilePickerNotifier, 79*cdf0e10cSrcweir css::ui::dialogs::XFilePreview, 80*cdf0e10cSrcweir css::lang::XInitialization, 81*cdf0e10cSrcweir css::util::XCancellable, 82*cdf0e10cSrcweir css::lang::XEventListener, 83*cdf0e10cSrcweir css::lang::XServiceInfo > TVistaFilePickerBase; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir //----------------------------------------------------------------------------- 86*cdf0e10cSrcweir /** Implements the XFilePicker & friends interface(s) 87*cdf0e10cSrcweir for Windos Vista and upcoming versions. 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir Note: This will be an UNO wrapper for the real file picker 90*cdf0e10cSrcweir implementation oly. The real implementation is done in class 91*cdf0e10cSrcweir VistaFilePickerImpl. 92*cdf0e10cSrcweir */ 93*cdf0e10cSrcweir class VistaFilePicker : public ::cppu::BaseMutex 94*cdf0e10cSrcweir , public TVistaFilePickerBase 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir public: 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 99*cdf0e10cSrcweir // ctor/dtor 100*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir VistaFilePicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); 103*cdf0e10cSrcweir virtual ~VistaFilePicker(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 106*cdf0e10cSrcweir // XFilePickerNotifier 107*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) 110*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) 113*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 116*cdf0e10cSrcweir // XExecutableDialog functions 117*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) 120*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir virtual sal_Int16 SAL_CALL execute( ) 123*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 126*cdf0e10cSrcweir // XFilePicker functions 127*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) 130*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir virtual void SAL_CALL setDefaultName( const ::rtl::OUString& sName ) 133*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& sDirectory ) 136*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, 137*cdf0e10cSrcweir css::uno::RuntimeException ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getDisplayDirectory( ) 140*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( ) 143*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 146*cdf0e10cSrcweir // XFilePicker2 functions 147*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedFiles( ) 150*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 153*cdf0e10cSrcweir // XFilterManager functions 154*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir virtual void SAL_CALL appendFilter( const ::rtl::OUString& sTitle , 157*cdf0e10cSrcweir const ::rtl::OUString& sFilter ) 158*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, 159*cdf0e10cSrcweir css::uno::RuntimeException ); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& sTitle ) 162*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, 163*cdf0e10cSrcweir css::uno::RuntimeException ); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getCurrentFilter( ) 166*cdf0e10cSrcweir throw( css::uno::RuntimeException ); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 169*cdf0e10cSrcweir // XFilterGroupManager functions 170*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, 173*cdf0e10cSrcweir const css::uno::Sequence< css::beans::StringPair >& lFilters ) 174*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, 175*cdf0e10cSrcweir css::uno::RuntimeException ); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 178*cdf0e10cSrcweir // XFilePickerControlAccess functions 179*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir virtual void SAL_CALL setValue( sal_Int16 nControlId , 182*cdf0e10cSrcweir sal_Int16 nControlAction, 183*cdf0e10cSrcweir const css::uno::Any& aValue ) 184*cdf0e10cSrcweir throw (css::uno::RuntimeException); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId , 187*cdf0e10cSrcweir sal_Int16 nControlAction ) 188*cdf0e10cSrcweir throw (css::uno::RuntimeException); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir virtual void SAL_CALL enableControl( sal_Int16 nControlId, 191*cdf0e10cSrcweir sal_Bool bEnable ) 192*cdf0e10cSrcweir throw(css::uno::RuntimeException ); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir virtual void SAL_CALL setLabel( sal_Int16 nControlId, 195*cdf0e10cSrcweir const ::rtl::OUString& sLabel ) 196*cdf0e10cSrcweir throw (css::uno::RuntimeException); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) 199*cdf0e10cSrcweir throw (css::uno::RuntimeException); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir //------------------------------------------------ 202*cdf0e10cSrcweir // XFilePreview 203*cdf0e10cSrcweir //------------------------------------------------ 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) 206*cdf0e10cSrcweir throw (css::uno::RuntimeException); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getTargetColorDepth( ) 209*cdf0e10cSrcweir throw (css::uno::RuntimeException); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAvailableWidth( ) 212*cdf0e10cSrcweir throw (css::uno::RuntimeException); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAvailableHeight( ) 215*cdf0e10cSrcweir throw (css::uno::RuntimeException); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir virtual void SAL_CALL setImage( sal_Int16 nImageFormat, 218*cdf0e10cSrcweir const css::uno::Any& aImage ) 219*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) 222*cdf0e10cSrcweir throw (css::uno::RuntimeException); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir virtual sal_Bool SAL_CALL getShowState( ) 225*cdf0e10cSrcweir throw (css::uno::RuntimeException); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir //------------------------------------------------ 228*cdf0e10cSrcweir // XInitialization 229*cdf0e10cSrcweir //------------------------------------------------ 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) 232*cdf0e10cSrcweir throw(css::uno::Exception , 233*cdf0e10cSrcweir css::uno::RuntimeException); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir //------------------------------------------------ 236*cdf0e10cSrcweir // XCancellable 237*cdf0e10cSrcweir //------------------------------------------------ 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir virtual void SAL_CALL cancel( ) 240*cdf0e10cSrcweir throw(css::uno::RuntimeException); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir //------------------------------------------------ 243*cdf0e10cSrcweir // XEventListener 244*cdf0e10cSrcweir //------------------------------------------------ 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) 247*cdf0e10cSrcweir throw(css::uno::RuntimeException); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //------------------------------------------------ 250*cdf0e10cSrcweir // XServiceInfo 251*cdf0e10cSrcweir //------------------------------------------------ 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) 254*cdf0e10cSrcweir throw(css::uno::RuntimeException); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 257*cdf0e10cSrcweir throw(css::uno::RuntimeException); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 260*cdf0e10cSrcweir throw(css::uno::RuntimeException); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /* 263*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 264*cdf0e10cSrcweir // FilePicker Event functions 265*cdf0e10cSrcweir //------------------------------------------------------------------------------------ 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir void SAL_CALL fileSelectionChanged(const css::ui::dialogs::FilePickerEvent& aEvent ); 268*cdf0e10cSrcweir void SAL_CALL directoryChanged(const css::ui::dialogs::FilePickerEvent& aEvent ); 269*cdf0e10cSrcweir ::rtl::OUString SAL_CALL helpRequested(const css::ui::dialogs::FilePickerEvent& aEvent ) const; 270*cdf0e10cSrcweir void SAL_CALL controlStateChanged(const css::ui::dialogs::FilePickerEvent& aEvent ); 271*cdf0e10cSrcweir void SAL_CALL dialogSizeChanged( ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir bool startupEventNotification(bool bStartupSuspended); 274*cdf0e10cSrcweir void shutdownEventNotification(); 275*cdf0e10cSrcweir void suspendEventNotification(); 276*cdf0e10cSrcweir void resumeEventNotification(); 277*cdf0e10cSrcweir */ 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir private: 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // prevent copy and assignment 282*cdf0e10cSrcweir VistaFilePicker( const VistaFilePicker& ); 283*cdf0e10cSrcweir VistaFilePicker& operator=( const VistaFilePicker& ); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir using WeakComponentImplHelperBase::disposing; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir private: 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir //--------------------------------------------------------------------- 290*cdf0e10cSrcweir /// service manager to create own used uno services 291*cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir //--------------------------------------------------------------------- 294*cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > m_lLastFiles; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir //--------------------------------------------------------------------- 297*cdf0e10cSrcweir /** execute the COM dialog within a STA thread 298*cdf0e10cSrcweir * Must be used on the heap ... because it's implemented as OSL thread .-) 299*cdf0e10cSrcweir */ 300*cdf0e10cSrcweir RequestHandlerRef m_rDialog; 301*cdf0e10cSrcweir AsyncRequests m_aAsyncExecute; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir //--------------------------------------------------------------------- 304*cdf0e10cSrcweir oslThreadIdentifier m_nFilePickerThreadId; 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir bool m_bInitialized; 307*cdf0e10cSrcweir }; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir } // namespace vista 310*cdf0e10cSrcweir } // namespace win32 311*cdf0e10cSrcweir } // namespace fpicker 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir #undef css 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir #endif // FPICKER_WIN32_VISTA_FILEPICKER_HXX 316