summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-05-08 16:43:22 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-05-08 21:00:12 +0200
commite2b0e614e1185c960b3015414919f69a1ed35aa0 (patch)
treec4416c9047ba30bbd89c0fa09f3d2e177d7eaa2b /svx
parentc35aef260feda34eae5e4b8a39f1baaa716b717d (diff)
Related: tdf#129916 svx: improve shadow size of custom shapes
There are multiple problems with this bug document, the first is that the shadow primitive got the default position (0) of the owning shape. Do it the same way as commit 6454b6336b8de9a4c5899adeab552af6f794cdc4 (tdf#130058 Import shadow size., 2020-04-14) did for graphic objects. This requires constructing a transform matrix in ViewContactOfSdrObjCustomShape::createViewIndependentPrimitive2DSequence(), include position and size in that as a start. Change-Id: Ia51df555c1984971afe7c52ba3f2658099a4e7b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93771 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx19
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx14
3 files changed, 28 insertions, 10 deletions
diff --git a/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
index 6ca417d340c5..aaa93af94595 100644
--- a/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
@@ -47,6 +47,8 @@ namespace drawinglayer
// making exceptions with shadow generation
bool mb3DShape : 1;
+ basegfx::B2DHomMatrix maTransform;
+
protected:
// local decomposition.
virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
@@ -57,7 +59,8 @@ namespace drawinglayer
const Primitive2DContainer& rSubPrimitives,
const basegfx::B2DHomMatrix& rTextBox,
bool bWordWrap,
- bool b3DShape);
+ bool b3DShape,
+ const basegfx::B2DHomMatrix& rObjectMatrix);
// data access
const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; }
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 61dd7d27e21b..bf1249be1c47 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -149,13 +149,13 @@ namespace sdr::contact
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 tools::Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aObjectBound);
+
if(bHasText)
{
- // take unrotated snap rect as default, then get the
- // unrotated text box. Rotation needs to be done centered
- const tools::Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
- const basegfx::B2DRange aObjectRange = vcl::unotools::b2DRectangleFromRectangle(aObjectBound);
-
// #i101684# get the text range unrotated and absolute to the object range
const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
@@ -230,6 +230,12 @@ namespace sdr::contact
bWordWrap = GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP).GetValue();
}
+ // fill object matrix
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ /*fShearX=*/0, /*fRotate=*/0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
// create primitive
const drawinglayer::primitive2d::Primitive2DReference xReference(
new drawinglayer::primitive2d::SdrCustomShapePrimitive2D(
@@ -237,7 +243,8 @@ namespace sdr::contact
xGroup,
aTextBoxMatrix,
bWordWrap,
- b3DShape));
+ b3DShape,
+ aObjectMatrix));
xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
}
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
index 378d78f5c6f6..eac5278ada2d 100644
--- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -74,7 +74,13 @@ namespace drawinglayer::primitive2d
// shadow will be correct (using ColorModifierStack), but expensive.
if(!get3DShape())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow());
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate = 0;
+ double fShearX = 0;
+ maTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow(),
+ aTranslate.getX(), aTranslate.getY());
}
}
@@ -86,13 +92,15 @@ namespace drawinglayer::primitive2d
const Primitive2DContainer& rSubPrimitives,
const basegfx::B2DHomMatrix& rTextBox,
bool bWordWrap,
- bool b3DShape)
+ bool b3DShape,
+ const basegfx::B2DHomMatrix& rTransform)
: BufferedDecompositionPrimitive2D(),
maSdrSTAttribute(rSdrSTAttribute),
maSubPrimitives(rSubPrimitives),
maTextBox(rTextBox),
mbWordWrap(bWordWrap),
- mb3DShape(b3DShape)
+ mb3DShape(b3DShape),
+ maTransform(rTransform)
{
}