summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-02-21 09:00:16 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-02-21 17:45:01 +0100
commit43f04e78a33fbe25aaaef7a72f0f1bb5da007955 (patch)
treee5bd3fd56b8cf8cd0c6e04df7840b5928c459377
parent2b3aa996b385cab856b30b7be2f54cbcc59446eb (diff)
Do not compare OUStrings twice
Change-Id: I94f7cecf5b39c1f03b9f10a13b5efa63bb06ced8
-rw-r--r--sw/source/core/doc/docnum.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index ee294d272918..77dfbc5bfdde 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -570,17 +570,20 @@ static sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const OUString& rNam
for( SwOutlineNodes::size_type n = 0; n < rOutlNds.size(); ++n )
{
SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
- OUString sTxt( pTxtNd->GetExpandTxt() );
- if (sTxt == rName)
+ const OUString sTxt( pTxtNd->GetExpandTxt() );
+ if (sTxt.startsWith(rName))
{
- // Found "exact", set Pos to the Node
- nSavePos = n;
- break;
- }
- else if( !bExact && USHRT_MAX == nSavePos && sTxt.startsWith(rName) )
- {
- // maybe we just found the text's first part
- nSavePos = n;
+ if (sTxt.getLength() == rName.getLength())
+ {
+ // Found "exact", set Pos to the Node
+ nSavePos = n;
+ break;
+ }
+ else if( !bExact && USHRT_MAX == nSavePos )
+ {
+ // maybe we just found the text's first part
+ nSavePos = n;
+ }
}
}