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