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 @@ ...@@ -31,6 +31,7 @@
#include <com/sun/star/animations/TransitionSubType.hpp> #include <com/sun/star/animations/TransitionSubType.hpp>
#include "transitionfactory.hxx" #include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "transitiontools.hxx" #include "transitiontools.hxx"
#include "parametricpolypolygonfactory.hxx" #include "parametricpolypolygonfactory.hxx"
#include "animationfactory.hxx" #include "animationfactory.hxx"
...@@ -191,26 +192,7 @@ double ClippingAnimation::getUnderlyingValue() const ...@@ -191,26 +192,7 @@ double ClippingAnimation::getUnderlyingValue() const
// Permissible range for operator() above is [0,1] // Permissible range for operator() above is [0,1]
} }
} // anon namespace AnimationActivitySharedPtr createShapeTransitionByType(
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(
const ActivitiesFactory::CommonParameters& rParms, const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape, const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager, const ShapeManagerSharedPtr& rShapeManager,
...@@ -222,7 +204,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition( ...@@ -222,7 +204,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
{ {
ENSURE_OR_THROW( ENSURE_OR_THROW(
xTransition.is(), xTransition.is(),
"TransitionFactory::createShapeTransition(): Invalid XTransition" ); "createShapeTransitionByType(): Invalid XTransition" );
const TransitionInfo* pTransitionInfo( const TransitionInfo* pTransitionInfo(
getTransitionInfo( nType, nSubType ) ); getTransitionInfo( nType, nSubType ) );
...@@ -234,7 +216,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition( ...@@ -234,7 +216,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
{ {
default: default:
case TransitionInfo::TRANSITION_INVALID: 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!" ); "Don't ask me for a 0 TransitionType, have no XTransitionFilter node instead!" );
return AnimationActivitySharedPtr(); return AnimationActivitySharedPtr();
...@@ -272,13 +254,13 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition( ...@@ -272,13 +254,13 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
const TransitionInfo* pRandomTransitionInfo( getRandomTransitionInfo() ); const TransitionInfo* pRandomTransitionInfo( getRandomTransitionInfo() );
ENSURE_OR_THROW( pRandomTransitionInfo != NULL, 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, 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 // and recurse
pGeneratedActivity = createShapeTransition( rParms, pGeneratedActivity = createShapeTransitionByType( rParms,
rShape, rShape,
rShapeManager, rShapeManager,
rSlideSize, rSlideSize,
...@@ -319,7 +301,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition( ...@@ -319,7 +301,7 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
default: default:
ENSURE_OR_THROW( false, ENSURE_OR_THROW( false,
"TransitionFactory::createShapeTransition(): Unexpected subtype for SLIDEWIPE" ); "createShapeTransitionByType(): Unexpected subtype for SLIDEWIPE" );
break; break;
} }
...@@ -372,18 +354,36 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition( ...@@ -372,18 +354,36 @@ AnimationActivitySharedPtr TransitionFactory::createShapeTransition(
// No animation generated, maybe no table entry for given // No animation generated, maybe no table entry for given
// transition? // transition?
OSL_TRACE( OSL_TRACE(
"TransitionFactory::createShapeTransition(): Unknown type/subtype (%d/%d) " "createShapeTransitionByType(): Unknown type/subtype (%d/%d) "
"combination encountered", "combination encountered",
xTransition->getTransition(), xTransition->getTransition(),
xTransition->getSubtype() ); xTransition->getSubtype() );
OSL_FAIL( OSL_FAIL(
"TransitionFactory::createShapeTransition(): Unknown type/subtype " "createShapeTransitionByType(): Unknown type/subtype "
"combination encountered" ); "combination encountered" );
} }
return pGeneratedActivity; 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 @@ ...@@ -38,6 +38,7 @@
#include "slidechangebase.hxx" #include "slidechangebase.hxx"
#include "transitionfactory.hxx" #include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "transitiontools.hxx" #include "transitiontools.hxx"
#include "parametricpolypolygonfactory.hxx" #include "parametricpolypolygonfactory.hxx"
#include "animationfactory.hxx" #include "animationfactory.hxx"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <com/sun/star/animations/TransitionSubType.hpp> #include <com/sun/star/animations/TransitionSubType.hpp>
#include "transitionfactory.hxx" #include "transitionfactory.hxx"
#include "transitionfactorytab.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <algorithm> #include <algorithm>
...@@ -2108,7 +2109,7 @@ static const TransitionInfo lcl_transitionInfo[] = ...@@ -2108,7 +2109,7 @@ static const TransitionInfo lcl_transitionInfo[] =
} // anon namespace } // anon namespace
const TransitionInfo* TransitionFactory::getTransitionInfo( const TransitionInfo* getTransitionInfo(
sal_Int16 nTransitionType, sal_Int16 nTransitionSubType ) sal_Int16 nTransitionType, sal_Int16 nTransitionSubType )
{ {
static const TransitionInfo* pTableEnd = lcl_transitionInfo+ static const TransitionInfo* pTableEnd = lcl_transitionInfo+
...@@ -2124,7 +2125,7 @@ const TransitionInfo* TransitionFactory::getTransitionInfo( ...@@ -2124,7 +2125,7 @@ const TransitionInfo* TransitionFactory::getTransitionInfo(
return NULL; return NULL;
} }
const TransitionInfo* TransitionFactory::getRandomTransitionInfo() const TransitionInfo* getRandomTransitionInfo()
{ {
return lcl_transitionInfo + getRandomOrdinal( return lcl_transitionInfo + getRandomOrdinal(
SAL_N_ELEMENTS(lcl_transitionInfo) 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 @@ ...@@ -33,16 +33,13 @@
#include "transitioninfo.hxx" #include "transitioninfo.hxx"
#include "soundplayer.hxx" #include "soundplayer.hxx"
#include <boost/utility.hpp>
namespace slideshow namespace slideshow
{ {
namespace internal namespace internal
{ {
/* Definition of Transitionfactory class */ /* Definition of Transitionfactory class */
class TransitionFactory : private boost::noncopyable namespace TransitionFactory
{ {
public:
/** Create a transition effect for shapes. /** Create a transition effect for shapes.
This method creates an AnimationActivity, which, when This method creates an AnimationActivity, which, when
...@@ -64,7 +61,7 @@ namespace slideshow ...@@ -64,7 +61,7 @@ namespace slideshow
@return the created activity, or NULL for no @return the created activity, or NULL for no
transition effect transition effect
*/ */
static AnimationActivitySharedPtr createShapeTransition( AnimationActivitySharedPtr createShapeTransition(
const ActivitiesFactory::CommonParameters& rParms, const ActivitiesFactory::CommonParameters& rParms,
const AnimatableShapeSharedPtr& rShape, const AnimatableShapeSharedPtr& rShape,
const ShapeManagerSharedPtr& rShapeManager, const ShapeManagerSharedPtr& rShapeManager,
...@@ -100,7 +97,7 @@ namespace slideshow ...@@ -100,7 +97,7 @@ namespace slideshow
@return the created animation, or NULL for no @return the created animation, or NULL for no
transition effect transition effect
*/ */
static NumberAnimationSharedPtr createSlideTransition( NumberAnimationSharedPtr createSlideTransition(
const SlideSharedPtr& rLeavingSlide, const SlideSharedPtr& rLeavingSlide,
const SlideSharedPtr& rEnteringSlide, const SlideSharedPtr& rEnteringSlide,
const UnoViewContainer& rViewContainer, const UnoViewContainer& rViewContainer,
...@@ -114,26 +111,7 @@ namespace slideshow ...@@ -114,26 +111,7 @@ namespace slideshow
bool bTransitionDirection, bool bTransitionDirection,
const RGBColor& rTransitionFadeColor, const RGBColor& rTransitionFadeColor,
const SoundPlayerSharedPtr& rSoundPlayer ); 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