tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / fpicker / source / office / OfficeControlAccess.hxx
blob859ff15f270e3376c844ea97a65678637baf8d67
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
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
32 NONE = 0x0000,
33 Text = 0x0001,
34 Enabled = 0x0002,
35 Visible = 0x0004,
36 HelpUrl = 0x0008,
37 ListItems = 0x0010,
38 SelectedItem = 0x0020,
39 SelectedItemIndex = 0x0040,
40 Checked = 0x0080,
42 namespace o3tl {
43 template<> struct typed_flags<PropFlags> : is_typed_flags<PropFlags, 0x00ff> {};
47 namespace svt
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
62 class OControlAccess
64 IFilePickerController* m_pFilePickerController;
65 SvtFileView* m_pFileView;
67 public:
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;
90 private:
91 /** implements the various methods for setting properties on controls
93 @param nControlId
94 the id of the control
95 @param pControl
96 the affected control. Must be the same as referred by <arg>nControlId</arg>, or NULL.
97 @param nProperty
98 the property to set
99 See PropFlags::*
100 @param rValue
101 the value to set
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
114 @param pControl
115 the affected control
116 @PRECOND not <NULL/>
117 @param nProperty
118 the property to retrieve
119 See PropFlags::*
120 @return
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);
131 } // namespace svt
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */