Line data Source code
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 : #ifndef INCLUDED_SC_SOURCE_UI_INC_NAMEMGRTABLE_HXX
11 : #define INCLUDED_SC_SOURCE_UI_INC_NAMEMGRTABLE_HXX
12 :
13 : #include <svtools/simptabl.hxx>
14 : #include <vcl/ctrl.hxx>
15 :
16 : #include "scresid.hxx"
17 : #include "address.hxx"
18 :
19 : #include <vector>
20 : #include <boost/ptr_container/ptr_map.hpp>
21 :
22 : class ScRangeName;
23 : class ScRangeData;
24 :
25 0 : struct ScRangeNameLine
26 : {
27 : OUString aName;
28 : OUString aExpression;
29 : OUString aScope;
30 : };
31 :
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
37 : {
38 : public:
39 0 : class InitListener
40 : {
41 : public:
42 : virtual ~InitListener();
43 : virtual void tableInitialized() = 0;
44 : };
45 :
46 : private:
47 : OUString maGlobalString;
48 :
49 : // should be const because we should not modify it here
50 : const boost::ptr_map<OUString, ScRangeName>& mrRangeMap;
51 : // for performance, save which entries already have the formula entry
52 : // otherwise opening the dialog with a lot of range names is extremelly slow because
53 : // we would calculate all formula strings during opening
54 : std::map<SvTreeListEntry*, bool> maCalculatedFormulaEntries;
55 : const ScAddress maPos;
56 :
57 : InitListener* mpInitListener;
58 :
59 : void GetLine(ScRangeNameLine& aLine, SvTreeListEntry* pEntry);
60 : void Init();
61 : void CheckForFormulaString();
62 : const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
63 :
64 : void setColWidths();
65 :
66 : public:
67 : ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos );
68 : virtual ~ScRangeManagerTable();
69 :
70 : virtual void Resize() SAL_OVERRIDE;
71 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
72 :
73 : void setInitListener( InitListener* pListener );
74 :
75 : void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
76 : void DeleteSelectedEntries();
77 : void SetEntry( const ScRangeNameLine& rLine );
78 :
79 : void GetCurrentLine(ScRangeNameLine& rLine);
80 : bool IsMultiSelection();
81 : std::vector<ScRangeNameLine> GetSelectedEntries();
82 :
83 : DECL_LINK( ScrollHdl, void*);
84 : DECL_LINK( HeaderEndDragHdl, void*);
85 : };
86 :
87 : #endif
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|