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 SVTOOLS_CONTROLACCESS_HXX
25cdf0e10cSrcweir #define SVTOOLS_CONTROLACCESS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/fileview.hxx>
28cdf0e10cSrcweir #include <vcl/lstbox.hxx>
29cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
30cdf0e10cSrcweir #include "pickercallbacks.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //.........................................................................
33cdf0e10cSrcweir namespace svt
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //.........................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	// --------------------------------------------------------------------
38cdf0e10cSrcweir 	namespace InternalFilePickerElementIds
39cdf0e10cSrcweir 	{
40cdf0e10cSrcweir 		static const sal_Int16 PUSHBUTTON_HELP = (sal_Int16)0x1000;
41cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_DEFAULT_LOCATION = (sal_Int16)0x1001;
42cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_LEVEL_UP = (sal_Int16)0x1002;
43cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_NEW_FOLDER = (sal_Int16)0x1003;
44cdf0e10cSrcweir 		static const sal_Int16 FIXEDTEXT_CURRENTFOLDER = (sal_Int16)0x1004;
45cdf0e10cSrcweir 	}
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	// --------------------------------------------------------------------
48cdf0e10cSrcweir 	/**	implements the XControlAccess, XControlInformation and XFilePickerControlAccess for the file picker
49cdf0e10cSrcweir 	*/
50cdf0e10cSrcweir 	class OControlAccess
51cdf0e10cSrcweir 	{
52cdf0e10cSrcweir 		IFilePickerController*	m_pFilePickerController;
53cdf0e10cSrcweir 		SvtFileView*			m_pFileView;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	public:
56cdf0e10cSrcweir 		OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		// XControlAccess implementation
59cdf0e10cSrcweir 		void setControlProperty( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty, const ::com::sun::star::uno::Any& _rValue );
60cdf0e10cSrcweir 		::com::sun::star::uno::Any	getControlProperty( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 		// XControlInformation implementation
63cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString >	getSupportedControls(  );
64cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString >	getSupportedControlProperties( const ::rtl::OUString& _rControlName );
65cdf0e10cSrcweir 		sal_Bool											isControlSupported( const ::rtl::OUString& _rControlName );
66cdf0e10cSrcweir 		sal_Bool											isControlPropertySupported( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty );
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 		// XFilePickerControlAccess
69cdf0e10cSrcweir 		void						setValue( sal_Int16 _nId, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
70cdf0e10cSrcweir 		::com::sun::star::uno::Any  getValue( sal_Int16 _nId, sal_Int16 _nCtrlAction ) const;
71cdf0e10cSrcweir 		void						setLabel( sal_Int16 _nId, const ::rtl::OUString& _rValue );
72cdf0e10cSrcweir 		::rtl::OUString             getLabel( sal_Int16 _nId ) const;
73cdf0e10cSrcweir 		void                        enableControl( sal_Int16 _nId, sal_Bool _bEnable );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		static void				setHelpURL( Window* _pControl, const ::rtl::OUString& _rURL, sal_Bool _bFileView );
76cdf0e10cSrcweir 		static ::rtl::OUString	getHelpURL( Window* _pControl, sal_Bool _bFileView );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	private:
79cdf0e10cSrcweir 		/** implements the various methods for setting properties on controls
80cdf0e10cSrcweir 
81cdf0e10cSrcweir             @param _nControlId
82cdf0e10cSrcweir                 the id of the control
83cdf0e10cSrcweir 			@param _pControl
84cdf0e10cSrcweir 				the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
85cdf0e10cSrcweir 			@param _nProperty
86cdf0e10cSrcweir 				the property to set
87cdf0e10cSrcweir 				See PROPERTY_FLAG_*
88cdf0e10cSrcweir 			@param _rValue
89cdf0e10cSrcweir 				the value to set
90cdf0e10cSrcweir 			@param _bIgnoreIllegalArgument
91cdf0e10cSrcweir 				if <FALSE/>, an exception will be thrown if the given value is of improper type
92cdf0e10cSrcweir 		*/
93cdf0e10cSrcweir 		void						implSetControlProperty(
94cdf0e10cSrcweir                                         sal_Int16 _nControlId,
95cdf0e10cSrcweir 										Control* _pControl, sal_Int16 _nProperty, const ::com::sun::star::uno::Any& _rValue,
96cdf0e10cSrcweir 										sal_Bool _bIgnoreIllegalArgument = sal_True );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 		Control* implGetControl( const ::rtl::OUString& _rControlName, sal_Int16* _pId = NULL, sal_Int32* _pPropertyMask = NULL ) const SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 		/** implements the various methods for retrieving properties from controls
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 			@param _pControl
103cdf0e10cSrcweir 				the affected control
104cdf0e10cSrcweir 				@PRECOND not <NULL/>
105cdf0e10cSrcweir 			@param _nProperty
106cdf0e10cSrcweir 				the property to retrieve
107cdf0e10cSrcweir 				See PROPERTY_FLAG_*
108cdf0e10cSrcweir 			@return
109cdf0e10cSrcweir 		*/
110cdf0e10cSrcweir 		::com::sun::star::uno::Any	implGetControlProperty( Control* _pControl, sal_Int16 _nProperty ) const;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	};
115cdf0e10cSrcweir 
116cdf0e10cSrcweir //.........................................................................
117cdf0e10cSrcweir }	// namespace svt
118cdf0e10cSrcweir //.........................................................................
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #endif // SVTOOLS_CONTROLACCESS_HXX
121cdf0e10cSrcweir 
122