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 "anyrefdg.hxx"
30 : #include "namedefdlg.hrc"
31 : #include <vcl/button.hxx>
32 : #include <vcl/fixed.hxx>
33 : #include <vcl/edit.hxx>
34 : #include <vcl/lstbox.hxx>
35 :
36 : #include <map>
37 :
38 : class ScRangeName;
39 : class ScDocument;
40 : class ScDocShell;
41 : class ScViewData;
42 :
43 : class ScNameDefDlg : public ScAnyRefDlg
44 : {
45 : private:
46 : Edit maEdName;
47 :
48 : formula::RefEdit maEdRange;
49 : formula::RefButton maRbRange;
50 :
51 : ListBox maLbScope;
52 :
53 : DisclosureButton maBtnMore;
54 : CheckBox maBtnRowHeader;
55 : CheckBox maBtnColHeader;
56 : CheckBox maBtnPrintArea;
57 : CheckBox maBtnCriteria;
58 :
59 : PushButton maBtnAdd;
60 : PushButton maBtnCancel;
61 : FixedText maFtInfo;
62 : FixedText maFtName;
63 : FixedText maFtRange;
64 : FixedText maFtScope;
65 : FixedLine maFlDiv;
66 :
67 :
68 : bool mbUndo; //if true we need to add an undo action after creating a range name
69 : ScDocument* mpDoc;
70 : ScDocShell* mpDocShell;
71 :
72 : ScAddress maCursorPos;
73 : const rtl::OUString maGlobalNameStr;
74 : const rtl::OUString maErrInvalidNameStr;
75 : const rtl::OUString maErrNameInUse;
76 : const rtl::OUString maStrInfoDefault;
77 :
78 : //hack to call this dialog from Manage Names
79 : rtl::OUString maName;
80 : rtl::OUString maScope;
81 :
82 : std::map<rtl::OUString, ScRangeName*> maRangeMap;
83 :
84 : void CancelPushed();
85 : void AddPushed();
86 : void MorePushed();
87 :
88 : bool IsNameValid();
89 : bool IsFormulaValid();
90 :
91 : DECL_LINK( CancelBtnHdl, void * );
92 : DECL_LINK( AddBtnHdl, void* );
93 : DECL_LINK( NameModifyHdl, void* );
94 : DECL_LINK( AssignGetFocusHdl, void * );
95 : DECL_LINK( MoreBtnHdl, void* );
96 :
97 : protected:
98 : virtual void RefInputDone( sal_Bool bForced = sal_False );
99 :
100 : public:
101 : ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
102 : ScViewData* pViewData, std::map<rtl::OUString, ScRangeName*> aRangeMap,
103 : const ScAddress& aCursorPos, const bool bUndo);
104 :
105 0 : virtual ~ScNameDefDlg() {};
106 :
107 : virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
108 : virtual sal_Bool IsRefInputMode() const;
109 :
110 : virtual void SetActive();
111 : virtual sal_Bool Close();
112 :
113 : void GetNewData( rtl::OUString& rName, rtl::OUString& rScope );
114 : };
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|