xref: /AOO41X/main/fpicker/source/office/OfficeControlAccess.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SVTOOLS_CONTROLACCESS_HXX
29*cdf0e10cSrcweir #define SVTOOLS_CONTROLACCESS_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svtools/fileview.hxx>
32*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
34*cdf0e10cSrcweir #include "pickercallbacks.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //.........................................................................
37*cdf0e10cSrcweir namespace svt
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir //.........................................................................
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 	// --------------------------------------------------------------------
42*cdf0e10cSrcweir 	namespace InternalFilePickerElementIds
43*cdf0e10cSrcweir 	{
44*cdf0e10cSrcweir 		static const sal_Int16 PUSHBUTTON_HELP = (sal_Int16)0x1000;
45*cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_DEFAULT_LOCATION = (sal_Int16)0x1001;
46*cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_LEVEL_UP = (sal_Int16)0x1002;
47*cdf0e10cSrcweir 		static const sal_Int16 TOOLBOXBUTOON_NEW_FOLDER = (sal_Int16)0x1003;
48*cdf0e10cSrcweir 		static const sal_Int16 FIXEDTEXT_CURRENTFOLDER = (sal_Int16)0x1004;
49*cdf0e10cSrcweir 	}
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 	// --------------------------------------------------------------------
52*cdf0e10cSrcweir 	/**	implements the XControlAccess, XControlInformation and XFilePickerControlAccess for the file picker
53*cdf0e10cSrcweir 	*/
54*cdf0e10cSrcweir 	class OControlAccess
55*cdf0e10cSrcweir 	{
56*cdf0e10cSrcweir 		IFilePickerController*	m_pFilePickerController;
57*cdf0e10cSrcweir 		SvtFileView*			m_pFileView;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	public:
60*cdf0e10cSrcweir 		OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 		// XControlAccess implementation
63*cdf0e10cSrcweir 		void setControlProperty( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty, const ::com::sun::star::uno::Any& _rValue );
64*cdf0e10cSrcweir 		::com::sun::star::uno::Any	getControlProperty( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty );
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 		// XControlInformation implementation
67*cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString >	getSupportedControls(  );
68*cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString >	getSupportedControlProperties( const ::rtl::OUString& _rControlName );
69*cdf0e10cSrcweir 		sal_Bool											isControlSupported( const ::rtl::OUString& _rControlName );
70*cdf0e10cSrcweir 		sal_Bool											isControlPropertySupported( const ::rtl::OUString& _rControlName, const ::rtl::OUString& _rControlProperty );
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir 		// XFilePickerControlAccess
73*cdf0e10cSrcweir 		void						setValue( sal_Int16 _nId, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
74*cdf0e10cSrcweir 		::com::sun::star::uno::Any  getValue( sal_Int16 _nId, sal_Int16 _nCtrlAction ) const;
75*cdf0e10cSrcweir 		void						setLabel( sal_Int16 _nId, const ::rtl::OUString& _rValue );
76*cdf0e10cSrcweir 		::rtl::OUString             getLabel( sal_Int16 _nId ) const;
77*cdf0e10cSrcweir 		void                        enableControl( sal_Int16 _nId, sal_Bool _bEnable );
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 		static void				setHelpURL( Window* _pControl, const ::rtl::OUString& _rURL, sal_Bool _bFileView );
80*cdf0e10cSrcweir 		static ::rtl::OUString	getHelpURL( Window* _pControl, sal_Bool _bFileView );
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	private:
83*cdf0e10cSrcweir 		/** implements the various methods for setting properties on controls
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir             @param _nControlId
86*cdf0e10cSrcweir                 the id of the control
87*cdf0e10cSrcweir 			@param _pControl
88*cdf0e10cSrcweir 				the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
89*cdf0e10cSrcweir 			@param _nProperty
90*cdf0e10cSrcweir 				the property to set
91*cdf0e10cSrcweir 				See PROPERTY_FLAG_*
92*cdf0e10cSrcweir 			@param _rValue
93*cdf0e10cSrcweir 				the value to set
94*cdf0e10cSrcweir 			@param _bIgnoreIllegalArgument
95*cdf0e10cSrcweir 				if <FALSE/>, an exception will be thrown if the given value is of improper type
96*cdf0e10cSrcweir 		*/
97*cdf0e10cSrcweir 		void						implSetControlProperty(
98*cdf0e10cSrcweir                                         sal_Int16 _nControlId,
99*cdf0e10cSrcweir 										Control* _pControl, sal_Int16 _nProperty, const ::com::sun::star::uno::Any& _rValue,
100*cdf0e10cSrcweir 										sal_Bool _bIgnoreIllegalArgument = sal_True );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 		Control* implGetControl( const ::rtl::OUString& _rControlName, sal_Int16* _pId = NULL, sal_Int32* _pPropertyMask = NULL ) const SAL_THROW( (::com::sun::star::lang::IllegalArgumentException) );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 		/** implements the various methods for retrieving properties from controls
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 			@param _pControl
107*cdf0e10cSrcweir 				the affected control
108*cdf0e10cSrcweir 				@PRECOND not <NULL/>
109*cdf0e10cSrcweir 			@param _nProperty
110*cdf0e10cSrcweir 				the property to retrieve
111*cdf0e10cSrcweir 				See PROPERTY_FLAG_*
112*cdf0e10cSrcweir 			@return
113*cdf0e10cSrcweir 		*/
114*cdf0e10cSrcweir 		::com::sun::star::uno::Any	implGetControlProperty( Control* _pControl, sal_Int16 _nProperty ) const;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 		void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	};
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir //.........................................................................
121*cdf0e10cSrcweir }	// namespace svt
122*cdf0e10cSrcweir //.........................................................................
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir #endif // SVTOOLS_CONTROLACCESS_HXX
125*cdf0e10cSrcweir 
126