Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_OFFICECONTROLACCESS_HXX
21 : #define INCLUDED_FPICKER_SOURCE_OFFICE_OFFICECONTROLACCESS_HXX
22 :
23 : #include <svtools/fileview.hxx>
24 : #include <vcl/lstbox.hxx>
25 : #include <com/sun/star/lang/IllegalArgumentException.hpp>
26 : #include "pickercallbacks.hxx"
27 :
28 :
29 : namespace svt
30 : {
31 :
32 :
33 :
34 : namespace InternalFilePickerElementIds
35 : {
36 : static const sal_Int16 PUSHBUTTON_HELP = (sal_Int16)0x1000;
37 : static const sal_Int16 TOOLBOXBUTOON_DEFAULT_LOCATION = (sal_Int16)0x1001;
38 : static const sal_Int16 TOOLBOXBUTOON_LEVEL_UP = (sal_Int16)0x1002;
39 : static const sal_Int16 TOOLBOXBUTOON_NEW_FOLDER = (sal_Int16)0x1003;
40 : static const sal_Int16 FIXEDTEXT_CURRENTFOLDER = (sal_Int16)0x1004;
41 : }
42 :
43 :
44 : /** implements the XControlAccess, XControlInformation and XFilePickerControlAccess for the file picker
45 : */
46 0 : class OControlAccess
47 : {
48 : IFilePickerController* m_pFilePickerController;
49 : VclPtr<SvtFileView> m_pFileView;
50 :
51 : public:
52 : OControlAccess( IFilePickerController* _pController, SvtFileView* _pFileView );
53 :
54 : // XControlAccess implementation
55 : void setControlProperty( const OUString& _rControlName, const OUString& _rControlProperty, const ::com::sun::star::uno::Any& _rValue );
56 : ::com::sun::star::uno::Any getControlProperty( const OUString& _rControlName, const OUString& _rControlProperty );
57 :
58 : // XControlInformation implementation
59 : ::com::sun::star::uno::Sequence< OUString > getSupportedControls( );
60 : ::com::sun::star::uno::Sequence< OUString > getSupportedControlProperties( const OUString& _rControlName );
61 : static bool isControlSupported( const OUString& _rControlName );
62 : bool isControlPropertySupported( const OUString& _rControlName, const OUString& _rControlProperty );
63 :
64 : // XFilePickerControlAccess
65 : void setValue( sal_Int16 _nId, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
66 : ::com::sun::star::uno::Any getValue( sal_Int16 _nId, sal_Int16 _nCtrlAction ) const;
67 : void setLabel( sal_Int16 _nId, const OUString& _rValue );
68 : OUString getLabel( sal_Int16 _nId ) const;
69 : void enableControl( sal_Int16 _nId, bool _bEnable );
70 :
71 : static void setHelpURL( vcl::Window* _pControl, const OUString& _rURL, bool _bFileView );
72 : static OUString getHelpURL( vcl::Window* _pControl, bool _bFileView );
73 :
74 : private:
75 : /** implements the various methods for setting properties on controls
76 :
77 : @param _nControlId
78 : the id of the control
79 : @param _pControl
80 : the affected control. Must be the same as referred by <arg>_nControlId</arg>, or NULL.
81 : @param _nProperty
82 : the property to set
83 : See PROPERTY_FLAG_*
84 : @param _rValue
85 : the value to set
86 : @param _bIgnoreIllegalArgument
87 : if <FALSE/>, an exception will be thrown if the given value is of improper type
88 : */
89 : void implSetControlProperty(
90 : sal_Int16 _nControlId,
91 : Control* _pControl, sal_Int16 _nProperty, const ::com::sun::star::uno::Any& _rValue,
92 : bool _bIgnoreIllegalArgument = true );
93 :
94 : Control* implGetControl( const OUString& _rControlName, sal_Int16* _pId = NULL, sal_Int32* _pPropertyMask = NULL ) const;
95 :
96 : /** implements the various methods for retrieving properties from controls
97 :
98 : @param _pControl
99 : the affected control
100 : @PRECOND not <NULL/>
101 : @param _nProperty
102 : the property to retrieve
103 : See PROPERTY_FLAG_*
104 : @return
105 : */
106 : ::com::sun::star::uno::Any implGetControlProperty( Control* _pControl, sal_Int16 _nProperty ) const;
107 :
108 : static void implDoListboxAction( ListBox* _pListbox, sal_Int16 _nCtrlAction, const ::com::sun::star::uno::Any& _rValue );
109 :
110 : };
111 :
112 :
113 : } // namespace svt
114 :
115 :
116 : #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICECONTROLACCESS_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|