summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-03-09 15:23:11 +0100
committerEike Rathke <erack@redhat.com>2016-03-12 00:21:29 +0000
commit51d0b4037b36a4a74c9181b95edb18017542ab79 (patch)
treec13c5ac4782888e1640ee60911d68329018dcc05
parentdc519b6dea7653e4b68b45aa664e3c0b5189d682 (diff)
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+logerrit@ok.de> Reviewed-on: https://gerrit.libreoffice.org/22840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/inc/address.hxx91
-rw-r--r--sc/inc/attrib.hxx3
-rw-r--r--sc/inc/rangelst.hxx6
-rw-r--r--sc/inc/rangeutl.hxx8
-rw-r--r--sc/qa/unit/copy_paste_test.cxx4
-rw-r--r--sc/qa/unit/helper/qahelper.cxx14
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx164
-rw-r--r--sc/qa/unit/ucalc_pivottable.cxx6
-rw-r--r--sc/qa/unit/ucalc_sort.cxx2
-rw-r--r--sc/source/core/data/bcaslot.cxx6
-rw-r--r--sc/source/core/data/conditio.cxx2
-rw-r--r--sc/source/core/data/documen5.cxx12
-rw-r--r--sc/source/core/data/dpcache.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx12
-rw-r--r--sc/source/core/data/validat.cxx4
-rw-r--r--sc/source/core/tool/address.cxx522
-rw-r--r--sc/source/core/tool/chartarr.cxx4
-rw-r--r--sc/source/core/tool/chgtrack.cxx12
-rw-r--r--sc/source/core/tool/compiler.cxx60
-rw-r--r--sc/source/core/tool/grouparealistener.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx20
-rw-r--r--sc/source/core/tool/rangelst.cxx28
-rw-r--r--sc/source/core/tool/rangenam.cxx4
-rw-r--r--sc/source/core/tool/rangeutl.cxx66
-rw-r--r--sc/source/core/tool/reffind.cxx30
-rw-r--r--sc/source/filter/excel/xecontent.cxx2
-rw-r--r--sc/source/filter/excel/xename.cxx4
-rw-r--r--sc/source/filter/excel/xestream.cxx6
-rw-r--r--sc/source/filter/excel/xicontent.cxx4
-rw-r--r--sc/source/filter/excel/xilink.cxx4
-rw-r--r--sc/source/filter/oox/worksheetbuffer.cxx2
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx3
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx26
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleCellBase.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx4
-rw-r--r--sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx4
-rw-r--r--sc/source/ui/StatisticsDialogs/SamplingDialog.cxx12
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx12
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx18
-rw-r--r--sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx6
-rw-r--r--sc/source/ui/app/inputhdl.cxx33
-rw-r--r--sc/source/ui/app/inputwin.cxx8
-rw-r--r--sc/source/ui/collab/sendfunc.cxx2
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx22
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx2
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx10
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx12
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx10
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx6
-rw-r--r--sc/source/ui/dbgui/foptmgr.cxx14
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx22
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx18
-rw-r--r--sc/source/ui/dbgui/validate.cxx2
-rw-r--r--sc/source/ui/dialogs/searchresults.cxx6
-rw-r--r--sc/source/ui/docshell/arealink.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx8
-rw-r--r--sc/source/ui/docshell/impex.cxx8
-rw-r--r--sc/source/ui/docshell/servobj.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx8
-rw-r--r--sc/source/ui/formdlg/formula.cxx4
-rw-r--r--sc/source/ui/inc/rfindlst.hxx4
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx2
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx8
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx27
-rw-r--r--sc/source/ui/miscdlgs/datastreamdlg.cxx6
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx4
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx14
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx4
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx16
-rw-r--r--sc/source/ui/miscdlgs/tabopdlg.cxx6
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx4
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx4
-rw-r--r--sc/source/ui/navipi/navipi.cxx2
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx62
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx2
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx68
-rw-r--r--sc/source/ui/unoobj/addruno.cxx24
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx22
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx4
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx4
-rw-r--r--sc/source/ui/vba/vbanames.cxx3
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx4
-rw-r--r--sc/source/ui/vba/vbarange.cxx31
-rw-r--r--sc/source/ui/vba/vbarange.hxx3
-rw-r--r--sc/source/ui/vba/vbavalidation.cxx2
-rw-r--r--sc/source/ui/view/cellsh.cxx3
-rw-r--r--sc/source/ui/view/cellsh1.cxx4
-rw-r--r--sc/source/ui/view/cellsh2.cxx6
-rw-r--r--sc/source/ui/view/drawvie4.cxx4
-rw-r--r--sc/source/ui/view/gridwin.cxx16
-rw-r--r--sc/source/ui/view/gridwin2.cxx6
-rw-r--r--sc/source/ui/view/output.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx40
-rw-r--r--sc/source/ui/view/tabvwsha.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx6
-rw-r--r--sc/source/ui/view/viewfun5.cxx2
-rw-r--r--sc/source/ui/view/viewfun6.cxx4
-rw-r--r--sc/source/ui/xmlsource/xmlsourcedlg.cxx8
106 files changed, 950 insertions, 895 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 0e545be5578f..a917de79d0c8 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 7bab719aadc3..4c0b739a34b3 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 7d19174cbe43..2641483adef9 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 c572797bc6f6..2aa035e07de2 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 e0bd40279639..44a24d625227 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 ad32a2077c7d..96dbf5c75f12 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 37181312cc46..c78f321878c0 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 f93f9dd91429..1d54d79dc2fa 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 ef143ffd7bbd..3ec7bd1d8b24 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 e692ec8fa5af..b47b3a3f1c03 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 6e9c640105be..5a09764e5753 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 8b8b4bc32c28..d65355b4f4fe 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 9345d20589ee..b054560d8d61 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 9fdf5a2dfbad..ff343d34f284 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 b6d9c392d914..48314dd53971 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 baf4110d16bc..2535990a8849 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 5542be679e7f..ef2e492a55ee 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') &&
nullptr != (p = lcl_r1c1_get_col( p+1, rDetails, &aEnd, &ignored )))
{
- nRes = SCA_VALID_COL;
+ nRes = ScRefFlags::COL_VALID;
}
}
else
{
aEnd = aStart;
- nRes = SCA_VALID_COL;
+ nRes = ScRefFlags::COL_VALID;
}
}
break;
}
- return (p != nullptr && *p == '\0') ? nRes : 0;
+ return (p != nullptr && *p == '\0') ? nRes : ScRefFlags::ZERO;
}
// Parse only full row references
@@ -1692,7 +1697,7 @@ void ScRange::ParseRows( const OUString& rStr, ScDocument* pDoc,
return;
const sal_Unicode* p = rStr.getStr();
- sal_uInt16 ignored = 0;
+ ScRefFlags ignored = ScRefFlags::ZERO;
(void)pDoc; // make compiler shutup we may need this later
@@ -1852,20 +1857,20 @@ static inline void lcl_string_append(OStringBuffer &rString, const OUString &sSt
rString.append(OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ));
}
-template<typename T > inline void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCOL nCol, sal_uInt16 nFlags,
+template<typename T > inline void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCOL nCol, ScRefFlags nFlags,
const ScDocument* pDoc,
const ScAddress::Details& rDetails)
{
- if( nFlags & SCA_VALID )
- nFlags |= ( SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_TAB );
- if( pDoc && (nFlags & SCA_VALID_TAB ) )
+ if( nFlags & ScRefFlags::VALID )
+ nFlags |= ( ScRefFlags::ROW_VALID | ScRefFlags::COL_VALID | ScRefFlags::TAB_VALID );
+ if( pDoc && (nFlags & ScRefFlags::TAB_VALID ) )
{
if ( nTab >= pDoc->GetTableCount() )
{
lcl_string_append(r, ScGlobal::GetRscString( STR_NOREF_STR ));
return;
}
- if( nFlags & SCA_TAB_3D )
+ if( nFlags & ScRefFlags::TAB_3D )
{
OUString aTabName, aDocName;
pDoc->GetName(nTab, aTabName);
@@ -1879,7 +1884,7 @@ template<typename T > inline void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCO
aTabName = aTabName.copy( nPos + 1 );
}
}
- else if( nFlags & SCA_FORCE_DOC )
+ else if( nFlags & ScRefFlags::FORCE_DOC )
{
// VBA has an 'external' flag that forces the addition of the
// tab name _and_ the doc name. The VBA code would be
@@ -1895,7 +1900,7 @@ template<typename T > inline void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCO
default :
case formula::FormulaGrammar::CONV_OOO:
lcl_string_append(r, aDocName);
- if( nFlags & SCA_TAB_ABSOLUTE )
+ if( nFlags & ScRefFlags::TAB_ABS )
r.append("$");
lcl_string_append(r, aTabName);
r.append(".");
@@ -1921,29 +1926,29 @@ template<typename T > inline void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCO
case formula::FormulaGrammar::CONV_OOO:
case formula::FormulaGrammar::CONV_XL_A1:
case formula::FormulaGrammar::CONV_XL_OOX:
- if( nFlags & SCA_VALID_COL )
- lcl_a1_append_c ( r, nCol, (nFlags & SCA_COL_ABSOLUTE) != 0 );
- if( nFlags & SCA_VALID_ROW )
- lcl_a1_append_r ( r, nRow, (nFlags & SCA_ROW_ABSOLUTE) != 0 );
+ if( nFlags & ScRefFlags::COL_VALID )
+ lcl_a1_append_c ( r, nCol, (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO );
+ if( nFlags & ScRefFlags::ROW_VALID )
+ lcl_a1_append_r ( r, nRow, (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO );
break;
case formula::FormulaGrammar::CONV_XL_R1C1:
- if( nFlags & SCA_VALID_ROW )
- lcl_r1c1_append_r ( r, nRow, (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails );
- if( nFlags & SCA_VALID_COL )
- lcl_r1c1_append_c ( r, nCol, (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails );
+ if( nFlags & ScRefFlags::ROW_VALID )
+ lcl_r1c1_append_r ( r, nRow, (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO, rDetails );
+ if( nFlags & ScRefFlags::COL_VALID )
+ lcl_r1c1_append_c ( r, nCol, (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO, rDetails );
break;
}
}
-void ScAddress::Format( OStringBuffer& r, sal_uInt16 nFlags,
+void ScAddress::Format( OStringBuffer& r, ScRefFlags nFlags,
const ScDocument* pDoc,
const Details& rDetails) const
{
lcl_Format(r, nTab, nRow, nCol, nFlags, pDoc, rDetails);
}
-OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc,
+OUString ScAddress::Format(ScRefFlags nFlags, const ScDocument* pDoc,
const Details& rDetails) const
{
OUStringBuffer r;
@@ -1953,7 +1958,7 @@ OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc,
static void lcl_Split_DocTab( const ScDocument* pDoc, SCTAB nTab,
const ScAddress::Details& rDetails,
- sal_uInt16 nFlags,
+ ScRefFlags nFlags,
OUString& rTabName, OUString& rDocName )
{
pDoc->GetName(nTab, rTabName);
@@ -1968,7 +1973,7 @@ static void lcl_Split_DocTab( const ScDocument* pDoc, SCTAB nTab,
rTabName = rTabName.copy( nPos + 1 );
}
}
- else if( nFlags & SCA_FORCE_DOC )
+ else if( nFlags & ScRefFlags::FORCE_DOC )
{
// VBA has an 'external' flag that forces the addition of the
// tab name _and_ the doc name. The VBA code would be
@@ -1981,10 +1986,10 @@ static void lcl_Split_DocTab( const ScDocument* pDoc, SCTAB nTab,
}
static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange& rRange,
- sal_uInt16 nFlags, const ScDocument* pDoc,
+ ScRefFlags nFlags, const ScDocument* pDoc,
const ScAddress::Details& rDetails )
{
- if( nFlags & SCA_TAB_3D )
+ if( nFlags & ScRefFlags::TAB_3D )
{
OUString aTabName, aDocName;
lcl_Split_DocTab( pDoc, rRange.aStart.Tab(), rDetails, nFlags,
@@ -1995,7 +2000,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange
}
rString.append(aTabName);
- if( nFlags & SCA_TAB2_3D )
+ if( nFlags & ScRefFlags::TAB2_3D )
{
lcl_Split_DocTab( pDoc, rRange.aEnd.Tab(), rDetails, nFlags,
aTabName, aDocName );
@@ -2006,32 +2011,42 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange
}
}
-OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc,
+// helpers used in ScRange::Format
+static inline bool lcl_ColAbsFlagDiffer(const ScRefFlags nFlags)
+{
+ return (bool)(nFlags & ScRefFlags::COL_ABS) != (bool)(nFlags & ScRefFlags::COL2_ABS);
+}
+static inline bool lcl_RowAbsFlagDiffer(const ScRefFlags nFlags)
+{
+ return (bool)(nFlags & ScRefFlags::ROW_ABS) != (bool)(nFlags & ScRefFlags::ROW2_ABS);
+}
+
+OUString ScRange::Format( ScRefFlags nFlags, const ScDocument* pDoc,
const ScAddress::Details& rDetails ) const
{
- if( !( nFlags & SCA_VALID ) )
+ if( !( nFlags & ScRefFlags::VALID ) )
{
return ScGlobal::GetRscString( STR_NOREF_STR );
}
OUStringBuffer r;
-#define absrel_differ(nFlags, mask) (((nFlags) & (mask)) ^ (((nFlags) >> 4) & (mask)))
switch( rDetails.eConv ) {
default :
case formula::FormulaGrammar::CONV_OOO: {
bool bOneTab = (aStart.Tab() == aEnd.Tab());
if ( !bOneTab )
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
r = aStart.Format(nFlags, pDoc, rDetails);
if( aStart != aEnd ||
- absrel_differ( nFlags, SCA_COL_ABSOLUTE ) ||
- absrel_differ( nFlags, SCA_ROW_ABSOLUTE ))
+ lcl_ColAbsFlagDiffer( nFlags ) ||
+ lcl_RowAbsFlagDiffer( nFlags ))
{
- nFlags = ( nFlags & SCA_VALID ) | ( ( nFlags >> 4 ) & 0x070F );
+ // move flags of end reference to start reference, mask with BITS to exclude FORCE_DOC flag
+ nFlags = ScRefFlags::VALID | (ScRefFlags((std::underlying_type<ScRefFlags>::type)nFlags >> 4) & ScRefFlags::BITS);
if ( bOneTab )
pDoc = nullptr;
else
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
OUString aName(aEnd.Format(nFlags, pDoc, rDetails));
r.append(":");
r.append(aName);
@@ -2045,28 +2060,28 @@ OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc,
if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL )
{
// Full col refs always require 2 rows (2:2)
- lcl_a1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0 );
+ lcl_a1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO );
r.append(":");
- lcl_a1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0 );
+ lcl_a1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != ScRefFlags::ZERO );
}
else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW )
{
// Full row refs always require 2 cols (A:A)
- lcl_a1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0 );
+ lcl_a1_append_c( r, aStart.Col(), (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO );
r.append(":");
- lcl_a1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0 );
+ lcl_a1_append_c( r, aEnd.Col(), (nFlags & ScRefFlags::COL2_ABS) != ScRefFlags::ZERO );
}
else
{
- lcl_a1_append_c ( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0 );
- lcl_a1_append_r ( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0 );
+ lcl_a1_append_c ( r, aStart.Col(), (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO );
+ lcl_a1_append_r ( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO );
if( aStart.Col() != aEnd.Col() ||
- absrel_differ( nFlags, SCA_COL_ABSOLUTE ) ||
+ lcl_ColAbsFlagDiffer( nFlags ) ||
aStart.Row() != aEnd.Row() ||
- absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) {
+ lcl_RowAbsFlagDiffer( nFlags ) ) {
r.append(":");
- lcl_a1_append_c ( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0 );
- lcl_a1_append_r ( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0 );
+ lcl_a1_append_c ( r, aEnd.Col(), (nFlags & ScRefFlags::COL2_ABS) != ScRefFlags::ZERO );
+ lcl_a1_append_r ( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != ScRefFlags::ZERO );
}
}
break;
@@ -2075,37 +2090,36 @@ OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc,
lcl_ScRange_Format_XL_Header( r, *this, nFlags, pDoc, rDetails );
if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL )
{
- lcl_r1c1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO, rDetails );
if( aStart.Row() != aEnd.Row() ||
- absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) {
+ lcl_RowAbsFlagDiffer( nFlags ) ) {
r.append(":");
- lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != ScRefFlags::ZERO, rDetails );
}
}
else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW )
{
- lcl_r1c1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_c( r, aStart.Col(), (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO, rDetails );
if( aStart.Col() != aEnd.Col() ||
- absrel_differ( nFlags, SCA_COL_ABSOLUTE )) {
+ lcl_ColAbsFlagDiffer( nFlags )) {
r.append(":");
- lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & ScRefFlags::COL2_ABS) != ScRefFlags::ZERO, rDetails );
}
}
else
{
- lcl_r1c1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails );
- lcl_r1c1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_r( r, aStart.Row(), (nFlags & ScRefFlags::ROW_ABS) != ScRefFlags::ZERO, rDetails );
+ lcl_r1c1_append_c( r, aStart.Col(), (nFlags & ScRefFlags::COL_ABS) != ScRefFlags::ZERO, rDetails );
if( aStart.Col() != aEnd.Col() ||
- absrel_differ( nFlags, SCA_COL_ABSOLUTE ) ||
+ lcl_ColAbsFlagDiffer( nFlags ) ||
aStart.Row() != aEnd.Row() ||
- absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) {
+ lcl_RowAbsFlagDiffer( nFlags ) ) {
r.append(":");
- lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0, rDetails );
- lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0, rDetails );
+ lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & ScRefFlags::ROW2_ABS) != ScRefFlags::ZERO, rDetails );
+ lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & ScRefFlags::COL2_ABS) != ScRefFlags::ZERO, rDetails );
}
}
}
-#undef absrel_differ
return r.makeStringAndClear();
}
@@ -2266,17 +2280,17 @@ OUString ScRefAddress::GetRefString( ScDocument* pDoc, SCTAB nActTab,
if ( Tab()+1 > pDoc->GetTableCount() )
return ScGlobal::GetRscString( STR_NOREF_STR );
- sal_uInt16 nFlags = SCA_VALID;
+ ScRefFlags nFlags = ScRefFlags::VALID;
if ( nActTab != Tab() )
{
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
if ( !bRelTab )
- nFlags |= SCA_TAB_ABSOLUTE;
+ nFlags |= ScRefFlags::TAB_ABS;
}
if ( !bRelCol )
- nFlags |= SCA_COL_ABSOLUTE;
+ nFlags |= ScRefFlags::COL_ABS;
if ( !bRelRow )
- nFlags |= SCA_ROW_ABSOLUTE;
+ nFlags |= ScRefFlags::ROW_ABS;
return aAdr.Format(nFlags, pDoc, rDetails);
}
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index 4d1cccb4c34b..eab0e71f5a6a 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -266,7 +266,7 @@ ScMemChart* ScChartArray::CreateMemChartSingle()
aBuf.append(' ');
ScAddress aPos( aCols[ nCol ], 0, 0 );
- aBuf.append(aPos.Format(SCA_VALID_COL));
+ aBuf.append(aPos.Format(ScRefFlags::COL_VALID));
aString = aBuf.makeStringAndClear();
}
@@ -379,7 +379,7 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
else
nPosCol++;
ScAddress aPos( nPosCol - 1, 0, 0 );
- aBuf.append(aPos.Format(SCA_VALID_COL));
+ aBuf.append(aPos.Format(ScRefFlags::COL_VALID));
aString = aBuf.makeStringAndClear();
}
pMemChart->SetColText( nCol, aString);
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 076a34ccf1dd..80040a595654 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -501,8 +501,8 @@ OUString ScChangeAction::GetRefString(
const ScBigRange& rRange, ScDocument* pDoc, bool bFlag3D ) const
{
OUStringBuffer aBuf;
- sal_uInt16 nFlags = ( rRange.IsValid( pDoc ) ? SCA_VALID : 0 );
- if ( !nFlags )
+ ScRefFlags nFlags = ( rRange.IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ if ( nFlags == ScRefFlags::ZERO )
aBuf.append(ScGlobal::GetRscString(STR_NOREF_STR));
else
{
@@ -538,7 +538,7 @@ OUString ScChangeAction::GetRefString(
default:
{
if ( bFlag3D || GetType() == SC_CAT_INSERT_TABS )
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
aBuf.append(aTmpRange.Format(nFlags, pDoc, pDoc->GetAddressConvention()));
}
@@ -1495,8 +1495,8 @@ void ScChangeActionContent::GetDescription(
void ScChangeActionContent::GetRefString(
OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
{
- sal_uInt16 nFlags = ( GetBigRange().IsValid( pDoc ) ? SCA_VALID : 0 );
- if ( nFlags )
+ ScRefFlags nFlags = ( GetBigRange().IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ if ( nFlags != ScRefFlags::ZERO )
{
const ScCellValue& rCell = GetNewCell();
if ( GetContentCellType(rCell) == SC_CACCT_MATORG )
@@ -1514,7 +1514,7 @@ void ScChangeActionContent::GetRefString(
ScAddress aTmpAddress( GetBigRange().aStart.MakeAddress() );
if ( bFlag3D )
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
rStr = aTmpAddress.Format(nFlags, pDoc, pDoc->GetAddressConvention());
if ( IsDeletedIn() )
{
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7d9895f6c457..2ea80345b11d 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -496,7 +496,7 @@ static bool lcl_parseExternalName(
// indexed external document names.
ScRange aRange;
OUString aStartTabName, aEndTabName;
- sal_uInt16 nFlags = 0;
+ ScRefFlags nFlags = ScRefFlags::ZERO;
p = aRange.Parse_XL_Header( p, pDoc, aTmpFile, aStartTabName,
aEndTabName, nFlags, true, pExternalLinks );
if (!p || p == pStart)
@@ -2855,23 +2855,23 @@ bool ScCompiler::IsDoubleReference( const OUString& rName )
ScRange aRange( aPos, aPos );
const ScAddress::Details aDetails( pConv->meConv, aPos );
ScAddress::ExternalInfo aExtInfo;
- sal_uInt16 nFlags = aRange.Parse( rName, pDoc, aDetails, &aExtInfo, &maExternalLinks );
- if( nFlags & SCA_VALID )
+ ScRefFlags nFlags = aRange.Parse( rName, pDoc, aDetails, &aExtInfo, &maExternalLinks );
+ if( nFlags & ScRefFlags::VALID )
{
ScComplexRefData aRef;
aRef.InitRange( aRange );
- aRef.Ref1.SetColRel( (nFlags & SCA_COL_ABSOLUTE) == 0 );
- aRef.Ref1.SetRowRel( (nFlags & SCA_ROW_ABSOLUTE) == 0 );
- aRef.Ref1.SetTabRel( (nFlags & SCA_TAB_ABSOLUTE) == 0 );
- if ( !(nFlags & SCA_VALID_TAB) )
+ aRef.Ref1.SetColRel( (nFlags & ScRefFlags::COL_ABS) == ScRefFlags::ZERO );
+ aRef.Ref1.SetRowRel( (nFlags & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO );
+ aRef.Ref1.SetTabRel( (nFlags & ScRefFlags::TAB_ABS) == ScRefFlags::ZERO );
+ if ( !(nFlags & ScRefFlags::TAB_VALID) )
aRef.Ref1.SetTabDeleted( true ); // #REF!
- aRef.Ref1.SetFlag3D( ( nFlags & SCA_TAB_3D ) != 0 );
- aRef.Ref2.SetColRel( (nFlags & SCA_COL2_ABSOLUTE) == 0 );
- aRef.Ref2.SetRowRel( (nFlags & SCA_ROW2_ABSOLUTE) == 0 );
- aRef.Ref2.SetTabRel( (nFlags & SCA_TAB2_ABSOLUTE) == 0 );
- if ( !(nFlags & SCA_VALID_TAB2) )
+ aRef.Ref1.SetFlag3D( ( nFlags & ScRefFlags::TAB_3D ) != ScRefFlags::ZERO );
+ aRef.Ref2.SetColRel( (nFlags & ScRefFlags::COL2_ABS) == ScRefFlags::ZERO );
+ aRef.Ref2.SetRowRel( (nFlags & ScRefFlags::ROW2_ABS) == ScRefFlags::ZERO );
+ aRef.Ref2.SetTabRel( (nFlags & ScRefFlags::TAB2_ABS) == ScRefFlags::ZERO );
+ if ( !(nFlags & ScRefFlags::TAB2_VALID) )
aRef.Ref2.SetTabDeleted( true ); // #REF!
- aRef.Ref2.SetFlag3D( ( nFlags & SCA_TAB2_3D ) != 0 );
+ aRef.Ref2.SetFlag3D( ( nFlags & ScRefFlags::TAB2_3D ) != ScRefFlags::ZERO );
aRef.SetRange(aRange, aPos);
if (aExtInfo.mbExternal)
{
@@ -2887,7 +2887,7 @@ bool ScCompiler::IsDoubleReference( const OUString& rName )
}
}
- return ( nFlags & SCA_VALID ) != 0;
+ return ( nFlags & ScRefFlags::VALID ) != ScRefFlags::ZERO;
}
bool ScCompiler::IsSingleReference( const OUString& rName )
@@ -2895,27 +2895,27 @@ bool ScCompiler::IsSingleReference( const OUString& rName )
ScAddress aAddr( aPos );
const ScAddress::Details aDetails( pConv->meConv, aPos );
ScAddress::ExternalInfo aExtInfo;
- sal_uInt16 nFlags = aAddr.Parse( rName, pDoc, aDetails, &aExtInfo, &maExternalLinks );
+ ScRefFlags nFlags = aAddr.Parse( rName, pDoc, aDetails, &aExtInfo, &maExternalLinks );
// Something must be valid in order to recognize Sheet1.blah or blah.a1
// as a (wrong) reference.
- if( nFlags & ( SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB ) )
+ if( nFlags & ( ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID ) )
{
ScSingleRefData aRef;
aRef.InitAddress( aAddr );
- aRef.SetColRel( (nFlags & SCA_COL_ABSOLUTE) == 0 );
- aRef.SetRowRel( (nFlags & SCA_ROW_ABSOLUTE) == 0 );
- aRef.SetTabRel( (nFlags & SCA_TAB_ABSOLUTE) == 0 );
- aRef.SetFlag3D( ( nFlags & SCA_TAB_3D ) != 0 );
+ aRef.SetColRel( (nFlags & ScRefFlags::COL_ABS) == ScRefFlags::ZERO );
+ aRef.SetRowRel( (nFlags & ScRefFlags::ROW_ABS) == ScRefFlags::ZERO );
+ aRef.SetTabRel( (nFlags & ScRefFlags::TAB_ABS) == ScRefFlags::ZERO );
+ aRef.SetFlag3D( ( nFlags & ScRefFlags::TAB_3D ) != ScRefFlags::ZERO );
// the reference is really invalid
- if( !( nFlags & SCA_VALID ) )
+ if( !( nFlags & ScRefFlags::VALID ) )
{
- if( !( nFlags & SCA_VALID_COL ) )
+ if( !( nFlags & ScRefFlags::COL_VALID ) )
aRef.SetColDeleted(true);
- if( !( nFlags & SCA_VALID_ROW ) )
+ if( !( nFlags & ScRefFlags::ROW_VALID ) )
aRef.SetRowDeleted(true);
- if( !( nFlags & SCA_VALID_TAB ) )
+ if( !( nFlags & ScRefFlags::TAB_VALID ) )
aRef.SetTabDeleted(true);
- nFlags |= SCA_VALID;
+ nFlags |= ScRefFlags::VALID;
}
aRef.SetAddress(aAddr, aPos);
@@ -2931,7 +2931,7 @@ bool ScCompiler::IsSingleReference( const OUString& rName )
maRawToken.SetSingleReference(aRef);
}
- return ( nFlags & SCA_VALID ) != 0;
+ return ( nFlags & ScRefFlags::VALID ) != ScRefFlags::ZERO;
}
bool ScCompiler::IsReference( const OUString& rName )
@@ -3742,7 +3742,7 @@ void ScCompiler::AutoCorrectParsedSymbol()
bool bChanged = false;
bool bOk = true;
- sal_uInt16 nMask = SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW;
+ ScRefFlags nMask = ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID;
for ( int j=0; j<nRefs; j++ )
{
sal_Int32 nTmp = 0;
@@ -4716,7 +4716,7 @@ void ScCompiler::CreateStringFromSingleRef( OUStringBuffer& rBuffer, const Formu
ScAddress aAbs = rRef.toAbs(aPos);
const ScDBData* pData = pDoc->GetDBAtCursor( aAbs.Col(), aAbs.Row(), aAbs.Tab(), ScDBDataPortion::AREA);
SAL_WARN_IF( !pData, "sc.core", "ScCompiler::CreateStringFromSingleRef - TableRef without ScDBData: " <<
- aAbs.Format( SCA_VALID | SCA_TAB_3D, pDoc));
+ aAbs.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, pDoc));
if (pData)
aStr = pData->GetTableColumnName( aAbs.Col());
if (aStr.isEmpty())
@@ -4724,13 +4724,13 @@ void ScCompiler::CreateStringFromSingleRef( OUStringBuffer& rBuffer, const Formu
if (pData && pData->HasHeader())
{
SAL_WARN("sc.core", "ScCompiler::CreateStringFromSingleRef - TableRef falling back to cell: " <<
- aAbs.Format( SCA_VALID | SCA_TAB_3D, pDoc));
+ aAbs.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, pDoc));
aStr = pDoc->GetString(aAbs);
}
else
{
SAL_WARN("sc.core", "ScCompiler::CreateStringFromSingleRef - TableRef of empty header-less: " <<
- aAbs.Format( SCA_VALID | SCA_TAB_3D, pDoc));
+ aAbs.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, pDoc));
aStr = aErrRef;
}
}
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index e4e62aa902b0..70847d826fcb 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -86,7 +86,7 @@ FormulaGroupAreaListener::FormulaGroupAreaListener( const ScRange& rRange, const
assert(mpColumn);
SAL_INFO( "sc.core.grouparealistener",
"FormulaGroupAreaListener ctor this " << this <<
- " range " << (maRange == BCA_LISTEN_ALWAYS ? "LISTEN-ALWAYS" : maRange.Format(SCA_VALID)) <<
+ " range " << (maRange == BCA_LISTEN_ALWAYS ? "LISTEN-ALWAYS" : maRange.Format(ScRefFlags::VALID)) <<
" mnTopCellRow " << mnTopCellRow << " length " << mnGroupLen <<
", col/tab " << mpColumn->GetCol() << "/" << mpColumn->GetTab());
}
@@ -183,7 +183,7 @@ void FormulaGroupAreaListener::collectFormulaCells(
{
SAL_INFO( "sc.core.grouparealistener",
"FormulaGroupAreaListener::collectFormulaCells() this " << this <<
- " range " << (maRange == BCA_LISTEN_ALWAYS ? "LISTEN-ALWAYS" : maRange.Format(SCA_VALID)) <<
+ " range " << (maRange == BCA_LISTEN_ALWAYS ? "LISTEN-ALWAYS" : maRange.Format(ScRefFlags::VALID)) <<
" mnTopCellRow " << mnTopCellRow << " length " << mnGroupLen <<
", col/tab " << mpColumn->GetCol() << "/" << mpColumn->GetTab());
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 8d2636f0ccb9..fe973d3dee39 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2151,7 +2151,7 @@ void ScInterpreter::ScCell()
}
else if( aInfoType == "ADDRESS" )
{ // address formatted as [['FILENAME'#]$TABLE.]$COL$ROW
- sal_uInt16 nFlags = (aCellPos.Tab() == aPos.Tab()) ? (SCA_ABS) : (SCA_ABS_3D);
+ ScRefFlags nFlags = (aCellPos.Tab() == aPos.Tab()) ? (ScRefFlags::ADDR_ABS) : (ScRefFlags::ADDR_ABS_3D);
OUString aStr(aCellPos.Format(nFlags, pDok, pDok->GetAddressConvention()));
PushString(aStr);
}
@@ -2188,10 +2188,10 @@ void ScInterpreter::ScCell()
OUStringBuffer aFuncResult;
OUString aCellStr =
ScAddress( static_cast<SCCOL>(aCellPos.Tab()), 0, 0 ).Format(
- (SCA_COL_ABSOLUTE|SCA_VALID_COL), nullptr, pDok->GetAddressConvention() );
+ (ScRefFlags::COL_ABS|ScRefFlags::COL_VALID), nullptr, pDok->GetAddressConvention() );
aFuncResult.append(aCellStr);
aFuncResult.append(':');
- aCellStr = aCellPos.Format((SCA_COL_ABSOLUTE|SCA_VALID_COL|SCA_ROW_ABSOLUTE|SCA_VALID_ROW),
+ aCellStr = aCellPos.Format((ScRefFlags::COL_ABS|ScRefFlags::COL_VALID|ScRefFlags::ROW_ABS|ScRefFlags::ROW_VALID),
nullptr, pDok->GetAddressConvention());
aFuncResult.append(aCellStr);
PushString( aFuncResult.makeStringAndClear() );
@@ -7236,7 +7236,7 @@ void ScInterpreter::ScAddressFunc()
if( nParamCount >= 4 && 0.0 == ::rtl::math::approxFloor( GetDoubleWithDefault( 1.0)))
eConv = FormulaGrammar::CONV_XL_R1C1;
- sal_uInt16 nFlags = SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE; // default
+ ScRefFlags nFlags = ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS; // default
if( nParamCount >= 3 )
{
sal_uInt16 n = (sal_uInt16) ::rtl::math::approxFloor( GetDoubleWithDefault( 1.0));
@@ -7249,14 +7249,14 @@ void ScInterpreter::ScAddressFunc()
case 5:
case 1 : break; // default
case 6:
- case 2 : nFlags = SCA_ROW_ABSOLUTE; break;
+ case 2 : nFlags = ScRefFlags::ROW_ABS; break;
case 7:
- case 3 : nFlags = SCA_COL_ABSOLUTE; break;
+ case 3 : nFlags = ScRefFlags::COL_ABS; break;
case 8:
- case 4 : nFlags = 0; break; // both relative
+ case 4 : nFlags = ScRefFlags::ZERO; break; // both relative
}
}
- nFlags |= SCA_VALID | SCA_VALID_ROW | SCA_VALID_COL;
+ nFlags |= ScRefFlags::VALID | ScRefFlags::ROW_VALID | ScRefFlags::COL_VALID;
SCCOL nCol = (SCCOL) ::rtl::math::approxFloor(GetDouble());
SCROW nRow = (SCROW) ::rtl::math::approxFloor(GetDouble());
@@ -7264,9 +7264,9 @@ void ScInterpreter::ScAddressFunc()
{
// YUCK! The XL interface actually treats rel R1C1 refs differently
// than A1
- if( !(nFlags & SCA_COL_ABSOLUTE) )
+ if( !(nFlags & ScRefFlags::COL_ABS) )
nCol += aPos.Col() + 1;
- if( !(nFlags & SCA_ROW_ABSOLUTE) )
+ if( !(nFlags & ScRefFlags::ROW_ABS) )
nRow += aPos.Row() + 1;
}
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 97edca29dc3d..924bd0b86ffa 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -115,7 +115,7 @@ private:
class FormatString : public ::std::unary_function<const ScRange*, void>
{
public:
- FormatString(OUString& rStr, sal_uInt16 nFlags, ScDocument* pDoc, FormulaGrammar::AddressConvention eConv, sal_Unicode cDelim) :
+ FormatString(OUString& rStr, ScRefFlags nFlags, ScDocument* pDoc, FormulaGrammar::AddressConvention eConv, sal_Unicode cDelim) :
mrStr(rStr),
mnFlags(nFlags),
mpDoc(pDoc),
@@ -142,7 +142,7 @@ public:
}
private:
OUString& mrStr;
- sal_uInt16 mnFlags;
+ ScRefFlags mnFlags;
ScDocument* mpDoc;
FormulaGrammar::AddressConvention meConv;
sal_Unicode mcDelim;
@@ -157,7 +157,7 @@ ScRangeList::~ScRangeList()
RemoveAll();
}
-sal_uInt16 ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, sal_uInt16 nMask,
+ScRefFlags ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, ScRefFlags nMask,
formula::FormulaGrammar::AddressConvention eConv,
SCTAB nDefaultTab, sal_Unicode cDelimiter )
{
@@ -166,8 +166,8 @@ sal_uInt16 ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, sal_uInt1
if (!cDelimiter)
cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep);
- nMask |= SCA_VALID; // falls das jemand vergessen sollte
- sal_uInt16 nResult = (sal_uInt16)~0; // alle Bits setzen
+ nMask |= ScRefFlags::VALID; // falls das jemand vergessen sollte
+ ScRefFlags nResult = ~ScRefFlags::ZERO; // alle Bits setzen
ScRange aRange;
const SCTAB nTab = pDoc ? nDefaultTab : 0;
@@ -176,15 +176,15 @@ sal_uInt16 ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, sal_uInt1
{
const OUString aOne = rStr.getToken( 0, cDelimiter, nPos );
aRange.aStart.SetTab( nTab ); // Default Tab wenn nicht angegeben
- sal_uInt16 nRes = aRange.ParseAny( aOne, pDoc, eConv );
- sal_uInt16 nEndRangeBits = SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2;
- sal_uInt16 nTmp1 = ( nRes & SCA_BITS );
- sal_uInt16 nTmp2 = ( nRes & nEndRangeBits );
+ ScRefFlags nRes = aRange.ParseAny( aOne, pDoc, eConv );
+ ScRefFlags nEndRangeBits = ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID;
+ ScRefFlags nTmp1 = ( nRes & ScRefFlags::BITS );
+ ScRefFlags nTmp2 = ( nRes & nEndRangeBits );
// If we have a valid single range with
// any of the address bits we are interested in
// set - set the equiv end range bits
- if ( (nRes & SCA_VALID ) && nTmp1 && ( nTmp2 != nEndRangeBits ) )
- nRes |= ( nTmp1 << 4 );
+ if ( (nRes & ScRefFlags::VALID ) && (nTmp1 != ScRefFlags::ZERO) && ( nTmp2 != nEndRangeBits ) )
+ applyStartToEndFlags(nRes, nTmp1);
if ( (nRes & nMask) == nMask )
Append( aRange );
@@ -192,13 +192,13 @@ sal_uInt16 ScRangeList::Parse( const OUString& rStr, ScDocument* pDoc, sal_uInt1
}
while (nPos >= 0);
- return nResult; // SCA_VALID gesetzt wenn alle ok
+ return nResult; // ScRefFlags::VALID gesetzt wenn alle ok
}
else
- return 0;
+ return ScRefFlags::ZERO;
}
-void ScRangeList::Format( OUString& rStr, sal_uInt16 nFlags, ScDocument* pDoc,
+void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, ScDocument* pDoc,
formula::FormulaGrammar::AddressConvention eConv,
sal_Unicode cDelimiter ) const
{
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index ba3e594b6418..cc438f626471 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -463,7 +463,7 @@ void ScRangeData::MakeValidName( OUString& rName )
ScAddress::Details details( static_cast<FormulaGrammar::AddressConvention>( nConv ) );
// Don't check Parse on VALID, any partial only VALID may result in
// #REF! during compile later!
- while (aRange.Parse( rName, nullptr, details) || aAddr.Parse( rName, nullptr, details))
+ while ( (bool)aRange.Parse( rName, nullptr, details) || (bool)aAddr.Parse( rName, nullptr, details ) )
{
// Range Parse is partially valid also with invalid sheet name,
// Address Parse dito, during compile name would generate a #REF!
@@ -498,7 +498,7 @@ bool ScRangeData::IsNameValid( const OUString& rName, ScDocument* pDoc )
ScAddress::Details details( static_cast<FormulaGrammar::AddressConvention>( nConv ) );
// Don't check Parse on VALID, any partial only VALID may result in
// #REF! during compile later!
- if (aRange.Parse( rName, pDoc, details) || aAddr.Parse( rName, pDoc, details))
+ if ( (bool)aRange.Parse( rName, pDoc, details) || (bool)aAddr.Parse( rName, pDoc, details) )
return false;
}
return true;
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 93c8da31032a..22d803b92d48 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -448,11 +448,11 @@ bool ScRangeStringConverter::GetAddressFromString(
GetTokenByOffset( sToken, rAddressStr, nOffset, cSeparator, cQuote );
if( nOffset >= 0 )
{
- if ((rAddress.Parse( sToken, const_cast<ScDocument*>(pDocument), eConv ) & SCA_VALID) == SCA_VALID)
+ if ((rAddress.Parse( sToken, const_cast<ScDocument*>(pDocument), eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
return true;
::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
if (eConv != eConvUI)
- return ((rAddress.Parse(sToken, const_cast<ScDocument*>(pDocument), eConvUI) & SCA_VALID) == SCA_VALID);
+ return ((rAddress.Parse(sToken, const_cast<ScDocument*>(pDocument), eConvUI) & ScRefFlags::VALID) == ScRefFlags::VALID);
}
return false;
}
@@ -478,11 +478,12 @@ bool ScRangeStringConverter::GetRangeFromString(
{
if ( aUIString[0] == '.' )
aUIString = aUIString.copy( 1 );
- bResult = ((rRange.aStart.Parse( aUIString, const_cast<ScDocument*> (pDocument), eConv) & SCA_VALID) == SCA_VALID);
+ bResult = (rRange.aStart.Parse( aUIString, const_cast<ScDocument*> (pDocument), eConv) & ScRefFlags::VALID) ==
+ ScRefFlags::VALID;
::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
if (!bResult && eConv != eConvUI)
- bResult = ((rRange.aStart.Parse(
- aUIString, const_cast<ScDocument*>(pDocument), eConvUI) & SCA_VALID) == SCA_VALID);
+ bResult = (rRange.aStart.Parse(aUIString, const_cast<ScDocument*>(pDocument), eConvUI) & ScRefFlags::VALID) ==
+ ScRefFlags::VALID;
rRange.aEnd = rRange.aStart;
}
else
@@ -497,24 +498,27 @@ bool ScRangeStringConverter::GetRangeFromString(
aUIString[ nIndex + 1 ] == '.' )
aUIString = aUIString.replaceAt( nIndex + 1, 1, "" );
- bResult = ((rRange.Parse(aUIString, const_cast<ScDocument*> (pDocument), eConv) & SCA_VALID) == SCA_VALID);
+ bResult = ((rRange.Parse(aUIString, const_cast<ScDocument*> (pDocument), eConv) & ScRefFlags::VALID) ==
+ ScRefFlags::VALID);
// #i77703# chart ranges in the file format contain both sheet names, even for an external reference sheet.
// This isn't parsed by ScRange, so try to parse the two Addresses then.
if (!bResult)
{
- bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument),
- eConv) & SCA_VALID) == SCA_VALID) &&
- ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument),
- eConv) & SCA_VALID) == SCA_VALID);
+ bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument), eConv)
+ & ScRefFlags::VALID) == ScRefFlags::VALID)
+ &&
+ ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument), eConv)
+ & ScRefFlags::VALID) == ScRefFlags::VALID);
::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
if (!bResult && eConv != eConvUI)
{
- bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument),
- eConvUI) & SCA_VALID) == SCA_VALID) &&
- ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument),
- eConvUI) & SCA_VALID) == SCA_VALID);
+ bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument), eConvUI)
+ & ScRefFlags::VALID) == ScRefFlags::VALID)
+ &&
+ ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument), eConvUI)
+ & ScRefFlags::VALID) == ScRefFlags::VALID);
}
}
}
@@ -618,7 +622,7 @@ void ScRangeStringConverter::GetStringFromAddress(
FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator,
bool bAppendStr,
- sal_uInt16 nFormatFlags )
+ ScRefFlags nFormatFlags )
{
if (pDocument && pDocument->HasTable(rAddress.Tab()))
{
@@ -634,7 +638,7 @@ void ScRangeStringConverter::GetStringFromRange(
FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator,
bool bAppendStr,
- sal_uInt16 nFormatFlags )
+ ScRefFlags nFormatFlags )
{
if (pDocument && pDocument->HasTable(rRange.aStart.Tab()))
{
@@ -674,7 +678,7 @@ void ScRangeStringConverter::GetStringFromArea(
FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator,
bool bAppendStr,
- sal_uInt16 nFormatFlags )
+ ScRefFlags nFormatFlags )
{
ScRange aRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, rArea.nColEnd, rArea.nRowEnd, rArea.nTab );
GetStringFromRange( rString, aRange, pDocument, eConv, cSeparator, bAppendStr, nFormatFlags );
@@ -699,7 +703,7 @@ void ScRangeStringConverter::GetStringFromRange(
FormulaGrammar::AddressConvention eConv,
sal_Unicode cSeparator,
bool bAppendStr,
- sal_uInt16 nFormatFlags )
+ ScRefFlags nFormatFlags )
{
ScRange aScRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), rRange.Sheet,
static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), rRange.Sheet );
@@ -743,12 +747,12 @@ static void lcl_appendCellAddress(
ScRangeStringConverter::AppendTableName(rBuf, rExtInfo.maTabName);
rBuf.append('.');
- OUString aAddr(rCell.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention()));
+ OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention()));
rBuf.append(aAddr);
}
else
{
- OUString aAddr(rCell.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
rBuf.append(aAddr);
}
}
@@ -776,7 +780,7 @@ static void lcl_appendCellRangeAddress(
ScRangeStringConverter::AppendTableName(rBuf, rExtInfo1.maTabName);
rBuf.append('.');
- OUString aAddr(rCell1.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention()));
+ OUString aAddr(rCell1.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention()));
rBuf.append(aAddr);
rBuf.append(":");
@@ -788,7 +792,7 @@ static void lcl_appendCellRangeAddress(
rBuf.append('.');
}
- aAddr = rCell2.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention());
+ aAddr = rCell2.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention());
rBuf.append(aAddr);
}
else
@@ -796,7 +800,7 @@ static void lcl_appendCellRangeAddress(
ScRange aRange;
aRange.aStart = rCell1;
aRange.aEnd = rCell2;
- OUString aAddr(aRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aAddr(aRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
rBuf.append(aAddr);
}
}
@@ -852,28 +856,28 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
ScAddress::ExternalInfo aExtInfo1, aExtInfo2;
ScAddress aCell1, aCell2;
- sal_uInt16 nRet = aCell1.Parse(aBeginCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ ScRefFlags nRet = aCell1.Parse(aBeginCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
{
// first cell is invalid.
if (eConv == FormulaGrammar::CONV_OOO)
continue;
nRet = aCell1.Parse(aBeginCell, pDoc, eConv, &aExtInfo1);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
// first cell is really invalid.
continue;
}
nRet = aCell2.Parse(aEndCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo2);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
{
// second cell is invalid.
if (eConv == FormulaGrammar::CONV_OOO)
continue;
nRet = aCell2.Parse(aEndCell, pDoc, eConv, &aExtInfo2);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
// second cell is really invalid.
continue;
}
@@ -896,11 +900,11 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
// Chart always saves ranges using CONV_OOO convention.
ScAddress::ExternalInfo aExtInfo;
ScAddress aCell;
- sal_uInt16 nRet = aCell.Parse(aToken, pDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ ScRefFlags nRet = aCell.Parse(aToken, pDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO )
{
nRet = aCell.Parse(aToken, pDoc, eConv, &aExtInfo);
- if ((nRet & SCA_VALID) != SCA_VALID)
+ if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
continue;
}
diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index b1883232bc07..463100359dfc 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -215,15 +215,16 @@ ScRefFinder::~ScRefFinder()
{
}
-static sal_uInt16 lcl_NextFlags( sal_uInt16 nOld )
+static ScRefFlags lcl_NextFlags( ScRefFlags nOld )
{
- sal_uInt16 nNew = nOld & 7; // die drei Abs-Flags
- nNew = ( nNew - 1 ) & 7; // weiterzaehlen
+ const ScRefFlags Mask_ABS = (ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS | ScRefFlags::TAB_ABS);
+ ScRefFlags nNew = nOld & Mask_ABS;
+ nNew = ScRefFlags( (std::underlying_type<ScRefFlags>::type)(nNew) - 1 ) & Mask_ABS; // weiterzaehlen
- if (!(nOld & SCA_TAB_3D))
- nNew &= ~SCA_TAB_ABSOLUTE; // not 3D -> never absolute!
+ if (!(nOld & ScRefFlags::TAB_3D))
+ nNew &= ~ScRefFlags::TAB_ABS; // not 3D -> never absolute!
- return ( nOld & 0xfff8 ) | nNew;
+ return (nOld & ~Mask_ABS) | nNew;
}
void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
@@ -264,10 +265,10 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
// Check the validity of the expression, and toggle the relative flag.
ScAddress::Details aDetails(meConv, maPos.Row(), maPos.Col());
ScAddress::ExternalInfo aExtInfo;
- sal_uInt16 nResult = aAddr.Parse(aExpr, mpDoc, aDetails, &aExtInfo);
- if ( nResult & SCA_VALID )
+ ScRefFlags nResult = aAddr.Parse(aExpr, mpDoc, aDetails, &aExtInfo);
+ if ( nResult & ScRefFlags::VALID )
{
- sal_uInt16 nFlags = lcl_NextFlags( nResult );
+ ScRefFlags nFlags;
if( aExtInfo.mbExternal )
{ // retain external doc name and tab name before toggle relative flag
sal_Int32 nSep;
@@ -283,11 +284,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
nSep = aExpr.lastIndexOf('.');
break;
}
- if (nSep < 0)
- {
- assert(!"Invalid syntax according to address convention.");
- }
- else
+ if (nSep >= 0)
{
OUString aRef = aExpr.copy(nSep+1);
OUString aExtDocNameTabName = aExpr.copy(0, nSep+1);
@@ -296,9 +293,14 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
nFlags = lcl_NextFlags( nResult );
aExpr = aExtDocNameTabName + aAddr.Format(nFlags, mpDoc, aDetails);
}
+ else
+ {
+ assert(!"Invalid syntax according to address convention.");
+ }
}
else
{
+ nFlags = lcl_NextFlags( nResult );
aExpr = aAddr.Format(nFlags, mpDoc, aDetails);
}
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index b6921a07ff73..71a380932ab2 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1226,7 +1226,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
else if(pFormatEntry->GetType() == condformat::DATE)
maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
}
- aScRanges.Format( msSeqRef, SCA_VALID, nullptr, formula::FormulaGrammar::CONV_XL_A1 );
+ aScRanges.Format( msSeqRef, ScRefFlags::VALID, nullptr, formula::FormulaGrammar::CONV_XL_A1 );
if(!aExtEntries.empty() && xExtLst.get())
{
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 8ebe8117c4c1..d49055578d64 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -369,7 +369,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo
XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) );
xName->SetTokenArray( xTokArr );
xName->SetLocalTab( aRange.aStart.Tab() );
- OUString sSymbol(aRange.Format(SCR_ABS_3D, &GetDocRef(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1)));
+ OUString sSymbol(aRange.Format(ScRefFlags::RANGE_ABS_3D, &GetDocRef(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1)));
xName->SetSymbol( sSymbol );
return Append( xName );
}
@@ -380,7 +380,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo
xName->SetTokenArray( xTokArr );
xName->SetLocalTab( nScTab );
OUString sSymbol;
- rRangeList.Format( sSymbol, SCR_ABS_3D, &GetDocRef(), ::formula::FormulaGrammar::CONV_XL_A1 );
+ rRangeList.Format( sSymbol, ScRefFlags::RANGE_ABS_3D, &GetDocRef(), ::formula::FormulaGrammar::CONV_XL_A1 );
xName->SetSymbol( sSymbol );
return Append( xName );
}
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index ae9857b784ee..aef122dbe380 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -715,7 +715,7 @@ OString XclXmlUtils::ToOString( const OUString& s )
OStringBuffer& XclXmlUtils::ToOString( OStringBuffer& s, const ScAddress& rAddress )
{
- rAddress.Format(s, SCA_VALID, nullptr, ScAddress::Details( FormulaGrammar::CONV_XL_A1));
+ rAddress.Format(s, ScRefFlags::VALID, nullptr, ScAddress::Details( FormulaGrammar::CONV_XL_A1));
return s;
}
@@ -732,14 +732,14 @@ OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer )
OString XclXmlUtils::ToOString( const ScRange& rRange )
{
- OUString sRange(rRange.Format(SCA_VALID, nullptr, ScAddress::Details( FormulaGrammar::CONV_XL_A1)));
+ OUString sRange(rRange.Format(ScRefFlags::VALID, nullptr, ScAddress::Details( FormulaGrammar::CONV_XL_A1)));
return ToOString( sRange );
}
OString XclXmlUtils::ToOString( const ScRangeList& rRangeList )
{
OUString s;
- rRangeList.Format(s, SCA_VALID, nullptr, FormulaGrammar::CONV_XL_A1, ' ');
+ rRangeList.Format(s, ScRefFlags::VALID, nullptr, FormulaGrammar::CONV_XL_A1, ' ');
return ToOString( s );
}
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 9cf9841a3adf..69ecaa668879 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -344,8 +344,8 @@ OUString XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm )
if (nSepPos < xTextMark->getLength() - 1)
{
ScRange aRange;
- if ((aRange.ParseAny( xTextMark->copy( nSepPos + 1 ), nullptr,
- formula::FormulaGrammar::CONV_XL_R1C1) & SCA_VALID) != SCA_VALID)
+ if ((aRange.ParseAny( xTextMark->copy( nSepPos + 1 ), nullptr, formula::FormulaGrammar::CONV_XL_R1C1)
+ & ScRefFlags::VALID) == ScRefFlags::ZERO)
xTextMark.reset( new OUString( xTextMark->replaceAt( nSepPos, 1, OUString( '.' ))));
}
}
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 7b7ec4bc3563..96e68a1d3c15 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -476,8 +476,8 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl,
return false;
ScRange aRange;
- sal_uInt16 nRes = aRange.ParseAny(aRangeStr, &rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
- if ((nRes & SCA_VALID) != SCA_VALID)
+ ScRefFlags nRes = aRange.ParseAny(aRangeStr, &rDoc, formula::FormulaGrammar::CONV_XL_R1C1);
+ if ((nRes & ScRefFlags::VALID) == ScRefFlags::ZERO)
return false;
if (aRange.aStart.Tab() != aRange.aEnd.Tab())
diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx
index 8104f367ead7..8a5ef92a0299 100644
--- a/sc/source/filter/oox/worksheetbuffer.cxx
+++ b/sc/source/filter/oox/worksheetbuffer.cxx
@@ -129,7 +129,7 @@ void WorksheetBuffer::convertSheetNameRef( OUString& sSheetNameRef ) const
{
ScRange aRange;
if ((aRange.ParseAny( sSheetNameRef.copy( nSepPos + 1 ), nullptr,
- formula::FormulaGrammar::CONV_XL_R1C1) & SCA_VALID) != SCA_VALID)
+ formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO)
sSheetNameRef = sSheetNameRef.replaceAt( nSepPos, 1, OUString( '.' ) );
}
// #i66592# convert sheet names that have been renamed on import
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 1f8b670bc251..fa0efef957ab 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1029,7 +1029,8 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c
{
ScRange aRange;
if ((aRange.ParseAny( aUrl.copy( nSepPos + 1 ), nullptr,
- formula::FormulaGrammar::CONV_XL_R1C1) & SCA_VALID) != SCA_VALID)
+ formula::FormulaGrammar::CONV_XL_R1C1)
+ & ScRefFlags::VALID) == ScRefFlags::ZERO)
aUrl = aUrl.replaceAt( nSepPos, 1, OUString( '.' ) );
}
// #i66592# convert sheet names that have been renamed on import
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 43a355a4db3c..19a6e0eadcb8 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1050,44 +1050,44 @@ GetEditAs( XclObjAny& rObj )
namespace {
-sal_uInt16 parseRange(const OUString& rString, ScRange& rRange, ScDocument* pDoc)
+ScRefFlags parseRange(const OUString& rString, ScRange& rRange, ScDocument* pDoc)
{
// start with the address convention set in the document
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- sal_uInt16 nResult = rRange.Parse(rString, pDoc, eConv);
- if ( (nResult & SCA_VALID) )
+ ScRefFlags nResult = rRange.Parse(rString, pDoc, eConv);
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the default calc address convention
nResult = rRange.Parse(rString, pDoc);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try excel a1
nResult = rRange.Parse(rString, pDoc, formula::FormulaGrammar::CONV_XL_A1);
- if (nResult & SCA_VALID)
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try r1c1
return rRange.Parse(rString, pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
}
-sal_uInt16 parseAddress(const OUString& rString, ScAddress& rAddress, ScDocument* pDoc)
+ScRefFlags parseAddress(const OUString& rString, ScAddress& rAddress, ScDocument* pDoc)
{
// start with the address convention set in the document
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- sal_uInt16 nResult = rAddress.Parse(rString, pDoc, eConv);
- if ( (nResult & SCA_VALID) )
+ ScRefFlags nResult = rAddress.Parse(rString, pDoc, eConv);
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the default calc address convention
nResult = rAddress.Parse(rString, pDoc);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try excel a1
nResult = rAddress.Parse(rString, pDoc, formula::FormulaGrammar::CONV_XL_A1);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try r1c1
@@ -1105,8 +1105,8 @@ bool transformURL(const OUString& rOldURL, OUString& rNewURL, ScDocument* pDoc)
ScRange aRange;
ScAddress aAddress;
- sal_uInt16 nResult = parseRange(aAddressString, aRange, pDoc);
- if (nResult & SCA_VALID)
+ ScRefFlags nResult = parseRange(aAddressString, aRange, pDoc);
+ if ( nResult & ScRefFlags::VALID )
{
OUString aString = aRange.Format(nResult, pDoc, formula::FormulaGrammar::CONV_XL_OOX);
rNewURL = "#" + aString;
@@ -1115,7 +1115,7 @@ bool transformURL(const OUString& rOldURL, OUString& rNewURL, ScDocument* pDoc)
else
{
nResult = parseAddress(aAddressString, aAddress, pDoc);
- if(nResult & SCA_VALID)
+ if( nResult & ScRefFlags::VALID )
{
OUString aString = aAddress.Format(nResult, pDoc, formula::FormulaGrammar::CONV_XL_OOX);
rNewURL = "#" + aString;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 7bcfcdf10835..bf6686f9d3ea 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4026,7 +4026,7 @@ void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName)
OUString sBaseCellAddress;
it->second->ValidateTabRefs();
ScRangeStringConverter::GetStringFromAddress( sBaseCellAddress, it->second->GetPos(), pDoc,
- FormulaGrammar::CONV_OOO, ' ', false, SCA_ABS_3D);
+ FormulaGrammar::CONV_OOO, ' ', false, ScRefFlags::ADDR_ABS_3D);
AddAttribute(XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, sBaseCellAddress);
OUString sSymbol;
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 65e9a547e366..3c3a218d3936 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -219,7 +219,7 @@ OUString SAL_CALL
{
// Document not needed, because only the cell address, but not the tablename is needed
// always us OOO notation
- return maCellAddress.Format(SCA_VALID);
+ return maCellAddress.Format(ScRefFlags::VALID);
}
//===== XAccessibleValue ================================================
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index c875a817ee2f..e05f66324e54 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2296,7 +2296,7 @@ OUString ScAccessibleDocument::GetCurrentCellName() const
if (mpViewShell)
{
// Document not needed, because only the cell address, but not the tablename is needed
- OUString sAddress(mpViewShell->GetViewData().GetCurPos().Format(SCA_VALID));
+ OUString sAddress(mpViewShell->GetViewData().GetCurPos().Format(ScRefFlags::VALID));
sName = sName.replaceFirst("%1", sAddress);
}
return sName;
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 15a784e64058..aa4467ced8c9 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -172,7 +172,7 @@ sal_Int32 ScNotesChildren::AddNotes(const ScPreviewLocationData& rData, const Re
if (bMark)
{
// Document not needed, because only the cell address, but not the tablename is needed
- aNote.maNoteText = aNote.maNoteCell.Format(SCA_VALID);
+ aNote.maNoteText = aNote.maNoteCell.Format(ScRefFlags::VALID);
}
else
{
@@ -344,7 +344,7 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData,
if (bMark)
{
// Document not needed, because only the cell address, but not the tablename is needed
- aNote.maNoteText = aNote.maNoteCell.Format(SCA_VALID);
+ aNote.maNoteText = aNote.maNoteCell.Format(ScRefFlags::VALID);
}
else
{
diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index e6329bc5d5bc..84ed14c80f64 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -68,7 +68,7 @@ OUString lclCreateMultiParameterFormula(
OUString aResult;
for (size_t i = 0; i < aRangeList.size(); i++)
{
- OUString aRangeString(aRangeList[i]->Format(SCR_ABS, pDocument, aAddressDetails));
+ OUString aRangeString(aRangeList[i]->Format(ScRefFlags::RANGE_ABS, pDocument, aAddressDetails));
OUString aFormulaString = aFormulaTemplate.replaceAll(aWildcard, aRangeString);
aResult += aFormulaString;
if(i != aRangeList.size() - 1) // Not Last
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 83b1cedf035f..e1e07f456697 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -136,7 +136,7 @@ void ScRandomNumberGeneratorDialog::Init()
void ScRandomNumberGeneratorDialog::GetRangeFromSelection()
{
mpViewData->GetSimpleArea(maInputRange);
- OUString aCurrentString(maInputRange.Format(SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
+ OUString aCurrentString(maInputRange.Format(ScRefFlags::RANGE_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
mpInputRangeEdit->SetText( aCurrentString );
}
@@ -169,7 +169,7 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange
maInputRange = rReferenceRange;
- OUString aReferenceString(maInputRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aReferenceString(maInputRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
mpInputRangeEdit->SetRefString( aReferenceString );
mpButtonApply->Enable();
diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 4a03c7ec1775..6f9b95a47618 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -122,7 +122,7 @@ void ScSamplingDialog::Init()
void ScSamplingDialog::GetRangeFromSelection()
{
mViewData->GetSimpleArea(mInputRange);
- OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails));
+ OUString aCurrentString(mInputRange.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails));
mpInputRangeEdit->SetText(aCurrentString);
}
@@ -158,14 +158,16 @@ void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument*
if ( mpActiveEdit == mpInputRangeEdit )
{
mInputRange = rReferenceRange;
- aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mInputRange.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpInputRangeEdit->SetRefString( aReferenceString );
}
else if ( mpActiveEdit == mpOutputRangeEdit )
{
mOutputAddress = rReferenceRange.aStart;
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
@@ -370,7 +372,9 @@ IMPL_LINK_NOARG_TYPED(ScSamplingDialog, RefInputModifyHandler, Edit&, void)
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
index 02a3e717be86..0ca3a93e242d 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
@@ -141,7 +141,7 @@ void ScStatisticsInputOutputDialog::Init()
void ScStatisticsInputOutputDialog::GetRangeFromSelection()
{
mViewData->GetSimpleArea(mInputRange);
- OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails));
+ OUString aCurrentString(mInputRange.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails));
mpInputRangeEdit->SetText(aCurrentString);
}
@@ -172,14 +172,16 @@ void ScStatisticsInputOutputDialog::SetReference( const ScRange& rReferenceRange
if ( mpActiveEdit == mpInputRangeEdit )
{
mInputRange = rReferenceRange;
- aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mInputRange.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpInputRangeEdit->SetRefString( aReferenceString );
}
else if ( mpActiveEdit == mpOutputRangeEdit )
{
mOutputAddress = rReferenceRange.aStart;
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
@@ -256,7 +258,9 @@ IMPL_LINK_NOARG_TYPED( ScStatisticsInputOutputDialog, RefInputModifyHandler, Edi
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
index df6dc0117615..3d99a1f7ef0d 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
@@ -136,18 +136,18 @@ void ScStatisticsTwoVariableDialog::GetRangeFromSelection()
{
mVariable1Range = aCurrentRange;
mVariable1Range.aEnd.SetCol(mVariable1Range.aStart.Col());
- aCurrentString = mVariable1Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable1RangeEdit->SetText(aCurrentString);
mVariable2Range = aCurrentRange;
mVariable2Range.aStart.SetCol(mVariable2Range.aEnd.Col());
- aCurrentString = mVariable2Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable2RangeEdit->SetText(aCurrentString);
}
else
{
mVariable1Range = aCurrentRange;
- aCurrentString = mVariable1Range.Format(SCR_ABS_3D, mDocument, mAddressDetails);
+ aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails);
mpVariable1RangeEdit->SetText(aCurrentString);
}
}
@@ -179,20 +179,22 @@ void ScStatisticsTwoVariableDialog::SetReference( const ScRange& rReferenceRange
if ( mpActiveEdit == mpVariable1RangeEdit )
{
mVariable1Range = rReferenceRange;
- aReferenceString = mVariable1Range.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpVariable1RangeEdit->SetRefString(aReferenceString);
}
else if ( mpActiveEdit == mpVariable2RangeEdit )
{
mVariable2Range = rReferenceRange;
- aReferenceString = mVariable2Range.Format(SCR_ABS_3D, pDocument, mAddressDetails);
+ aReferenceString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails);
mpVariable2RangeEdit->SetRefString(aReferenceString);
}
else if ( mpActiveEdit == mpOutputRangeEdit )
{
mOutputAddress = rReferenceRange.aStart;
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
@@ -295,7 +297,9 @@ IMPL_LINK_NOARG_TYPED( ScStatisticsTwoVariableDialog, RefInputModifyHandler, Edi
// Crop output range to top left address for Edit field.
if (pRange->aStart != pRange->aEnd)
{
- sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
+ ScRefFlags::ADDR_ABS :
+ ScRefFlags::ADDR_ABS_3D;
OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention());
mpOutputRangeEdit->SetRefString( aReferenceString );
}
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index 982249c3553a..96c004061ee9 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -61,7 +61,7 @@ void FormulaTemplate::autoReplaceAddress(const OUString& aVariable, ScAddress aA
void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D)
{
- sal_uInt16 nFlag = b3D ? SCR_ABS_3D : SCR_ABS;
+ ScRefFlags nFlag = b3D ? ScRefFlags::RANGE_ABS_3D : ScRefFlags::RANGE_ABS;
OUString aString = aRange.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}
@@ -69,13 +69,13 @@ void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRang
void FormulaTemplate::applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList)
{
OUString aString;
- aRangeList.Format(aString, SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
+ aRangeList.Format(aString, ScRefFlags::RANGE_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}
void FormulaTemplate::applyAddress(const OUString& aVariable, const ScAddress& aAddress, bool b3D)
{
- sal_uInt16 nFlag = b3D ? SCA_ABS_3D : SCA_ABS;
+ ScRefFlags nFlag = b3D ? ScRefFlags::ADDR_ABS_3D : ScRefFlags::ADDR_ABS;
OUString aString = aAddress.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
mTemplate = mTemplate.replaceAll(aVariable, aString);
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d71b4e02bf3d..5e0814b4b901 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -352,21 +352,22 @@ handle_r1c1:
{
OUString aTest = rFormula.copy( nStart, nPos-nStart );
const ScAddress::Details aAddrDetails( &rDoc, aCursorPos );
- sal_uInt16 nFlags = aRange.ParseAny( aTest, &rDoc, aAddrDetails );
- if ( nFlags & SCA_VALID )
+ ScRefFlags nFlags = aRange.ParseAny( aTest, &rDoc, aAddrDetails );
+ if ( nFlags & ScRefFlags::VALID )
{
// Set tables if not specified
- if ( (nFlags & SCA_TAB_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO)
aRange.aStart.SetTab( pActiveViewSh->GetViewData().GetTabNo() );
- if ( (nFlags & SCA_TAB2_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB2_3D) == ScRefFlags::ZERO)
aRange.aEnd.SetTab( aRange.aStart.Tab() );
- if ( ( nFlags & ( SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2 ) ) == 0 )
+ if ( ( nFlags & (ScRefFlags::COL2_VALID|ScRefFlags::ROW2_VALID|ScRefFlags::TAB2_VALID) ) ==
+ ScRefFlags::ZERO )
{
// #i73766# if a single ref was parsed, set the same "abs" flags for ref2,
// so Format doesn't output a double ref because of different flags.
- sal_uInt16 nAbsFlags = nFlags & ( SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE );
- nFlags |= nAbsFlags << 4;
+ ScRefFlags nAbsFlags = nFlags & (ScRefFlags::COL_ABS|ScRefFlags::ROW_ABS|ScRefFlags::TAB_ABS);
+ applyStartToEndFlags(nFlags, nAbsFlags);
}
if (!nCount)
@@ -1455,7 +1456,7 @@ static OUString lcl_Calculate( const OUString& rFormula, ScDocument* pDoc, const
}
ScRange aTestRange;
- if ( bColRowName || (aTestRange.Parse(rFormula) & SCA_VALID) )
+ if ( bColRowName || (aTestRange.Parse(rFormula) & ScRefFlags::VALID) )
aValue = aValue + " ...";
return aValue;
@@ -3049,7 +3050,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc )
// Reference to other document
OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab");
- OUString aTmp(rRef.Format(SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails)); // Always 3D
+ OUString aTmp(rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc, aAddrDetails)); // Always 3D
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
// #i75893# convert escaped URL of the document to something user friendly
@@ -3077,9 +3078,9 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc )
{
if ( rRef.aStart.Tab() != aCursorPos.Tab() ||
rRef.aStart.Tab() != rRef.aEnd.Tab() )
- aRefStr = rRef.Format(SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails);
+ aRefStr = rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc, aAddrDetails);
else
- aRefStr = rRef.Format(SCA_VALID, pDoc, aAddrDetails);
+ aRefStr = rRef.Format(ScRefFlags::VALID, pDoc, aAddrDetails);
}
if (pTableView || pTopView)
@@ -3653,17 +3654,17 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
if ( aPosStr.isEmpty() ) // Not a name -> format
{
- sal_uInt16 nFlags = 0;
+ ScRefFlags nFlags = ScRefFlags::ZERO;
if( aAddrDetails.eConv == formula::FormulaGrammar::CONV_XL_R1C1 )
- nFlags |= SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE;
+ nFlags |= ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS;
if ( rSPos != rEPos )
{
ScRange r(rSPos, rEPos);
- nFlags |= (nFlags << 4);
- aPosStr = r.Format(SCA_VALID | nFlags, &rDoc, aAddrDetails);
+ applyStartToEndFlags(nFlags);
+ aPosStr = r.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
}
else
- aPosStr = aCursorPos.Format(SCA_VALID | nFlags, &rDoc, aAddrDetails);
+ aPosStr = aCursorPos.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
}
// Disable the accessible VALUE_CHANGE event
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 619baa444ac4..68a199f99d61 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2094,9 +2094,9 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
if (rText == ScGlobal::GetRscString(STR_MANAGE_NAMES))
eRet = SC_MANAGE_NAMES;
- else if ( aRange.Parse( rText, pDoc, eConv ) & SCA_VALID )
+ else if ( aRange.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID )
eRet = SC_NAME_INPUT_RANGE;
- else if ( aAddress.Parse( rText, pDoc, eConv ) & SCA_VALID )
+ else if ( aAddress.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID )
eRet = SC_NAME_INPUT_CELL;
else if ( ScRangeUtil::MakeRangeFromName( rText, pDoc, nTab, aRange, RUTL_NAMES, eConv ) )
eRet = SC_NAME_INPUT_NAMEDRANGE;
@@ -2243,7 +2243,7 @@ void ScPosWnd::DoEnter()
{
ScRangeName aNewRanges( *pNames );
ScAddress aCursor( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
- OUString aContent(aSelection.Format(SCR_ABS_3D, &rDoc, rDoc.GetAddressConvention()));
+ OUString aContent(aSelection.Format(ScRefFlags::RANGE_ABS_3D, &rDoc, rDoc.GetAddressConvention()));
ScRangeData* pNew = new ScRangeData( &rDoc, aText, aContent, aCursor );
if ( aNewRanges.insert(pNew) )
{
@@ -2269,7 +2269,7 @@ void ScPosWnd::DoEnter()
// be in Calc A1 format. Convert the text.
ScRange aRange(0,0, rViewData.GetTabNo());
aRange.ParseAny(aText, &rDoc, rDoc.GetAddressConvention());
- aText = aRange.Format(SCR_ABS_3D, &rDoc, ::formula::FormulaGrammar::CONV_OOO);
+ aText = aRange.Format(ScRefFlags::RANGE_ABS_3D, &rDoc, ::formula::FormulaGrammar::CONV_OOO);
}
SfxStringItem aPosItem( SID_CURRENTCELL, aText );
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 728a67d68795..7edda7adc5b2 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -196,7 +196,7 @@ public:
void appendAddress( const ScAddress &rPos )
{
- aMessage.append( rPos.Format( SCA_VALID ) );
+ aMessage.append( rPos.Format( ScRefFlags::VALID ) );
appendSeparator();
}
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 5bc73a1a0b51..0884f330efa1 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -451,7 +451,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW,
mpEdRange->SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) );
OUString aRangeString;
- rRange.Format(aRangeString, SCA_VALID, pViewData->GetDocument(),
+ rRange.Format(aRangeString, ScRefFlags::VALID, pViewData->GetDocument(),
pViewData->GetDocument()->GetAddressConvention());
mpEdRange->SetText(aRangeString);
@@ -536,13 +536,13 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*)
if(rRef.aStart != rRef.aEnd)
RefInputStart(pEdit);
- sal_uInt16 n = 0;
+ ScRefFlags nFlags;
if (mpLastEdit && mpLastEdit != mpEdRange)
- n = SCR_ABS_3D;
+ nFlags = ScRefFlags::RANGE_ABS_3D;
else
- n = SCR_ABS;
+ nFlags = ScRefFlags::RANGE_ABS;
- OUString aRefStr(rRef.Format(n, mpViewData->GetDocument(),
+ OUString aRefStr(rRef.Format(nFlags, mpViewData->GetDocument(),
ScAddress::Details(mpViewData->GetDocument()->GetAddressConvention(), 0, 0)));
pEdit->SetRefString( aRefStr );
updateTitle();
@@ -556,11 +556,11 @@ ScConditionalFormat* ScCondFormatDlg::GetConditionalFormat() const
return nullptr;
ScRangeList aRange;
- sal_uInt16 nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
- SCA_VALID, mpViewData->GetDocument()->GetAddressConvention(), maPos.Tab());
+ ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
+ ScRefFlags::VALID, mpViewData->GetDocument()->GetAddressConvention(), maPos.Tab());
ScConditionalFormat* pFormat = mpCondFormList->GetConditionalFormat();
- if(nFlags & SCA_VALID && !aRange.empty() && pFormat)
+ if((nFlags & ScRefFlags::VALID) && !aRange.empty() && pFormat)
pFormat->SetRange(aRange);
else
{
@@ -760,9 +760,9 @@ IMPL_LINK_TYPED( ScCondFormatDlg, EdRangeModifyHdl, Edit&, rEdit, void )
{
OUString aRangeStr = rEdit.GetText();
ScRangeList aRange;
- sal_uInt16 nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
- SCA_VALID, mpViewData->GetDocument()->GetAddressConvention());
- if(nFlags & SCA_VALID)
+ ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
+ ScRefFlags::VALID, mpViewData->GetDocument()->GetAddressConvention());
+ if(nFlags & ScRefFlags::VALID)
rEdit.SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor());
else
rEdit.SetControlBackground(COL_LIGHTRED);
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index e0fb268df0b9..86a08ac9f85d 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -37,7 +37,7 @@ OUString ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat&
{
ScRangeList aRange = rFormat.GetRange();
OUString aStr;
- aRange.Format(aStr, SCA_VALID, mpDoc, mpDoc->GetAddressConvention());
+ aRange.Format(aStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention());
aStr += "\t";
aStr += ScCondFormatHelper::GetExpression(rFormat, aRange.GetTopLeftCorner());
return aStr;
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index fb00e3f9e98e..412b7667fe93 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -241,7 +241,7 @@ void ScPivotLayoutDialog::SetupSource()
}
else
{
- OUString aSourceRangeName = aSourceRange.Format(SCR_ABS_3D, mpDocument, maAddressDetails);
+ OUString aSourceRangeName = aSourceRange.Format(ScRefFlags::RANGE_ABS_3D, mpDocument, maAddressDetails);
mpSourceEdit->SetText(aSourceRangeName);
}
}
@@ -324,7 +324,7 @@ void ScPivotLayoutDialog::SetupDestination()
if (maPivotParameters.nTab != MAXTAB + 1)
{
ScAddress aAddress(maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab);
- OUString aAddressString = aAddress.Format(SCA_VALID | SCA_TAB_3D | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE, mpDocument, maAddressDetails);
+ OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, mpDocument, maAddressDetails);
mpDestinationEdit->SetText(aAddressString);
mpDestinationRadioSelection->Check();
}
@@ -373,7 +373,7 @@ void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocumen
if (rReferenceRange.aStart != rReferenceRange.aEnd)
RefInputStart(mpActiveEdit);
- OUString aReferenceString = rReferenceRange.Format(SCR_ABS_3D, pDocument, maAddressDetails);
+ OUString aReferenceString = rReferenceRange.Format(ScRefFlags::RANGE_ABS_3D, pDocument, maAddressDetails);
if (mpActiveEdit == mpSourceEdit)
{
@@ -437,9 +437,9 @@ void ScPivotLayoutDialog::UpdateSourceRange()
{
OUString aSourceString = mpSourceEdit->GetText();
ScRange aSourceRange;
- sal_uInt16 nResult = aSourceRange.Parse(aSourceString, mpDocument, maAddressDetails);
+ ScRefFlags nResult = aSourceRange.Parse(aSourceString, mpDocument, maAddressDetails);
- bool bIsValid = (nResult & SCA_VALID) == SCA_VALID; // aSourceString is valid
+ bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
mpSourceEdit->SetRefValid(true);
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index cbcd7ba355d6..2ff6d879b3f5 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -184,7 +184,7 @@ void ScConsolidateDlg::Init()
{
aStr = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format(
- SCR_ABS_3D, pDoc, eConv );
+ ScRefFlags::RANGE_ABS_3D, pDoc, eConv );
pLbConsAreas->InsertEntry( aStr );
}
}
@@ -192,7 +192,7 @@ void ScConsolidateDlg::Init()
if ( theConsData.nTab < pDoc->GetTableCount() )
{
aStr = ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab
- ).Format( SCA_ABS_3D, pDoc, eConv );
+ ).Format( ScRefFlags::ADDR_ABS_3D, pDoc, eConv );
pEdDestArea->SetText( aStr );
}
else
@@ -219,7 +219,7 @@ void ScConsolidateDlg::Init()
ScAreaNameIterator aIter( pDoc );
while ( aIter.Next( aStrName, aRange ) )
{
- OUString aStrArea(aRange.Format(SCA_ABS_3D, pDoc, eConv));
+ OUString aStrArea(aRange.Format(ScRefFlags::ADDR_ABS_3D, pDoc, eConv));
pAreaData[nAt++].Set( aStrName, aStrArea, aIter.WasDBName() );
}
}
@@ -268,11 +268,11 @@ void ScConsolidateDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
RefInputStart( pRefInputEdit );
OUString aStr;
- sal_uInt16 nFmt = SCR_ABS_3D; //!!! nCurTab is still missing
+ ScRefFlags nFmt = ScRefFlags::RANGE_ABS_3D; //!!! nCurTab is still missing
const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
if ( rRef.aStart.Tab() != rRef.aEnd.Tab() )
- nFmt |= SCA_TAB2_3D;
+ nFmt |= ScRefFlags::TAB2_3D;
if ( pRefInputEdit == pEdDataArea)
aStr = rRef.Format(nFmt, pDocP, eConv);
@@ -447,7 +447,7 @@ IMPL_LINK_TYPED( ScConsolidateDlg, ClickHdl, Button*, pBtn, void )
const ScArea& rArea = *(ppAreas[i]);
aNewArea = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
rArea.nColEnd, rArea.nRowEnd, rArea.nTab
- ).Format(SCR_ABS_3D, pDoc, eConv);
+ ).Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
if ( pLbConsAreas->GetEntryPos( aNewArea )
== LISTBOX_ENTRY_NOTFOUND )
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 5b1ba88b519c..76d84853008d 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -219,7 +219,7 @@ void ScDbNameDlg::Init()
theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
ScAddress( nEndCol, nEndRow, nEndTab ) );
- theAreaStr = theCurArea.Format(SCR_ABS_3D, pDoc, aAddrDetails);
+ theAreaStr = theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, aAddrDetails);
if ( pDBColl )
{
@@ -295,7 +295,7 @@ void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
theCurArea = rRef;
- OUString aRefStr(theCurArea.Format(SCR_ABS_3D, pDocP, aAddrDetails));
+ OUString aRefStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDocP, aAddrDetails));
m_pEdAssign->SetRefString( aRefStr );
m_pOptions->Enable();
m_pBtnAdd->Enable();
@@ -364,7 +364,7 @@ void ScDbNameDlg::UpdateDBData( const OUString& rStrName )
pData->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ),
ScAddress( nColEnd, nRowEnd, nTab ) );
- OUString theArea(theCurArea.Format(SCR_ABS_3D, pDoc, aAddrDetails));
+ OUString theArea(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, aAddrDetails));
m_pEdAssign->SetText( theArea );
m_pBtnAdd->SetText( aStrModify );
m_pBtnHeader->Check( pData->HasHeader() );
@@ -421,7 +421,7 @@ IMPL_LINK_NOARG_TYPED(ScDbNameDlg, AddBtnHdl, Button*, void)
// weil jetzt editiert werden kann, muss erst geparst werden
ScRange aTmpRange;
OUString aText = m_pEdAssign->GetText();
- if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
+ if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & ScRefFlags::VALID )
{
theCurArea = aTmpRange;
ScAddress aStart = theCurArea.aStart;
@@ -628,7 +628,7 @@ IMPL_LINK_NOARG_TYPED(ScDbNameDlg, AssModifyHdl, Edit&, void)
ScRange aTmpRange;
OUString aText = m_pEdAssign->GetText();
- if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
+ if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & ScRefFlags::VALID )
theCurArea = aTmpRange;
if (!aText.isEmpty() && !m_pEdName->GetText().isEmpty())
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 79fe8ab38db0..82235105e780 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -443,7 +443,7 @@ void ScFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
if ( rRef.aStart != rRef.aEnd )
RefInputStart( pEdCopyArea );
- OUString aRefStr(rRef.aStart.Format(SCA_ABS_3D, pDocP, pDocP->GetAddressConvention()));
+ OUString aRefStr(rRef.aStart.Format(ScRefFlags::ADDR_ABS_3D, pDocP, pDocP->GetAddressConvention()));
pEdCopyArea->SetRefString( aRefStr );
}
}
@@ -664,9 +664,9 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
if ( pBtnCopyResult->IsChecked() )
{
- sal_uInt16 nResult = theCopyPos.Parse(
+ ScRefFlags nResult = theCopyPos.Parse(
pEdCopyArea->GetText(), pDoc, pDoc->GetAddressConvention());
- bCopyPosOk = ( SCA_VALID == (nResult & SCA_VALID) );
+ bCopyPosOk = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID;
}
if ( pBtnCopyResult->IsChecked() && bCopyPosOk )
diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx
index db56b77a200c..0be8764e61cb 100644
--- a/sc/source/ui/dbgui/foptmgr.cxx
+++ b/sc/source/ui/dbgui/foptmgr.cxx
@@ -102,7 +102,7 @@ void ScFilterOptionsMgr::Init()
OUString theDbName(STR_DB_LOCAL_NONAME);
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- theAreaStr = theCurArea.Format(SCR_ABS_3D, pDoc, eConv);
+ theAreaStr = theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
// Zielbereichsliste fuellen
@@ -116,7 +116,7 @@ void ScFilterOptionsMgr::Init()
{
const sal_Int32 nInsert = pLbCopyArea->InsertEntry( aName );
- OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, pDoc, eConv));
+ OUString aRefStr(aRange.aStart.Format(ScRefFlags::ADDR_ABS_3D, pDoc, eConv));
pLbCopyArea->SetEntryData( nInsert, new OUString( aRefStr ) );
}
@@ -170,7 +170,7 @@ void ScFilterOptionsMgr::Init()
ScAddress( rQueryData.nDestCol,
rQueryData.nDestRow,
rQueryData.nDestTab
- ).Format(SCA_ABS_3D, pDoc, eConv);
+ ).Format(ScRefFlags::ADDR_ABS_3D, pDoc, eConv);
pBtnCopyResult->Check();
pEdCopyArea->SetText( aString );
@@ -202,9 +202,9 @@ bool ScFilterOptionsMgr::VerifyPosStr( const OUString& rPosStr ) const
if ( -1 != nColonPos )
aPosStr = aPosStr.copy( 0, nColonPos );
- sal_uInt16 nResult = ScAddress().Parse( aPosStr, pDoc, pDoc->GetAddressConvention() );
+ ScRefFlags nResult = ScAddress().Parse( aPosStr, pDoc, pDoc->GetAddressConvention() );
- return ( SCA_VALID == (nResult & SCA_VALID) );
+ return (nResult & ScRefFlags::VALID) == ScRefFlags::VALID;
}
// Handler:
@@ -228,9 +228,9 @@ IMPL_LINK_TYPED( ScFilterOptionsMgr, EdAreaModifyHdl, Edit&, rEd, void )
if ( &rEd == pEdCopyArea )
{
OUString theCurPosStr = rEd.GetText();
- sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
+ ScRefFlags nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
- if ( SCA_VALID == (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::VALID)
{
const sal_Int32 nCount = pLbCopyArea->GetEntryCount();
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index f00924e8f76f..bedb0b979eda 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -168,7 +168,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
ScRange aAdvSource;
if (rQueryItem.GetAdvancedQuerySource(aAdvSource))
{
- OUString aRefStr(aAdvSource.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aRefStr(aAdvSource.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
pEdFilterArea->SetRefString( aRefStr );
}
}
@@ -226,9 +226,9 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
if ( pRefInputEdit == pEdCopyArea)
- aRefStr = rRef.aStart.Format(SCA_ABS_3D, pDocP, eConv);
+ aRefStr = rRef.aStart.Format(ScRefFlags::ADDR_ABS_3D, pDocP, eConv);
else if ( pRefInputEdit == pEdFilterArea)
- aRefStr = rRef.Format(SCR_ABS_3D, pDocP, eConv);
+ aRefStr = rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP, eConv);
pRefInputEdit->SetRefString( aRefStr );
}
@@ -295,9 +295,9 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
if ( -1 != nColonPos )
theCopyStr = theCopyStr.copy( 0, nColonPos );
- sal_uInt16 nResult = theAdrCopy.Parse( theCopyStr, pDoc, eConv );
+ ScRefFlags nResult = theAdrCopy.Parse( theCopyStr, pDoc, eConv );
- if ( SCA_VALID != (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::ZERO )
{
if (!pExpander->get_expanded())
pExpander->set_expanded(true);
@@ -310,9 +310,9 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
if ( bEditInputOk )
{
- sal_uInt16 nResult = ScRange().Parse( theAreaStr, pDoc, eConv );
+ ScRefFlags nResult = ScRange().Parse( theAreaStr, pDoc, eConv );
- if ( SCA_VALID != (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::ZERO )
{
ERRORBOX( STR_INVALID_TABREF );
pEdFilterArea->GrabFocus();
@@ -328,9 +328,9 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
* ein ScQueryParam zu erzeugen:
*/
- sal_uInt16 nResult = theFilterArea.Parse( theAreaStr, pDoc, eConv );
+ ScRefFlags nResult = theFilterArea.Parse( theAreaStr, pDoc, eConv );
- if ( SCA_VALID == (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::VALID )
{
ScAddress& rStart = theFilterArea.aStart;
ScAddress& rEnd = theFilterArea.aEnd;
@@ -430,9 +430,9 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, FilterAreaModHdl, Edit&, rEd, void )
if ( pDoc && pViewData )
{
OUString theCurAreaStr = rEd.GetText();
- sal_uInt16 nResult = ScRange().Parse( theCurAreaStr, pDoc );
+ ScRefFlags nResult = ScRange().Parse( theCurAreaStr, pDoc );
- if ( SCA_VALID == (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::VALID )
{
const sal_Int32 nCount = pLbFilterArea->GetEntryCount();
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index fba0f873a2ae..cafd3af373f1 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -598,7 +598,7 @@ void ScTabPageSortOptions::Init()
{
const sal_Int32 nInsert = m_pLbOutPos->InsertEntry( aName );
- OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, pDoc, eConv));
+ OUString aRefStr(aRange.aStart.Format(ScRefFlags::ADDR_ABS_3D, pDoc, eConv));
m_pLbOutPos->SetEntryData( nInsert, new OUString( aRefStr ) );
}
@@ -611,7 +611,7 @@ void ScTabPageSortOptions::Init()
OUString theArea =
ScRange( aScAddress,
ScAddress( aSortData.nCol2, aSortData.nRow2, nCurTab )
- ).Format(SCR_ABS, pDoc, eConv);
+ ).Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
if ( pDBColl )
{
@@ -686,9 +686,9 @@ void ScTabPageSortOptions::Reset( const SfxItemSet* /* rArgSet */ )
if ( pDoc && !aSortData.bInplace )
{
- sal_uInt16 nFormat = (aSortData.nDestTab != pViewData->GetTabNo())
- ? SCR_ABS_3D
- : SCR_ABS;
+ ScRefFlags nFormat = (aSortData.nDestTab != pViewData->GetTabNo())
+ ? ScRefFlags::RANGE_ABS_3D
+ : ScRefFlags::RANGE_ABS;
theOutPos.Set( aSortData.nDestCol,
aSortData.nDestRow,
@@ -803,9 +803,9 @@ SfxTabPage::sfxpg ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
thePos.SetTab( pViewData->GetTabNo() );
}
- sal_uInt16 nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() );
+ ScRefFlags nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() );
- bPosInputOk = ( SCA_VALID == (nResult & SCA_VALID) );
+ bPosInputOk = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID;
if ( !bPosInputOk )
{
@@ -909,9 +909,9 @@ void ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd )
if (pEd == m_pEdOutPos)
{
OUString theCurPosStr = m_pEdOutPos->GetText();
- sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
+ ScRefFlags nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
- if ( SCA_VALID == (nResult & SCA_VALID) )
+ if ( (nResult & ScRefFlags::VALID) == ScRefFlags::VALID )
{
bool bFound = false;
sal_Int32 i = 0;
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index db7301280b1e..da40275de342 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -110,7 +110,7 @@ void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pD
if ( m_pRefEdit )
{
- OUString aStr(rRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aStr(rRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
m_pRefEdit->SetRefString( aStr );
}
}
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index b0ae3d151df2..5cafdca7ed13 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -66,7 +66,7 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche
// Out-of-bound sheet index.
continue;
- OUString aPosStr = aPos.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention());
+ OUString aPosStr = aPos.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention());
mpList->InsertEntry(aTabNames[aPos.Tab()] + "\t" + aPosStr + "\t" + pDoc->GetString(aPos));
}
}
@@ -106,8 +106,8 @@ IMPL_LINK_NOARG_TYPED( SearchResultsDlg, ListSelectHdl, SvTreeListBox*, void )
return;
ScAddress aPos;
- sal_uInt16 nRes = aPos.Parse(aPosStr, mpDoc, mpDoc->GetAddressConvention());
- if (!(nRes & SCA_VALID))
+ ScRefFlags nRes = aPos.Parse(aPosStr, mpDoc, mpDoc->GetAddressConvention());
+ if (!(nRes & ScRefFlags::VALID))
// Invalid address string.
return;
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index f4030935ec5f..d9ef58035daf 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -217,7 +217,7 @@ bool ScAreaLink::FindExtRange( ScRange& rRange, ScDocument* pSrcDoc, const OUStr
if (!bFound) // direct reference (range or cell)
{
ScAddress::Details aDetails(pSrcDoc->GetAddressConvention(), 0, 0);
- if ( rRange.ParseAny( rAreaName, pSrcDoc, aDetails ) & SCA_VALID )
+ if ( rRange.ParseAny( rAreaName, pSrcDoc, aDetails ) & ScRefFlags::VALID )
bFound = true;
}
return bFound;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4d413d790884..ca13e6d84de4 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4905,7 +4905,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
ScRangeData::MakeValidName(aName);
if (!aName.isEmpty())
{
- OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, &rDoc));
+ OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(ScRefFlags::RANGE_ABS_3D, &rDoc));
bool bInsert = false;
ScRangeData* pOld = rList.findByUpperName(ScGlobal::pCharClass->uppercase(aName));
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 1332e29190a4..ad54a5aa62fa 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -200,7 +200,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( !pDBColl || !pDBColl->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(sTarget)) )
{
ScAddress aPos;
- if ( aPos.Parse( sTarget, &aDocument, aDocument.GetAddressConvention() ) & SCA_VALID )
+ if ( aPos.Parse( sTarget, &aDocument, aDocument.GetAddressConvention() ) & ScRefFlags::VALID )
{
bMakeArea = true;
if (bUndo)
@@ -285,7 +285,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
- bool bValid = ( aSingleRange.ParseAny( aRangeName, &rDoc, aDetails ) & SCA_VALID ) != 0;
+ bool bValid = (aSingleRange.ParseAny(aRangeName, &rDoc, aDetails) & ScRefFlags::VALID) == ScRefFlags::ZERO;
if (!bValid)
{
aRangeListRef = new ScRangeList;
@@ -2210,8 +2210,8 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
// because the address item in a DDE entry is *not* normalized when saved
// into ODF.
ScRange aRange;
- bool bValid = ( (aRange.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO ) & SCA_VALID) ||
- (aRange.aStart.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO) & SCA_VALID) );
+ bool bValid = ( (aRange.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO ) & ScRefFlags::VALID) ||
+ (aRange.aStart.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO) & ScRefFlags::VALID) );
ScServerObject* pObj = nullptr; // NULL = error
if ( bValid )
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 509f05f250ec..88ec3b2c6656 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -159,10 +159,10 @@ ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos )
}
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
// Range?
- if (aRange.Parse(aPos, pDoc, eConv) & SCA_VALID)
+ if (aRange.Parse(aPos, pDoc, eConv) & ScRefFlags::VALID)
bSingle = false;
// Cell?
- else if (aRange.aStart.Parse(aPos, pDoc, eConv) & SCA_VALID)
+ else if (aRange.aStart.Parse(aPos, pDoc, eConv) & ScRefFlags::VALID)
aRange.aEnd = aRange.aStart;
else
bAll = true;
@@ -433,13 +433,13 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So
{
// Always use Calc A1 syntax for paste link.
OUString aRefName;
- sal_uInt16 nFlags = SCA_VALID | SCA_TAB_3D;
+ ScRefFlags nFlags = ScRefFlags::VALID | ScRefFlags::TAB_3D;
if( bSingle )
aRefName = aRange.aStart.Format(nFlags, pDoc, formula::FormulaGrammar::CONV_OOO);
else
{
if( aRange.aStart.Tab() != aRange.aEnd.Tab() )
- nFlags |= SCA_TAB2_3D;
+ nFlags |= ScRefFlags::TAB2_3D;
aRefName = aRange.Format(nFlags, pDoc, formula::FormulaGrammar::CONV_OOO);
}
OUString aAppName = Application::GetAppName();
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 2c215dcf2dd0..21d7c2cab3b0 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -84,11 +84,11 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const OUString& rItem ) :
// For DDE link, we always must parse references using OOO A1 convention.
- if ( aRange.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ if ( aRange.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & ScRefFlags::VALID )
{
// area reference
}
- else if ( aRange.aStart.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ else if ( aRange.aStart.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & ScRefFlags::VALID )
{
// cell reference
aRange.aEnd = aRange.aStart;
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 73429814c43d..732cc2f1d70e 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -114,7 +114,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 );
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- aRangeString = aRange.Format(SCR_ABS_3D, &rScDoc);
+ aRangeString = aRange.Format(ScRefFlags::RANGE_ABS_3D, &rScDoc);
}
}
}
@@ -143,14 +143,14 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
// use ScChartPositioner to auto-detect column/row headers (like ScChartArray in old version)
ScRangeListRef aRangeListRef( new ScRangeList );
- aRangeListRef->Parse( aRangeString, &rScDoc, SCA_VALID, rScDoc.GetAddressConvention() );
+ aRangeListRef->Parse( aRangeString, &rScDoc, ScRefFlags::VALID, rScDoc.GetAddressConvention() );
if ( !aRangeListRef->empty() )
{
rScDoc.LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
// update string from modified ranges. The ranges must be in the current formula syntax.
OUString aTmpStr;
- aRangeListRef->Format( aTmpStr, SCR_ABS_3D, &rScDoc, rScDoc.GetAddressConvention() );
+ aRangeListRef->Format( aTmpStr, ScRefFlags::RANGE_ABS_3D, &rScDoc, rScDoc.GetAddressConvention() );
aRangeString = aTmpStr;
ScChartPositioner aChartPositioner( &rScDoc, aRangeListRef );
@@ -429,7 +429,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV
aMultiMark.FillRangeListWithMarks( &aRanges, false );
OUString aStr;
ScDocument* pDocument = pViewSh->GetViewData().GetDocument();
- aRanges.Format( aStr, SCR_ABS_3D, pDocument, pDocument->GetAddressConvention() );
+ aRanges.Format( aStr, ScRefFlags::RANGE_ABS_3D, pDocument, pDocument->GetAddressConvention() );
aRangeString = aStr;
// get "total" range for positioning
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index a41d1ed78d6c..085c7177f2a0 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -351,7 +351,7 @@ bool ScFormulaDlg::calculateValue( const OUString& rStrExp, OUString& rStrResult
}
ScRange aTestRange;
- if ( bColRowName || (aTestRange.Parse(rStrExp) & SCA_VALID) )
+ if ( bColRowName || (aTestRange.Parse(rStrExp) & ScRefFlags::VALID) )
rStrResult += " ...";
// area
}
@@ -397,7 +397,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab");
- OUString aTmp(rRef.Format(SCA_VALID|SCA_TAB_3D, pRefDoc)); // immer 3d
+ OUString aTmp(rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pRefDoc)); // immer 3d
SfxObjectShell* pObjSh = pRefDoc->GetDocumentShell();
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 1db0c3a51d0e..f666d5fcf458 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -27,12 +27,12 @@
struct ScRangeFindData
{
ScRange aRef;
- sal_uInt16 nFlags;
+ ScRefFlags nFlags;
sal_Int32 nSelStart;
sal_Int32 nSelEnd;
ColorData nColorData;
- ScRangeFindData( const ScRange& rR, sal_uInt16 nF, sal_Int32 nS, sal_Int32 nE ) :
+ ScRangeFindData( const ScRange& rR, ScRefFlags nF, sal_Int32 nS, sal_Int32 nE ) :
aRef(rR), nFlags(nF), nSelStart(nS), nSelEnd(nE), nColorData(0) {}
};
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index ce7b2f297d61..a1ec22268b85 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -251,7 +251,7 @@ void ScAcceptChgDlg::Init()
if( !aChangeViewSet.GetTheRangeList().empty() )
{
const ScRange* pRangeEntry = aChangeViewSet.GetTheRangeList().front();
- OUString aRefStr(pRangeEntry->Format(SCR_ABS_3D, pDoc));
+ OUString aRefStr(pRangeEntry->Format(ScRefFlags::RANGE_ABS_3D, pDoc));
pTPFilter->SetRange(aRefStr);
}
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 9998a05ef6f1..e0818fb5aa63 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -167,12 +167,12 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUStr
ScRange aRange;
OUString aRangeStr( rStr.getToken( nToken, ';' ) );
- sal_uInt16 nFlags = aRange.ParseAny( aRangeStr, pDoc, aDetails );
- if ( nFlags & SCA_VALID )
+ ScRefFlags nFlags = aRange.ParseAny( aRangeStr, pDoc, aDetails );
+ if ( nFlags & ScRefFlags::VALID )
{
- if ( (nFlags & SCA_TAB_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO )
aRange.aStart.SetTab( nRefTab );
- if ( (nFlags & SCA_TAB2_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB2_3D) == ScRefFlags::ZERO )
aRange.aEnd.SetTab( aRange.aStart.Tab() );
rRanges.Append( aRange );
}
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index fed1d44a0feb..0d2c57be0f99 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -204,7 +204,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
if ( bValid )
{
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, eConv));
+ OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv));
if(bRef)
pEdAssign->SetRefString( aStr );
@@ -212,7 +212,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
pEdAssign->SetText( aStr );
pEdAssign->SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) );
- aStr = theCurData.Format(SCR_ABS_3D, pDoc, eConv);
+ aStr = theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
if(bRef)
pEdAssign2->SetRefString( aStr );
@@ -291,7 +291,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR
}
}
}
- OUString aStr(theCurData.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aStr(theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
if(bRef)
pEdAssign2->SetRefString( aStr );
@@ -379,7 +379,7 @@ void ScColRowNameRangesDlg::UpdateNames()
for ( j=0; j < nCount; j++ )
{
const ScRange aRange(ppSortArray[j]->GetRange(0));
- aString = aRange.Format(SCR_ABS_3D, pDoc, aDetails);
+ aString = aRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, aDetails);
//@008 get range parameters from document
ppSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1,
@@ -422,7 +422,7 @@ void ScColRowNameRangesDlg::UpdateNames()
for ( j=0; j < nCount; j++ )
{
const ScRange aRange(ppSortArray[j]->GetRange(0));
- aString = aRange.Format(SCR_ABS_3D, pDoc, aDetails);
+ aString = aRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc, aDetails);
//@008 Build string for rows below
ppSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1,
@@ -469,14 +469,14 @@ void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, bool bColNam
{
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
theCurArea = rRange;
- OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, eConv));
+ OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv));
pEdAssign->SetText( aStr );
pBtnAdd->Disable();
pBtnRemove->Enable();
pBtnColHead->Check( bColName );
pBtnRowHead->Check( !bColName );
theCurData = pPair->GetRange(1);
- aStr = theCurData.Format(SCR_ABS_3D, pDoc, eConv);
+ aStr = theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
pEdAssign2->SetText( aStr );
}
else
@@ -530,9 +530,8 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, AddBtnHdl, Button*, void)
{
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
ScRange aRange1, aRange2;
- bool bOk1;
- if ( (bOk1 = ((aRange1.ParseAny( aNewArea, pDoc, eConv ) & SCA_VALID) == SCA_VALID))
- && ((aRange2.ParseAny( aNewData, pDoc, eConv ) & SCA_VALID) == SCA_VALID) )
+ bool bOk1 = (aRange1.ParseAny( aNewArea, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID;
+ if ( bOk1 && (aRange2.ParseAny( aNewData, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
theCurArea = aRange1;
AdjustColRowData( aRange2 );
@@ -712,7 +711,7 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, Range1DataModifyHdl, Edit&, void)
if (!aNewArea.isEmpty() && pDoc)
{
ScRange aRange;
- if ( (aRange.ParseAny( aNewArea, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID) == SCA_VALID )
+ if ( (aRange.ParseAny(aNewArea, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
SetColRowData( aRange );
bValid = true;
@@ -744,7 +743,7 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, Range2DataModifyHdl, Edit&, void)
if ( !aNewData.isEmpty() )
{
ScRange aRange;
- if ( (aRange.ParseAny( aNewData, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID) == SCA_VALID )
+ if ( (aRange.ParseAny(aNewData, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
AdjustColRowData( aRange );
pBtnAdd->Enable();
@@ -768,7 +767,7 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, ColClickHdl, Button*, void)
if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == MAXROW )
{
theCurArea.aEnd.SetRow( MAXROW - 1 );
- OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
pEdAssign->SetText( aStr );
}
ScRange aRange( theCurData );
@@ -788,7 +787,7 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, RowClickHdl, Button*, void)
if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == MAXCOL )
{
theCurArea.aEnd.SetCol( MAXCOL - 1 );
- OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, pDoc->GetAddressConvention()));
pEdAssign->SetText( aStr );
}
ScRange aRange( theCurData );
diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx
index 5aa18913cd82..ddd2102dfbff 100644
--- a/sc/source/ui/miscdlgs/datastreamdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx
@@ -133,8 +133,8 @@ ScRange DataStreamDlg::GetStartRange()
OUString aStr = m_pEdRange->GetText();
ScDocument& rDoc = mpDocShell->GetDocument();
ScRange aRange;
- sal_uInt16 nRes = aRange.Parse(aStr, &rDoc, rDoc.GetAddressConvention());
- if ((nRes & SCA_VALID) != SCA_VALID || !aRange.IsValid())
+ ScRefFlags nRes = aRange.Parse(aStr, &rDoc, rDoc.GetAddressConvention());
+ if ( ((nRes & ScRefFlags::VALID) == ScRefFlags::ZERO) || !aRange.IsValid())
{
// Invalid range.
aRange.SetInvalid();
@@ -156,7 +156,7 @@ void DataStreamDlg::Init( const DataStream& rStrm )
ScRange aRange = rStrm.GetRange();
ScRange aTopRange = aRange;
aTopRange.aEnd.SetRow(aTopRange.aStart.Row());
- OUString aStr = aTopRange.Format(SCR_ABS_3D, &rDoc, rDoc.GetAddressConvention());
+ OUString aStr = aTopRange.Format(ScRefFlags::RANGE_ABS_3D, &rDoc, rDoc.GetAddressConvention());
m_pEdRange->SetText(aStr);
SCROW nRows = aRange.aEnd.Row() - aRange.aStart.Row() + 1;
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index 927bf3d0a82a..7be94ab129fb 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -126,7 +126,7 @@ void ScHighlightChgDlg::Init()
if ( !aChangeViewSet.GetTheRangeList().empty() )
{
const ScRange* pRangeEntry = aChangeViewSet.GetTheRangeList().front();
- OUString aRefStr(pRangeEntry->Format(SCR_ABS_3D, pDoc));
+ OUString aRefStr(pRangeEntry->Format(ScRefFlags::RANGE_ABS_3D, pDoc));
m_pFilterCtr->SetRange(aRefStr);
}
m_pFilterCtr->Enable();
@@ -142,7 +142,7 @@ void ScHighlightChgDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
if ( rRef.aStart != rRef.aEnd )
RefInputStart(m_pEdAssign);
- OUString aRefStr(rRef.Format(SCR_ABS_3D, pDocP, pDocP->GetAddressConvention()));
+ OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP, pDocP->GetAddressConvention()));
m_pEdAssign->SetRefString( aRefStr );
m_pFilterCtr->SetRange(aRefStr);
}
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 0744602ca764..596fc8ace56e 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -453,7 +453,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
m_pRbMax->Check();
OUString aCursorStr;
if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) )
- aCursorStr = rCursorPos.Format(SCA_ABS, nullptr, mrDoc.GetAddressConvention());
+ aCursorStr = rCursorPos.Format(ScRefFlags::ADDR_ABS, nullptr, mrDoc.GetAddressConvention());
m_pEdObjectiveCell->SetRefString( aCursorStr );
if ( nImplCount > 0 )
maEngine = maImplNames[0]; // use first implementation
@@ -562,11 +562,11 @@ void ScOptSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
aStr = aName;
else // format cell/range reference
{
- sal_uInt16 nFmt = ( aAdr.Tab() == mnCurTab ) ? SCA_ABS : SCA_ABS_3D;
+ ScRefFlags nFmt = ( aAdr.Tab() == mnCurTab ) ? ScRefFlags::ADDR_ABS : ScRefFlags::ADDR_ABS_3D;
if ( bSingle )
aStr = aAdr.Format(nFmt, pDocP, pDocP->GetAddressConvention());
else
- aStr = rRef.Format(nFmt | SCR_ABS, pDocP, pDocP->GetAddressConvention());
+ aStr = rRef.Format(nFmt | ScRefFlags::RANGE_ABS, pDocP, pDocP->GetAddressConvention());
}
// variable cells can be several ranges, so only the selection is replaced
@@ -805,12 +805,12 @@ bool ScOptSolverDlg::ParseRef( ScRange& rRange, const OUString& rInput, bool bAl
{
ScRangeUtil aRangeUtil;
ScAddress::Details aDetails(mrDoc.GetAddressConvention(), 0, 0);
- sal_uInt16 nFlags = rRange.ParseAny( rInput, &mrDoc, aDetails );
- if ( nFlags & SCA_VALID )
+ ScRefFlags nFlags = rRange.ParseAny( rInput, &mrDoc, aDetails );
+ if ( nFlags & ScRefFlags::VALID )
{
- if ( (nFlags & SCA_TAB_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO)
rRange.aStart.SetTab( mnCurTab );
- if ( (nFlags & SCA_TAB2_3D) == 0 )
+ if ( (nFlags & ScRefFlags::TAB2_3D) == ScRefFlags::ZERO)
rRange.aEnd.SetTab( rRange.aStart.Tab() );
return ( bAllowRange || rRange.aStart == rRange.aEnd );
}
diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx
index 0c5688833993..233778601483 100644
--- a/sc/source/ui/miscdlgs/simpref.cxx
+++ b/sc/source/ui/miscdlgs/simpref.cxx
@@ -99,10 +99,10 @@ void ScSimpleRefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
if ( bSingleCell )
{
ScAddress aAdr = rRef.aStart;
- aRefStr = aAdr.Format(SCA_ABS_3D, pDocP, pDocP->GetAddressConvention());
+ aRefStr = aAdr.Format(ScRefFlags::ADDR_ABS_3D, pDocP, pDocP->GetAddressConvention());
}
else
- aRefStr = theCurArea.Format(SCR_ABS_3D, pDocP, pDocP->GetAddressConvention());
+ aRefStr = theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDocP, pDocP->GetAddressConvention());
if ( bMultiSelection )
{
diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx
index 5cf45106c185..07982d39963f 100644
--- a/sc/source/ui/miscdlgs/solvrdlg.cxx
+++ b/sc/source/ui/miscdlgs/solvrdlg.cxx
@@ -109,7 +109,7 @@ void ScSolverDlg::Init()
m_pEdVariableCell->SetLoseFocusHdl ( aLink );
m_pRBVariableCell->SetLoseFocusHdl ( aLink );
- OUString aStr(theFormulaCell.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention()));
+ OUString aStr(theFormulaCell.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention()));
m_pEdFormulaCell->SetText( aStr );
m_pEdFormulaCell->GrabFocus();
@@ -144,9 +144,9 @@ void ScSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
RefInputStart(pEdActive);
ScAddress aAdr = rRef.aStart;
- sal_uInt16 nFmt = ( aAdr.Tab() == nCurTab )
- ? SCA_ABS
- : SCA_ABS_3D;
+ ScRefFlags nFmt = ( aAdr.Tab() == nCurTab )
+ ? ScRefFlags::ADDR_ABS
+ : ScRefFlags::ADDR_ABS_3D;
OUString aStr(aAdr.Format(nFmt, pDocP, pDocP->GetAddressConvention()));
pEdActive->SetRefString( aStr );
@@ -211,12 +211,12 @@ IMPL_LINK_TYPED( ScSolverDlg, BtnHdl, Button*, pBtn, void )
// 3. has a valid target value been entered?
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- sal_uInt16 nRes1 = theFormulaCell .Parse( m_pEdFormulaCell->GetText(), pDoc, eConv );
- sal_uInt16 nRes2 = theVariableCell.Parse( m_pEdVariableCell->GetText(), pDoc, eConv );
+ ScRefFlags nRes1 = theFormulaCell .Parse( m_pEdFormulaCell->GetText(), pDoc, eConv );
+ ScRefFlags nRes2 = theVariableCell.Parse( m_pEdVariableCell->GetText(), pDoc, eConv );
- if ( SCA_VALID == ( nRes1 & SCA_VALID ) )
+ if ( (nRes1 & ScRefFlags::VALID) == ScRefFlags::VALID )
{
- if ( SCA_VALID == ( nRes2 & SCA_VALID ) )
+ if ( (nRes2 & ScRefFlags::VALID) == ScRefFlags::VALID )
{
if ( CheckTargetValue( theTargetValStr ) )
{
diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx
index d48918b5dac5..0ae7eab15343 100644
--- a/sc/source/ui/miscdlgs/tabopdlg.cxx
+++ b/sc/source/ui/miscdlgs/tabopdlg.cxx
@@ -155,9 +155,9 @@ void ScTabOpDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
RefInputStart(pEdActive);
OUString aStr;
- sal_uInt16 nFmt = ( rRef.aStart.Tab() == nCurTab )
- ? SCR_ABS
- : SCR_ABS_3D;
+ ScRefFlags nFmt = ( rRef.aStart.Tab() == nCurTab )
+ ? ScRefFlags::RANGE_ABS
+ : ScRefFlags::RANGE_ABS_3D;
if (pEdActive == m_pEdFormulaRange)
{
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 71760dffcccd..021df03375b3 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -75,7 +75,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* p
ScRange aRange;
pViewData->GetSimpleArea( aRange );
- OUString aAreaStr(aRange.Format(SCR_ABS_3D, mpDoc,
+ OUString aAreaStr(aRange.Format(ScRefFlags::RANGE_ABS_3D, mpDoc,
ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0)));
m_pEdRange->SetText( aAreaStr );
@@ -302,7 +302,7 @@ void ScNameDefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
if ( rRef.aStart != rRef.aEnd )
RefInputStart(m_pEdRange);
- OUString aRefStr(rRef.Format(SCR_ABS_3D, pDocP,
+ OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP,
ScAddress::Details(pDocP->GetAddressConvention(), 0, 0)));
m_pEdRange->SetRefString( aRefStr );
}
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index dfc00bed1d49..78f1ac26480b 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -181,7 +181,7 @@ void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
if ( rRef.aStart != rRef.aEnd )
RefInputStart(m_pEdAssign);
- OUString aRefStr(rRef.Format(SCR_ABS_3D, pDocP,
+ OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP,
ScAddress::Details(pDocP->GetAddressConvention(), 0, 0)));
m_pEdAssign->SetRefString( aRefStr );
}
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 89a428e309b4..b2940d1bc313 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -338,7 +338,7 @@ static OUString lcl_GetDBAreaRange( ScDocument* pDoc, const OUString& rDBName )
{
ScRange aRange;
pData->GetArea(aRange);
- aRet = aRange.Format(SCR_ABS_3D, pDoc);
+ aRet = aRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc);
}
}
return aRet;
@@ -404,7 +404,7 @@ IMPL_LINK_NOARG_TYPED(ScContentTree, ContentDoubleClickHdl, SvTreeListBox*, bool
{
ScRange aRange = pLink->GetDestArea();
ScDocument* pSrcDoc = GetSourceDocument();
- OUString aRangeStr(aRange.Format(SCR_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention()));
+ OUString aRangeStr(aRange.Format(ScRefFlags::RANGE_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention()));
pParentWindow->SetCurrentCellStr( aRangeStr );
}
}
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index bc9e495ec173..9e7f8d216968 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -916,7 +916,7 @@ void ScNavigatorDlg::SetCurrentCell( SCCOL nColNo, SCROW nRowNo )
ppBoundItems[0]->ClearCache();
ScAddress aScAddress( nColNo, nRowNo, 0 );
- OUString aAddr(aScAddress.Format(SCA_ABS));
+ OUString aAddr(aScAddress.Format(ScRefFlags::ADDR_ABS));
bool bUnmark = false;
if ( GetViewData() )
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 19697c4db490..d9c7ddbd2bc1 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -341,7 +341,7 @@ struct OpenCLTester
mpDoc->SetString(ScAddress(1,0,0),
"=IF(SUM(" +
ScRange(ScAddress(1,1,0),
- ScAddress(1,1+mnTestAreas-1,0)).Format(SCA_VALID|SCA_VALID_COL|SCA_VALID_ROW) +
+ ScAddress(1,1+mnTestAreas-1,0)).Format(ScRefFlags::VALID|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")=0,\"PASS\",\"FAIL\")");
}
};
@@ -409,7 +409,7 @@ struct UnOp : Op
pDoc->SetValue(ScAddress(0,1+nRow,nTab), nArg);
pDoc->SetString(ScAddress(1,1+nRow,nTab),
- "=" + msOp + "(" + ScAddress(0,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) + ")");
+ "=" + msOp + "(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) + ")");
pDoc->SetValue(ScAddress(2,1+nRow,nTab), mpFun(nArg));
@@ -417,9 +417,9 @@ struct UnOp : Op
{
// relative epsilon
pDoc->SetString(ScAddress(3,1+nRow,nTab),
- "=IF(ABS((" + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- ")/" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS((" + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ ")/" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=" + OUString::number(-mnEpsilon) +
",0,1)");
}
@@ -427,8 +427,8 @@ struct UnOp : Op
{
// absolute epsilon
pDoc->SetString(ScAddress(3,1+nRow,nTab),
- "=IF(ABS(" + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS(" + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=" + OUString::number(mnEpsilon) +
",0,1)");
}
@@ -438,7 +438,7 @@ struct UnOp : Op
{
return "=SUM(" +
ScRange(ScAddress(3,1,nTab),
- ScAddress(3,1+mnRows-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(3,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) +
")";
}
};
@@ -485,14 +485,14 @@ struct BinOp : Op
pDoc->SetValue(ScAddress(1,1+nRow,nTab), nRhs);
pDoc->SetString(ScAddress(2,1+nRow,nTab),
- "=" + ScAddress(0,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- msOp + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW));
+ "=" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ msOp + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID));
pDoc->SetValue(ScAddress(3,1+nRow,nTab), mpFun(nLhs, nRhs));
pDoc->SetString(ScAddress(4,1+nRow,nTab),
- "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(3,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=" + OUString::number(mnEpsilon) +
",0,1)");
}
@@ -501,7 +501,7 @@ struct BinOp : Op
{
return "=SUM(" +
ScRange(ScAddress(4,1,nTab),
- ScAddress(4,1+mnRows-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(4,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) +
")";
}
};
@@ -534,15 +534,15 @@ struct Round : Area
pDoc->SetValue(ScAddress(1,1+nRow,nTab), nN);
pDoc->SetString(ScAddress(2,1+nRow,nTab),
- "=ROUND(" + ScAddress(0,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "," + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=ROUND(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "," + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")");
pDoc->SetValue(ScAddress(3,1+nRow,nTab), ::rtl::math::round(nX, (short) nN));
pDoc->SetString(ScAddress(4,1+nRow,nTab),
- "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(3,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS(" + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=3e-10"
",0,1)");
}
@@ -551,7 +551,7 @@ struct Round : Area
{
return "=SUM(" +
ScRange(ScAddress(4,1,nTab),
- ScAddress(4,1+mnRows-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(4,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) +
")";
}
@@ -591,10 +591,10 @@ struct Normdist : Area
pDoc->SetValue(ScAddress(3,1+nRow,nTab), nType);
pDoc->SetString(ScAddress(4,1+nRow,nTab),
- "=NORMDIST(" + ScAddress(0,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "," + ScAddress(1,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "," + ScAddress(2,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "," + ScAddress(3,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=NORMDIST(" + ScAddress(0,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "," + ScAddress(1,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "," + ScAddress(2,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "," + ScAddress(3,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")");
if (nType == 1)
@@ -603,8 +603,8 @@ struct Normdist : Area
pDoc->SetValue(ScAddress(5,1+nRow,nTab), ScInterpreter::phi((nNum-nAvg)/nStDev)/nStDev);
pDoc->SetString(ScAddress(6,1+nRow,nTab),
- "=IF(ABS(" + ScAddress(4,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(5,1+nRow,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS(" + ScAddress(4,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(5,1+nRow,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=3e-10"
",0,1)");
}
@@ -613,7 +613,7 @@ struct Normdist : Area
{
return "=SUM(" +
ScRange(ScAddress(6,1,nTab),
- ScAddress(6,1+mnRows-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(6,1+mnRows-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) +
")";
}
@@ -665,7 +665,7 @@ struct Reduction : Op
pDoc->SetString(ScAddress(1,1+nRow-mnRows/2+1,nTab),
"=" + msOp + "(" +
ScRange(ScAddress(0,1+nRow-mnRows/2+1,nTab),
- ScAddress(0,1+nRow,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW) +
+ ScAddress(0,1+nRow,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")");
double nAccum(mnAccumInitial);
@@ -676,14 +676,14 @@ struct Reduction : Op
if (mnEpsilon != 0)
pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab),
- "=IF(ABS(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "-" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(ABS(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "-" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
")<=" + OUString::number(mnEpsilon) +
",0,1)");
else
pDoc->SetString(ScAddress(3,1+nRow-mnRows/2+1,nTab),
- "=IF(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
- "=" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(SCA_VALID_COL|SCA_VALID_ROW) +
+ "=IF(" + ScAddress(1,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
+ "=" + ScAddress(2,1+nRow-mnRows/2+1,nTab).Format(ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID) +
",0,1)");
}
}
@@ -692,7 +692,7 @@ struct Reduction : Op
{
return "=SUM(" +
ScRange(ScAddress(3,1+0,nTab),
- ScAddress(3,1+mnRows-mnRows/2-1,nTab)).Format(SCA_VALID|SCA_TAB_3D|SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB, pDoc) +
+ ScAddress(3,1+mnRows-mnRows/2-1,nTab)).Format(ScRefFlags::VALID|ScRefFlags::TAB_3D|ScRefFlags::COL_VALID|ScRefFlags::ROW_VALID|ScRefFlags::TAB_VALID, pDoc) +
")";
}
};
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 1de9b59f7cf9..be45355014a7 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -135,7 +135,7 @@ void ScTpUserLists::Init()
PutInOrder( nStartTab, nEndTab );
aStrSelectedArea = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab
- ).Format(SCR_ABS_3D, pDoc);
+ ).Format(ScRefFlags::RANGE_ABS_3D, pDoc);
mpBtnCopy->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) );
mpBtnCopy->Enable();
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 5d9f76d2f7c5..f4107c7d63ba 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -61,28 +61,28 @@ static void lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, b
#if 0
// this method is useful when debugging address flags.
-static void printAddressFlags(sal_uInt16 nFlag)
+static void printAddressFlags(ScRefFlags nFlag)
{
- if ((nFlag & SCA_COL_ABSOLUTE ) == SCA_COL_ABSOLUTE ) printf("SCA_COL_ABSOLUTE \n");
- if ((nFlag & SCA_ROW_ABSOLUTE ) == SCA_ROW_ABSOLUTE ) printf("SCA_ROW_ABSOLUTE \n");
- if ((nFlag & SCA_TAB_ABSOLUTE ) == SCA_TAB_ABSOLUTE ) printf("SCA_TAB_ABSOLUTE \n");
- if ((nFlag & SCA_TAB_3D ) == SCA_TAB_3D ) printf("SCA_TAB_3D \n");
- if ((nFlag & SCA_COL2_ABSOLUTE ) == SCA_COL2_ABSOLUTE ) printf("SCA_COL2_ABSOLUTE\n");
- if ((nFlag & SCA_ROW2_ABSOLUTE ) == SCA_ROW2_ABSOLUTE ) printf("SCA_ROW2_ABSOLUTE\n");
- if ((nFlag & SCA_TAB2_ABSOLUTE ) == SCA_TAB2_ABSOLUTE ) printf("SCA_TAB2_ABSOLUTE\n");
- if ((nFlag & SCA_TAB2_3D ) == SCA_TAB2_3D ) printf("SCA_TAB2_3D \n");
- if ((nFlag & SCA_VALID_ROW ) == SCA_VALID_ROW ) printf("SCA_VALID_ROW \n");
- if ((nFlag & SCA_VALID_COL ) == SCA_VALID_COL ) printf("SCA_VALID_COL \n");
- if ((nFlag & SCA_VALID_TAB ) == SCA_VALID_TAB ) printf("SCA_VALID_TAB \n");
- if ((nFlag & SCA_FORCE_DOC ) == SCA_FORCE_DOC ) printf("SCA_FORCE_DOC \n");
- if ((nFlag & SCA_VALID_ROW2 ) == SCA_VALID_ROW2 ) printf("SCA_VALID_ROW2 \n");
- if ((nFlag & SCA_VALID_COL2 ) == SCA_VALID_COL2 ) printf("SCA_VALID_COL2 \n");
- if ((nFlag & SCA_VALID_TAB2 ) == SCA_VALID_TAB2 ) printf("SCA_VALID_TAB2 \n");
- if ((nFlag & SCA_VALID ) == SCA_VALID ) printf("SCA_VALID \n");
- if ((nFlag & SCA_ABS ) == SCA_ABS ) printf("SCA_ABS \n");
- if ((nFlag & SCR_ABS ) == SCR_ABS ) printf("SCR_ABS \n");
- if ((nFlag & SCA_ABS_3D ) == SCA_ABS_3D ) printf("SCA_ABS_3D \n");
- if ((nFlag & SCR_ABS_3D ) == SCR_ABS_3D ) printf("SCR_ABS_3D \n");
+ if ((nFlag & ScRefFlags::COL_ABS ) == ScRefFlags::COL_ABS ) printf("ScRefFlags::COL_ABS \n");
+ if ((nFlag & ScRefFlags::ROW_ABS ) == ScRefFlags::ROW_ABS ) printf("ScRefFlags::ROW_ABS \n");
+ if ((nFlag & ScRefFlags::TAB_ABS ) == ScRefFlags::TAB_ABS ) printf("ScRefFlags::TAB_ABS \n");
+ if ((nFlag & ScRefFlags::TAB_3D ) == ScRefFlags::TAB_3D ) printf("ScRefFlags::TAB_3D \n");
+ if ((nFlag & ScRefFlags::COL2_ABS ) == ScRefFlags::COL2_ABS ) printf("ScRefFlags::COL2_ABS \n");
+ if ((nFlag & ScRefFlags::ROW2_ABS ) == ScRefFlags::ROW2_ABS ) printf("ScRefFlags::ROW2_ABS \n");
+ if ((nFlag & ScRefFlags::TAB2_ABS ) == ScRefFlags::TAB2_ABS ) printf("ScRefFlags::TAB2_ABS \n");
+ if ((nFlag & ScRefFlags::TAB2_3D ) == ScRefFlags::TAB2_3D ) printf("ScRefFlags::TAB2_3D \n");
+ if ((nFlag & ScRefFlags::ROW_VALID ) == ScRefFlags::ROW_VALID ) printf("ScRefFlags::ROW_VALID \n");
+ if ((nFlag & ScRefFlags::COL_VALID ) == ScRefFlags::COL_VALID ) printf("ScRefFlags::COL_VALID \n");
+ if ((nFlag & ScRefFlags::TAB_VALID ) == ScRefFlags::TAB_VALID ) printf("ScRefFlags::TAB_VALID \n");
+ if ((nFlag & ScRefFlags::FORCE_DOC ) == ScRefFlags::FORCE_DOC ) printf("ScRefFlags::FORCE_DOC \n");
+ if ((nFlag & ScRefFlags::ROW2_VALID ) == ScRefFlags::ROW2_VALID ) printf("ScRefFlags::ROW2_VALID \n");
+ if ((nFlag & ScRefFlags::COL2_VALID ) == ScRefFlags::COL2_VALID ) printf("ScRefFlags::COL2_VALID \n");
+ if ((nFlag & ScRefFlags::TAB2_VALID ) == ScRefFlags::TAB2_VALID ) printf("ScRefFlags::TAB2_VALID \n");
+ if ((nFlag & ScRefFlags::VALID ) == ScRefFlags::VALID ) printf("ScRefFlags::VALID \n");
+ if ((nFlag & ScRefFlags::ADDR_ABS ) == ScRefFlags::ADDR_ABS ) printf("ScRefFlags::ADDR_ABS \n");
+ if ((nFlag & ScRefFlags::RANGE_ABS ) == ScRefFlags::RANGE_ABS ) printf("ScRefFlags::RANGE_ABS \n");
+ if ((nFlag & ScRefFlags::ADDR_ABS_3D ) == ScRefFlags::ADDR_ABS_3D ) printf("ScRefFlags::ADDR_ABS_3D \n");
+ if ((nFlag & ScRefFlags::RANGE_ABS_3D ) == ScRefFlags::RANGE_ABS_3D ) printf("ScRefFlags::RANGE_ABS_3D \n");
}
#endif
@@ -192,7 +192,7 @@ void ScPrintAreasDlg::SetReference( const ScRange& rRef, ScDocument* /* pDoc */
if ( pEdPrintArea == pRefInputEdit )
{
- aStr = rRef.Format(SCR_ABS, pDoc, eConv);
+ aStr = rRef.Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
OUString aVal = pEdPrintArea->GetText();
Selection aSel = pEdPrintArea->GetSelection();
aSel.Justify();
@@ -287,7 +287,7 @@ void ScPrintAreasDlg::Impl_Reset()
{
if ( !aStrRange.isEmpty() )
aStrRange += OUString(sep);
- aOne = pPrintRange->Format(SCR_ABS, pDoc, eConv);
+ aOne = pPrintRange->Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
aStrRange += aOne;
}
}
@@ -324,7 +324,7 @@ bool ScPrintAreasDlg::Impl_GetItem( Edit* pEd, SfxStringItem& rItem )
ScRange aRange;
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
lcl_CheckRepeatString(aRangeStr, pDoc, pEdRepeatRow == pEd, &aRange);
- aRangeStr = aRange.Format(SCR_ABS, pDoc, eConv);
+ aRangeStr = aRange.Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
}
rItem.SetValue( aRangeStr );
@@ -342,8 +342,8 @@ bool ScPrintAreasDlg::Impl_CheckRefStrings()
bool bPrintAreaOk = true;
if ( !aStrPrintArea.isEmpty() )
{
- const sal_uInt16 nValidAddr = SCA_VALID | SCA_VALID_ROW | SCA_VALID_COL;
- const sal_uInt16 nValidRange = nValidAddr | SCA_VALID_ROW2 | SCA_VALID_COL2;
+ const ScRefFlags nValidAddr = ScRefFlags::VALID | ScRefFlags::ROW_VALID | ScRefFlags::COL_VALID;
+ const ScRefFlags nValidRange = nValidAddr | ScRefFlags::ROW2_VALID | ScRefFlags::COL2_VALID;
const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
const sal_Unicode sep = ScCompiler::GetNativeSymbolChar(ocSep);
@@ -353,10 +353,10 @@ bool ScPrintAreasDlg::Impl_CheckRefStrings()
for ( sal_Int32 i = 0; i < nSepCount && bPrintAreaOk; ++i )
{
OUString aOne = aStrPrintArea.getToken(i, sep);
- sal_uInt16 nResult = aRange.Parse( aOne, pDoc, eConv );
+ ScRefFlags nResult = aRange.Parse( aOne, pDoc, eConv );
if ((nResult & nValidRange) != nValidRange)
{
- sal_uInt16 nAddrResult = aAddr.Parse( aOne, pDoc, eConv );
+ ScRefFlags nAddrResult = aAddr.Parse( aOne, pDoc, eConv );
if ((nAddrResult & nValidAddr) != nValidAddr)
bPrintAreaOk = false;
}
@@ -409,12 +409,12 @@ void ScPrintAreasDlg::Impl_FillLists()
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
if ( bSimple )
- aStrRange = aRange.Format(SCR_ABS, pDoc, eConv);
+ aStrRange = aRange.Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
else
{
ScRangeListRef aList( new ScRangeList );
pViewData->GetMarkData().FillRangeListWithMarks( aList, false );
- aList->Format(aStrRange, SCR_ABS, pDoc, eConv);
+ aList->Format(aStrRange, ScRefFlags::RANGE_ABS, pDoc, eConv);
}
pLbPrintArea->SetEntryData( SC_AREASDLG_PR_SELECT, new OUString( aStrRange ) );
@@ -436,11 +436,11 @@ void ScPrintAreasDlg::Impl_FillLists()
OUString aName = itr->second->GetName();
OUString aSymbol;
itr->second->GetSymbol(aSymbol);
- if (aRange.ParseAny(aSymbol, pDoc, eConv) & SCA_VALID)
+ if (aRange.ParseAny(aSymbol, pDoc, eConv) & ScRefFlags::VALID)
{
if (itr->second->HasType(RT_PRINTAREA))
{
- aSymbol = aRange.Format(SCR_ABS, pDoc, eConv);
+ aSymbol = aRange.Format(ScRefFlags::RANGE_ABS, pDoc, eConv);
pLbPrintArea->SetEntryData(
pLbPrintArea->InsertEntry(aName),
new OUString(aSymbol) );
@@ -808,7 +808,9 @@ static void lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, b
const ScAddress& rStart = pRange->aStart;
const ScAddress& rEnd = pRange->aEnd;
- const sal_uInt16 nFmt = bIsRow ? (SCA_VALID_ROW | SCA_ROW_ABSOLUTE) : (SCA_VALID_COL | SCA_COL_ABSOLUTE);
+ const ScRefFlags nFmt = bIsRow
+ ? (ScRefFlags::ROW_VALID | ScRefFlags::ROW_ABS)
+ : (ScRefFlags::COL_VALID | ScRefFlags::COL_ABS);
rStr += rStart.Format(nFmt, pDoc, eConv);
if ((bIsRow && rStart.Row() != rEnd.Row()) || (!bIsRow && rStart.Col() != rEnd.Col()))
{
diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx
index 1e90822bd0df..e31d80c3627a 100644
--- a/sc/source/ui/unoobj/addruno.cxx
+++ b/sc/source/ui/unoobj/addruno.cxx
@@ -66,12 +66,12 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula
bool bSuccess = false;
if ( bIsRange )
{
- sal_uInt16 nResult = aRange.ParseAny( rUIString, &rDoc, eConv );
- if ( nResult & SCA_VALID )
+ ScRefFlags nResult = aRange.ParseAny( rUIString, &rDoc, eConv );
+ if ( nResult & ScRefFlags::VALID )
{
- if ( ( nResult & SCA_TAB_3D ) == 0 )
+ if ( ( nResult & ScRefFlags::TAB_3D ) == ScRefFlags::ZERO )
aRange.aStart.SetTab( static_cast<SCTAB>(nRefSheet) );
- if ( ( nResult & SCA_TAB2_3D ) == 0 )
+ if ( ( nResult & ScRefFlags::TAB2_3D ) == ScRefFlags::ZERO )
aRange.aEnd.SetTab( aRange.aStart.Tab() );
// different sheets are not supported in CellRangeAddress
if ( aRange.aStart.Tab() == aRange.aEnd.Tab() )
@@ -80,10 +80,10 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula
}
else
{
- sal_uInt16 nResult = aRange.aStart.Parse( rUIString, &rDoc, eConv );
- if ( nResult & SCA_VALID )
+ ScRefFlags nResult = aRange.aStart.Parse( rUIString, &rDoc, eConv );
+ if ( nResult & ScRefFlags::VALID )
{
- if ( ( nResult & SCA_TAB_3D ) == 0 )
+ if ( ( nResult & ScRefFlags::TAB_3D ) == ScRefFlags::ZERO )
aRange.aStart.SetTab( static_cast<SCTAB>(nRefSheet) );
bSuccess = true;
}
@@ -251,9 +251,9 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
{
// generate UI representation string - include sheet only if different from ref sheet
OUString aFormatStr;
- sal_uInt16 nFlags = SCA_VALID;
+ ScRefFlags nFlags = ScRefFlags::VALID;
if ( aRange.aStart.Tab() != nRefSheet )
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
if ( bIsRange )
aFormatStr = aRange.Format(nFlags, &rDoc);
else
@@ -266,14 +266,14 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro
::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO;
// generate file format string - always include sheet
- OUString aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, &rDoc, eConv));
+ OUString aFormatStr(aRange.aStart.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, &rDoc, eConv));
if ( bIsRange )
{
// manually concatenate range so both parts always have the sheet name
aFormatStr += ":";
- sal_uInt16 nFlags = SCA_VALID;
+ ScRefFlags nFlags = ScRefFlags::VALID;
if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 )
- nFlags |= SCA_TAB_3D;
+ nFlags |= ScRefFlags::TAB_3D;
OUString aSecond(aRange.aEnd.Format(nFlags, &rDoc, eConv));
aFormatStr += aSecond ;
}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 46bf00ce031d..070514508e5a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2616,7 +2616,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
case SC_WID_UNO_ABSNAME:
{
OUString sRet;
- aRanges.Format(sRet, SCR_ABS_3D, &pDocShell->GetDocument());
+ aRanges.Format(sRet, ScRefFlags::RANGE_ABS_3D, &pDocShell->GetDocument());
rAny <<= sRet;
}
}
@@ -4292,7 +4292,7 @@ OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
ScDocShell* pDocSh = GetDocShell();
const ScRangeList& rRanges = GetRangeList();
if (pDocSh)
- rRanges.Format( aString, SCA_VALID | SCA_TAB_3D, &pDocSh->GetDocument() );
+ rRanges.Format( aString, ScRefFlags::VALID | ScRefFlags::TAB_3D, &pDocSh->GetDocument() );
return aString;
}
@@ -4480,7 +4480,7 @@ static bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
ScDocument& rDoc = pDocSh->GetDocument();
for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
{
- aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, &rDoc);
+ aRangeStr = rRanges[ i ]->Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, &rDoc);
if ( aRangeStr == rName )
{
rIndex = i;
@@ -4507,8 +4507,9 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries,
// range contained in selection? (sheet must be specified)
ScRange aCellRange;
- sal_uInt16 nParse = aCellRange.ParseAny( rName, &pDocSh->GetDocument() );
- if ( ( nParse & ( SCA_VALID | SCA_TAB_3D ) ) == ( SCA_VALID | SCA_TAB_3D ) )
+ ScRefFlags nParse = aCellRange.ParseAny( rName, &pDocSh->GetDocument() );
+ if ( (nParse & ( ScRefFlags::VALID | ScRefFlags::TAB_3D ))
+ == ( ScRefFlags::VALID | ScRefFlags::TAB_3D ))
{
ScMarkData aMarkData;
aMarkData.MarkFromRangeList( rRanges, false );
@@ -4568,7 +4569,8 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName )
{
// deselect any ranges (parsed or named entry)
ScRangeList aDiff;
- bool bValid = ( aDiff.Parse( aNameStr, &pDocSh->GetDocument() ) & SCA_VALID ) != 0;
+ bool bValid = ( aDiff.Parse( aNameStr, &pDocSh->GetDocument() ) & ScRefFlags::VALID )
+ == ScRefFlags::VALID;
if (!bValid && !m_pImpl->m_aNamedEntries.empty())
{
sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size();
@@ -4682,7 +4684,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames()
if (m_pImpl->m_aNamedEntries.empty() ||
!lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr))
{
- aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, &rDoc);
+ aRangeStr = aRange.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, &rDoc);
}
pAry[i] = aRangeStr;
}
@@ -4969,10 +4971,10 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
ScRange aCellRange;
bool bFound = false;
OUString aString(aName);
- sal_uInt16 nParse = aCellRange.ParseAny( aString, &rDoc, rDetails );
- if ( nParse & SCA_VALID )
+ ScRefFlags nParse = aCellRange.ParseAny( aString, &rDoc, rDetails );
+ if ( nParse & ScRefFlags::VALID )
{
- if ( !(nParse & SCA_TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle
+ if ( !(nParse & ScRefFlags::TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle
{
aCellRange.aStart.SetTab(nTab);
aCellRange.aEnd.SetTab(nTab);
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index fe84cf0a9dcb..521619b5c7a0 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2468,7 +2468,7 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
// BM: don't use names of named ranges but the UI range strings
// String aStr;
-// rRangeList->Format( aStr, SCR_ABS_3D, m_pDocument );
+// rRangeList->Format( aStr, ScRefFlags::RANGE_ABS_3D, m_pDocument );
// m_aIdentifier = aStr;
// m_aIdentifier = "ID_";
@@ -3140,7 +3140,7 @@ public:
OUString aString = ScGlobal::GetRscString(STR_COLUMN);
aString += " ";
ScAddress aPos( nCol, 0, 0 );
- OUString aColStr(aPos.Format(SCA_VALID_COL));
+ OUString aColStr(aPos.Format(ScRefFlags::COL_VALID));
aString += aColStr;
pArr[mnCount] = aString;
}
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index c6baa5c79bea..9809f4bdadc1 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -248,7 +248,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
if( xReceiver.is())
{
OUString sRangeStr;
- xNewRanges->Format(sRangeStr, SCR_ABS_3D, &rDoc);
+ xNewRanges->Format(sRangeStr, ScRefFlags::RANGE_ABS_3D, &rDoc);
// connect
if( !sRangeStr.isEmpty() )
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1c51354a31bb..6498fe0c23ee 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1185,11 +1185,11 @@ static bool lcl_ParseTarget( const OUString& rTarget, ScRange& rTargetRange, Rec
bool bRangeValid = false;
bool bRectValid = false;
- if ( rTargetRange.Parse( rTarget, pDoc ) & SCA_VALID )
+ if ( rTargetRange.Parse( rTarget, pDoc ) & ScRefFlags::VALID )
{
bRangeValid = true; // range reference
}
- else if ( aAddress.Parse( rTarget, pDoc ) & SCA_VALID )
+ else if ( aAddress.Parse( rTarget, pDoc ) & ScRefFlags::VALID )
{
rTargetRange = aAddress;
bRangeValid = true; // cell reference
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index ec276a7fef37..75e0edd29c9e 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -170,8 +170,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
if ( sFormula.startsWith("=") )
sFormula = sFormula.copy(1);
ScRangeList aCellRanges;
- sal_uInt16 nFlags = 0;
-
+ ScRefFlags nFlags = ScRefFlags::ZERO;
formula::FormulaGrammar::AddressConvention eConv = ( eGram == formula::FormulaGrammar::GRAM_NATIVE_XL_A1 ) ? formula::FormulaGrammar::CONV_XL_A1 : formula::FormulaGrammar::CONV_XL_R1C1;
if ( ScVbaRange::getCellRangesForAddress( nFlags, sFormula, pDocSh, aCellRanges, eConv , ',' ) )
{
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index 173b7c2f4041..50e6e096fa69 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -72,8 +72,6 @@ OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeExcepti
if( nCount )
{
ScAddress::Details aDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
- sal_uInt16 nFlags = SCA_VALID;
- nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
ScRangeList aRangeList;
for( sal_Int32 i=0; i<nCount; i++ )
{
@@ -82,7 +80,7 @@ OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeExcepti
aRangeList.Append( aRange );
}
ScDocument& rDoc = excel::getDocShell( mxModel )->GetDocument();
- aRangeList.Format( aPrintArea, nFlags, &rDoc, formula::FormulaGrammar::CONV_XL_A1, ',' );
+ aRangeList.Format( aPrintArea, ScRefFlags::RANGE_ABS, &rDoc, formula::FormulaGrammar::CONV_XL_A1, ',' );
}
return aPrintArea;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index ae1c3be7e461..16962802327f 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1139,15 +1139,14 @@ public:
};
bool
-ScVbaRange::getCellRangesForAddress( sal_uInt16& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter )
+ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter )
{
if ( pDocSh )
{
ScDocument& rDoc = pDocSh->GetDocument();
- sal_uInt16 nMask = SCA_VALID;
- rResFlags = rCellRanges.Parse( sAddress, &rDoc, nMask, eConv, 0, cDelimiter );
- if ( rResFlags & SCA_VALID )
+ rResFlags = rCellRanges.Parse( sAddress, &rDoc, ScRefFlags::VALID, eConv, 0, cDelimiter );
+ if ( rResFlags & ScRefFlags::VALID )
{
return true;
}
@@ -1207,11 +1206,11 @@ bool getScRangeListForAddress( const OUString& sName, ScDocShell* pDocSh, ScRang
aChar = ';';
}
- sal_uInt16 nFlags = 0;
+ ScRefFlags nFlags = ScRefFlags::ZERO;
if ( !ScVbaRange::getCellRangesForAddress( nFlags, sAddress, pDocSh, aCellRanges, eConv, aChar ) )
return false;
- bool bTabFromReferrer = !( nFlags & SCA_TAB_3D );
+ bool bTabFromReferrer = !( nFlags & ScRefFlags::TAB_3D );
for ( size_t i = 0, nRanges = aCellRanges.size(); i < nRanges; ++i )
{
@@ -2061,37 +2060,37 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut
if ( refStyle == excel::XlReferenceStyle::xlR1C1 )
dDetails = ScAddress::Details( formula::FormulaGrammar::CONV_XL_R1C1, 0, 0 );
}
- sal_uInt16 nFlags = SCA_VALID;
+ // default
+ ScRefFlags nFlags = ScRefFlags::RANGE_ABS;
ScDocShell* pDocShell = getScDocShell();
ScDocument& rDoc = pDocShell->GetDocument();
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
- sal_uInt16 ROW_ABSOLUTE = ( SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE );
- sal_uInt16 COL_ABSOLUTE = ( SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE );
- // default
- nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
+ ScRefFlags ROW_ABS = ( ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS );
+ ScRefFlags COL_ABS = ( ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS );
+
if ( RowAbsolute.hasValue() )
{
bool bVal = true;
RowAbsolute >>= bVal;
if ( !bVal )
- nFlags &= ~ROW_ABSOLUTE;
+ nFlags &= ~ROW_ABS;
}
if ( ColumnAbsolute.hasValue() )
{
bool bVal = true;
ColumnAbsolute >>= bVal;
if ( !bVal )
- nFlags &= ~COL_ABSOLUTE;
+ nFlags &= ~COL_ABS;
}
if ( External.hasValue() )
{
bool bLocal = false;
External >>= bLocal;
if ( bLocal )
- nFlags |= SCA_TAB_3D | SCA_FORCE_DOC;
+ nFlags |= ScRefFlags::TAB_3D | ScRefFlags::FORCE_DOC;
}
if ( RelativeTo.hasValue() )
{
@@ -2182,8 +2181,8 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
{
ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRange tmpRange;
- sal_uInt16 flags = tmpRange.ParseCols( sCol, &getDocumentFromRange( xRange ), dDetails );
- if ( ( flags & 0x200 ) != 0x200 )
+ ScRefFlags flags = tmpRange.ParseCols( sCol, &getDocumentFromRange( xRange ), dDetails );
+ if ( (flags & ScRefFlags::COL_VALID) == ScRefFlags::ZERO )
throw uno::RuntimeException();
nColumn = tmpRange.aStart.Col() + 1;
}
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index f2b7645eda07..ee715cfa4e0b 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -42,6 +42,7 @@
#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
#include "vbaformat.hxx"
+#include "address.hxx"
#include <formula/grammar.hxx>
class ScCellRangesBase;
@@ -287,7 +288,7 @@ public:
// * object should be a lightweight as possible
// * we shouldn't need hacks like this below
static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException, std::exception);
- static bool getCellRangesForAddress( sal_uInt16& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter = 0 );
+ static bool getCellRangesForAddress(ScRefFlags &rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter = 0 );
virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException, std::exception) override;
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue)
throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) override;
diff --git a/sc/source/ui/vba/vbavalidation.cxx b/sc/source/ui/vba/vbavalidation.cxx
index 541be9a773e2..fa03dfe2cf76 100644
--- a/sc/source/ui/vba/vbavalidation.cxx
+++ b/sc/source/ui/vba/vbavalidation.cxx
@@ -299,7 +299,7 @@ ScVbaValidation::getFormula1() throw (uno::RuntimeException, std::exception)
uno::Reference< sheet::XSheetCondition > xCond( lcl_getValidationProps( m_xRange ), uno::UNO_QUERY_THROW );
OUString sString = xCond->getFormula1();
- sal_uInt16 nFlags = 0;
+ ScRefFlags nFlags = ScRefFlags::ZERO;
ScRangeList aCellRanges;
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_XL_A1;
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index f381267368c9..f88274eb3419 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -619,8 +619,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
ScRange aRange;
if ( pData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
- sal_uInt16 nFlags = SCA_VALID | SCA_TAB_3D;
- OUString aStr(aRange.Format(nFlags,pDoc));
+ OUString aStr(aRange.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D,pDoc));
rSet.Put( SfxStringItem( nWhich, aStr ) );
}
}
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index b9fbf41ccca7..fea6f1a26ffd 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -823,7 +823,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAddress aScAddress;
OUString aArg = static_cast<const SfxStringItem*>(pItem)->GetValue();
- if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID )
+ if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID )
{
nFillRow = aScAddress.Row();
nFillCol = aScAddress.Col();
@@ -894,7 +894,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if( ! rReq.IsAPI() )
{
ScAddress aAdr( nFillCol, nFillRow, 0 );
- OUString aAdrStr(aAdr.Format(SCR_ABS, pDoc, pDoc->GetAddressConvention()));
+ OUString aAdrStr(aAdr.Format(ScRefFlags::RANGE_ABS, pDoc, pDoc->GetAddressConvention()));
rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) );
rReq.Done();
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 789f29763320..fec2ae45347b 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -171,14 +171,12 @@ static bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
((rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col()) ||
(rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row())))
{
- sal_uInt16 nFmt = SCA_VALID;
-
pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
- OUString aExtendStr(rExtendRange.Format(nFmt, pDoc));
+ OUString aExtendStr(rExtendRange.Format(ScRefFlags::VALID, pDoc));
ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
- OUString aCurrentStr(rCurrentRange.Format(nFmt, pDoc));
+ OUString aCurrentStr(rCurrentRange.Format(ScRefFlags::VALID, pDoc));
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 8f4a2e0aa207..dbc8ef80fd00 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -273,12 +273,12 @@ void getChartSourceRanges(ScDocument* pDoc, const SdrMarkList& rObjs, std::vecto
{
ScRangeList aRange;
ScAddress aAddr;
- if (aRange.Parse(*it, pDoc, pDoc->GetAddressConvention()) & SCA_VALID)
+ if (aRange.Parse(*it, pDoc, ScRefFlags::VALID, pDoc->GetAddressConvention()) & ScRefFlags::VALID)
{
for(size_t i = 0; i < aRange.size(); ++i)
rRanges.push_back(*aRange[i]);
}
- else if (aAddr.Parse(*it, pDoc, pDoc->GetAddressConvention()) & SCA_VALID)
+ else if (aAddr.Parse(*it, pDoc, pDoc->GetAddressConvention()) & ScRefFlags::VALID)
rRanges.push_back(aAddr);
}
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e1274fe5f333..d74fb713abc0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2458,8 +2458,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
ScAddress aTempAddr;
ScAddress::ExternalInfo aExtInfo;
- sal_uInt16 nRes = aTempAddr.Parse(aUrl, pDoc, pDoc->GetAddressConvention(), &aExtInfo);
- if (!(nRes & SCA_VALID))
+ ScRefFlags nRes = aTempAddr.Parse(aUrl, pDoc, pDoc->GetAddressConvention(), &aExtInfo);
+ if (!(nRes & ScRefFlags::VALID))
{
// Not a reference string. Pass it through unmodified.
ScGlobal::OpenURL(aUrl, aTarget);
@@ -2478,7 +2478,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
aBuf.append('#');
aBuf.append(aExtInfo.maTabName);
aBuf.append('.');
- OUString aRefCalcA1(aTempAddr.Format(SCA_ABS, nullptr, formula::FormulaGrammar::CONV_OOO));
+ OUString aRefCalcA1(aTempAddr.Format(ScRefFlags::ADDR_ABS, nullptr, formula::FormulaGrammar::CONV_OOO));
aBuf.append(aRefCalcA1);
ScGlobal::OpenURL(aBuf.makeStringAndClear(), aTarget);
}
@@ -2486,7 +2486,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
// Internal reference.
aBuf.append('#');
- OUString aUrlCalcA1(aTempAddr.Format(SCA_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO));
+ OUString aUrlCalcA1(aTempAddr.Format(ScRefFlags::ADDR_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO));
aBuf.append(aUrlCalcA1);
ScGlobal::OpenURL(aBuf.makeStringAndClear(), aTarget);
}
@@ -2545,7 +2545,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
ScRange aScRange;
rMark.GetMarkArea( aScRange );
- aAddr = aScRange.Format(SCR_ABS);
+ aAddr = aScRange.Format(ScRefFlags::RANGE_ABS);
if ( aScRange.aStart == aScRange.aEnd )
{
// make sure there is a range selection string even for a single cell
@@ -2558,7 +2558,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
else // only move cursor
{
ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 0 );
- aAddr = aScAddress.Format(SCA_ABS);
+ aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS);
}
SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
@@ -4227,7 +4227,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
OUString aChartName;
if (pThisDoc->HasChartAtPoint( nThisTab, rLogicPos, aChartName ))
{
- OUString aRangeName(aSource.Format(SCR_ABS_3D, pThisDoc));
+ OUString aRangeName(aSource.Format(ScRefFlags::RANGE_ABS_3D, pThisDoc));
SfxStringItem aNameItem( SID_CHART_NAME, aChartName );
SfxStringItem aRangeItem( SID_CHART_SOURCE, aRangeName );
sal_uInt16 nId = bIsMove ? SID_CHART_SOURCE : SID_CHART_ADDSOURCE;
@@ -4413,7 +4413,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
{
OUString aApp = Application::GetAppName();
OUString aTopic = pSourceSh->GetTitle( SFX_TITLE_FULLNAME );
- OUString aItem(aSource.Format(SCA_VALID | SCA_TAB_3D, pSourceDoc));
+ OUString aItem(aSource.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pSourceDoc));
// TODO: we could define ocQuote for "
const OUString aQuote('"');
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index c90d8dbf6d3a..2ee209254548 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -1047,9 +1047,9 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp )
{
OUString aTemp;
if ( *pOld != aPagebreakSource )
- aTemp = pOld->Format(SCA_VALID);
+ aTemp = pOld->Format(ScRefFlags::VALID);
else if ( !bHide )
- aTemp = aPagebreakDrag.Format(SCA_VALID);
+ aTemp = aPagebreakDrag.Format(ScRefFlags::VALID);
if (!aTemp.isEmpty())
{
if ( !aNewRanges.isEmpty() )
@@ -1060,7 +1060,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp )
}
}
else if (!bHide)
- aNewRanges = aPagebreakDrag.Format(SCA_VALID);
+ aNewRanges = aPagebreakDrag.Format(ScRefFlags::VALID);
pViewFunc->SetPrintRanges( rDoc.IsPrintEntireSheet( nTab ), &aNewRanges, nullptr, nullptr, false );
}
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 45e0a034ed02..e4c722fd698a 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2466,7 +2466,7 @@ void ScOutputData::AddPDFNotes()
// Note title is the cell address (as on printed note pages)
ScAddress aAddress( nMergeX, nMergeY, nTab );
- OUString aTitle(aAddress.Format(SCA_VALID, mpDoc, mpDoc->GetAddressConvention()));
+ OUString aTitle(aAddress.Format(ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention()));
// Content has to be a simple string without line breaks
OUString aContent = pNote->GetText();
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index ac16552460d1..439a5b8375cd 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1882,7 +1882,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData
{
pEditEngine->Draw( pDev, Point( nPosX, nPosY ) );
- OUString aMarkStr(rPos.Format(SCA_VALID, pDoc, pDoc->GetAddressConvention()));
+ OUString aMarkStr(rPos.Format(ScRefFlags::VALID, pDoc, pDoc->GetAddressConvention()));
aMarkStr += ":";
// cell position also via EditEngine, for correct positioning
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 4ea02a9fde79..7b43c896ce09 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -69,44 +69,44 @@
#include <memory>
-static sal_uInt16 lcl_ParseRange(ScRange& rScRange, const OUString& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
+static ScRefFlags lcl_ParseRange(ScRange& rScRange, const OUString& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
{
// start with the address convention set in the document
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- sal_uInt16 nResult = rScRange.Parse(aAddress, pDoc, eConv);
- if ( (nResult & SCA_VALID) )
+ ScRefFlags nResult = rScRange.Parse(aAddress, pDoc, eConv);
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the default Calc (A1) address convention
nResult = rScRange.Parse(aAddress, pDoc);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the Excel A1 address convention
nResult = rScRange.Parse(aAddress, pDoc, formula::FormulaGrammar::CONV_XL_A1);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try Excel R1C1 address convention
return rScRange.Parse(aAddress, pDoc, formula::FormulaGrammar::CONV_XL_R1C1);
}
-static sal_uInt16 lcl_ParseAddress(ScAddress& rScAddress, const OUString& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
+static ScRefFlags lcl_ParseAddress(ScAddress& rScAddress, const OUString& aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
{
// start with the address convention set in the document
formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- sal_uInt16 nResult = rScAddress.Parse(aAddress, pDoc, eConv);
- if ( (nResult & SCA_VALID) )
+ ScRefFlags nResult = rScAddress.Parse(aAddress, pDoc, eConv);
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the default Calc (A1) address convention
nResult = rScAddress.Parse(aAddress, pDoc);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try the Excel A1 address convention
nResult = rScAddress.Parse(aAddress, pDoc, formula::FormulaGrammar::CONV_XL_A1);
- if ( (nResult & SCA_VALID) )
+ if ( nResult & ScRefFlags::VALID )
return nResult;
// try Excel R1C1 address convention
@@ -278,14 +278,14 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
ScMarkData& rMark = rViewData.GetMarkData();
ScRange aScRange;
ScAddress aScAddress;
- sal_uInt16 nResult = lcl_ParseRange(aScRange, aAddress, pDoc, nSlot);
+ ScRefFlags nResult = lcl_ParseRange(aScRange, aAddress, pDoc, nSlot);
SCTAB nTab = rViewData.GetTabNo();
bool bMark = true;
// Is this a range ?
- if( nResult & SCA_VALID )
+ if( nResult & ScRefFlags::VALID )
{
- if ( nResult & SCA_TAB_3D )
+ if ( nResult & ScRefFlags::TAB_3D )
{
if( aScRange.aStart.Tab() != nTab )
SetTabNo( nTab = aScRange.aStart.Tab() );
@@ -297,9 +297,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
}
// Is this a cell ?
- else if ( (nResult = lcl_ParseAddress(aScAddress, aAddress, pDoc, nSlot)) & SCA_VALID )
+ else if ( (nResult = lcl_ParseAddress(aScAddress, aAddress, pDoc, nSlot)) & ScRefFlags::VALID )
{
- if ( nResult & SCA_TAB_3D )
+ if ( nResult & ScRefFlags::TAB_3D )
{
if( aScAddress.Tab() != nTab )
SetTabNo( nTab = aScAddress.Tab() );
@@ -319,13 +319,13 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
if( ScRangeUtil::MakeRangeFromName( aAddress, pDoc, nTab, aScRange, RUTL_NAMES, eConv ) ||
ScRangeUtil::MakeRangeFromName( aAddress, pDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
{
- nResult |= SCA_VALID;
+ nResult |= ScRefFlags::VALID;
if( aScRange.aStart.Tab() != nTab )
SetTabNo( nTab = aScRange.aStart.Tab() );
}
}
- if ( !(nResult & SCA_VALID) && comphelper::string::isdigitAsciiString(aAddress) )
+ if ( !(nResult & ScRefFlags::VALID) && comphelper::string::isdigitAsciiString(aAddress) )
{
sal_Int32 nNumeric = aAddress.toInt32();
if ( nNumeric > 0 && nNumeric <= MAXROW+1 )
@@ -337,15 +337,15 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
aScAddress.SetTab( nTab );
aScRange = ScRange( aScAddress, aScAddress );
bMark = false;
- nResult = SCA_VALID;
+ nResult = ScRefFlags::VALID;
}
}
if ( !ValidRow(aScRange.aStart.Row()) || !ValidRow(aScRange.aEnd.Row()) )
- nResult = 0;
+ nResult = ScRefFlags::ZERO;
// we have found something
- if( nResult & SCA_VALID )
+ if( nResult & ScRefFlags::VALID )
{
bFound = true;
SCCOL nCol = aScRange.aStart.Col();
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index dd55e5224924..ce8b41cf15b4 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -235,7 +235,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
case SID_CURRENTCELL:
{
ScAddress aScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), 0 );
- OUString aAddr(aScAddress.Format(SCA_ABS, nullptr, pDoc->GetAddressConvention()));
+ OUString aAddr(aScAddress.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention()));
SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
rSet.Put( aPosItem );
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 7ab75c852fe9..54c019aae01c 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -924,7 +924,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint,
do
{
const OUString aToken = pPrint->getToken(0, sep, nPos);
- if ( aRange.ParseAny( aToken, &rDoc, aDetails ) & SCA_VALID )
+ if ( aRange.ParseAny( aToken, &rDoc, aDetails ) & ScRefFlags::VALID )
rDoc.AddPrintRange( nTab, aRange );
}
while (nPos >= 0);
@@ -956,7 +956,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint,
if ( pRepCol->isEmpty() )
rDoc.SetRepeatColRange( nTab, nullptr );
else
- if ( aRange.ParseAny( *pRepCol, &rDoc, aDetails ) & SCA_VALID )
+ if ( aRange.ParseAny( *pRepCol, &rDoc, aDetails ) & ScRefFlags::VALID )
rDoc.SetRepeatColRange( nTab, &aRange );
}
@@ -967,7 +967,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint,
if ( pRepRow->isEmpty() )
rDoc.SetRepeatRowRange( nTab, nullptr );
else
- if ( aRange.ParseAny( *pRepRow, &rDoc, aDetails ) & SCA_VALID )
+ if ( aRange.ParseAny( *pRepRow, &rDoc, aDetails ) & ScRefFlags::VALID )
rDoc.SetRepeatRowRange( nTab, &aRange );
}
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index bbd61e0c005b..9358173278ad 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -397,7 +397,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
else
{
ScAddress aCellPos( nPosX,nPosY,nTab );
- sTarget = aCellPos.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention());
+ sTarget = aCellPos.Format(ScRefFlags::ADDR_ABS_3D, pDoc, pDoc->GetAddressConvention());
}
SfxStringItem aTarget(FN_PARAM_1, sTarget);
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index d655cddfcedc..77f1ef8b3e9f 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -108,7 +108,7 @@ void ScViewFunc::DetectiveRefresh()
static void lcl_jumpToRange(const ScRange& rRange, ScViewData* pView, ScDocument* pDoc)
{
- OUString aAddrText(rRange.Format(SCR_ABS_3D, pDoc));
+ OUString aAddrText(rRange.Format(ScRefFlags::RANGE_ABS_3D, pDoc));
SfxStringItem aPosItem(SID_CURRENTCELL, aAddrText);
SfxBoolItem aUnmarkItem(FN_PARAM_1, true); // remove existing selection
pView->GetDispatcher().Execute(
@@ -189,7 +189,7 @@ void ScViewFunc::DetectiveMarkPred()
aBuf.append(aTabName);
aBuf.append('.');
- OUString aRangeStr(aRange.Format(SCA_VALID));
+ OUString aRangeStr(aRange.Format(ScRefFlags::VALID));
aBuf.append(aRangeStr);
ScGlobal::OpenURL(aBuf.makeStringAndClear(), OUString());
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index a1a84d901110..433e31a4831f 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -146,7 +146,7 @@ void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
if (rRange.aStart != rRange.aEnd)
RefInputStart(mpActiveEdit);
- OUString aStr(rRange.aStart.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention()));
+ OUString aStr(rRange.aStart.Format(ScRefFlags::ADDR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
mpActiveEdit->SetRefString(aStr);
RefEditModified();
@@ -308,7 +308,7 @@ void ScXMLSourceDlg::TreeItemSelected()
const ScAddress& rPos = pUserData->maLinkedPos;
if (rPos.IsValid())
{
- OUString aStr(rPos.Format(SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
+ OUString aStr(rPos.Format(ScRefFlags::ADDR_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
mpRefEdit->SetRefString(aStr);
}
else
@@ -618,8 +618,8 @@ void ScXMLSourceDlg::RefEditModified()
// Check if the address is valid.
ScAddress aLinkedPos;
- sal_uInt16 nRes = aLinkedPos.Parse(aRefStr, mpDoc, mpDoc->GetAddressConvention());
- bool bValid = (nRes & SCA_VALID) == SCA_VALID;
+ ScRefFlags nRes = aLinkedPos.Parse(aRefStr, mpDoc, mpDoc->GetAddressConvention());
+ bool bValid = ( (nRes & ScRefFlags::VALID) == ScRefFlags::VALID );
// TODO: For some unknown reason, setting the ref invalid will hide the text altogether.
// Find out how to make this work.