Avoid potential negative array index access to cached text.
[LibreOffice.git] / formula / source / ui / dlg / funcpage.hxx
blobe7ca248d861b52aabb03076ac937ad2b269002f8
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>
25 namespace formula
28 class IFunctionDescription;
29 class IFunctionManager;
30 class IFunctionCategory;
32 typedef const IFunctionDescription* TFunctionDesc;
34 class FuncPage final
36 private:
37 std::unique_ptr<weld::Builder> m_xBuilder;
38 std::unique_ptr<weld::Container> m_xContainer;
40 std::unique_ptr<weld::ComboBox> m_xLbCategory;
41 std::unique_ptr<weld::TreeView> m_xLbFunction;
42 std::unique_ptr<weld::Entry> m_xLbFunctionSearchString;
44 Link<FuncPage&,void> aDoubleClickLink;
45 Link<FuncPage&,void> aSelectionLink;
46 const IFunctionManager* m_pFunctionManager;
48 ::std::vector< TFunctionDesc > aLRUList;
49 OUString m_aHelpId;
51 // tdf#104487 - remember last used function category
52 static sal_Int32 m_nRememberedFunctionCategory;
54 void impl_addFunctions(const IFunctionCategory* _pCategory);
56 DECL_LINK(SelComboBoxHdl, weld::ComboBox&, void);
57 DECL_LINK(SelTreeViewHdl, weld::TreeView&, void);
58 DECL_LINK(DblClkHdl, weld::TreeView&, bool);
59 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
60 DECL_LINK(ModifyHdl, weld::Entry&, void);
62 void UpdateFunctionList(const OUString&);
64 public:
66 FuncPage(weld::Container* pContainer, const IFunctionManager* _pFunctionManager);
67 ~FuncPage();
69 void SetCategory(sal_Int32 nCat);
70 void SetFunction(sal_Int32 nFunc);
71 void SetFocus();
72 sal_Int32 GetCategory() const;
73 sal_Int32 GetCategoryEntryCount() const;
74 sal_Int32 GetFunction() const;
75 sal_Int32 GetFunctionEntryCount() const;
77 // tdf#104487 - remember last used function category
78 static sal_Int32 GetRememeberdFunctionCategory() { return m_nRememberedFunctionCategory; };
80 sal_Int32 GetFuncPos(const IFunctionDescription* _pDesc);
81 const IFunctionDescription* GetFuncDesc( sal_Int32 nPos ) const;
82 OUString GetSelFunctionName() const;
84 void SetDoubleClickHdl( const Link<FuncPage&,void>& rLink ) { aDoubleClickLink = rLink; }
86 void SetSelectHdl( const Link<FuncPage&,void>& rLink ) { aSelectionLink = rLink; }
88 bool IsVisible() const { return m_xContainer->get_visible(); }
91 } // formula
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */