From ffe5c97056ab181367e49691d487eb6f6f375200 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- svx/source/sdr/contact/viewcontact.cxx | 3 +- svx/source/sdr/contact/viewcontactofe3d.cxx | 30 +-- svx/source/sdr/contact/viewcontactofe3dcube.cxx | 17 +- svx/source/sdr/contact/viewcontactofe3dextrude.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dlathe.cxx | 24 +-- svx/source/sdr/contact/viewcontactofe3dpolygon.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dscene.cxx | 117 ++++------ svx/source/sdr/contact/viewcontactofe3dsphere.cxx | 20 +- svx/source/sdr/contact/viewcontactofgraphic.cxx | 236 ++++++++++----------- svx/source/sdr/contact/viewcontactofgroup.cxx | 26 ++- .../contact/viewcontactofmasterpagedescriptor.cxx | 41 ++-- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 194 ++++++++--------- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 91 ++++---- svx/source/sdr/contact/viewcontactofsdredgeobj.cxx | 43 ++-- .../sdr/contact/viewcontactofsdrmeasureobj.cxx | 149 +++++++------ .../sdr/contact/viewcontactofsdrmediaobj.cxx | 13 +- .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 179 ++++++++-------- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 93 ++++---- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 39 ++-- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 163 +++++++------- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 105 ++++----- svx/source/sdr/contact/viewcontactofunocontrol.cxx | 45 ++-- svx/source/sdr/contact/viewcontactofvirtobj.cxx | 41 ++-- svx/source/sdr/contact/viewobjectcontactofe3d.cxx | 1 - .../sdr/contact/viewobjectcontactofe3dscene.cxx | 11 - .../sdr/contact/viewobjectcontactofgroup.cxx | 14 -- .../sdr/contact/viewobjectcontactofpageobj.cxx | 25 +-- .../sdr/contact/viewobjectcontactofsdrole2obj.cxx | 8 +- 28 files changed, 824 insertions(+), 948 deletions(-) (limited to 'svx/source/sdr/contact') diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index fa9bc88d8f73..4f78318a5b49 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -280,7 +280,8 @@ namespace sdr DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)"); const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0))); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index 77a5bf4dff3c..5a2b25010009 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -37,10 +37,12 @@ #include #include #include -#include -#include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -128,13 +130,14 @@ namespace sdr // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl. // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object) - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D( - rxContent3D, - pVCOfE3DScene->getObjectTransformation(), - aViewInformation3D, - aLightNormal, - fShadowSlant, - rAllContentRange)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::Embedded3DPrimitive2D( + rxContent3D, + pVCOfE3DScene->getObjectTransformation(), + aViewInformation3D, + aLightNormal, + fShadowSlant, + rAllContentRange)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -179,9 +182,12 @@ namespace sdr if(!rObjectTransform.isIdentity()) { - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D( - rObjectTransform, xRetval)); - return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::TransformPrimitive3D( + rObjectTransform, + xRetval)); + + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx index 8626296cb42a..bccccd1d074d 100644 --- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get cube geometry and use as traslation and scaling for unit cube basegfx::B3DRange aCubeRange; @@ -100,12 +92,13 @@ namespace sdr const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY()); // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrCubePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 815a9416c7de..501727aa9782 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon()); @@ -93,15 +85,15 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, - bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrExtrudePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, + bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 877ffaca2117..8bea766cbdfe 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D()); @@ -107,16 +99,16 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, nHorizontalSegments, nVerticalSegments, - fDiagonal, fBackScale, fRotation, - bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrLathePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, nHorizontalSegments, nVerticalSegments, + fDiagonal, fBackScale, fRotation, + bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 9ae265d29362..b69d1d6a8ced 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -60,23 +60,15 @@ namespace sdr drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet(); const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly()); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill)); // get extrude geometry basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D()); const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D()); - const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); - const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); + const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); + const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); if(bNormals || bTexture) { @@ -181,13 +173,13 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( - aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( + aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 9c5885d2bf95..ca6168c4aafb 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -41,11 +41,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -167,21 +167,13 @@ namespace sdr ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene) : ViewContactOfSdrObj(rScene), - mpViewInformation3D(0), - mpObjectTransformation(0), - mpSdrSceneAttribute(0), - mpSdrLightingAttribute(0) + maViewInformation3D(), + maObjectTransformation(), + maSdrSceneAttribute(), + maSdrLightingAttribute() { } - ViewContactOfE3dScene::~ViewContactOfE3dScene() - { - delete mpViewInformation3D; - delete mpObjectTransformation; - delete mpSdrSceneAttribute; - delete mpSdrLightingAttribute; - } - void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange) { basegfx::B3DHomMatrix aTransformation; @@ -265,34 +257,36 @@ namespace sdr } const uno::Sequence< beans::PropertyValue > aEmptyProperties; - mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties); + maViewInformation3D = drawinglayer::geometry::ViewInformation3D( + aTransformation, aOrientation, aProjection, + aDeviceToView, 0.0, aEmptyProperties); } void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - mpObjectTransformation = new basegfx::B2DHomMatrix; const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - mpObjectTransformation->set(0, 0, rRectangle.getWidth()); - mpObjectTransformation->set(1, 1, rRectangle.getHeight()); - mpObjectTransformation->set(0, 2, rRectangle.Left()); - mpObjectTransformation->set(1, 2, rRectangle.Top()); + maObjectTransformation.set(0, 0, rRectangle.getWidth()); + maObjectTransformation.set(1, 1, rRectangle.getHeight()); + maObjectTransformation.set(0, 2, rRectangle.Left()); + maObjectTransformation.set(1, 2, rRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); + maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); } void ViewContactOfE3dScene::createSdrLightingAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); + maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence( + const SetOfByte* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); @@ -332,19 +326,27 @@ namespace sdr // on identity and the time on 0.0. const uno::Sequence< beans::PropertyValue > aEmptyProperties; const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties); - const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); + const basegfx::B3DRange aContentRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); // create 2d primitive 3dscene with generated sub-list from collector - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D( - bTestVisibility ? aVisibleSequence : aAllSequence, - getSdrSceneAttribute(), - getSdrLightingAttribute(), - getObjectTransformation(), - getViewInformation3D(aContentRange))); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ScenePrimitive2D( + bTestVisibility ? aVisibleSequence : aAllSequence, + getSdrSceneAttribute(), + getSdrLightingAttribute(), + getObjectTransformation(), + getViewInformation3D(aContentRange))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, getObjectTransformation())); + return xRetval; } @@ -358,27 +360,7 @@ namespace sdr xRetval = createScenePrimitive2DSequence(0); } - if(xRetval.hasElements()) - { - return xRetval; - } - else - { - // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size - // model information directly, NOT getBoundRect()/getSnapRect() since these will - // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data - // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here - const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(), - aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom()))); - const double fGrayTone(0xc0 / 255.0); - const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); - - // The replacement object may also get a text like 'empty 3D Scene' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + return xRetval; } void ViewContactOfE3dScene::ActionChanged() @@ -387,22 +369,15 @@ namespace sdr ViewContactOfSdrObj::ActionChanged(); // mark locally cached values as invalid - delete mpViewInformation3D; - mpViewInformation3D = 0; - - delete mpObjectTransformation; - mpObjectTransformation = 0; - - delete mpSdrSceneAttribute; - mpSdrSceneAttribute = 0; - - delete mpSdrLightingAttribute; - mpSdrLightingAttribute = 0; + maViewInformation3D = drawinglayer::geometry::ViewInformation3D(); + maObjectTransformation.identity(); + maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute(); + maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute(); } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { // this version will create the content range on demand locally and thus is less // performant than the other one. Since the information is buffered the planned @@ -421,47 +396,47 @@ namespace sdr const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const { - if(!mpObjectTransformation) + if(maObjectTransformation.isIdentity()) { const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation(); } - return *mpObjectTransformation; + return maObjectTransformation; } const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const { - if(!mpSdrSceneAttribute) + if(maSdrSceneAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute(); } - return *mpSdrSceneAttribute; + return maSdrSceneAttribute; } const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const { - if(!mpSdrLightingAttribute) + if(maSdrLightingAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute(); } - return *mpSdrLightingAttribute; + return maSdrLightingAttribute; } drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx index e175416d7552..cb234138d8f7 100644 --- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx @@ -57,16 +57,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get sphere center and size for geometry basegfx::B3DRange aSphereRange; @@ -92,14 +84,14 @@ namespace sdr F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - nHorizontalSegments, nVerticalSegments)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrSpherePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + nHorizontalSegments, nVerticalSegments)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index fcac5f68056e..b7663fc30dcf 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,6 @@ #endif #include -#include #include #include #include @@ -62,6 +60,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -151,10 +150,9 @@ namespace sdr * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, - aEmptyAttributes, + drawinglayer::attribute::SdrLineFillShadowTextAttribute(), rGraphicObject, rLocalGrafInfo)); @@ -180,14 +178,12 @@ namespace sdr aEmptyGraphicAttr)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - if(!rAttribute.getLine()) + if(rAttribute.getLine().isDefault()) { // create a surrounding frame when no linestyle given const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); const basegfx::BColor aBColor(aColor.getBColor()); - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, @@ -317,127 +313,123 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetGrafObject().getText(0); - - if(pSdrText) + const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0))); + + // create and fill GraphicAttr + GraphicAttr aLocalGrafInfo; + const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); + const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); + aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); + aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); + aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); + aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); + aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); + aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); + aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); + aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); + aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); + aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); + + if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) { - const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - bool bVisible(pAttribute && pAttribute->isVisible()); - - // create and fill GraphicAttr - GraphicAttr aLocalGrafInfo; - const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); - const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); - aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); - aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); - aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); - aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); - aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); - aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); - aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); - aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); - aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - - if(!bVisible && 255L != aLocalGrafInfo.GetTransparency()) + // no fill, no line, no text (invisible), but the graphic content is visible. + // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet + const drawinglayer::attribute::SdrShadowAttribute aShadow( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + + if(!aShadow.isDefault()) { - // content is visible, so force some fill stuff - delete pAttribute; - bVisible = true; + // create new attribute set if indeed shadow is used + aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( + aAttribute.getLine(), + aAttribute.getFill(), + aAttribute.getLineStartEnd(), + aShadow, + aAttribute.getFillFloatTransGradient(), + aAttribute.getText()); + } + } - // check shadow - drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet); + // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() + // 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()); + + // look for mirroring + const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); + const sal_Int32 nDrehWink(rGeoStat.nDrehWink); + const bool bRota180(18000 == nDrehWink); + const bool bMirrored(GetGrafObject().IsMirrored()); + const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); + bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); + bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); + + // set mirror flags at LocalGrafInfo. Take into account that the geometry in + // aObjectRange is already changed and rotated when bRota180 is used. To rebuild + // that old behaviour (as long as part of the model data), correct the H/V flags + // accordingly. The created bitmapPrimitive WILL use the rotation, too. + if(bRota180) + { + // if bRota180 which is used for vertical mirroring, the graphic will already be rotated + // by 180 degrees. To correct, switch off VMirror and invert HMirroring. + bHMirr = !bHMirr; + bVMirr = false; + } - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + if(bHMirr || bVMirr) + { + aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); + } - // create new attribute set - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L); - } + // 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); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); - if(pAttribute) - { - if(pAttribute->isVisible() || bVisible) - { - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() - // 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()); - - // look for mirroring - const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); - const sal_Int32 nDrehWink(rGeoStat.nDrehWink); - const bool bRota180(18000 == nDrehWink); - const bool bMirrored(GetGrafObject().IsMirrored()); - const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); - bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); - bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); - - // set mirror flags at LocalGrafInfo. Take into account that the geometry in - // aObjectRange is already changed and rotated when bRota180 is used. To rebuild - // that old behaviour (as long as part of the model data), correct the H/V flags - // accordingly. The created bitmapPrimitive WILL use the rotation, too. - if(bRota180) - { - // if bRota180 which is used for vertical mirroring, the graphic will already be rotated - // by 180 degrees. To correct, switch off VMirror and invert HMirroring. - bHMirr = !bHMirr; - bVMirr = false; - } - - if(bHMirr || bVMirr) - { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); - } - - // 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); - 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); - - if(visualisationUsesPresObj()) - { - // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one - // with the content which is the placeholder graphic - xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); - } - else if(visualisationUsesDraft()) - { - // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism - // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious - // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent - // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster - // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages - xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); - } - else - { - // create primitive. Info: Calling the copy-constructor of GraphicObject in this - // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - *pAttribute, - rGraphicObject, - aLocalGrafInfo)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // get the current, unchenged graphic obect from SdrGrafObj + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + + if(visualisationUsesPresObj()) + { + // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one + // with the content which is the placeholder graphic + xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute); } + else + { + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 3dd2b4bd4388..00e9ad8cb684 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,25 +82,22 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); } } - - if(xRetval.hasElements()) - { - return xRetval; - } else { - // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups, - // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect() - // to not execute anything. + // append an invisible outline for the cases where no visible content exists const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()))); - const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + const basegfx::B2DRange aCurrentRange( + aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), + aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); - // The replacement object may also get a text like 'empty group' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aCurrentRange)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 748d5c083a65..84f6c7c9bfe2 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -41,12 +41,14 @@ #include #include #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,26 +70,27 @@ namespace sdr { // build primitive from pBackgroundCandidate's attributes const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 337681e4d391..57e7ec69485b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -70,107 +69,108 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrCaptionObj& rCaptionObj(GetCaptionObj()); const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet(); - SdrText* pSdrText = rCaptionObj.getText(0); - - if(pSdrText) + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + rCaptionObj.getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); + + // fill object matrix + 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; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius( + rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // create primitive. Always create one (even if invisible) to let the decomposition + // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCaptionPrimitive2D( + aObjectMatrix, + aAttribute, + rCaptionObj.getTailPolygon(), + fCornerRadiusX, + fCornerRadiusY)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow()) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) + // for SC, the caption object may have a specialized shadow. The usual object shadow is off + // and a specialized shadow gets created here (see old paint) + const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); + const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); + const Color aShadCol(rShadColItem.GetColorValue()); + const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); + + // Create own ItemSet and modify as needed + // Always hide lines for special calc shadow + SfxItemSet aSet(rItemSet); + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_HATCH == eStyle) + { + // #41666# Hatch color is set hard to shadow color + XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); + aHatch.SetColor(aShadCol); + aSet.Put(XFillHatchItem(String(),aHatch)); + } + else { - if(pAttribute->isVisible()) + if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - - // fill object matrix - 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; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D( - aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - - if(rCaptionObj.GetSpecialTextBoxShadow()) - { - // for SC, the caption object may have a specialized shadow. The usual object shadow is off - // and a specialized shadow gets created here (see old paint) - const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); - const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); - const Color aShadCol(rShadColItem.GetColorValue()); - const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); - - // Create own ItemSet and modify as needed - // Always hide lines for special calc shadow - SfxItemSet aSet(rItemSet); - aSet.Put(XLineStyleItem(XLINE_NONE)); - - if(XFILL_HATCH == eStyle) - { - // #41666# Hatch color is set hard to shadow color - XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); - aHatch.SetColor(aShadCol); - aSet.Put(XFillHatchItem(String(),aHatch)); - } - else - { - if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) - { - // force fill to solid (for Gradient and Bitmap) - aSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - aSet.Put(XFillColorItem(String(),aShadCol)); - aSet.Put(XFillTransparenceItem(nTransp)); - } - - // crete FillAttribute from modified ItemSet - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet); - drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; - - if(pFill) - { - if(pFill->isVisible()) - { - // add shadow offset to object matrix - const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); - const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); - aObjectMatrix.translate(nXDist, nYDist); - - // 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 - xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill); - } - - delete pFill; - } - - if(xSpecialShadow.is()) - { - // if we really got a special shadow, create a two-element retval with the shadow - // behind the standard object's geometry - xRetval.realloc(2); - - xRetval[0] = xSpecialShadow; - xRetval[1] = xReference; - } - } + // force fill to solid (for Gradient and Bitmap) + aSet.Put(XFillStyleItem(XFILL_SOLID)); } - delete pAttribute; + aSet.Put(XFillColorItem(String(),aShadCol)); + aSet.Put(XFillTransparenceItem(nTransp)); + } + + // crete FillAttribute from modified ItemSet + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(aSet)); + drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; + + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) + { + // add shadow offset to object matrix + const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); + const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); + aObjectMatrix.translate(nXDist, nYDist); + + // 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 + xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + aObjectMatrix, + aFill, + drawinglayer::attribute::FillGradientAttribute()); + } + + if(xSpecialShadow.is()) + { + // if we really got a special shadow, create a two-element retval with the shadow + // behind the standard object's geometry + xRetval.realloc(2); + + xRetval[0] = xSpecialShadow; + xRetval[1] = xReference; } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 047685dc14f2..2ff6a48686e9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -58,56 +57,62 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet(); - SdrText* pSdrText = GetCircObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetCircObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - // fill object matrix - 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())); + // fill object matrix + 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()); + // create primitive data + const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); - if(OBJ_CIRC == nIdentifier) - { - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - else - { - const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); - const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); - const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); - const bool bCloseSegment(OBJ_CARC != nIdentifier); - const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } + // always create primitives to allow the decomposition of SdrEllipsePrimitive2D + // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + if(OBJ_CIRC == nIdentifier) + { + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipsePrimitive2D( + aObjectMatrix, + aAttribute)); - delete pAttribute; - } + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); + const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); + const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); + const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); + const bool bCloseSegment(OBJ_CARC != nIdentifier); + const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D( + aObjectMatrix, + aAttribute, + fStart, + fEnd, + bCloseSegment, + bCloseUsingCenter)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 10b63f8044bf..df0151d65615 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -55,35 +54,27 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack()); + const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); - // base visualisation on EdgeTrack - if(aEdgeTrack.count()) - { - // ckeck attributes - const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); - SdrText* pSdrText = GetEdgeObj().getText(0); + // what to do when no EdgeTrack is provided (HitTest and selectability) ? + OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // ckeck attributes + const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetEdgeObj().getText(0))); - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // create primitive. Always create primitives to allow the decomposition of + // SdrConnectorPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrConnectorPrimitive2D( + aAttribute, + rEdgeTrack)); - delete pAttribute; - } - } - } - - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 18a82377d582..a129882686c8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -61,91 +60,85 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet(); - SdrText* pSdrText = GetMeasureObj().getText(0); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetMeasureObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // take properties which are the model data. + const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); + const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); + const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); + const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); + const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); + drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); + drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - if(pAttribute) + switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) + { + case SDRMEASURE_TEXTLEFTOUTSIDE : { - if(pAttribute->isVisible()) - { - // take properties which are the model data. - const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); - const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); - const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); - const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); - const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); - drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - - switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) - { - case SDRMEASURE_TEXTLEFTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURE_TEXTINSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_TEXTRIGHTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTHAUTO - { - break; - } - } - - switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) - { - case SDRMEASURE_ABOVE : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURETEXT_BREAKEDLINE : - case SDRMEASURETEXT_VERTICALCENTERED : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_BELOW : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTVAUTO - { - break; - } - } - - // create primitive with the model data - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute, - aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta, - bBelow, bTextRotation, bTextAutoAngle)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURE_TEXTINSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_TEXTRIGHTOUTSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTHAUTO + { + break; + } + } - delete pAttribute; + switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) + { + case SDRMEASURE_ABOVE : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURETEXT_BREAKEDLINE : + case SDRMEASURETEXT_VERTICALCENTERED : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_BELOW : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTVAUTO + { + break; } } - return xRetval; + // create primitive with the model data. Always create primitives to allow the + // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrMeasurePrimitive2D( + aAttribute, aStart, aEnd, + aMTPHor, aMTPVer, fDistance, + fUpperDistance, fLowerDistance, + fLeftDelta, fRightDelta, bBelow, + bTextRotation, bTextAutoAngle)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 96a2f65e32ee..03eb97281240 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -157,7 +157,9 @@ namespace sdr // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; @@ -166,12 +168,15 @@ namespace sdr aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create media primitive + // create media primitive. Always create primitives to allow the + // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0); const rtl::OUString& rURL(GetSdrMediaObj().getURL()); const sal_uInt32 nPixelBorder(4L); - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D( - aTransform, rURL, aBackgroundColor, nPixelBorder)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::MediaPrimitive2D( + aTransform, rURL, aBackgroundColor, nPixelBorder)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 352b9198e97b..36475a38eb64 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -34,13 +34,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -121,126 +121,121 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet(); - SdrText* pSdrText = GetCustomShapeObj().getText(0); - if(pSdrText) - { - // #i98072# Get shandow and text; eventually suppress the text if it's - // a TextPath FontworkGallery object - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + const drawinglayer::attribute::SdrShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrShadowTextAttribute( rItemSet, - *pSdrText, - GetCustomShapeObj().IsTextPath()); - drawinglayer::primitive2d::Primitive2DSequence xGroup; - bool bHasText(pAttribute && pAttribute->getText()); + GetCustomShapeObj().getText(0), + GetCustomShapeObj().IsTextPath())); + drawinglayer::primitive2d::Primitive2DSequence xGroup; + bool bHasText(!aAttribute.getText().isDefault()); + + // create Primitive2DSequence from sub-geometry + const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); - // create Primitive2DSequence from sub-geometry - const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); - bool b3DShape(false); + if(pSdrObjRepresentation) + { + SdrObjListIter aIterator(*pSdrObjRepresentation); - if(pSdrObjRepresentation) + while(aIterator.IsMore()) { - SdrObjListIter aIterator(*pSdrObjRepresentation); + SdrObject& rCandidate = *aIterator.Next(); - while(aIterator.IsMore()) + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { - SdrObject& rCandidate = *aIterator.Next(); - - if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) - { - b3DShape = true; - } - - const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); + b3DShape = true; } + + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } + } + + if(bHasText || xGroup.hasElements()) + { + // prepare text box geometry + basegfx::B2DHomMatrix aTextBoxMatrix; + bool bWordWrap(false); - if(bHasText || xGroup.hasElements()) + if(bHasText) { - // prepare text box geometry - basegfx::B2DHomMatrix aTextBoxMatrix; - bool bWordWrap(false); + // take unrotated snap rect as default, then get the + // unrotated text box. Rotation needs to be done centered + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); - if(bHasText) - { - // take unrotated snap rect as default, then get the - // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); - const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); + // #i101684# get the text range unrotated and absolute to the object range + const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); - // #i101684# get the text range unrotated and absolute to the object range - const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); + // give text object a size + aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // give text object a size - aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); + // check if we have a rotation/shear at all to take care of + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); + const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); - // check if we have a rotation/shear at all to take care of - const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); - const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + { + if(aObjectRange != aTextRange) + { + // move relative to unrotated object range + aTextBoxMatrix.translate( + aTextRange.getMinX() - aObjectRange.getMinimum().getX(), + aTextRange.getMinY() - aObjectRange.getMinimum().getY()); + } - if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + if(rGeoStat.nShearWink) { - if(aObjectRange != aTextRange) - { - // move relative to unrotated object range - aTextBoxMatrix.translate( - aTextRange.getMinX() - aObjectRange.getMinimum().getX(), - aTextRange.getMinY() - aObjectRange.getMinimum().getY()); - } - - if(rGeoStat.nShearWink) - { - aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - if(!basegfx::fTools::equalZero(fExtraTextRotation)) - { - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); - } - - // give text it's target position - aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); } - else + + if(rGeoStat.nDrehWink) { - aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); + aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); } - // check if SdrTextWordWrapItem is set - bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); - } + if(!basegfx::fTools::equalZero(fExtraTextRotation)) + { + aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + } - // make sure a (even empty) SdrShadowTextAttribute exists for - // primitive creation - if(!pAttribute) + // give text it's target position + aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + } + else { - pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L); + aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); } - // create primitive - 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); + // check if SdrTextWordWrapItem is set + bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); } - if(pAttribute) - { - delete pAttribute; - } + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + aAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + // always append an invisible outline for the cases where no visible content exists + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange( + aObjectBound.Left(), aObjectBound.Top(), + aObjectBound.Right(), aObjectBound.Bottom()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectRange)); + return xRetval; } } // end of namespace contact diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 7672577138d0..bcd7646f326a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -76,59 +75,51 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( bool bHighContrast) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetOle2Obj().getText(0); - - if(pSdrText) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); - const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object matrix - 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); - 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(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(!pAttribute) - { - // force existence, even when not visible - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); - } - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( - GetOle2Obj(), - aObjectMatrix, - - // #i104867# add GraphicVersion number to be able to check for - // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), - - bHighContrast)); - - // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + 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); + 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(); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetOle2Obj().getText(0))); + + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + + bHighContrast)); + + // create primitive. Use Ole2 primitive here. Prepare attribute settings, will + // be used soon anyways. Always create primitives to allow the decomposition of + // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, - *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - delete pAttribute; - } + aAttribute)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 26a3934c179e..12b7e1b0acf4 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -45,9 +45,9 @@ #include #include #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -101,7 +101,8 @@ namespace sdr const svtools::ColorConfig aColorConfig; const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -216,25 +217,25 @@ namespace sdr { // build primitive from pObject's attributes const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } } diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 3c8449bae7f6..97716a7fdddd 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -57,93 +56,91 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet(); - SdrText* pSdrText = GetPathObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetPathObj().getText(0))); + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + sal_uInt32 nPointCount(0); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count(); + } + + if(!nPointCount) + { + OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)"); + basegfx::B2DPolygon aFallbackLine; + aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0)); + aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0)); + aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine); + + nPolyCount = 1; + } + + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - if(pSdrText) + if(bIsLine) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); - - if(nPolyCount) - { - // prepare object transformation and unit polygon (direct model data) - basegfx::B2DHomMatrix aObjectMatrix; - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); - const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); - const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); - const basegfx::B2DVector aLine(aEnd - aStart); - - // #i102548# create new unit polygon for line (horizontal) - basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); - aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); - - // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aLine.getLength(), 1.0, - 0.0, - atan2(aLine.getY(), aLine.getX()), - aStart.getX(), aStart.getY()); - } - else - { - // #i102548# create unscaled, unsheared, unrotated and untranslated polygon - // (unit polygon) by creating the object matrix and back-transforming the polygon - const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - const double fWidth(aObjectRange.getWidth()); - const double fHeight(aObjectRange.getHeight()); - 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); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); - } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D( - aObjectMatrix, - *pAttribute, - aUnitPolyPolygon)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + 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); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive. Always create primitives to allow the decomposition of + // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + aAttribute, + aUnitPolyPolygon)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 94b26b5d020e..6a7f6842a76d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -59,70 +58,48 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); - SdrText* pSdrText = GetRectObj().getText(0); - - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - - // fill object matrix - 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()); - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // #i105856# use knowledge about pickthrough from the model - const bool bPickThroughTransparentTextFrames( - GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, - *pAttribute, - fCornerRadiusX, - fCornerRadiusY, - // #i105856# use fill for HitTest when TextFrame and not PickThrough - GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pAttribute; - } - - if(!xRetval.hasElements()) - { - // #i99123# - // Object is invisible. Create a fallback primitive for HitTest - basegfx::B2DHomMatrix aObjectMatrix; - basegfx::B2DPolyPolygon aObjectPolyPolygon; - GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - return xRetval; + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetRectObj().getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); + + // fill object matrix + 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()); + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + + // create primitive. Always create primitives to allow the decomposition of + // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + aAttribute, + fCornerRadiusX, + fCornerRadiusY, + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 7bea25feeeed..f830369fc2ec 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -50,6 +50,7 @@ #include #include #include +#include //........................................................................ namespace sdr { namespace contact { @@ -138,35 +139,43 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const { + // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use + // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) + // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything + const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel(); if(xControlModel.is()) { - // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use - // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) - // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::ControlPrimitive2D( + aTransform, + xControlModel)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } else { - // #i93161# This UnoControl does not yet have a xControlModel (can happen - // during diverse creations). Without a model, create no visualisation. - return drawinglayer::primitive2d::Primitive2DSequence(); + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xRetval( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aTransform)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx index 0f046bdda97f..5578bf399f84 100644 --- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx +++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,29 +78,39 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + // create displacement transformation if we have content + basegfx::B2DHomMatrix aObjectMatrix; + Point aAnchor(GetVirtObj().GetAnchorPos()); + + if(aAnchor.X() || aAnchor.Y()) + { + aObjectMatrix.set(0, 2, aAnchor.X()); + aObjectMatrix.set(1, 2, aAnchor.Y()); + } // use method from referenced object to get the Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual( + GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequenceVirtual.hasElements()) { - // create displacement transformation if we have content - ::basegfx::B2DHomMatrix aObjectMatrix; - Point aAnchor(GetVirtObj().GetAnchorPos()); - - if(aAnchor.X() || aAnchor.Y()) - { - aObjectMatrix.set(0, 2, aAnchor.X()); - aObjectMatrix.set(1, 2, aAnchor.Y()); - } - // create transform primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::TransformPrimitive2D( + aObjectMatrix, + xSequenceVirtual)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 435eb31c47f0..d031ef552486 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -39,7 +39,6 @@ #include #include #include -#include ////////////////////////////////////////////////////////////////////////////// // predeclarations diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index b093ddbe8b75..68ac3365796e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -125,17 +125,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } - else - { - // do neither print nor PDF export the fallback visualisation - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // empty group, fallback to parent method which will create the default - // grayed frame for empty 3d scenes by using model data and - // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - } if(bIsActiveVC) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 0f67ba46acb9..b7406bd1cc58 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -59,20 +59,6 @@ namespace sdr { } - bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const - { - const bool bHasChildren(0 != GetViewContact().GetObjectCount()); - - if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile())) - { - // empty group uses fallback gray empty frame display. Do neither print nor PDF export it - return false; - } - - // call parent - return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo); - } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index bd208b5cf54f..645632c956f8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -296,28 +296,19 @@ namespace sdr 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); + // on the handout page more simple, add hidden fill geometry + const drawinglayer::primitive2d::Primitive2DReference xFrameHit( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aPageObjectTransform)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1); } // add a gray outline frame, except not when printing 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))); + basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 635ae9c7fcc8..954102c0a8cb 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -39,11 +39,11 @@ #include #include #include -#include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ namespace sdr if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); aObjectOutline.transform(aObjectTransform); // Use a FillHatchPrimitive2D with necessary attributes -- cgit From 5f1e3bff24310560c4a3c314bb0cd909d1f423c2 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 9 Feb 2010 11:33:08 +0100 Subject: aw079 #i99386# finer granular changes for MPBGO removal --- .../contact/viewcontactofmasterpagedescriptor.cxx | 32 ++++++++++++++++++++++ svx/source/sdr/contact/viewcontactofsdrpage.cxx | 30 ++++++++++++++++++++ .../viewobjectcontactofmasterpagedescriptor.cxx | 13 +++++++++ 3 files changed, 75 insertions(+) (limited to 'svx/source/sdr/contact') diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 84f6c7c9bfe2..4dad454af869 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -64,6 +64,33 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + +#ifdef NEWPBG + // build primitive from page fill attributes + const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } +#else const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); if(pBackgroundCandidate) @@ -93,6 +120,7 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } +#endif return xRetval; } @@ -113,20 +141,24 @@ namespace sdr { sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); +#ifndef NEWPBG if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nRetval--; } +#endif return nRetval; } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 12b7e1b0acf4..3018a9dc17e2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,6 +206,31 @@ namespace sdr } else { +#ifdef NEWPBG + // build primitive from pObject's attributes + const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + +#else OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); if(rPage.GetObjCount()) @@ -239,6 +264,7 @@ namespace sdr } } } +#endif } } @@ -461,20 +487,24 @@ namespace sdr { sal_uInt32 nSubObjectCount(getPage().GetObjCount()); +#ifndef NEWPBG if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nSubObjectCount--; } +#endif return nSubObjectCount; } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index fa785125118c..f0c3eb2c8bed 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,6 +98,18 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); +#ifdef NEWPBG + // check layer visibility (traditionally was member of layer 1) + if(aPreprocessedLayers.IsSet(1)) + { + // hide PageBackground for special DrawModes; historical reasons + if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) + { + // if visible, create the default background primitive sequence + xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); + } + } +#else // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); @@ -110,6 +122,7 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } +#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) -- cgit From c4eadd3cb2aa9e6e12123683728b9dd2c587eb25 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 11 Feb 2010 17:35:16 +0100 Subject: aw079 #i99386# cleanup of define and last change from CL --- .../contact/viewcontactofmasterpagedescriptor.cxx | 50 +------------------- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 55 +--------------------- .../viewobjectcontactofmasterpagedescriptor.cxx | 15 ------ 3 files changed, 2 insertions(+), 118 deletions(-) (limited to 'svx/source/sdr/contact') diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 4dad454af869..d99c6f7baa5f 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -65,7 +65,6 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; -#ifdef NEWPBG // build primitive from page fill attributes const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -90,37 +89,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } -#else - const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); - - if(pBackgroundCandidate) - { - // build primitive from pBackgroundCandidate's attributes - const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), - rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } -#endif return xRetval; } @@ -139,27 +107,11 @@ namespace sdr sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const { - sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); - -#ifndef NEWPBG - if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nRetval--; - } -#endif - - return nRetval; + return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 3018a9dc17e2..d469b15a761a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,7 +206,6 @@ namespace sdr } else { -#ifdef NEWPBG // build primitive from pObject's attributes const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -229,42 +228,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } - -#else - OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); - - if(rPage.GetObjCount()) - { - SdrObject* pObject = rPage.GetObj(0); - OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); - - if(pObject && pObject->IsMasterPageBackgroundObject()) - { - // build primitive from pObject's attributes - const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - } -#endif } } @@ -485,27 +448,11 @@ namespace sdr sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const { - sal_uInt32 nSubObjectCount(getPage().GetObjCount()); - -#ifndef NEWPBG - if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nSubObjectCount--; - } -#endif - - return nSubObjectCount; + return getPage().GetObjCount(); } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); return pObj->GetViewContact(); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index f0c3eb2c8bed..f5ca659f501c 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,7 +98,6 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); -#ifdef NEWPBG // check layer visibility (traditionally was member of layer 1) if(aPreprocessedLayers.IsSet(1)) { @@ -109,20 +108,6 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } -#else - // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet - const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); - - if(pBackgroundCandidate && aPreprocessedLayers.IsSet(pBackgroundCandidate->GetLayer())) - { - // hide PageBackground for special DrawModes; historical reasons - if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) - { - // if yes, create the default background primitive sequence - xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); - } - } -#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) -- cgit