summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-03-21 22:41:51 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-03-22 07:01:44 +0000
commita7ba6358eec442aaa28fdd952102dbd10ca2569e (patch)
tree17ac873181eb64519a70201a0e82a0456801f65f
parentd27e3eca2cca1249a0bdd9e6385ca693d471ef9b (diff)
tdf#84938 replace #define with scoped typed_flags
'RangeType' becomes 'Type', goes into ScRangeData and is strongly typed now. This revealed a misuse of RangeType in vbanames.cxx where the uno equivalent was expected, but it had no impact because both values were 0. Change-Id: I0b4764d1411c709a1faa243ec70afeb160410990 Reviewed-on: https://gerrit.libreoffice.org/23415 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sc/inc/nameuno.hxx6
-rw-r--r--sc/inc/rangenam.hxx50
-rw-r--r--sc/qa/unit/ucalc.cxx3
-rw-r--r--sc/qa/unit/ucalc_formula.cxx13
-rw-r--r--sc/source/core/data/documen3.cxx2
-rw-r--r--sc/source/core/tool/rangenam.cxx30
-rw-r--r--sc/source/filter/excel/xiname.cxx8
-rw-r--r--sc/source/filter/inc/xiname.hxx2
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx10
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx10
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx8
-rw-r--r--sc/source/ui/docshell/docsh4.cxx6
-rw-r--r--sc/source/ui/docshell/impex.cxx6
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx12
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx18
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx2
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx10
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx38
-rw-r--r--sc/source/ui/vba/vbanames.cxx5
-rw-r--r--sc/source/ui/view/viewfunc.cxx10
21 files changed, 131 insertions, 120 deletions
diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index df67816b919a..1e1fceb21a88 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -22,6 +22,7 @@
#include <svl/lstner.hxx>
#include "address.hxx"
+#include "rangenam.hxx"
#include <formula/grammar.hxx>
#include <com/sun/star/sheet/XLabelRange.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
@@ -40,9 +41,6 @@
#include <rtl/ref.hxx>
class ScDocShell;
-class ScRangeName;
-class ScRangeData;
-class ScTokenArray;
class ScNamedRangesObj;
class SC_DLLPUBLIC ScNamedRangeObj : public ::cppu::WeakImplHelper<
@@ -65,7 +63,7 @@ friend class ScVbaName;
ScRangeData* GetRangeData_Impl();
void Modify_Impl( const OUString* pNewName,
const ScTokenArray* pNewTokens, const OUString* pNewContent,
- const ScAddress* pNewPos, const sal_uInt16* pNewType,
+ const ScAddress* pNewPos, const ScRangeData::Type* pNewType,
const formula::FormulaGrammar::Grammar eGrammar );
SCTAB GetTab_Impl();
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 8e9e75303d51..676eed4c5603 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -43,26 +43,28 @@ class CompileFormulaContext;
}
-typedef sal_uInt16 RangeType;
-
-#define RT_NAME ((RangeType)0x0000)
-#define RT_DATABASE ((RangeType)0x0001)
-#define RT_CRITERIA ((RangeType)0x0002)
-#define RT_PRINTAREA ((RangeType)0x0004)
-#define RT_COLHEADER ((RangeType)0x0008)
-#define RT_ROWHEADER ((RangeType)0x0010)
-#define RT_ABSAREA ((RangeType)0x0020)
-#define RT_REFAREA ((RangeType)0x0040)
-#define RT_ABSPOS ((RangeType)0x0080)
-
class ScRangeData
{
+public:
+ enum class Type //specialization to typed_flags outside of class
+ {
+ Name = 0x0000,
+ Database = 0x0001,
+ Criteria = 0x0002,
+ PrintArea = 0x0004,
+ ColHeader = 0x0008,
+ RowHeader = 0x0010,
+ AbsArea = 0x0020,
+ RefArea = 0x0040,
+ AbsPos = 0x0080
+ };
+
private:
OUString aName;
OUString aUpperName; // #i62977# for faster searching (aName is never modified after ctor)
ScTokenArray* pCode;
ScAddress aPos;
- RangeType eType;
+ Type eType;
ScDocument* pDoc;
formula::FormulaGrammar::Grammar eTempGrammar; // needed for unresolved XML compiles
sal_uInt16 nIndex;
@@ -83,13 +85,13 @@ public:
const OUString& rName,
const OUString& rSymbol,
const ScAddress& rAdr = ScAddress(),
- RangeType nType = RT_NAME,
+ Type nType = Type::Name,
const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
SC_DLLPUBLIC ScRangeData( ScDocument* pDoc,
const OUString& rName,
const ScTokenArray& rArr,
const ScAddress& rAdr = ScAddress(),
- RangeType nType = RT_NAME );
+ Type nType = Type::Name );
SC_DLLPUBLIC ScRangeData( ScDocument* pDoc,
const OUString& rName,
const ScAddress& rTarget );
@@ -116,9 +118,9 @@ public:
const ScTokenArray* GetCode() const { return pCode; }
SC_DLLPUBLIC sal_uInt16 GetErrCode() const;
bool HasReferences() const;
- void AddType( RangeType nType ) { eType = eType|nType; }
- RangeType GetType() const { return eType; }
- bool HasType( RangeType nType ) const;
+ void AddType( Type nType );
+ Type GetType() const { return eType; }
+ bool HasType( Type nType ) const;
sal_uInt32 GetUnoType() const;
SC_DLLPUBLIC void GetSymbol( OUString& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
SC_DLLPUBLIC void GetSymbol( OUString& rSymbol, const ScAddress& rPos, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
@@ -159,8 +161,18 @@ public:
void Dump() const;
#endif
};
+namespace o3tl
+{
+ template<> struct typed_flags<ScRangeData::Type> : is_typed_flags<ScRangeData::Type, 0xff> {};
+}
+
+
+inline void ScRangeData::AddType( Type nType )
+{
+ eType = eType|nType;
+}
-inline bool ScRangeData::HasType( RangeType nType ) const
+inline bool ScRangeData::HasType( Type nType ) const
{
return ( ( eType & nType ) == nType );
}
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index f9ba17419c6a..77a42e6a8731 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6312,7 +6312,8 @@ bool Test::insertRangeNames(
pDoc,
OUString::createFromAscii(p->mpName),
OUString::createFromAscii(p->mpExpr),
- aA1, 0, formula::FormulaGrammar::GRAM_ENGLISH);
+ aA1, ScRangeData::Type::Name,
+ formula::FormulaGrammar::GRAM_ENGLISH);
pNew->SetIndex(p->mnIndex);
bool bSuccess = pNames->insert(pNew);
if (!bSuccess)
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 1d54d79dc2fa..e8ff482a4100 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -119,7 +119,7 @@ void Test::testFormulaCreateStringFromTokens()
{
ScRangeData* pName = new ScRangeData(
m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr),
- ScAddress(0,0,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
+ ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
if (aNames[i].bGlobal)
{
@@ -2696,7 +2696,8 @@ void Test::testFormulaRefUpdateName()
ScRangeName* pGlobalNames = m_pDoc->GetRangeName();
CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames);
ScRangeData* pName = new ScRangeData(
- m_pDoc, "ToLeft", "RC[-1]", ScAddress(2,1,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1);
+ m_pDoc, "ToLeft", "RC[-1]", ScAddress(2,1,0),
+ ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1);
bool bInserted = pGlobalNames->insert(pName);
CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
@@ -2738,7 +2739,7 @@ void Test::testFormulaRefUpdateName()
// Insert a new named expression that references these values as absolute range.
pName = new ScRangeData(
- m_pDoc, "MyRange", "$B$10:$B$12", ScAddress(0,0,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
+ m_pDoc, "MyRange", "$B$10:$B$12", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
bInserted = pGlobalNames->insert(pName);
CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
@@ -2795,7 +2796,7 @@ void Test::testFormulaRefUpdateName()
pGlobalNames->clear();
pName = new ScRangeData(
- m_pDoc, "MyRange", "$B$1:$C$6", ScAddress(0,0,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
+ m_pDoc, "MyRange", "$B$1:$C$6", ScAddress(0,0,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
bInserted = pGlobalNames->insert(pName);
CPPUNIT_ASSERT_MESSAGE("Failed to insert a new name.", bInserted);
pName->GetSymbol(aExpr);
@@ -5879,7 +5880,7 @@ void Test::testFuncTableRef()
// proper rows.
ScRangeData* pName = new ScRangeData(
m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr),
- ScAddress(2,4,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
+ ScAddress(2,4,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
bool bInserted = pGlobalNames->insert(pName);
CPPUNIT_ASSERT_MESSAGE(
OString("Failed to insert named expression "+ OString(aNames[i].pName) +".").getStr(), bInserted);
@@ -6056,7 +6057,7 @@ void Test::testFuncTableRef()
// proper rows.
ScRangeData* pName = new ScRangeData(
m_pDoc, OUString::createFromAscii(aHlNames[i].pName), OUString::createFromAscii(aHlNames[i].pExpr),
- ScAddress(6,12,0), RT_NAME, formula::FormulaGrammar::GRAM_NATIVE);
+ ScAddress(6,12,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
bool bInserted = pGlobalNames->insert(pName);
CPPUNIT_ASSERT_MESSAGE(
OString("Failed to insert named expression "+ OString(aHlNames[i].pName) +".").getStr(), bInserted);
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index bada3affed38..4374d7b32981 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -218,7 +218,7 @@ bool ScDocument::InsertNewRangeName( const OUString& rName, const ScAddress& rPo
if (!pGlobalNames)
return false;
- ScRangeData* pName = new ScRangeData(this, rName, rExpr, rPos, RT_NAME, GetGrammar());
+ ScRangeData* pName = new ScRangeData(this, rName, rExpr, rPos, ScRangeData::Type::Name, GetGrammar());
return pGlobalNames->insert(pName);
}
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 35e4f5ce5990..a9ab515d99cc 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -49,7 +49,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
const OUString& rName,
const OUString& rSymbol,
const ScAddress& rAddress,
- RangeType nType,
+ Type nType,
const FormulaGrammar::Grammar eGrammar ) :
aName ( rName ),
aUpperName ( ScGlobal::pCharClass->uppercase( rName ) ),
@@ -82,7 +82,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
const OUString& rName,
const ScTokenArray& rArr,
const ScAddress& rAddress,
- RangeType nType ) :
+ Type nType ) :
aName ( rName ),
aUpperName ( ScGlobal::pCharClass->uppercase( rName ) ),
pCode ( new ScTokenArray( rArr ) ),
@@ -106,7 +106,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
aUpperName ( ScGlobal::pCharClass->uppercase( rName ) ),
pCode ( new ScTokenArray() ),
aPos ( rTarget ),
- eType ( RT_NAME ),
+ eType ( Type::Name ),
pDoc ( pDok ),
eTempGrammar( FormulaGrammar::GRAM_UNSPECIFIED ),
nIndex ( 0 ),
@@ -123,7 +123,7 @@ ScRangeData::ScRangeData( ScDocument* pDok,
aComp.SetGrammar(pDoc->GetGrammar());
aComp.CompileTokenArray();
if ( !pCode->GetCodeError() )
- eType |= RT_ABSPOS;
+ eType |= Type::AbsPos;
}
ScRangeData::ScRangeData(const ScRangeData& rScRangeData, ScDocument* pDocument, const ScAddress* pPos) :
@@ -174,9 +174,9 @@ void ScRangeData::CompileRangeData( const OUString& rSymbol, bool bSetError )
// first token is a reference
/* FIXME: wouldn't that need a check if it's exactly one reference? */
if( p->GetType() == svSingleRef )
- eType = eType | RT_ABSPOS;
+ eType = eType | Type::AbsPos;
else
- eType = eType | RT_ABSAREA;
+ eType = eType | Type::AbsArea;
}
// For manual input set an error for an incomplete formula.
if (!pDoc->IsImportingXML())
@@ -380,7 +380,7 @@ bool ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const
bool ScRangeData::IsReference( ScRange& rRange ) const
{
- if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS )) && pCode )
+ if ( (eType & ( Type::AbsArea | Type::RefArea | Type::AbsPos )) && pCode )
return pCode->IsReference(rRange, aPos);
return false;
@@ -388,7 +388,7 @@ bool ScRangeData::IsReference( ScRange& rRange ) const
bool ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
{
- if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) ) && pCode )
+ if ( (eType & ( Type::AbsArea | Type::RefArea | Type::AbsPos ) ) && pCode )
return pCode->IsReference(rRange, rPos);
return false;
@@ -396,7 +396,7 @@ bool ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
bool ScRangeData::IsValidReference( ScRange& rRange ) const
{
- if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) ) && pCode )
+ if ( (eType & ( Type::AbsArea | Type::RefArea | Type::AbsPos ) ) && pCode )
return pCode->IsValidReference(rRange, aPos);
return false;
@@ -531,10 +531,10 @@ bool ScRangeData::HasReferences() const
sal_uInt32 ScRangeData::GetUnoType() const
{
sal_uInt32 nUnoType = 0;
- if ( HasType(RT_CRITERIA) ) nUnoType |= css::sheet::NamedRangeFlag::FILTER_CRITERIA;
- if ( HasType(RT_PRINTAREA) ) nUnoType |= css::sheet::NamedRangeFlag::PRINT_AREA;
- if ( HasType(RT_COLHEADER) ) nUnoType |= css::sheet::NamedRangeFlag::COLUMN_HEADER;
- if ( HasType(RT_ROWHEADER) ) nUnoType |= css::sheet::NamedRangeFlag::ROW_HEADER;
+ if ( HasType(Type::Criteria) ) nUnoType |= css::sheet::NamedRangeFlag::FILTER_CRITERIA;
+ if ( HasType(Type::PrintArea) ) nUnoType |= css::sheet::NamedRangeFlag::PRINT_AREA;
+ if ( HasType(Type::ColHeader) ) nUnoType |= css::sheet::NamedRangeFlag::COLUMN_HEADER;
+ if ( HasType(Type::RowHeader) ) nUnoType |= css::sheet::NamedRangeFlag::ROW_HEADER;
return nUnoType;
}
@@ -641,9 +641,9 @@ void ScRangeData::InitCode()
if( p ) // exact one reference at first
{
if( p->GetType() == svSingleRef )
- eType = eType | RT_ABSPOS;
+ eType = eType | Type::AbsPos;
else
- eType = eType | RT_ABSAREA;
+ eType = eType | Type::AbsArea;
}
}
}
diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 679233cb5227..d09661503c6b 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -36,7 +36,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
mpScData( nullptr ),
mcBuiltIn( EXC_BUILTIN_UNKNOWN ),
mnScTab( SCTAB_MAX ),
- meNameType( RT_NAME ),
+ meNameType( ScRangeData::Type::Name ),
mnXclTab( EXC_NAME_GLOBAL ),
mnNameIndex( nXclNameIdx ),
mbVBName( false ),
@@ -161,11 +161,11 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
{
case EXC_BUILTIN_PRINTAREA:
if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
- meNameType |= RT_PRINTAREA;
+ meNameType |= ScRangeData::Type::PrintArea;
break;
case EXC_BUILTIN_PRINTTITLES:
if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
- meNameType |= RT_COLHEADER | RT_ROWHEADER;
+ meNameType |= ScRangeData::Type::ColHeader | ScRangeData::Type::RowHeader;
break;
}
rStrm.PopPosition();
@@ -188,7 +188,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
break;
case EXC_BUILTIN_CRITERIA:
GetFilterManager().AddAdvancedRange( aRange );
- meNameType |= RT_CRITERIA;
+ meNameType |= ScRangeData::Type::Criteria;
break;
case EXC_BUILTIN_EXTRACT:
if (pTokArr->IsValidReference(aRange, ScAddress()))
diff --git a/sc/source/filter/inc/xiname.hxx b/sc/source/filter/inc/xiname.hxx
index 6cf9465417f2..8c06a13406bd 100644
--- a/sc/source/filter/inc/xiname.hxx
+++ b/sc/source/filter/inc/xiname.hxx
@@ -66,7 +66,7 @@ private:
const ScRangeData* mpScData; /// Pointer to Calc defined name (no ownership).
sal_Unicode mcBuiltIn; /// Excel built-in name index.
SCTAB mnScTab; /// Calc sheet index of local names.
- RangeType meNameType;
+ ScRangeData::Type meNameType;
sal_uInt16 mnXclTab;
sal_uInt16 mnNameIndex;
bool mbVBName:1; /// true = Visual Basic procedure or function.
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 05d904dde711..62bc87d0bc43 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -372,11 +372,11 @@ namespace {
ScRangeData* lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, const Sequence<FormulaToken>& rTokens, sal_Int16 nIndex, sal_Int32 nUnoType )
{
bool bDone = false;
- sal_uInt16 nNewType = RT_NAME;
- if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
- if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
- if ( nUnoType & NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
- if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
+ ScRangeData::Type nNewType = ScRangeData::Type::Name;
+ if ( nUnoType & NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
+ if ( nUnoType & NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
+ if ( nUnoType & NamedRangeFlag::COLUMN_HEADER ) nNewType |= ScRangeData::Type::ColHeader;
+ if ( nUnoType & NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
ScTokenArray aTokenArray;
(void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
ScRangeData* pNew = new ScRangeData( &rDoc, rName, aTokenArray, ScAddress(), nNewType );
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 80b9b773a9f4..68bde0937541 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -3097,11 +3097,11 @@ public:
const OUString& aType = p->sRangeType;
sal_uInt32 nUnoType = ScXMLImport::GetRangeType(aType);
- sal_uInt16 nNewType = RT_NAME;
- if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
- if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
- if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
- if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
+ ScRangeData::Type nNewType = ScRangeData::Type::Name;
+ if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
+ if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
+ if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= ScRangeData::Type::ColHeader;
+ if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
if (mpDoc)
{
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index bedb0b979eda..6ed9c5d03ca9 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -153,7 +153,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end();
for (; itr != itrEnd; ++itr)
{
- if (!itr->second->HasType(RT_CRITERIA))
+ if (!itr->second->HasType(ScRangeData::Type::Criteria))
continue;
const sal_Int32 nInsert = pLbFilterArea->InsertEntry(itr->second->GetName());
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ca13e6d84de4..c61141a34d8c 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5059,7 +5059,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
for (ScRangeName::iterator itr = itrLocalBeg; itr != itrLocalEnd; ++itr)
{
const ScRangeData& r = *itr->second;
- if (!r.HasType(RT_DATABASE))
+ if (!r.HasType(ScRangeData::Type::Database))
++nValidCount;
}
ScRangeName* pList = rDoc.GetRangeName();
@@ -5067,7 +5067,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
for (ScRangeName::iterator itr = itrBeg; itr != itrEnd; ++itr)
{
const ScRangeData& r = *itr->second;
- if (!r.HasType(RT_DATABASE) && !pLocalList->findByUpperName(r.GetUpperName()))
+ if (!r.HasType(ScRangeData::Type::Database) && !pLocalList->findByUpperName(r.GetUpperName()))
++nValidCount;
}
@@ -5098,13 +5098,13 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
for (ScRangeName::iterator itr = itrLocalBeg; itr != itrLocalEnd; ++itr)
{
ScRangeData& r = *itr->second;
- if (!r.HasType(RT_DATABASE))
+ if (!r.HasType(ScRangeData::Type::Database))
ppSortArray[j++] = &r;
}
for (ScRangeName::iterator itr = itrBeg; itr != itrEnd; ++itr)
{
ScRangeData& r = *itr->second;
- if (!r.HasType(RT_DATABASE) && !pLocalList->findByUpperName(itr->first))
+ if (!r.HasType(ScRangeData::Type::Database) && !pLocalList->findByUpperName(itr->first))
ppSortArray[j++] = &r;
}
qsort( static_cast<void*>(ppSortArray.get()), nValidCount, sizeof(ScRangeData*),
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index ad54a5aa62fa..669ee620d0ff 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2198,9 +2198,9 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
const ScRangeData* pData = pRange->findByUpperName(ScGlobal::pCharClass->uppercase(aPos));
if (pData)
{
- if( pData->HasType( RT_REFAREA )
- || pData->HasType( RT_ABSAREA )
- || pData->HasType( RT_ABSPOS ) )
+ if( pData->HasType( ScRangeData::Type::RefArea )
+ || pData->HasType( ScRangeData::Type::AbsArea )
+ || pData->HasType( ScRangeData::Type::AbsPos ) )
pData->GetSymbol( aPos ); // continue with the name's contents
}
}
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 88ec3b2c6656..c018e1dcfc92 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -149,9 +149,9 @@ ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos )
const ScRangeData* pData = pRange->findByUpperName(ScGlobal::pCharClass->uppercase(aPos));
if (pData)
{
- if( pData->HasType( RT_REFAREA )
- || pData->HasType( RT_ABSAREA )
- || pData->HasType( RT_ABSPOS ) )
+ if( pData->HasType( ScRangeData::Type::RefArea )
+ || pData->HasType( ScRangeData::Type::AbsArea )
+ || pData->HasType( ScRangeData::Type::AbsPos ) )
{
pData->GetSymbol(aPos);
}
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 021df03375b3..bb65077b07d5 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -217,7 +217,7 @@ void ScNameDefDlg::AddPushed()
{
if ( mpDoc )
{
- RangeType nType = RT_NAME;
+ ScRangeData::Type nType = ScRangeData::Type::Name;
ScRangeData* pNewEntry = new ScRangeData( mpDoc,
aName,
@@ -225,11 +225,11 @@ void ScNameDefDlg::AddPushed()
maCursorPos,
nType );
- nType = nType
- | (m_pBtnRowHeader->IsChecked() ? RT_ROWHEADER : RangeType(0))
- | (m_pBtnColHeader->IsChecked() ? RT_COLHEADER : RangeType(0))
- | (m_pBtnPrintArea->IsChecked() ? RT_PRINTAREA : RangeType(0))
- | (m_pBtnCriteria->IsChecked() ? RT_CRITERIA : RangeType(0));
+ if ( m_pBtnRowHeader->IsChecked() ) nType |= ScRangeData::Type::RowHeader;
+ if ( m_pBtnColHeader->IsChecked() ) nType |= ScRangeData::Type::ColHeader;
+ if ( m_pBtnPrintArea->IsChecked() ) nType |= ScRangeData::Type::PrintArea;
+ if ( m_pBtnCriteria->IsChecked() ) nType |= ScRangeData::Type::Criteria;
+
pNewEntry->AddType(nType);
// aExpression valid?
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 78f1ac26480b..3be4af38a7f6 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -254,10 +254,10 @@ void ScNameDlg::UpdateChecks(ScRangeData* pData)
m_pBtnColHeader->SetToggleHdl( Link<CheckBox&,void>() );
m_pBtnRowHeader->SetToggleHdl( Link<CheckBox&,void>() );
- m_pBtnCriteria->Check( pData->HasType( RT_CRITERIA ) );
- m_pBtnPrintArea->Check( pData->HasType( RT_PRINTAREA ) );
- m_pBtnColHeader->Check( pData->HasType( RT_COLHEADER ) );
- m_pBtnRowHeader->Check( pData->HasType( RT_ROWHEADER ) );
+ m_pBtnCriteria->Check( pData->HasType( ScRangeData::Type::Criteria ) );
+ m_pBtnPrintArea->Check( pData->HasType( ScRangeData::Type::PrintArea ) );
+ m_pBtnColHeader->Check( pData->HasType( ScRangeData::Type::ColHeader ) );
+ m_pBtnRowHeader->Check( pData->HasType( ScRangeData::Type::RowHeader ) );
// Restore handlers so user input is processed again
Link<CheckBox&,void> aToggleHandler = LINK( this, ScNameDlg, EdModifyCheckBoxHdl );
@@ -408,11 +408,11 @@ void ScNameDlg::NameModified()
pOldRangeName->erase(*pData);
mbNeedUpdate = false;
m_pRangeManagerTable->DeleteSelectedEntries();
- RangeType nType = RT_NAME |
- (m_pBtnRowHeader->IsChecked() ? RT_ROWHEADER : RangeType(0))
- |(m_pBtnColHeader->IsChecked() ? RT_COLHEADER : RangeType(0))
- |(m_pBtnPrintArea->IsChecked() ? RT_PRINTAREA : RangeType(0))
- |(m_pBtnCriteria->IsChecked() ? RT_CRITERIA : RangeType(0));
+ ScRangeData::Type nType = ScRangeData::Type::Name;
+ if ( m_pBtnRowHeader->IsChecked() ) nType |= ScRangeData::Type::RowHeader;
+ if ( m_pBtnColHeader->IsChecked() ) nType |= ScRangeData::Type::ColHeader;
+ if ( m_pBtnPrintArea->IsChecked() ) nType |= ScRangeData::Type::PrintArea;
+ if ( m_pBtnCriteria->IsChecked() ) nType |= ScRangeData::Type::Criteria;
ScRangeData* pNewEntry = new ScRangeData( mpDoc, aNewName, aExpr,
maCursorPos, nType);
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 0a557a627586..6abb349a338f 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -154,7 +154,7 @@ void ScRangeManagerTable::Init()
for (ScRangeName::const_iterator it = pLocalRangeName->begin();
it != pLocalRangeName->end(); ++it)
{
- if (!it->second->HasType(RT_DATABASE))
+ if (!it->second->HasType(ScRangeData::Type::Database))
{
aLine.aName = it->second->GetName();
addEntry(aLine, false);
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index f4107c7d63ba..541d38d84e29 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -430,7 +430,9 @@ void ScPrintAreasDlg::Impl_FillLists()
ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end();
for (; itr != itrEnd; ++itr)
{
- if (!itr->second->HasType(RT_ABSAREA) && !itr->second->HasType(RT_REFAREA) && !itr->second->HasType(RT_ABSPOS))
+ if (!itr->second->HasType(ScRangeData::Type::AbsArea )
+ && !itr->second->HasType(ScRangeData::Type::RefArea)
+ && !itr->second->HasType(ScRangeData::Type::AbsPos ))
continue;
OUString aName = itr->second->GetName();
@@ -438,7 +440,7 @@ void ScPrintAreasDlg::Impl_FillLists()
itr->second->GetSymbol(aSymbol);
if (aRange.ParseAny(aSymbol, pDoc, eConv) & ScRefFlags::VALID)
{
- if (itr->second->HasType(RT_PRINTAREA))
+ if (itr->second->HasType(ScRangeData::Type::PrintArea))
{
aSymbol = aRange.Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
pLbPrintArea->SetEntryData(
@@ -446,7 +448,7 @@ void ScPrintAreasDlg::Impl_FillLists()
new OUString(aSymbol) );
}
- if (itr->second->HasType(RT_ROWHEADER))
+ if (itr->second->HasType(ScRangeData::Type::RowHeader))
{
lcl_GetRepeatRangeString(&aRange, pDoc, true, aSymbol);
pLbRepeatRow->SetEntryData(
@@ -454,7 +456,7 @@ void ScPrintAreasDlg::Impl_FillLists()
new OUString(aSymbol) );
}
- if (itr->second->HasType(RT_COLHEADER))
+ if (itr->second->HasType(ScRangeData::Type::ColHeader))
{
lcl_GetRepeatRangeString(&aRange, pDoc, false, aSymbol);
pLbRepeatCol->SetEntryData(
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 2e390f68d068..598604314805 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -78,7 +78,7 @@ static bool lcl_UserVisibleName(const ScRangeData& rData)
{
//! as method to ScRangeData
- return !rData.HasType(RT_DATABASE);
+ return !rData.HasType(ScRangeData::Type::Database);
}
ScNamedRangeObj::ScNamedRangeObj( rtl::Reference< ScNamedRangesObj > xParent, ScDocShell* pDocSh, const OUString& rNm, Reference<container::XNamed> xSheet):
@@ -150,7 +150,7 @@ SCTAB ScNamedRangeObj::GetTab_Impl()
// sheet::XNamedRange
void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray* pNewTokens, const OUString* pNewContent,
- const ScAddress* pNewPos, const sal_uInt16* pNewType,
+ const ScAddress* pNewPos, const ScRangeData::Type* pNewType,
const formula::FormulaGrammar::Grammar eGrammar )
{
if (!pDocShell)
@@ -185,7 +185,7 @@ void ScNamedRangeObj::Modify_Impl( const OUString* pNewName, const ScTokenArray*
if (pNewPos)
aPos = *pNewPos;
- sal_uInt16 nType = pOld->GetType();
+ ScRangeData::Type nType = pOld->GetType();
if (pNewType)
nType = *pNewType;
@@ -293,12 +293,11 @@ sal_Int32 SAL_CALL ScNamedRangeObj::getType() throw(uno::RuntimeException, std::
ScRangeData* pData = GetRangeData_Impl();
if (pData)
{
- // do not return internal RT_* flags
- // see property 'IsSharedFormula' for RT_SHARED
- if ( pData->HasType(RT_CRITERIA) ) nType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
- if ( pData->HasType(RT_PRINTAREA) ) nType |= sheet::NamedRangeFlag::PRINT_AREA;
- if ( pData->HasType(RT_COLHEADER) ) nType |= sheet::NamedRangeFlag::COLUMN_HEADER;
- if ( pData->HasType(RT_ROWHEADER) ) nType |= sheet::NamedRangeFlag::ROW_HEADER;
+ // do not return internal ScRangeData::Type flags
+ if ( pData->HasType(ScRangeData::Type::Criteria) ) nType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
+ if ( pData->HasType(ScRangeData::Type::PrintArea) ) nType |= sheet::NamedRangeFlag::PRINT_AREA;
+ if ( pData->HasType(ScRangeData::Type::ColHeader) ) nType |= sheet::NamedRangeFlag::COLUMN_HEADER;
+ if ( pData->HasType(ScRangeData::Type::RowHeader) ) nType |= sheet::NamedRangeFlag::ROW_HEADER;
}
return nType;
}
@@ -306,13 +305,12 @@ sal_Int32 SAL_CALL ScNamedRangeObj::getType() throw(uno::RuntimeException, std::
void SAL_CALL ScNamedRangeObj::setType( sal_Int32 nUnoType )
throw (uno::RuntimeException, std::exception)
{
- // see property 'IsSharedFormula' for RT_SHARED
SolarMutexGuard aGuard;
- sal_uInt16 nNewType = RT_NAME;
- if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
- if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
- if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
- if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
+ ScRangeData::Type nNewType = ScRangeData::Type::Name;
+ if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
+ if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
+ if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= ScRangeData::Type::ColHeader;
+ if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
// GRAM_PODF_A1 for API compatibility.
Modify_Impl( nullptr, nullptr, nullptr, nullptr, &nNewType,formula::FormulaGrammar::GRAM_PODF_A1 );
@@ -503,11 +501,11 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName,
SolarMutexGuard aGuard;
ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, aPosition.Sheet );
- sal_uInt16 nNewType = RT_NAME;
- if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
- if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
- if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
- if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
+ ScRangeData::Type nNewType = ScRangeData::Type::Name;
+ if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
+ if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
+ if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= ScRangeData::Type::ColHeader;
+ if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= ScRangeData::Type::RowHeader;
bool bDone = false;
if (pDocShell)
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index 75e0edd29c9e..22db74ad12a2 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -26,7 +26,6 @@
#include "vbarange.hxx"
#include "vbaglobals.hxx"
#include <vector>
-#include <rangenam.hxx>
#include <vcl/msgbox.hxx>
#include "tabvwsh.hxx"
#include "viewdata.hxx"
@@ -204,7 +203,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
uno::Any xAny2 ;
if ( mxNames.is() )
{
- RangeType nType = RT_NAME;
+ sal_Int32 nUnoType = 0;
table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
if ( mxNames->hasByName( sName ) )
mxNames->removeByName(sName);
@@ -219,7 +218,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
sTmp += ",";
sTmp = sTmp + "'" + xRange->getWorksheet()->getName() + "'." + sRangeAdd;
}
- mxNames->addNewByName( sName , sTmp , aCellAddr , (sal_Int32)nType);
+ mxNames->addNewByName( sName , sTmp , aCellAddr , nUnoType);
return Item( uno::makeAny( sName ), uno::Any() );
}
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index c3d74241be3b..7c46a85e8df8 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2640,19 +2640,19 @@ bool ScViewFunc::InsertName( const OUString& rName, const OUString& rSymbol,
SCTAB nTab = GetViewData().GetTabNo();
ScRangeName* pList = rDoc.GetRangeName();
- RangeType nType = RT_NAME;
+ ScRangeData::Type nType = ScRangeData::Type::Name;
ScRangeData* pNewEntry = new ScRangeData( &rDoc, rName, rSymbol,
ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(),
nTab), nType );
OUString aUpType = rType.toAsciiUpperCase();
if ( aUpType.indexOf( 'P' ) != -1 )
- nType |= RT_PRINTAREA;
+ nType |= ScRangeData::Type::PrintArea;
if ( aUpType.indexOf( 'R' ) != -1 )
- nType |= RT_ROWHEADER;
+ nType |= ScRangeData::Type::RowHeader;
if ( aUpType.indexOf( 'C' ) != -1 )
- nType |= RT_COLHEADER;
+ nType |= ScRangeData::Type::ColHeader;
if ( aUpType.indexOf( 'F' ) != -1 )
- nType |= RT_CRITERIA;
+ nType |= ScRangeData::Type::Criteria;
pNewEntry->AddType(nType);
if ( !pNewEntry->GetErrCode() ) // text valid?