1 |
From 74879ff0ef14db47365650819bbe7c9f105b057a Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Wed, 8 Jul 2015 12:24:46 +0100 |
4 |
Subject: [PATCH] when skipping hidden pages omit the hidden pages from page |
5 |
bookmarks |
6 |
|
7 |
three slides, set second to hidden, export to pdf (without toggling |
8 |
on include hidden slides), in evince/acroread click on the "slide 3" |
9 |
title, and the viewers will not jump to that slide, seeing as the |
10 |
index is mis-calculated assuming 1-1 export-import pages |
11 |
|
12 |
Change-Id: I2f21eb655684ac4cb06384a8e9a17b419f644f3f |
13 |
--- |
14 |
sd/source/ui/unoidl/unomodel.cxx | 26 ++++++++++++++++++++++++-- |
15 |
1 file changed, 24 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx |
18 |
index 2d72378..472edac 100644 |
19 |
--- a/sd/source/ui/unoidl/unomodel.cxx |
20 |
+++ b/sd/source/ui/unoidl/unomodel.cxx |
21 |
@@ -1851,6 +1851,25 @@ bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const |
22 |
return bPrintable; |
23 |
|
24 |
} |
25 |
+ |
26 |
+namespace |
27 |
+{ |
28 |
+ sal_Int16 CalcOutputPageNum(vcl::PDFExtOutDevData* pPDFExtOutDevData, SdDrawDocument *pDoc, sal_Int16 nPageNumber) |
29 |
+ { |
30 |
+ //export all pages, simple one to one case |
31 |
+ if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides()) |
32 |
+ return nPageNumber-1; |
33 |
+ //check all preceding pages, and only count non-hidden ones |
34 |
+ sal_Int16 nRet = 0; |
35 |
+ for (sal_Int16 i = 0; i < nPageNumber-1; ++i) |
36 |
+ { |
37 |
+ if (!(pDoc->GetSdPage(i, PK_STANDARD))->IsExcluded()) |
38 |
+ ++nRet; |
39 |
+ } |
40 |
+ return nRet; |
41 |
+ } |
42 |
+} |
43 |
+ |
44 |
void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection, |
45 |
const uno::Sequence< beans::PropertyValue >& rxOptions ) |
46 |
throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) |
47 |
@@ -2135,9 +2154,12 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r |
48 |
OUString aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName(); |
49 |
if( !aPageName.isEmpty() ) |
50 |
{ |
51 |
+ // Destination PageNum |
52 |
+ const sal_Int32 nDestPageNum = CalcOutputPageNum(pPDFExtOutDevData, mpDoc, nPageNumber); |
53 |
+ |
54 |
// insert the bookmark to this page into the NamedDestinations |
55 |
if( pPDFExtOutDevData->GetIsExportNamedDestinations() ) |
56 |
- pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 ); |
57 |
+ pPDFExtOutDevData->CreateNamedDest(aPageName, aPageRect, nDestPageNum); |
58 |
|
59 |
// add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx |
60 |
// issue #i40318. |
61 |
@@ -2146,7 +2168,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r |
62 |
{ |
63 |
// Destination Export |
64 |
const sal_Int32 nDestId = |
65 |
- pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 ); |
66 |
+ pPDFExtOutDevData->CreateDest(aPageRect , nDestPageNum); |
67 |
|
68 |
// Create a new outline item: |
69 |
pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId ); |
70 |
-- |
71 |
2.4.0 |
72 |
|