Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : : *
5 : : * The contents of this file are subject to the Mozilla Public License Version
6 : : * 1.1 (the "License"); you may not use this file except in compliance with
7 : : * the License or as specified alternatively below. You may obtain a copy of
8 : : * the License at http://www.mozilla.org/MPL/
9 : : *
10 : : * Software distributed under the License is distributed on an "AS IS" basis,
11 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : : * for the specific language governing rights and limitations under the
13 : : * License.
14 : : *
15 : : * Major Contributor(s):
16 : : * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer)
17 : : *
18 : : * All Rights Reserved.
19 : : *
20 : : * For minor contributions see the git repository.
21 : : *
22 : : * Alternatively, the contents of this file may be used under the terms of
23 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : : * instead of those above.
27 : : */
28 : :
29 : : #include <svtools/headbar.hxx>
30 : : #include <svtools/svtabbx.hxx>
31 : : #include <vcl/ctrl.hxx>
32 : :
33 : : #include "scresid.hxx"
34 : : #include "address.hxx"
35 : :
36 : : #include <vector>
37 : : #include <boost/ptr_container/ptr_map.hpp>
38 : :
39 : : class ScRangeName;
40 : : class ScRangeData;
41 : :
42 : 0 : struct ScRangeNameLine
43 : : {
44 : : rtl::OUString aName;
45 : : rtl::OUString aExpression;
46 : : rtl::OUString aScope;
47 : : };
48 : :
49 : : /** Implements the Control behind the table
50 : : * It controls the size of the table
51 : : */
52 [ # # ]: 0 : class ScRangeManagerCtrl : public Control
53 : : {
54 : : public:
55 : 0 : ScRangeManagerCtrl(Window* pParent, const ScResId& rResId):
56 : 0 : Control( pParent, rResId) {}
57 : : };
58 : :
59 : : //Implements the table for the manage names dialog
60 : : //TODO: cache the lines for performance improvements
61 : : //otherwise handling of a large set of range names might get extremely slow
62 : : //Need some sort of a filter to handle several range names
63 : : class SC_DLLPUBLIC ScRangeManagerTable : public SvTabListBox
64 : : {
65 : : private:
66 : : HeaderBar maHeaderBar;
67 : : rtl::OUString maGlobalString;
68 : :
69 : : // should be const because we should not modify it here
70 : : const boost::ptr_map<rtl::OUString, ScRangeName>& mrRangeMap;
71 : : // for performance, save which entries already have the formula entry
72 : : // otherwise opening the dialog with a lot of range names is extremelly slow because
73 : : // we would calculate all formula strings during opening
74 : : std::map<SvLBoxEntry*, bool> maCalculatedFormulaEntries;
75 : : const ScAddress maPos;
76 : :
77 : : void GetLine(ScRangeNameLine& aLine, SvLBoxEntry* pEntry);
78 : : void Init();
79 : : void CheckForFormulaString();
80 : : const ScRangeData* findRangeData(const ScRangeNameLine& rLine);
81 : :
82 : : public:
83 : : ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos );
84 : : virtual ~ScRangeManagerTable();
85 : :
86 : : void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true );
87 : : void DeleteSelectedEntries();
88 : : void SetEntry( const ScRangeNameLine& rLine );
89 : :
90 : : void GetCurrentLine(ScRangeNameLine& rLine);
91 : : bool IsMultiSelection();
92 : : std::vector<ScRangeNameLine> GetSelectedEntries();
93 : :
94 : : DECL_LINK( ScrollHdl, void*);
95 : : DECL_LINK( HeaderEndDragHdl, void*);
96 : : };
97 : :
98 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|