1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <sal/config.h>
24 #include <string_view>
26 #include "fileview.hxx"
27 #include "pickercallbacks.hxx"
28 #include <o3tl/typed_flags_set.hxx>
30 enum class PropFlags
{
31 Unknown
= -1, // used as an error sentinel
38 SelectedItem
= 0x0020,
39 SelectedItemIndex
= 0x0040,
43 template<> struct typed_flags
<PropFlags
> : is_typed_flags
<PropFlags
, 0x00ff> {};
51 namespace InternalFilePickerElementIds
53 const sal_Int16 PUSHBUTTON_HELP
= sal_Int16(0x1000);
54 const sal_Int16 TOOLBOXBUTTON_LEVEL_UP
= sal_Int16(0x1002);
55 const sal_Int16 TOOLBOXBUTTON_NEW_FOLDER
= sal_Int16(0x1003);
56 const sal_Int16 FIXEDTEXT_CURRENTFOLDER
= sal_Int16(0x1004);
60 /** implements the XControlAccess, XControlInformation and XFilePickerControlAccess for the file picker
64 IFilePickerController
* m_pFilePickerController
;
65 SvtFileView
* m_pFileView
;
68 OControlAccess( IFilePickerController
* pController
, SvtFileView
* pFileView
);
70 // XControlAccess implementation
71 void setControlProperty( std::u16string_view rControlName
, const OUString
& rControlProperty
, const css::uno::Any
& rValue
);
72 css::uno::Any
getControlProperty( std::u16string_view rControlName
, const OUString
& rControlProperty
);
74 // XControlInformation implementation
75 css::uno::Sequence
< OUString
> getSupportedControls( ) const;
76 css::uno::Sequence
< OUString
> getSupportedControlProperties( std::u16string_view rControlName
);
77 static bool isControlSupported( std::u16string_view rControlName
);
78 bool isControlPropertySupported( std::u16string_view rControlName
, const OUString
& rControlProperty
);
80 // XFilePickerControlAccess
81 void setValue( sal_Int16 nId
, sal_Int16 nCtrlAction
, const css::uno::Any
& rValue
);
82 css::uno::Any
getValue( sal_Int16 nId
, sal_Int16 nCtrlAction
) const;
83 void setLabel( sal_Int16 nId
, const OUString
& rValue
);
84 OUString
getLabel( sal_Int16 nId
) const;
85 void enableControl( sal_Int16 nId
, bool bEnable
);
87 void setHelpURL(weld::Widget
* pControl
, const OUString
& rURL
);
88 OUString
getHelpURL(weld::Widget
const* pControl
) const;
91 /** implements the various methods for setting properties on controls
96 the affected control. Must be the same as referred by <arg>nControlId</arg>, or NULL.
102 @param bIgnoreIllegalArgument
103 if <FALSE/>, an exception will be thrown if the given value is of improper type
105 void implSetControlProperty(
106 sal_Int16 nControlId
,
107 weld::Widget
* pControl
, PropFlags nProperty
, const css::uno::Any
& rValue
,
108 bool bIgnoreIllegalArgument
= true );
110 weld::Widget
* implGetControl( std::u16string_view rControlName
, sal_Int16
* pId
, PropFlags
* pPropertyMask
= nullptr ) const;
112 /** implements the various methods for retrieving properties from controls
118 the property to retrieve
122 css::uno::Any
implGetControlProperty( weld::Widget
const * pControl
, PropFlags nProperty
) const;
124 bool IsFileViewWidget(weld::Widget
const * pControl
) const;
126 static void implDoListboxAction(weld::ComboBox
* pListbox
, sal_Int16 nCtrlAction
, const css::uno::Any
& rValue
);
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */