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 #ifndef _FILEPICKERSTATE_HXX_
25cdf0e10cSrcweir #define _FILEPICKERSTATE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //------------------------------------------------------------------------
28cdf0e10cSrcweir // includes
29cdf0e10cSrcweir //------------------------------------------------------------------------
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <sal/types.h>
32cdf0e10cSrcweir #include "controlcommand.hxx"
33cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
34cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
35cdf0e10cSrcweir #include <rtl/ustring.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN
38cdf0e10cSrcweir #if defined _MSC_VER
39cdf0e10cSrcweir #pragma warning(push, 1)
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <windows.h>
42cdf0e10cSrcweir #if defined _MSC_VER
43cdf0e10cSrcweir #pragma warning(pop)
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir //---------------------------------------------
46cdf0e10cSrcweir //
47cdf0e10cSrcweir //---------------------------------------------
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class CControlCommand;
50cdf0e10cSrcweir class CFileOpenDialog;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //---------------------------------------------
53cdf0e10cSrcweir // declaration
54cdf0e10cSrcweir //---------------------------------------------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class CFilePickerState
57cdf0e10cSrcweir {
58cdf0e10cSrcweir public:
59cdf0e10cSrcweir     virtual ~CFilePickerState( );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue ) = 0;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) = 0;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable ) = 0;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ) = 0;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId ) = 0;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog ) = 0;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) = 0;
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir //---------------------------------------------
77cdf0e10cSrcweir // this class is not thread-safe
78cdf0e10cSrcweir //---------------------------------------------
79cdf0e10cSrcweir 
80cdf0e10cSrcweir class CNonExecuteFilePickerState : public CFilePickerState
81cdf0e10cSrcweir {
82cdf0e10cSrcweir public:
83cdf0e10cSrcweir     CNonExecuteFilePickerState( );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     virtual ~CNonExecuteFilePickerState( );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     void SAL_CALL reset( );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     CControlCommand* SAL_CALL getControlCommand( ) const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir protected:
106cdf0e10cSrcweir     void SAL_CALL addControlCommand( CControlCommand* aControlCommand );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir private:
109cdf0e10cSrcweir     CControlCommand* m_FirstControlCommand;
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir //---------------------------------------------
113cdf0e10cSrcweir // this class is not thread-safe
114cdf0e10cSrcweir //---------------------------------------------
115cdf0e10cSrcweir 
116cdf0e10cSrcweir class CExecuteFilePickerState : public CFilePickerState
117cdf0e10cSrcweir {
118cdf0e10cSrcweir public:
119cdf0e10cSrcweir     CExecuteFilePickerState( HWND hwndDlg = NULL );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( CFileOpenDialog* aFileOpenDialog );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getDisplayDirectory( CFileOpenDialog* aFileOpenDialog );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     void SAL_CALL initFilePickerControls( CControlCommand* firstControlCommand );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     void SAL_CALL cacheControlState( HWND hwndControl, CFilePickerState* aFilePickerState );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     void SAL_CALL setHwnd( HWND hwndDlg );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir private:
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     inline sal_Bool SAL_CALL IsListboxControl( HWND hwndControl ) const;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     inline sal_Int16 SAL_CALL ListboxIdToListboxLabelId( sal_Int16 aListboxId ) const;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     inline HWND SAL_CALL GetListboxLabelItem( sal_Int16 aControlId ) const;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     // returns a hwnd for a control if successful
150cdf0e10cSrcweir 	// if bIncludeStdCtrls is false, the standard file dialog
151cdf0e10cSrcweir 	// controls like OK button, etc. will not be considered
152cdf0e10cSrcweir 	// the function return 0 on failure
153cdf0e10cSrcweir     HWND SAL_CALL GetHwndDlgItem( sal_Int16 aControlId, sal_Bool bIncludeStdCtrls = sal_True ) const;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     HWND m_hwndDlg;
156cdf0e10cSrcweir };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir #endif
159