summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/vml/vmlshapecontext.cxx35
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx68
2 files changed, 79 insertions, 24 deletions
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 79dac8e963da..c5edd00e65ac 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -59,6 +59,35 @@ OptValue< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 nT
return OptValue< double >();
}
+/** #119750# Special method for opacity; it *should* be a percentage value, but there are cases
+ where a value relative to 0xffff (65536) is used, ending with an 'f'
+ */
+OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue )
+{
+ OptValue< OUString > oValue = rAttribs.getString( nToken );
+ double fRetval(fDefValue);
+
+ if( oValue.has() )
+ {
+ const OUString aString(oValue.get());
+ const sal_Int32 nLength(aString.getLength());
+
+ if(nLength > 0)
+ {
+ if(aString.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("f")))
+ {
+ fRetval = std::max(0.0, std::min(1.0, aString.toDouble() / 65536.0));
+ }
+ else
+ {
+ fRetval = ConversionHelper::decodePercent( aString, fDefValue );
+ }
+ }
+ }
+
+ return OptValue< double >(fRetval);
+}
+
/** Returns the integer value pair from the specified VML attribute (if present).
*/
OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int32 nToken )
@@ -298,7 +327,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
mrTypeModel.maStrokeModel.maEndArrow.moArrowWidth = rAttribs.getToken( XML_endarrowwidth );
mrTypeModel.maStrokeModel.maEndArrow.moArrowLength = rAttribs.getToken( XML_endarrowlength );
mrTypeModel.maStrokeModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) );
- mrTypeModel.maStrokeModel.moOpacity = lclDecodePercent( rAttribs, XML_opacity, 1.0 );
+ mrTypeModel.maStrokeModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 );
mrTypeModel.maStrokeModel.moWeight.assignIfUsed( rAttribs.getString( XML_weight ) );
mrTypeModel.maStrokeModel.moDashStyle = rAttribs.getString( XML_dashstyle );
mrTypeModel.maStrokeModel.moLineStyle = rAttribs.getToken( XML_linestyle );
@@ -308,9 +337,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
case VML_TOKEN( fill ):
mrTypeModel.maFillModel.moFilled.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) );
mrTypeModel.maFillModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) );
- mrTypeModel.maFillModel.moOpacity = lclDecodePercent( rAttribs, XML_opacity, 1.0 );
+ mrTypeModel.maFillModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 );
mrTypeModel.maFillModel.moColor2 = rAttribs.getString( XML_color2 );
- mrTypeModel.maFillModel.moOpacity2 = lclDecodePercent( rAttribs, XML_opacity2, 1.0 );
+ mrTypeModel.maFillModel.moOpacity2 = lclDecodeOpacity( rAttribs, XML_opacity2, 1.0 );
mrTypeModel.maFillModel.moType = rAttribs.getToken( XML_type );
mrTypeModel.maFillModel.moAngle = rAttribs.getInteger( XML_angle );
mrTypeModel.maFillModel.moFocus = lclDecodePercent( rAttribs, XML_focus, 0.0 );
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())