diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-03-21 22:41:51 +0100 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-20 01:26:01 -0400 |
commit | d33fa42d7202a167ebd05ce9adf252b9c8475a15 (patch) | |
tree | bfe3b73ddd967fac28c448160b130c68be08cc41 /sc | |
parent | 31224ed0b55bfa6ae35813758f004fa4c75372f7 (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>
(cherry picked from commit a7ba6358eec442aaa28fdd952102dbd10ca2569e)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/nameuno.hxx | 6 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 50 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 3 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 13 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/rangenam.cxx | 30 | ||||
-rw-r--r-- | sc/source/filter/excel/xiname.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/inc/xiname.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedefdlg.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namemgrtable.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/areasdlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/nameuno.cxx | 38 | ||||
-rw-r--r-- | sc/source/ui/vba/vbanames.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 10 |
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 4db3e39d320a..70fb4c9d2442 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 ); @@ -112,9 +114,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; @@ -156,8 +158,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 3be2f8e8cb28..8d210272102b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -6817,7 +6817,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 75ef6a2ba0c0..3278bbff7dca 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -114,7 +114,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) { @@ -2678,7 +2678,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); @@ -2720,7 +2721,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); @@ -2777,7 +2778,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); @@ -5826,7 +5827,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); @@ -6003,7 +6004,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 0ae4e7ac761b..c519f1efe4a1 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -219,7 +219,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 dd2db2bd818d..0377890b2326 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) : @@ -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()) @@ -381,7 +381,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; @@ -389,7 +389,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; @@ -397,7 +397,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; @@ -528,10 +528,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; } @@ -638,9 +638,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 99b889af7274..e1c540fae0cb 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 f62f350a69ee..2a7d48516fd6 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -3106,11 +3106,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 a631c537b92b..3a808e485ea9 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -165,7 +165,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 ace2efa791aa..10faf54726c4 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5090,7 +5090,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(); @@ -5098,7 +5098,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; } @@ -5129,13 +5129,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 3ca38ac018cf..bae39ce04534 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2186,9 +2186,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 5988bdb88854..8034bc755217 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 7c813258f283..925fd6f44615 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -225,7 +225,7 @@ void ScNameDefDlg::AddPushed() { if ( mpDoc ) { - RangeType nType = RT_NAME; + ScRangeData::Type nType = ScRangeData::Type::Name; ScRangeData* pNewEntry = new ScRangeData( mpDoc, aName, @@ -233,11 +233,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 5426964f11f5..05d8df07dcb1 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -262,10 +262,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 ); @@ -417,11 +417,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 5d9f76d2f7c5..615549d43603 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) & SCA_VALID) { - if (itr->second->HasType(RT_PRINTAREA)) + if (itr->second->HasType(ScRangeData::Type::PrintArea)) { aSymbol = aRange.Format(SCR_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 ec276a7fef37..1b064cc6c3e0 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" @@ -205,7 +204,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); @@ -220,7 +219,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 ebcee5d1941c..2062d8e8bbad 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? |