LibreOffice Module sc (master) 1
sheetlimits.hxx
Go to the documentation of this file.
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.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
23#include "address.hxx"
24
25// Because some stuff needs this info, and those objects lifetimes sometimes exceeds the lifetime
26// of the ScDocument.
28{
31
32 ScSheetLimits(SCCOL nMaxCol, SCROW nMaxRow)
33 : mnMaxCol(nMaxCol)
34 , mnMaxRow(nMaxRow)
35 {
36 }
37
39
40 [[nodiscard]] bool ValidCol(SCCOL nCol) const { return ::ValidCol(nCol, mnMaxCol); }
41 [[nodiscard]] bool ValidRow(SCROW nRow) const { return ::ValidRow(nRow, mnMaxRow); }
42 [[nodiscard]] bool ValidColRow(SCCOL nCol, SCROW nRow) const
43 {
45 }
46 [[nodiscard]] bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const
47 {
48 return ::ValidColRowTab(nCol, nRow, nTab, mnMaxCol, mnMaxRow);
49 }
50 [[nodiscard]] bool ValidRange(const ScRange& rRange) const
51 {
53 }
54 [[nodiscard]] bool ValidAddress(const ScAddress& rAddress) const
55 {
57 }
58 [[nodiscard]] SCCOL SanitizeCol(SCCOL nCol) const { return ::SanitizeCol(nCol, mnMaxCol); }
59 [[nodiscard]] SCROW SanitizeRow(SCROW nRow) const { return ::SanitizeRow(nRow, mnMaxRow); }
60
61 // equivalent of MAXROW in address.hxx
62 SCROW MaxRow() const { return mnMaxRow; }
63 // equivalent of MAXCOL in address.hxx
64 SCCOL MaxCol() const { return mnMaxCol; }
65 // equivalent of MAXROWCOUNT in address.hxx
66 SCROW GetMaxRowCount() const { return mnMaxRow + 1; }
67 // equivalent of MAXCOLCOUNT in address.hxx
68 SCCOL GetMaxColCount() const { return mnMaxCol + 1; }
69 // max row number as string
70 OUString MaxRowAsString() const
71 {
72 return mnMaxRow == MAXROW ? OUString(MAXROW_STRING) : OUString(MAXROW_JUMBO_STRING);
73 }
74 // mac col as string ("AMJ" or "XFD")
75 OUString MaxColAsString() const
76 {
77 return mnMaxCol == MAXCOL ? OUString(MAXCOL_STRING) : OUString(MAXCOL_JUMBO_STRING);
78 }
79};
80
81/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ValidColRow(SCCOL nCol, SCROW nRow, SCCOL nMaxCol, SCROW nMaxRow)
Definition: address.hxx:121
SCROW SanitizeRow(SCROW nRow, SCROW nMaxRow)
Definition: address.hxx:139
constexpr OUStringLiteral MAXCOL_JUMBO_STRING(u"XFD")
bool ValidAddress(const ScAddress &rAddress, SCCOL nMaxCol, SCROW nMaxRow)
Definition: address.hxx:488
bool ValidRange(const ScRange &rRange, SCCOL nMaxCol, SCROW nMaxRow)
Definition: address.hxx:786
constexpr OUStringLiteral MAXROW_JUMBO_STRING(u"16777215")
const SCROW MAXROW
Definition: address.hxx:68
constexpr OUStringLiteral MAXCOL_STRING(u"XFD")
constexpr OUStringLiteral MAXROW_STRING(u"1048575")
SCCOL SanitizeCol(SCCOL nCol, SCCOL nMaxCol)
Definition: address.hxx:133
bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL nMaxCol, SCROW nMaxRow)
Definition: address.hxx:127
bool ValidRow(SCROW nRow, SCROW nMaxRow)
Definition: address.hxx:105
const SCCOL MAXCOL
Definition: address.hxx:69
bool ValidCol(SCCOL nCol, SCCOL nMaxCol)
Definition: address.hxx:99
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
OUString MaxRowAsString() const
Definition: sheetlimits.hxx:70
bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: sheetlimits.hxx:46
const SCCOL mnMaxCol
Definition: sheetlimits.hxx:29
SCCOL SanitizeCol(SCCOL nCol) const
Definition: sheetlimits.hxx:58
SCROW GetMaxRowCount() const
Definition: sheetlimits.hxx:66
static SC_DLLPUBLIC ScSheetLimits CreateDefault()
Definition: documen2.cxx:98
SCROW MaxRow() const
Definition: sheetlimits.hxx:62
SCROW SanitizeRow(SCROW nRow) const
Definition: sheetlimits.hxx:59
bool ValidColRow(SCCOL nCol, SCROW nRow) const
Definition: sheetlimits.hxx:42
ScSheetLimits(SCCOL nMaxCol, SCROW nMaxRow)
Maximum addressable row.
Definition: sheetlimits.hxx:32
OUString MaxColAsString() const
Definition: sheetlimits.hxx:75
bool ValidAddress(const ScAddress &rAddress) const
Definition: sheetlimits.hxx:54
bool ValidRow(SCROW nRow) const
Definition: sheetlimits.hxx:41
bool ValidRange(const ScRange &rRange) const
Definition: sheetlimits.hxx:50
const SCROW mnMaxRow
Maximum addressable column.
Definition: sheetlimits.hxx:30
bool ValidCol(SCCOL nCol) const
Definition: sheetlimits.hxx:40
SCCOL MaxCol() const
Definition: sheetlimits.hxx:64
SCCOL GetMaxColCount() const
Definition: sheetlimits.hxx:68
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17