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, 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<ScRangeManagerTable> m_xRangeManagerTable;
72
73private:
74 void Init();
75 void UpdateChecks(const ScRangeData* pData);
76 void ShowOptions(const ScRangeNameLine& rLine);
77
78 bool IsNameValid();
79 bool IsFormulaValid();
80 void CheckForEmptyTable();
81
82 ScRangeName* GetRangeName(const OUString& rScope);
83
84 void AddPushed();
85 void RemovePushed();
86 void ScopeChanged();
87 void NameModified();
88
89 void SelectionChanged();
90
91 // Handler:
92 DECL_LINK(OkBtnHdl, weld::Button&, void);
93 DECL_LINK(CancelBtnHdl, weld::Button&, void);
94 DECL_LINK(AddBtnHdl, weld::Button&, void);
95 DECL_LINK(RemoveBtnHdl, weld::Button&, void);
96 DECL_LINK(EdModifyHdl, weld::Entry&, void);
97 DECL_LINK(RefEdModifyHdl, formula::RefEdit&, void);
98 DECL_LINK(EdModifyCheckBoxHdl, weld::Toggleable&, void);
99 DECL_LINK(AssignGetFocusHdl, formula::RefEdit&, void);
100 DECL_LINK(SelectionChangedHdl_Impl, weld::TreeView&, void);
101 DECL_LINK(ScopeChangedHdl, weld::ComboBox&, void);
102
103protected:
104 virtual void RefInputDone(bool bForced = false) override;
105
106public:
107 ScNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScViewData& rViewData,
108 const ScAddress& aCursorPos, std::map<OUString, ScRangeName>* pRangeMap = nullptr);
109 virtual ~ScNameDlg() override;
110
111 virtual void SetReference(const ScRange& rRef, ScDocument& rDoc) override;
112 virtual bool IsRefInputMode() const override;
113
114 virtual void SetActive() override;
115 virtual void Close() override;
116
117 void GetRangeNames(std::map<OUString, ScRangeName>& rRangeMap);
118 void SetEntry(const OUString& rName, const OUString& rScope);
119};
120
121/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CheckForEmptyTable()
Definition: namedlg.cxx:176
bool IsFormulaValid()
Definition: namedlg.cxx:265
void GetRangeNames(std::map< OUString, ScRangeName > &rRangeMap)
Definition: namedlg.cxx:448
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:335
bool mbDataChanged
Definition: namedlg.hxx:45
DECL_LINK(CancelBtnHdl, weld::Button &, void)
std::unique_ptr< weld::Label > m_xFtInfo
Definition: namedlg.hxx:69
void Init()
Definition: namedlg.cxx:100
std::unique_ptr< weld::CheckButton > m_xBtnRowHeader
Definition: namedlg.hxx:62
void SetEntry(const OUString &rName, const OUString &rScope)
Definition: namedlg.cxx:305
DECL_LINK(ScopeChangedHdl, weld::ComboBox &, void)
std::map< OUString, ScRangeName > RangeNameContainer
Definition: namedlg.hxx:49
std::unique_ptr< weld::Entry > m_xEdName
Definition: namedlg.hxx:53
void UpdateChecks(const ScRangeData *pData)
Definition: namedlg.cxx:212
virtual bool IsRefInputMode() const override
Definition: namedlg.cxx:146
virtual void SetActive() override
Definition: namedlg.cxx:206
void ScopeChanged()
Definition: namedlg.cxx:443
bool IsNameValid()
Definition: namedlg.cxx:238
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)
const OUString maGlobalNameStr
Definition: namedlg.hxx:35
virtual void Close() override
Definition: namedlg.cxx:169
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:71
void SelectionChanged()
Definition: namedlg.cxx:401
RangeNameContainer m_RangeMap
Definition: namedlg.hxx:51
void ShowOptions(const ScRangeNameLine &rLine)
Definition: namedlg.cxx:288
const OUString maErrInvalidNameStr
Definition: namedlg.hxx:36
void RemovePushed()
Definition: namedlg.cxx:317
void AddPushed()
Definition: namedlg.cxx:298
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:280
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:157
std::unique_ptr< weld::Button > m_xBtnAdd
Definition: namedlg.hxx:64
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: namedlg.hxx:67
DECL_LINK(AssignGetFocusHdl, formula::RefEdit &, void)
virtual void RefInputDone(bool bForced=false) override
Definition: namedlg.cxx:151
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
ScNameDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData, const ScAddress &aCursorPos, std::map< OUString, ScRangeName > *pRangeMap=nullptr)
Definition: namedlg.cxx:43
std::unique_ptr< weld::Button > m_xBtnOk
Definition: namedlg.hxx:66
virtual ~ScNameDlg() override
Definition: namedlg.cxx:96