summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2017-10-26 17:17:03 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-10-28 03:31:26 +0200
commit9a9cfb1d80cea14abddea3d2e18fedb1549c9293 (patch)
tree62a744efd043ae6dac6fa89f6ae5220f0fe860fe
parent81d50fd137fdf712a0f37988217c43278cf24c26 (diff)
related tdf#38778 Speed-up: Do not traverse the whole array
It is known that text attributes are sorted inside SwpHints. No need to check all entries if special position is provided. Change-Id: Iac92cd40cd6d094d158f3b50fd768f47029ccdce Reviewed-on: https://gerrit.libreoffice.org/43911 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index a43db5d01869..de0820b8204a 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -663,10 +663,16 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
for (size_t i = 0; i < pTextAttrs->Count(); ++i)
{
const SwTextAttr* pHt = pTextAttrs->Get(i);
- if ( ( pHt->HasDummyChar() || pHt->HasContent() )
- && (pHt->GetStart() == nSwPos) )
+ if (nSwPos == pHt->GetStart())
{
- return true;
+ if (pHt->HasDummyChar() || pHt->HasContent() )
+ {
+ return true;
+ }
+ }
+ else if (nSwPos < pHt->GetStart())
+ {
+ break; // sorted by start
}
}
}