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