summaryrefslogtreecommitdiff
path: root/svx/source/sdr/contact
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr/contact')
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx3
-rw-r--r--svx/source/sdr/contact/viewcontactofe3d.cxx30
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dcube.cxx19
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dextrude.cxx22
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx24
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx18
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dscene.cxx117
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dsphere.cxx20
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx236
-rw-r--r--svx/source/sdr/contact/viewcontactofgroup.cxx26
-rw-r--r--svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx65
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx194
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcircobj.cxx93
-rw-r--r--svx/source/sdr/contact/viewcontactofsdredgeobj.cxx43
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx149
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx13
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx191
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx93
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx68
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx163
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrrectobj.cxx97
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx45
-rw-r--r--svx/source/sdr/contact/viewcontactofvirtobj.cxx41
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3d.cxx1
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx11
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgroup.cxx14
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx25
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx4
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx3
30 files changed, 837 insertions, 999 deletions
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index 35e7412401..afc2513e8d 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -277,7 +277,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 03643420e4..ff9cd5059f 100644
--- a/svx/source/sdr/contact/viewcontactofe3d.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3d.cxx
@@ -33,10 +33,12 @@
#include <svx/obj3d.hxx>
#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <svx/scene3d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -124,13 +126,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);
}
@@ -175,9 +178,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 c4e08c50b9..b7497995c4 100644
--- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -54,16 +54,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;
@@ -96,13 +88,14 @@ 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;
}
} // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
index 85f05dea45..f0dd9197ff 100644
--- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -54,16 +54,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());
@@ -89,15 +81,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 dbe9460bbf..495a1f6df9 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -54,16 +54,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());
@@ -103,16 +95,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 6d39d8eae9..b8e8c352e5 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -56,16 +56,8 @@ 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());
@@ -177,13 +169,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 7658ef7dde..36231a3ac7 100644
--- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
@@ -38,11 +38,11 @@
#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/range/b3drange.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
#include <svx/sdr/contact/viewcontactofe3d.hxx>
#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -164,21 +164,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;
@@ -262,34 +254,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());
@@ -329,19 +323,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;
}
@@ -355,27 +357,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()
@@ -384,22 +366,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
@@ -418,47 +393,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 4e30ae592c..9a3d673ca3 100644
--- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -53,16 +53,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;
@@ -88,14 +80,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 62aa3c6840..019ec8d159 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -30,7 +30,6 @@
#include <svx/sdr/contact/viewcontactofgraphic.hxx>
#include <svx/sdr/contact/viewobjectcontactofgraphic.hxx>
#include <svx/svdograf.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svl/itemset.hxx>
@@ -39,7 +38,6 @@
#endif
#include <svx/sdgcpitm.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
@@ -59,6 +57,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/colritem.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -148,10 +147,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));
@@ -177,14 +175,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,
@@ -314,127 +310,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 72683559e1..3595c1a8f6 100644
--- a/svx/source/sdr/contact/viewcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewcontactofgroup.cxx
@@ -36,6 +36,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/color/bcolor.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -78,25 +79,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());
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aCurrentRange));
- // The replacement object may also get a text like 'empty group' here later
- return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ 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 3b8dc097a2..d397917edf 100644
--- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -38,12 +38,14 @@
#include <svx/svdview.hxx>
#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
#include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <svx/svdpage.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -59,33 +61,30 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject();
- if(pBackgroundCandidate)
- {
- // build primitive from pBackgroundCandidate's attributes
- const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet();
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
-
- if(pFill)
- {
- 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);
- }
+ // build primitive from page fill attributes
+ const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes));
- delete pFill;
- }
+ 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);
}
return xRetval;
@@ -105,23 +104,11 @@ namespace sdr
sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const
{
- sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount());
-
- if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
- {
- nRetval--;
- }
-
- return nRetval;
+ return GetMasterPageDescriptor().GetUsedPage().GetObjCount();
}
ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
{
- if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
- {
- nIndex++;
- }
-
return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
index 85dd101da9..f13d30c8db 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx>
#include <svx/svdocapt.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -66,107 +65,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 12db5086bd..10a0d3f733 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrcircobj.hxx>
#include <svx/svdocirc.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx>
#include <svl/itemset.hxx>
#include <svx/sxciaitm.hxx>
@@ -54,56 +53,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());
-
- // 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()));
+ // 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());
- // create primitive data
- const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
+ // 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()));
- 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);
- }
- }
+ // create primitive data
+ const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
- delete pAttribute;
- }
+ // 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));
+
+ 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);
- return xRetval;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ fStart,
+ fEnd,
+ bCloseSegment,
+ bCloseUsingCenter));
+
+ 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 6f131479c3..6fdd107669 100644
--- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdredgeobj.hxx>
#include <svx/svdoedge.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -51,35 +50,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 aea0144d47..2ee955d980 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrmeasureobj.hxx>
#include <svx/svdomeas.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svl/itemset.hxx>
#include <svx/sxmbritm.hxx>
#include <svx/sxmlhitm.hxx>
@@ -57,91 +56,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 af9686e9d6..5a38d50543 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
@@ -154,7 +154,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;
@@ -163,12 +165,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 9c0d1f5fc8..c998a65591 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -31,13 +31,13 @@
#include <svx/svdoashp.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svditer.hxx>
#include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/obj3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -112,131 +112,126 @@ 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)
+ if(pSdrObjRepresentation)
+ {
+ SdrObjListIter aIterator(*pSdrObjRepresentation);
+
+ while(aIterator.IsMore())
{
- SdrObjListIter aIterator(*pSdrObjRepresentation);
-
- while(aIterator.IsMore())
- {
- SdrObject& rCandidate = *aIterator.Next();
+ 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);
+ if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate))
+ {
+ 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(!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(!basegfx::fTools::equalZero(fExtraTextRotation))
- {
- basegfx::B2DVector aTranslation(
- ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
- ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
- aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
- aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
- aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
- }
-
- if(rGeoStat.nShearWink)
- {
- aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
- }
-
- if(rGeoStat.nDrehWink)
- {
- aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
- }
-
- // give text it's target position
- aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ basegfx::B2DVector aTranslation(
+ ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
+ ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
+ aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
+ aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
+ aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
- else
+
+ if(rGeoStat.nShearWink)
{
- aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());
+ aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
}
- // check if SdrTextWordWrapItem is set
- bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
- }
+ if(rGeoStat.nDrehWink)
+ {
+ aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+ }
- // 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 ddbae27a9e..b802b2e363 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -30,7 +30,6 @@
#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
#include <svx/svdoole2.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svx/sdr/primitive2d/sdrole2primitive2d.hxx>
@@ -72,59 +71,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 fdfcd53d05..0bf51d58f9 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -42,9 +42,9 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -98,7 +98,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);
}
@@ -202,38 +203,27 @@ namespace sdr
}
else
{
- OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
+ // build primitive from pObject's attributes
+ const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes));
- if(rPage.GetObjCount())
+ if(!aFill.isDefault())
{
- 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();
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
-
- if(pFill)
- {
- 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);
}
}
}
@@ -455,23 +445,11 @@ namespace sdr
sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
{
- sal_uInt32 nSubObjectCount(getPage().GetObjCount());
-
- if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
- {
- nSubObjectCount--;
- }
-
- return nSubObjectCount;
+ return getPage().GetObjCount();
}
ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
{
- if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
- {
- nIndex++;
- }
-
SdrObject* pObj = getPage().GetObj(nIndex);
DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
return pObj->GetViewContact();
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 21cbb4ef94..78f90a54d9 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrpathobj.hxx>
#include <svx/svdopath.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -53,93 +52,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(pSdrText)
+ if(!nPointCount)
{
- 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;
- }
+ 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;
}
- return xRetval;
+ // 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. 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 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 9b9b3a838e..cf2cf35033 100644
--- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -31,7 +31,6 @@
#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
#include <svx/svdorect.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
#include <svl/itemset.hxx>
#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
@@ -55,70 +54,48 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const
{
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
- SdrText* pSdrText = GetRectObj().getText(0);
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetRectObj().getText(0)));
- if(pSdrText)
- {
- drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
+ // 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()));
- 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);
- // 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());
- // #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;
+ // 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 16756cd8a8..1e34db7575 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -47,6 +47,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//........................................................................
namespace sdr { namespace contact {
@@ -135,35 +136,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 5269faedfd..a6ccb2b45f 100644
--- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
@@ -33,6 +33,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -74,29 +75,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 2109789ade..0873ef1806 100644
--- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
@@ -35,7 +35,6 @@
#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
//////////////////////////////////////////////////////////////////////////////
// predeclarations
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
index 3e13d81f95..01c666b56c 100644
--- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
@@ -121,17 +121,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 f5f522608a..88e7e842f7 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -55,20 +55,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/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
index 8744fd14a8..85c4068d4f 100644
--- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
@@ -94,15 +94,13 @@ namespace sdr
rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
rDisplayInfo.SetSubContentActive(true);
- // 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()))
+ // 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 yes, create the default background primitive sequence
+ // if visible, create the default background primitive sequence
xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence();
}
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index b406620e08..fb497d09d3 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -40,7 +40,7 @@
#include <svx/svdpage.hxx>
#include <unoapi.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -292,28 +292,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 645a980a1c..182f790fe1 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -35,11 +35,11 @@
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/svdview.hxx>
#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -203,7 +203,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
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 3b53a9c543..1e8f4c79de 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -1689,6 +1689,9 @@ namespace sdr { namespace contact {
if ( !bHadControl && rControl.is() && rControl.isVisible() )
rControl.invalidate();
+ if ( !bHadControl && rControl.is() && rControl.isVisible() )
+ rControl.invalidate();
+
// check if we already have an XControl.
if ( !xControlModel.is() || !rControl.is() )
// use the default mechanism. This will create a ControlPrimitive2D without