summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-02 10:36:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2013-05-22 10:44:29 +0000
commit6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch)
tree2746468845d6f1159e3759ee2cf7a620fca15b6e /sd
parent697a007c61b9cabceb9767fad87cd5822b300452 (diff)
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases. Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752 Reviewed-on: https://gerrit.libreoffice.org/4001 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx74
-rw-r--r--sd/source/core/sdpage2.cxx6
-rw-r--r--sd/source/core/stlpool.cxx2
-rw-r--r--sd/source/filter/eppt/pptexanimations.cxx4
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx3
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx5
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx3
7 files changed, 38 insertions, 59 deletions
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 827bed2af29f..dc73646245cf 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1055,26 +1055,24 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType )
xNewContainer->appendChild( xChildNode );
}
- Reference< XAnimationNode > xNewNode( xNewContainer, UNO_QUERY_THROW );
-
- xNewNode->setBegin( mxNode->getBegin() );
- xNewNode->setDuration( mxNode->getDuration() );
- xNewNode->setEnd( mxNode->getEnd() );
- xNewNode->setEndSync( mxNode->getEndSync() );
- xNewNode->setRepeatCount( mxNode->getRepeatCount() );
- xNewNode->setFill( mxNode->getFill() );
- xNewNode->setFillDefault( mxNode->getFillDefault() );
- xNewNode->setRestart( mxNode->getRestart() );
- xNewNode->setRestartDefault( mxNode->getRestartDefault() );
- xNewNode->setAcceleration( mxNode->getAcceleration() );
- xNewNode->setDecelerate( mxNode->getDecelerate() );
- xNewNode->setAutoReverse( mxNode->getAutoReverse() );
- xNewNode->setRepeatDuration( mxNode->getRepeatDuration() );
- xNewNode->setEndSync( mxNode->getEndSync() );
- xNewNode->setRepeatCount( mxNode->getRepeatCount() );
- xNewNode->setUserData( mxNode->getUserData() );
-
- mxNode = xNewNode;
+ xNewContainer->setBegin( mxNode->getBegin() );
+ xNewContainer->setDuration( mxNode->getDuration() );
+ xNewContainer->setEnd( mxNode->getEnd() );
+ xNewContainer->setEndSync( mxNode->getEndSync() );
+ xNewContainer->setRepeatCount( mxNode->getRepeatCount() );
+ xNewContainer->setFill( mxNode->getFill() );
+ xNewContainer->setFillDefault( mxNode->getFillDefault() );
+ xNewContainer->setRestart( mxNode->getRestart() );
+ xNewContainer->setRestartDefault( mxNode->getRestartDefault() );
+ xNewContainer->setAcceleration( mxNode->getAcceleration() );
+ xNewContainer->setDecelerate( mxNode->getDecelerate() );
+ xNewContainer->setAutoReverse( mxNode->getAutoReverse() );
+ xNewContainer->setRepeatDuration( mxNode->getRepeatDuration() );
+ xNewContainer->setEndSync( mxNode->getEndSync() );
+ xNewContainer->setRepeatCount( mxNode->getRepeatCount() );
+ xNewContainer->setUserData( mxNode->getUserData() );
+
+ mxNode = xNewContainer;
Any aTarget;
if( nIterateType )
@@ -1659,8 +1657,7 @@ void CustomAnimationEffect::setStopAudio()
xCommand->setCommand( EffectCommands::STOPAUDIO );
Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY_THROW );
- Reference< XAnimationNode > xChild( xCommand, UNO_QUERY_THROW );
- xContainer->appendChild( xChild );
+ xContainer->appendChild( xCommand );
mnCommand = EffectCommands::STOPAUDIO;
}
@@ -1898,8 +1895,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathOb
if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) )
nSubItem = ShapeAnimationSubType::ONLY_TEXT;
- Reference< XAnimationNode > xEffectNode( xEffectContainer, UNO_QUERY_THROW );
- pEffect.reset( new CustomAnimationEffect( xEffectNode ) );
+ pEffect.reset( new CustomAnimationEffect( xEffectContainer ) );
pEffect->setEffectSequence( this );
pEffect->setTarget( rTarget );
pEffect->setTargetSubItem( nSubItem );
@@ -2039,8 +2035,7 @@ void EffectSequenceHelper::implRebuild()
xOnClickContainer->setBegin( aBegin );
- Reference< XAnimationNode > xOnClickContainerNode( xOnClickContainer, UNO_QUERY_THROW );
- mxSequenceRoot->appendChild( xOnClickContainerNode );
+ mxSequenceRoot->appendChild( xOnClickContainer );
double fBegin = 0.0;
@@ -2048,9 +2043,8 @@ void EffectSequenceHelper::implRebuild()
{
// create a par container for the current click or after effect node and all following with effects
Reference< XTimeContainer > xWithContainer( ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ), UNO_QUERY_THROW );
- Reference< XAnimationNode > xWithContainerNode( xWithContainer, UNO_QUERY_THROW );
xWithContainer->setBegin( makeAny( fBegin ) );
- xOnClickContainer->appendChild( xWithContainerNode );
+ xOnClickContainer->appendChild( xWithContainer );
double fDuration = 0.0;
do
@@ -2193,9 +2187,8 @@ void stl_process_after_effect_node_func(AfterEffectNode& rNode)
// this does not yet have a child container, create one
xNextContainer.set( ParallelTimeContainer::create(xContext), UNO_QUERY_THROW );
- Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW );
- xNode->setBegin( makeAny( (double)0.0 ) );
- xNextClickContainer->appendChild( xNode );
+ xNextContainer->setBegin( makeAny( (double)0.0 ) );
+ xNextClickContainer->appendChild( xNextContainer );
}
DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not find/create container!" );
}
@@ -2206,24 +2199,20 @@ void stl_process_after_effect_node_func(AfterEffectNode& rNode)
{
Reference< XTimeContainer > xNewClickContainer( ParallelTimeContainer::create( xContext ), UNO_QUERY_THROW );
- Reference< XAnimationNode > xNewClickNode( xNewClickContainer, UNO_QUERY_THROW );
-
Event aEvent;
aEvent.Trigger = EventTrigger::ON_NEXT;
aEvent.Repeat = 0;
- xNewClickNode->setBegin( makeAny( aEvent ) );
+ xNewClickContainer->setBegin( makeAny( aEvent ) );
- Reference< XAnimationNode > xRefNode( xClickContainer, UNO_QUERY_THROW );
- xSequenceContainer->insertAfter( xNewClickNode, xRefNode );
+ xSequenceContainer->insertAfter( xNewClickContainer, xClickContainer );
xNextContainer.set( ParallelTimeContainer::create( xContext ), UNO_QUERY_THROW );
DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not create container!" );
if( xNextContainer.is() )
{
- Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW );
- xNode->setBegin( makeAny( (double)0.0 ) );
- xNewClickContainer->appendChild( xNode );
+ xNextContainer->setBegin( makeAny( (double)0.0 ) );
+ xNewClickContainer->appendChild( xNextContainer );
}
}
@@ -3157,9 +3146,7 @@ void EffectSequenceHelper::processAfterEffect( const Reference< XAnimationNode >
else
{
// its a hide
- Reference< XChild > xNodeChild( xNode, UNO_QUERY_THROW );
- Reference< XChild > xMasterChild( xMaster, UNO_QUERY_THROW );
- pMasterEffect->setAfterEffectOnNext( xNodeChild->getParent() != xMasterChild->getParent() );
+ pMasterEffect->setAfterEffectOnNext( xNode->getParent() != xMaster->getParent() );
}
}
}
@@ -3371,9 +3358,8 @@ InteractiveSequencePtr MainSequence::createInteractiveSequence( const ::com::sun
xISRoot->setUserData( aUserData );
Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW );
- Reference< XAnimationNode > xISNode( xISRoot, UNO_QUERY_THROW );
Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW );
- xParent->appendChild( xISNode );
+ xParent->appendChild( xISRoot );
pIS.reset( new InteractiveSequence( xISRoot, this) );
pIS->setTriggerShape( xShape );
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index cb4259d0cf49..95d9e3a8dcc9 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -611,8 +611,7 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn
if( pModel )
{
pModel->SetChanged();
- Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xSource );
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xAnnotation );
}
}
@@ -632,8 +631,7 @@ void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
if( pModel )
{
pModel->SetChanged();
- Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xSource );
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xAnnotation );
}
}
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 488e6f540d3a..ffa64d50b8c2 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -567,7 +567,7 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
}
}
- OUString sName( Reference< XNamed >( xSourceTableStyle, UNO_QUERY_THROW )->getName() );
+ OUString sName( xSourceTableStyle->getName() );
if( xTarget->hasByName( sName ) )
xTarget->replaceByName( sName, Any( xNewTableStyle ) );
else
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index d112fb48b798..fa2160b83d69 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -969,9 +969,7 @@ sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Refer
if( xMaster.is() )
{
sal_Int32 nMasterRel = 2;
- Reference< XChild > xNodeChild( xNode, UNO_QUERY );
- Reference< XChild > xMasterChild( xMaster, UNO_QUERY );
- if( xNodeChild.is() && xMasterChild.is() && (xNodeChild->getParent() == xMasterChild->getParent() ) )
+ if( xNode.is() && xMaster.is() && (xNode->getParent() == xMaster->getParent() ) )
nMasterRel = 0;
aMasterRel <<= nMasterRel;
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 9578918c0a0c..f26cb75b234b 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2414,8 +2414,7 @@ void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimation
xRoot->setUserData( aUserData );
xRoot->appendChild( xAnimationNode );
- Reference< XAnimationNode > xNode( xRoot, UNO_QUERY );
- SlideShow::StartPreview( mrBase, mxCurrentPage, xNode );
+ SlideShow::StartPreview( mrBase, mxCurrentPage, xRoot );
}
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 08b903b560fb..45191b372d5c 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -578,10 +578,9 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r
{
bool bRelocationSuccessfull (false);
Reference<XRelocatableResource> xResource (pDescriptor->mxView, UNO_QUERY);
- Reference<XResource> xNewAnchor (rxPane, UNO_QUERY);
- if (xResource.is() && xNewAnchor.is())
+ if (xResource.is() && rxPane.is())
{
- if (xResource->relocateToAnchor(xNewAnchor))
+ if (xResource->relocateToAnchor(rxPane))
bRelocationSuccessfull = true;
}
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 91091c49bb1e..67c22e176ee9 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1125,9 +1125,8 @@ OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_QUERY_THROW );
Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) );
- Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW );
- OUString aModuleIdentifier( xModuleManager->identify( xIfac ) );
+ OUString aModuleIdentifier( xModuleManager->identify( xFrame ) );
if( !aModuleIdentifier.isEmpty() )
{