23#include <compiler.hxx>
24#include <document.hxx>
33#include <tokenarray.hxx>
46 std::map<OUString, ScRangeName> *
const pRangeMap)
50 , maGlobalNameStr(
ScResId(STR_GLOBAL_SCOPE))
51 , maErrInvalidNameStr(
ScResId(STR_ERR_NAME_INVALID))
52 , maErrNameInUse(
ScResId(STR_ERR_NAME_EXISTS))
53 , maStrMultiSelect(
ScResId(STR_MULTI_SELECT))
55 , mrViewData(rViewData)
56 , mrDoc(rViewData.GetDocument())
57 , maCursorPos(aCursorPos)
58 , mbDataChanged(false)
59 , mbCloseWithoutUndo(false)
61 , m_xEdName(m_xBuilder->weld_entry(
"name"))
62 , m_xFtAssign(m_xBuilder->weld_label(
"label3"))
63 , m_xEdAssign(new
formula::RefEdit(m_xBuilder->weld_entry(
"range")))
64 , m_xRbAssign(new
formula::RefButton(m_xBuilder->weld_button(
"assign")))
65 , m_xLbScope(m_xBuilder->weld_combo_box(
"scope"))
66 , m_xBtnPrintArea(m_xBuilder->weld_check_button(
"printrange"))
67 , m_xBtnColHeader(m_xBuilder->weld_check_button(
"colheader"))
68 , m_xBtnCriteria(m_xBuilder->weld_check_button(
"filter"))
69 , m_xBtnRowHeader(m_xBuilder->weld_check_button(
"rowheader"))
70 , m_xBtnAdd(m_xBuilder->weld_button(
"add"))
71 , m_xBtnDelete(m_xBuilder->weld_button(
"delete"))
72 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
73 , m_xBtnCancel(m_xBuilder->weld_button(
"cancel"))
74 , m_xFtInfo(m_xBuilder->weld_label(
"info"))
82 std::map<OUString, ScRangeName*> aRangeMap;
84 for (
const auto& [aTemp, pRangeName] : aRangeMap)
86 m_RangeMap.insert(std::make_pair(aTemp, *pRangeName));
104 std::unique_ptr<weld::TreeView> xTreeView(m_xBuilder->weld_tree_view(
"names"));
105 xTreeView->set_size_request(xTreeView->get_approximate_digit_width() * 75,
106 xTreeView->get_height_rows(10));
173 DoClose(ScNameDlgWrapper::GetChildWindowId());
240 OUString aScope =
m_xLbScope->get_active_text();
269 if (pCode->GetCodeError() != FormulaError::NONE)
307 if (!rName.isEmpty())
325 OSL_ENSURE(
pData,
"table and model should be in sync");
339 OUString aOldName = aLine.
aName;
340 OUString aNewName =
m_xEdName->get_text();
341 aNewName = aNewName.trim();
343 if (aNewName != aOldName)
359 OUString aOldScope = aLine.
aScope;
361 if (aOldScope.isEmpty())
364 OUString aNewScope =
m_xLbScope->get_active_text();
369 OSL_ENSURE(
pData,
"model and table should be in sync");
376 sal_uInt16
nIndex = (aNewScope != aOldScope ? 0 :
pData->GetIndex());
390 pNewRangeName->
insert(pNewEntry,
false );
391 aLine.
aName = aNewName;
460 mbCloseWithoutUndo =
true;
491 RefEdModifyHdl(*m_xEdAssign);
static bool Reschedule(bool bHandleAllCurrentEvents=false)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
std::unique_ptr< ScTokenArray > CompileString(const OUString &rFormula)
Tokenize formula expression string into an array of tokens.
void ModifyAllRangeNames(const std::map< OUString, ScRangeName > &rRangeMap)
Modify all range names, global scope names as well as sheet local ones, in one go.
SC_DLLPUBLIC void GetRangeNameMap(std::map< OUString, ScRangeName * > &rRangeName)
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC SCTAB GetTableCount() const
static SC_DLLPUBLIC const CharClass & getCharClass()
void CheckForEmptyTable()
void GetRangeNames(std::map< OUString, ScRangeName > &rRangeMap)
std::unique_ptr< weld::Button > m_xBtnDelete
const OUString maErrNameInUse
std::unique_ptr< weld::CheckButton > m_xBtnPrintArea
std::unique_ptr< weld::Label > m_xFtInfo
std::unique_ptr< weld::CheckButton > m_xBtnRowHeader
void SetEntry(const OUString &rName, const OUString &rScope)
std::unique_ptr< weld::Entry > m_xEdName
void UpdateChecks(const ScRangeData *pData)
virtual bool IsRefInputMode() const override
virtual void SetActive() override
std::unique_ptr< weld::Label > m_xFtAssign
std::unique_ptr< weld::CheckButton > m_xBtnCriteria
const OUString maGlobalNameStr
virtual void Close() override
OUString maStrInfoDefault
std::unique_ptr< weld::CheckButton > m_xBtnColHeader
std::unique_ptr< ScRangeManagerTable > m_xRangeManagerTable
RangeNameContainer m_RangeMap
void ShowOptions(const ScRangeNameLine &rLine)
const OUString maErrInvalidNameStr
std::unique_ptr< weld::ComboBox > m_xLbScope
ScRangeName * GetRangeName(const OUString &rScope)
const OUString maStrMultiSelect
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
std::unique_ptr< weld::Button > m_xBtnAdd
std::unique_ptr< weld::Button > m_xBtnCancel
virtual void RefInputDone(bool bForced=false) override
const ScAddress maCursorPos
std::unique_ptr< formula::RefButton > m_xRbAssign
std::unique_ptr< formula::RefEdit > m_xEdAssign
ScNameDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData, const ScAddress &aCursorPos, std::map< OUString, ScRangeName > *pRangeMap=nullptr)
std::unique_ptr< weld::Button > m_xBtnOk
virtual ~ScNameDlg() override
void SetIndex(sal_uInt16 nInd)
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
void erase(const ScRangeData &r)
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
virtual void RefInputDone(bool bForced=false) override
bool DoClose(sal_uInt16 nId)
void SwitchBetweenRefDialogs(SfxModelessDialogController *pDialog)
static ScTabViewShell * GetActiveViewShell()
ScDocFunc & GetDocFunc() const
ScXMLEditAttributeMap::Entry const aEntries[]
constexpr OUStringLiteral STR_GLOBAL_RANGE_NAME
#define LINK(Instance, Class, Member)
std::unique_ptr< sal_Int32[]> pData
IMPL_LINK_NOARG(ScNameDlg, OkBtnHdl, weld::Button &, void)
OUString ScResId(TranslateId aId)