summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-02-21 09:39:12 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-02-21 17:45:01 +0100
commit8d219ce09375535ffbe3ae997549ee944b43117c (patch)
treefa63e7af6a49cc4e8669746fb274968cdf4c4db7
parent43f04e78a33fbe25aaaef7a72f0f1bb5da007955 (diff)
SwOutlineNodes are already available
Change-Id: I384308ebffcdbc6df0ee752339dd49957f7d4bbb
-rw-r--r--sw/source/core/doc/docnum.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 77dfbc5bfdde..a89ebce60329 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -562,11 +562,10 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
return MoveParagraph( aPam, nOffs, true );
}
-static sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const OUString& rName,
+static sal_uInt16 lcl_FindOutlineName( const SwOutlineNodes& rOutlNds, const OUString& rName,
bool bExact )
{
sal_uInt16 nSavePos = USHRT_MAX;
- const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
for( SwOutlineNodes::size_type n = 0; n < rOutlNds.size(); ++n )
{
SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
@@ -590,7 +589,7 @@ static sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const OUString& rNam
return nSavePos;
}
-static sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, OUString& rName )
+static sal_uInt16 lcl_FindOutlineNum( const SwOutlineNodes& rOutlNds, OUString& rName )
{
// Valid numbers are (always just offsets!):
// ([Number]+\.)+ (as a regular expression!)
@@ -633,11 +632,12 @@ static sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, OUString& rName )
rName = sName; // that's the follow-up text
// read all levels, so search the document for this outline
- const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+
// Without OutlineNodes searching doesn't pay off
// and we save a crash
if( rOutlNds.empty() )
return USHRT_MAX;
+
SwTxtNode* pNd;
nPos = 0;
// search in the existing outline nodes for the required outline num array
@@ -700,7 +700,7 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
// 1. step: via the Number:
OUString sName( rName );
- sal_uInt16 nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName );
+ sal_uInt16 nFndPos = ::lcl_FindOutlineNum( rOutlNds, sName );
if( USHRT_MAX != nFndPos )
{
SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();
@@ -720,7 +720,7 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
if( sExpandedText != sName )
{
- sal_uInt16 nTmp = ::lcl_FindOutlineName( GetNodes(), sName, true );
+ sal_uInt16 nTmp = ::lcl_FindOutlineName( rOutlNds, sName, true );
if( USHRT_MAX != nTmp ) // found via the Name
{
nFndPos = nTmp;
@@ -732,7 +732,7 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
return true;
}
- nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, false );
+ nFndPos = ::lcl_FindOutlineName( rOutlNds, rName, false );
if( USHRT_MAX != nFndPos )
{
SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();
@@ -744,7 +744,7 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
// #i68289# additional search on hyperlink URL without its outline numbering part
if ( sName != rName )
{
- nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, false );
+ nFndPos = ::lcl_FindOutlineName( rOutlNds, sName, false );
if( USHRT_MAX != nFndPos )
{
SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode();