tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / dwfunctr.hxx
blob9c05491dac2d94bd3a7a49c43d9fab1c8e392dea
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 .
19 #pragma once
21 #include <comphelper/configurationlistener.hxx>
22 #include <sfx2/sidebar/PanelLayout.hxx>
23 #include <unordered_map>
25 class ScFuncDesc;
26 namespace formula { class IFunctionDescription; }
28 class ScFunctionWin;
30 class EnglishFunctionNameChange : public comphelper::ConfigurationListenerProperty<bool>
32 ScFunctionWin* m_pFunctionWin;
33 protected:
34 virtual void setProperty(const css::uno::Any &rProperty) override;
35 public:
36 EnglishFunctionNameChange(const rtl::Reference<comphelper::ConfigurationListener> &rListener, ScFunctionWin* pFunctionWin)
37 : ConfigurationListenerProperty(rListener, u"EnglishFunctionName"_ustr)
38 , m_pFunctionWin(pFunctionWin)
43 class ScFunctionWin : public PanelLayout
46 private:
47 std::unique_ptr<weld::ComboBox> xCatBox;
48 std::unique_ptr<weld::TreeView> xFuncList;
49 std::unique_ptr<weld::TreeIter> xScratchIter;
50 std::unique_ptr<weld::Button> xInsertButton;
51 std::unique_ptr<weld::Button> xHelpButton;
52 std::unique_ptr<weld::CheckButton> xSimilaritySearch;
53 std::unique_ptr<weld::TextView> xFiFuncDesc;
54 std::unique_ptr<weld::Entry> m_xSearchString;
56 rtl::Reference<comphelper::ConfigurationListener> xConfigListener;
57 std::unique_ptr<EnglishFunctionNameChange> xConfigChange;
58 const ScFuncDesc* pFuncDesc;
59 sal_uInt16 nArgs;
60 OUString m_aListHelpId;
61 OUString m_aSearchHelpId;
63 ::std::set<std::pair<std::pair<sal_Int32, sal_Int32>, std::pair<OUString, const ScFuncDesc*>>>
64 sFuncScores;
65 ::std::vector< const formula::IFunctionDescription*> aLRUList;
66 ::std::unordered_map<OUString, std::unique_ptr<weld::TreeIter>> mCategories;
68 void UpdateLRUList();
69 void DoEnter(bool bDouble_or_Enter = false);
70 void SetDescription();
71 weld::TreeIter* FillCategoriesMap(const OUString&, bool);
73 DECL_LINK( SetRowActivatedHdl, weld::TreeView&, bool );
74 DECL_LINK( SetSelectionClickHdl, weld::Button&, void );
75 DECL_LINK( SetHelpClickHdl, weld::Button&, void );
76 DECL_LINK( SetSimilarityToggleHdl, weld::Toggleable&, void );
77 DECL_LINK( SelComboHdl, weld::ComboBox&, void );
78 DECL_LINK( SelTreeHdl, weld::TreeView&, void );
79 DECL_LINK( ModifyHdl, weld::Entry&, void );
80 DECL_LINK( KeyInputHdl, const KeyEvent&, bool);
82 public:
83 ScFunctionWin(weld::Widget* pParent);
85 virtual ~ScFunctionWin() override;
87 void InitLRUList();
88 void UpdateFunctionList(const OUString&);
89 void SearchFunction(const OUString&, const OUString&, const ScFuncDesc*, const bool);
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */