1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include "anyrefdg.hxx"
23 #include "namemgrtable.hxx"
31 //logic behind the manage names dialog
32 class ScNameDlg
: public ScAnyRefDlgController
35 const OUString maGlobalNameStr
;
36 const OUString maErrInvalidNameStr
;
37 const OUString maErrNameInUse
;
38 const OUString maErrInvalidSheetReference
;
39 const OUString maStrMultiSelect
;
40 OUString maStrInfoDefault
;
42 ScViewData
& mrViewData
;
44 const ScAddress maCursorPos
;
47 //ugly hack to call DefineNames from ManageNames
48 bool mbCloseWithoutUndo
;
50 typedef std::map
<OUString
, 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
;
78 void UpdateChecks(const ScRangeData
* pData
);
79 void ShowOptions(const ScRangeNameLine
& rLine
);
82 bool IsFormulaValid();
83 void CheckForEmptyTable();
85 ScRangeName
* GetRangeName(const OUString
& rScope
);
92 void SelectionChanged();
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::Toggleable
&, void);
102 DECL_LINK(AssignGetFocusHdl
, formula::RefEdit
&, void);
103 DECL_LINK(SelectionChangedHdl_Impl
, weld::TreeView
&, void);
104 DECL_LINK(ScopeChangedHdl
, weld::ComboBox
&, void);
107 virtual void RefInputDone(bool bForced
= false) override
;
110 ScNameDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
, weld::Window
* pParent
, ScViewData
& rViewData
,
111 const ScAddress
& aCursorPos
, std::map
<OUString
, ScRangeName
>* pRangeMap
= nullptr);
112 virtual ~ScNameDlg() override
;
114 virtual void SetReference(const ScRange
& rRef
, ScDocument
& rDoc
) override
;
115 virtual bool IsRefInputMode() const override
;
117 virtual void SetActive() override
;
118 virtual void Close() override
;
120 void GetRangeNames(std::map
<OUString
, ScRangeName
>& rRangeMap
);
121 void SetEntry(const OUString
& rName
, const OUString
& rScope
);
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */