Kaydet (Commit) e1d1ea2d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Turn all-static TransitionFactory class into namespace

Change-Id: I0187cf4c1b31c5a8c930804c7d3f36c79142af3a
üst b10fe49d
......@@ -31,6 +31,7 @@
#include <com/sun/star/animations/TransitionSubType.hpp>
#include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "transitiontools.hxx"
#include "parametricpolypolygonfactory.hxx"
#include "animationfactory.hxx"
......@@ -191,26 +192,7 @@ double ClippingAnimation::getUnderlyingValue() const
// Permissible range for operator() above is [0,1]
}
} // anon namespace
AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager,
const ::basegfx::B2DVector& rSlideSize,
uno::Reference< animations::XTransitionFilter > const& xTransition )
{
return createShapeTransition( rParms,
rShape,
rShapeManager,
rSlideSize,
xTransition,
xTransition->getTransition(),
xTransition->getSubtype() );
}
AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
AnimationActivitySharedPtr createShapeTransitionByType(
const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager,
......@@ -222,7 +204,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
{
ENSURE_OR_THROW(
xTransition.is(),
"TransitionFactory::createShapeTransition(): Invalid XTransition" );
"createShapeTransitionByType(): Invalid XTransition" );
const TransitionInfo* pTransitionInfo(
getTransitionInfo( nType, nSubType ) );
......@@ -234,7 +216,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
{
default:
case TransitionInfo::TRANSITION_INVALID:
OSL_FAIL( "TransitionFactory::createShapeTransition(): Invalid transition type. "
OSL_FAIL( "createShapeTransitionByType(): Invalid transition type. "
"Don't ask me for a 0 TransitionType, have no XTransitionFilter node instead!" );
return AnimationActivitySharedPtr();
......@@ -272,13 +254,13 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
const TransitionInfo* pRandomTransitionInfo( getRandomTransitionInfo() );
ENSURE_OR_THROW( pRandomTransitionInfo != NULL,
"TransitionFactory::createShapeTransition(): Got invalid random transition info" );
"createShapeTransitionByType(): Got invalid random transition info" );
ENSURE_OR_THROW( pRandomTransitionInfo->mnTransitionType != animations::TransitionType::RANDOM,
"TransitionFactory::createShapeTransition(): Got random again for random input!" );
"createShapeTransitionByType(): Got random again for random input!" );
// and recurse
pGeneratedActivity = createShapeTransition( rParms,
pGeneratedActivity = createShapeTransitionByType( rParms,
rShape,
rShapeManager,
rSlideSize,
......@@ -319,7 +301,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
default:
ENSURE_OR_THROW( false,
"TransitionFactory::createShapeTransition(): Unexpected subtype for SLIDEWIPE" );
"createShapeTransitionByType(): Unexpected subtype for SLIDEWIPE" );
break;
}
......@@ -372,18 +354,36 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
// No animation generated, maybe no table entry for given
// transition?
OSL_TRACE(
"TransitionFactory::createShapeTransition(): Unknown type/subtype (%d/%d) "
"createShapeTransitionByType(): Unknown type/subtype (%d/%d) "
"combination encountered",
xTransition->getTransition(),
xTransition->getSubtype() );
OSL_FAIL(
"TransitionFactory::createShapeTransition(): Unknown type/subtype "
"createShapeTransitionByType(): Unknown type/subtype "
"combination encountered" );
}
return pGeneratedActivity;
}
} // anon namespace
AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager,
const ::basegfx::B2DVector& rSlideSize,
uno::Reference< animations::XTransitionFilter > const& xTransition )
{
return createShapeTransitionByType( rParms,
rShape,
rShapeManager,
rSlideSize,
xTransition,
xTransition->getTransition(),
xTransition->getSubtype() );
}
}
}
......
......@@ -38,6 +38,7 @@
#include "slidechangebase.hxx"
#include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "transitiontools.hxx"
#include "parametricpolypolygonfactory.hxx"
#include "animationfactory.hxx"
......
......@@ -24,6 +24,7 @@
#include <com/sun/star/animations/TransitionSubType.hpp>
#include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "tools.hxx"
#include <algorithm>
......@@ -2108,7 +2109,7 @@ static const TransitionInfo lcl_transitionInfo[] =
} // anon namespace
const TransitionInfo* TransitionFactory::getTransitionInfo(
const TransitionInfo* getTransitionInfo(
sal_Int16 nTransitionType, sal_Int16 nTransitionSubType )
{
static const TransitionInfo* pTableEnd = lcl_transitionInfo+
......@@ -2124,7 +2125,7 @@ const TransitionInfo* TransitionFactory::getTransitionInfo(
return NULL;
}
const TransitionInfo* TransitionFactory::getRandomTransitionInfo()
const TransitionInfo* getRandomTransitionInfo()
{
return lcl_transitionInfo + getRandomOrdinal(
SAL_N_ELEMENTS(lcl_transitionInfo)
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_TRANSITIONS_TRANSITIONFACTORYTAB_HXX
#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_TRANSITIONS_TRANSITIONFACTORYTAB_HXX
#include <sal/config.h>
#include <sal/types.h>
namespace slideshow { namespace internal {
struct TransitionInfo;
TransitionInfo const * getTransitionInfo(
sal_Int16 nTransitionType, sal_Int16 nTransitionSubType);
TransitionInfo const * getRandomTransitionInfo();
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -33,16 +33,13 @@
#include "transitioninfo.hxx"
#include "soundplayer.hxx"
#include <boost/utility.hpp>
namespace slideshow
{
namespace internal
{
/* Definition of Transitionfactory class */
class TransitionFactory : private boost::noncopyable
namespace TransitionFactory
{
public:
/** Create a transition effect for shapes.
This method creates an AnimationActivity, which, when
......@@ -64,7 +61,7 @@ namespace slideshow
@return the created activity, or NULL for no
transition effect
*/
static AnimationActivitySharedPtr createShapeTransition(
AnimationActivitySharedPtr createShapeTransition(
const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager,
......@@ -100,7 +97,7 @@ namespace slideshow
@return the created animation, or NULL for no
transition effect
*/
static NumberAnimationSharedPtr createSlideTransition(
NumberAnimationSharedPtr createSlideTransition(
const SlideSharedPtr& rLeavingSlide,
const SlideSharedPtr& rEnteringSlide,
const UnoViewContainer& rViewContainer,
......@@ -114,26 +111,7 @@ namespace slideshow
bool bTransitionDirection,
const RGBColor& rTransitionFadeColor,
const SoundPlayerSharedPtr& rSoundPlayer );
private:
static const TransitionInfo* getTransitionInfo(
sal_Int16 nTransitionType, sal_Int16 nTransitionSubType );
static const TransitionInfo* getRandomTransitionInfo();
static AnimationActivitySharedPtr createShapeTransition(
const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager,
const ::basegfx::B2DVector& rSlideSize,
::com::sun::star::uno::Reference<
::com::sun::star::animations::XTransitionFilter > const& xTransition,
sal_Int16 nTransitionType,
sal_Int16 nTransitionSubType );
// static factory
TransitionFactory() SAL_DELETED_FUNCTION; //TODO: get rid of this class
~TransitionFactory() SAL_DELETED_FUNCTION;
};
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment