From dcbceb945b7a282c1a1309cf07e62ecc925e98f6 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 26 Jun 2015 20:05:54 +0200 Subject: use ScComplexRefData::IsEntireCol() and IsEntireRow() Change-Id: I4287019f5492825f6d295c4e364405f0d7329eb7 --- sc/inc/refdata.hxx | 14 ++++++++++++++ sc/source/core/tool/compiler.cxx | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index e0d9b807a78b..c49682f67534 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -146,6 +146,20 @@ struct ScComplexRefData tab if one sheet, or >=0 if more than one sheets. */ bool ValidExternal() const; + /** Whether this references entire columns, A:A */ + inline bool IsEntireCol() const + { + // Both row anchors must be absolute. + return Ref1.Row() == 0 && Ref2.Row() == MAXROW && !Ref1.IsRowRel() && !Ref2.IsRowRel(); + } + + /** Whether this references entire rows, 1:1 */ + inline bool IsEntireRow() const + { + // Both column anchors must be absolute. + return Ref1.Col() == 0 && Ref2.Col() == MAXCOL && !Ref1.IsColRel() && !Ref2.IsColRel(); + } + SC_DLLPUBLIC ScRange toAbs( const ScAddress& rPos ) const; void SetRange( const ScRange& rRange, const ScAddress& rPos ); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 9251731997f4..e75bce80a222 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -829,12 +829,12 @@ struct ConventionOOO_A1 : public Convention_A1 !ValidCol(rAbs2.Col()) || rRef.Ref2.IsColDeleted() || !ValidRow(rAbs2.Row()) || rRef.Ref2.IsRowDeleted()) return SINGLETON_NONE; - // A:A or $A:$A or A:$A or $A:A, both row anchors must be absolute. - if (rAbs1.Row() == 0 && rAbs2.Row() == MAXROW && !rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel()) + // A:A or $A:$A or A:$A or $A:A + if (rRef.IsEntireCol()) return SINGLETON_COL; - // 1:1 or $1:$1 or 1:$1 or $1:1, both column anchors must be absolute. - if (rAbs1.Col() == 0 && rAbs2.Col() == MAXCOL && !rRef.Ref1.IsColRel() && !rRef.Ref2.IsColRel()) + // 1:1 or $1:$1 or 1:$1 or $1:1 + if (rRef.IsEntireRow()) return SINGLETON_ROW; return SINGLETON_NONE; -- cgit