Hello John, Andrew, *

On Sunday 18 January 2009 02:51, Andrew Douglas Pitonyak wrote:
> John,
>
> I do not remember seeing any replies on list (since you ask). People did
> see the question, however.
>
> I took a quick look at all of my documentation that I have produced. I
> thought that I had done this once just to test it. Seems that I did not.
>
> the point is that I spent ten minutes looking at it, but I did not
> pursue it because of lack of time (I do this all on my personal time).
> Some people do take a look, and, as Ariel said, they likely did not know
> the answer off hand so did not bother to answer.
>
> Could I find a solution? Probably, if the API supports this. But at the
> moment, I did not want to spend an hour or so looking into it.
>
> Ariel Constenla-Haile wrote:
> > Hello John,
> >
> > On Friday 16 January 2009 16:52, John Hayes wrote:
> >> Hello again,
> >>
> >>
> >>
> >> Just making sure no one replied to this original email - I'm not on the
> >
> > no, no one replied.
> >
> >> dev@api.openoffice.org list, so if replying please "Reply All." Also,
> >
> > you can read the mail archive at
> > http://api.openoffice.org/servlets/SummarizeList?listName=dev
> >
> >> apologies for the cross-post, but if no one can help on dev@, perhaps
> >> the users@ list can. Many thanks in advance for any help you can give.
> >
> > oh no, there you have even less chances to get an answer.
> > You may have to write to d...@openoffice.org or
> > d...@graphics.openoffice.org, where you'll find the developer/s who
> > designed that API.
> >
> >> I'm completely new to the OOo UNO API, and I have been completely
> >> unsuccessful in finding info on adding motion path animations to an
> >> XShape in Impress. I was told (in IRC) that it involves querying the
> >> com::sun::star::animations::XAnimationNodeSupplier interface from a page
> >> in my document, then somehow adding SMIL nodes to the root node through
> >> that, but to be honest I don't understand how to do that at all.
> >>
> >>
> >>
> >> Could someone please shed some light on this subject for a complete
> >> newbie like myself? Example code that adds a motion path animation to a
> >> shape would be most helpful, but I'll take whatever I can get right now!
> >
> > I guess nobody answered you because nobody knows. At least, I have no
> > idea, never tried that (nor understand what a "motion path Animation to
> > an XShape" is).

switching the GUI from Spanish to English I understood.


> > On the other hand, Draw/Impress API is the worst document OOo API (just
> > go to the Dev's Guide and see the holes in the documentation, lots of
> > features for which there is already an API are not even mentioned).
> > And if you take a look at the documentation for the module in question
> > http://api.openoffice.org/docs/common/ref/com/sun/star/animations/module-
> >ix.html you'll see missing descriptions for
> >
> > TargetPropertiesCreator
> > XAnimationNode
> > XAnimationNodeSupplier
> > XAudio
> > TimeFilterPair
> > ValuePair
> > Timing
> > AnimationEndSync
> > AnimationValueType
> > EventTrigger
> > TransitionSubType
> > TransitionType
> >
> > so lucky you if you can get an idea of how things work with the animation
> > API ust by reading the abstract specification.
> >
> > If I compare this state with
> > http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/application/Co
> >pyTableWizard.html I come to the concusion that some developers don't care
> > much about API users. So luck with them at d...@openoffice.org or
> > d...@graphics.openoffice.org. [If you find the answers, please come back
> > and tell]
> >
> > Regards

OOo Basic code to test, that I'm not sure how correct is:

'********************************************************
'********************************************************

Sub [User Path]
        Dim oDoc as Object
        oDoc = createNewDoc("impress")
        
        Dim oDrawPages as Object
        oDrawPages = oDoc.getDrawPages()
        Dim oDrawPage as Object
        If oDrawPages.getCount() < 1 Then 'impossible, but...
                oDrawPage = oDrawPages.insertNewByIndex(0)
        Else
                oDrawPage = oDrawPages.getByIndex(0)
        End If
        
        Dim oShape as Object
        oShape = createShape(oDoc, "EllipseShape")
        
        Dim nWIdth%
        nWIdth = 10000
        
        Dim aPosition as new com.sun.star.awt.Point
        Dim aSize as new com.sun.star.awt.Size
        
        aPosition.X = oDrawPage.Width / 2 - nWIdth / 2
        aPosition.Y = oDrawPage.Height / 2 - nWIdth / 2
        
        aSize.Width = nWidth
        aSize.Height = nWidth
        
        oShape.setPosition( aPosition )
        oShape.setSize( aSize )
        
        oDrawPage.add( oShape )
        
        Dim oRootAnimNode as Object
        oRootAnimNode = oDrawPage.getAnimationNode()
        
        Dim oSeqNode as Object
        oSeqNode = createSequenceTimeContainer()
        oRootAnimNode.appendChild(oSeqNode)

        Dim oContainer as Object
        oContainer = createParallelTimeContainer()
        
        Dim aUserData(2) as New com.sun.star.beans.NamedValue
        aUserData(0).Name = "node-type"
        aUserData(0).Value = 
com.sun.star.presentation.EffectNodeType.AFTER_PREVIOUS
        aUserData(1).Name = "preset-class"
        aUserData(1).Value = 
com.sun.star.presentation.EffectPresetClass.MOTIONPATH
        oContainer.UserData = aUserData
        oContainer.Acceleration = 0.5
        oContainer.Decelerate = 0.5
        oContainer.Fill = com.sun.star.animations.AnimationFill.HOLD
        
        oSeqNode.appendChild(oContainer)
        
        Dim oAnimateMotion as Object
        oAnimateMotion = createAnimateMotion()
        
        oAnimateMotion.Duration = 5
        oAnimateMotion.Fill = com.sun.star.animations.AnimationFill.HOLD
        oAnimateMotion.Target = oShape
        'there *must* be another way, other than hand-coding an SVG path!
        oAnimateMotion.Path = "m -0.5 -0.5 0.5 1 0.5 -1"
        
        oContainer.appendChild(oAnimateMotion)
        
        Wait 5
        oDoc.Presentation.start()
End Sub


'**************************************************************************

Function createAnimationNode(sType as String)
        On Error Resume Next
        createAnimationNode = CreateUnoService("com.sun.star.animations." + 
sType)
End Function

Function createParallelTimeContainer()
        On Error Resume Next
        createParallelTimeContainer = 
createAnimationNode("ParallelTimeContainer")
End Function

Function createSequenceTimeContainer()
        On Error Resume Next
        createSequenceTimeContainer = 
createAnimationNode("SequenceTimeContainer")
End Function

Function createAnimateMotion()
        On Error Resume Next
        createAnimateMotion = createAnimationNode("AnimateMotion")
End Function

Function createAudioEffect()
        On Error Resume Next
        createAudioEffect = createAnimationNode("Audio")
End Function


Function createShape(oDoc as OBject, sShapeType as String)
        On Error Resume Next
        createShape = oDoc.createInstance("com.sun.star.drawing." & sShapeType)
End Function

Function createNewDoc(sDocType as String, Optional MediaDescriptor() )
        If IsMissing(MediaDescriptor()) then MediaDescriptor() = Array()
        createNewDoc = StarDesktop.loadComponentFromURL(_
                                                "private:factory/s" & sDocType 
, "_default", 0, MediaDescriptor())
End Function

'********************************************************
'********************************************************


Obviously, the problem here are undocumented services and null documentation:
http://svn.services.openoffice.org/opengrok/xref/DEV300_m38/animations/source/animcore/animcore.cxx#540
[some one should be evil and submit an issue for each service]


If you want to get some idea, IMO there is no other option than reading the 
sources (in C++, of course):

http://svn.services.openoffice.org/ooo/tags/DEV300_m39/animations/
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/animations.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/anmdef.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/anminfo.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/CustomAnimationCloner.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/CustomAnimationEffect.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/CustomAnimationPreset.hxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/anminfo.cxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnimationCloner.cxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnimationEffect.cxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnimationPreset.cxx
http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/ui/animations/
etc. etc. etc. 

this is a no-go; API clients shouldn't worry about the implementation.

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina


"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to