|
|
@@ -56,7 +56,7 @@
|
|
|
|
#include <cppuhelper/implbase.hxx>
|
|
|
|
#include <cppuhelper/implbase.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
@@ -100,10 +100,6 @@ using namespace ::com::sun::star::animations::AnimationNodeType;
|
|
|
|
namespace animcore
|
|
|
|
namespace animcore
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::list< Reference< XAnimationNode > > ChildList_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AnimationNodeBase : public XAnimateMotion,
|
|
|
|
class AnimationNodeBase : public XAnimateMotion,
|
|
|
|
public XAnimateColor,
|
|
|
|
public XAnimateColor,
|
|
|
|
public XTransitionFilter,
|
|
|
|
public XTransitionFilter,
|
|
|
@@ -344,14 +340,14 @@ private:
|
|
|
|
double mfIterateInterval;
|
|
|
|
double mfIterateInterval;
|
|
|
|
|
|
|
|
|
|
|
|
/** sorted list of child nodes for XTimeContainer*/
|
|
|
|
/** sorted list of child nodes for XTimeContainer*/
|
|
|
|
ChildList_t maChildren;
|
|
|
|
std::vector< Reference< XAnimationNode > > maChildren;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TimeContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
|
|
|
|
class TimeContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
explicit TimeContainerEnumeration( const ChildList_t &rChildren );
|
|
|
|
explicit TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren );
|
|
|
|
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
// Methods
|
|
|
|
virtual sal_Bool SAL_CALL hasMoreElements() override;
|
|
|
|
virtual sal_Bool SAL_CALL hasMoreElements() override;
|
|
|
@@ -359,16 +355,16 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
/** sorted list of child nodes */
|
|
|
|
/** sorted list of child nodes */
|
|
|
|
ChildList_t maChildren;
|
|
|
|
std::vector< Reference< XAnimationNode > > maChildren;
|
|
|
|
|
|
|
|
|
|
|
|
/** current iteration position */
|
|
|
|
/** current iteration position */
|
|
|
|
ChildList_t::iterator maIter;
|
|
|
|
std::vector< Reference< XAnimationNode > >::iterator maIter;
|
|
|
|
|
|
|
|
|
|
|
|
/** our first, last and only protection from multi-threads! */
|
|
|
|
/** our first, last and only protection from multi-threads! */
|
|
|
|
Mutex maMutex;
|
|
|
|
Mutex maMutex;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t &rChildren )
|
|
|
|
TimeContainerEnumeration::TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren )
|
|
|
|
: maChildren( rChildren )
|
|
|
|
: maChildren( rChildren )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
maIter = maChildren.begin();
|
|
|
|
maIter = maChildren.begin();
|
|
|
@@ -1192,11 +1188,9 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone()
|
|
|
|
Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY );
|
|
|
|
Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY );
|
|
|
|
if( xContainer.is() )
|
|
|
|
if( xContainer.is() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ChildList_t::iterator aIter( maChildren.begin() );
|
|
|
|
for (auto const& child : maChildren)
|
|
|
|
ChildList_t::iterator aEnd( maChildren.end() );
|
|
|
|
|
|
|
|
while( aIter != aEnd )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Reference< XCloneable > xCloneable((*aIter++), UNO_QUERY );
|
|
|
|
Reference< XCloneable > xCloneable(child, UNO_QUERY );
|
|
|
|
if( xCloneable.is() ) try
|
|
|
|
if( xCloneable.is() ) try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY );
|
|
|
|
Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY );
|
|
|
@@ -1768,13 +1762,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Referenc
|
|
|
|
if( !newChild.is() || !refChild.is() )
|
|
|
|
if( !newChild.is() || !refChild.is() )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
|
|
ChildList_t::iterator before = std::find(maChildren.begin(), maChildren.end(), refChild);
|
|
|
|
|
|
|
|
if( before == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
throw ElementExistException();
|
|
|
|
throw ElementExistException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
|
|
|
|
|
|
|
|
if( before == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
maChildren.insert( before, newChild );
|
|
|
|
maChildren.insert( before, newChild );
|
|
|
|
|
|
|
|
|
|
|
|
Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
|
|
|
|
Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
|
|
|
@@ -1792,13 +1786,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference
|
|
|
|
if( !newChild.is() || !refChild.is() )
|
|
|
|
if( !newChild.is() || !refChild.is() )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
|
|
ChildList_t::iterator before = std::find(maChildren.begin(), maChildren.end(), refChild);
|
|
|
|
|
|
|
|
if( before == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
throw ElementExistException();
|
|
|
|
throw ElementExistException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
|
|
|
|
|
|
|
|
if( before == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
++before;
|
|
|
|
++before;
|
|
|
|
if( before != maChildren.end() )
|
|
|
|
if( before != maChildren.end() )
|
|
|
|
maChildren.insert( before, newChild );
|
|
|
|
maChildren.insert( before, newChild );
|
|
|
@@ -1820,13 +1814,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Referenc
|
|
|
|
if( !newChild.is() || !oldChild.is() )
|
|
|
|
if( !newChild.is() || !oldChild.is() )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
|
|
ChildList_t::iterator replace = std::find(maChildren.begin(), maChildren.end(), oldChild);
|
|
|
|
|
|
|
|
if( replace == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
|
|
|
|
throw ElementExistException();
|
|
|
|
throw ElementExistException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto replace = std::find(maChildren.begin(), maChildren.end(), oldChild);
|
|
|
|
|
|
|
|
if( replace == maChildren.end() )
|
|
|
|
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
Reference< XInterface > xNull( nullptr );
|
|
|
|
Reference< XInterface > xNull( nullptr );
|
|
|
|
oldChild->setParent( xNull );
|
|
|
|
oldChild->setParent( xNull );
|
|
|
|
|
|
|
|
|
|
|
@@ -1847,7 +1841,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference
|
|
|
|
if( !oldChild.is() )
|
|
|
|
if( !oldChild.is() )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
|
|
ChildList_t::iterator old = std::find(maChildren.begin(), maChildren.end(), oldChild);
|
|
|
|
auto old = std::find(maChildren.begin(), maChildren.end(), oldChild);
|
|
|
|
if( old == maChildren.end() )
|
|
|
|
if( old == maChildren.end() )
|
|
|
|
throw NoSuchElementException();
|
|
|
|
throw NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|