summaryrefslogtreecommitdiff
path: root/sc/source/ui/Accessibility
diff options
context:
space:
mode:
authorAleksas Pantechovskis <alex.pantec@gmail.com>2016-03-28 00:16:42 +0300
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-30 04:34:05 +0000
commitfa7416a6af4b40d9223c27ce58e66b69bdd53fd1 (patch)
tree05d91ba0db0de5b415bedbd4a5b4613d4263a600 /sc/source/ui/Accessibility
parent2c69316037e29db52393d898100e6593a6cd5a24 (diff)
tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc
Change-Id: Ie9a16fa1b44d41cc9d10b50c37ba15f3b7e786c8 Reviewed-on: https://gerrit.libreoffice.org/23561 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/ui/Accessibility')
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx18
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx11
2 files changed, 16 insertions, 13 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index c615155ef4e7..4e5519653f87 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -431,16 +431,18 @@ void ScAccessibleCell::FillDependends(utl::AccessibleRelationSetHelper* pRelatio
void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet)
{
- if (mpDoc && mpDoc->GetCellType(maCellAddress) == CELLTYPE_FORMULA)
+ if (mpDoc)
{
- ScFormulaCell* pCell = mpDoc->GetFormulaCell(maCellAddress);
- if (!pCell)
- return;
- ScDetectiveRefIter aIter(pCell);
- ScRange aRef;
- while ( aIter.GetNextRef( aRef ) )
+ ScRefCellValue aCell(*mpDoc, maCellAddress);
+ if (aCell.meType == CELLTYPE_FORMULA)
{
- AddRelation( aRef, AccessibleRelationType::CONTROLLED_BY, pRelationSet);
+ ScFormulaCell* pCell = aCell.mpFormula;
+ ScDetectiveRefIter aIter(pCell);
+ ScRange aRef;
+ while ( aIter.GetNextRef( aRef ) )
+ {
+ AddRelation( aRef, AccessibleRelationType::CONTROLLED_BY, pRelationSet);
+ }
}
}
}
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 0ff33178fa42..75904774d971 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -25,6 +25,8 @@
#include "AccessibleCell.hxx"
#include "tabvwsh.hxx"
#include "editutil.hxx"
+#include "cellvalue.hxx"
+#include "formulacell.hxx"
#include "document.hxx"
#include "scmod.hxx"
#include "prevwsh.hxx"
@@ -745,15 +747,14 @@ void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, OUString&
if (mpViewShell)
{
const ScViewOptions& aOptions = mpViewShell->GetViewData().GetOptions();
- CellType aCellType;
- rDoc.GetCellType(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), aCellType);
- if (aCellType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS ))
+ ScRefCellValue aCell(rDoc, ScAddress(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab()));
+ if (aCell.meType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS ))
{
- rDoc.GetFormula( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText);
+ aCell.mpFormula->GetFormula(rText);
}
else if (!aOptions.GetOption( VOPT_NULLVALS ))
{
- if ((aCellType == CELLTYPE_VALUE || aCellType == CELLTYPE_FORMULA) && rDoc.GetValue(rCellPos) == 0.0)
+ if ((aCell.meType == CELLTYPE_VALUE || aCell.meType == CELLTYPE_FORMULA) && aCell.getValue() == 0.0)
rText.clear();
}
}