monperrus / ExpandAnimations

LibreOffice/OpenOffice.org extension to expand animations before exporting to PDF. Looking for maintainers.
https://github.com/monperrus/ExpandAnimations
GNU Lesser General Public License v3.0
230 stars 30 forks source link

Error on LibreOffice 3.5 #3

Closed ebugnet closed 11 years ago

ebugnet commented 11 years ago

Hi, I got an error on LO 3.5

New file is created, loaded, some slides are generated... but :

Macro stop on slide.remove(shapes(n)) from :

' remove from the given slide all shapes that are invisible in the specified frame sub removeInvisibleShapes(slide as Object, visibility, frame as Integer) shapes = getAnimatedShapes(slide) for n = 0 to UBound(shapes) if visibility(n, frame) = false then slide.remove(shapes(n)) <------ HERE end if next end sub

Message is : Cannot coerce argument type during corereflection call!

Have any idea ? Thanks Eric

monperrus commented 11 years ago

Seems similar to https://github.com/monperrus/ExpandAnimations/issues/1 Do your animations involve text fragments?

ebugnet commented 11 years ago

I think it was, but no ! I test again with a new file, just one slide, one word in title, one word in text boxe (write here)... Animate with appear effect only... Same symptoms.

I'm on ubuntu, and using LO 3.5... I will test my file on windows, and LO 3.4 if I can see something else.

Thanks, Eric

ebugnet commented 11 years ago

Hi again. OK, it seems to be a bug for Libreoffice 3.5, 3.6.1, 3.6.2 (test this 3) When you animate a text boxe, you can't choose "as one object" Defaut is line by line, and changing this option crash impress !

Johann-Tree commented 11 years ago

Hi,

I run into the same error. I don't know how to fix it but I have an idea how to one possibly can get around it. What would you think about adding the following feature?

