summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-08 12:32:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-07-08 14:25:20 +0100
commit57e5bf760fa84ec84abd3a93e1623aa045d410e1 (patch)
treefc54384c2d4fdbef21d9658357e02055e167cb8d /sd
parent3e8cb7da52e84b03b309b68708889fc42789b722 (diff)
when skipping hidden pages to pdf adjust dest page indexes
when setting the page bookmarks. three slides, set second to hidden, export to pdf (without toggling on include hidden slides), in evince/acroread click on the "slide 3" title, and the viewers will not jump to that slide, seeing as the index is mis-calculated assuming 1-1 export-import pages Change-Id: I5784100c2444ca480984914e67c8b7e376a2ec47
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index dd71a82d7ac5..04c61c14637f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1855,6 +1855,25 @@ bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
return bPrintable;
}
+
+namespace
+{
+ sal_Int16 CalcOutputPageNum(vcl::PDFExtOutDevData* pPDFExtOutDevData, SdDrawDocument *pDoc, sal_Int16 nPageNumber)
+ {
+ //export all pages, simple one to one case
+ if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides())
+ return nPageNumber-1;
+ //check all preceding pages, and only count non-hidden ones
+ sal_Int16 nRet = 0;
+ for (sal_Int16 i = 0; i < nPageNumber-1; ++i)
+ {
+ if (!(pDoc->GetSdPage(i, PK_STANDARD))->IsExcluded())
+ ++nRet;
+ }
+ return nRet;
+ }
+}
+
void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
const uno::Sequence< beans::PropertyValue >& rxOptions )
throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
@@ -2139,9 +2158,12 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
OUString aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName();
if( !aPageName.isEmpty() )
{
+ // Destination PageNum
+ const sal_Int32 nDestPageNum = CalcOutputPageNum(pPDFExtOutDevData, mpDoc, nPageNumber);
+
// insert the bookmark to this page into the NamedDestinations
if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
- pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 );
+ pPDFExtOutDevData->CreateNamedDest(aPageName, aPageRect, nDestPageNum);
// add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
// issue #i40318.
@@ -2150,7 +2172,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
{
// Destination Export
const sal_Int32 nDestId =
- pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
+ pPDFExtOutDevData->CreateDest(aPageRect , nDestPageNum);
// Create a new outline item:
pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );