diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-06-22 16:41:31 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-06-22 16:46:09 +0400 |
commit | 4cffdb68196d6c23e5134a57018648af5d1f4111 (patch) | |
tree | 52343cbecab4567e1f9667d716622e16648f8c58 | |
parent | 99a05de8245c7365fbb19a7e1ea595ccd3d1224a (diff) |
reuse existing code
Change-Id: I10f3d9958679b485cf75d514a38093cbe51d540e
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index b04a1bd770e4..c04b03db57cd 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2149,58 +2149,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() */ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) const { - // Document page number. - sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect ); - if ( nPageNumOfRect < 0 ) - return -1; - - // What will be the page number of page nPageNumOfRect in the output pdf? - sal_Int32 nRet = -1; - if ( mpRangeEnum ) - { - if ( mbSkipEmptyPages ) - // Map the page number to the range without empty pages. - nPageNumOfRect = maPageNumberMap[ nPageNumOfRect ]; - - if ( mpRangeEnum->hasValue( nPageNumOfRect ) ) - { - sal_Int32 nOutputPageNum = 0; - StringRangeEnumerator::Iterator aIter = mpRangeEnum->begin(); - StringRangeEnumerator::Iterator aEnd = mpRangeEnum->end(); - for ( ; aIter != aEnd; ++aIter ) - { - if ( *aIter == nPageNumOfRect ) - { - nRet = nOutputPageNum; - break; - } - ++nOutputPageNum; - } - } - } - else - { - if ( mbSkipEmptyPages ) - { - sal_Int32 nOutputPageNum = 0; - for ( size_t i = 0; i < maPageNumberMap.size(); ++i ) - { - if ( maPageNumberMap[i] >= 0 ) // is not empty? - { - if ( i == static_cast<size_t>( nPageNumOfRect ) ) - { - nRet = nOutputPageNum; - break; - } - ++nOutputPageNum; - } - } - } - else - nRet = nPageNumOfRect; - } - - return nRet; + std::vector< sal_Int32 > aPageNums = CalcOutputPageNums( rRect ); + if ( !aPageNums.empty() ) + return aPageNums[0]; + return -1; } /* |