2007-07-17 13:57:33 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* $RCSfile: slideanimations.cxx,v $
|
2008-06-24 11:13:11 +00:00
|
|
|
* $Revision: 1.4 $
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
2008-04-11 00:00:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-17 13:57:33 +00:00
|
|
|
*
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
|
#include "precompiled_slideshow.hxx"
|
|
|
|
|
|
|
|
|
|
// must be first
|
|
|
|
|
#include <canvas/debug.hxx>
|
2008-06-24 11:13:11 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
|
|
|
|
#include <tools/diagnose_ex.h>
|
2007-07-17 13:57:33 +00:00
|
|
|
|
|
|
|
|
#include <comphelper/anytostring.hxx>
|
|
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
|
|
|
|
|
|
|
|
|
#include "slideanimations.hxx"
|
|
|
|
|
#include "animationnodefactory.hxx"
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
|
namespace slideshow
|
|
|
|
|
{
|
|
|
|
|
namespace internal
|
|
|
|
|
{
|
|
|
|
|
SlideAnimations::SlideAnimations( const SlideShowContext& rContext,
|
|
|
|
|
const ::basegfx::B2DVector& rSlideSize ) :
|
|
|
|
|
maContext( rContext ),
|
|
|
|
|
maSlideSize( rSlideSize ),
|
|
|
|
|
mpRootNode()
|
|
|
|
|
{
|
2008-06-24 11:13:11 +00:00
|
|
|
ENSURE_OR_THROW( maContext.mpSubsettableShapeManager,
|
2007-07-17 13:57:33 +00:00
|
|
|
"SlideAnimations::SlideAnimations(): Invalid SlideShowContext" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SlideAnimations::~SlideAnimations()
|
|
|
|
|
{
|
|
|
|
|
if( mpRootNode )
|
|
|
|
|
{
|
|
|
|
|
SHOW_NODE_TREE( mpRootNode );
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
mpRootNode->dispose();
|
|
|
|
|
}
|
|
|
|
|
catch (uno::Exception &)
|
|
|
|
|
{
|
|
|
|
|
OSL_ENSURE( false, rtl::OUStringToOString(
|
|
|
|
|
comphelper::anyToString(
|
|
|
|
|
cppu::getCaughtException() ),
|
|
|
|
|
RTL_TEXTENCODING_UTF8 ).getStr() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SlideAnimations::importAnimations( const uno::Reference< animations::XAnimationNode >& xRootAnimationNode )
|
|
|
|
|
{
|
|
|
|
|
mpRootNode = AnimationNodeFactory::createAnimationNode(
|
|
|
|
|
xRootAnimationNode,
|
|
|
|
|
maSlideSize,
|
|
|
|
|
maContext );
|
|
|
|
|
|
|
|
|
|
SHOW_NODE_TREE( mpRootNode );
|
|
|
|
|
|
|
|
|
|
return mpRootNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SlideAnimations::isAnimated() const
|
|
|
|
|
{
|
|
|
|
|
if( !mpRootNode )
|
|
|
|
|
return false; // no animations there
|
|
|
|
|
|
|
|
|
|
// query root node about pending animations
|
|
|
|
|
return mpRootNode->hasPendingAnimation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SlideAnimations::start()
|
|
|
|
|
{
|
|
|
|
|
if( !mpRootNode )
|
|
|
|
|
return false; // no animations there
|
|
|
|
|
|
|
|
|
|
// init all nodes
|
|
|
|
|
if( !mpRootNode->init() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// resolve root node
|
|
|
|
|
if( !mpRootNode->resolve() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SlideAnimations::end()
|
|
|
|
|
{
|
|
|
|
|
if( !mpRootNode )
|
|
|
|
|
return; // no animations there
|
|
|
|
|
|
|
|
|
|
// end root node
|
|
|
|
|
mpRootNode->deactivate();
|
|
|
|
|
mpRootNode->end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SlideAnimations::dispose()
|
|
|
|
|
{
|
|
|
|
|
mpRootNode.reset();
|
|
|
|
|
maContext.dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|