LibreOffice Module sc (master) 1
namedlg.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "anyrefdg.hxx"
23#include "namemgrtable.hxx"
24
25#include <memory>
26#include <map>
27
28class ScViewData;
29class ScDocument;
30
31//logic behind the manage names dialog
33{
34private:
35 const OUString maGlobalNameStr;
36 const OUString maErrInvalidNameStr;
37 const OUString maErrNameInUse;
38 const OUString maStrMultiSelect;
40
44
46 //ugly hack to call DefineNames from ManageNames
48
49 typedef std::map<OUString, std::unique_ptr<ScRangeName>> RangeNameContainer;
50
52
53 std::unique_ptr<weld::Entry> m_xEdName;
54 std::unique_ptr<weld::Label> m_xFtAssign;
55 std::unique_ptr<formula::RefEdit> m_xEdAssign;
56 std::unique_ptr<formula::RefButton> m_xRbAssign;
57 std::unique_ptr<weld::ComboBox> m_xLbScope;
58
59 std::unique_ptr<weld::CheckButton> m_xBtnPrintArea;
60 std::unique_ptr<weld::CheckButton> m_xBtnColHeader;
61 std::unique_ptr<weld::CheckButton> m_xBtnCriteria;
62 std::unique_ptr<weld::CheckButton> m_xBtnRowHeader;
63
64 std::unique_ptr<weld::Button> m_xBtnAdd;
65 std::unique_ptr<weld::Button> m_xBtnDelete;
66 std::unique_ptr<weld::Button> m_xBtnOk;
67 std::unique_ptr<weld::Button> m_xBtnCancel;
68
69 std::unique_ptr<weld::Label> m_xFtInfo;
70
71 std::unique_ptr<weld::Expander> m_xExpander;
72
73 std::unique_ptr<ScRangeManagerTable> m_xRangeManagerTable;
74
75private:
76 void Init();
77 void UpdateChecks(const ScRangeData* pData);
78 void ShowOptions(const ScRangeNameLine& rLine);
79
80 bool IsNameValid();
81 bool IsFormulaValid();
82 void CheckForEmptyTable();
83
84 ScRangeName* GetRangeName(const OUString& rScope);
85
86 void AddPushed();
87 void RemovePushed();
88 void ScopeChanged();
89 void NameModified();
90
91 void SelectionChanged();
92
93 // Handler:
94 DECL_LINK(OkBtnHdl, weld::Button&, void);
95 DECL_LINK(CancelBtnHdl, weld::Button&, void);
96 DECL_LINK(AddBtnHdl, weld::Button&, void);
97 DECL_LINK(RemoveBtnHdl, weld::Button&, void);
98 DECL_LINK(EdModifyHdl, weld::Entry&, void);
99 DECL_LINK(RefEdModifyHdl, formula::RefEdit&, void);
100 DECL_LINK(EdModifyCheckBoxHdl, weld::Toggleable&, void);
101 DECL_LINK(AssignGetFocusHdl, formula::RefEdit&, void);
102 DECL_LINK(SelectionChangedHdl_Impl, weld::TreeView&, void);
103 DECL_LINK(ScopeChangedHdl, weld::ComboBox&, void);
104
105protected:
106 virtual void RefInputDone(bool bForced = false) override;
107
108public:
109 ScNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData,
110 const ScAddress& aCursorPos,
111 std::map<OUString, std::unique_ptr<ScRangeName>>* pRangeMap = nullptr);
112 virtual ~ScNameDlg() override;
113
114 virtual void SetReference(const ScRange& rRef, ScDocument& rDoc) override;
115 virtual bool IsRefInputMode() const override;
116
117 virtual void SetActive() override;
118 virtual void Close() override;
119
120 void GetRangeNames(std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap);
121 void SetEntry(const OUString& rName, const OUString& rScope);
122};
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CheckForEmptyTable()
Definition: namedlg.cxx:177
bool IsFormulaValid()
Definition: namedlg.cxx:266
std::unique_ptr< weld::Button > m_xBtnDelete
Definition: namedlg.hxx:65
const OUString maErrNameInUse
Definition: namedlg.hxx:37
std::unique_ptr< weld::CheckButton > m_xBtnPrintArea
Definition: namedlg.hxx:59
void NameModified()
Definition: namedlg.cxx:336
bool mbDataChanged
Definition: namedlg.hxx:45
std::map< OUString, std::unique_ptr< ScRangeName > > RangeNameContainer
Definition: namedlg.hxx:49
DECL_LINK(CancelBtnHdl, weld::Button &, void)
std::unique_ptr< weld::Label > m_xFtInfo
Definition: namedlg.hxx:69
void Init()
Definition: namedlg.cxx:101
std::unique_ptr< weld::CheckButton > m_xBtnRowHeader
Definition: namedlg.hxx:62
void SetEntry(const OUString &rName, const OUString &rScope)
Definition: namedlg.cxx:306
DECL_LINK(ScopeChangedHdl, weld::ComboBox &, void)
std::unique_ptr< weld::Entry > m_xEdName
Definition: namedlg.hxx:53
void UpdateChecks(const ScRangeData *pData)
Definition: namedlg.cxx:213
virtual bool IsRefInputMode() const override
Definition: namedlg.cxx:147
virtual void SetActive() override
Definition: namedlg.cxx:207
void ScopeChanged()
Definition: namedlg.cxx:444
bool IsNameValid()
Definition: namedlg.cxx:239
DECL_LINK(EdModifyHdl, weld::Entry &, void)
std::unique_ptr< weld::Label > m_xFtAssign
Definition: namedlg.hxx:54
std::unique_ptr< weld::CheckButton > m_xBtnCriteria
Definition: namedlg.hxx:61
DECL_LINK(EdModifyCheckBoxHdl, weld::Toggleable &, void)
ScNameDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData, const ScAddress &aCursorPos, std::map< OUString, std::unique_ptr< ScRangeName > > *pRangeMap=nullptr)
Definition: namedlg.cxx:43
const OUString maGlobalNameStr
Definition: namedlg.hxx:35
virtual void Close() override
Definition: namedlg.cxx:170
void GetRangeNames(std::map< OUString, std::unique_ptr< ScRangeName > > &rRangeMap)
Definition: namedlg.cxx:449
ScDocument & mrDoc
Definition: namedlg.hxx:42
DECL_LINK(RefEdModifyHdl, formula::RefEdit &, void)
ScViewData & mrViewData
Definition: namedlg.hxx:41
OUString maStrInfoDefault
Definition: namedlg.hxx:39
std::unique_ptr< weld::CheckButton > m_xBtnColHeader
Definition: namedlg.hxx:60
std::unique_ptr< ScRangeManagerTable > m_xRangeManagerTable
Definition: namedlg.hxx:73
void SelectionChanged()
Definition: namedlg.cxx:402
RangeNameContainer m_RangeMap
Definition: namedlg.hxx:51
void ShowOptions(const ScRangeNameLine &rLine)
Definition: namedlg.cxx:289
const OUString maErrInvalidNameStr
Definition: namedlg.hxx:36
void RemovePushed()
Definition: namedlg.cxx:318
void AddPushed()
Definition: namedlg.cxx:299
std::unique_ptr< weld::ComboBox > m_xLbScope
Definition: namedlg.hxx:57
DECL_LINK(RemoveBtnHdl, weld::Button &, void)
ScRangeName * GetRangeName(const OUString &rScope)
Definition: namedlg.cxx:281
const OUString maStrMultiSelect
Definition: namedlg.hxx:38
DECL_LINK(SelectionChangedHdl_Impl, weld::TreeView &, void)
DECL_LINK(AddBtnHdl, weld::Button &, void)
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
Definition: namedlg.cxx:158
std::unique_ptr< weld::Button > m_xBtnAdd
Definition: namedlg.hxx:64
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: namedlg.hxx:67
std::unique_ptr< weld::Expander > m_xExpander
Definition: namedlg.hxx:71
DECL_LINK(AssignGetFocusHdl, formula::RefEdit &, void)
virtual void RefInputDone(bool bForced=false) override
Definition: namedlg.cxx:152
DECL_LINK(OkBtnHdl, weld::Button &, void)
const ScAddress maCursorPos
Definition: namedlg.hxx:43
std::unique_ptr< formula::RefButton > m_xRbAssign
Definition: namedlg.hxx:56
std::unique_ptr< formula::RefEdit > m_xEdAssign
Definition: namedlg.hxx:55
bool mbCloseWithoutUndo
Definition: namedlg.hxx:47
std::unique_ptr< weld::Button > m_xBtnOk
Definition: namedlg.hxx:66
virtual ~ScNameDlg() override
Definition: namedlg.cxx:97