merge the formfield patch from ooo-build
[ooovba.git] / fpicker / source / win32 / filepicker / filepickerstate.hxx
blob2559871c3a873d96f5c6e61363c6f63e9840065f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filepickerstate.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FILEPICKERSTATE_HXX_
32 #define _FILEPICKERSTATE_HXX_
34 //------------------------------------------------------------------------
35 // includes
36 //------------------------------------------------------------------------
38 #include <sal/types.h>
39 #include "controlcommand.hxx"
40 #include <com/sun/star/uno/Any.hxx>
41 #include <com/sun/star/uno/Sequence.hxx>
42 #include <rtl/ustring.hxx>
44 #define WIN32_LEAN_AND_MEAN
45 #if defined _MSC_VER
46 #pragma warning(push, 1)
47 #endif
48 #include <windows.h>
49 #if defined _MSC_VER
50 #pragma warning(pop)
51 #endif
52 //---------------------------------------------
54 //---------------------------------------------
56 class CControlCommand;
57 class CFileOpenDialog;
59 //---------------------------------------------
60 // declaration
61 //---------------------------------------------
63 class CFilePickerState
65 public:
66 virtual ~CFilePickerState( );
68 virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ) = 0;
70 virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) = 0;
72 virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ) = 0;
74 virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ) = 0;
76 virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ) = 0;
78 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog ) = 0;
80 virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) = 0;
83 //---------------------------------------------
84 // this class is not thread-safe
85 //---------------------------------------------
87 class CNonExecuteFilePickerState : public CFilePickerState
89 public:
90 CNonExecuteFilePickerState( );
92 virtual ~CNonExecuteFilePickerState( );
94 virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue );
96 virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction );
98 virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable );
100 virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel );
102 virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId );
104 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog );
106 virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog );
108 void SAL_CALL reset( );
110 CControlCommand* SAL_CALL getControlCommand( ) const;
112 protected:
113 void SAL_CALL addControlCommand( CControlCommand* aControlCommand );
115 private:
116 CControlCommand* m_FirstControlCommand;
119 //---------------------------------------------
120 // this class is not thread-safe
121 //---------------------------------------------
123 class CExecuteFilePickerState : public CFilePickerState
125 public:
126 CExecuteFilePickerState( HWND hwndDlg = NULL );
128 virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue );
130 virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction );
132 virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable );
134 virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel );
136 virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId );
138 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog );
140 virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog );
142 void SAL_CALL initFilePickerControls( CControlCommand* firstControlCommand );
144 void SAL_CALL cacheControlState( HWND hwndControl, CFilePickerState* aFilePickerState );
146 void SAL_CALL setHwnd( HWND hwndDlg );
148 private:
150 inline sal_Bool SAL_CALL IsListboxControl( HWND hwndControl ) const;
152 inline sal_Int16 SAL_CALL ListboxIdToListboxLabelId( sal_Int16 aListboxId ) const;
154 inline HWND SAL_CALL GetListboxLabelItem( sal_Int16 aControlId ) const;
156 // returns a hwnd for a control if successful
157 // if bIncludeStdCtrls is false, the standard file dialog
158 // controls like OK button, etc. will not be considered
159 // the function return 0 on failure
160 HWND SAL_CALL GetHwndDlgItem( sal_Int16 aControlId, sal_Bool bIncludeStdCtrls = sal_True ) const;
162 HWND m_hwndDlg;
165 #endif