16#include <compiler.hxx>
17#include <document.hxx>
25#include <tokenarray.hxx>
28 const ScViewData& rViewData, std::map<OUString, ScRangeName*>&& aRangeMap,
29 const ScAddress& aCursorPos,
const bool bUndo )
32 , mrDoc(rViewData.GetDocument())
33 , mpDocShell ( rViewData.GetDocShell() )
34 , maCursorPos( aCursorPos )
35 , maGlobalNameStr (
ScResId(STR_GLOBAL_SCOPE) )
36 , maErrInvalidNameStr(
ScResId(STR_ERR_NAME_INVALID))
37 , maErrInvalidNameCellRefStr(
ScResId(STR_ERR_NAME_INVALID_CELL_REF))
38 , maErrNameInUse (
ScResId(STR_ERR_NAME_EXISTS))
39 , maRangeMap(
std::move(aRangeMap) )
40 , m_xEdName(m_xBuilder->weld_entry(
"edit"))
41 , m_xEdRange(new
formula::RefEdit(m_xBuilder->weld_entry(
"range")))
42 , m_xRbRange(new
formula::RefButton(m_xBuilder->weld_button(
"refbutton")))
43 , m_xLbScope(m_xBuilder->weld_combo_box(
"scope"))
44 , m_xBtnRowHeader(m_xBuilder->weld_check_button(
"rowheader"))
45 , m_xBtnColHeader(m_xBuilder->weld_check_button(
"colheader"))
46 , m_xBtnPrintArea(m_xBuilder->weld_check_button(
"printarea"))
47 , m_xBtnCriteria(m_xBuilder->weld_check_button(
"filter"))
48 , m_xBtnAdd(m_xBuilder->weld_button(
"add"))
49 , m_xBtnCancel(m_xBuilder->weld_button(
"cancel"))
50 , m_xFtInfo(m_xBuilder->weld_label(
"label"))
51 , m_xFtRange(m_xBuilder->weld_label(
"label3"))
106 if (pCode->GetCodeError() != FormulaError::NONE)
119 OUString aScope =
m_xLbScope->get_active_text();
122 bool bIsNameValid =
true;
136 if (
aName.isEmpty() )
138 bIsNameValid =
false;
151 bIsNameValid =
false;
156 bIsNameValid =
false;
161 bIsNameValid =
false;
173 OUString aScope =
m_xLbScope->get_active_text();
181 if (aScope.isEmpty())
218 if ( FormulaError::NONE == pNewEntry->
GetErrCode() )
220 if ( !pRangeName->
insert( pNewEntry,
false ) )
235 std::make_unique<ScUndoAddRangeData>(
mpDocShell, pNewEntry, nTab) );
270 return m_xEdRange->GetWidget()->get_sensitive();
293 DoClose( ScNameDefDlgWrapper::GetChildWindowId() );
SfxApplication * SfxGetpApp()
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 SetDocumentModified()
virtual SfxUndoManager * GetUndoManager() override
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
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()
OUString maStrInfoDefault
ScNameDefDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const ScViewData &rViewData, std::map< OUString, ScRangeName * > &&aRangeMap, const ScAddress &aCursorPos, const bool bUndo)
std::unique_ptr< weld::Button > m_xBtnCancel
const OUString maErrNameInUse
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
const OUString maErrInvalidNameCellRefStr
std::unique_ptr< formula::RefEdit > m_xEdRange
std::unique_ptr< weld::CheckButton > m_xBtnRowHeader
std::unique_ptr< weld::ComboBox > m_xLbScope
std::unique_ptr< weld::CheckButton > m_xBtnColHeader
virtual void Close() override
virtual ~ScNameDefDlg() override
const OUString maGlobalNameStr
virtual bool IsRefInputMode() const override
virtual void SetActive() override
std::unique_ptr< weld::Label > m_xFtRange
std::unique_ptr< formula::RefButton > m_xRbRange
std::unique_ptr< weld::CheckButton > m_xBtnPrintArea
virtual void RefInputDone(bool bForced=false) override
std::map< OUString, ScRangeName * > maRangeMap
std::unique_ptr< weld::Button > m_xBtnAdd
void GetNewData(OUString &rName, OUString &rScope)
const OUString maErrInvalidNameStr
std::unique_ptr< weld::Entry > m_xEdName
std::unique_ptr< weld::CheckButton > m_xBtnCriteria
std::unique_ptr< weld::Label > m_xFtInfo
SC_DLLPUBLIC FormulaError GetErrCode() const
@ NAME_INVALID_BAD_STRING
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
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()
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
constexpr OUStringLiteral STR_GLOBAL_RANGE_NAME
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(ScNameDefDlg, CancelBtnHdl, weld::Button &, void)
OUString ScResId(TranslateId aId)