[Libreoffice-commits] core.git: sc/inc
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 11 14:46:03 UTC 2019
sc/inc/address.hxx | 32 ++++++++++++++++----------------
sc/inc/document.hxx | 8 ++++++++
sc/inc/table.hxx | 7 +++++--
3 files changed, 29 insertions(+), 18 deletions(-)
New commits:
commit 79f80e21022f897de27ba37c516bb0e6e64693ce
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Dec 11 12:21:01 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 11 15:44:51 2019 +0100
sc: rowcol: tdf#50916 initial conversion of Valid* methods
just default the params for now
Change-Id: I13ee78aeaa1133a167d57520b334d5e644e28ece
Reviewed-on: https://gerrit.libreoffice.org/84926
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index ebd9f022b1be..1d6680cb8ebf 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -88,14 +88,14 @@ const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
const SCROW MAXROW_30 = 8191;
-[[nodiscard]] inline bool ValidCol( SCCOL nCol )
+[[nodiscard]] inline bool ValidCol( SCCOL nCol, SCCOL nMaxCol = MAXCOL )
{
- return nCol >= 0 && nCol <= MAXCOL;
+ return nCol >= 0 && nCol <= nMaxCol;
}
-[[nodiscard]] inline bool ValidRow( SCROW nRow )
+[[nodiscard]] inline bool ValidRow( SCROW nRow, SCROW nMaxRow = MAXROW)
{
- return nRow >= 0 && nRow <= MAXROW;
+ return nRow >= 0 && nRow <= nMaxRow;
}
[[nodiscard]] inline bool ValidTab( SCTAB nTab )
@@ -108,24 +108,24 @@ const SCROW MAXROW_30 = 8191;
return nTab >= 0 && nTab <= nMaxTab;
}
-[[nodiscard]] inline bool ValidColRow( SCCOL nCol, SCROW nRow )
+[[nodiscard]] inline bool ValidColRow( SCCOL nCol, SCROW nRow, SCCOL nMaxCol = MAXCOL, SCROW nMaxRow = MAXROW )
{
- return ValidCol( nCol) && ValidRow( nRow);
+ return ValidCol(nCol,nMaxCol) && ValidRow(nRow,nMaxRow);
}
-[[nodiscard]] inline bool ValidColRowTab( SCCOL nCol, SCROW nRow, SCTAB nTab )
+[[nodiscard]] inline bool ValidColRowTab( SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL nMaxCol = MAXCOL, SCROW nMaxRow = MAXROW )
{
- return ValidCol( nCol) && ValidRow( nRow) && ValidTab( nTab);
+ return ValidCol(nCol,nMaxCol) && ValidRow(nRow,nMaxRow) && ValidTab( nTab);
}
-[[nodiscard]] inline SCCOL SanitizeCol( SCCOL nCol )
+[[nodiscard]] inline SCCOL SanitizeCol( SCCOL nCol, SCCOL nMaxCol = MAXCOL )
{
- return nCol < 0 ? 0 : (nCol > MAXCOL ? MAXCOL : nCol);
+ return nCol < 0 ? 0 : (nCol > nMaxCol ? nMaxCol : nCol);
}
-[[nodiscard]] inline SCROW SanitizeRow( SCROW nRow )
+[[nodiscard]] inline SCROW SanitizeRow( SCROW nRow, SCROW nMaxRow = MAXROW )
{
- return nRow < 0 ? 0 : (nRow > MAXROW ? MAXROW : nRow);
+ return nRow < 0 ? 0 : (nRow > nMaxRow ? nMaxRow : nRow);
}
[[nodiscard]] inline SCTAB SanitizeTab( SCTAB nTab )
@@ -480,9 +480,9 @@ struct ScAddressHashFunctor
}
};
-inline bool ValidAddress( const ScAddress& rAddress )
+inline bool ValidAddress( const ScAddress& rAddress, SCCOL nMaxCol = MAXCOL, SCROW nMaxRow = MAXROW )
{
- return ValidCol(rAddress.Col()) && ValidRow(rAddress.Row()) && ValidTab(rAddress.Tab());
+ return ValidCol(rAddress.Col(), nMaxCol) && ValidRow(rAddress.Row(), nMaxRow) && ValidTab(rAddress.Tab());
}
// ScRange
@@ -782,9 +782,9 @@ inline size_t ScRange::hashStartColumn() const
#endif
}
-inline bool ValidRange( const ScRange& rRange )
+inline bool ValidRange( const ScRange& rRange, SCCOL nMaxCol = MAXCOL, SCROW nMaxRow = MAXROW )
{
- return ValidAddress(rRange.aStart) && ValidAddress(rRange.aEnd);
+ return ValidAddress(rRange.aStart, nMaxCol, nMaxRow) && ValidAddress(rRange.aEnd, nMaxCol, nMaxRow);
}
// ScRangePair
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d774cdbdd3ce..e160c8d4b735 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -858,6 +858,14 @@ public:
SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const;
SC_DLLPUBLIC SCCOL MaxCol() const { return mnMaxCol; }
SC_DLLPUBLIC SCROW MaxRow() const { return mnMaxRow; }
+ [[nodiscard]] bool ValidCol(SCCOL nCol) const { return ::ValidCol(nCol, mnMaxCol); }
+ [[nodiscard]] bool ValidRow(SCROW nRow) const { return ::ValidRow(nRow, mnMaxRow); }
+ [[nodiscard]] bool ValidColRow(SCCOL nCol, SCROW nRow) const { return ::ValidColRow(nCol, nRow, mnMaxCol, mnMaxRow); }
+ [[nodiscard]] bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const { return ::ValidColRowTab(nCol, nRow, nTab, mnMaxCol, mnMaxRow); }
+ [[nodiscard]] bool ValidRange(const ScRange& rRange) const { return ::ValidRange(rRange, mnMaxCol, mnMaxRow); }
+ [[nodiscard]] bool ValidAddress(const ScAddress& rAddress) const { return ::ValidAddress(rAddress, mnMaxCol, mnMaxRow); }
+ [[nodiscard]] SCCOL SanitizeCol( SCCOL nCol ) const { return ::SanitizeCol(nCol, mnMaxCol); }
+ [[nodiscard]] SCROW SanitizeRow( SCROW nRow ) const { return ::SanitizeRow(nRow, mnMaxRow); }
SC_DLLPUBLIC std::vector<OUString> GetAllTableNames() const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 49ff6b2a96ea..681167b9c5f6 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -315,12 +315,15 @@ public:
}
[[nodiscard]] bool IsColRowValid( const SCCOL nScCol, const SCROW nScRow ) const
{
- return IsColValid( nScCol ) && ValidRow( nScRow );
+ return IsColValid( nScCol ) && GetDoc().ValidRow( nScRow );
}
[[nodiscard]] bool IsColRowTabValid( const SCCOL nScCol, const SCROW nScRow, const SCTAB nScTab ) const
{
- return IsColValid( nScCol ) && ValidRow( nScRow ) && ValidTab( nScTab );
+ return IsColValid( nScCol ) && GetDoc().ValidRow( nScRow ) && ValidTab( nScTab );
}
+ [[nodiscard]] bool ValidCol(SCCOL nCol) const { return GetDoc().ValidCol(nCol); }
+ [[nodiscard]] bool ValidRow(SCROW nRow) const { return GetDoc().ValidRow(nRow); }
+ [[nodiscard]] bool ValidColRow(SCCOL nCol, SCROW nRow) const { return GetDoc().ValidColRow(nCol, nRow); }
bool IsPendingRowHeights() const { return bPendingRowHeights; }
void SetPendingRowHeights( bool bSet );
More information about the Libreoffice-commits
mailing list