nss: upgrade to release 3.73
[LibreOffice.git] / sc / inc / sheetlimits.hxx
blob31df9d43793b5a33bfc18f73666f7d68981f6ba4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_INC_SHEETLIMITS_HXX
21 #define INCLUDED_SC_INC_SHEETLIMITS_HXX
23 #include <salhelper/simplereferenceobject.hxx>
25 // Because some stuff needs this info, and those objects lifetimes sometimes exceeds the lifetime
26 // of the ScDocument.
27 struct ScSheetLimits final : public salhelper::SimpleReferenceObject
29 const SCCOL mnMaxCol; /// Maximum addressable column
30 const SCROW mnMaxRow; /// Maximum addressable row
32 ScSheetLimits(SCCOL nMaxCol, SCROW nMaxRow)
33 : mnMaxCol(nMaxCol)
34 , mnMaxRow(nMaxRow){}
36 [[nodiscard]] bool ValidCol(SCCOL nCol) const
38 return ::ValidCol(nCol, mnMaxCol);
40 [[nodiscard]] bool ValidRow(SCROW nRow) const { return ::ValidRow(nRow, mnMaxRow); }
41 [[nodiscard]] bool ValidColRow(SCCOL nCol, SCROW nRow) const
43 return ::ValidColRow(nCol, nRow, mnMaxCol, mnMaxRow);
45 [[nodiscard]] bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const
47 return ::ValidColRowTab(nCol, nRow, nTab, mnMaxCol, mnMaxRow);
49 [[nodiscard]] bool ValidRange(const ScRange& rRange) const
51 return ::ValidRange(rRange, mnMaxCol, mnMaxRow);
53 [[nodiscard]] bool ValidAddress(const ScAddress& rAddress) const
55 return ::ValidAddress(rAddress, mnMaxCol, mnMaxRow);
57 [[nodiscard]] SCCOL SanitizeCol(SCCOL nCol) const { return ::SanitizeCol(nCol, mnMaxCol); }
58 [[nodiscard]] SCROW SanitizeRow(SCROW nRow) const { return ::SanitizeRow(nRow, mnMaxRow); }
60 // equivalent of MAXROWCOUNT in address.hxx
61 SCROW GetMaxRowCount() const { return mnMaxRow + 1; }
62 // equivalent of MAXCOLCOUNT in address.hxx
63 SCCOL GetMaxColCount() const { return mnMaxCol + 1; }
66 #endif
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */