[Libreoffice-commits] core.git: sc/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 13 14:29:02 UTC 2021
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 18 +++++++++---------
sc/source/ui/inc/AccessibleSpreadsheet.hxx | 3 ---
2 files changed, 9 insertions(+), 12 deletions(-)
New commits:
commit b307eee222023a2ea0f45bb0cf21db206deb52b4
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Sep 13 11:53:24 2021 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Sep 13 16:28:27 2021 +0200
ScAccessibleSpreadsheet: Use 2 local vars instead of class members
Those vectors are only used in
'ScAccessibleSpreadsheet::CalcScAddressFromRangeList' and cleared
before use, so just use local variables instead.
Also, use a 'std::pair<SCCOL,SCCOL>' instead of a
'std::pair<sal_uInt16,sal_uInt16>' for holding a
pair of column indices and drop the 'PAIR_COL' typedef.
Change-Id: Iacddba03cb72a5cfb6cf3ced0001258ef9db9107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122028
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index d5ec795c64d0..b5e806e379dd 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -69,7 +69,7 @@ ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMa
ScDocument* pDoc= GetDocument(mpViewShell);
sal_Int32 nMinRow = pDoc->MaxRow();
sal_Int32 nMaxRow = 0;
- m_vecTempRange.clear();
+ std::vector<ScRange> aRanges;
size_t nSize = pMarkedRanges->size();
for (size_t i = 0; i < nSize; ++i)
{
@@ -79,7 +79,7 @@ ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMa
if ((maActiveCell.Tab() >= rRange.aStart.Tab()) ||
maActiveCell.Tab() <= rRange.aEnd.Tab())
{
- m_vecTempRange.push_back(rRange);
+ aRanges.push_back(rRange);
nMinRow = std::min(rRange.aStart.Row(),nMinRow);
nMaxRow = std::max(rRange.aEnd.Row(),nMaxRow);
}
@@ -88,7 +88,7 @@ ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMa
}
else if(rRange.aStart.Tab() == maActiveCell.Tab())
{
- m_vecTempRange.push_back(rRange);
+ aRanges.push_back(rRange);
nMinRow = std::min(rRange.aStart.Row(),nMinRow);
nMaxRow = std::max(rRange.aEnd.Row(),nMaxRow);
}
@@ -98,18 +98,18 @@ ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMa
int nCurrentIndex = 0 ;
for(sal_Int32 row = nMinRow ; row <= nMaxRow ; ++row)
{
- m_vecTempCol.clear();
- for (ScRange const & r : m_vecTempRange)
+ std::vector<std::pair<SCCOL, SCCOL>> aVecCol;
+ for (ScRange const & r : aRanges)
{
if ( row >= r.aStart.Row() && row <= r.aEnd.Row())
{
- m_vecTempCol.emplace_back(r.aStart.Col(),r.aEnd.Col());
+ aVecCol.emplace_back(r.aStart.Col(), r.aEnd.Col());
}
}
- std::sort(m_vecTempCol.begin(),m_vecTempCol.end(),CompMinCol);
- for (const PAIR_COL &pairCol : m_vecTempCol)
+ std::sort(aVecCol.begin(), aVecCol.end(), CompMinCol);
+ for (const std::pair<SCCOL, SCCOL> &pairCol : aVecCol)
{
- sal_uInt16 nCol = pairCol.second - pairCol.first + 1;
+ SCCOL nCol = pairCol.second - pairCol.first + 1;
if (nCol + nCurrentIndex > nSelectedChildIndex)
{
return ScMyAddress(static_cast<SCCOL>(pairCol.first + nSelectedChildIndex - nCurrentIndex), row, maActiveCell.Tab());
diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 8f33e5d2ada0..2c708bd776c6 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -267,9 +267,6 @@ private:
ScRange m_aLastWithInMarkRange;
OUString m_strCurCellValue;
ScRangeList m_LastMarkedRanges;
- std::vector<ScRange> m_vecTempRange;
- typedef std::pair<sal_uInt16,sal_uInt16> PAIR_COL;
- std::vector<PAIR_COL> m_vecTempCol;
OUString m_strOldTabName;
};
More information about the Libreoffice-commits
mailing list