Kaydet (Commit) 4cffdb68 authored tarafından Ivan Timofeev's avatar Ivan Timofeev

reuse existing code

Change-Id: I10f3d9958679b485cf75d514a38093cbe51d540e
üst 99a05de8
...@@ -2149,58 +2149,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -2149,58 +2149,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
*/ */
sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) const sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect& rRect ) const
{ {
// Document page number. std::vector< sal_Int32 > aPageNums = CalcOutputPageNums( rRect );
sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect ); if ( !aPageNums.empty() )
if ( nPageNumOfRect < 0 ) return aPageNums[0];
return -1; 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;
} }
/* /*
......
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