> 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.
> > >
> > >> [email protected] 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 [email protected] or
> > > [email protected], 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/modul
> > >e- 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 [email protected] or
> > > [email protected]. [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/sour
>ce/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.hx
>x 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/CustomAnimati
>onCloner.hxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/CustomAnimati
>onEffect.hxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/inc/CustomAnimati
>onPreset.hxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/anminfo.cx
>x
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnim
>ationCloner.cxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnim
>ationEffect.cxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/CustomAnim
>ationPreset.cxx
> http://svn.services.openoffice.org/ooo/tags/DEV300_m39/sd/source/ui/animati
>ons/ etc. etc. etc.
>
> this is a no-go; API clients shouldn't worry about the implementation.
>
> Regards
and this may be how to use OOo predefined motion paths:
Sub [How to use OOo Predefined Paths: neutron demo]
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
aUserData(2).Name = "preset-id"
aUserData(2).Value = "ooo-motionpath-neutron"
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 = 2
oAnimateMotion.Fill = com.sun.star.animations.AnimationFill.HOLD
oAnimateMotion.Target = oShape
'get the SVG path from
'/opt/openoffice.org/basis3.1/share/config/soffice.cfg/simpress/effects.xml
'See also
'/opt/openoffice.org/basis3.1/share/registry/data/org/openoffice/Office/UI/Effects.xcu
'correct line breaks when copy&paste
oAnimateMotion.Path = "M 0 0 C 0.007 -0.01332 0.014 -0.02798 " +_
"0.021 -0.04663 C 0.04 -0.09993 0.045 -0.15189 0.031 -0.15989" +_
" C 0.017 -0.16922 -0.01 -0.13191 -0.029 -0.07861 C -0.039 " +_
"-0.05063 -0.045 -0.02398 -0.047 -0.004 C -0.05 0.01199 -0.051 " +_
"0.02798 -0.051 0.04663 C -0.051 0.10659 -0.038 0.15589 -0.023 " + _
"0.15589 C -0.008 0.15589 0.005 0.10659 0.005 0.04663 C 0.005 " +_
"0.01865 0.002 -0.00799 -0.003 -0.02665 C -0.005 -0.04264 -0.01 " +_
"-0.05996 -0.016 -0.07728 C -0.036 -0.13191 -0.063 -0.16922 -0.077" +_
" -0.15989 C -0.091 -0.15056 -0.086 -0.09993 -0.066 -0.0453 C -0.058" +_
" -0.01999 -0.047 0.00133 -0.036 0.01599 C -0.028 0.02931 -0.019 " +_
"0.0413 -0.007 0.0533 C 0.029 0.09194 0.065 0.10926 0.075 0.09327 " +_
"C 0.084 0.07728 0.064 0.03331 0.028 -0.004 C 0.013 -0.01999 -0.003 " +_
"-0.03198 -0.016 -0.03997 C -0.028 -0.04797 -0.043 -0.05463 -0.059 " +_
"-0.05863 C -0.103 -0.07195 -0.141 -0.06795 -0.144 -0.04663 C -0.148 " + _
"-0.02665 -0.115 0 -0.071 0.01332 C -0.051 0.01865 -0.032 0.02132 " + _
"-0.017 0.01999 C -0.004 0.01999 0.01 0.01732 0.025 0.01332 C 0.069 0 "
+ _
"0.102 -0.02798 0.098 -0.04797 C 0.095 -0.06795 0.057 -0.07328 0.013 " +
_
"-0.05996 C -0.008 -0.0533 -0.027 -0.04397 -0.04 -0.03331 C -0.051 " + _
"-0.02532 -0.062 -0.01599 -0.074 -0.004 C -0.109 0.03464 -0.13 0.07728 "
+ _
"-0.12 0.09327 C -0.111 0.10926 -0.074 0.09194 -0.039 0.05463 C -0.022 "
+ _
"0.03598 -0.008 0.01732 0 0 Z"
oContainer.appendChild(oAnimateMotion)
Wait 5
oDoc.Presentation.start()
End Sub
may be there is some hidden service to retrieve the SVG path.
Looking at
/opt/openoffice.org/basis3.1/share/config/soffice.cfg/simpress/effects.xml I
may be
missing some extra nodes, and may be this is why these API created motion
paths are not displayed in Impress... homework for you.
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: [email protected]
For additional commands, e-mail: [email protected]