summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-09-26 11:26:49 +0000
committerXisco Fauli <anistenis@gmail.com>2013-03-31 16:22:36 +0200
commit61651ece1a1eaa5012c69e3b0b36fcddb2e37c71 (patch)
tree4b0b8214c4fd29894040c5882733271ff3f89cf4 /svx
parentbdd1a3e1001258a7af5366d73a24ecb3173dab70 (diff)
#119750# corrected opacity import for SC comment shapes and their shadow visualisation
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx68
1 files changed, 47 insertions, 21 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
index a9903849059d..9076ba7d45a0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -34,6 +34,7 @@
#include <svx/xfltrit.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -107,32 +108,32 @@ namespace sdr
// 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();
+ const sal_uInt16 nShadowTransparence(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
+ const Color aShadowColor(rShadColItem.GetColorValue());
+ const XFillStyle eShadowStyle = ((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)
+ if(XFILL_HATCH == eShadowStyle)
{
// #41666# Hatch color is set hard to shadow color
XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue();
- aHatch.SetColor(aShadCol);
+ aHatch.SetColor(aShadowColor);
aSet.Put(XFillHatchItem(String(),aHatch));
}
else
{
- if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle)
+ if(XFILL_SOLID != eShadowStyle)
{
- // force fill to solid (for Gradient and Bitmap)
+ // force fill to solid (for Gradient, Bitmap and *no* fill (#119750# not filled comments *have* shadow))
aSet.Put(XFillStyleItem(XFILL_SOLID));
}
- aSet.Put(XFillColorItem(String(),aShadCol));
- aSet.Put(XFillTransparenceItem(nTransp));
+ aSet.Put(XFillColorItem(String(),aShadowColor));
+ aSet.Put(XFillTransparenceItem(nShadowTransparence));
}
// crete FillAttribute from modified ItemSet
@@ -145,18 +146,43 @@ namespace sdr
// 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(nXDist || nYDist)
+ {
+ // #119750# create obect and shadow outline, clip shadow outline
+ // on object outline. If there is a rest, create shadow. Do this to
+ // emulate that shadow is *not* visible behind the object for
+ // transparent object fill for comments in excel
+ basegfx::B2DPolygon aObjectOutline(
+ basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
+ fCornerRadiusX,
+ fCornerRadiusY));
+ aObjectOutline.transform(aObjectMatrix);
+
+ // create shadow outline
+ basegfx::B2DPolygon aShadowOutline(aObjectOutline);
+ aShadowOutline.transform(
+ basegfx::tools::createTranslateB2DHomMatrix(nXDist, nYDist));
+
+ // clip shadow outline against object outline
+ const basegfx::B2DPolyPolygon aClippedShadow(
+ basegfx::tools::clipPolygonOnPolyPolygon(
+ aShadowOutline,
+ basegfx::B2DPolyPolygon(aObjectOutline),
+ false, // take the outside
+ false));
+
+ if(aClippedShadow.count())
+ {
+ // if there is shadow, create the specialized shadow primitive
+ xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ aClippedShadow,
+ basegfx::B2DHomMatrix(),
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute());
+ }
+ }
}
if(xSpecialShadow.is())