Kaydet (Commit) 99a05de8 authored tarafından Ivan Timofeev's avatar Ivan Timofeev

rely on the return value optimization

Change-Id: Ide566aa8bbf6f4128bed598c76269b16acf99a7b
üst ae0c9254
...@@ -238,7 +238,7 @@ class SwEnhancedPDFExportHelper ...@@ -238,7 +238,7 @@ class SwEnhancedPDFExportHelper
void EnhancedPDFExport(); void EnhancedPDFExport();
sal_Int32 CalcOutputPageNum( const SwRect& rRect ) const; sal_Int32 CalcOutputPageNum( const SwRect& rRect ) const;
void CalcOutputPageNums( const SwRect& rRect, std::vector<sal_Int32>& rPageNums ) const; std::vector< sal_Int32 > CalcOutputPageNums( const SwRect& rRect ) const;
void MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData, void MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData,
const SwTxtNode& rTNd, const SwRect& rLinkRect, const SwTxtNode& rTNd, const SwRect& rLinkRect,
......
...@@ -1627,8 +1627,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1627,8 +1627,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const SwRect& rNoteRect = mrSh.GetCharRect(); const SwRect& rNoteRect = mrSh.GetCharRect();
// Link PageNums // Link PageNums
std::vector<sal_Int32> aNotePageNums; std::vector<sal_Int32> aNotePageNums = CalcOutputPageNums( rNoteRect );
CalcOutputPageNums( rNoteRect, aNotePageNums );
for ( size_t nNumIdx = 0; nNumIdx < aNotePageNums.size(); ++nNumIdx ) for ( size_t nNumIdx = 0; nNumIdx < aNotePageNums.size(); ++nNumIdx )
{ {
// Link Note // Link Note
...@@ -1740,8 +1739,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1740,8 +1739,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const SwRect& rLinkRect( aTmp[ i ] ); const SwRect& rLinkRect( aTmp[ i ] );
// Link PageNums // Link PageNums
std::vector<sal_Int32> aLinkPageNums; std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( rLinkRect );
CalcOutputPageNums( rLinkRect, aLinkPageNums );
for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx ) for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
{ {
...@@ -1810,8 +1808,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1810,8 +1808,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const SwRect aLinkRect = pFrmFmt->FindLayoutRect( sal_False, &aNullPt ); const SwRect aLinkRect = pFrmFmt->FindLayoutRect( sal_False, &aNullPt );
// Link PageNums // Link PageNums
std::vector<sal_Int32> aLinkPageNums; std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
CalcOutputPageNums( aLinkRect, aLinkPageNums );
// Link Export // Link Export
for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx ) for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
...@@ -1900,8 +1897,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1900,8 +1897,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const SwRect& rLinkRect( aTmp[ i ] ); const SwRect& rLinkRect( aTmp[ i ] );
// Link PageNums // Link PageNums
std::vector<sal_Int32> aLinkPageNums; std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( rLinkRect );
CalcOutputPageNums( rLinkRect, aLinkPageNums );
for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx ) for ( size_t nNumIdx = 0; nNumIdx < aLinkPageNums.size(); ++nNumIdx )
{ {
...@@ -1969,8 +1965,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1969,8 +1965,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
if ( mrSh.GotoFtnTxt() ) if ( mrSh.GotoFtnTxt() )
{ {
// Link PageNums // Link PageNums
std::vector<sal_Int32> aLinkPageNums; std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
CalcOutputPageNums( aLinkRect, aLinkPageNums );
// Destination Rectangle // Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect(); const SwRect& rDestRect = mrSh.GetCharRect();
...@@ -2211,19 +2206,19 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) co ...@@ -2211,19 +2206,19 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) co
/* /*
* SwEnhancedPDFExportHelper::CalcOutputPageNums() * SwEnhancedPDFExportHelper::CalcOutputPageNums()
* *
* Fills rPageNums with the page numbers in the output pdf on which the given * Returns a vector of the page numbers in the output pdf on which the given
* rect is located. There can be many such pages since StringRangeEnumerator * rect is located. There can be many such pages since StringRangeEnumerator
* allows duplication of its entries. * allows duplication of its entries.
*/ */
void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect, std::vector< sal_Int32 > SwEnhancedPDFExportHelper::CalcOutputPageNums(
std::vector<sal_Int32>& rPageNums ) const const SwRect& rRect ) const
{ {
rPageNums.clear(); std::vector< sal_Int32 > aPageNums;
// Document page number. // Document page number.
sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect ); sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect );
if ( nPageNumOfRect < 0 ) if ( nPageNumOfRect < 0 )
return; return aPageNums;
// What will be the page numbers of page nPageNumOfRect in the output pdf? // What will be the page numbers of page nPageNumOfRect in the output pdf?
if ( mpRangeEnum ) if ( mpRangeEnum )
...@@ -2240,7 +2235,7 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect, ...@@ -2240,7 +2235,7 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
for ( ; aIter != aEnd; ++aIter ) for ( ; aIter != aEnd; ++aIter )
{ {
if ( *aIter == nPageNumOfRect ) if ( *aIter == nPageNumOfRect )
rPageNums.push_back( nOutputPageNum ); aPageNums.push_back( nOutputPageNum );
++nOutputPageNum; ++nOutputPageNum;
} }
} }
...@@ -2256,7 +2251,7 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect, ...@@ -2256,7 +2251,7 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
{ {
if ( i == static_cast<size_t>( nPageNumOfRect ) ) if ( i == static_cast<size_t>( nPageNumOfRect ) )
{ {
rPageNums.push_back( nOutputPageNum ); aPageNums.push_back( nOutputPageNum );
break; break;
} }
++nOutputPageNum; ++nOutputPageNum;
...@@ -2264,8 +2259,10 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect, ...@@ -2264,8 +2259,10 @@ void SwEnhancedPDFExportHelper::CalcOutputPageNums( const SwRect& rRect,
} }
} }
else else
rPageNums.push_back( nPageNumOfRect ); aPageNums.push_back( nPageNumOfRect );
} }
return aPageNums;
} }
void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData, void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData,
...@@ -2293,8 +2290,7 @@ void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rP ...@@ -2293,8 +2290,7 @@ void SwEnhancedPDFExportHelper::MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rP
if ( aHFLinkRect.Pos() != rLinkRect.Pos() ) if ( aHFLinkRect.Pos() != rLinkRect.Pos() )
{ {
// Link PageNums // Link PageNums
std::vector<sal_Int32> aHFLinkPageNums; std::vector<sal_Int32> aHFLinkPageNums = CalcOutputPageNums( aHFLinkRect );
CalcOutputPageNums( aHFLinkRect, aHFLinkPageNums );
for ( size_t nNumIdx = 0; nNumIdx < aHFLinkPageNums.size(); ++nNumIdx ) for ( size_t nNumIdx = 0; nNumIdx < aHFLinkPageNums.size(); ++nNumIdx )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment