diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-04 18:51:18 +0100 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-04 18:51:18 +0100 |
commit | a05f4353081edb5a8e2dd0d4fffac5aa4158ecd3 (patch) | |
tree | 980567c28bd94ea0f35a36c588a3cfc44a7f9f02 | |
parent | eb86211c1db0bb492669e7ac8302b89254ed4793 (diff) | |
parent | aa009b1d9a3a8b691e01e9c28db0adcae84cbafc (diff) |
CWS-TOOLING: integrate CWS aw078
34 files changed, 242 insertions, 245 deletions
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 23a04bf9d5ee..040bc7c0a78c 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -69,6 +69,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2drange.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <algorithm> @@ -1715,21 +1716,16 @@ void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj ) SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() ); if( pObj ) { - ::basegfx::B2DHomMatrix aTransform; - SdrPage* pPage = pObj->GetPage(); if( pPage ) { const Size aPageSize( pPage->GetSize() ); - aTransform.scale( (double)aPageSize.Width(), (double)aPageSize.Height() ); - xPolyPoly.transform( aTransform ); - aTransform.identity(); + xPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix((double)aPageSize.Width(), (double)aPageSize.Height())); } const Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); const Point aCenter( aBoundRect.Center() ); - aTransform.translate( aCenter.X(), aCenter.Y() ); - xPolyPoly.transform( aTransform ); + xPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(aCenter.X(), aCenter.Y())); } } @@ -1748,17 +1744,14 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj const Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); const Point aCenter( aBoundRect.Center() ); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -aCenter.X(), -aCenter.Y() ); - xPolyPoly.transform( aTransform ); + xPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); SdrPage* pPage = pObj->GetPage(); if( pPage ) { - aTransform.identity(); const Size aPageSize( pPage->GetSize() ); - aTransform.scale( 1.0 / (double)aPageSize.Width(), 1.0 / (double)aPageSize.Height() ); - xPolyPoly.transform( aTransform ); + xPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix( + 1.0 / (double)aPageSize.Width(), 1.0 / (double)aPageSize.Height())); } } diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 69d1d0203936..389af0473f85 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -302,8 +302,9 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, BOOL bVertical, const Rec case PRESOBJ_HANDOUT: { //Erste Standardseite am SdrPageObj vermerken - SdrPage* pFirstPage = ( (SdDrawDocument*) pModel )->GetSdPage(0, PK_STANDARD); - pSdrObj = new SdrPageObj( pFirstPage ); + // #i105146# We want no content to be displayed for PK_HANDOUT, + // so just never set a page as content + pSdrObj = new SdrPageObj(0); pSdrObj->SetResizeProtect(TRUE); } break; @@ -745,28 +746,17 @@ void SdPage::CreateTitleAndLayout(BOOL bInit, BOOL bCreate ) CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas ); const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3; - - sal_uInt16 nPage = 0; std::vector< Rectangle >::iterator iter( aAreas.begin() ); + while( iter != aAreas.end() ) { SdrPageObj* pPageObj = static_cast<SdrPageObj*>(pMasterPage->CreatePresObj(PRESOBJ_HANDOUT, FALSE, (*iter++), TRUE) ); - - const sal_uInt16 nDestinationPageNum(2 * nPage + 1); - - if(nDestinationPageNum < pModel->GetPageCount()) - { - pPageObj->SetReferencedPage(pModel->GetPage(nDestinationPageNum)); - } - else - { - pPageObj->SetReferencedPage(0L); - } + // #i105146# We want no content to be displayed for PK_HANDOUT, + // so just never set a page as content + pPageObj->SetReferencedPage(0L); if( bSkip && iter != aAreas.end() ) iter++; - - nPage++; } } diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 887c6014f29c..4fc0ec0dc80e 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -36,6 +36,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> @@ -196,9 +197,8 @@ bool PathDragResize::EndSdrDrag(bool /*bCopy*/) SdrPathObj* pPathObj = mxTag->getPathObj(); if( pPathObj ) { - basegfx::B2DHomMatrix aTrans; const Point aRef( DragStat().Ref1() ); - aTrans.translate(-aRef.X(), -aRef.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aRef.X(), -aRef.Y())); aTrans.scale(double(aXFact), double(aYFact)); aTrans.translate(aRef.X(), aRef.Y()); basegfx::B2DPolyPolygon aDragPoly(pPathObj->GetPathPoly()); @@ -966,8 +966,8 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList ) ::com::sun::star::awt::Point aPos( mxOrigin->getPosition() ); if( (aPos.X != maOriginPos.X) || (aPos.Y != maOriginPos.Y) ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y ); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y)); mxPolyPoly.transform( aTransform ); mpPathObj->SetPathPoly( mxPolyPoly ); maOriginPos = aPos; diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index 83851db28cae..db1dc120e478 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -42,13 +42,13 @@ #include <svx/svdogrp.hxx> #include <svx/eeitem.hxx> - #include "View.hxx" #include "ViewShell.hxx" #include "Window.hxx" #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "strings.hrc" #include "sdresid.hxx" @@ -264,9 +264,8 @@ void FuMorph::ImpEqualizePolyPointCount(::basegfx::B2DPolygon& rSmall, const ::b const ::basegfx::B2DPoint aSrcPos(aSrcSize.getCenter()); const ::basegfx::B2DRange aDstSize(::basegfx::tools::getRange(rSmall)); const ::basegfx::B2DPoint aDstPos(aDstSize.getCenter()); - ::basegfx::B2DHomMatrix aTrans; - aTrans.translate(-aSrcPos.getX(), -aSrcPos.getY()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aSrcPos.getX(), -aSrcPos.getY())); aTrans.scale(aDstSize.getWidth() / aSrcSize.getWidth(), aDstSize.getHeight() / aSrcSize.getHeight()); aTrans.translate(aDstPos.getX(), aDstPos.getY()); @@ -499,16 +498,15 @@ sal_Bool FuMorph::ImpMorphPolygons( for(sal_uInt16 i(0); i < nSteps; i++) { fValue += fFactor; - ::basegfx::B2DPolyPolygon* pNewPolyPoly3D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue); + ::basegfx::B2DPolyPolygon* pNewPolyPoly2D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue); - const ::basegfx::B2DRange aNewPolySize(::basegfx::tools::getRange(*pNewPolyPoly3D)); + const ::basegfx::B2DRange aNewPolySize(::basegfx::tools::getRange(*pNewPolyPoly2D)); const ::basegfx::B2DPoint aNewS(aNewPolySize.getCenter()); const ::basegfx::B2DPoint aRealS(aStartCenter + (aDelta * fValue)); - ::basegfx::B2DHomMatrix aTrans; const ::basegfx::B2DPoint aDiff(aRealS - aNewS); - aTrans.translate(aDiff.getX(), aDiff.getY()); - pNewPolyPoly3D->transform(aTrans); - rPolyPolyList3D.Insert(pNewPolyPoly3D, LIST_APPEND); + + pNewPolyPoly2D->transform(basegfx::tools::createTranslateB2DHomMatrix(aDiff)); + rPolyPolyList3D.Insert(pNewPolyPoly2D, LIST_APPEND); } } return TRUE; diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx index f4de77f03394..69190f68a0aa 100644 --- a/sd/source/ui/slideshow/slideshowviewimpl.cxx +++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx @@ -38,6 +38,8 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + #include <cppcanvas/vclfactory.hxx> #include <cppcanvas/basegfxfactory.hxx> @@ -384,16 +386,12 @@ geometry::AffineMatrix2D SAL_CALL SlideShowView::getTransformation( ) throw (Ru Point aOutputOffset( ( aWindowSize.Width() - aOutputSize.Width() ) >> 1, ( aWindowSize.Height() - aOutputSize.Height() ) >> 1 ); - ::basegfx::B2DHomMatrix aMatrix; - maPresentationArea = Rectangle( aOutputOffset, aOutputSize ); mrOutputWindow.SetPresentationArea( maPresentationArea ); - // scale presentation into available window rect (minus 10%) - aMatrix.scale( aOutputSize.Width(), aOutputSize.Height() ); - - // center in the window - aMatrix.translate( aOutputOffset.X(), aOutputOffset.Y() ); + // scale presentation into available window rect (minus 10%); center in the window + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + aOutputSize.Width(), aOutputSize.Height(), aOutputOffset.X(), aOutputOffset.Y())); geometry::AffineMatrix2D aRes; diff --git a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx index 1d99584bec4b..93798e095871 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx @@ -89,6 +89,7 @@ protected: OverlayManager. This registration is done on demand. */ void EnsureRegistration (void); + void RemoveRegistration(); }; @@ -147,6 +148,7 @@ class SelectionRectangleOverlay { public: SelectionRectangleOverlay (ViewOverlay& rViewOverlay); + virtual ~SelectionRectangleOverlay(); void Start (const Point& rAnchor); void Update (const Point& rSecondCorner); @@ -176,6 +178,7 @@ class InsertionIndicatorOverlay { public: InsertionIndicatorOverlay (ViewOverlay& rViewOverlay); + virtual ~InsertionIndicatorOverlay(); /** Given a position in model coordinates this method calculates the insertion marker both as an index in the document and as a rectangle diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx index 3e0d61064bdf..8c3fd4532c4f 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx @@ -256,7 +256,7 @@ namespace sd { namespace slidesorter { namespace view { // class for all derived SdPageObjectPrimitives. The SdPageObjectBasePrimitive itself // is pure virtual -class SdPageObjectBasePrimitive : public drawinglayer::primitive2d::BasePrimitive2D +class SdPageObjectBasePrimitive : public drawinglayer::primitive2d::BufferedDecompositionPrimitive2D { private: // the inner range of the SdPageObject visualisation @@ -275,7 +275,7 @@ public: }; SdPageObjectBasePrimitive::SdPageObjectBasePrimitive(const basegfx::B2DRange& rRange) -: drawinglayer::primitive2d::BasePrimitive2D(), +: drawinglayer::primitive2d::BufferedDecompositionPrimitive2D(), maRange(rRange) { } @@ -286,7 +286,7 @@ SdPageObjectBasePrimitive::~SdPageObjectBasePrimitive() bool SdPageObjectBasePrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const { - if(drawinglayer::primitive2d::BasePrimitive2D::operator==(rPrimitive)) + if(drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdPageObjectBasePrimitive& rCompare = static_cast< const SdPageObjectBasePrimitive& >(rPrimitive); return (getPageObjectRange() == rCompare.getPageObjectRange()); @@ -306,7 +306,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -325,7 +325,7 @@ public: DeclPrimitrive2DIDBlock() }; -Primitive2DSequence SdPageObjectPageBitmapPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectPageBitmapPrimitive::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { // add bitmap primitive // to avoid scaling, use the Bitmap pixel size as primitive size @@ -385,7 +385,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -399,7 +399,7 @@ public: const sal_Int32 SdPageObjectSelectPrimitive::mnSelectionIndicatorOffset(1); const sal_Int32 SdPageObjectSelectPrimitive::mnSelectionIndicatorThickness(3); -Primitive2DSequence SdPageObjectSelectPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectSelectPrimitive::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval(2); @@ -470,7 +470,7 @@ class SdPageObjectBorderPrimitive : public SdPageObjectBasePrimitive { protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -481,7 +481,7 @@ public: DeclPrimitrive2DIDBlock() }; -Primitive2DSequence SdPageObjectBorderPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectBorderPrimitive::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { // since old Width/Height calculations always added a single pixel value, // it is necessary to create a inner range which is one display unit less @@ -524,7 +524,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -537,7 +537,7 @@ public: const sal_Int32 SdPageObjectFocusPrimitive::mnFocusIndicatorOffset(2); -Primitive2DSequence SdPageObjectFocusPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectFocusPrimitive::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval(2); @@ -633,7 +633,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -683,6 +683,7 @@ const BitmapEx& SdPageObjectFadeNameNumberPrimitive::getFadeEffectIconBitmap() c return *mpFadeEffectIconBitmap; } + const sal_Int32 SdPageObjectFadeNameNumberPrimitive::mnCommentsIndicatorOffset(9); BitmapEx* SdPageObjectFadeNameNumberPrimitive::mpCommentsIconBitmap = 0; @@ -701,7 +702,7 @@ const BitmapEx& SdPageObjectFadeNameNumberPrimitive::getCommentsIconBitmap() con return *mpCommentsIconBitmap; } -Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { const xub_StrLen nTextLength(getPageName().Len()); const sal_uInt32 nCount( @@ -727,8 +728,8 @@ Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecompositio // get font attributes basegfx::B2DVector aTextSizeAttribute; - const drawinglayer::primitive2d::FontAttributes aFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + const drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aTextSizeAttribute, getPageNameFont(), false, @@ -834,7 +835,7 @@ Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecompositio 0, aPageName.Len(), aDXArray, - aFontAttributes, + aFontAttribute, aLocale, aFontColor)); } @@ -875,7 +876,7 @@ Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecompositio 0, nNumberLen, aDXArray, - aFontAttributes, + aFontAttribute, aLocale, aFontColor)); @@ -1190,12 +1191,16 @@ void PageObjectViewObjectContact::ActionChanged (void) // Even when we are called from destructor we still have to invalide // the preview bitmap in the cache. const SdrPage* pPage = GetPage(); - SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel()); - if (mpCache!=NULL && pPage!=NULL && pDocument!=NULL) + + if(pPage) { - cache::PageCacheManager::Instance()->InvalidatePreviewBitmap( - pDocument->getUnoModel(), - GetPage()); + SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel()); + if (mpCache!=NULL && pPage!=NULL && pDocument!=NULL) + { + cache::PageCacheManager::Instance()->InvalidatePreviewBitmap( + pDocument->getUnoModel(), + pPage); + } } // call parent @@ -1211,7 +1216,7 @@ void PageObjectViewObjectContact::ActionChanged (void) // Very simple primitive which just remembers the discrete data and applies // it at decomposition time. -class MouseOverEffectPrimitive : public drawinglayer::primitive2d::BasePrimitive2D +class MouseOverEffectPrimitive : public drawinglayer::primitive2d::BufferedDecompositionPrimitive2D { private: basegfx::B2DRange maLogicRange; @@ -1220,7 +1225,7 @@ private: basegfx::BColor maRGBColor; protected: - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition( + virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: @@ -1229,7 +1234,7 @@ public: sal_uInt32 nDiscreteOffset, sal_uInt32 nDiscreteWidth, const basegfx::BColor& rRGBColor) - : drawinglayer::primitive2d::BasePrimitive2D(), + : drawinglayer::primitive2d::BufferedDecompositionPrimitive2D(), maLogicRange(rLogicRange), mnDiscreteOffset(nDiscreteOffset), mnDiscreteWidth(nDiscreteWidth), @@ -1247,7 +1252,7 @@ public: DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence MouseOverEffectPrimitive::createLocalDecomposition( +drawinglayer::primitive2d::Primitive2DSequence MouseOverEffectPrimitive::create2DDecomposition( const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { // get logic sizes in object coordinate system @@ -1277,7 +1282,7 @@ drawinglayer::primitive2d::Primitive2DSequence MouseOverEffectPrimitive::createL bool MouseOverEffectPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const { - if(drawinglayer::primitive2d::BasePrimitive2D::operator==(rPrimitive)) + if(drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const MouseOverEffectPrimitive& rCompare = static_cast< const MouseOverEffectPrimitive& >(rPrimitive); diff --git a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx index 5e338480e236..0cad1985ce35 100644 --- a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx @@ -55,6 +55,8 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + #include <svx/sdr/overlay/overlaymanager.hxx> #include <svx/svdpagv.hxx> #include <svx/sdrpagewindow.hxx> @@ -165,9 +167,7 @@ OverlayBase::OverlayBase (ViewOverlay& rViewOverlay) OverlayBase::~OverlayBase (void) { - OverlayManager* pOverlayManager = getOverlayManager(); - if (pOverlayManager != NULL) - pOverlayManager->remove(*this); + OSL_ENSURE(!getOverlayManager(), "Please call RemoveRegistration() in the derived class; it's too late to call it in the base class since virtual methods will be missing when called in the destructor."); } @@ -186,6 +186,16 @@ void OverlayBase::EnsureRegistration (void) +void OverlayBase::RemoveRegistration() +{ + OverlayManager* pOverlayManager = getOverlayManager(); + if (pOverlayManager != NULL) + pOverlayManager->remove(*this); +} + + + + //===== SubstitutionOverlay ================================================= SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay) @@ -200,6 +210,7 @@ SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay) SubstitutionOverlay::~SubstitutionOverlay (void) { + RemoveRegistration(); } @@ -245,8 +256,7 @@ void SubstitutionOverlay::Clear (void) void SubstitutionOverlay::Move (const Point& rOffset) { - basegfx::B2DHomMatrix aTranslation; - aTranslation.translate(rOffset.X(), rOffset.Y()); + const basegfx::B2DHomMatrix aTranslation(basegfx::tools::createTranslateB2DHomMatrix(rOffset.X(), rOffset.Y())); maShapes.transform(aTranslation); maPosition += rOffset; @@ -316,6 +326,13 @@ SelectionRectangleOverlay::SelectionRectangleOverlay (ViewOverlay& rViewOverlay) +SelectionRectangleOverlay::~SelectionRectangleOverlay() +{ + RemoveRegistration(); +} + + + Rectangle SelectionRectangleOverlay::GetSelectionRectangle (void) { @@ -391,6 +408,14 @@ InsertionIndicatorOverlay::InsertionIndicatorOverlay (ViewOverlay& rViewOverlay) +InsertionIndicatorOverlay::~InsertionIndicatorOverlay() +{ + RemoveRegistration(); +} + + + + void InsertionIndicatorOverlay::SetPositionAndSize (const Rectangle& aNewBoundingBox) { EnsureRegistration(); @@ -509,6 +534,7 @@ MouseOverIndicatorOverlay::MouseOverIndicatorOverlay (ViewOverlay& rViewOverlay) MouseOverIndicatorOverlay::~MouseOverIndicatorOverlay (void) { + RemoveRegistration(); } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 187a62f0dcfe..685bb4a48144 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -322,6 +322,7 @@ const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind ) { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, + { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, @@ -1001,7 +1002,21 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() ); break; case WID_PAGE_NUMBER: - aAny <<= (sal_Int16)((sal_uInt16)((GetPage()->GetPageNum()-1)>>1) + 1); + { + const sal_uInt16 nPageNumber(GetPage()->GetPageNum()); + + if(nPageNumber > 0) + { + // for all other pages calculate the number + aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1); + } + else + { + // for pages with number 0 (Handout Master, Handout page) + // return 0 + aAny <<= (sal_Int16)0; + } + } break; case WID_PAGE_DURATION: aAny <<= (sal_Int32)(GetPage()->GetTime()); diff --git a/sd/source/ui/view/PrintManager.cxx b/sd/source/ui/view/PrintManager.cxx index 3963c4cb5273..6d24fdf98e79 100644 --- a/sd/source/ui/view/PrintManager.cxx +++ b/sd/source/ui/view/PrintManager.cxx @@ -34,6 +34,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "PrintManager.hxx" @@ -1779,10 +1780,10 @@ void PrintManager::InitHandoutTemplate( PrintInfo& /*rInfo*/, USHORT nSlidesPerH aPoly.insert(0, basegfx::B2DPoint( aRect.Left(), aRect.Top() ) ); aPoly.insert(1, basegfx::B2DPoint( aRect.Right(), aRect.Top() ) ); - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( 0.0, static_cast< double >( aRect.GetHeight() / 7 ) ); - + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + 0.0, static_cast< double >( aRect.GetHeight() / 7 ))); basegfx::B2DPolyPolygon aPathPoly; + for( sal_uInt16 nLine = 0; nLine < 7; nLine++ ) { aPoly.transform( aMatrix ); diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 2077a852f960..3d7ec543943b 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -1196,25 +1196,15 @@ BOOL DrawViewShell::SwitchPage(USHORT nSelectedPage) { // set pages for all available handout presentation objects sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList(); - - sal_uInt16 nPgNum = 0; SdrObject* pObj = 0; + while( (pObj = rShapeList.getNextShape(pObj)) != 0 ) { if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT ) { - const sal_uInt16 nDestinationPageNum(2 * nPgNum + 1); - - if(nDestinationPageNum < GetDoc()->GetPageCount()) - { - static_cast<SdrPageObj*>(pObj)->SetReferencedPage(GetDoc()->GetPage(nDestinationPageNum)); - } - else - { - static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0L); - } - - nPgNum++; + // #i105146# We want no content to be displayed for PK_HANDOUT, + // so just never set a page as content + static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0); } } } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 020f2a1ffec5..d38704bd124c 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -99,6 +99,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <svx/unoapi.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <numeric> @@ -447,20 +448,19 @@ drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedP aVclFont.SetHeight( 500 ); - const drawinglayer::primitive2d::FontAttributes aFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + const drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aTextSizeAttribute, aVclFont, false, false)); // fill text matrix - basegfx::B2DHomMatrix aTextMatrix; - - aTextMatrix.scale(aTextSizeAttribute.getX(), aTextSizeAttribute.getY()); - aTextMatrix.shearX(fShearX); - aTextMatrix.rotate(fRotate); - aTextMatrix.translate(fPosX, fPosY); + const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aTextSizeAttribute.getX(), aTextSizeAttribute.getY(), + fShearX, + fRotate, + fPosX, fPosY)); // create DXTextArray (can be empty one) const ::std::vector< double > aDXArray; @@ -476,7 +476,7 @@ drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedP 0, nTextLength, aDXArray, - aFontAttributes, + aFontAttribute, aLocale, aFontColor)); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef); diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index 8e6db547cb85..5826f752cbec 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -48,6 +48,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <com/sun/star/rendering/XCanvas.hpp> @@ -120,10 +121,9 @@ namespace slideshow aLinearTransform.set( 1, 2, 0.0 ); pBitmapCanvas->setTransformation( aLinearTransform ); - ::basegfx::B2DHomMatrix aShapeTransform; - - aShapeTransform.scale( maBounds.getWidth(), maBounds.getHeight() ); - aShapeTransform.translate( maBounds.getMinX(), maBounds.getMinY() ); + const basegfx::B2DHomMatrix aShapeTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( + maBounds.getWidth(), maBounds.getHeight(), + maBounds.getMinX(), maBounds.getMinY())); ::cppcanvas::RendererSharedPtr pRenderer( ::cppcanvas::VCLFactory::getInstance().createRenderer( diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index fb2246309343..4e9c255c86ea 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -51,6 +51,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <canvas/verbosetrace.hxx> #include <canvas/canvastools.hxx> @@ -713,9 +714,8 @@ namespace slideshow aBitmapTransform.invert(); - ::basegfx::B2DHomMatrix aTranslation; - aTranslation.translate( aTmpRect.getMinX(), - aTmpRect.getMinY() ); + const basegfx::B2DHomMatrix aTranslation(basegfx::tools::createTranslateB2DHomMatrix( + aTmpRect.getMinX(), aTmpRect.getMinY())); aBitmapTransform = aBitmapTransform * aTranslation; pBitmap->setTransformation( aBitmapTransform ); diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 9cc6f042cdb2..c06cc0786865 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -42,6 +42,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <canvas/canvastools.hxx> #include <basegfx/tools/canvastools.hxx> @@ -78,9 +79,7 @@ namespace slideshow rendering::RenderState aRenderState; ::canvas::tools::initRenderState( aRenderState ); - ::basegfx::B2DHomMatrix aTranslation; - aTranslation.translate( maOutputPos.getX(), - maOutputPos.getY() ); + const basegfx::B2DHomMatrix aTranslation(basegfx::tools::createTranslateB2DHomMatrix(maOutputPos)); ::canvas::tools::setRenderStateTransform( aRenderState, aTranslation ); try diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index b2c179647db3..136e70743916 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -51,6 +51,7 @@ #include <basegfx/vector/b2ivector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/basegfxfactory.hxx> @@ -524,10 +525,9 @@ namespace slideshow { if( !pAttr ) { - ::basegfx::B2DHomMatrix aTransform; - - aTransform.scale( rShapeBounds.getWidth(), rShapeBounds.getHeight() ); - aTransform.translate( rShapeBounds.getMinX(), rShapeBounds.getMinY() ); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( + rShapeBounds.getWidth(), rShapeBounds.getHeight(), + rShapeBounds.getMinX(), rShapeBounds.getMinY())); return aTransform; } diff --git a/slideshow/source/engine/transitions/barndoorwipe.cxx b/slideshow/source/engine/transitions/barndoorwipe.cxx index fb9388ff9ee8..be226c2c560d 100644 --- a/slideshow/source/engine/transitions/barndoorwipe.cxx +++ b/slideshow/source/engine/transitions/barndoorwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "barndoorwipe.hxx" @@ -45,8 +46,7 @@ namespace internal { if (m_doubled) t /= 2.0; - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); aTransform.scale( ::basegfx::pruneScaleValue(t), 1.0 ); aTransform.translate( 0.5, 0.5 ); ::basegfx::B2DPolygon poly( m_unitRect ); @@ -54,8 +54,7 @@ namespace internal { ::basegfx::B2DPolyPolygon res(poly); if (m_doubled) { - aTransform.identity(); - aTransform.translate( -0.5, -0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); poly.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx index 97bb7fbd688f..58a50815b3ce 100644 --- a/slideshow/source/engine/transitions/clippingfunctor.cxx +++ b/slideshow/source/engine/transitions/clippingfunctor.cxx @@ -40,6 +40,7 @@ #include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -134,20 +135,19 @@ namespace slideshow break; case TransitionInfo::REVERSEMETHOD_ROTATE_180: - maStaticTransformation.translate( -0.5, -0.5 ); - maStaticTransformation.rotate( M_PI ); - maStaticTransformation.translate( 0.5, 0.5 ); + maStaticTransformation = basegfx::tools::createRotateAroundPoint(0.5, 0.5, M_PI) + * maStaticTransformation; break; case TransitionInfo::REVERSEMETHOD_FLIP_X: - maStaticTransformation.scale( -1.0, 1.0 ); - maStaticTransformation.translate( 1.0, 0.0 ); + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0) + * maStaticTransformation; mbFlip = true; break; case TransitionInfo::REVERSEMETHOD_FLIP_Y: - maStaticTransformation.scale( 1.0, -1.0 ); - maStaticTransformation.translate( 0.0, 1.0 ); + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0) + * maStaticTransformation; mbFlip = true; break; } diff --git a/slideshow/source/engine/transitions/clockwipe.cxx b/slideshow/source/engine/transitions/clockwipe.cxx index 16088f1954d0..5beef1efcbd9 100644 --- a/slideshow/source/engine/transitions/clockwipe.cxx +++ b/slideshow/source/engine/transitions/clockwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" @@ -66,9 +67,7 @@ namespace internal { ::basegfx::B2DPolyPolygon ClockWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); ::basegfx::B2DPolygon poly( calcCenteredClock(t) ); poly.transform( aTransform ); return ::basegfx::B2DPolyPolygon(poly); diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index a222592b7d8d..93238162cadb 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -35,6 +35,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/spritecanvas.hxx> @@ -70,11 +71,7 @@ basegfx::B2DPolyPolygon createClipPolygon( // rotate polygons, such that the strips are parallel to // the given direction vector const ::basegfx::B2DVector aUpVec(0.0, 1.0); - ::basegfx::B2DHomMatrix aMatrix; - - aMatrix.translate( -0.5, -0.5 ); - aMatrix.rotate( aUpVec.angle( rDirection ) ); - aMatrix.translate( 0.5, 0.5 ); + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(0.5, 0.5, aUpVec.angle( rDirection ))); // blow up clip polygon to slide size aMatrix.scale( rSlideSize.getX(), @@ -129,7 +126,6 @@ void CombTransition::renderComb( double t, // change transformation on cloned canvas to be in // device pixel cppcanvas::CanvasSharedPtr pCanvas( pCanvas_->clone() ); - basegfx::B2DHomMatrix transform; basegfx::B2DPoint p; // TODO(Q2): Use basegfx bitmaps here @@ -156,17 +152,14 @@ void CombTransition::renderComb( double t, pLeavingBitmap->clip( aClipPolygon1 ); // don't modify bitmap object (no move!): p = basegfx::B2DPoint( pageOrigin + (t * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pLeavingBitmap->draw( pCanvas ); // render even strips: pLeavingBitmap->clip( aClipPolygon2 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin - (t * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pLeavingBitmap->draw( pCanvas ); } @@ -176,19 +169,15 @@ void CombTransition::renderComb( double t, // render odd strips: pEnteringBitmap->clip( aClipPolygon1 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin + ((t - 1.0) * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pEnteringBitmap->draw( pCanvas ); // render even strips: pEnteringBitmap->clip( aClipPolygon2 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin + ((1.0 - t) * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pEnteringBitmap->draw( pCanvas ); } diff --git a/slideshow/source/engine/transitions/fanwipe.cxx b/slideshow/source/engine/transitions/fanwipe.cxx index 286d2a6b57de..220aa108c3f6 100644 --- a/slideshow/source/engine/transitions/fanwipe.cxx +++ b/slideshow/source/engine/transitions/fanwipe.cxx @@ -33,6 +33,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "clockwipe.hxx" #include "fanwipe.hxx" @@ -50,26 +51,21 @@ namespace internal { res.append( poly ); // flip on y-axis: - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( -1.0, 1.0 ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createScaleB2DHomMatrix(-1.0, 1.0)); poly.flip(); res.append( poly ); - aTransform.identity(); - if (m_center) { - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); + if (m_center) + { + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); if (! m_single) res.append( flipOnXAxis(res) ); } - else { + else + { OSL_ASSERT( ! m_fanIn ); - aTransform.scale( 0.5, 1.0 ); - aTransform.translate( 0.5, 1.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0, 0.5, 1.0)); } return res; } diff --git a/slideshow/source/engine/transitions/figurewipe.cxx b/slideshow/source/engine/transitions/figurewipe.cxx index d4f4a2d2fe52..9c0576905877 100644 --- a/slideshow/source/engine/transitions/figurewipe.cxx +++ b/slideshow/source/engine/transitions/figurewipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "figurewipe.hxx" @@ -45,10 +46,7 @@ namespace internal { ::basegfx::B2DPolyPolygon FigureWipe::operator () ( double t ) { ::basegfx::B2DPolyPolygon res(m_figure); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( t, t ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(t, t, 0.5, 0.5)); return res; } diff --git a/slideshow/source/engine/transitions/fourboxwipe.cxx b/slideshow/source/engine/transitions/fourboxwipe.cxx index 61793eaa5a6b..96895cf44b10 100644 --- a/slideshow/source/engine/transitions/fourboxwipe.cxx +++ b/slideshow/source/engine/transitions/fourboxwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "fourboxwipe.hxx" @@ -45,13 +46,15 @@ namespace internal { { ::basegfx::B2DHomMatrix aTransform; const double d = ::basegfx::pruneScaleValue( t / 2.0 ); - if (m_cornersOut) { - aTransform.translate( -0.5, -0.5 ); - aTransform.scale( d, d ); - aTransform.translate( -0.25, -0.25 ); - } else { - aTransform.scale( d, d ); - aTransform.translate( -0.5, -0.5 ); + if (m_cornersOut) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.25, -0.25) + * aTransform; + } + else + { + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.5, -0.5); } // top left: @@ -76,8 +79,7 @@ namespace internal { square4.flip(); // flip direction res.append( square4 ); - aTransform.identity(); - aTransform.translate( 0.5, 0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.5); res.transform( aTransform ); return res; } diff --git a/slideshow/source/engine/transitions/iriswipe.cxx b/slideshow/source/engine/transitions/iriswipe.cxx index 757108ada909..e58a8363e3f8 100644 --- a/slideshow/source/engine/transitions/iriswipe.cxx +++ b/slideshow/source/engine/transitions/iriswipe.cxx @@ -33,6 +33,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "iriswipe.hxx" @@ -41,11 +42,10 @@ namespace internal { ::basegfx::B2DPolyPolygon IrisWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); const double d = ::basegfx::pruneScaleValue(t); - aTransform.scale( d, d ); - aTransform.translate( 0.5, 0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, 0.5, 0.5) * aTransform; + ::basegfx::B2DPolyPolygon res( m_unitRect ); res.transform( aTransform ); return res; diff --git a/slideshow/source/engine/transitions/pinwheelwipe.cxx b/slideshow/source/engine/transitions/pinwheelwipe.cxx index 7e0ec35dff21..d959abb72a4d 100644 --- a/slideshow/source/engine/transitions/pinwheelwipe.cxx +++ b/slideshow/source/engine/transitions/pinwheelwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" #include "pinwheelwipe.hxx" @@ -43,23 +44,17 @@ namespace internal { ::basegfx::B2DPolyPolygon PinWheelWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( t / m_blades, 2.0 /* max edge when rotating */ ) ); ::basegfx::B2DPolyPolygon res; for ( sal_Int32 i = m_blades; i--; ) { - aTransform.identity(); - aTransform.rotate( (i * 2.0 * M_PI) / m_blades ); ::basegfx::B2DPolygon p(poly); - p.transform( aTransform ); + p.transform(basegfx::tools::createRotateB2DHomMatrix((i * 2.0 * M_PI) / m_blades)); res.append( p ); } - aTransform.identity(); - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); return res; } diff --git a/slideshow/source/engine/transitions/randomwipe.cxx b/slideshow/source/engine/transitions/randomwipe.cxx index 94d73d613845..875ec1b3daa0 100644 --- a/slideshow/source/engine/transitions/randomwipe.cxx +++ b/slideshow/source/engine/transitions/randomwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "randomwipe.hxx" #include "tools.hxx" @@ -85,11 +86,9 @@ RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) ::basegfx::B2DPolyPolygon res; for ( sal_Int32 pos = static_cast<sal_Int32>(t * m_nElements); pos--; ) { - ::basegfx::B2DHomMatrix aTransform; ::basegfx::B2DPoint const & point = m_positions[ pos ]; - aTransform.translate( point.getX(), point.getY() ); ::basegfx::B2DPolygon poly( m_rect ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(point.getX(), point.getY())); res.append( poly ); } return res; diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index c8b5cc4a4970..d855b7114ec6 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -37,6 +37,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/basegfxfactory.hxx> #include "slidechangebase.hxx" @@ -179,9 +180,10 @@ void SlideChangeBase::renderBitmap( viewTransform * basegfx::B2DPoint() ); const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); - basegfx::B2DHomMatrix transform; + // render at output position, don't modify bitmap object (no move!): - transform.translate( pageOrigin.getX(), pageOrigin.getY() ); + const basegfx::B2DHomMatrix transform(basegfx::tools::createTranslateB2DHomMatrix( + pageOrigin.getX(), pageOrigin.getY())); pDevicePixelCanvas->setTransformation( transform ); pSlideBitmap->draw( pDevicePixelCanvas ); diff --git a/slideshow/source/engine/transitions/snakewipe.cxx b/slideshow/source/engine/transitions/snakewipe.cxx index 496eaa559a6a..a8050a1b0e9a 100644 --- a/slideshow/source/engine/transitions/snakewipe.cxx +++ b/slideshow/source/engine/transitions/snakewipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "snakewipe.hxx" #include "transitiontools.hxx" @@ -121,16 +122,20 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); poly.setClosed(true); ::basegfx::B2DHomMatrix aTransform; - if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) { + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { // odd line - aTransform.rotate( M_PI_2 + M_PI_4 ); - aTransform.translate( edge + m_elementEdge, 0.0 ); + aTransform = basegfx::tools::createRotateB2DHomMatrix(M_PI_2 + M_PI_4); + aTransform.translate(edge + m_elementEdge, 0.0); } - else { - aTransform.translate( -a, 0.0 ); + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-a, 0.0); aTransform.rotate( -M_PI_4 ); aTransform.translate( 0.0, edge ); } + poly.transform( aTransform ); res.append(poly); } @@ -161,14 +166,17 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); poly.setClosed(true); ::basegfx::B2DHomMatrix aTransform; - if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) { + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { // odd line - aTransform.translate( 0.0, -height ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.0, -height); aTransform.rotate( M_PI_2 + M_PI_4 ); aTransform.translate( 1.0, edge ); } - else { - aTransform.rotate( -M_PI_4 ); + else + { + aTransform = basegfx::tools::createRotateB2DHomMatrix(-M_PI_4); aTransform.translate( edge, 1.0 ); } poly.transform( aTransform ); @@ -205,17 +213,16 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) ::basegfx::B2DPolyPolygon half( calcHalfDiagonalSnake( t, false /* out */ ) ); // flip on x axis and rotate 90 degrees: - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 1.0, -1.0 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0)); aTransform.translate( -0.5, 0.5 ); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); half.flip(); res.append( half ); + // rotate 180 degrees: - aTransform.identity(); - aTransform.translate( -0.5, -0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); @@ -225,8 +232,7 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) { ::basegfx::B2DPolyPolygon half( calcSnake( t / 2.0 ) ); // rotate 90 degrees: - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/spiralwipe.cxx b/slideshow/source/engine/transitions/spiralwipe.cxx index f02c360a2628..5b8463ad9eea 100644 --- a/slideshow/source/engine/transitions/spiralwipe.cxx +++ b/slideshow/source/engine/transitions/spiralwipe.cxx @@ -38,6 +38,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -57,8 +58,7 @@ SpiralWipe::SpiralWipe( sal_Int32 nElements, bool flipOnYAxis ) const double e = (sqrt(area) / 2.0); const sal_Int32 edge = (static_cast<sal_Int32>(e) * 2); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); const double edge_ = ::basegfx::pruneScaleValue( static_cast<double>(edge) / m_sqrtElements ); aTransform.scale( edge_, edge_ ); @@ -75,8 +75,7 @@ SpiralWipe::SpiralWipe( sal_Int32 nElements, bool flipOnYAxis ) const sal_Int32 alen = (len > edge1 ? edge1 : len); len -= alen; poly = createUnitRect(); - aTransform.identity(); - aTransform.scale( + aTransform = basegfx::tools::createScaleB2DHomMatrix( ::basegfx::pruneScaleValue( static_cast<double>(alen) / m_sqrtElements ), ::basegfx::pruneScaleValue( 1.0 / m_sqrtElements ) ); aTransform.translate( diff --git a/slideshow/source/engine/transitions/sweepwipe.cxx b/slideshow/source/engine/transitions/sweepwipe.cxx index 17a3d8933797..ae6bd8a21f82 100644 --- a/slideshow/source/engine/transitions/sweepwipe.cxx +++ b/slideshow/source/engine/transitions/sweepwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" #include "sweepwipe.hxx" #include "transitiontools.hxx" @@ -52,22 +53,26 @@ namespace internal { ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( 0.25 + t ) ); ::basegfx::B2DHomMatrix aTransform; - if (m_center) { - aTransform.translate( 0.5, 0.0 ); + + if (m_center) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.0); poly.transform( aTransform ); } ::basegfx::B2DPolyPolygon res(poly); - if (! m_single) { - aTransform.identity(); - if (m_oppositeVertical) { - aTransform.scale( 1.0, -1.0 ); + if (! m_single) + { + if (m_oppositeVertical) + { + aTransform = basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0); aTransform.translate( 0.0, 1.0 ); poly.transform( aTransform ); poly.flip(); } - else { - aTransform.translate( -0.5, -0.5 ); + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI ); aTransform.translate( 0.5, 0.5 ); poly.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/transitiontools.cxx b/slideshow/source/engine/transitions/transitiontools.cxx index 6197e24514e0..c09bd12ef43d 100644 --- a/slideshow/source/engine/transitions/transitiontools.cxx +++ b/slideshow/source/engine/transitions/transitiontools.cxx @@ -36,6 +36,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -53,10 +54,7 @@ namespace internal { ::basegfx::B2DPolyPolygon const & polypoly ) { ::basegfx::B2DPolyPolygon res(polypoly); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( -1.0, 1.0 ); - aTransform.translate( 1.0, 0.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0)); res.flip(); return res; } @@ -65,10 +63,7 @@ namespace internal { ::basegfx::B2DPolyPolygon const & polypoly ) { ::basegfx::B2DPolyPolygon res(polypoly); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 1.0, -1.0 ); - aTransform.translate( 0.0, 1.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0)); res.flip(); return res; } diff --git a/slideshow/source/engine/transitions/waterfallwipe.cxx b/slideshow/source/engine/transitions/waterfallwipe.cxx index 7a86edff5c67..c81cf2c68433 100644 --- a/slideshow/source/engine/transitions/waterfallwipe.cxx +++ b/slideshow/source/engine/transitions/waterfallwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "waterfallwipe.hxx" #include "transitiontools.hxx" @@ -67,9 +68,7 @@ WaterfallWipe::WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis ) ::basegfx::B2DPolyPolygon WaterfallWipe::operator () ( double t ) { ::basegfx::B2DPolygon poly( m_waterfall ); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( 0.0, ::basegfx::pruneScaleValue( 2.0 * t ) ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(0.0, ::basegfx::pruneScaleValue(2.0 * t))); poly.setB2DPoint( 0, ::basegfx::B2DPoint( 0.0, -1.0 ) ); poly.setB2DPoint( poly.count()-1, ::basegfx::B2DPoint( 1.0, -1.0 ) ); diff --git a/slideshow/source/engine/transitions/zigzagwipe.cxx b/slideshow/source/engine/transitions/zigzagwipe.cxx index edc16099f843..8fa22c15c052 100644 --- a/slideshow/source/engine/transitions/zigzagwipe.cxx +++ b/slideshow/source/engine/transitions/zigzagwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "zigzagwipe.hxx" @@ -58,10 +59,8 @@ ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) ::basegfx::B2DPolyPolygon ZigZagWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( (1.0 + m_zigEdge) * t, 0.0 ); ::basegfx::B2DPolyPolygon res(m_stdZigZag); - res.transform( aTransform ); + res.transform(basegfx::tools::createTranslateB2DHomMatrix((1.0 + m_zigEdge) * t, 0.0)); return res; } @@ -70,8 +69,8 @@ ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) ::basegfx::B2DPolyPolygon res( createUnitRect() ); ::basegfx::B2DPolygon poly( m_stdZigZag ); poly.flip(); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( (1.0 + m_zigEdge) * (1.0 - t) / 2.0, 0.0 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + (1.0 + m_zigEdge) * (1.0 - t) / 2.0, 0.0)); poly.transform( aTransform ); res.append( poly ); aTransform.scale( -1.0, 1.0 ); diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx index da7b4bfe3d3a..f860644dd5ac 100644 --- a/slideshow/test/demoshow.cxx +++ b/slideshow/test/demoshow.cxx @@ -100,12 +100,9 @@ public: void resize( const ::Size& rNewSize ) { maSize = rNewSize; - maTransform.identity(); - const sal_Int32 nSize( std::min( rNewSize.Width(), - rNewSize.Height() ) - 10 ); - maTransform.scale( nSize, nSize ); - maTransform.translate( (rNewSize.Width() - nSize) / 2, - (rNewSize.Height() - nSize) / 2 ); + const sal_Int32 nSize( std::min( rNewSize.Width(), rNewSize.Height() ) - 10); + maTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + nSize, nSize, (rNewSize.Width() - nSize) / 2, (rNewSize.Height() - nSize) / 2); lang::EventObject aEvent( *this ); maTransformationListeners.notifyEach( &util::XModifyListener::modified, |