LibreOffice Module sc (master) 1
cachedattraccess.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
10#include "cachedattraccess.hxx"
11#include <document.hxx>
12
14 mnTab(-1), mnRow1(-1), mnRow2(-1), mbValue(false) {}
15
16bool ScXMLCachedRowAttrAccess::Cache::hasCache(sal_Int32 nTab, sal_Int32 nRow) const
17{
18 return mnTab == nTab && mnRow1 <= nRow && nRow <= mnRow2;
19}
20
22 mpDoc(pDoc) {}
23
24bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow)
25{
26 if (!maHidden.hasCache(nTab, nRow))
27 {
28 SCROW nRow1, nRow2;
30 static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), &nRow1, &nRow2);
31 maHidden.mnTab = nTab;
32 maHidden.mnRow1 = static_cast<sal_Int32>(nRow1);
33 maHidden.mnRow2 = static_cast<sal_Int32>(nRow2);
34 }
35
36 nEndRow = maHidden.mnRow2;
37 return maHidden.mbValue;
38}
39
40bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab, sal_Int32 nRow, sal_Int32& nEndRow)
41{
42 if (!maFiltered.hasCache(nTab, nRow))
43 {
44 SCROW nRow1, nRow2;
46 static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), &nRow1, &nRow2);
47 maFiltered.mnTab = nTab;
48 maFiltered.mnRow1 = static_cast<sal_Int32>(nRow1);
49 maFiltered.mnRow2 = static_cast<sal_Int32>(nRow2);
50 }
51 nEndRow = maFiltered.mnRow2;
52 return maFiltered.mbValue;
53}
54
55/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4475
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
bool rowFiltered(sal_Int32 nTab, sal_Int32 nRow, sal_Int32 &nEndRow)
bool rowHidden(sal_Int32 nTab, sal_Int32 nRow, sal_Int32 &nEndRow)
ScXMLCachedRowAttrAccess(ScDocument *pDoc)
bool hasCache(sal_Int32 nTab, sal_Int32 nRow) const
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int32 SCROW
Definition: types.hxx:17