1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include "cachedattraccess.hxx"
11 #include "document.hxx"
13 ScXMLCachedRowAttrAccess::Cache::Cache() :
14 mnTab(-1), mnRow1(-1), mnRow2(-1), mbValue(false) {}
16 bool ScXMLCachedRowAttrAccess::Cache::hasCache(sal_Int32 nTab
, sal_Int32 nRow
) const
18 return mnTab
== nTab
&& mnRow1
<= nRow
&& nRow
<= mnRow2
;
21 ScXMLCachedRowAttrAccess::ScXMLCachedRowAttrAccess(ScDocument
* pDoc
) :
24 bool ScXMLCachedRowAttrAccess::rowHidden(sal_Int32 nTab
, sal_Int32 nRow
)
26 if (!maHidden
.hasCache(nTab
, nRow
))
29 maHidden
.mbValue
= mpDoc
->RowHidden(
30 static_cast<SCROW
>(nRow
), static_cast<SCTAB
>(nTab
), &nRow1
, &nRow2
);
31 maHidden
.mnRow1
= static_cast<sal_Int32
>(nRow1
);
32 maHidden
.mnRow2
= static_cast<sal_Int32
>(nRow2
);
34 return maHidden
.mbValue
;
37 bool ScXMLCachedRowAttrAccess::rowFiltered(sal_Int32 nTab
, sal_Int32 nRow
)
39 if (!maFiltered
.hasCache(nTab
, nRow
))
42 maFiltered
.mbValue
= mpDoc
->RowFiltered(
43 static_cast<SCROW
>(nRow
), static_cast<SCTAB
>(nTab
), &nRow1
, &nRow2
);
44 maFiltered
.mnRow1
= static_cast<sal_Int32
>(nRow1
);
45 maFiltered
.mnRow2
= static_cast<sal_Int32
>(nRow2
);
47 return maFiltered
.mbValue
;
50 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */