1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filepickerstate.hxx,v $
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 //------------------------------------------------------------------------
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
46 #pragma warning(push, 1)
52 //---------------------------------------------
54 //---------------------------------------------
56 class CControlCommand
;
57 class CFileOpenDialog
;
59 //---------------------------------------------
61 //---------------------------------------------
63 class CFilePickerState
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
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;
113 void SAL_CALL
addControlCommand( CControlCommand
* aControlCommand
);
116 CControlCommand
* m_FirstControlCommand
;
119 //---------------------------------------------
120 // this class is not thread-safe
121 //---------------------------------------------
123 class CExecuteFilePickerState
: public CFilePickerState
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
);
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;