LibreOffice Module fpicker (master) 1
OfficeControlAccess.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include "fileview.hxx"
27#include "pickercallbacks.hxx"
29
30enum 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,
41};
42namespace o3tl {
43 template<> struct typed_flags<PropFlags> : is_typed_flags<PropFlags, 0x00ff> {};
44}
45
46
47namespace svt
48{
49
50
51 namespace InternalFilePickerElementIds
52 {
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);
57 }
58
59
63 {
66
67 public:
68 OControlAccess( IFilePickerController* pController, SvtFileView* pFileView );
69
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 );
73
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 );
79
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 );
86
87 void setHelpURL(weld::Widget* pControl, const OUString& rURL);
88 OUString getHelpURL(weld::Widget const* pControl) const;
89
90 private:
106 sal_Int16 nControlId,
107 weld::Widget* pControl, PropFlags nProperty, const css::uno::Any& rValue,
108 bool bIgnoreIllegalArgument = true );
109
110 weld::Widget* implGetControl( std::u16string_view rControlName, sal_Int16* pId, PropFlags* pPropertyMask = nullptr ) const;
111
122 css::uno::Any implGetControlProperty( weld::Widget const * pControl, PropFlags nProperty ) const;
123
124 bool IsFileViewWidget(weld::Widget const * pControl) const;
125
126 static void implDoListboxAction(weld::ComboBox* pListbox, sal_Int16 nCtrlAction, const css::uno::Any& rValue);
127
128 };
129
130
131} // namespace svt
132
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int16 nControlId
@ SelectedItemIndex
implements the XControlAccess, XControlInformation and XFilePickerControlAccess for the file picker
void setValue(sal_Int16 nId, sal_Int16 nCtrlAction, const css::uno::Any &rValue)
void enableControl(sal_Int16 nId, bool bEnable)
static void implDoListboxAction(weld::ComboBox *pListbox, sal_Int16 nCtrlAction, const css::uno::Any &rValue)
css::uno::Any getValue(sal_Int16 nId, sal_Int16 nCtrlAction) const
void implSetControlProperty(sal_Int16 nControlId, weld::Widget *pControl, PropFlags nProperty, const css::uno::Any &rValue, bool bIgnoreIllegalArgument=true)
implements the various methods for setting properties on controls
OControlAccess(IFilePickerController *pController, SvtFileView *pFileView)
css::uno::Sequence< OUString > getSupportedControlProperties(std::u16string_view rControlName)
void setLabel(sal_Int16 nId, const OUString &rValue)
bool IsFileViewWidget(weld::Widget const *pControl) const
static bool isControlSupported(std::u16string_view rControlName)
css::uno::Any implGetControlProperty(weld::Widget const *pControl, PropFlags nProperty) const
implements the various methods for retrieving properties from controls
weld::Widget * implGetControl(std::u16string_view rControlName, sal_Int16 *pId, PropFlags *pPropertyMask=nullptr) const
void setHelpURL(weld::Widget *pControl, const OUString &rURL)
css::uno::Sequence< OUString > getSupportedControls() const
OUString getHelpURL(weld::Widget const *pControl) const
IFilePickerController * m_pFilePickerController
OUString getLabel(sal_Int16 nId) const
css::uno::Any getControlProperty(std::u16string_view rControlName, const OUString &rControlProperty)
void setControlProperty(std::u16string_view rControlName, const OUString &rControlProperty, const css::uno::Any &rValue)
bool isControlPropertySupported(std::u16string_view rControlName, const OUString &rControlProperty)
NONE
Unknown
Visible
std::vector< css::uno::WeakReference< css::accessibility::XAccessible > > ListItems