nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / ui / inc / namedlg.hxx
blobf85ee09bc39ff6f6770802938d547d3b1f270f01
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 INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
23 #include "anyrefdg.hxx"
24 #include "namemgrtable.hxx"
26 #include <memory>
27 #include <map>
29 class ScViewData;
30 class ScDocument;
32 //logic behind the manage names dialog
33 class ScNameDlg : public ScAnyRefDlgController
35 private:
36 const OUString maGlobalNameStr;
37 const OUString maErrInvalidNameStr;
38 const OUString maErrNameInUse;
39 const OUString maStrMultiSelect;
40 OUString maStrInfoDefault;
42 ScViewData& mrViewData;
43 ScDocument& mrDoc;
44 const ScAddress maCursorPos;
46 bool mbDataChanged;
47 //ugly hack to call DefineNames from ManageNames
48 bool mbCloseWithoutUndo;
50 typedef std::map<OUString, std::unique_ptr<ScRangeName>> RangeNameContainer;
52 RangeNameContainer m_RangeMap;
54 std::unique_ptr<weld::Entry> m_xEdName;
55 std::unique_ptr<weld::Label> m_xFtAssign;
56 std::unique_ptr<formula::RefEdit> m_xEdAssign;
57 std::unique_ptr<formula::RefButton> m_xRbAssign;
58 std::unique_ptr<weld::ComboBox> m_xLbScope;
60 std::unique_ptr<weld::CheckButton> m_xBtnPrintArea;
61 std::unique_ptr<weld::CheckButton> m_xBtnColHeader;
62 std::unique_ptr<weld::CheckButton> m_xBtnCriteria;
63 std::unique_ptr<weld::CheckButton> m_xBtnRowHeader;
65 std::unique_ptr<weld::Button> m_xBtnAdd;
66 std::unique_ptr<weld::Button> m_xBtnDelete;
67 std::unique_ptr<weld::Button> m_xBtnOk;
68 std::unique_ptr<weld::Button> m_xBtnCancel;
70 std::unique_ptr<weld::Label> m_xFtInfo;
72 std::unique_ptr<weld::Expander> m_xExpander;
74 std::unique_ptr<ScRangeManagerTable> m_xRangeManagerTable;
76 private:
77 void Init();
78 void UpdateChecks(const ScRangeData* pData);
79 void ShowOptions(const ScRangeNameLine& rLine);
81 bool IsNameValid();
82 bool IsFormulaValid();
83 void CheckForEmptyTable();
85 ScRangeName* GetRangeName(const OUString& rScope);
87 void AddPushed();
88 void RemovePushed();
89 void ScopeChanged();
90 void NameModified();
92 void SelectionChanged();
94 // Handler:
95 DECL_LINK(OkBtnHdl, weld::Button&, void);
96 DECL_LINK(CancelBtnHdl, weld::Button&, void);
97 DECL_LINK(AddBtnHdl, weld::Button&, void);
98 DECL_LINK(RemoveBtnHdl, weld::Button&, void);
99 DECL_LINK(EdModifyHdl, weld::Entry&, void);
100 DECL_LINK(RefEdModifyHdl, formula::RefEdit&, void);
101 DECL_LINK(EdModifyCheckBoxHdl, weld::ToggleButton&, void);
102 DECL_LINK(AssignGetFocusHdl, formula::RefEdit&, void);
103 DECL_LINK(SelectionChangedHdl_Impl, weld::TreeView&, void);
104 DECL_LINK(ScopeChangedHdl, weld::ComboBox&, void);
106 protected:
107 virtual void RefInputDone(bool bForced = false) override;
109 public:
110 ScNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData,
111 const ScAddress& aCursorPos,
112 std::map<OUString, std::unique_ptr<ScRangeName>>* pRangeMap = nullptr);
113 virtual ~ScNameDlg() override;
115 virtual void SetReference(const ScRange& rRef, ScDocument& rDoc) override;
116 virtual bool IsRefInputMode() const override;
118 virtual void SetActive() override;
119 virtual void Close() override;
121 void GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap);
122 void SetEntry(const OUString& rName, const OUString& rScope);
125 #endif // INCLUDED_SC_SOURCE_UI_INC_NAMEDLG_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */