tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / formula / source / ui / dlg / funcpage.hxx
blob010bca872832607ec25d2f03aa5d2bc852e8da55
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 <vcl/weld.hxx>
23 #include <vector>
24 #include <set>
25 #include <unordered_map>
27 namespace formula
30 class IFunctionDescription;
31 class IFunctionManager;
32 class IFunctionCategory;
34 typedef const IFunctionDescription* TFunctionDesc;
36 class FuncPage final
38 private:
39 std::unique_ptr<weld::Builder> m_xBuilder;
40 std::unique_ptr<weld::Container> m_xContainer;
42 std::unique_ptr<weld::ComboBox> m_xLbCategory;
43 std::unique_ptr<weld::TreeView> m_xLbFunction;
44 std::unique_ptr<weld::TreeIter> m_xScratchIter;
45 std::unique_ptr<weld::Entry> m_xLbFunctionSearchString;
46 std::unique_ptr<weld::CheckButton> m_xSimilaritySearch;
47 std::unique_ptr<weld::Button> m_xHelpButton;
49 Link<FuncPage&,void> aDoubleClickLink;
50 Link<FuncPage&,void> aSelectionLink;
51 const IFunctionManager* m_pFunctionManager;
53 ::std::vector< TFunctionDesc > aLRUList;
54 ::std::unordered_map<OUString, std::unique_ptr<weld::TreeIter>> mCategories;
55 ::std::set<std::pair<std::pair<sal_Int32, sal_Int32>, std::pair<OUString, TFunctionDesc>>>
56 sFuncScores;
57 OUString m_aHelpId;
59 // tdf#104487 - remember last used function category
60 static sal_Int32 m_nRememberedFunctionCategory;
62 void impl_addFunctions(const IFunctionCategory*, bool);
63 weld::TreeIter* FillCategoriesMap(const OUString&, bool);
65 DECL_LINK(SelComboBoxHdl, weld::ComboBox&, void);
66 DECL_LINK(SelTreeViewHdl, weld::TreeView&, void);
67 DECL_LINK(DblClkHdl, weld::TreeView&, bool);
68 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
69 DECL_LINK(ModifyHdl, weld::Entry&, void);
70 DECL_LINK(SelHelpClickHdl, weld::Button&, void);
71 DECL_LINK(SimilarityToggleHdl, weld::Toggleable&, void);
73 void UpdateFunctionList(const OUString&);
75 public:
77 FuncPage(weld::Container* pContainer, const IFunctionManager* _pFunctionManager);
78 ~FuncPage();
80 void SetCategory(sal_Int32 nCat);
81 void SetFunction(sal_Int32 nFunc);
82 void SetFocus();
83 sal_Int32 GetCategory() const;
84 sal_Int32 GetCategoryEntryCount() const;
85 sal_Int32 GetFunction() const;
86 sal_Int32 GetFunctionEntryCount() const;
88 // tdf#104487 - remember last used function category
89 static sal_Int32 GetRememeberdFunctionCategory() { return m_nRememberedFunctionCategory; };
91 sal_Int32 GetFuncPos(const IFunctionDescription* _pDesc);
92 const IFunctionDescription* GetFuncDesc() const;
93 OUString GetSelFunctionName() const;
95 void SetDoubleClickHdl( const Link<FuncPage&,void>& rLink ) { aDoubleClickLink = rLink; }
97 void SetSelectHdl( const Link<FuncPage&,void>& rLink ) { aSelectionLink = rLink; }
99 bool IsVisible() const { return m_xContainer->get_visible(); }
101 void SearchFunction(const OUString&, const OUString&, TFunctionDesc, const bool);
104 } // formula
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */