Issue 85205 - SaveAs PPT Deletes Interactions Using Named Objects
Summary: SaveAs PPT Deletes Interactions Using Named Objects
Status: CONFIRMED
Alias: None
Product: Impress
Classification: Application
Component: save-export (show other issues)
Version: OOo 2.3.1
Hardware: PC All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL: http://www.oooforum.org/forum/viewtop...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-13 18:39 UTC by briceman
Modified: 2013-08-07 15:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description briceman 2008-01-13 18:39:24 UTC
MS PPTViewer 2003 does not support Interactions which "Go to Page or Object" 
and target a Named Object. 

On export to PPT, Interactions which Goto a Named Object are *all* replaced 
with Goto Page 1. Thus the exported PPT presentations are broken.

The ideal solution would be to dereference the Named Object's Page Number and 
export that instead. PPTViewer 2003 seems to handle only hard coded page 
numbers.

Named Objects are a powerful tool for organizing large, complex presentations. 
But they are unusable if they can't be exported to PowerPoint. Please fix. 
Thanks!
Comment 1 briceman 2008-01-13 19:35:38 UTC
It appears that *all* Interactions of the type "Goto Page or Object" utilize 
the OnClick type of com.sun.star.presentation.ClickAction.BOOKMARK. Page number 
targets are simply coded as bookmarks formed as "page#".

This means that the PPT export issue is likely located in the code that parses 
the bookmark strings. It probably isn't checking for strings that do NOT have 
the format "page#". In those cases it should be getting the bookmark anchor, 
then the page number for the anchor, and then exporting a hard coded page 
number for PowerPoint compatibility. 

If the same dereferencing code will also work on the "page#" bookmarks, then no 
checking of format need be done -- simply dereference ALL bookmarks and 
determine the page number of their anchors.
Comment 2 briceman 2008-01-13 23:24:49 UTC
... the following macro tries to update all oShape.Bookmark strings to point to 
hard coded Page Numbers instead of Named Objects. Running this before exporting 
to PPT will keep the presentation from breaking in PPTViewer 2003.


REM  *****  BASIC  *****

Sub UpdateBookmarks

	Dim oDPages
	Dim oPage
	Dim oShape
	Dim i%
	Dim j%
	Dim k%
	Dim s$

	Dim tableSize%
	tableSize = 100
	Dim objectNames(tableSize + 1) as String
	Dim objectPages(tableSize + 1) as Integer
	Dim objectCount%
	objectCount = 0

	Dim bookmark$
	Dim found As Boolean
	Dim trace As Boolean
	trace = False
	
	oDPages = ThisComponent.getDrawPages()


REM build a table or all Named Objects and their Page Numbers
	For i = 1 To oDPages.getCount()
		oPage = oDPages.getByIndex(i-1)

		For j = 1 To oPage.getCount()
			oShape = oPage.getByIndex(j-1)

			If (oShape.getName <> "") Then
				
				If (trace) Then
					s = "Named Shape '" & oShape.getName 
& "' Found on Page " & i
					Print s
				End If
				
				objectCount = objectCount + 1
				
				REM resize table arrays if needed
				If (objectCount >= tableSize) Then
					tableSize = tableSize + 100
					ReDim Preserve objectNames(tableSize) 
as String
					ReDim Preserve objectPages(tableSize) 
as Integer
				End If
				
				objectNames(objectCount) = oShape.getName
				objectPages(objectCount) = i
				
			End If
		Next
	Next

REM find Shapes with "Goto Page or Object" Interactions and
REM update oShape.Bookmark to point to Page Number of the Named Object
	For i = 1 To oDPages.getCount()
		oPage = oDPages.getByIndex(i-1)

		For j = 1 To oPage.getCount()
			oShape = oPage.getByIndex(j-1)

			If (oShape.OnClick = 
com.sun.star.presentation.ClickAction.BOOKMARK) _
				AND (Left(oShape.Bookmark, 4) <> "page") Then
				
				If (trace) Then				
					s = "Page " & i & " : Shape " & j 
					s = s & " (" & oShape.getName & ")"
					s = s & " : OnClick --> " & 
oShape.Bookmark
					Print s
				End If
				
				REM scan through the pre-built tables 
				bookmark = oShape.Bookmark
				found = False
				For k = 1 To objectCount
					If (objectNames(k) = bookmark) Then
		
						If (trace) Then
							s = "Page " & i & " : 
Shape " & j 
							s = s & " (" & 
oShape.getName & ")"
							s = s & " : Updating 
" & oShape.Bookmark 
							s = s & " --> page" & 
objectPages(k)
							Print s
						End If

						found = True
						oShape.Bookmark = "page" & 
objectPages(k)
					End If
				Next
				
				REM trap unknown targets (should not happen)
				If (found = False) Then
					s = "ERROR!!"
					s = "Page " & i & " : Shape " & j 
					s = s & " (" & oShape.getName & ")"
					s = s & " : OnClick --> " & 
oShape.Bookmark
					s = s & "BUT NO SUCH NAMED SHAPE 
EXISTS!!"
					s = s & "... Continuing Anyhow... Click 
OK."
					Print s
				End If
				
			End If
		Next
	Next
		
End Sub		
				
Comment 3 christian.guenther 2008-01-22 17:43:46 UTC
Set to new and change the target.
Comment 4 christian.guenther 2008-01-22 17:47:34 UTC
The interaction goto object should exported to ppt as goto slide because ppt
didn't support goto object. Please have a look if it is possible to implement
this enhancement in this way.