sc/inc/address.hxx | 91 + sc/inc/attrib.hxx | 3 sc/inc/rangelst.hxx | 6 sc/inc/rangeutl.hxx | 8 sc/qa/unit/copy_paste_test.cxx | 4 sc/qa/unit/helper/qahelper.cxx | 14 sc/qa/unit/ucalc.cxx | 2 sc/qa/unit/ucalc_formula.cxx | 164 +-- sc/qa/unit/ucalc_pivottable.cxx | 6 sc/qa/unit/ucalc_sort.cxx | 2 sc/source/core/data/bcaslot.cxx | 6 sc/source/core/data/conditio.cxx | 2 sc/source/core/data/documen5.cxx | 12 sc/source/core/data/dpcache.cxx | 2 sc/source/core/data/formulacell.cxx | 12 sc/source/core/data/validat.cxx | 4 sc/source/core/tool/address.cxx | 522 +++++----- sc/source/core/tool/chartarr.cxx | 4 sc/source/core/tool/chgtrack.cxx | 12 sc/source/core/tool/compiler.cxx | 60 - sc/source/core/tool/grouparealistener.cxx | 4 sc/source/core/tool/interpr1.cxx | 20 sc/source/core/tool/rangelst.cxx | 28 sc/source/core/tool/rangenam.cxx | 4 sc/source/core/tool/rangeutl.cxx | 66 - sc/source/core/tool/reffind.cxx | 30 sc/source/filter/excel/xecontent.cxx | 2 sc/source/filter/excel/xename.cxx | 4 sc/source/filter/excel/xestream.cxx | 6 sc/source/filter/excel/xicontent.cxx | 4 sc/source/filter/excel/xilink.cxx | 4 sc/source/filter/oox/worksheetbuffer.cxx | 2 sc/source/filter/oox/worksheethelper.cxx | 3 sc/source/filter/xcl97/xcl97rec.cxx | 26 sc/source/filter/xml/xmlexprt.cxx | 2 sc/source/ui/Accessibility/AccessibleCellBase.cxx | 2 sc/source/ui/Accessibility/AccessibleDocument.cxx | 2 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx | 4 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx | 2 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx | 4 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx | 12 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx | 12 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx | 18 sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 6 sc/source/ui/app/inputhdl.cxx | 33 sc/source/ui/app/inputwin.cxx | 8 sc/source/ui/collab/sendfunc.cxx | 2 sc/source/ui/condformat/condformatdlg.cxx | 22 sc/source/ui/condformat/condformatmgr.cxx | 2 sc/source/ui/dbgui/PivotLayoutDialog.cxx | 10 sc/source/ui/dbgui/consdlg.cxx | 12 sc/source/ui/dbgui/dbnamdlg.cxx | 10 sc/source/ui/dbgui/filtdlg.cxx | 6 sc/source/ui/dbgui/foptmgr.cxx | 14 sc/source/ui/dbgui/sfiltdlg.cxx | 22 sc/source/ui/dbgui/tpsort.cxx | 18 sc/source/ui/dbgui/validate.cxx | 2 sc/source/ui/dialogs/searchresults.cxx | 6 sc/source/ui/docshell/arealink.cxx | 2 sc/source/ui/docshell/docfunc.cxx | 2 sc/source/ui/docshell/docsh4.cxx | 8 sc/source/ui/docshell/impex.cxx | 8 sc/source/ui/docshell/servobj.cxx | 4 sc/source/ui/drawfunc/fuins2.cxx | 8 sc/source/ui/formdlg/formula.cxx | 4 sc/source/ui/inc/rfindlst.hxx | 4 sc/source/ui/miscdlgs/acredlin.cxx | 2 sc/source/ui/miscdlgs/anyrefdg.cxx | 8 sc/source/ui/miscdlgs/crnrdlg.cxx | 27 sc/source/ui/miscdlgs/datastreamdlg.cxx | 6 sc/source/ui/miscdlgs/highred.cxx | 4 sc/source/ui/miscdlgs/optsolver.cxx | 14 sc/source/ui/miscdlgs/simpref.cxx | 4 sc/source/ui/miscdlgs/solvrdlg.cxx | 16 sc/source/ui/miscdlgs/tabopdlg.cxx | 6 sc/source/ui/namedlg/namedefdlg.cxx | 4 sc/source/ui/namedlg/namedlg.cxx | 2 sc/source/ui/navipi/content.cxx | 4 sc/source/ui/navipi/navipi.cxx | 2 sc/source/ui/optdlg/calcoptionsdlg.cxx | 62 - sc/source/ui/optdlg/tpusrlst.cxx | 2 sc/source/ui/pagedlg/areasdlg.cxx | 68 - sc/source/ui/unoobj/addruno.cxx | 24 sc/source/ui/unoobj/cellsuno.cxx | 22 sc/source/ui/unoobj/chart2uno.cxx | 4 sc/source/ui/unoobj/chartuno.cxx | 2 sc/source/ui/unoobj/docuno.cxx | 4 sc/source/ui/vba/vbanames.cxx | 3 sc/source/ui/vba/vbapagesetup.cxx | 4 sc/source/ui/vba/vbarange.cxx | 31 sc/source/ui/vba/vbarange.hxx | 3 sc/source/ui/vba/vbavalidation.cxx | 2 sc/source/ui/view/cellsh.cxx | 3 sc/source/ui/view/cellsh1.cxx | 4 sc/source/ui/view/cellsh2.cxx | 6 sc/source/ui/view/drawvie4.cxx | 4 sc/source/ui/view/gridwin.cxx | 16 sc/source/ui/view/gridwin2.cxx | 6 sc/source/ui/view/output.cxx | 2 sc/source/ui/view/printfun.cxx | 2 sc/source/ui/view/tabvwsh3.cxx | 40 sc/source/ui/view/tabvwsha.cxx | 2 sc/source/ui/view/viewfun2.cxx | 6 sc/source/ui/view/viewfun5.cxx | 2 sc/source/ui/view/viewfun6.cxx | 4 sc/source/ui/xmlsource/xmlsourcedlg.cxx | 8 106 files changed, 950 insertions(+), 895 deletions(-)
New commits: commit 51d0b4037b36a4a74c9181b95edb18017542ab79 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Wed Mar 9 15:23:11 2016 +0100 tdf#84938 Change defines to typed_flags Put defines into an enum class and use typed_flags template from o3tl to give them flag operators. There were some shift operations to apply flags from start references to end references, these went into a helper in address.hxx to hide them. A marco with shift operations in address.cxx was rewritten in two helpers without shifts. One shift remained in ScRange::Format with a comment. The other flag untypical operator was a minus 1 in a helper for ScRefFinder::ToggleRel, which iteratates through all possible combinations for absolute references. This is used to make referecnces absolute via SHIFT+F4. A replacement would be too complex. Change-Id: I4850f1623e01e56c60ac2260b95fc5cad8b6fd71 Signed-off-by: Jochen Nitschke <j.nitschke+loger...@ok.de> Reviewed-on: https://gerrit.libreoffice.org/22840 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 0e545be..a917de7 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -29,6 +29,7 @@ #include "types.hxx" #include <formula/grammar.hxx> +#include <o3tl/typed_flags_set.hxx> #include <com/sun/star/uno/Sequence.hxx> namespace com { namespace sun { namespace star { @@ -140,35 +141,51 @@ SAL_WARN_UNUSED_RESULT inline SCTAB SanitizeTab( SCTAB nTab ) // not using gcc -fno-strict-aliasing // The result of ConvertRef() is a bit group of the following: +enum class ScRefFlags : sal_uInt16 +{ + ZERO = 0x0000, + COL_ABS = 0x0001, + ROW_ABS = 0x0002, + TAB_ABS = 0x0004, + TAB_3D = 0x0008, + COL2_ABS = 0x0010, + ROW2_ABS = 0x0020, + TAB2_ABS = 0x0040, + TAB2_3D = 0x0080, + ROW_VALID = 0x0100, + COL_VALID = 0x0200, + TAB_VALID = 0x0400, + // BITS for convience + BITS = COL_ABS | ROW_ABS | TAB_ABS | TAB_3D \ + | ROW_VALID | COL_VALID | TAB_VALID, + // somewhat cheesy kludge to force the display of the document name even for + // local references. Requires TAB_3D to be valid + FORCE_DOC = 0x0800, + ROW2_VALID = 0x1000, + COL2_VALID = 0x2000, + TAB2_VALID = 0x4000, + VALID = 0x8000, + + ADDR_ABS = VALID | COL_ABS | ROW_ABS | TAB_ABS, + + RANGE_ABS = ADDR_ABS | COL2_ABS | ROW2_ABS | TAB2_ABS, + + ADDR_ABS_3D = ADDR_ABS | TAB_3D, + RANGE_ABS_3D = RANGE_ABS | TAB_3D +}; -#define SCA_COL_ABSOLUTE 0x01 -#define SCA_ROW_ABSOLUTE 0x02 -#define SCA_TAB_ABSOLUTE 0x04 -#define SCA_TAB_3D 0x08 -#define SCA_COL2_ABSOLUTE 0x10 -#define SCA_ROW2_ABSOLUTE 0x20 -#define SCA_TAB2_ABSOLUTE 0x40 -#define SCA_TAB2_3D 0x80 -#define SCA_VALID_ROW 0x0100 -#define SCA_VALID_COL 0x0200 -#define SCA_VALID_TAB 0x0400 -// SCA_BITS is a convience for -// (SCA_VALID_TAB | SCA_VALID_COL | SCA_VALID_ROW | SCA_TAB_3D | SCA_TAB_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_COL_ABSOLUTE) -#define SCA_BITS 0x070F -// somewhat cheesy kludge to force the display of the document name even for -// local references. Requires TAB_3D to be valid -#define SCA_FORCE_DOC 0x0800 -#define SCA_VALID_ROW2 0x1000 -#define SCA_VALID_COL2 0x2000 -#define SCA_VALID_TAB2 0x4000 -#define SCA_VALID 0x8000 - -#define SCA_ABS SCA_VALID | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE - -#define SCR_ABS SCA_ABS | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE - -#define SCA_ABS_3D SCA_ABS | SCA_TAB_3D -#define SCR_ABS_3D SCR_ABS | SCA_TAB_3D +namespace o3tl +{ + template<> struct typed_flags<ScRefFlags> : is_typed_flags<ScRefFlags, 0xffff> {}; +} +inline void applyStartToEndFlags(ScRefFlags &target,const ScRefFlags source) +{ + target |= ScRefFlags((std::underlying_type<ScRefFlags>::type)source << 4); +} +inline void applyStartToEndFlags(ScRefFlags &target) +{ + target |= ScRefFlags((std::underlying_type<ScRefFlags>::type)target << 4); +} // ScAddress class ScAddress @@ -291,17 +308,17 @@ public: nTabP = nTab; } - SC_DLLPUBLIC sal_uInt16 Parse( + SC_DLLPUBLIC ScRefFlags Parse( const OUString&, ScDocument* = nullptr, const Details& rDetails = detailsOOOa1, ExternalInfo* pExtInfo = nullptr, const css::uno::Sequence<css::sheet::ExternalLinkInfo>* pExternalLinks = nullptr ); - SC_DLLPUBLIC void Format( OStringBuffer& r, sal_uInt16 nFlags = 0, + SC_DLLPUBLIC void Format( OStringBuffer& r, ScRefFlags nFlags = ScRefFlags::ZERO, const ScDocument* pDocument = nullptr, const Details& rDetails = detailsOOOa1) const; - SC_DLLPUBLIC OUString Format( sal_uInt16 nFlags = 0, + SC_DLLPUBLIC OUString Format( ScRefFlags nFlags = ScRefFlags::ZERO, const ScDocument* pDocument = nullptr, const Details& rDetails = detailsOOOa1) const; @@ -476,14 +493,14 @@ public: inline bool In( const ScAddress& ) const; ///< is Address& in Range? inline bool In( const ScRange& ) const; ///< is Range& in Range? - SC_DLLPUBLIC sal_uInt16 Parse( const OUString&, ScDocument* = nullptr, + SC_DLLPUBLIC ScRefFlags Parse( const OUString&, ScDocument* = nullptr, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, ScAddress::ExternalInfo* pExtInfo = nullptr, const css::uno::Sequence<css::sheet::ExternalLinkInfo>* pExternalLinks = nullptr ); - SC_DLLPUBLIC sal_uInt16 ParseAny( const OUString&, ScDocument* = nullptr, + SC_DLLPUBLIC ScRefFlags ParseAny( const OUString&, ScDocument* = nullptr, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); - SC_DLLPUBLIC sal_uInt16 ParseCols( const OUString&, ScDocument* = nullptr, + SC_DLLPUBLIC ScRefFlags ParseCols( const OUString&, ScDocument* = nullptr, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); SC_DLLPUBLIC void ParseRows( const OUString&, ScDocument* = nullptr, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); @@ -502,7 +519,7 @@ public: @returns Pointer to the position after '!' if successfully parsed, and rExternDocName, rStartTabName and/or rEndTabName filled if - applicable. SCA_... flags set in nFlags. + applicable. ScRefFlags::... flags set in nFlags. Or if no valid document and/or sheet header could be parsed the start position passed with pString. Or NULL if a 3D sheet header could be parsed but @@ -510,11 +527,11 @@ public: */ const sal_Unicode* Parse_XL_Header( const sal_Unicode* pString, const ScDocument* pDocument, OUString& rExternDocName, OUString& rStartTabName, - OUString& rEndTabName, sal_uInt16& nFlags, + OUString& rEndTabName, ScRefFlags& nFlags, bool bOnlyAcceptSingle, const css::uno::Sequence<css::sheet::ExternalLinkInfo>* pExternalLinks = nullptr ); - SC_DLLPUBLIC OUString Format(sal_uInt16 nFlags= 0, const ScDocument* pDocument = nullptr, + SC_DLLPUBLIC OUString Format(ScRefFlags nFlags = ScRefFlags::ZERO, const ScDocument* pDocument = nullptr, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1) const; inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1, diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index 7bab719..4c0b739 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -144,9 +144,6 @@ public: }; // ScRangeItem: manages an area of a table - -#define SCR_INVALID 0x01 - class ScRangeItem : public SfxPoolItem { public: diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 7d19174..2641483 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -38,12 +38,12 @@ public: ScRangeList& operator=(const ScRangeList& rList); void Append( const ScRange& rRange ); - sal_uInt16 Parse( const OUString&, ScDocument* = nullptr, - sal_uInt16 nMask = SCA_VALID, + ScRefFlags Parse( const OUString&, ScDocument* = nullptr, + ScRefFlags nMask = ScRefFlags::VALID, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab = 0, sal_Unicode cDelimiter = 0 ); - void Format( OUString&, sal_uInt16 nFlags = 0, ScDocument* = nullptr, + void Format( OUString&, ScRefFlags nFlags = ScRefFlags::ZERO, ScDocument* = nullptr, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter = 0 ) const; diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx index c572797..2aa035e 100644 --- a/sc/inc/rangeutl.hxx +++ b/sc/inc/rangeutl.hxx @@ -177,7 +177,7 @@ public: formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator = ' ', bool bAppendStr = false, - sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + ScRefFlags nFormatFlags = (ScRefFlags::VALID | ScRefFlags::TAB_3D) ); static void GetStringFromRange( OUString& rString, const ScRange& rRange, @@ -185,7 +185,7 @@ public: formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator = ' ', bool bAppendStr = false, - sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + ScRefFlags nFormatFlags = (ScRefFlags::VALID | ScRefFlags::TAB_3D) ); static void GetStringFromRangeList( OUString& rString, const ScRangeList* pRangeList, @@ -200,7 +200,7 @@ public: formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator = ' ', bool bAppendStr = false, - sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + ScRefFlags nFormatFlags = (ScRefFlags::VALID | ScRefFlags::TAB_3D) ); /// Range to String API static void GetStringFromAddress( @@ -217,7 +217,7 @@ public: formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator = ' ', bool bAppendStr = false, - sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + ScRefFlags nFormatFlags = (ScRefFlags::VALID | ScRefFlags::TAB_3D) ); static void GetStringFromRangeList( OUString& rString, const css::uno::Sequence< css::table::CellRangeAddress >& rRangeSeq, diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index e0bd402..44a24d6 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -77,8 +77,8 @@ void ScCopyPasteTest::testCopyPasteXLS() // 2. Highlight B2:C5 ScRange aSrcRange; - sal_uInt16 nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + ScRefFlags nRes = aSrcRange.Parse("B2:C5", &rDoc, rDoc.GetAddressConvention()); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); ScMarkData aMark; aMark.SetMarkArea(aSrcRange); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index ad32a20..96dbf5c 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -392,8 +392,8 @@ ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) for (size_t i = 0, n = aRangeReps.size(); i < n; ++i) { ScRange aRange; - sal_uInt16 nRes = aRange.Parse(aRangeReps[i], &rDoc, rDoc.GetAddressConvention()); - if (nRes & SCA_VALID) + ScRefFlags nRes = aRange.Parse(aRangeReps[i], &rDoc, rDoc.GetAddressConvention()); + if (nRes & ScRefFlags::VALID) // This is a range address. aRanges.Append(aRange); else @@ -401,7 +401,7 @@ ScRangeList getChartRanges(ScDocument& rDoc, const SdrOle2Obj& rChartObj) // Parse it as a single cell address. ScAddress aAddr; nRes = aAddr.Parse(aRangeReps[i], &rDoc, rDoc.GetAddressConvention()); - CPPUNIT_ASSERT_MESSAGE("Failed to parse a range representation.", (nRes & SCA_VALID)); + CPPUNIT_ASSERT_MESSAGE("Failed to parse a range representation.", (nRes & ScRefFlags::VALID)); aRanges.Append(aAddr); } } @@ -416,7 +416,7 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) ScFormulaCell* pCell = rDoc.GetFormulaCell(rPos); if (!pCell) { - OUString aStr = rPos.Format(SCA_VALID); + OUString aStr = rPos.Format(ScRefFlags::VALID); cerr << aStr << " is not a formula cell." << endl; return nullptr; } @@ -447,7 +447,7 @@ bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos) { - OUString aStr(rPos.Format(SCA_VALID)); + OUString aStr(rPos.Format(ScRefFlags::VALID)); const ScFormulaCell* pFC = rDoc.GetFormulaCell(rPos); if (!pFC) { @@ -457,7 +457,7 @@ bool checkFormulaPosition(ScDocument& rDoc, const ScAddress& rPos) if (pFC->aPos != rPos) { - OUString aStr2(pFC->aPos.Format(SCA_VALID)); + OUString aStr2(pFC->aPos.Format(ScRefFlags::VALID)); cerr << "Formula cell at " << aStr << " has incorrect position of " << aStr2 << endl; return false; } @@ -476,7 +476,7 @@ bool checkFormulaPositions( if (!checkFormulaPosition(rDoc, aPos)) { - OUString aStr(aPos.Format(SCA_VALID)); + OUString aStr(aPos.Format(ScRefFlags::VALID)); cerr << "Formula cell position failed at " << aStr << "." << endl; return false; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 3718131..c78f321 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3543,7 +3543,7 @@ void Test::testCopyPasteSkipEmpty() bool checkRange( const ScAddress& rPos, const Check* p, const Check* pEnd ) { ScAddress aPos(rPos); - OUString aPosStr = aPos.Format(SCA_VALID); + OUString aPosStr = aPos.Format(ScRefFlags::VALID); for (; p != pEnd; ++p, aPos.IncRow()) { if (!mpDoc->GetString(aPos).equalsAscii(p->mpStr)) diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index f93f9dd..1d54d79 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -298,29 +298,29 @@ void Test::testFormulaParseReference() ScAddress aPos; ScAddress::ExternalInfo aExtInfo; - sal_uInt16 nRes = aPos.Parse("'90''s Music'.D10", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + ScRefFlags nRes = aPos.Parse("'90''s Music'.D10", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), aPos.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(3), aPos.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), aPos.Row()); CPPUNIT_ASSERT_MESSAGE("This is not an external address.", !aExtInfo.mbExternal); nRes = aPos.Parse("'90''s and 70''s'.C100", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), aPos.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(2), aPos.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(99), aPos.Row()); CPPUNIT_ASSERT_MESSAGE("This is not an external address.", !aExtInfo.mbExternal); nRes = aPos.Parse("'All Others'.B3", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(3), aPos.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aPos.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), aPos.Row()); CPPUNIT_ASSERT_MESSAGE("This is not an external address.", !aExtInfo.mbExternal); nRes = aPos.Parse("NoQuote.E13", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(4), aPos.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(4), aPos.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), aPos.Row()); @@ -330,120 +330,130 @@ void Test::testFormulaParseReference() aRange.aStart.SetTab(0); nRes = aRange.Parse(":B", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("B:", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse(":B2", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("B2:", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse(":2", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("2:", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse(":2B", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("2B:", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("abc_foo:abc_bar", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", (nRes & SCA_VALID) == 0); + CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); aRange.aStart.SetTab(0); nRes = aRange.Parse("B:B", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aStart.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aRange.aStart.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), aRange.aStart.Row()); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aEnd.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aRange.aEnd.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(MAXROW), aRange.aEnd.Row()); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2), - (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2)); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE), 0); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE), (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)) == + (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)) == + ScRefFlags::ZERO); + CPPUNIT_ASSERT((nRes & (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)) == + (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)); aRange.aStart.SetTab(0); nRes = aRange.Parse("2:2", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aStart.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(0), aRange.aStart.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), aRange.aStart.Row()); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aEnd.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(MAXCOL), aRange.aEnd.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), aRange.aEnd.Row()); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2), - (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2)); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE), 0); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE), (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)) == + (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)) == + ScRefFlags::ZERO); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)) == + (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)); nRes = aRange.Parse("NoQuote.B:C", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(4), aRange.aStart.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aRange.aStart.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), aRange.aStart.Row()); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(4), aRange.aEnd.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(2), aRange.aEnd.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(MAXROW), aRange.aEnd.Row()); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2), - (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2)); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE), 0); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE), (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)) == + (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)) == + ScRefFlags::ZERO); + CPPUNIT_ASSERT((nRes & (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)) == + (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)); // Both rows at sheet bounds and relative => convert to absolute => entire column reference. aRange.aStart.SetTab(0); nRes = aRange.Parse("B1:B1048576", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aStart.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aRange.aStart.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), aRange.aStart.Row()); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aEnd.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), aRange.aEnd.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(MAXROW), aRange.aEnd.Row()); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2), - (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2)); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE), 0); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE), (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)) == + (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)) == + ScRefFlags::ZERO); + CPPUNIT_ASSERT((nRes & (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)) == + (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)); // Both columns at sheet bounds and relative => convert to absolute => entire row reference. aRange.aStart.SetTab(0); nRes = aRange.Parse("A2:AMJ2", m_pDoc, formula::FormulaGrammar::CONV_OOO); - CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & SCA_VALID) != 0); + CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID)); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aStart.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(0), aRange.aStart.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), aRange.aStart.Row()); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(0), aRange.aEnd.Tab()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(MAXCOL), aRange.aEnd.Col()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), aRange.aEnd.Row()); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2), - (SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2)); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE), 0); - CPPUNIT_ASSERT_EQUAL(nRes & (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE), (SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)) == + (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID)); + CPPUNIT_ASSERT((nRes & (ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS)) == + ScRefFlags::ZERO); + CPPUNIT_ASSERT((nRes & (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)) == + (ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS)); // Check for reference input conversion to and display string of entire column/row. { @@ -5883,7 +5893,7 @@ void Test::testFuncTableRef() ScAddress aPos(3+i,1,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aNames[i].pCounta), aPrefix + m_pDoc->GetString( aPos)); } @@ -5895,7 +5905,7 @@ void Test::testFuncTableRef() ScAddress aPos(3+i,2,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aNames[i].pSum3), aPrefix + m_pDoc->GetString( aPos)); } @@ -5907,7 +5917,7 @@ void Test::testFuncTableRef() ScAddress aPos(3+i,3,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aNames[i].pSum4), aPrefix + m_pDoc->GetString( aPos)); } @@ -5919,7 +5929,7 @@ void Test::testFuncTableRef() ScAddress aPos(3+i,4,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aNames[i].pSumX), aPrefix + m_pDoc->GetString( aPos)); } @@ -5936,7 +5946,7 @@ void Test::testFuncTableRef() OUString aFormula( "=SUM(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(4+i,3,0); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aNames[i].pSum4), aPrefix + m_pDoc->GetString( aPos)); } @@ -5964,7 +5974,7 @@ void Test::testFuncTableRef() { OUString aFormula( OUString::createFromAscii( pColumn2Formula)); ScAddress aPos(1,5,0); - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( OUString(aPrefix + "448"), OUString(aPrefix + m_pDoc->GetString(aPos))); } @@ -6060,7 +6070,7 @@ void Test::testFuncTableRef() ScAddress aPos(7+i,9,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aHlNames[i].pCounta), aPrefix + m_pDoc->GetString( aPos)); } @@ -6072,7 +6082,7 @@ void Test::testFuncTableRef() ScAddress aPos(7+i,10,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aHlNames[i].pSum3), aPrefix + m_pDoc->GetString( aPos)); } @@ -6084,7 +6094,7 @@ void Test::testFuncTableRef() ScAddress aPos(7+i,11,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aHlNames[i].pSum4), aPrefix + m_pDoc->GetString( aPos)); } @@ -6096,7 +6106,7 @@ void Test::testFuncTableRef() ScAddress aPos(7+i,12,0); m_pDoc->SetString( aPos, aFormula); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aHlNames[i].pSumX), aPrefix + m_pDoc->GetString( aPos)); } @@ -6113,7 +6123,7 @@ void Test::testFuncTableRef() OUString aFormula( "=SUM(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(8+i,11,0); // For easier "debugability" have position and formula in assertion. - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( aPrefix + OUString::createFromAscii( aHlNames[i].pSum4), aPrefix + m_pDoc->GetString( aPos)); } @@ -6140,7 +6150,7 @@ void Test::testFuncTableRef() { OUString aFormula( OUString::createFromAscii( pColumn3Formula)); ScAddress aPos(5,13,0); - OUString aPrefix( aPos.Format(SCA_VALID) + " " + aFormula + " : "); + OUString aPrefix( aPos.Format(ScRefFlags::VALID) + " " + aFormula + " : "); CPPUNIT_ASSERT_EQUAL( OUString(aPrefix + "448"), OUString(aPrefix + m_pDoc->GetString(aPos))); } @@ -6912,57 +6922,57 @@ void Test::testFormulaErrorPropagation() aPos.IncRow(); // C2 m_pDoc->SetString( aPos, "=ISERROR(A1:B1+3)"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C3 m_pDoc->SetString( aPos, "=ISERROR(A1:B1+{3})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C4 aPos2 = aPos; aPos2.IncCol(); // D4 m_pDoc->InsertMatrixFormula(aPos.Col(), aPos.Row(), aPos2.Col(), aPos2.Row(), aMark, "=ISERROR(A1:B1+{3})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); aPos.IncRow(); // C5 m_pDoc->SetString( aPos, "=ISERROR({1;\"x\"}+{3;4})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C6 aPos2 = aPos; aPos2.IncCol(); // D6 m_pDoc->InsertMatrixFormula(aPos.Col(), aPos.Row(), aPos2.Col(), aPos2.Row(), aMark, "=ISERROR({1;\"x\"}+{3;4})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos2)); aPos.IncRow(); // C7 m_pDoc->SetString( aPos, "=ISERROR({\"x\";2}+{3;4})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C8 aPos2 = aPos; aPos2.IncCol(); // D8 m_pDoc->InsertMatrixFormula(aPos.Col(), aPos.Row(), aPos2.Col(), aPos2.Row(), aMark, "=ISERROR({\"x\";2}+{3;4})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); aPos.IncRow(); // C9 m_pDoc->SetString( aPos, "=ISERROR(({1;\"x\"}+{3;4})-{5;6})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C10 aPos2 = aPos; aPos2.IncCol(); // D10 m_pDoc->InsertMatrixFormula(aPos.Col(), aPos.Row(), aPos2.Col(), aPos2.Row(), aMark, "=ISERROR(({1;\"x\"}+{3;4})-{5;6})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos2)); aPos.IncRow(); // C11 m_pDoc->SetString( aPos, "=ISERROR(({\"x\";2}+{3;4})-{5;6})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); aPos.IncRow(); // C12 aPos2 = aPos; aPos2.IncCol(); // D12 m_pDoc->InsertMatrixFormula(aPos.Col(), aPos.Row(), aPos2.Col(), aPos2.Row(), aMark, "=ISERROR(({\"x\";2}+{3;4})-{5;6})"); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(SCA_VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); - CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(SCA_VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos.Format(ScRefFlags::VALID).toUtf8().getStr(), aTRUE, m_pDoc->GetString(aPos)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aPos2.Format(ScRefFlags::VALID).toUtf8().getStr(), aFALSE, m_pDoc->GetString(aPos2)); m_pDoc->DeleteTab(0); } diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index ef143ff..3ec7bd1 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -680,7 +680,7 @@ void Test::testPivotTableNamedSource() // Insert the raw data. ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); - OUString aRangeStr(aSrcRange.Format(SCR_ABS_3D, m_pDoc)); + OUString aRangeStr(aSrcRange.Format(ScRefFlags::RANGE_ABS_3D, m_pDoc)); // Name this range. OUString aRangeName("MyData"); @@ -2126,7 +2126,7 @@ void Test::testFuncGETPIVOTDATA() aPos = aOutRange.aEnd; aPos.IncRow(2); // Move 2 rows down from the table output. - OUString aPivotPosStr(aOutRange.aStart.Format(SCA_ABS)); + OUString aPivotPosStr(aOutRange.aStart.Format(ScRefFlags::ADDR_ABS)); sc::AutoCalcSwitch aSwitch(*m_pDoc, true); // turn autocalc on. @@ -2188,7 +2188,7 @@ void Test::testFuncGETPIVOTDATA() aPos = aOutRange.aEnd; aPos.IncRow(2); // move 2 rows down from the output. - aPivotPosStr = aOutRange.aStart.Format(SCA_ABS); + aPivotPosStr = aOutRange.aStart.Format(ScRefFlags::ADDR_ABS); // First, get the grand totals. aFormula = ("=GETPIVOTDATA(\"Sum - Value\";") + aPivotPosStr + ")"; diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index e692ec8..b47b3a3 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -141,7 +141,7 @@ void Test::testSortHorizontal() // Insert raw data into A1:D4. ScRange aDataRange = insertRangeData(m_pDoc, ScAddress(0,0,0), aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_EQUAL(OUString("A1:D4"), aDataRange.Format(SCA_VALID)); + CPPUNIT_ASSERT_EQUAL(OUString("A1:D4"), aDataRange.Format(ScRefFlags::VALID)); // Check the formula values. CPPUNIT_ASSERT_EQUAL(OUString("Yes-No"), m_pDoc->GetString(ScAddress(3,1,0))); diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 6e9c640..5a09764 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -593,7 +593,7 @@ void ScBroadcastAreaSlot::Dump() const const SvtBroadcaster::ListenersType& rListeners = rBC.GetAllListeners(); size_t n = rListeners.size(); - cout << " * range: " << rtl::OUStringToOString(pArea->GetRange().Format(SCA_VALID|SCA_TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() + cout << " * range: " << rtl::OUStringToOString(pArea->GetRange().Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() << ", group: " << pArea->IsGroupListening() << ", listener count: " << n << endl; @@ -603,7 +603,7 @@ void ScBroadcastAreaSlot::Dump() const if (pFC) { cout << " * listener: formula cell: " - << rtl::OUStringToOString(pFC->aPos.Format(SCA_VALID|SCA_TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() + << rtl::OUStringToOString(pFC->aPos.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() << endl; continue; } @@ -612,7 +612,7 @@ void ScBroadcastAreaSlot::Dump() const if (pFGListener) { cout << " * listener: formula group: (pos: " - << rtl::OUStringToOString(pFGListener->getTopCellPos().Format(SCA_VALID | SCA_TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() + << rtl::OUStringToOString(pFGListener->getTopCellPos().Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pDoc), RTL_TEXTENCODING_UTF8).getStr() << ", length: " << pFGListener->getGroupLength() << ")" << endl; continue; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 8b8b4bc..d65355b 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -462,7 +462,7 @@ void ScConditionEntry::CompileXML() ScAddress aNew; /* XML is always in OOo:A1 format, although R1C1 would be more amenable * to compression */ - if ( aNew.Parse( aSrcString, mpDoc ) & SCA_VALID ) + if ( aNew.Parse( aSrcString, mpDoc ) & ScRefFlags::VALID ) aSrcPos = aNew; // if the position is invalid, there isn't much we can do at this time aSrcString.clear(); diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 9345d20..b054560 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -143,7 +143,7 @@ void ScDocument::UpdateAllCharts() { ScRangeListRef aRanges = pChartObj->GetRangeList(); OUString sRangeStr; - aRanges->Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() ); + aRanges->Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, this, GetAddressConvention() ); chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS; bool bHasCategories = pChartObj->HasRowHeaders(); @@ -264,7 +264,7 @@ void ScDocument::GetChartRanges( const OUString& rChartName, ::std::vector< ScRa for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ ) { ScRangeList aRanges; - aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, SCA_VALID, pSheetNameDoc->GetAddressConvention() ); + aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, ScRefFlags::VALID, pSheetNameDoc->GetAddressConvention() ); rRangesVector.push_back(aRanges); } } @@ -281,7 +281,7 @@ void ScDocument::SetChartRanges( const OUString& rChartName, const ::std::vector { ScRangeList aScRangeList( rRangesVector[nN] ); OUString sRangeStr; - aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() ); + aScRangeList.Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, this, GetAddressConvention() ); aRangeStrings[nN]=sRangeStr; } ScChartHelper::SetChartRanges( xChartDoc, aRangeStrings ); @@ -407,7 +407,7 @@ void ScDocument::UpdateChartArea( const OUString& rChartName, } OUString sRangeStr; - aNewRanges->Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() ); + aNewRanges->Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, this, GetAddressConvention() ); lcl_SetChartParameters( xReceiver, sRangeStr, eDataRowSource, bHasCategories, bFirstCellAsLabel ); @@ -469,7 +469,7 @@ void ScDocument::RestoreChartListener( const OUString& rName ) { ScRange aRange; ScAddress::Details aDetails(GetAddressConvention(), 0, 0); - if ( aRange.ParseAny( aRepresentations[i], this, aDetails ) & SCA_VALID ) + if ( aRange.ParseAny( aRepresentations[i], this, aDetails ) & ScRefFlags::VALID ) aRanges->Append( aRange ); } @@ -603,7 +603,7 @@ void ScDocument::SetChartRangeList( const OUString& rChartName, lcl_GetChartParameters( xChartDoc, aRangesStr, eDataRowSource, bHasCategories, bFirstCellAsLabel ); OUString sRangeStr; - rNewRangeListRef->Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() ); + rNewRangeListRef->Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, this, GetAddressConvention() ); lcl_SetChartParameters( xReceiver, sRangeStr, eDataRowSource, bHasCategories, bFirstCellAsLabel ); diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 9fdf5a2..ff343d3 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -117,7 +117,7 @@ OUString createLabelString(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) aBuf.append(' '); ScAddress aColAddr(nCol, 0, 0); - aBuf.append(aColAddr.Format(SCA_VALID_COL)); + aBuf.append(aColAddr.Format(ScRefFlags::COL_VALID)); aDocStr = aBuf.makeStringAndClear(); } return aDocStr; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index b6d9c39..48314dd 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -116,7 +116,7 @@ static struct DebugCalculation { for (auto const& it : mvPos) { - OUString aStr( it.maPos.Format( SCA_VALID | SCA_TAB_3D, it.mpDoc) + + OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc) + " [" + OUString::number( it.mnRecursion) + "," + OUString::number( it.mnGroup) + "]"); fprintf( stderr, "%s -> ", aStr.toUtf8().getStr()); } @@ -128,7 +128,7 @@ static struct DebugCalculation { for (auto const& it : mvResults) { - OUString aStr( it.maPos.Format( SCA_VALID | SCA_TAB_3D, it.mpDoc)); + OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc)); aStr += " (" + it.maResult + ")"; fprintf( stderr, "%s, ", aStr.toUtf8().getStr()); } @@ -2712,10 +2712,10 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const { #if OSL_DEBUG_LEVEL > 0 OStringBuffer aMsg("broken Matrix, no MatFormula at origin, Pos: "); - OUString aTmp(aPos.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument)); + OUString aTmp(aPos.Format(ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID, pDocument)); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_ASCII_US)); aMsg.append(", MatOrg: "); - aTmp = aOrg.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument); + aTmp = aOrg.Format(ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID, pDocument); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_ASCII_US)); OSL_FAIL(aMsg.getStr()); #endif @@ -2743,10 +2743,10 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const else { OStringBuffer aMsg( "broken Matrix, Pos: " ); - OUString aTmp(aPos.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument)); + OUString aTmp(aPos.Format(ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID, pDocument)); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8 )); aMsg.append(", MatOrg: "); - aTmp = aOrg.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument); + aTmp = aOrg.Format(ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID, pDocument); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8 )); aMsg.append(", MatCols: "); aMsg.append(static_cast<sal_Int32>( nC )); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index baf4110..2535990 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -211,7 +211,7 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, aParams[0] = css::uno::makeAny( OUString( aValStr ) ); // 2) Position of the cell - OUString aPosStr(rPos.Format(SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention())); + OUString aPosStr(rPos.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pDocument, pDocument->GetAddressConvention())); aParams[1] = css::uno::makeAny(aPosStr); // use link-update flag to prevent closing the document @@ -328,7 +328,7 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, refPar->Get(1)->PutString( aValStr ); // 2) Position of the cell - OUString aPosStr(rPos.Format(SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention())); + OUString aPosStr(rPos.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pDocument, pDocument->GetAddressConvention())); refPar->Get(2)->PutString( aPosStr ); // use link-update flag to prevent closing the document diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 5542be6..ef2e492 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -178,7 +178,7 @@ static const sal_Unicode* lcl_eatWhiteSpace( const sal_Unicode* p ) */ static bool lcl_ScRange_External_TabSpan( ScRange & rRange, - sal_uInt16 & rFlags, + ScRefFlags & rFlags, ScAddress::ExternalInfo* pExtInfo, const OUString & rExternDocName, const OUString & rStartTabName, @@ -234,9 +234,9 @@ static bool lcl_ScRange_External_TabSpan( SCsTAB nSpan = pRefMgr->getCachedTabSpan( nFileId, rStartTabName, rEndTabName); if (nSpan == -1) - rFlags &= ~(SCA_VALID_TAB | SCA_VALID_TAB2); + rFlags &= ~ScRefFlags(ScRefFlags::TAB_VALID | ScRefFlags::TAB2_VALID); else if (nSpan == 0) - rFlags &= ~SCA_VALID_TAB2; + rFlags &= ~ScRefFlags::TAB2_VALID; else if (nSpan >= 1) rRange.aEnd.SetTab( rRange.aStart.Tab() + nSpan - 1); else // (nSpan < -1) @@ -433,12 +433,12 @@ const sal_Unicode* ScRange::Parse_XL_Header( OUString& rExternDocName, OUString& rStartTabName, OUString& rEndTabName, - sal_uInt16& nFlags, + ScRefFlags& nFlags, bool bOnlyAcceptSingle, const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { const sal_Unicode* startTabs, *start = p; - sal_uInt16 nSaveFlags = nFlags; + ScRefFlags nSaveFlags = nFlags; // Is this an external reference ? rStartTabName.clear(); @@ -535,7 +535,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( return nullptr; // 3D if( p != startTabs ) { - nFlags |= SCA_VALID_TAB | SCA_TAB_3D | SCA_TAB_ABSOLUTE; + nFlags |= ScRefFlags::TAB_VALID | ScRefFlags::TAB_3D | ScRefFlags::TAB_ABS; if( *p == ':' ) // 3d ref { p = lcl_XL_ParseSheetRef( p+1, rEndTabName, false, pMsoxlQuoteStop); @@ -544,13 +544,13 @@ const sal_Unicode* ScRange::Parse_XL_Header( nFlags = nSaveFlags; return start; // invalid tab } - nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE; + nFlags |= ScRefFlags::TAB2_VALID | ScRefFlags::TAB2_3D | ScRefFlags::TAB2_ABS; } else { // If only one sheet is given, the full reference is still valid, // only the second 3D flag is not set. - nFlags |= SCA_VALID_TAB2 | SCA_TAB2_ABSOLUTE; + nFlags |= ScRefFlags::TAB2_VALID | ScRefFlags::TAB2_ABS; aEnd.SetTab( aStart.Tab() ); } @@ -564,7 +564,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( } else { - nFlags |= SCA_VALID_TAB | SCA_VALID_TAB2; + nFlags |= ScRefFlags::TAB_VALID | ScRefFlags::TAB2_VALID; // Use the current tab, it needs to be passed in. : aEnd.SetTab( .. ); } @@ -586,7 +586,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( if (!pDoc->GetTable(rStartTabName, nTab)) { // invalid table name. - nFlags &= ~SCA_VALID_TAB; + nFlags &= ~ScRefFlags::TAB_VALID; nTab = -1; } @@ -598,7 +598,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( if (!pDoc->GetTable(rEndTabName, nTab)) { // invalid table name. - nFlags &= ~SCA_VALID_TAB2; + nFlags &= ~ScRefFlags::TAB2_VALID; nTab = -1; } @@ -610,7 +610,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p, const ScAddress::Details& rDetails, - ScAddress* pAddr, sal_uInt16* nFlags ) + ScAddress* pAddr, ScRefFlags* nFlags ) { const sal_Unicode *pEnd; long int n; @@ -641,14 +641,14 @@ static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p, } else { - *nFlags |= SCA_COL_ABSOLUTE; + *nFlags |= ScRefFlags::COL_ABS; n--; } if( n < 0 || n >= MAXCOLCOUNT ) return nullptr; pAddr->SetCol( static_cast<SCCOL>( n ) ); - *nFlags |= SCA_VALID_COL; + *nFlags |= ScRefFlags::COL_VALID; return pEnd; } @@ -656,7 +656,7 @@ static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p, static inline const sal_Unicode* lcl_r1c1_get_row( const sal_Unicode* p, const ScAddress::Details& rDetails, - ScAddress* pAddr, sal_uInt16* nFlags ) + ScAddress* pAddr, ScRefFlags* nFlags ) { const sal_Unicode *pEnd; long int n; @@ -687,19 +687,19 @@ static inline const sal_Unicode* lcl_r1c1_get_row( } else { - *nFlags |= SCA_ROW_ABSOLUTE; + *nFlags |= ScRefFlags::ROW_ABS; n--; } if( n < 0 || n >= MAXROWCOUNT ) return nullptr; pAddr->SetRow( static_cast<SCROW>( n ) ); - *nFlags |= SCA_VALID_ROW; + *nFlags |= ScRefFlags::ROW_VALID; return pEnd; } -static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, +static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, const sal_Unicode* p, ScDocument* pDoc, const ScAddress::Details& rDetails, @@ -708,9 +708,9 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, { const sal_Unicode* pTmp = nullptr; OUString aExternDocName, aStartTabName, aEndTabName; - sal_uInt16 nFlags = SCA_VALID | SCA_VALID_TAB; + ScRefFlags nFlags = ScRefFlags::VALID | ScRefFlags::TAB_VALID; // Keep in mind that nFlags2 gets left-shifted by 4 bits before being merged. - sal_uInt16 nFlags2 = SCA_VALID_TAB; + ScRefFlags nFlags2 = ScRefFlags::TAB_VALID; p = r.Parse_XL_Header( p, pDoc, aExternDocName, aStartTabName, aEndTabName, nFlags, bOnlyAcceptSingle ); @@ -720,12 +720,12 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, aStartTabName, aEndTabName, pDoc); if( nullptr == p ) - return 0; + return ScRefFlags::ZERO; if( *p == 'R' || *p == 'r' ) { if( nullptr == (p = lcl_r1c1_get_row( p, rDetails, &r.aStart, &nFlags )) ) - return 0; + return ScRefFlags::ZERO; if( *p != 'C' && *p != 'c' ) // full row R# { @@ -734,35 +734,35 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, { // Only the initial row number is given, or the second row // number is invalid. Fallback to just the initial R - nFlags |= (nFlags << 4); + applyStartToEndFlags(nFlags); r.aEnd.SetRow( r.aStart.Row() ); } else { // Full row range successfully parsed. - nFlags |= (nFlags2 << 4); + applyStartToEndFlags(nFlags, nFlags2); p = pTmp; } if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID); return nFlags; } nFlags |= - SCA_VALID_COL | SCA_VALID_COL2 | - SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE; + ScRefFlags::COL_VALID | ScRefFlags::COL2_VALID | + ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS; r.aStart.SetCol( 0 ); r.aEnd.SetCol( MAXCOL ); - return bOnlyAcceptSingle ? 0 : nFlags; + return bOnlyAcceptSingle ? ScRefFlags::ZERO : nFlags; } else if( nullptr == (p = lcl_r1c1_get_col( p, rDetails, &r.aStart, &nFlags ))) { - return 0; + return ScRefFlags::ZERO; } if( p[0] != ':' || @@ -776,11 +776,11 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID); return nFlags; } - return bOnlyAcceptSingle ? nFlags : 0; + return bOnlyAcceptSingle ? nFlags : ScRefFlags::ZERO; } p = pTmp; @@ -789,60 +789,60 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r, if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole range. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID); return nFlags; } - nFlags |= (nFlags2 << 4); - return bOnlyAcceptSingle ? 0 : nFlags; + applyStartToEndFlags(nFlags, nFlags2); + return bOnlyAcceptSingle ? ScRefFlags::ZERO : nFlags; } else if( *p == 'C' || *p == 'c' ) // full col C# { if( nullptr == (p = lcl_r1c1_get_col( p, rDetails, &r.aStart, &nFlags ))) - return 0; + return ScRefFlags::ZERO; if( p[0] != ':' || (p[1] != 'C' && p[1] != 'c') || nullptr == (pTmp = lcl_r1c1_get_col( p+1, rDetails, &r.aEnd, &nFlags2 ))) { // Fallback to just the initial C - nFlags |= (nFlags << 4); + applyStartToEndFlags(nFlags); r.aEnd.SetCol( r.aStart.Col() ); } else { - nFlags |= (nFlags2 << 4); + applyStartToEndFlags(nFlags, nFlags2); p = pTmp; } if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID); return nFlags; } nFlags |= - SCA_VALID_ROW | SCA_VALID_ROW2 | - SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE; + ScRefFlags::ROW_VALID | ScRefFlags::ROW2_VALID | + ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS; r.aStart.SetRow( 0 ); r.aEnd.SetRow( MAXROW ); - return bOnlyAcceptSingle ? 0 : nFlags; + return bOnlyAcceptSingle ? ScRefFlags::ZERO : nFlags; } - return 0; + return ScRefFlags::ZERO; } static inline const sal_Unicode* lcl_a1_get_col( const sal_Unicode* p, ScAddress* pAddr, - sal_uInt16* nFlags ) + ScRefFlags* nFlags ) { SCCOL nCol; if( *p == '$' ) { - *nFlags |= SCA_COL_ABSOLUTE; + *nFlags |= ScRefFlags::COL_ABS; p++; } @@ -855,7 +855,7 @@ static inline const sal_Unicode* lcl_a1_get_col( const sal_Unicode* p, if( nCol > MAXCOL || rtl::isAsciiAlpha( *p ) ) return nullptr; - *nFlags |= SCA_VALID_COL; + *nFlags |= ScRefFlags::COL_VALID; pAddr->SetCol( nCol ); return p; @@ -863,14 +863,14 @@ static inline const sal_Unicode* lcl_a1_get_col( const sal_Unicode* p, static inline const sal_Unicode* lcl_a1_get_row( const sal_Unicode* p, ScAddress* pAddr, - sal_uInt16* nFlags ) + ScRefFlags* nFlags ) { const sal_Unicode *pEnd; long int n; if( *p == '$' ) { - *nFlags |= SCA_ROW_ABSOLUTE; + *nFlags |= ScRefFlags::ROW_ABS; p++; } @@ -878,21 +878,21 @@ static inline const sal_Unicode* lcl_a1_get_row( const sal_Unicode* p, if( nullptr == pEnd || p == pEnd || n < 0 || n > MAXROW ) return nullptr; - *nFlags |= SCA_VALID_ROW; + *nFlags |= ScRefFlags::ROW_VALID; pAddr->SetRow( static_cast<SCROW>(n) ); return pEnd; } /// B:B or 2:2, but not B:2 or 2:B or B2:B or B:B2 or ... -static bool isValidSingleton( sal_uInt16 nFlags, sal_uInt16 nFlags2 ) +static bool isValidSingleton( ScRefFlags nFlags, ScRefFlags nFlags2 ) { - bool bCols = (nFlags & SCA_VALID_COL) && ((nFlags & SCA_VALID_COL2) || (nFlags2 & SCA_VALID_COL)); - bool bRows = (nFlags & SCA_VALID_ROW) && ((nFlags & SCA_VALID_ROW2) || (nFlags2 & SCA_VALID_ROW)); + bool bCols = (nFlags & ScRefFlags::COL_VALID) && ((nFlags & ScRefFlags::COL2_VALID) || (nFlags2 & ScRefFlags::COL_VALID)); + bool bRows = (nFlags & ScRefFlags::ROW_VALID) && ((nFlags & ScRefFlags::ROW2_VALID) || (nFlags2 & ScRefFlags::ROW_VALID)); return (bCols && !bRows) || (!bCols && bRows); } -static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, +static ScRefFlags lcl_ScRange_Parse_XL_A1( ScRange& r, const sal_Unicode* p, ScDocument* pDoc, bool bOnlyAcceptSingle, @@ -901,7 +901,7 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, { const sal_Unicode* tmp1, *tmp2; OUString aExternDocName, aStartTabName, aEndTabName; // for external link table - sal_uInt16 nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB; + ScRefFlags nFlags = ScRefFlags::VALID | ScRefFlags::TAB_VALID, nFlags2 = ScRefFlags::TAB_VALID; p = r.Parse_XL_Header( p, pDoc, aExternDocName, aStartTabName, aEndTabName, nFlags, bOnlyAcceptSingle, pExternalLinks ); @@ -911,30 +911,30 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, aStartTabName, aEndTabName, pDoc); if( nullptr == p ) - return 0; + return ScRefFlags::ZERO; tmp1 = lcl_a1_get_col( p, &r.aStart, &nFlags ); if( tmp1 == nullptr ) // Is it a row only reference 3:5 { if( bOnlyAcceptSingle ) // by definition full row refs are ranges - return 0; + return ScRefFlags::ZERO; tmp1 = lcl_a1_get_row( p, &r.aStart, &nFlags ); tmp1 = lcl_eatWhiteSpace( tmp1 ); if( !tmp1 || *tmp1++ != ':' ) // Even a singleton requires ':' (eg 2:2) - return 0; + return ScRefFlags::ZERO; tmp1 = lcl_eatWhiteSpace( tmp1 ); tmp2 = lcl_a1_get_row( tmp1, &r.aEnd, &nFlags2 ); if( !tmp2 || *tmp2 != 0 ) // Must have fully parsed a singleton. - return 0; + return ScRefFlags::ZERO; r.aStart.SetCol( 0 ); r.aEnd.SetCol( MAXCOL ); nFlags |= - SCA_VALID_COL | SCA_VALID_COL2 | - SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE; - nFlags |= (nFlags2 << 4); + ScRefFlags::COL_VALID | ScRefFlags::COL2_VALID | + ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS; + applyStartToEndFlags(nFlags, nFlags2); return nFlags; } @@ -942,22 +942,22 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, if( tmp2 == nullptr ) // check for col only reference F:H { if( bOnlyAcceptSingle ) // by definition full col refs are ranges - return 0; + return ScRefFlags::ZERO; tmp1 = lcl_eatWhiteSpace( tmp1 ); if( *tmp1++ != ':' ) // Even a singleton requires ':' (eg F:F) - return 0; + return ScRefFlags::ZERO; tmp1 = lcl_eatWhiteSpace( tmp1 ); tmp2 = lcl_a1_get_col( tmp1, &r.aEnd, &nFlags2 ); if( !tmp2 || *tmp2 != 0 ) // Must have fully parsed a singleton. - return 0; + return ScRefFlags::ZERO; r.aStart.SetRow( 0 ); r.aEnd.SetRow( MAXROW ); nFlags |= - SCA_VALID_ROW | SCA_VALID_ROW2 | - SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE; - nFlags |= (nFlags2 << 4); + ScRefFlags::ROW_VALID | ScRefFlags::ROW2_VALID | + ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS; + applyStartToEndFlags(nFlags, nFlags2); return nFlags; } @@ -972,7 +972,7 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, else { // any trailing invalid character must invalidate the address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID); return nFlags; } } @@ -982,17 +982,17 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, { // Sheet1:Sheet2!C4 is a valid range, without a second sheet it is // not. Any trailing invalid character invalidates the range. - if (*tmp2 == 0 && (nFlags & SCA_TAB2_3D)) + if (*tmp2 == 0 && (nFlags & ScRefFlags::TAB2_3D)) { - if (nFlags & SCA_COL_ABSOLUTE) - nFlags |= SCA_COL2_ABSOLUTE; - if (nFlags & SCA_ROW_ABSOLUTE) - nFlags |= SCA_ROW2_ABSOLUTE; + if (nFlags & ScRefFlags::COL_ABS) + nFlags |= ScRefFlags::COL2_ABS; + if (nFlags & ScRefFlags::ROW_ABS) + nFlags |= ScRefFlags::ROW2_ABS; } else - nFlags &= ~(SCA_VALID | - SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | + ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID); return nFlags; } @@ -1008,7 +1008,7 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, if( !aEndTabName.isEmpty() && pDoc->GetTable( aEndTabName, nTab ) ) { r.aEnd.SetTab( nTab ); - nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE; + nFlags |= ScRefFlags::TAB2_VALID | ScRefFlags::TAB2_3D | ScRefFlags::TAB2_ABS; } if (*p == '!' || *p == ':') p = lcl_eatWhiteSpace( p+1 ); @@ -1016,27 +1016,27 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, } } if( !tmp1 ) // strange, but maybe valid singleton - return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID); + return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~ScRefFlags::VALID); tmp2 = lcl_a1_get_row( tmp1, &r.aEnd, &nFlags2 ); if( !tmp2 ) // strange, but maybe valid singleton - return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID); + return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~ScRefFlags::VALID); if ( *tmp2 != 0 ) { // any trailing invalid character must invalidate the range. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | - SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); + nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID | + ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID); return nFlags; } - nFlags |= (nFlags2 << 4); + applyStartToEndFlags(nFlags, nFlags2); return nFlags; } /** @param p pointer to null-terminated sal_Unicode string - @param rRawRes returns SCA_... flags without the final check for full + @param rRawRes returns ScRefFlags::... flags without the final check for full validity that is applied to the return value, with which two addresses that form a column or row singleton range, e.g. A:A or 1:1, can be detected. Used in @@ -1045,12 +1045,12 @@ static sal_uInt16 lcl_ScRange_Parse_XL_A1( ScRange& r, used in conjunction with pExtInfo to determine the tab span of a 3D reference. */ -static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr, - sal_uInt16& rRawRes, +static ScRefFlags lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr, + ScRefFlags& rRawRes, ScAddress::ExternalInfo* pExtInfo = nullptr, ScRange* pRange = nullptr ) { - sal_uInt16 nRes = 0; - rRawRes = 0; + ScRefFlags nRes = ScRefFlags::ZERO; + rRawRes = ScRefFlags::ZERO; OUString aDocName; // the pure Document Name OUString aTab; bool bExtDoc = false; @@ -1081,16 +1081,16 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo SCCOL nCol = 0; SCROW nRow = 0; SCTAB nTab = 0; - sal_uInt16 nBits = SCA_VALID_TAB; + ScRefFlags nBits = ScRefFlags::TAB_VALID; const sal_Unicode* q; if ( ScGlobal::FindUnquoted( p, '.') ) { - nRes |= SCA_TAB_3D; + nRes |= ScRefFlags::TAB_3D; if ( bExtDoc ) - nRes |= SCA_TAB_ABSOLUTE; + nRes |= ScRefFlags::TAB_ABS; if (*p == '$') { - nRes |= SCA_TAB_ABSOLUTE; + nRes |= ScRefFlags::TAB_ABS; p++; } @@ -1119,7 +1119,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo aTab = aTabAcc.makeStringAndClear(); } if( *p++ != '.' ) - nBits = 0; + nBits = ScRefFlags::ZERO; if (!bExtDoc && (!pDoc || !pDoc->GetTable( aTab, nTab ))) { @@ -1134,7 +1134,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo } else // No extension found. This is probably not an external document. - nBits = 0; + nBits = ScRefFlags::ZERO; } } else @@ -1148,10 +1148,10 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo q = p; if (*p) { - nBits = SCA_VALID_COL; + nBits = ScRefFlags::COL_VALID; if (*p == '$') { - nBits |= SCA_COL_ABSOLUTE; + nBits |= ScRefFlags::COL_ABS; p++; } @@ -1162,27 +1162,27 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo nCol = sal::static_int_cast<SCCOL>( ((nCol + 1) * 26) + rtl::toAsciiUpperCase( *p++ ) - 'A' ); } else - nBits = 0; + nBits = ScRefFlags::ZERO; if (nCol > MAXCOL || (*p && *p != '$' && !rtl::isAsciiDigit( *p ))) - nBits = 0; + nBits = ScRefFlags::ZERO; nRes |= nBits; - if( !nBits ) + if( nBits == ScRefFlags::ZERO ) p = q; } q = p; if (*p) { - nBits = SCA_VALID_ROW; + nBits = ScRefFlags::ROW_VALID; if (*p == '$') { - nBits |= SCA_ROW_ABSOLUTE; + nBits |= ScRefFlags::ROW_ABS; p++; } if( !rtl::isAsciiDigit( *p ) ) { - nBits = 0; + nBits = ScRefFlags::ZERO; nRow = SCROW(-1); } else @@ -1191,11 +1191,11 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo while (rtl::isAsciiDigit( *p )) p++; if( n < 0 || n > MAXROW ) - nBits = 0; + nBits = ScRefFlags::ZERO; nRow = static_cast<SCROW>(n); } nRes |= nBits; - if( !nBits ) + if( nBits == ScRefFlags::ZERO ) p = q; } @@ -1204,7 +1204,7 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo if (!*p && bExtDoc) { if (!pDoc) - nRes = 0; + nRes = ScRefFlags::ZERO; else { ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); @@ -1223,24 +1223,24 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo if (pFileName) aDocName = *pFileName; else - nRes = 0; + nRes = ScRefFlags::ZERO; } pRefMgr->convertToAbsName(aDocName); if ((!pExtInfo || !pExtInfo->mbExternal) && pRefMgr->isOwnDocument(aDocName)) { if (!pDoc->GetTable( aTab, nTab )) - nRes = 0; + nRes = ScRefFlags::ZERO; else { rAddr.SetTab( nTab); - nRes |= SCA_VALID_TAB; + nRes |= ScRefFlags::TAB_VALID; } } else { if (!pExtInfo) - nRes = 0; + nRes = ScRefFlags::ZERO; else { if (!pExtInfo->mbExternal) @@ -1256,33 +1256,33 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo &nTab).get()) { rAddr.SetTab( nTab); - nRes |= SCA_VALID_TAB; + nRes |= ScRefFlags::TAB_VALID; } else - nRes = 0; + nRes = ScRefFlags::ZERO; } else { // This is a call for the second part of the reference, // we must have the range to adapt tab span. if (!pRange) - nRes = 0; + nRes = ScRefFlags::ZERO; else { - sal_uInt16 nFlags = nRes | SCA_VALID_TAB2; + ScRefFlags nFlags = nRes | ScRefFlags::TAB2_VALID; if (!lcl_ScRange_External_TabSpan( *pRange, nFlags, pExtInfo, aDocName, pExtInfo->maTabName, aTab, pDoc)) - nRes &= ~SCA_VALID_TAB; + nRes &= ~ScRefFlags::TAB_VALID; else { - if (nFlags & SCA_VALID_TAB2) + if (nFlags & ScRefFlags::TAB2_VALID) { rAddr.SetTab( pRange->aEnd.Tab()); - nRes |= SCA_VALID_TAB; + nRes |= ScRefFlags::TAB_VALID; } else - nRes &= ~SCA_VALID_TAB; + nRes &= ~ScRefFlags::TAB_VALID; } } } @@ -1293,29 +1293,29 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo rRawRes |= nRes; - if ( !(nRes & SCA_VALID_ROW) && (nRes & SCA_VALID_COL) - && !( (nRes & SCA_TAB_3D) && (nRes & SCA_VALID_TAB)) ) + if ( !(nRes & ScRefFlags::ROW_VALID) && (nRes & ScRefFlags::COL_VALID) + && !( (nRes & ScRefFlags::TAB_3D) && (nRes & ScRefFlags::TAB_VALID)) ) { // no Row, no Tab, but Col => DM (...), B (...) et al - nRes = 0; + nRes = ScRefFlags::ZERO; } if( !*p ) { - sal_uInt16 nMask = nRes & ( SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_TAB ); - if( nMask == ( SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_TAB ) ) - nRes |= SCA_VALID; + ScRefFlags nMask = nRes & ( ScRefFlags::ROW_VALID | ScRefFlags::COL_VALID | ScRefFlags::TAB_VALID ); + if( nMask == ( ScRefFlags::ROW_VALID | ScRefFlags::COL_VALID | ScRefFlags::TAB_VALID ) ) + nRes |= ScRefFlags::VALID; } else - nRes = 0; + nRes = ScRefFlags::ZERO; return nRes; } -static sal_uInt16 lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr, +static ScRefFlags lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr, const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo = nullptr, const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks = nullptr ) { if( !*p ) - return 0; + return ScRefFlags::ZERO; switch (rDetails.eConv) { @@ -1323,7 +1323,7 @@ static sal_uInt16 lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, case formula::FormulaGrammar::CONV_XL_OOX: { ScRange rRange = rAddr; - sal_uInt16 nFlags = lcl_ScRange_Parse_XL_A1( + ScRefFlags nFlags = lcl_ScRange_Parse_XL_A1( rRange, p, pDoc, true, pExtInfo, (rDetails.eConv == formula::FormulaGrammar::CONV_XL_OOX ? pExternalLinks : nullptr) ); rAddr = rRange.aStart; @@ -1332,14 +1332,14 @@ static sal_uInt16 lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, case formula::FormulaGrammar::CONV_XL_R1C1: { ScRange rRange = rAddr; - sal_uInt16 nFlags = lcl_ScRange_Parse_XL_R1C1( rRange, p, pDoc, rDetails, true, pExtInfo ); + ScRefFlags nFlags = lcl_ScRange_Parse_XL_R1C1( rRange, p, pDoc, rDetails, true, pExtInfo ); rAddr = rRange.aStart; return nFlags; } default : case formula::FormulaGrammar::CONV_OOO: { - sal_uInt16 nRawRes = 0; + ScRefFlags nRawRes = ScRefFlags::ZERO; return lcl_ScAddress_Parse_OOo( p, pDoc, rAddr, nRawRes, pExtInfo ); } } @@ -1354,13 +1354,13 @@ bool ConvertSingleRef( ScDocument* pDoc, const OUString& rRefString, if (pExtInfo || (ScGlobal::FindUnquoted( rRefString, SC_COMPILER_FILE_TAB_SEP) == -1)) { ScAddress aAddr( 0, 0, nDefTab ); - sal_uInt16 nRes = aAddr.Parse( rRefString, pDoc, rDetails, pExtInfo); - if ( nRes & SCA_VALID ) + ScRefFlags nRes = aAddr.Parse( rRefString, pDoc, rDetails, pExtInfo); + if ( nRes & ScRefFlags::VALID ) { rRefAddress.Set( aAddr, - ((nRes & SCA_COL_ABSOLUTE) == 0), - ((nRes & SCA_ROW_ABSOLUTE) == 0), - ((nRes & SCA_TAB_ABSOLUTE) == 0)); + ((nRes & ScRefFlags::COL_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::TAB_ABS) == ScRefFlags::ZERO)); bRet = true; } } @@ -1376,24 +1376,24 @@ bool ConvertDoubleRef( ScDocument* pDoc, const OUString& rRefString, SCTAB nDefT if (pExtInfo || (ScGlobal::FindUnquoted( rRefString, SC_COMPILER_FILE_TAB_SEP) == -1)) { ScRange aRange( ScAddress( 0, 0, nDefTab)); - sal_uInt16 nRes = aRange.Parse( rRefString, pDoc, rDetails, pExtInfo); - if ( nRes & SCA_VALID ) + ScRefFlags nRes = aRange.Parse( rRefString, pDoc, rDetails, pExtInfo); + if ( nRes & ScRefFlags::VALID ) { rStartRefAddress.Set( aRange.aStart, - ((nRes & SCA_COL_ABSOLUTE) == 0), - ((nRes & SCA_ROW_ABSOLUTE) == 0), - ((nRes & SCA_TAB_ABSOLUTE) == 0)); + ((nRes & ScRefFlags::COL_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::TAB_ABS) == ScRefFlags::ZERO)); rEndRefAddress.Set( aRange.aEnd, - ((nRes & SCA_COL2_ABSOLUTE) == 0), - ((nRes & SCA_ROW2_ABSOLUTE) == 0), - ((nRes & SCA_TAB2_ABSOLUTE) == 0)); + ((nRes & ScRefFlags::COL2_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::ROW2_ABS) == ScRefFlags::ZERO), + ((nRes & ScRefFlags::TAB2_ABS) == ScRefFlags::ZERO)); bRet = true; } } return bRet; } -sal_uInt16 ScAddress::Parse( const OUString& r, ScDocument* pDoc, +ScRefFlags ScAddress::Parse( const OUString& r, ScDocument* pDoc, const Details& rDetails, ExternalInfo* pExtInfo, const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) @@ -1463,78 +1463,83 @@ void ScRange::ExtendTo( const ScRange& rRange ) *this = rRange; } -static sal_uInt16 lcl_ScRange_Parse_OOo( ScRange& rRange, +static ScRefFlags lcl_ScRange_Parse_OOo( ScRange& rRange, const OUString& r, ScDocument* pDoc, ScAddress::ExternalInfo* pExtInfo = nullptr ) { - sal_uInt16 nRes1 = 0, nRes2 = 0; + ScRefFlags nRes1 = ScRefFlags::ZERO, nRes2 = ScRefFlags::ZERO; sal_Int32 nPos = ScGlobal::FindUnquoted( r, ':'); if (nPos != -1) { OUStringBuffer aTmp(r); aTmp[nPos] = 0; const sal_Unicode* p = aTmp.getStr(); - sal_uInt16 nRawRes1 = 0; - if (((nRes1 = lcl_ScAddress_Parse_OOo( p, pDoc, rRange.aStart, nRawRes1, pExtInfo)) != 0) || - ((nRawRes1 & (SCA_VALID_COL | SCA_VALID_ROW)) && (nRawRes1 & SCA_VALID_TAB))) + ScRefFlags nRawRes1 = ScRefFlags::ZERO; + if (((nRes1 = lcl_ScAddress_Parse_OOo( p, pDoc, rRange.aStart, nRawRes1, pExtInfo)) != ScRefFlags::ZERO) || + ((nRawRes1 & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID)) && + (nRawRes1 & ScRefFlags::TAB_VALID))) { rRange.aEnd = rRange.aStart; // sheet must be initialized identical to first sheet - sal_uInt16 nRawRes2 = 0; + ScRefFlags nRawRes2 = ScRefFlags::ZERO; nRes2 = lcl_ScAddress_Parse_OOo( p + nPos+ 1, pDoc, rRange.aEnd, nRawRes2, pExtInfo, &rRange); - if (!((nRes1 & SCA_VALID) && (nRes2 & SCA_VALID)) && + if (!((nRes1 & ScRefFlags::VALID) && (nRes2 & ScRefFlags::VALID)) && // If not fully valid addresses, check if both have a valid // column or row, and both have valid (or omitted) sheet references. - (nRawRes1 & (SCA_VALID_COL | SCA_VALID_ROW)) && (nRawRes1 & SCA_VALID_TAB) && - (nRawRes2 & (SCA_VALID_COL | SCA_VALID_ROW)) && (nRawRes2 & SCA_VALID_TAB) && + (nRawRes1 & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID)) && + (nRawRes1 & ScRefFlags::TAB_VALID) && + (nRawRes2 & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID)) && + (nRawRes2 & ScRefFlags::TAB_VALID) && // Both must be column XOR row references, A:A or 1:1 but not A:1 or 1:A - ((nRawRes1 & (SCA_VALID_COL | SCA_VALID_ROW)) == (nRawRes2 & (SCA_VALID_COL | SCA_VALID_ROW)))) + ((nRawRes1 & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID)) == + (nRawRes2 & (ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID)))) { - nRes1 = nRawRes1 | SCA_VALID; - nRes2 = nRawRes2 | SCA_VALID; - if (nRawRes1 & SCA_VALID_COL) + nRes1 = nRawRes1 | ScRefFlags::VALID; + nRes2 = nRawRes2 | ScRefFlags::VALID; + if (nRawRes1 & ScRefFlags::COL_VALID) { rRange.aStart.SetRow(0); rRange.aEnd.SetRow(MAXROW); - nRes1 |= SCA_VALID_ROW | SCA_ROW_ABSOLUTE; - nRes2 |= SCA_VALID_ROW | SCA_ROW_ABSOLUTE; + nRes1 |= ScRefFlags::ROW_VALID | ScRefFlags::ROW_ABS; + nRes2 |= ScRefFlags::ROW_VALID | ScRefFlags::ROW_ABS; } else { rRange.aStart.SetCol(0); rRange.aEnd.SetCol(MAXCOL); - nRes1 |= SCA_VALID_COL | SCA_COL_ABSOLUTE; - nRes2 |= SCA_VALID_COL | SCA_COL_ABSOLUTE; + nRes1 |= ScRefFlags::COL_VALID | ScRefFlags::COL_ABS; + nRes2 |= ScRefFlags::COL_VALID | ScRefFlags::COL_ABS; } } - else if ((nRes1 & SCA_VALID) && (nRes2 & SCA_VALID)) + else if ((nRes1 & ScRefFlags::VALID) && (nRes2 & ScRefFlags::VALID)) { // Flag entire column/row references so they can be displayed // as such. If the sticky reference parts are not both // absolute or relative, assume that the user thought about // something we should not touch. if (rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW && - ((nRes1 & SCA_ROW_ABSOLUTE) == 0) && ((nRes2 & SCA_ROW_ABSOLUTE) == 0)) + ((nRes1 & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO) && + ((nRes2 & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO)) { - nRes1 |= SCA_ROW_ABSOLUTE; - nRes2 |= SCA_ROW_ABSOLUTE; + nRes1 |= ScRefFlags::ROW_ABS; + nRes2 |= ScRefFlags::ROW_ABS; } else if (rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL && - ((nRes1 & SCA_COL_ABSOLUTE) == 0) && ((nRes2 & SCA_COL_ABSOLUTE) == 0)) + ((nRes1 & ScRefFlags::COL_ABS) == ScRefFlags::ZERO) && ((nRes2 & ScRefFlags::COL_ABS) == ScRefFlags::ZERO)) { - nRes1 |= SCA_COL_ABSOLUTE; - nRes2 |= SCA_COL_ABSOLUTE; + nRes1 |= ScRefFlags::COL_ABS; + nRes2 |= ScRefFlags::COL_ABS; } } - if ((nRes1 & SCA_VALID) && (nRes2 & SCA_VALID)) + if ((nRes1 & ScRefFlags::VALID) && (nRes2 & ScRefFlags::VALID)) { // PutInOrder / Justify - sal_uInt16 nMask, nBits1, nBits2; + ScRefFlags nMask, nBits1, nBits2; SCCOL nTempCol; if ( rRange.aEnd.Col() < (nTempCol = rRange.aStart.Col()) ) { rRange.aStart.SetCol(rRange.aEnd.Col()); rRange.aEnd.SetCol(nTempCol); - nMask = (SCA_VALID_COL | SCA_COL_ABSOLUTE); + nMask = (ScRefFlags::COL_VALID | ScRefFlags::COL_ABS); nBits1 = nRes1 & nMask; nBits2 = nRes2 & nMask; nRes1 = (nRes1 & ~nMask) | nBits2; @@ -1544,7 +1549,7 @@ static sal_uInt16 lcl_ScRange_Parse_OOo( ScRange& rRange, if ( rRange.aEnd.Row() < (nTempRow = rRange.aStart.Row()) ) { rRange.aStart.SetRow(rRange.aEnd.Row()); rRange.aEnd.SetRow(nTempRow); - nMask = (SCA_VALID_ROW | SCA_ROW_ABSOLUTE); + nMask = (ScRefFlags::ROW_VALID | ScRefFlags::ROW_ABS); nBits1 = nRes1 & nMask; nBits2 = nRes2 & nMask; nRes1 = (nRes1 & ~nMask) | nBits2; @@ -1554,37 +1559,36 @@ static sal_uInt16 lcl_ScRange_Parse_OOo( ScRange& rRange, if ( rRange.aEnd.Tab() < (nTempTab = rRange.aStart.Tab()) ) { rRange.aStart.SetTab(rRange.aEnd.Tab()); rRange.aEnd.SetTab(nTempTab); - nMask = (SCA_VALID_TAB | SCA_TAB_ABSOLUTE | SCA_TAB_3D); + nMask = (ScRefFlags::TAB_VALID | ScRefFlags::TAB_ABS | ScRefFlags::TAB_3D); nBits1 = nRes1 & nMask; nBits2 = nRes2 & nMask; nRes1 = (nRes1 & ~nMask) | nBits2; nRes2 = (nRes2 & ~nMask) | nBits1; } - if ( ((nRes1 & ( SCA_TAB_ABSOLUTE | SCA_TAB_3D )) - == ( SCA_TAB_ABSOLUTE | SCA_TAB_3D )) - && !(nRes2 & SCA_TAB_3D) ) - nRes2 |= SCA_TAB_ABSOLUTE; + if ( ((nRes1 & ( ScRefFlags::TAB_ABS | ScRefFlags::TAB_3D )) + == ( ScRefFlags::TAB_ABS | ScRefFlags::TAB_3D )) + && !(nRes2 & ScRefFlags::TAB_3D) ) + nRes2 |= ScRefFlags::TAB_ABS; } else { // Don't leave around valid half references. - nRes1 = nRes2 = 0; + nRes1 = nRes2 = ScRefFlags::ZERO; } } } - nRes1 = ( ( nRes1 | nRes2 ) & SCA_VALID ) - | nRes1 - | ( ( nRes2 & SCA_BITS ) << 4 ); + applyStartToEndFlags(nRes1, nRes2 & ScRefFlags::BITS); + nRes1 |= nRes2 & ScRefFlags::VALID; return nRes1; } -sal_uInt16 ScRange::Parse( const OUString& rString, ScDocument* pDoc, +ScRefFlags ScRange::Parse( const OUString& rString, ScDocument* pDoc, const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo, const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { if (rString.isEmpty()) - return 0; + return ScRefFlags::ZERO; switch (rDetails.eConv) { @@ -1609,31 +1613,32 @@ sal_uInt16 ScRange::Parse( const OUString& rString, ScDocument* pDoc, } // Accept a full range, or an address -sal_uInt16 ScRange::ParseAny( const OUString& rString, ScDocument* pDoc, +ScRefFlags ScRange::ParseAny( const OUString& rString, ScDocument* pDoc, const ScAddress::Details& rDetails ) { - sal_uInt16 nRet = Parse( rString, pDoc, rDetails ); - const sal_uInt16 nValid = SCA_VALID | SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2; + ScRefFlags nRet = Parse( rString, pDoc, rDetails ); + const ScRefFlags nValid = ScRefFlags::VALID | ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID; if ( (nRet & nValid) != nValid ) { ScAddress aAdr(aStart);//initialize with currentPos as fallback for table number nRet = aAdr.Parse( rString, pDoc, rDetails ); - if ( nRet & SCA_VALID ) + if ( nRet & ScRefFlags::VALID ) aStart = aEnd = aAdr; } return nRet; } // Parse only full row references -sal_uInt16 ScRange::ParseCols( const OUString& rStr, ScDocument* pDoc, +ScRefFlags ScRange::ParseCols( const OUString& rStr, ScDocument* pDoc, const ScAddress::Details& rDetails ) { if (rStr.isEmpty()) - return 0; + return ScRefFlags::ZERO; const sal_Unicode* p = rStr.getStr(); - sal_uInt16 nRes = 0, ignored = 0; + ScRefFlags nRes = ScRefFlags::ZERO; + ScRefFlags ignored = ScRefFlags::ZERO; (void)pDoc; // make compiler shutup we may need this later @@ -1649,13 +1654,13 @@ sal_uInt16 ScRange::ParseCols( const OUString& rStr, ScDocument* pDoc, { if( nullptr != (p = lcl_a1_get_col( p+1, &aEnd, &ignored ))) { - nRes = SCA_VALID_COL; + nRes = ScRefFlags::COL_VALID; } } else { aEnd = aStart; - nRes = SCA_VALID_COL; + nRes = ScRefFlags::COL_VALID; } } break; @@ -1669,19 +1674,19 @@ sal_uInt16 ScRange::ParseCols( const OUString& rStr, ScDocument* pDoc, if( (p[1] == 'C' || p[1] == 'c') && ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits