diff options
Diffstat (limited to 'slideshow/source/engine/slideview.cxx')
-rw-r--r-- | slideshow/source/engine/slideview.cxx | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 04f840f4458f..376b8a3f7249 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -156,7 +156,7 @@ basegfx::B2DPolyPolygon createClipPolygon( const basegfx::B2DPolyPolygon& rCl (createClipPolygon() has to be called every time the view size changes) */ -basegfx::B2DPolyPolygon prepareClip( const basegfx::B2DPolyPolygon& rClip ) +basegfx::B2DPolyPolygon prepareClip( const basegfx::B2DPolyPolygon& rClip ) { basegfx::B2DPolyPolygon aClip( rClip ); @@ -164,14 +164,14 @@ basegfx::B2DPolyPolygon prepareClip( const basegfx::B2DPolyPolygon& rClip ) // AW: Should be no longer necessary; tools are now bezier-safe if( aClip.areControlPointsUsed() ) aClip = basegfx::tools::adaptiveSubdivideByAngle( aClip ); - + // normalize polygon, preparation for clipping // in updateCanvas() aClip = basegfx::tools::correctOrientations(aClip); aClip = basegfx::tools::solveCrossovers(aClip); aClip = basegfx::tools::stripNeutralPolygons(aClip); aClip = basegfx::tools::stripDispensablePolygons(aClip, false); - + return aClip; } @@ -200,8 +200,8 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas, ::basegfx::tools::createPolygonFromRect( basegfx::B2DRange(rArea))); - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCanvas, + ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( + ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCanvas, aPoly ) ); if( pPolyPoly ) @@ -218,7 +218,7 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas, if( pCanvas->getClip() ) { ::cppcanvas::PolyPolygonSharedPtr pPolyPoly2( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCliplessCanvas, + ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCliplessCanvas, *(pCanvas->getClip()) )); if( pPolyPoly2 ) { @@ -244,16 +244,16 @@ basegfx::B2IRange getLayerBoundsPixel( basegfx::B2DRange const& rLayerBounds basegfx::B2DHomMatrix const& rTransformation ) { ::basegfx::B2DRange aTmpRect; - ::canvas::tools::calcTransformedRectBounds( aTmpRect, - rLayerBounds, + ::canvas::tools::calcTransformedRectBounds( aTmpRect, + rLayerBounds, rTransformation ); if( aTmpRect.isEmpty() ) return ::basegfx::B2IRange(); - // #i42440# Returned layer size is one pixel too small, as - // rendering happens one pixel to the right and below the - // actual bound rect. + // #i42440# Returned layer size is one pixel too small, as + // rendering happens one pixel to the right and below the + // actual bound rect. return ::basegfx::B2IRange( ::basegfx::fround(aTmpRect.getMinX()), ::basegfx::fround(aTmpRect.getMinY()), ::basegfx::fround(aTmpRect.getMaxX()) + 1, @@ -313,14 +313,14 @@ class LayerSpriteContainer while( aCurrSprite != aEnd ) { cppcanvas::CustomSpriteSharedPtr pCurrSprite( aCurrSprite->mpSprite.lock() ); - + if( pCurrSprite ) { // only copy still valid sprites over to the refreshed // sprite vector. aValidSprites.push_back( *aCurrSprite ); - pCurrSprite->setPriority( + pCurrSprite->setPriority( getSpritePriority( aValidSprites.size()-1 )); } @@ -384,7 +384,7 @@ public: // prio). This basically caters for the common case of // iterated character animations, which generate lots of // sprites, all added to the end. - pSprite->setPriority( + pSprite->setPriority( getSpritePriority( nNumSprites-1 )); } } @@ -411,7 +411,7 @@ public: the layer priority changes, the sprites change z order together with their parent. */ -class SlideViewLayer : public ViewLayer, +class SlideViewLayer : public ViewLayer, private boost::noncopyable { /// Smart container for all sprites issued by this layer @@ -425,7 +425,7 @@ class SlideViewLayer : public ViewLayer, /// Current clip polygon in user coordinates basegfx::B2DPolyPolygon maClip; - + /// Current size of the view in user coordinates basegfx::B2DSize maUserSize; @@ -442,7 +442,7 @@ class SlideViewLayer : public ViewLayer, /// actual output canvas retrieved from a sprite mutable cppcanvas::CanvasSharedPtr mpOutputCanvas; - + /// ptr back to owning view. needed for isOnView() method View const* const mpParentView; @@ -473,7 +473,7 @@ public: mpSprite(), mpOutputCanvas(), mpParentView(pParentView) - { + { } void updateView( const basegfx::B2DHomMatrix& rMatrix, @@ -534,8 +534,8 @@ private: // Offset given transformation by left, top border of given // range (after transformation through given transformation) basegfx::B2DRectangle aTmpRect; - canvas::tools::calcTransformedRectBounds( aTmpRect, - maLayerBounds, + canvas::tools::calcTransformedRectBounds( aTmpRect, + maLayerBounds, maTransformation ); basegfx::B2DHomMatrix aMatrix( maTransformation ); @@ -601,40 +601,40 @@ private: basegfx::B2DVector(sal::static_int_cast<sal_Int32>(rSpriteSize.getX()), sal::static_int_cast<sal_Int32>(rSpriteSize.getY())) ); - mpSprite->setPriority( + mpSprite->setPriority( maSpriteContainer.getLayerPriority().getMinimum() ); #if defined(VERBOSE) && defined(DBG_UTIL) - mpSprite->movePixel( - basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) + + mpSprite->movePixel( + basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) + basegfx::B2DPoint(10,10) ); - mpSprite->setAlpha(0.5); + mpSprite->setAlpha(0.5); #else - mpSprite->movePixel( + mpSprite->movePixel( basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) ); - mpSprite->setAlpha(1.0); + mpSprite->setAlpha(1.0); #endif - mpSprite->show(); + mpSprite->show(); } ENSURE_OR_THROW( mpSprite, "SlideViewLayer::getCanvas(): no layer sprite" ); mpOutputCanvas = mpSprite->getContentCanvas(); - + ENSURE_OR_THROW( mpOutputCanvas, "SlideViewLayer::getCanvas(): sprite doesn't yield a canvas" ); // new canvas retrieved - setup transformation and clip mpOutputCanvas->setTransformation( getTransformation() ); - mpOutputCanvas->setClip( + mpOutputCanvas->setClip( createClipPolygon( maClip, mpOutputCanvas, maUserSize )); } - + return mpOutputCanvas; } @@ -647,7 +647,7 @@ private: maClip = aNewClip; if(mpOutputCanvas ) - mpOutputCanvas->setClip( + mpOutputCanvas->setClip( createClipPolygon( maClip, mpOutputCanvas, maUserSize )); @@ -669,7 +669,7 @@ private: // --------------------------------------------------------- typedef cppu::WeakComponentImplHelper2< - ::com::sun::star::util::XModifyListener, + ::com::sun::star::util::XModifyListener, ::com::sun::star::awt::XPaintListener> SlideViewBase; /** SlideView class @@ -729,7 +729,7 @@ private: void updateClip(); -private: +private: typedef std::vector< boost::weak_ptr<SlideViewLayer> > ViewLayerVector; /// Prune viewlayers from deceased ones, optionally update them @@ -742,15 +742,15 @@ private: uno::Reference<presentation::XSlideShowView> mxView; cppcanvas::SpriteCanvasSharedPtr mpCanvas; - + EventMultiplexer& mrEventMultiplexer; EventQueue& mrEventQueue; mutable LayerSpriteContainer maSprites; - mutable ViewLayerVector maViewLayers; + mutable ViewLayerVector maViewLayers; basegfx::B2DPolyPolygon maClip; - + basegfx::B2DHomMatrix maViewTransform; basegfx::B2DSize maUserSize; bool mbIsSoundEnabled; @@ -769,19 +769,19 @@ SlideView::SlideView( const uno::Reference<presentation::XSlideShowView>& xView, maViewLayers(), maClip(), maViewTransform(), - maUserSize( 1.0, 1.0 ), // default size: one-by-one rectangle + maUserSize( 1.0, 1.0 ), // default size: one-by-one rectangle mbIsSoundEnabled(true) { // take care not constructing any UNO references to this _inside_ - // ctor, shift that code to createSlideView()! + // ctor, shift that code to createSlideView()! ENSURE_OR_THROW( mxView.is(), "SlideView::SlideView(): Invalid view" ); - + mpCanvas = cppcanvas::VCLFactory::getInstance().createSpriteCanvas( xView->getCanvas() ); - ENSURE_OR_THROW( mpCanvas, + ENSURE_OR_THROW( mpCanvas, "Could not create cppcanvas" ); - + geometry::AffineMatrix2D aViewTransform( xView->getTransformation() ); @@ -792,12 +792,12 @@ SlideView::SlideView( const uno::Reference<presentation::XSlideShowView>& xView, basegfx::B2DVector(aViewTransform.m01, aViewTransform.m11).getLength()) ) { - OSL_ENSURE( false, + OSL_ENSURE( false, "SlideView::SlideView(): Singular matrix!" ); canvas::tools::setIdentityAffineMatrix2D(aViewTransform); } - + basegfx::unotools::homMatrixFromAffineMatrix( maViewTransform, aViewTransform ); @@ -815,7 +815,7 @@ void SlideView::disposing() mpCanvas.reset(); // additionally, also de-register from XSlideShowView - if (mxView.is()) + if (mxView.is()) { mxView->removeTransformationChangedListener( this ); mxView->removePaintListener( this ); @@ -827,7 +827,7 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpCanvas, + ENSURE_OR_THROW( mpCanvas, "SlideView::createViewLayer(): Disposed" ); const std::size_t nNumLayers( maViewLayers.size() ); @@ -871,7 +871,7 @@ void SlideView::clear() const { osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( mxView.is() && mpCanvas, + OSL_ENSURE( mxView.is() && mpCanvas, "SlideView::clear(): Disposed" ); if( !mxView.is() || !mpCanvas ) return; @@ -889,7 +889,7 @@ void SlideView::clearAll() const { osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( mxView.is() && mpCanvas, + OSL_ENSURE( mxView.is() && mpCanvas, "SlideView::clear(): Disposed" ); if( !mxView.is() || !mpCanvas ) return; @@ -923,7 +923,7 @@ cppcanvas::CanvasSharedPtr SlideView::getCanvas() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpCanvas, + ENSURE_OR_THROW( mpCanvas, "SlideView::getCanvas(): Disposed" ); return mpCanvas; @@ -931,7 +931,7 @@ cppcanvas::CanvasSharedPtr SlideView::getCanvas() const cppcanvas::CustomSpriteSharedPtr SlideView::createSprite( const basegfx::B2DSize& rSpriteSizePixel, - double nPriority ) const + double nPriority ) const { osl::MutexGuard aGuard( m_aMutex ); @@ -975,11 +975,11 @@ void SlideView::setClip( const basegfx::B2DPolyPolygon& rClip ) osl::MutexGuard aGuard( m_aMutex ); basegfx::B2DPolyPolygon aNewClip = prepareClip( rClip ); - + if( aNewClip != maClip ) { - maClip = aNewClip; - + maClip = aNewClip; + updateClip(); } } @@ -1025,7 +1025,7 @@ void SlideView::disposing( lang::EventObject const& evt ) // no deregistration necessary anymore, XView has left: osl::MutexGuard const guard( m_aMutex ); - if (mxView.is()) + if (mxView.is()) { OSL_ASSERT( evt.Source == mxView ); mxView.clear(); @@ -1045,7 +1045,7 @@ void SlideView::modified( const lang::EventObject& /*aEvent*/ ) if( !mxView.is() ) return; - + geometry::AffineMatrix2D aViewTransform( mxView->getTransformation() ); @@ -1056,25 +1056,25 @@ void SlideView::modified( const lang::EventObject& /*aEvent*/ ) basegfx::B2DVector(aViewTransform.m01, aViewTransform.m11).getLength()) ) { - OSL_ENSURE( false, + OSL_ENSURE( false, "SlideView::modified(): Singular matrix!" ); canvas::tools::setIdentityAffineMatrix2D(aViewTransform); } - + // view transformation really changed? basegfx::B2DHomMatrix aNewTransform; basegfx::unotools::homMatrixFromAffineMatrix( - aNewTransform, + aNewTransform, aViewTransform ); if( aNewTransform == maViewTransform ) return; // No change, nothing to do - + maViewTransform = aNewTransform; updateCanvas(); - + // notify view change. Don't call EventMultiplexer directly, this // might not be the main thread! mrEventQueue.addEvent( @@ -1092,7 +1092,7 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ ) osl::MutexGuard aGuard( m_aMutex ); OSL_ENSURE( mxView.is() && mpCanvas, "Disposed, but event received?!" ); - + // notify view clobbering. Don't call EventMultiplexer directly, // this might not be the main thread! mrEventQueue.addEvent( @@ -1103,19 +1103,19 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ ) void SlideView::updateCanvas() { - OSL_ENSURE( mpCanvas, + OSL_ENSURE( mpCanvas, "SlideView::updateCanvasTransform(): Disposed" ); if( !mpCanvas || !mxView.is()) return; - + mpCanvas->clear(); // this is unnecessary, strictly speaking. but // it makes the SlideView behave exactly like a // sprite-based SlideViewLayer, because those // are created from scratch after a resize clearAll(); mpCanvas->setTransformation( getTransformation() ); - mpCanvas->setClip( + mpCanvas->setClip( createClipPolygon( maClip, mpCanvas, maUserSize )); @@ -1126,13 +1126,13 @@ void SlideView::updateCanvas() void SlideView::updateClip() { - OSL_ENSURE( mpCanvas, + OSL_ENSURE( mpCanvas, "SlideView::updateClip(): Disposed" ); if( !mpCanvas ) return; - - mpCanvas->setClip( + + mpCanvas->setClip( createClipPolygon( maClip, mpCanvas, maUserSize )); @@ -1144,7 +1144,7 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const { ViewLayerVector aValidLayers; - const basegfx::B2DHomMatrix& rCurrTransform( + const basegfx::B2DHomMatrix& rCurrTransform( getTransformation() ); // check all layers for validity, and retain only the live ones @@ -1153,11 +1153,11 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const while( aCurr != aEnd ) { boost::shared_ptr< SlideViewLayer > pCurrLayer( aCurr->lock() ); - + if( pCurrLayer ) { aValidLayers.push_back( pCurrLayer ); - + if( bWithViewLayerUpdate ) pCurrLayer->updateView( rCurrTransform, maUserSize ); @@ -1178,17 +1178,17 @@ UnoViewSharedPtr createSlideView( uno::Reference< presentation::XSlideShowView> { boost::shared_ptr<SlideView> const that( comphelper::make_shared_from_UNO( - new SlideView(xView, + new SlideView(xView, rEventQueue, rEventMultiplexer))); // register listeners with XSlideShowView xView->addTransformationChangedListener( that.get() ); xView->addPaintListener( that.get() ); - + // set new transformation that->updateCanvas(); - + return that; } |