tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / namemgrtable.hxx
blob34f46bbc1a172fa87a71ed63a7d288d894d7851b
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/.
8 */
10 #pragma once
12 #include <vcl/weld.hxx>
14 #include <address.hxx>
16 #include <memory>
17 #include <vector>
18 #include <map>
20 class ScRangeName;
21 class ScRangeData;
23 struct ScRangeNameLine
25 OUString aName;
26 OUString aExpression;
27 OUString aScope;
30 class SC_DLLPUBLIC ScRangeManagerTable
32 private:
33 std::unique_ptr<weld::TreeView> m_xTreeView;
35 OUString maGlobalString;
37 // should be const because we should not modify it here
38 const std::map<OUString, ScRangeName>& m_RangeMap;
39 // for performance, save which entries already have the formula entry
40 // otherwise opening the dialog with a lot of range names is extremely slow because
41 // we would calculate all formula strings during opening
42 std::map<OUString, bool> maCalculatedFormulaEntries;
43 const ScAddress maPos;
45 int m_nId;
47 bool mbNeedUpdate;
49 void GetLine(ScRangeNameLine& aLine, const weld::TreeIter& rEntry);
50 void Init();
51 const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
53 DECL_DLLPRIVATE_LINK(SizeAllocHdl, const Size&, void);
54 DECL_DLLPRIVATE_LINK(VisRowsScrolledHdl, weld::TreeView&, void);
56 public:
57 ScRangeManagerTable(std::unique_ptr<weld::TreeView>,
58 const std::map<OUString, ScRangeName>& rTabRangeNames,
59 const ScAddress& rPos);
61 void CheckForFormulaString();
63 int n_children() const { return m_xTreeView->n_children(); }
64 void connect_changed(const Link<weld::TreeView&, void>& rLink)
66 m_xTreeView->connect_selection_changed(rLink);
68 void set_cursor(int nPos) { m_xTreeView->set_cursor(nPos); }
70 void addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry);
71 void DeleteSelectedEntries();
72 void SetEntry( const ScRangeNameLine& rLine );
74 void GetCurrentLine(ScRangeNameLine& rLine);
75 bool IsMultiSelection() const;
76 std::vector<ScRangeNameLine> GetSelectedEntries();
78 void BlockUpdate()
80 mbNeedUpdate = false;
83 bool UpdatesBlocked() const
85 return !mbNeedUpdate;
88 void UnblockUpdate()
90 mbNeedUpdate = true;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */