diff options
Diffstat (limited to 'svx/source')
44 files changed, 452 insertions, 623 deletions
diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index 85ba97f1a826..35ebb4dec0f6 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -70,8 +70,8 @@ namespace drawinglayer void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) { - // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch - switch(rCandidate.getPrimitiveID()) + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch + switch(rCandidate.getPrimitive3DID()) { case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : { diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 06d4cf5bbe95..3f89d202b6ba 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -77,6 +77,7 @@ #include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() @@ -185,9 +186,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // buld transfoprmation: translate and rotate so that given edge is // on x axis, them mirror in y and translate back const basegfx::B2DVector aEdge(aMirrorAxisB.X() - aMirrorAxisA.X(), aMirrorAxisB.Y() - aMirrorAxisA.Y()); - basegfx::B2DHomMatrix aMatrixTransform; - - aMatrixTransform.translate(-aMirrorAxisA.X(), -aMirrorAxisA.Y()); + basegfx::B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aMirrorAxisA.X(), -aMirrorAxisA.Y())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aMatrixTransform.scale(1.0, -1.0); aMatrixTransform.rotate(atan2(aEdge.getY(), aEdge.getX())); @@ -932,9 +932,8 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg if(fRot3D != 0.0) { - aLatheMat.translate(-aPnt2.getX(), -aPnt2.getY()); - aLatheMat.rotate(-fRot3D); - aLatheMat.translate(aPnt2.getX(), aPnt2.getY()); + aLatheMat = basegfx::tools::createRotateAroundPoint(aPnt2, -fRot3D) + * aLatheMat; } } diff --git a/svx/source/gengal/gengal.sh b/svx/source/gengal/gengal.sh index 0e9613da4df8..d6a9e3cbec94 100644 --- a/svx/source/gengal/gengal.sh +++ b/svx/source/gengal/gengal.sh @@ -80,11 +80,6 @@ case $sd_platform in export SHLIB_PATH ;; - IRIX*) - LD_LIBRARYN32_PATH=${sd_prog}${LD_LIBRARYN32_PATH+:${LD_LIBRARYN32_PATH}} - export LD_LIBRARYN32_PATH - ;; - *) LD_LIBRARY_PATH=${sd_prog}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}} export LD_LIBRARY_PATH diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 6c9d9a4c4c24..fcac5f68056e 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -52,18 +52,16 @@ #include "svdstr.hrc" #include <svdglob.hxx> #include <vcl/svapp.hxx> - #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> - #include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx> #include <svx/eeitem.hxx> #include <svx/colritem.hxx> -//#include <svx/xtable.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -148,11 +146,9 @@ namespace sdr { // create the EmptyPresObj fallback visualisation. The fallback graphic // is already provided in rGraphicObject in this case, use it - aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aSmallerMatrix.translate(fOffsetX, fOffsetY); - aSmallerMatrix.shearX(fShearX); - aSmallerMatrix.rotate(fRotate); - aSmallerMatrix.translate(aTranslate.getX(), aTranslate.getY()); + aSmallerMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY); + aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); @@ -241,12 +237,8 @@ namespace sdr && basegfx::fTools::lessOrEqual(fWidth, aScale.getX()) && basegfx::fTools::lessOrEqual(fHeight, aScale.getY())) { - basegfx::B2DHomMatrix aBitmapMatrix; - - aBitmapMatrix.scale(fWidth, fHeight); - aBitmapMatrix.shearX(fShearX); - aBitmapMatrix.rotate(fRotate); - aBitmapMatrix.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fWidth, fHeight, fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, drawinglayer::primitive2d::Primitive2DReference( @@ -293,12 +285,8 @@ namespace sdr if(pSdrText && pOPO) { // directly use the remaining space as TextRangeTransform - basegfx::B2DHomMatrix aTextRangeTransform; - - aTextRangeTransform.scale(aScale.getX(), aScale.getY()); - aTextRangeTransform.shearX(fShearX); - aTextRangeTransform.rotate(fRotate); - aTextRangeTransform.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aTextRangeTransform(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate)); // directly create temp SdrBlockTextPrimitive2D drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive( @@ -380,7 +368,6 @@ namespace sdr // which will use the primitive data we just create in the near future const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - basegfx::B2DHomMatrix aObjectMatrix; // look for mirroring const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); @@ -411,10 +398,10 @@ namespace sdr // fill object matrix const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - aObjectMatrix.scale(aObjectRange.getWidth(), aObjectRange.getHeight()); - aObjectMatrix.shearX(fShearX); - aObjectMatrix.rotate(fRotate); - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); // get the current, unchenged graphic obect from SdrGrafObj const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index c5c682222fde..337681e4d391 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -37,6 +37,7 @@ #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// // includes for special text box shadow (SC) @@ -83,30 +84,13 @@ namespace sdr const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // calculate corner radius double fCornerRadiusX; @@ -164,7 +148,7 @@ namespace sdr const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); aObjectMatrix.translate(nXDist, nYDist); - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::createLocalDecomposition) + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); // create the specialized shadow primitive diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index c57c153e9e40..047685dc14f2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -39,6 +39,7 @@ #include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx> #include <svl/itemset.hxx> #include <svx/sxciaitm.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -73,30 +74,13 @@ namespace sdr const Rectangle& rRectangle = GetCircObj().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // create primitive data const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 9d19e752396c..352b9198e97b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -39,6 +39,7 @@ #include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <svx/obj3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -223,13 +224,14 @@ namespace sdr } // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, - xGroup, - aTextBoxMatrix, - bWordWrap, - false, // #SJ# New parameter to force to clipped BlockText for SC - b3DShape)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + *pAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index a054e881b7c3..7672577138d0 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -46,6 +46,7 @@ #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <vcl/svapp.hxx> #include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -88,12 +89,9 @@ namespace sdr const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - basegfx::B2DHomMatrix aObjectMatrix; - - aObjectMatrix.scale(aObjectRange.getWidth(), aObjectRange.getHeight()); - aObjectMatrix.shearX(fShearX); - aObjectMatrix.rotate(fRotate); - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); // Prepare attribute settings, will be used soon anyways const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 0f818ff40f7a..3c8449bae7f6 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -38,6 +38,7 @@ #include <svx/sdr/attribute/sdrallattribute.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -98,9 +99,11 @@ namespace sdr aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix.scale(aLine.getLength(), 1.0); - aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX())); - aObjectMatrix.translate(aStart.getX(), aStart.getY()); + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } else { @@ -110,22 +113,14 @@ namespace sdr const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); const double fWidth(aObjectRange.getWidth()); const double fHeight(aObjectRange.getHeight()); - - aObjectMatrix.scale( - basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth, - basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); // ceate unit polygon from object's absolute path basegfx::B2DHomMatrix aInverse(aObjectMatrix); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 0eab2c882ce5..94b26b5d020e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -39,6 +39,7 @@ #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx> #include <svl/itemset.hxx> #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <svx/svdmodel.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -74,30 +75,13 @@ namespace sdr const Rectangle& rRectangle = GetRectObj().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // calculate corner radius sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index af222889a253..f265af141ef1 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -112,7 +112,7 @@ namespace void AnimatedExtractingProcessor2D::processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate) { // known implementation, access directly - switch(rCandidate.getPrimitiveID()) + switch(rCandidate.getPrimitive2DID()) { // add and accept animated primitives directly, no need to decompose case PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D : diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 34fddf088c98..bd208b5cf54f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -44,6 +44,7 @@ #include <svx/svdpage.hxx> #include <unoapi.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -153,7 +154,7 @@ namespace sdr // would be possible, but would require the internal transformation // which maps between the page visualisation object and the page // content, including the aspect ratios (for details see in - // PagePreviewPrimitive2D::createLocalDecomposition) + // PagePreviewPrimitive2D::create2DDecomposition) basegfx::B2DRange(), GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)), @@ -234,6 +235,9 @@ namespace sdr aPageObjectTransform.set(1, 2, aPageObjectBound.getMinY()); } + // #i102637# add gray frame also when printing and page exists (handout pages) + const bool bCreateGrayFrame(!GetObjectContact().isOutputToPrinter() || pPage); + // get displayed page's content. This is the uscaled page content if(mpExtractor && pPage) { @@ -289,10 +293,28 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPagePreview, 1); } } + else if(bCreateGrayFrame) + { + // #i105146# no content, but frame display. To make hitting the page preview objects + // on the handout page more simple, add a HitTest fill primitive + const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + aOutline.transform(aPageObjectTransform); + + const drawinglayer::primitive2d::Primitive2DReference xHitFill( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aOutline), + basegfx::BColor(0.0, 0.0, 0.0))); + + const drawinglayer::primitive2d::Primitive2DReference xHit( + new drawinglayer::primitive2d::HitTestPrimitive2D( + drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1))); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1); + } // add a gray outline frame, except not when printing - // #i102637# add frame also when printing and page exists (handout pages) - if(!GetObjectContact().isOutputToPrinter() || pPage) + if(bCreateGrayFrame) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index ec876ec036ac..0442c95f60d5 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -880,14 +880,19 @@ namespace sdr { namespace contact { //==================================================================== //= LazyControlCreationPrimitive2D //==================================================================== - class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BasePrimitive2D + class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D { private: - typedef ::drawinglayer::primitive2d::BasePrimitive2D BasePrimitive2D; + typedef ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D BufferedDecompositionPrimitive2D; protected: virtual ::drawinglayer::primitive2d::Primitive2DSequence - createLocalDecomposition( + get2DDecomposition( + const ::drawinglayer::geometry::ViewInformation2D& rViewInformation + ) const; + + virtual ::drawinglayer::primitive2d::Primitive2DSequence + create2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& rViewInformation ) const; @@ -1583,7 +1588,7 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- bool LazyControlCreationPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if ( !BasePrimitive2D::operator==( rPrimitive ) ) + if ( !BufferedDecompositionPrimitive2D::operator==( rPrimitive ) ) return false; const LazyControlCreationPrimitive2D* pRHS = dynamic_cast< const LazyControlCreationPrimitive2D* >( &rPrimitive ); @@ -1629,7 +1634,20 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + { + #if OSL_DEBUG_LEVEL > 1 + ::basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX ); + #endif + if ( m_pVOCImpl->hasControl() ) + impl_positionAndZoomControl( _rViewInformation ); + return BufferedDecompositionPrimitive2D::get2DDecomposition( _rViewInformation ); + } + + //-------------------------------------------------------------------- + ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::create2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { #if OSL_DEBUG_LEVEL > 1 ::basegfx::B2DVector aScale, aTranslate; diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index 2411ca3c31b4..b788de195903 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -113,9 +113,16 @@ namespace sdr if(nCount) { // create range primitives - const basegfx::BColor aRGBColor(getBaseColor().getBColor()); + const bool bInvert(OVERLAY_INVERT == maLastOverlayType); + basegfx::BColor aRGBColor(getBaseColor().getBColor()); aRetval.realloc(nCount); + if(bInvert) + { + // force color to white for invert to get a full invert + aRGBColor = basegfx::BColor(1.0, 1.0, 1.0); + } + for(sal_uInt32 a(0);a < nCount; a++) { const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a])); @@ -125,7 +132,7 @@ namespace sdr aRGBColor)); } - if(OVERLAY_INVERT == maLastOverlayType) + if(bInvert) { // embed all in invert primitive const drawinglayer::primitive2d::Primitive2DReference aInvert( diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 664c487c7e43..22b273a2a0e4 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -40,6 +40,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -59,7 +60,7 @@ namespace drawinglayer mnCenterY(nCenterY) {} - Primitive2DSequence OverlayBitmapExPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayBitmapExPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; const Size aBitmapSize(getBitmapEx().GetSizePixel()); @@ -129,7 +130,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayCrosshairPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayCrosshairPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; @@ -208,7 +209,7 @@ namespace drawinglayer mfRotation(fRotation) {} - Primitive2DSequence OverlayHatchRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayHatchRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; @@ -230,11 +231,8 @@ namespace drawinglayer if(!basegfx::fTools::equalZero(getRotation())) { - basegfx::B2DHomMatrix aTransform; - - aTransform.translate(-getObjectRange().getMinX(), -getObjectRange().getMinY()); - aTransform.rotate(getRotation()); - aTransform.translate(getObjectRange().getMinX(), getObjectRange().getMinY()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createRotateAroundPoint( + getObjectRange().getMinX(), getObjectRange().getMinY(), getRotation())); aHatchPolyPolygon.transform(aTransform); } @@ -301,7 +299,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayHelplineStripedPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence OverlayHelplineStripedPrimitive::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; @@ -417,7 +415,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayRollingRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayRollingRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 73d5689350c2..e4967f767299 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrCaptionPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; Primitive2DSequence aHitTestContent; @@ -142,7 +142,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rTail, double fCornerRadiusX, double fCornerRadiusY) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maTail(rTail), @@ -160,7 +160,7 @@ namespace drawinglayer bool SdrCaptionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCaptionPrimitive2D& rCompare = (SdrCaptionPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index a04021ae21ad..0c39f7a6480f 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrConnectorPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -87,7 +87,7 @@ namespace drawinglayer SdrConnectorPrimitive2D::SdrConnectorPrimitive2D( const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, const ::basegfx::B2DPolygon& rUnitPolygon) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maSdrLSTAttribute(rSdrLSTAttribute), maUnitPolygon(rUnitPolygon) { @@ -95,7 +95,7 @@ namespace drawinglayer bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrConnectorPrimitive2D& rCompare = (SdrConnectorPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index af3e6aacb410..5b686bb5abae 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrCustomShapePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCustomShapePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval(getSubPrimitives()); @@ -92,21 +92,21 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap, - bool bForceTextClipToTextRange, - bool b3DShape) - : BasePrimitive2D(), + bool b3DShape, + bool bForceTextClipToTextRange) + : BufferedDecompositionPrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), mbWordWrap(bWordWrap), - mbForceTextClipToTextRange(bForceTextClipToTextRange), - mb3DShape(b3DShape) + mb3DShape(b3DShape), + mbForceTextClipToTextRange(bForceTextClipToTextRange) { } bool SdrCustomShapePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCustomShapePrimitive2D& rCompare = (SdrCustomShapePrimitive2D&)rPrimitive; @@ -114,8 +114,8 @@ namespace drawinglayer && getSubPrimitives() == rCompare.getSubPrimitives() && getTextBox() == rCompare.getTextBox() && getWordWrap() == rCompare.getWordWrap() - && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange() - && get3DShape() == rCompare.get3DShape()); + && get3DShape() == rCompare.get3DShape() + && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index cd426edfdd05..8474b72be2e4 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -75,11 +75,11 @@ namespace drawinglayer // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - BasePrimitive2D* pNewFillPrimitive = 0L; + BasePrimitive2D* pNewFillPrimitive = 0; if(rFill.isGradient()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); } else if(rFill.isHatch()) { @@ -88,7 +88,7 @@ namespace drawinglayer else if(rFill.isBitmap()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); } else { @@ -192,19 +192,17 @@ namespace drawinglayer // scale outline to object's size to allow growing with value relative to that size // and also to keep aspect ratio - basegfx::B2DHomMatrix aScaleTransform; - aScaleTransform.set(0, 0, fabs(aScale.getX())); - aScaleTransform.set(1, 1, fabs(aScale.getY())); basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); - aScaledUnitPolyPolygon.transform(aScaleTransform); + aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( + fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); // scale back to unit polygon - aScaleTransform.set(0, 0, 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0); - aScaleTransform.set(1, 1, 0.0 != aScale.getY() ? 1.0 / aScale.getY() : 1.0); - aScaledUnitPolyPolygon.transform(aScaleTransform); + aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( + 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0, + 0.0 != aScale.getY() ? 1.0 / aScale.getY() : 1.0)); // create with unit polygon pNew = new SdrContourTextPrimitive2D( @@ -265,17 +263,16 @@ namespace drawinglayer aTextAnchorRange.expand(aBottomRight); // now create a transformation from this basic range (aTextAnchorRange) - aAnchorTransform.identity(); - aAnchorTransform.scale(aTextAnchorRange.getWidth(), aTextAnchorRange.getHeight()); - aAnchorTransform.translate(aTextAnchorRange.getMinX(), aTextAnchorRange.getMinY()); + aAnchorTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + aTextAnchorRange.getWidth(), aTextAnchorRange.getHeight(), + aTextAnchorRange.getMinX(), aTextAnchorRange.getMinY()); // apply mirroring aAnchorTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // apply object's other transforms - aAnchorTransform.shearX(fShearX); - aAnchorTransform.rotate(fRotate); - aAnchorTransform.translate(aTranslate.getX(), aTranslate.getY()); + aAnchorTransform = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aAnchorTransform; if(rText.isFitToSize()) { @@ -342,10 +339,8 @@ namespace drawinglayer aAnchorTransform.decompose(aScale, aTranslate, fRotate, fShearX); // build transform from scaled only to full AnchorTransform and inverse - basegfx::B2DHomMatrix aSRT; - aSRT.shearX(fShearX); - aSRT.rotate(fRotate); - aSRT.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aSRT(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate)); basegfx::B2DHomMatrix aISRT(aSRT); aISRT.invert(); diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 4f7e2c768669..1327d2a422fa 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -39,6 +39,7 @@ #include <drawinglayer/primitive2d/hittestprimitive2d.hxx> #include <basegfx/color/bcolor.hxx> #include <drawinglayer/attribute/sdrattribute.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +51,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrEllipsePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrEllipsePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -61,11 +62,7 @@ namespace drawinglayer ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - ::basegfx::B2DHomMatrix aUnitCorrectionMatrix; - aUnitCorrectionMatrix.set(0, 0, 0.5); - aUnitCorrectionMatrix.set(1, 1, 0.5); - aUnitCorrectionMatrix.set(0, 2, 0.5); - aUnitCorrectionMatrix.set(1, 2, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); @@ -109,7 +106,7 @@ namespace drawinglayer SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( const ::basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute) { @@ -117,7 +114,7 @@ namespace drawinglayer bool SdrEllipsePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrEllipsePrimitive2D& rCompare = (SdrEllipsePrimitive2D&)rPrimitive; @@ -140,13 +137,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrEllipseSegmentPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrEllipseSegmentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; // create unit outline polygon ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); - ::basegfx::B2DHomMatrix aUnitCorrectionMatrix; if(mbCloseSegment) { @@ -161,7 +157,7 @@ namespace drawinglayer } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - aUnitCorrectionMatrix.translate(1.0, 1.0); + basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); aUnitCorrectionMatrix.scale(0.5, 0.5); // apply to the geometry diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 63d050a775af..befff1b0c539 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -44,7 +44,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrGrafPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrGrafPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -121,7 +121,7 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maGraphicObject(rGraphicObject), @@ -133,7 +133,7 @@ namespace drawinglayer bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrGrafPrimitive2D& rCompare = (SdrGrafPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index cb2452e8ba1f..e22e9eb61c5b 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -40,6 +40,7 @@ #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -85,7 +86,7 @@ namespace drawinglayer return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); } - Primitive2DSequence SdrMeasurePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; SdrBlockTextPrimitive2D* pBlockText = 0L; @@ -97,10 +98,8 @@ namespace drawinglayer const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); - - basegfx::B2DHomMatrix aObjectMatrix; - aObjectMatrix.rotate(fAngle); - aObjectMatrix.translate(getStart().getX(), getStart().getY()); + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); if(pTextAttribute) { @@ -430,7 +429,7 @@ namespace drawinglayer // apply to existing text primitive SdrTextPrimitive2D* pNewBlockText = pBlockText->createTransformedClone(aChange); - OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::createLocalDecomposition: Could not create transformed clone of text primitive (!)"); + OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)"); delete pBlockText; // add to local primitives @@ -460,7 +459,7 @@ namespace drawinglayer bool bBelow, bool bTextRotation, bool bTextAutoAngle) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maSdrLSTAttribute(rSdrLSTAttribute), maStart(rStart), maEnd(rEnd), @@ -479,7 +478,7 @@ namespace drawinglayer bool SdrMeasurePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrMeasurePrimitive2D& rCompare = (SdrMeasurePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 7c44311d3c5a..bf2df22fb2e6 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -46,9 +46,37 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrOle2Primitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + SdrOle2Primitive2D::SdrOle2Primitive2D( + const Primitive2DSequence& rOLEContent, + const basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) + : BasePrimitive2D(), + maOLEContent(rOLEContent), + maTransform(rTransform), + maSdrLFSTAttribute(rSdrLFSTAttribute) + { + } + + bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; + + if(getOLEContent() == rCompare.getOLEContent() + && getTransform() == rCompare.getTransform() + && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) + { + return true; + } + } + + return false; + } + + Primitive2DSequence SdrOle2Primitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { - // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::createLocalDecomposition + // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition // should happen. For the moment we only need the OLE itself // Added complete primitive preparation using getSdrLFSTAttribute() now. To not do stuff which is not needed now, it // may be supressed by using a static bool. The paint version only supported text. @@ -104,7 +132,7 @@ namespace drawinglayer } // add graphic content - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getChildren()); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getOLEContent()); // add text, no need to supress to stay compatible since text was // always supported by the old paints, too @@ -122,32 +150,6 @@ namespace drawinglayer return aRetval; } - SdrOle2Primitive2D::SdrOle2Primitive2D( - const Primitive2DSequence& rChildren, - const ::basegfx::B2DHomMatrix& rTransform, - const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) - : GroupPrimitive2D(rChildren), - maTransform(rTransform), - maSdrLFSTAttribute(rSdrLFSTAttribute) - { - } - - bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - - if(getTransform() == rCompare.getTransform() - && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) - { - return true; - } - } - - return false; - } - // provide unique ID ImplPrimitrive2DIDBlock(SdrOle2Primitive2D, PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D) diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index e682c0e04b55..d46ab7b4b14d 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -39,6 +39,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -46,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrOleContentPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrOleContentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0); @@ -105,13 +106,10 @@ namespace drawinglayer if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) { // if content fits into frame, create it - basegfx::B2DHomMatrix aInnerObjectMatrix; - - aInnerObjectMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aInnerObjectMatrix.translate(fOffsetX, fOffsetY); - aInnerObjectMatrix.shearX(fShearX); - aInnerObjectMatrix.rotate(fRotate); - aInnerObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); + basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); + aInnerObjectMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aInnerObjectMatrix; const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( new drawinglayer::primitive2d::GraphicPrimitive2D( @@ -159,7 +157,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rObjectTransform, sal_uInt32 nGraphicVersion, bool bHighContrast) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), mnGraphicVersion(nGraphicVersion), @@ -169,7 +167,7 @@ namespace drawinglayer bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive; const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is()); diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 96da706fb66a..39f3efc617f5 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrPathPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -105,7 +105,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, const basegfx::B2DPolyPolygon& rUnitPolyPolygon) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maUnitPolyPolygon(rUnitPolyPolygon) @@ -114,7 +114,7 @@ namespace drawinglayer bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 097cd5edd445..93ed597cb0a3 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrRectanglePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; Primitive2DSequence aHitTestContent; @@ -128,7 +128,7 @@ namespace drawinglayer double fCornerRadiusX, double fCornerRadiusY, bool bForceFillForHitTest) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), mfCornerRadiusX(fCornerRadiusX), @@ -139,7 +139,7 @@ namespace drawinglayer bool SdrRectanglePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrRectanglePrimitive2D& rCompare = (SdrRectanglePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 47e85894f37e..6b1ad6e27755 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -109,7 +109,7 @@ namespace drawinglayer SdrTextPrimitive2D::SdrTextPrimitive2D( const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), mrSdrText(const_cast< SdrText* >(pSdrText)), maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), @@ -132,7 +132,7 @@ namespace drawinglayer bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; @@ -157,7 +157,7 @@ namespace drawinglayer sal_Int16 nCurrentlyValidPageNumber(0); sal_Int16 nCurrentlyValidPageCount(0); - if(getLocalDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { bool bDoDelete(false); @@ -211,11 +211,11 @@ namespace drawinglayer if(bDoDelete) { - const_cast< SdrTextPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence()); + const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocalDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField) { @@ -245,7 +245,7 @@ namespace drawinglayer } // call parent - return BasePrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -256,7 +256,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrContourTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation); @@ -309,7 +309,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrPathTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation); @@ -365,7 +365,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrBlockTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation); @@ -442,7 +442,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation); diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index 0e62aa9ed75f..5f607cd20bb6 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -35,6 +35,7 @@ #include <svx/svdobj.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <vcl/salbtype.hxx> // FRound ////////////////////////////////////////////////////////////////////////////// @@ -81,11 +82,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aCenter.getX(), -aCenter.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aCenter.getX(), aCenter.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -108,11 +105,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aCenter.getX(), -aCenter.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aCenter.getX(), aCenter.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -136,11 +129,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aEndPos.getX(), -aEndPos.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aEndPos.getX(), aEndPos.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -175,11 +164,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aEndPos.getX(), -aEndPos.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aEndPos.getX(), aEndPos.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index a8d588e73fe5..826e87520ce3 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -84,6 +84,7 @@ #include <svx/svdovirt.hxx> #include <svx/svdouno.hxx> #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -608,9 +609,8 @@ void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget) const double fScaleY(fabs(aScale.getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight())); // prepare transform matrix for polygon - basegfx::B2DHomMatrix aPolyTransform; - - aPolyTransform.translate(-aPolyRange.getMinX(), -aPolyRange.getMinY()); + basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aPolyRange.getMinX(), -aPolyRange.getMinY())); aPolyTransform.scale(fScaleX, fScaleY); // normally the poly should be moved back, but the translation is in the object @@ -1449,11 +1449,7 @@ bool SdrDragMove::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(DragStat().GetDX(), DragStat().GetDY()); - - return aRetval; + return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY()); } void SdrDragMove::ImpCheckSnap(const Point& rPt) @@ -1778,9 +1774,8 @@ bool SdrDragResize::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().Ref1().X(), -DragStat().Ref1().Y()); + basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( + -DragStat().Ref1().X(), -DragStat().Ref1().Y())); aRetval.scale(aXFact, aYFact); aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y()); @@ -2064,13 +2059,9 @@ bool SdrDragRotate::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); - aRetval.rotate(-atan2(nSin, nCos)); - aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y()); - - return aRetval; + return basegfx::tools::createRotateAroundPoint( + DragStat().GetRef1().X(), DragStat().GetRef1().Y(), + -atan2(nSin, nCos)); } void SdrDragRotate::MoveSdrDrag(const Point& rPnt_) @@ -2220,9 +2211,8 @@ bool SdrDragShear::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); + basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( + -DragStat().GetRef1().X(), -DragStat().GetRef1().Y())); if (bResize) { @@ -2520,7 +2510,7 @@ basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation() const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y()); const double fRotation(atan2(fDeltaY, fDeltaX)); - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); + aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); aRetval.rotate(-fRotation); aRetval.scale(1.0, -1.0); aRetval.rotate(fRotation); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 6682e421c180..ecfff66bf8c2 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -46,7 +46,6 @@ #include <svx/xlnclit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xflclit.hxx> - #include <svx/xgrad.hxx> #include <svx/xflgrit.hxx> #include <fontitem.hxx> @@ -55,9 +54,7 @@ #include <svx/cntritem.hxx> #include <svx/colritem.hxx> #include <vcl/metric.hxx> - #include <svx/charscaleitem.hxx> - #include <svx/xflhtit.hxx> #include <svx/svdattr.hxx> #include <svx/svdmodel.hxx> @@ -73,9 +70,10 @@ #include <svl/itemset.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <vcl/salbtype.hxx> // FRound - -// #i73407# #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/xlndsit.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -84,6 +82,8 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): pLineAttr(NULL),pFillAttr(NULL),pTextAttr(NULL), pPage(NULL),pModel(NULL),nLayer(0), nLineWidth(0), + maLineJoin(basegfx::B2DLINEJOIN_NONE), + maDash(XDASH_RECT, 0, 0, 0, 0, 0), bFntDirty(TRUE), bLastObjWasPolyWithoutLine(FALSE),bNoLine(FALSE),bNoFill(FALSE),bLastObjWasLine(FALSE) { @@ -277,6 +277,9 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceText { if ( nLineWidth ) pLineAttr->Put( XLineWidthItem( nLineWidth ) ); + else + pLineAttr->Put( XLineWidthItem( 0 ) ); + aOldLineColor = aVD.GetLineColor(); if( aVD.IsLineColor() ) { @@ -285,6 +288,34 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceText } else pLineAttr->Put(XLineStyleItem(XLINE_NONE)); + + switch(maLineJoin) + { + default : // basegfx::B2DLINEJOIN_NONE + pLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); + break; + case basegfx::B2DLINEJOIN_MIDDLE: + pLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); + break; + case basegfx::B2DLINEJOIN_BEVEL: + pLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); + break; + case basegfx::B2DLINEJOIN_MITER: + pLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); + break; + case basegfx::B2DLINEJOIN_ROUND: + pLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); + break; + } + + if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) + { + pLineAttr->Put(XLineDashItem(String(), maDash)); + } + else + { + pLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT))); + } } else bNoLine = TRUE; @@ -385,12 +416,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct) if(!aStart.equal(aEnd)) { basegfx::B2DPolygon aLine; - basegfx::B2DHomMatrix aTransform; + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aLine.append(aStart); aLine.append(aEnd); - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); aLine.transform(aTransform); const LineInfo& rLineInfo = rAct.GetLineInfo(); @@ -402,12 +431,19 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct) bCreateLineObject = false; } - nLineWidth = nNewLineWidth; - if(bCreateLineObject) { SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine)); + nLineWidth = nNewLineWidth; + maLineJoin = rLineInfo.GetLineJoin(); + maDash = XDash(XDASH_RECT, + rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), + rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), + rLineInfo.GetDistance()); SetAttributes(pPath); + nLineWidth = 0; + maLineJoin = basegfx::B2DLINEJOIN_NONE; + maDash = XDash(); InsertObj(pPath, false); } } @@ -581,10 +617,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); } @@ -601,12 +634,21 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) bCreateLineObject = false; } - nLineWidth = nNewLineWidth; - if(bCreateLineObject) { - SdrPathObj* pPath = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aSource)); + SdrPathObj* pPath = new SdrPathObj( + aSource.isClosed() ? OBJ_POLY : OBJ_PLIN, + basegfx::B2DPolyPolygon(aSource)); + nLineWidth = nNewLineWidth; + maLineJoin = rLineInfo.GetLineJoin(); + maDash = XDash(XDASH_RECT, + rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), + rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), + rLineInfo.GetDistance()); SetAttributes(pPath); + nLineWidth = 0; + maLineJoin = basegfx::B2DLINEJOIN_NONE; + maDash = XDash(); InsertObj(pPath, false); } } @@ -618,10 +660,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) @@ -643,10 +682,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) @@ -791,9 +827,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) @@ -886,12 +920,6 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); - aSource.transform(aTransform); - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { const Gradient& rGrad = pAct->GetGradient(); @@ -912,7 +940,20 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM aXGradient.SetEndIntens(rGrad.GetEndIntensity()); aXGradient.SetSteps(rGrad.GetSteps()); - SetAttributes(pPath); + if(aVD.IsLineColor()) + { + // switch line off; when there was one there will be a + // META_POLYLINE_ACTION following creating another object + const Color aLineColor(aVD.GetLineColor()); + aVD.SetLineColor(); + SetAttributes(pPath); + aVD.SetLineColor(aLineColor); + } + else + { + SetAttributes(pPath); + } + aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT)); aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient)); pPath->SetMergedItemSet(aGradAttr); diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index b4d583e6c506..84f2b30b6a15 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -86,6 +86,8 @@ protected: SdrLayerID nLayer; Color aOldLineColor; sal_Int32 nLineWidth; + basegfx::B2DLineJoin maLineJoin; + XDash maDash; sal_Bool bMov; sal_Bool bSize; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 4c4c39f7225b..85ca4c4ff09a 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -94,6 +94,7 @@ #include <svx/svdview.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> // #104018# replace macros above with type-safe methods inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } @@ -3444,31 +3445,11 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, ba } // build matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat struct and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 013eaed311c6..fb26d7b5fc9c 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -68,9 +68,6 @@ #include <svx/svdattrx.hxx> // NotPersistItems #include <svx/svdoashp.hxx> #include <svx/svdomedia.hxx> - -//////////////////////////////////////////////////////////////////////////////////////////////////// - #include <svx/xlnwtit.hxx> #include <svx/xlnstwit.hxx> #include <svx/xlnedwit.hxx> @@ -107,8 +104,6 @@ #include <vcl/graphictools.hxx> #include <svtools/colorcfg.hxx> #include <svx/sdr/properties/emptyproperties.hxx> - -// #110094# #include <svx/sdr/contact/viewcontactofsdrobj.hxx> #include <svx/sdr/contact/viewcontactofgraphic.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> @@ -120,7 +115,6 @@ #include <basegfx/range/b2drange.hxx> #include <svx/unoshape.hxx> #include <vcl/virdev.hxx> - #include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <drawinglayer/processor2d/contourextractor2d.hxx> #include <drawinglayer/processor2d/linegeometryextractor2d.hxx> @@ -128,10 +122,8 @@ #include "svx/svdotable.hxx" #include "svx/shapepropertynotifier.hxx" #include <svx/sdrhittesthelper.hxx> - -// --> OD 2009-07-10 #i73249# #include <svx/svdundo.hxx> -// <-- +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace ::com::sun::star; @@ -3056,17 +3048,7 @@ sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B } // build matrix - rMatrix.identity(); - - if(1.0 != aScale.getX() || 1.0 != aScale.getY()) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(0.0 != aTranslate.getX() || 0.0 != aTranslate.getY()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 0be63fefa61f..f3968586fd87 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -61,6 +61,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -225,24 +226,17 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c if(OBJ_CIRC == eCicrleKind) { - // create full circle. Do not use createPolygonFromEllipse, but the single - // calls to appendUnitCircleQuadrant() to get the start point to the bottom of the - // circle to keep compatible to old geometry creation - basegfx::tools::appendUnitCircleQuadrant(aCircPolygon, 1); - basegfx::tools::appendUnitCircleQuadrant(aCircPolygon, 2); - basegfx::tools::appendUnitCircleQuadrant(aCircPolygon, 3); - basegfx::tools::appendUnitCircleQuadrant(aCircPolygon, 0); - aCircPolygon.setClosed(true); - - // remove double points between segments created by segmented creation - aCircPolygon.removeDoublePoints(); - - // needs own scaling and translation from unit circle to target size - basegfx::B2DHomMatrix aMatrix; - const basegfx::B2DPoint aCenter(aRange.getCenter()); + // create full circle. Do not use createPolygonFromEllipse; it's necessary + // to get the start point to the bottom of the circle to keep compatible to + // old geometry creation + aCircPolygon = basegfx::tools::createPolygonFromUnitCircle(1); - aMatrix.scale(aRange.getWidth() / 2.0, aRange.getHeight() / 2.0); - aMatrix.translate(aCenter.getX(), aCenter.getY()); + // needs own scaling and translation from unit circle to target size (same as + // would be in createPolygonFromEllipse) + const basegfx::B2DPoint aCenter(aRange.getCenter()); + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + aRange.getWidth() / 2.0, aRange.getHeight() / 2.0, + aCenter.getX(), aCenter.getY())); aCircPolygon.transform(aMatrix); } else @@ -252,7 +246,9 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c const double fEnd(((36000 - nStart) % 36000) * F_PI18000); // create circle segment. This is not closed by default - aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment(aRange.getCenter(), aRange.getWidth() / 2.0, aRange.getHeight() / 2.0, fStart, fEnd); + aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment( + aRange.getCenter(), aRange.getWidth() / 2.0, aRange.getHeight() / 2.0, + fStart, fEnd); // check closing states const bool bCloseSegment(OBJ_CARC != eCicrleKind); @@ -277,26 +273,16 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c // #i76950# if(aGeo.nShearWink || aGeo.nDrehWink) { - const basegfx::B2DPoint aTopLeft(aRange.getMinimum()); - basegfx::B2DHomMatrix aMatrix; - // translate top left to (0,0) - aMatrix.translate(-aTopLeft.getX(), -aTopLeft.getY()); - - // shear (if needed) - if(aGeo.nShearWink) - { - aMatrix.shearX(tan((36000 - aGeo.nShearWink) * F_PI18000)); - } - - // rotate (if needed) - if(aGeo.nDrehWink) - { - aMatrix.rotate((36000 - aGeo.nDrehWink) * F_PI18000); - } - - // back to top left - aMatrix.translate(aTopLeft.getX(), aTopLeft.getY()); + const basegfx::B2DPoint aTopLeft(aRange.getMinimum()); + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + -aTopLeft.getX(), -aTopLeft.getY())); + + // shear, rotate and back to top left (if needed) + aMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + aGeo.nShearWink ? tan((36000 - aGeo.nShearWink) * F_PI18000) : 0.0, + aGeo.nDrehWink ? (36000 - aGeo.nDrehWink) * F_PI18000 : 0.0, + aTopLeft) * aMatrix; // apply transformation aCircPolygon.transform(aMatrix); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 84e571736328..28d192f3956d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -682,7 +682,7 @@ void SdrGrafObj::operator=( const SdrObject& rObj ) const SdrGrafObj& rGraf = (SdrGrafObj&) rObj; - pGraphic->SetGraphic( rGraf.GetGraphic() ); + pGraphic->SetGraphic( rGraf.GetGraphic(), &rGraf.GetGraphicObject() ); aCropRect = rGraf.aCropRect; aFileName = rGraf.aFileName; aFilterName = rGraf.aFilterName; diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 411058a766c6..bc86a689987a 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -71,6 +71,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1456,17 +1457,7 @@ sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf } // build return value matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate); return sal_True; } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index f44efe3c5dfa..dfad9824a8fd 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -56,7 +56,6 @@ #include <svx/xlnclit.hxx> #include <svx/xflclit.hxx> #include <svx/svdogrp.hxx> - #include <svx/polypolygoneditor.hxx> #include <svx/xlntrit.hxx> #include <vcl/salbtype.hxx> // FRound @@ -77,10 +76,9 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include <basegfx/range/b2drange.hxx> #include <basegfx/curve/b2dcubicbezier.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> - -// #i89784# #include <svx/sdr/attribute/sdrtextattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace sdr; @@ -2359,9 +2357,7 @@ Pointer SdrPathObj::GetCreatePointer() const void SdrPathObj::NbcMove(const Size& rSiz) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(rSiz.Width(), rSiz.Height()); - maPathPolygon.transform(aTrans); + maPathPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(rSiz.Width(), rSiz.Height())); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) SdrTextObj::NbcMove(rSiz); @@ -2369,10 +2365,9 @@ void SdrPathObj::NbcMove(const Size& rSiz) void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRef.X(), -rRef.Y()); - aTrans.scale(double(xFact), double(yFact)); - aTrans.translate(rRef.X(), rRef.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y())); + aTrans = basegfx::tools::createScaleTranslateB2DHomMatrix( + double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans; maPathPolygon.transform(aTrans); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) @@ -2381,10 +2376,8 @@ void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRef.X(), -rRef.Y()); - aTrans.rotate(-nWink * nPi180); // Thank JOE, the angles are defined mirrored to the mathematical meanings - aTrans.translate(rRef.X(), rRef.Y()); + // Thank JOE, the angles are defined mirrored to the mathematical meanings + const basegfx::B2DHomMatrix aTrans(basegfx::tools::createRotateAroundPoint(rRef.X(), rRef.Y(), -nWink * nPi180)); maPathPolygon.transform(aTrans); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) @@ -2393,8 +2386,7 @@ void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRefPnt.X(), -rRefPnt.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt.X(), -rRefPnt.Y())); if(bVShear) { @@ -2415,11 +2407,10 @@ void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBO void SdrPathObj::NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) { - basegfx::B2DHomMatrix aTrans; const double fDiffX(rRefPnt2.X() - rRefPnt1.X()); const double fDiffY(rRefPnt2.Y() - rRefPnt1.Y()); const double fRot(atan2(fDiffY, fDiffX)); - aTrans.translate(-rRefPnt1.X(), -rRefPnt1.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt1.X(), -rRefPnt1.Y())); aTrans.rotate(-fRot); aTrans.scale(1.0, -1.0); aTrans.rotate(fRot); @@ -3003,31 +2994,11 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // build return value matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_True; } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 7ae49a7a795a..d728e1f7edbc 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -63,17 +63,14 @@ #include <svx/editeng.hxx> #include <svl/itemiter.hxx> #include <svx/sdr/properties/textproperties.hxx> - -// #110496# #include <vcl/metaact.hxx> - -// #111111# #include <svx/sdr/contact/viewcontactoftextobj.hxx> #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <vcl/virdev.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -737,9 +734,9 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAncho { basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly()); basegfx::B2DPolyPolygon* pContourPolyPolygon = 0L; - basegfx::B2DHomMatrix aMatrix; + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + -rAnchorRect.Left(), -rAnchorRect.Top())); - aMatrix.translate(-rAnchorRect.Left(), -rAnchorRect.Top()); if(aGeo.nDrehWink) { // Unrotate! @@ -1735,31 +1732,11 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // build matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 072c40c8a1f3..5ffd47f82279 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -60,6 +60,7 @@ #include <unoapi.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <svx/outlobj.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// // helpers @@ -79,32 +80,6 @@ namespace return aRetval; } - static drawinglayer::primitive2d::FontUnderline mapTextLineStyle(FontUnderline eLineStyle) - { - switch(eLineStyle) - { - case UNDERLINE_SINGLE: return drawinglayer::primitive2d::FONT_UNDERLINE_SINGLE; - case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLE; - case UNDERLINE_DOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_DOTTED; - case UNDERLINE_DASH: return drawinglayer::primitive2d::FONT_UNDERLINE_DASH; - case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_LONGDASH; - case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOT; - case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOTDOT; - case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_SMALLWAVE; - case UNDERLINE_WAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_WAVE; - case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLEWAVE; - case UNDERLINE_BOLD: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLD; - case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDOTTED; - case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASH; - case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDLONGDASH; - case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOT; - case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT; - case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDWAVE; - // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE - default: return drawinglayer::primitive2d::FONT_UNDERLINE_NONE; - } - } - class impTextBreakupHandler { private: @@ -216,8 +191,8 @@ namespace if(rInfo.mrText.Len() && rInfo.mnTextLen) { basegfx::B2DVector aFontScaling; - drawinglayer::primitive2d::FontAttributes aFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aFontScaling, rInfo.mrFont, rInfo.IsRTL(), @@ -295,6 +270,11 @@ namespace const Color aFontColor(rInfo.mrFont.GetColor()); const basegfx::BColor aBFontColor(aFontColor.getBColor()); + // prepare wordLineMode (for underline and strikeout) + // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' + // to be splitted which would not look like the original + const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); + // prepare new primitive drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0; const bool bDecoratedIsNeeded( @@ -303,7 +283,8 @@ namespace || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout() || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) || RELIEF_NONE != rInfo.mrFont.GetRelief() - || rInfo.mrFont.IsShadow()); + || rInfo.mrFont.IsShadow() + || bWordLineMode); if(bDecoratedIsNeeded) { @@ -315,51 +296,40 @@ namespace const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor()); // prepare overline and underline data - const drawinglayer::primitive2d::FontUnderline eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); - const drawinglayer::primitive2d::FontUnderline eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); + const drawinglayer::primitive2d::TextLine eFontOverline( + drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetOverline())); + const drawinglayer::primitive2d::TextLine eFontUnderline( + drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetUnderline())); // check UndelineAbove - const bool bUnderlineAbove(drawinglayer::primitive2d::FONT_UNDERLINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); + const bool bUnderlineAbove( + drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); // prepare strikeout data - drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); - - switch(rInfo.mrFont.GetStrikeout()) - { - case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; - case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; - case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; - case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; - case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; - default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW - } - - // prepare wordLineMode (for underline and strikeout) - // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' - // to be splitted which would not look like the original - const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); + const drawinglayer::primitive2d::TextStrikeout eTextStrikeout( + drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout())); // prepare emphasis mark data - drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); + drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE); switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) { - case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; + case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break; + case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break; + case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break; + case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break; } const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); // prepare font relief data - drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); + drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE); switch(rInfo.mrFont.GetRelief()) { - case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; - case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; + case RELIEF_EMBOSSED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break; + case RELIEF_ENGRAVED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break; default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE } @@ -375,7 +345,7 @@ namespace rInfo.mnTextStart, rInfo.mnTextLen, aDXArray, - aFontAttributes, + aFontAttribute, rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), aBFontColor, @@ -385,12 +355,12 @@ namespace eFontOverline, eFontUnderline, bUnderlineAbove, - eFontStrikeout, + eTextStrikeout, bWordLineMode, - eFontEmphasisMark, + eTextEmphasisMark, bEmphasisMarkAbove, bEmphasisMarkBelow, - eFontRelief, + eTextRelief, bShadow); } else @@ -402,7 +372,7 @@ namespace rInfo.mnTextStart, rInfo.mnTextLen, aDXArray, - aFontAttributes, + aFontAttribute, rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), aBFontColor); } @@ -723,9 +693,7 @@ void SdrTextObj::impDecomposeContourTextPrimitive( // prepare contour polygon, force to non-mirrored for layouting basegfx::B2DPolyPolygon aPolyPolygon(rSdrContourTextPrimitive.getUnitPolyPolygon()); - basegfx::B2DHomMatrix aTransform; - aTransform.scale(fabs(aScale.getX()), fabs(aScale.getY())); - aPolyPolygon.transform(aTransform); + aPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(fabs(aScale.getX()), fabs(aScale.getY()))); // prepare outliner SdrOutliner& rOutliner = ImpGetDrawOutliner(); @@ -740,19 +708,17 @@ void SdrTextObj::impDecomposeContourTextPrimitive( // prepare matrices to apply to newly created primitives basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; // mirroring. We are now in the polygon sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); @@ -938,27 +904,23 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( // prepare matrices to apply to newly created primitives. aNewTransformA // will get coordinates in aOutlinerScale size and positive in X, Y. - basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; - - // translate relative to given primitive to get same rotation and shear + // Translate relative to given primitive to get same rotation and shear // as the master shape we are working on. For vertical, use the top-right // corner const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX()); const basegfx::B2DTuple aAdjOffset(fStartInX, aAdjustTranslate.getY()); - aNewTransformA.translate(aAdjOffset.getX(), aAdjOffset.getY()); + basegfx::B2DHomMatrix aNewTransformA(basegfx::tools::createTranslateB2DHomMatrix(aAdjOffset.getX(), aAdjOffset.getY())); // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // #SJ# create ClipRange (if needed)
basegfx::B2DRange aClipRange;
@@ -1018,7 +980,6 @@ void SdrTextObj::impDecomposeStretchTextPrimitive( // prepare matrices to apply to newly created primitives basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; // #i101957# Check for vertical text. If used, aNewTransformA // needs to translate the text initially around object width to orient @@ -1040,13 +1001,12 @@ void SdrTextObj::impDecomposeStretchTextPrimitive( // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 058d0c1a4513..6522feb7a2b8 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -366,8 +366,8 @@ namespace { const impPathTextPortion* pCandidate = rTextPortions[a]; basegfx::B2DVector aFontScaling; - const drawinglayer::primitive2d::FontAttributes aCandidateFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + const drawinglayer::attribute::FontAttribute aCandidateFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aFontScaling, pCandidate->getFont(), pCandidate->isRTL(), @@ -520,7 +520,7 @@ namespace nPortionIndex, nNextGlyphLen, aNewDXArray, - aCandidateFontAttributes, + aCandidateFontAttribute, pCandidate->getLocale(), aRGBShadowColor); @@ -545,7 +545,7 @@ namespace nPortionIndex, nNextGlyphLen, aNewDXArray, - aCandidateFontAttributes, + aCandidateFontAttribute, pCandidate->getLocale(), aRGBColor); diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 18840cde18e0..523eb6b4b2c3 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -40,6 +40,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/svdograf.hxx> #include <svx/svddrgv.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -216,9 +217,7 @@ basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const if(aAnchor.X() || aAnchor.Y()) { - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate(aAnchor.X(), aAnchor.Y()); - aPolyPolygon.transform(aMatrix); + aPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aAnchor.X(), aAnchor.Y())); } return aPolyPolygon; diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 55e0347e6522..a8cbfbb24c3d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1831,6 +1831,12 @@ GDIMetaFile SdrPage::GetMetaFile(const SetOfByte& /*rVisibleLayers*/, FASTBOOL / return GDIMetaFile(); } +bool SdrPage::isHandoutMasterPage() const +{ + return mbMaster && GetModel() && GetModel()->GetMasterPageCount() + && GetModel()->GetMasterPage(0) == this; +} + ////////////////////////////////////////////////////////////////////////////// // sdr::Comment interface diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index e53f41251ff2..e4e515ed1613 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -64,7 +64,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrCellPrimitive2D : public BasePrimitive2D + class SdrCellPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -72,13 +72,13 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrCellPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const attribute::SdrFillTextAttribute& rSdrFTAttribute) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrFTAttribute(rSdrFTAttribute) { @@ -95,7 +95,7 @@ namespace drawinglayer DeclPrimitrive2DIDBlock() }; - Primitive2DSequence SdrCellPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -132,7 +132,7 @@ namespace drawinglayer bool SdrCellPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCellPrimitive2D& rCompare = (SdrCellPrimitive2D&)rPrimitive; @@ -155,7 +155,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrBorderlinePrimitive2D : public BasePrimitive2D + class SdrBorderlinePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -173,7 +173,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrBorderlinePrimitive2D( @@ -187,7 +187,7 @@ namespace drawinglayer bool bRightIsOutside, bool bTopIsOutside, bool bInTwips) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maLeftLine(rLeftLine), maBottomLine(rBottomLine), @@ -282,7 +282,7 @@ namespace drawinglayer return (double)nValue; } - Primitive2DSequence SdrBorderlinePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrBorderlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence xRetval(4); sal_uInt32 nInsert(0); @@ -462,7 +462,7 @@ namespace drawinglayer bool SdrBorderlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrBorderlinePrimitive2D& rCompare = (SdrBorderlinePrimitive2D&)rPrimitive; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index d09ba5d439dc..be445143fbd5 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -98,6 +98,7 @@ #include "unomaster.hxx" #include <svx/outlobj.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <vector> @@ -2516,10 +2517,7 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); - - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( aPoint.X(), aPoint.Y() ); - aNewPolyPolygon.transform( aMatrix ); + aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y())); } pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon ); return true; @@ -2952,10 +2950,7 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); - - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( -aPoint.X(), -aPoint.Y() ); - aPolyPoly.transform( aMatrix ); + aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y())); } drawing::PolyPolygonBezierCoords aRetval; SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval); |