1*10ce8018SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*10ce8018SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*10ce8018SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*10ce8018SAndrew Rist * distributed with this work for additional information 6*10ce8018SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*10ce8018SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*10ce8018SAndrew Rist * "License"); you may not use this file except in compliance 9*10ce8018SAndrew Rist * with the License. You may obtain a copy of the License at 10*10ce8018SAndrew Rist * 11*10ce8018SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*10ce8018SAndrew Rist * 13*10ce8018SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*10ce8018SAndrew Rist * software distributed under the License is distributed on an 15*10ce8018SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*10ce8018SAndrew Rist * KIND, either express or implied. See the License for the 17*10ce8018SAndrew Rist * specific language governing permissions and limitations 18*10ce8018SAndrew Rist * under the License. 19*10ce8018SAndrew Rist * 20*10ce8018SAndrew Rist *************************************************************/ 21*10ce8018SAndrew Rist 22*10ce8018SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef _WINFILEOPENIMPL_HXX_ 26cdf0e10cSrcweir #define _WINFILEOPENIMPL_HXX_ 27cdf0e10cSrcweir 28cdf0e10cSrcweir //------------------------------------------------------------------------ 29cdf0e10cSrcweir // includes 30cdf0e10cSrcweir //------------------------------------------------------------------------ 31cdf0e10cSrcweir 32cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_XEXTENDEDFILEPICKER_HPP_ 33cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/FilePickerEvent.hpp> 36cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> 37cdf0e10cSrcweir #include "FilterContainer.hxx" 38cdf0e10cSrcweir #include "FileOpenDlg.hxx" 39cdf0e10cSrcweir #include "previewadapter.hxx" 40cdf0e10cSrcweir #include "helppopupwindow.hxx" 41cdf0e10cSrcweir #include "customcontrol.hxx" 42cdf0e10cSrcweir #include "customcontrolfactory.hxx" 43cdf0e10cSrcweir #include "..\misc\resourceprovider.hxx" 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include <utility> 46cdf0e10cSrcweir #include <memory> 47cdf0e10cSrcweir #include <vector> 48cdf0e10cSrcweir #include <osl/conditn.hxx> 49cdf0e10cSrcweir 50cdf0e10cSrcweir //------------------------------------------------------------------------ 51cdf0e10cSrcweir // deklarations 52cdf0e10cSrcweir //------------------------------------------------------------------------ 53cdf0e10cSrcweir 54cdf0e10cSrcweir // forward declaration 55cdf0e10cSrcweir class CFilePicker; 56cdf0e10cSrcweir class CFilePickerState; 57cdf0e10cSrcweir class CExecuteFilePickerState; 58cdf0e10cSrcweir class CNonExecuteFilePickerState; 59cdf0e10cSrcweir 60cdf0e10cSrcweir class CWinFileOpenImpl : public CFileOpenDialog 61cdf0e10cSrcweir { 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir CWinFileOpenImpl( 64cdf0e10cSrcweir CFilePicker* aFilePicker, 65cdf0e10cSrcweir sal_Bool bFileOpenDialog = sal_True, 66cdf0e10cSrcweir sal_uInt32 dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 67cdf0e10cSrcweir sal_uInt32 dwTemplateId = 0, 68cdf0e10cSrcweir HINSTANCE hInstance = 0 ); 69cdf0e10cSrcweir 70cdf0e10cSrcweir virtual ~CWinFileOpenImpl( ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 73cdf0e10cSrcweir // XExecutableDialog 74cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 75cdf0e10cSrcweir 76cdf0e10cSrcweir virtual sal_Int16 SAL_CALL execute( ) throw( ::com::sun::star::uno::RuntimeException ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 79cdf0e10cSrcweir // XFilePicker 80cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual void SAL_CALL setDefaultName( const ::rtl::OUString& aName ) 83cdf0e10cSrcweir throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( ) 86cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory ) 89cdf0e10cSrcweir throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getDisplayDirectory( ) throw ( ::com::sun::star::uno::RuntimeException ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 94cdf0e10cSrcweir // XFilterManager 95cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual void SAL_CALL appendFilter( const ::rtl::OUString& aTitle, const ::rtl::OUString& aFilter ) 98cdf0e10cSrcweir throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& aTitle ) 101cdf0e10cSrcweir throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getCurrentFilter( ) 104cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 107cdf0e10cSrcweir // XFilterGroupManager 108cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 109cdf0e10cSrcweir 110cdf0e10cSrcweir virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters ) 111cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 114cdf0e10cSrcweir // XFilePickerControlAccess 115cdf0e10cSrcweir //----------------------------------------------------------------------------------------- 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ) 118cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) 121cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ) 124cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ) 127cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir 129cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ) 130cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir //------------------------------------------------ 133cdf0e10cSrcweir // XFilePreview 134cdf0e10cSrcweir //------------------------------------------------ 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) 137cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 138cdf0e10cSrcweir 139cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getTargetColorDepth( ) 140cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir 142cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAvailableWidth( ) 143cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 144cdf0e10cSrcweir 145cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAvailableHeight( ) 146cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 147cdf0e10cSrcweir 148cdf0e10cSrcweir virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& aImage ) 149cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 150cdf0e10cSrcweir 151cdf0e10cSrcweir virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) 152cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 153cdf0e10cSrcweir 154cdf0e10cSrcweir virtual sal_Bool SAL_CALL getShowState( ) 155cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 156cdf0e10cSrcweir 157cdf0e10cSrcweir //------------------------------------------------ 158cdf0e10cSrcweir // XCancelable 159cdf0e10cSrcweir //------------------------------------------------ 160cdf0e10cSrcweir 161cdf0e10cSrcweir virtual void SAL_CALL cancel( ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir //------------------------------------------------ 164cdf0e10cSrcweir // Implementation details 165cdf0e10cSrcweir //------------------------------------------------ 166cdf0e10cSrcweir 167cdf0e10cSrcweir protected: 168cdf0e10cSrcweir sal_Int16 SAL_CALL getFocused( ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir virtual bool SAL_CALL preModal( ); 171cdf0e10cSrcweir virtual void SAL_CALL postModal( sal_Int16 nDialogResult ); 172cdf0e10cSrcweir 173cdf0e10cSrcweir virtual sal_uInt32 SAL_CALL onFileOk(); 174cdf0e10cSrcweir virtual void SAL_CALL onSelChanged( HWND hwndListBox ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir // only called back if OFN_EXPLORER is set 177cdf0e10cSrcweir virtual void SAL_CALL onInitDone(); 178cdf0e10cSrcweir virtual void SAL_CALL onFolderChanged(); 179cdf0e10cSrcweir virtual void SAL_CALL onTypeChanged( sal_uInt32 nFilterIndex ); 180cdf0e10cSrcweir 181cdf0e10cSrcweir // call base class method first when overloading 182cdf0e10cSrcweir virtual void SAL_CALL onInitDialog( HWND hwndDlg ); 183cdf0e10cSrcweir 184cdf0e10cSrcweir virtual sal_uInt32 SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode ); 185cdf0e10cSrcweir 186cdf0e10cSrcweir 187cdf0e10cSrcweir void onWMSize(); 188cdf0e10cSrcweir void onWMShow(sal_Bool bShow); 189cdf0e10cSrcweir void onWMWindowPosChanged(); 190cdf0e10cSrcweir void onCustomControlHelpRequest(LPHELPINFO lphi); 191cdf0e10cSrcweir 192cdf0e10cSrcweir private: 193cdf0e10cSrcweir inline void SAL_CALL appendFilterGroupSeparator( ); 194cdf0e10cSrcweir 195cdf0e10cSrcweir inline sal_Bool SAL_CALL IsCustomControlHelpRequested(LPHELPINFO lphi) const; 196cdf0e10cSrcweir 197cdf0e10cSrcweir void EnlargeStdControlLabels() const; 198cdf0e10cSrcweir 199cdf0e10cSrcweir // initialize all controls from cache 200cdf0e10cSrcweir void SAL_CALL InitControlLabel( HWND hWnd ); 201cdf0e10cSrcweir void SAL_CALL InitCustomControlContainer(HWND hCustomControl); 202cdf0e10cSrcweir 203cdf0e10cSrcweir // save the control state 204cdf0e10cSrcweir void SAL_CALL CacheControlState(HWND hWnd); 205cdf0e10cSrcweir 206cdf0e10cSrcweir void SAL_CALL SetDefaultExtension(); 207cdf0e10cSrcweir void SAL_CALL InitialSetDefaultName(); 208cdf0e10cSrcweir 209cdf0e10cSrcweir static LRESULT CALLBACK SubClassFunc(HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam); 210cdf0e10cSrcweir 211cdf0e10cSrcweir static BOOL CALLBACK EnumChildWndProc( HWND hWnd, LPARAM lParam ); 212cdf0e10cSrcweir 213cdf0e10cSrcweir private: 214cdf0e10cSrcweir std::auto_ptr<CFilterContainer> m_filterContainer; 215cdf0e10cSrcweir std::auto_ptr<CPreviewAdapter> m_Preview; 216cdf0e10cSrcweir std::auto_ptr<CCustomControlFactory> m_CustomControlFactory; 217cdf0e10cSrcweir std::auto_ptr<CCustomControl> m_CustomControls; 218cdf0e10cSrcweir CFilePicker* m_FilePicker; 219cdf0e10cSrcweir WNDPROC m_pfnOldDlgProc; 220cdf0e10cSrcweir rtl::OUString m_defaultName; 221cdf0e10cSrcweir sal_Bool m_bInitialSelChanged; 222cdf0e10cSrcweir CHelpPopupWindow m_HelpPopupWindow; 223cdf0e10cSrcweir CFilePickerState* m_FilePickerState; 224cdf0e10cSrcweir CExecuteFilePickerState* m_ExecuteFilePickerState; 225cdf0e10cSrcweir CNonExecuteFilePickerState* m_NonExecuteFilePickerState; 226cdf0e10cSrcweir CResourceProvider m_ResProvider; 227cdf0e10cSrcweir }; 228cdf0e10cSrcweir 229cdf0e10cSrcweir 230cdf0e10cSrcweir #endif 231