LibreOffice Module sc (master)  1
namemgrtable.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 
10 #pragma once
11 
12 #include <vcl/weld.hxx>
13 
14 #include <address.hxx>
15 
16 #include <memory>
17 #include <vector>
18 #include <map>
19 
20 class ScRangeName;
21 class ScRangeData;
22 
24 {
25  OUString aName;
26  OUString aExpression;
27  OUString aScope;
28 };
29 
31 {
32 private:
33  std::unique_ptr<weld::TreeView> m_xTreeView;
34 
35  OUString maGlobalString;
36 
37  // should be const because we should not modify it here
38  const std::map<OUString, std::unique_ptr<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;
44 
45  int m_nId;
46 
48 
49  void GetLine(ScRangeNameLine& aLine, const weld::TreeIter& rEntry);
50  void Init();
51  const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
52 
53  DECL_LINK(SizeAllocHdl, const Size&, void);
54  DECL_LINK(VisRowsScrolledHdl, weld::TreeView&, void);
55 
56 public:
57  ScRangeManagerTable(std::unique_ptr<weld::TreeView>,
58  const std::map<OUString, std::unique_ptr<ScRangeName>>& rTabRangeNames,
59  const ScAddress& rPos);
60 
61  void CheckForFormulaString();
62 
63  int n_children() const { return m_xTreeView->n_children(); }
64  void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
65  void set_cursor(int nPos) { m_xTreeView->set_cursor(nPos); }
66 
67  void addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry);
68  void DeleteSelectedEntries();
69  void SetEntry( const ScRangeNameLine& rLine );
70 
71  void GetCurrentLine(ScRangeNameLine& rLine);
72  bool IsMultiSelection() const;
73  std::vector<ScRangeNameLine> GetSelectedEntries();
74 
75  void BlockUpdate()
76  {
77  mbNeedUpdate = false;
78  }
79 
80  bool UpdatesBlocked() const
81  {
82  return !mbNeedUpdate;
83  }
84 
86  {
87  mbNeedUpdate = true;
88  }
89 };
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< OUString, bool > maCalculatedFormulaEntries
void Init()
OUString aExpression
void connect_changed(const Link< weld::TreeView &, void > &rLink)
const ScAddress maPos
const std::map< OUString, std::unique_ptr< ScRangeName > > & m_RangeMap
std::unique_ptr< weld::TreeView > m_xTreeView
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
int n_children() const
void set_cursor(int nPos)
bool UpdatesBlocked() const