Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / namemgrtable.hxx
blob5e5a8ca8a4c08631769192d72e2480d23eb5061d
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 #ifndef SC_NAMEMGRTABLE_HXX
11 #define SC_NAMEMGRTABLE_HXX
13 #include <svtools/simptabl.hxx>
14 #include <vcl/ctrl.hxx>
16 #include "scresid.hxx"
17 #include "address.hxx"
19 #include <vector>
20 #include <boost/ptr_container/ptr_map.hpp>
22 class ScRangeName;
23 class ScRangeData;
25 struct ScRangeNameLine
27 OUString aName;
28 OUString aExpression;
29 OUString aScope;
32 //Implements the table for the manage names dialog
33 //TODO: cache the lines for performance improvements
34 //otherwise handling of a large set of range names might get extremely slow
35 //Need some sort of a filter to handle several range names
36 class SC_DLLPUBLIC ScRangeManagerTable : public SvSimpleTable
38 private:
39 OUString maGlobalString;
41 // should be const because we should not modify it here
42 const boost::ptr_map<OUString, ScRangeName>& mrRangeMap;
43 // for performance, save which entries already have the formula entry
44 // otherwise opening the dialog with a lot of range names is extremelly slow because
45 // we would calculate all formula strings during opening
46 std::map<SvTreeListEntry*, bool> maCalculatedFormulaEntries;
47 const ScAddress maPos;
49 void GetLine(ScRangeNameLine& aLine, SvTreeListEntry* pEntry);
50 void Init();
51 void CheckForFormulaString();
52 const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
54 void setColWidths();
56 public:
57 ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos );
58 virtual ~ScRangeManagerTable();
60 virtual void Resize();
61 virtual void StateChanged( StateChangedType nStateChange );
63 void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
64 void DeleteSelectedEntries();
65 void SetEntry( const ScRangeNameLine& rLine );
67 void GetCurrentLine(ScRangeNameLine& rLine);
68 bool IsMultiSelection();
69 std::vector<ScRangeNameLine> GetSelectedEntries();
71 DECL_LINK( ScrollHdl, void*);
72 DECL_LINK( HeaderEndDragHdl, void*);
75 #endif
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */