summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx2
-rw-r--r--sc/source/ui/inc/namedefdlg.hxx1
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx13
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx2
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/vba/vbanames.cxx4
7 files changed, 21 insertions, 7 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 9239398829aa..9f940982a7fc 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1991,7 +1991,7 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
eRet = SC_NAME_INPUT_ROW;
else if ( pDoc->GetTable( rText, nNameTab ) )
eRet = SC_NAME_INPUT_SHEET;
- else if ( ScRangeData::IsNameValid( rText, pDoc ) ) // nothing found, create new range?
+ else if ( ScRangeData::IsNameValid( rText, pDoc ) == ScRangeData::NAME_VALID ) // nothing found, create new range?
{
if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
eRet = SC_NAME_INPUT_DEFINE;
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 8c917580587c..45967294d460 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -416,7 +416,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
if ( !aNewName.isEmpty() && !aNewArea.isEmpty() )
{
- if ( ScRangeData::IsNameValid( aNewName, pDoc ) && aNewName != STR_DB_LOCAL_NONAME )
+ if ( ScRangeData::IsNameValid( aNewName, pDoc ) == ScRangeData::NAME_VALID && aNewName != STR_DB_LOCAL_NONAME )
{
// weil jetzt editiert werden kann, muss erst geparst werden
ScRange aTmpRange;
diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx
index 3a036a91a2b3..447a762af4f5 100644
--- a/sc/source/ui/inc/namedefdlg.hxx
+++ b/sc/source/ui/inc/namedefdlg.hxx
@@ -50,6 +50,7 @@ private:
OUString maStrInfoDefault;
const OUString maGlobalNameStr;
const OUString maErrInvalidNameStr;
+ const OUString maErrInvalidNameCellRefStr;
const OUString maErrNameInUse;
//hack to call this dialog from Manage Names
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index aa9642758f61..23a3c1a43db8 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -36,6 +36,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* p
maGlobalNameStr ( ScGlobal::GetRscString(STR_GLOBAL_SCOPE) ),
maErrInvalidNameStr( ScGlobal::GetRscString(STR_ERR_NAME_INVALID)),
+ maErrInvalidNameCellRefStr( ScGlobal::GetRscString(STR_ERR_NAME_INVALID_CELL_REF)),
maErrNameInUse ( ScGlobal::GetRscString(STR_ERR_NAME_EXISTS)),
maRangeMap( aRangeMap )
{
@@ -150,6 +151,7 @@ bool ScNameDefDlg::IsNameValid()
pRangeName = maRangeMap.find(aScope)->second;
}
+ ScRangeData::IsNameValidType eType;
m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
if ( aName.isEmpty() )
{
@@ -157,10 +159,17 @@ bool ScNameDefDlg::IsNameValid()
m_pFtInfo->SetText(maStrInfoDefault);
return false;
}
- else if (!ScRangeData::IsNameValid( aName, mpDoc ))
+ else if ((eType = ScRangeData::IsNameValid( aName, mpDoc )) != ScRangeData::NAME_VALID)
{
m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
- m_pFtInfo->SetText(maErrInvalidNameStr);
+ if (eType == ScRangeData::NAME_INVALID_BAD_STRING)
+ {
+ m_pFtInfo->SetText(maErrInvalidNameStr);
+ }
+ else if (eType == ScRangeData::NAME_INVALID_CELL_REF)
+ {
+ m_pFtInfo->SetText(maErrInvalidNameCellRefStr);
+ }
m_pBtnAdd->Disable();
return false;
}
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 5a7a8f9df6dc..abf1f5756258 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -278,7 +278,7 @@ bool ScNameDlg::IsNameValid()
ScRangeName* pRangeName = GetRangeName( aScope );
- if (!ScRangeData::IsNameValid( aName, mpDoc ))
+ if (ScRangeData::IsNameValid( aName, mpDoc ) != ScRangeData::NAME_VALID)
{
m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
m_pFtInfo->SetText(maErrInvalidNameStr);
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index b11808fc0a89..dbbd3e48aebe 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -2113,6 +2113,10 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "The selected sheet(s) contain source data of related pivot tables that will be lost. Are you sure you want to delete the selected sheet(s)?";
};
+ String STR_ERR_NAME_INVALID_CELL_REF
+ {
+ Text [ en-US ] = "Invalid name. Reference to a cell, or a range of cells not allowed.";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index f9f1e32b0472..c366521f81e0 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -101,7 +101,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
NameLocal >>= sName;
if ( !sName.isEmpty() )
{
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
+ if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID )
{
OUString sResult ;
sal_Int32 nToken = 0;
@@ -112,7 +112,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
else
sResult = sName.copy( nIndex );
sName = sResult ;
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
+ if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID )
throw uno::RuntimeException( "This Name is not valid ." );
}
}