1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _FILEPICKERSTATE_HXX_ 25*b1cdbd2cSJim Jagielski #define _FILEPICKERSTATE_HXX_ 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ 28*b1cdbd2cSJim Jagielski // includes 29*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------ 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #include <sal/types.h> 32*b1cdbd2cSJim Jagielski #include "controlcommand.hxx" 33*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/Any.hxx> 34*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/Sequence.hxx> 35*b1cdbd2cSJim Jagielski #include <rtl/ustring.hxx> 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski #define WIN32_LEAN_AND_MEAN 38*b1cdbd2cSJim Jagielski #if defined _MSC_VER 39*b1cdbd2cSJim Jagielski #pragma warning(push, 1) 40*b1cdbd2cSJim Jagielski #endif 41*b1cdbd2cSJim Jagielski #include <windows.h> 42*b1cdbd2cSJim Jagielski #if defined _MSC_VER 43*b1cdbd2cSJim Jagielski #pragma warning(pop) 44*b1cdbd2cSJim Jagielski #endif 45*b1cdbd2cSJim Jagielski //--------------------------------------------- 46*b1cdbd2cSJim Jagielski // 47*b1cdbd2cSJim Jagielski //--------------------------------------------- 48*b1cdbd2cSJim Jagielski 49*b1cdbd2cSJim Jagielski class CControlCommand; 50*b1cdbd2cSJim Jagielski class CFileOpenDialog; 51*b1cdbd2cSJim Jagielski 52*b1cdbd2cSJim Jagielski //--------------------------------------------- 53*b1cdbd2cSJim Jagielski // declaration 54*b1cdbd2cSJim Jagielski //--------------------------------------------- 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski class CFilePickerState 57*b1cdbd2cSJim Jagielski { 58*b1cdbd2cSJim Jagielski public: 59*b1cdbd2cSJim Jagielski virtual ~CFilePickerState( ); 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ) = 0; 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) = 0; 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ) = 0; 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ) = 0; 68*b1cdbd2cSJim Jagielski 69*b1cdbd2cSJim Jagielski virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ) = 0; 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog ) = 0; 72*b1cdbd2cSJim Jagielski 73*b1cdbd2cSJim Jagielski virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) = 0; 74*b1cdbd2cSJim Jagielski }; 75*b1cdbd2cSJim Jagielski 76*b1cdbd2cSJim Jagielski //--------------------------------------------- 77*b1cdbd2cSJim Jagielski // this class is not thread-safe 78*b1cdbd2cSJim Jagielski //--------------------------------------------- 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski class CNonExecuteFilePickerState : public CFilePickerState 81*b1cdbd2cSJim Jagielski { 82*b1cdbd2cSJim Jagielski public: 83*b1cdbd2cSJim Jagielski CNonExecuteFilePickerState( ); 84*b1cdbd2cSJim Jagielski 85*b1cdbd2cSJim Jagielski virtual ~CNonExecuteFilePickerState( ); 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ); 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ); 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim Jagielski virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ); 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ); 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ); 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog ); 98*b1cdbd2cSJim Jagielski 99*b1cdbd2cSJim Jagielski virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ); 100*b1cdbd2cSJim Jagielski 101*b1cdbd2cSJim Jagielski void SAL_CALL reset( ); 102*b1cdbd2cSJim Jagielski 103*b1cdbd2cSJim Jagielski CControlCommand* SAL_CALL getControlCommand( ) const; 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski protected: 106*b1cdbd2cSJim Jagielski void SAL_CALL addControlCommand( CControlCommand* aControlCommand ); 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski private: 109*b1cdbd2cSJim Jagielski CControlCommand* m_FirstControlCommand; 110*b1cdbd2cSJim Jagielski }; 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski //--------------------------------------------- 113*b1cdbd2cSJim Jagielski // this class is not thread-safe 114*b1cdbd2cSJim Jagielski //--------------------------------------------- 115*b1cdbd2cSJim Jagielski 116*b1cdbd2cSJim Jagielski class CExecuteFilePickerState : public CFilePickerState 117*b1cdbd2cSJim Jagielski { 118*b1cdbd2cSJim Jagielski public: 119*b1cdbd2cSJim Jagielski CExecuteFilePickerState( HWND hwndDlg = NULL ); 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ); 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ); 124*b1cdbd2cSJim Jagielski 125*b1cdbd2cSJim Jagielski virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ); 126*b1cdbd2cSJim Jagielski 127*b1cdbd2cSJim Jagielski virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ); 128*b1cdbd2cSJim Jagielski 129*b1cdbd2cSJim Jagielski virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ); 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog ); 132*b1cdbd2cSJim Jagielski 133*b1cdbd2cSJim Jagielski virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ); 134*b1cdbd2cSJim Jagielski 135*b1cdbd2cSJim Jagielski void SAL_CALL initFilePickerControls( CControlCommand* firstControlCommand ); 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski void SAL_CALL cacheControlState( HWND hwndControl, CFilePickerState* aFilePickerState ); 138*b1cdbd2cSJim Jagielski 139*b1cdbd2cSJim Jagielski void SAL_CALL setHwnd( HWND hwndDlg ); 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski private: 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL IsListboxControl( HWND hwndControl ) const; 144*b1cdbd2cSJim Jagielski 145*b1cdbd2cSJim Jagielski inline sal_Int16 SAL_CALL ListboxIdToListboxLabelId( sal_Int16 aListboxId ) const; 146*b1cdbd2cSJim Jagielski 147*b1cdbd2cSJim Jagielski inline HWND SAL_CALL GetListboxLabelItem( sal_Int16 aControlId ) const; 148*b1cdbd2cSJim Jagielski 149*b1cdbd2cSJim Jagielski // returns a hwnd for a control if successful 150*b1cdbd2cSJim Jagielski // if bIncludeStdCtrls is false, the standard file dialog 151*b1cdbd2cSJim Jagielski // controls like OK button, etc. will not be considered 152*b1cdbd2cSJim Jagielski // the function return 0 on failure 153*b1cdbd2cSJim Jagielski HWND SAL_CALL GetHwndDlgItem( sal_Int16 aControlId, sal_Bool bIncludeStdCtrls = sal_True ) const; 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski HWND m_hwndDlg; 156*b1cdbd2cSJim Jagielski }; 157*b1cdbd2cSJim Jagielski 158*b1cdbd2cSJim Jagielski #endif 159