Providing an option which cause that a slide containing a bulleted list will be duplicated as often that the first slide has just the first bullet point and that on the next slide is just one more bullet, and so on. So no worrying about any effects added to that text box. :-)Maybe a second option could be interesting to also get another slide for a bullet down in the hierarchy. (I'm sorry, I don't know the right term because I'm using the German version of LO…)

I think this would be very helpful because I'm using Impress mostly like in this description: http://www.xaprb.com/blog/2007/08/06/how-to-create-stepping-slides-in-openofficeorg-impress/

Thank you very much, Johann

monperrus commented 11 years ago

Hi Johann,

I really like your idea. I'm quite busy these days, so feel free to implement it.

Regards, --Martin

On Sun, Dec 30, 2012 at 9:12 PM, Johann-Tree notifications@github.comwrote:

Hi,

I run into the same error. I don't know how to fix it but I have an idea how to one possibly can get around it. What would you think about adding the following feature?

Providing an option which cause that a slide containing a bulleted list will be duplicated as often that the first slide has just the first bullet point and that on the next slide is just one more bullet, and so on. So no worrying about any effects added to that text box. :-)Maybe a second option could be interesting to also get another slide for a bullet down in the hierarchy. (I'm sorry, I don't know the right term because I'm using the German version of LO…)

I think this would be very helpful because I'm using Impress mostly like in this description: http://www.xaprb.com/blog/2007/08/06/how-to-create-stepping-slides-in-openofficeorg-impress/

Thank you very much, Johann

— Reply to this email directly or view it on GitHubhttps://github.com/monperrus/ExpandAnimations/issues/3#issuecomment-11768237.

grrrats commented 11 years ago

I just developed a patch that solves this problem, at least for OO 3.5. The error arises because the code expects all animation targets to be UNO shape objects (e.g. SvxShapeText), but animating a text box (even a single-paragraph text box) creates a UNO struct of type com.sun.star.presentation.ParagraphTarget. This struct contains two variables, one of which is of type SvxShapeText and seems to refer to the entire text box.

I don't see how to upload a patch here, so I'll just describe my (very simple) fix below:

In these two functions:

getAnimatedShapes
getShapeVisibility

after the line:

target = animNode.target

I added the following lines:

if (IsUnoStruct(target)) then 'handle com.sun.star.presentation.ParagraphTarget
    target = target.Shape
end if

Thanks for a useful extension! Philip

monperrus commented 11 years ago

Hi Philip,

Thanks very much for the patch. Could you send it as attachment, I'll commit it to the repo.

Regards, --Martin

On 01/10/2013 06:01 PM, grrrats wrote:

I just developed a patch that solves this problem, at least for OO 3.5. The error arises because the code expects all animation targets to be UNO shape objects (e.g. SvxShapeText), but animating a text box (even a single-paragraph text box) creates a UNO struct of type com.sun.star.presentation.ParagraphTarget. This struct contains two variables, one of which is of type SvxShapeText and seems to refer to the /entire/ text box.

I don't see how to upload a patch here, so I'll just describe my (very simple) fix below:

In these two functions: getAnimatedShapes getShapeVisibility after the line: target = animNode.target I added the following lines: if (IsUnoStruct(target)) then 'handle com.sun.star.presentation.ParagraphTarget target = target.Shape end if

Thanks for a useful extension! Philip

— Reply to this email directly or view it on GitHub https://github.com/monperrus/ExpandAnimations/issues/3#issuecomment-12106938.

grrrats commented 11 years ago

Hi Martin,

See attached for patch.  Note that this change also eliminates the error message in issue number #2, although it does not solve that issue because the entire text box will be displayed instead of just the relevant paragraph.

Regards, Philip

--- On Wed, 1/23/13, Martin Monperrus notifications@github.com wrote: Hi Philip,

Thanks very much for the patch. Could you send it as attachment, I'll

commit it to the repo.

Regards, --Martin

grrrats commented 11 years ago

Unbelievable. Github seems to silently delete attachments when commenting via email and (from googling) has no means of attaching a patch to an issue. Here it is embedded in this comment:

diff --git a/src/ExpandAnimations.bas b/src/ExpandAnimations.bas
index da22ead..b128c57 100644
--- a/src/ExpandAnimations.bas
+++ b/src/ExpandAnimations.bas
@@ -183,6 +183,10 @@ function getAnimatedShapes(slide as Object)
                     animNode = animNodes.nextElement()
                     if isVisibilityAnimation(animNode) then
                         target = animNode.target
+                        'special handling for com.sun.star.presentation.ParagraphTarget
+                        if (IsUnoStruct(target)) then
+                           target = target.Shape
+                        end if
                         ' if we haven't seen this shape yet, add it to the array
                         if not containsObject(shapes, target) then
                             newUBound = UBound(shapes) + 1
@@ -233,6 +237,10 @@ function getShapeVisibility(slide as Object, nFrames as Integer)
                              animNode = animNodes.nextElement()
                              if isVisibilityAnimation(animNode) then
                                 target = animNode.target
+                                'special handling for com.sun.star.presentation.ParagraphTarget
+                                if (IsUnoStruct(target)) then
+                                   target = target.Shape
+                                end if
                                 ' if this is the shape we want, check the visibility
                                 if EqualUnoObjects(shape, target) then
                                     visCurrent = animNode.To
monperrus commented 11 years ago

Hi Philip,

Added your patch (see https://github.com/monperrus/ExpandAnimations/commit/cf23f0141c80f7547816f7b26997df1e6d8cf0e1). The new installation file is https://raw.github.com/monperrus/ExpandAnimations/master/dist/ExpandAnimations-0.2.oxt

Thanks again for the contribution.

--Martin

On 01/24/2013 04:12 PM, Philip Johnson wrote:

Hi Martin,

See attached for patch. Note that this change also eliminates the error message in issue number #2, although it does not solve that issue because the entire text box will be displayed instead of just the relevant paragraph.

Regards, Philip

--- On Wed, 1/23/13, Martin Monperrus notifications@github.com wrote: Hi Philip,

Thanks very much for the patch. Could you send it as attachment, I'll

commit it to the repo.

Regards, --Martin

— Reply to this email directly or view it on GitHub https://github.com/monperrus/ExpandAnimations/issues/3#issuecomment-12655264.

Johann-Tree commented 10 years ago

Hi Martin,

I really like your idea. I'm quite busy these days, so feel free to implement it.

I'm sorry, I somehow forget to respond in time. Unfortunately I'm not able to implement the idea myself because I'm not a programmer but only a user. So I would be really glad if you (or someone else) would do this. But probably you're still busy, I guess? I don't know how much work would be necessary but I'm willing to donate.

I really like your addon but until know it's not really useful for me.

Thank you very much, Johann