16 #include <compiler.hxx>
17 #include <document.hxx>
18 #include <globstr.hrc>
25 #include <tokenarray.hxx>
28 const ScViewData& rViewData,
const 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( 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_xExpander(m_xBuilder->weld_expander(
"more"))
52 , m_xFtRange(m_xBuilder->weld_label(
"label3"))
107 if (pCode->GetCodeError() != FormulaError::NONE)
120 OUString aScope =
m_xLbScope->get_active_text();
123 bool bIsNameValid =
true;
137 if ( aName.isEmpty() )
139 bIsNameValid =
false;
152 bIsNameValid =
false;
157 bIsNameValid =
false;
162 bIsNameValid =
false;
174 OUString aScope =
m_xLbScope->get_active_text();
182 if (aScope.isEmpty())
219 if ( FormulaError::NONE == pNewEntry->
GetErrCode() )
221 if ( !pRangeName->
insert( pNewEntry,
false ) )
236 std::make_unique<ScUndoAddRangeData>(
mpDocShell, pNewEntry, nTab) );
271 return m_xEdRange->GetWidget()->get_sensitive();
294 DoClose( ScNameDefDlgWrapper::GetChildWindowId() );
#define LINK(Instance, Class, Member)
std::unique_ptr< weld::Button > m_xBtnCancel
std::unique_ptr< ScTokenArray > CompileString(const OUString &rFormula)
Tokenize formula expression string into an array of tokens.
void SetDocumentModified()
const OUString maErrInvalidNameStr
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
std::unique_ptr< weld::Label > m_xFtRange
std::unique_ptr< weld::Label > m_xFtInfo
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
std::unique_ptr< weld::CheckButton > m_xBtnRowHeader
std::unique_ptr< weld::Entry > m_xEdName
ScNameDefDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const ScViewData &rViewData, const std::map< OUString, ScRangeName * > &aRangeMap, const ScAddress &aCursorPos, const bool bUndo)
SfxApplication * SfxGetpApp()
virtual SfxUndoManager * GetUndoManager() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
void GetNewData(OUString &rName, OUString &rScope)
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
OUString maStrInfoDefault
std::unique_ptr< formula::RefButton > m_xRbRange
virtual void RefInputDone(bool bForced=false) override
std::unique_ptr< formula::RefEdit > m_xEdRange
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
const OUString maErrInvalidNameCellRefStr
#define STR_GLOBAL_RANGE_NAME
std::unique_ptr< weld::Button > m_xBtnAdd
SC_DLLPUBLIC 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...
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString ScResId(const char *pId)
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
virtual void RefInputDone(bool bForced=false) override
virtual ~ScNameDefDlg() override
IMPL_LINK_NOARG(ScNameDefDlg, CancelBtnHdl, weld::Button &, void)
std::unique_ptr< weld::CheckButton > m_xBtnColHeader
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
virtual void SetActive() override
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
static ScTabViewShell * GetActiveViewShell()
std::unique_ptr< weld::ComboBox > m_xLbScope
virtual bool IsRefInputMode() const override
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
SC_DLLPUBLIC FormulaError GetErrCode() const
const OUString maErrNameInUse
std::unique_ptr< weld::CheckButton > m_xBtnCriteria
std::unique_ptr< weld::CheckButton > m_xBtnPrintArea
virtual void Close() override
bool DoClose(sal_uInt16 nId)
std::map< OUString, ScRangeName * > maRangeMap
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
const OUString maGlobalNameStr
void SwitchBetweenRefDialogs(SfxModelessDialogController *pDialog)
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override