Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / namedlg.hxx
blobb6ed1968fb7d20b11b16df4442fbdd81262d58f3
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_NAMEDLG_HXX
21 #define SC_NAMEDLG_HXX
23 #include <vcl/morebtn.hxx>
24 #include <vcl/combobox.hxx>
25 #include <vcl/group.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/lstbox.hxx>
29 #include "rangenam.hxx"
30 #include "anyrefdg.hxx"
31 #include "namemgrtable.hxx"
33 #include <boost/ptr_container/ptr_map.hpp>
34 #include <boost/ptr_container/ptr_set.hpp>
36 #include <stack>
37 #include <map>
39 class ScViewData;
40 class ScDocument;
43 //==================================================================
45 //logic behind the manage names dialog
46 class ScNameDlg : public ScAnyRefDlg
48 private:
49 Edit* m_pEdName;
50 formula::RefEdit* m_pEdAssign;
51 formula::RefButton* m_pRbAssign;
52 ListBox* m_pLbScope;
54 CheckBox* m_pBtnPrintArea;
55 CheckBox* m_pBtnColHeader;
56 CheckBox* m_pBtnCriteria;
57 CheckBox* m_pBtnRowHeader;
59 PushButton* m_pBtnAdd;
60 PushButton* m_pBtnDelete;
61 PushButton* m_pBtnOk;
62 PushButton* m_pBtnCancel;
64 FixedText* m_pFtInfo;
66 ScRangeManagerTable* m_pRangeManagerTable;
68 const OUString maGlobalNameStr;
69 const OUString maErrInvalidNameStr;
70 const OUString maErrNameInUse;
71 const OUString maStrMultiSelect;
72 OUString maStrInfoDefault;
74 ScViewData* mpViewData;
75 ScDocument* mpDoc;
76 const ScAddress maCursorPos;
77 Selection maCurSel;
79 bool mbNeedUpdate;
80 bool mbDataChanged;
81 //ugly hack to call DefineNames from ManageNames
82 bool mbCloseWithoutUndo;
84 typedef boost::ptr_map<OUString, ScRangeName> RangeNameContainer;
86 RangeNameContainer maRangeMap;
88 private:
89 void Init();
90 void UpdateChecks(ScRangeData* pData);
91 void ShowOptions(const ScRangeNameLine& rLine);
92 void UpdateNames();
94 bool IsNameValid();
95 bool IsFormulaValid();
96 void CheckForEmptyTable();
98 ScRangeName* GetRangeName(const OUString& rScope);
100 bool AddPushed();
101 void RemovePushed();
102 void OKPushed();
103 void CancelPushed();
104 void NameSelected();
105 void ScopeChanged();
106 void NameModified();
108 void SelectionChanged();
110 // Handler:
111 DECL_LINK( OkBtnHdl, void * );
112 DECL_LINK( CancelBtnHdl, void * );
113 DECL_LINK( AddBtnHdl, void * );
114 DECL_LINK( RemoveBtnHdl, void * );
115 DECL_LINK( SelectBtnHdl, void * );
116 DECL_LINK( EdModifyHdl, void * );
117 DECL_LINK( AssignGetFocusHdl, void * );
118 DECL_LINK( SelectionChangedHdl_Impl, void* );
119 DECL_LINK( ScopeChangedHdl, void* );
121 protected:
122 virtual void RefInputDone( sal_Bool bForced = sal_False );
124 public:
125 ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
126 ScViewData* ptrViewData,
127 const ScAddress& aCursorPos, boost::ptr_map<OUString, ScRangeName>* pRangeMap = NULL );
128 virtual ~ScNameDlg();
130 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
131 virtual sal_Bool IsRefInputMode() const;
133 virtual void SetActive();
134 virtual sal_Bool Close();
136 void GetRangeNames(boost::ptr_map<OUString, ScRangeName>& rRangeMap);
137 void SetEntry(const OUString& rName, const OUString& rScope);
143 #endif // SC_NAMEDLG_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */