summaryrefslogtreecommitdiff
path: root/svx/source/sdr/primitive2d
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-01-27 11:51:56 +0100
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-01-27 11:51:56 +0100
commitffe5c97056ab181367e49691d487eb6f6f375200 (patch)
tree552e2d32015f11e023004a4104e15cce886312e0 /svx/source/sdr/primitive2d
parentde7c998fe9ba5be956bf8a155455ad17985c4f88 (diff)
aw079: #i99147# attribute rework and others
Diffstat (limited to 'svx/source/sdr/primitive2d')
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx407
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx65
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx44
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx27
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx58
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx116
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx66
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx130
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx64
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx63
-rw-r--r--svx/source/sdr/primitive2d/sdrprimitivetools.cxx17
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx55
13 files changed, 572 insertions, 542 deletions
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index d657e6b9a8d7..a1ef5d8f0957 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -58,14 +58,11 @@
#include <svx/sdsxyitm.hxx>
#include <svx/sdshcitm.hxx>
#include <svx/sdshtitm.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <svx/svdotext.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#include <svx/sdr/attribute/sdrtextattribute.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <svx/xbtmpit.hxx>
#include <svl/itempool.hxx>
#include <vcl/svapp.hxx>
@@ -73,13 +70,22 @@
#include <svx/svx3ditems.hxx>
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <drawinglayer/attribute/sdrattribute3d.hxx>
#include <drawinglayer/attribute/sdrallattribute3d.hxx>
#include <svx/rectenum.hxx>
#include <svx/sdtfchim.hxx>
#include <svx/svdoutl.hxx>
#include <svx/svdmodel.hxx>
#include <svx/editstat.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <svx/sdr/attribute/sdrfilltextattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -221,9 +227,8 @@ namespace drawinglayer
{
namespace primitive2d
{
- attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet)
+ attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet)
{
- attribute::SdrLineAttribute* pRetval(0L);
const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
if(XLINE_NONE != eStyle)
@@ -253,7 +258,7 @@ namespace drawinglayer
}
}
- pRetval = new attribute::SdrLineAttribute(
+ return attribute::SdrLineAttribute(
XLineJointtoB2DLineJoin(eJoint),
(double)nWidth,
(double)nTransparence * 0.01,
@@ -263,12 +268,13 @@ namespace drawinglayer
}
}
- return pRetval;
+ return attribute::SdrLineAttribute();
}
- attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth)
+ attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+ const SfxItemSet& rSet,
+ double fWidth)
{
- attribute::SdrLineStartEndAttribute* pRetval(0L);
const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue());
const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue());
basegfx::B2DPolyPolygon aStartPolyPolygon;
@@ -328,15 +334,16 @@ namespace drawinglayer
if(bStartActive || bEndActive)
{
- pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered);
+ return attribute::SdrLineStartEndAttribute(
+ aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth,
+ bStartActive, bEndActive, bStartCentered, bEndCentered);
}
- return pRetval;
+ return attribute::SdrLineStartEndAttribute();
}
- attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet)
+ attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet)
{
- attribute::SdrShadowAttribute* pRetval(0L);
const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue());
if(bShadow)
@@ -374,16 +381,15 @@ namespace drawinglayer
(double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
- pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
+ return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
}
}
- return pRetval;
+ return attribute::SdrShadowAttribute();
}
- attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet)
+ attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet)
{
- attribute::SdrFillAttribute* pRetval(0L);
const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
if(XFILL_NONE != eStyle)
@@ -398,9 +404,9 @@ namespace drawinglayer
if(100 != nTransparence)
{
const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
- attribute::FillGradientAttribute* pGradient(0L);
- attribute::FillHatchAttribute* pHatch(0L);
- attribute::SdrFillBitmapAttribute* pBitmap(0L);
+ attribute::FillGradientAttribute aGradient;
+ attribute::FillHatchAttribute aHatch;
+ attribute::SdrFillBitmapAttribute aBitmap;
switch(eStyle)
{
@@ -412,10 +418,10 @@ namespace drawinglayer
}
case XFILL_GRADIENT :
{
- XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
+ XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
- const Color aStartColor(aGradient.GetStartColor());
- const sal_uInt16 nStartIntens(aGradient.GetStartIntens());
+ const Color aStartColor(aXGradient.GetStartColor());
+ const sal_uInt16 nStartIntens(aXGradient.GetStartIntens());
basegfx::BColor aStart(aStartColor.getBColor());
if(nStartIntens != 100)
@@ -424,8 +430,8 @@ namespace drawinglayer
aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
}
- const Color aEndColor(aGradient.GetEndColor());
- const sal_uInt16 nEndIntens(aGradient.GetEndIntens());
+ const Color aEndColor(aXGradient.GetEndColor());
+ const sal_uInt16 nEndIntens(aXGradient.GetEndIntens());
basegfx::BColor aEnd(aEndColor.getBColor());
if(nEndIntens != 100)
@@ -434,12 +440,12 @@ namespace drawinglayer
aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
}
- pGradient = new attribute::FillGradientAttribute(
- XGradientStyleToGradientStyle(aGradient.GetGradientStyle()),
- (double)aGradient.GetBorder() * 0.01,
- (double)aGradient.GetXOffset() * 0.01,
- (double)aGradient.GetYOffset() * 0.01,
- (double)aGradient.GetAngle() * F_PI1800,
+ aGradient = attribute::FillGradientAttribute(
+ XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
+ (double)aXGradient.GetBorder() * 0.01,
+ (double)aXGradient.GetXOffset() * 0.01,
+ (double)aXGradient.GetYOffset() * 0.01,
+ (double)aXGradient.GetAngle() * F_PI1800,
aStart,
aEnd,
((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue());
@@ -451,7 +457,7 @@ namespace drawinglayer
const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue());
const Color aColorB(rHatch.GetColor());
- pHatch = new attribute::FillHatchAttribute(
+ aHatch = attribute::FillHatchAttribute(
XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
(double)rHatch.GetDistance(),
(double)rHatch.GetAngle() * F_PI1800,
@@ -462,23 +468,25 @@ namespace drawinglayer
}
case XFILL_BITMAP :
{
- pBitmap = createNewSdrFillBitmapAttribute(rSet);
+ aBitmap = createNewSdrFillBitmapAttribute(rSet);
break;
}
}
- pRetval = new attribute::SdrFillAttribute(
+ return attribute::SdrFillAttribute(
(double)nTransparence * 0.01,
aColor.getBColor(),
- pGradient, pHatch, pBitmap);
+ aGradient,
+ aHatch,
+ aBitmap);
}
}
- return pRetval;
+ return attribute::SdrFillAttribute();
}
// #i101508# Support handing over given text-to-border distances
- attribute::SdrTextAttribute* createNewSdrTextAttribute(
+ attribute::SdrTextAttribute createNewSdrTextAttribute(
const SfxItemSet& rSet,
const SdrText& rText,
const sal_Int32* pLeft,
@@ -486,7 +494,6 @@ namespace drawinglayer
const sal_Int32* pRight,
const sal_Int32* pLower)
{
- attribute::SdrTextAttribute* pRetval(0);
const SdrTextObj& rTextObj = rText.GetObject();
if(rText.GetOutlinerParaObject() && rText.GetModel())
@@ -530,7 +537,7 @@ namespace drawinglayer
const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING);
- pRetval = new attribute::SdrTextAttribute(
+ return attribute::SdrTextAttribute(
rText,
aOutlinerParaObject,
((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(),
@@ -550,15 +557,15 @@ namespace drawinglayer
bWrongSpell);
}
- return pRetval;
+ return attribute::SdrTextAttribute();
}
- attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
+ attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
{
- attribute::FillGradientAttribute* pRetval = 0L;
const SfxPoolItem* pGradientItem;
- if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
+ if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem)
+ && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
{
// test if float transparence is completely transparent
const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
@@ -571,7 +578,7 @@ namespace drawinglayer
const double fStartLum(nStartLuminance / 255.0);
const double fEndLum(nEndLuminance / 255.0);
- pRetval = new attribute::FillGradientAttribute(
+ return attribute::FillGradientAttribute(
XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
(double)rGradient.GetBorder() * 0.01,
(double)rGradient.GetXOffset() * 0.01,
@@ -583,12 +590,11 @@ namespace drawinglayer
}
}
- return pRetval;
+ return attribute::FillGradientAttribute();
}
- attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
+ attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
{
- attribute::SdrFillBitmapAttribute* pRetval(0L);
Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap());
// make sure it's not empty, use default instead
@@ -635,7 +641,7 @@ namespace drawinglayer
(double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(),
(double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
- pRetval = new attribute::SdrFillBitmapAttribute(
+ return attribute::SdrFillBitmapAttribute(
aBitmap,
aSize,
aOffset,
@@ -644,252 +650,174 @@ namespace drawinglayer
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(),
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(),
((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue());
-
- return pRetval;
}
- attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText)
+ attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText,
+ bool bSuppressText)
{
- attribute::SdrShadowTextAttribute* pRetval(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrTextAttribute aText;
// #i98072# added option to suppress text
// look for text first
- if(!bSuppressText)
+ if(!bSuppressText && pText)
{
- pText = createNewSdrTextAttribute(rSet, rText);
+ aText = createNewSdrTextAttribute(rSet, *pText);
}
// try shadow
- pShadow = createNewSdrShadowAttribute(rSet);
-
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
- if(pText || pShadow)
- {
- pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText);
- }
-
- return pRetval;
+ return attribute::SdrShadowTextAttribute(aShadow, aText);
}
- attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
{
- attribute::SdrLineShadowTextAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- pText = createNewSdrTextAttribute(rSet, rText);
-
- // when object has text and text is fontwork and hide contour is set for fontwork, force
- // line and fill style to empty
- if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
+ if(pText)
{
- bFontworkHideContour = true;
+ aText = createNewSdrTextAttribute(rSet, *pText);
+
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.isDefault()
+ && !aText.getSdrFormTextAttribute().isDefault()
+ && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
}
// try line style
if(!bFontworkHideContour)
{
- pLine = createNewSdrLineAttribute(rSet);
+ aLine = createNewSdrLineAttribute(rSet);
- if(pLine && !pLine->isVisible())
- {
- delete pLine;
- pLine = 0L;
- }
-
- if(pLine)
+ if(!aLine.isDefault())
{
// try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
}
- // try shadow
- if(pLine || pText)
+ if(!aLine.isDefault() || !aText.isDefault())
{
- pShadow = createNewSdrShadowAttribute(rSet);
+ // try shadow
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
+ return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText);
}
- if(pLine || pText)
- {
- pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText);
- }
-
- return pRetval;
+ return attribute::SdrLineShadowTextAttribute();
}
- attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
{
- attribute::SdrLineFillShadowTextAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- pText = createNewSdrTextAttribute(rSet, rText);
-
- // when object has text and text is fontwork and hide contour is set for fontwork, force
- // line and fill style to empty
- if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
+ if(pText)
{
- bFontworkHideContour = true;
- }
-
- // try line style
- if(!bFontworkHideContour)
- {
- pLine = createNewSdrLineAttribute(rSet);
+ aText = createNewSdrTextAttribute(rSet, *pText);
- if(pLine && !pLine->isVisible())
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
{
- delete pLine;
- pLine = 0L;
- }
-
- if(pLine)
- {
- // try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ bFontworkHideContour = true;
}
}
- // try fill style
if(!bFontworkHideContour)
{
- pFill = createNewSdrFillAttribute(rSet);
+ // try line style
+ aLine = createNewSdrLineAttribute(rSet);
- if(pFill && !pFill->isVisible())
+ if(!aLine.isDefault())
{
- delete pFill;
- pFill = 0L;
+ // try LineStartEnd
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
- if(pFill)
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
+
+ if(!aFill.isDefault())
{
// try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- // try shadow
- if(pLine || pFill || pText)
+ if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault())
{
- pShadow = createNewSdrShadowAttribute(rSet);
-
- if(pShadow && !pShadow->isVisible())
- {
- delete pShadow;
- pShadow = 0L;
- }
- }
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
- if(pLine || pFill || pText)
- {
- pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText);
+ return attribute::SdrLineFillShadowTextAttribute(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText);
}
- return pRetval;
+ return attribute::SdrLineFillShadowTextAttribute();
}
- attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
+ attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
{
- attribute::SdrLineFillShadowAttribute* pRetval(0L);
- attribute::SdrLineAttribute* pLine(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::SdrLineStartEndAttribute* pLineStartEnd(0L);
- attribute::SdrShadowAttribute* pShadow(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
// try line style
- pLine = createNewSdrLineAttribute(rSet);
+ const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet));
- if(pLine && !pLine->isVisible())
- {
- delete pLine;
- pLine = 0L;
- }
-
- if(pLine)
+ if(!aLine.isDefault())
{
// try LineStartEnd
- pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth());
-
- if(pLineStartEnd && !pLineStartEnd->isVisible())
- {
- delete pLineStartEnd;
- pLineStartEnd = 0L;
- }
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
}
// try fill style
- pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet);
-
- if(pFill && !pFill->isVisible())
+ if(!bSuppressFill)
{
- delete pFill;
- pFill = 0L;
- }
-
- if(pFill)
- {
- // try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
- }
+ aFill = createNewSdrFillAttribute(rSet);
- // try shadow
- if(pLine || pFill)
- {
- pShadow = createNewSdrShadowAttribute(rSet);
-
- if(pShadow && !pShadow->isVisible())
+ if(!aFill.isDefault())
{
- delete pShadow;
- pShadow = 0L;
+ // try fillfloattransparence
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- if(pLine || pFill)
+ if(!aLine.isDefault() || !aFill.isDefault())
{
- pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient);
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
+
+ return attribute::SdrLineFillShadowAttribute3D(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient);
}
- return pRetval;
+ return attribute::SdrLineFillShadowAttribute3D();
}
- attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet)
+ attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet)
{
// get perspective
::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL);
@@ -926,10 +854,10 @@ namespace drawinglayer
// get two sided lighting
const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue());
- return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
+ return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
}
- attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet)
+ attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet)
{
// extract lights from given SfxItemSet (from scene)
::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
@@ -994,7 +922,7 @@ namespace drawinglayer
const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
- return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
+ return attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
}
void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY)
@@ -1051,57 +979,50 @@ namespace drawinglayer
}
// #i101508# Support handing over given text-to-border distances
- attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute(
+ attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(
const SfxItemSet& rSet,
- const SdrText* pSdrText,
+ const SdrText* pText,
const sal_Int32* pLeft,
const sal_Int32* pUpper,
const sal_Int32* pRight,
const sal_Int32* pLower)
{
- attribute::SdrFillTextAttribute* pRetval(0L);
- attribute::SdrFillAttribute* pFill(0L);
- attribute::FillGradientAttribute* pFillFloatTransGradient(0L);
- attribute::SdrTextAttribute* pText(0L);
+ attribute::SdrFillAttribute aFill;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
bool bFontworkHideContour(false);
// look for text first
- if(pSdrText)
+ if(pText)
{
- pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower);
- }
+ aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower);
- // when object has text and text is fontwork and hide contour is set for fontwork, force
- // fill style to empty
- if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour())
- {
- bFontworkHideContour = true;
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // fill style to empty
+ if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
}
- // try fill style
if(!bFontworkHideContour)
{
- pFill = createNewSdrFillAttribute(rSet);
-
- if(pFill && !pFill->isVisible())
- {
- delete pFill;
- pFill = 0L;
- }
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
- if(pFill)
+ if(!aFill.isDefault())
{
// try fillfloattransparence
- pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
}
}
- if(pFill || pText)
+ if(!aFill.isDefault() || !aText.isDefault())
{
- pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText);
+ return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText);
}
- return pRetval;
+ return attribute::SdrFillTextAttribute();
}
} // end of namespace primitive2d
diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
index e4967f767299..58017f9d01fc 100644
--- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
@@ -35,7 +35,7 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -50,7 +50,6 @@ namespace drawinglayer
Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
{
Primitive2DSequence aRetval;
- Primitive2DSequence aHitTestContent;
// create unit outline polygon
const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
@@ -59,68 +58,66 @@ namespace drawinglayer
getCornerRadiusY()));
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(getSdrLFSTAttribute().getFill().isDefault())
{
+ // create invisible fill for HitTest
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(
+ createHiddenGeometryPrimitives2D(
+ true,
basegfx::B2DPolyPolygon(aUnitOutline),
- getTransform(),
- *getSdrLFSTAttribute().getFill(),
- getSdrLFSTAttribute().getFillFloatTransGradient()));
+ getTransform()));
}
else
{
- // if no fill, create one for HitTest and BoundRect fallback
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolyPolygonFillPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)),
+ getSdrLFSTAttribute().getFill(),
getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
+ // create invisible line for HitTest/BoundRect
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolygonLinePrimitive(
- aUnitOutline,
- getTransform(),
- *getSdrLFSTAttribute().getLine()));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolygonLinePrimitive(
- getTail(),
- getTransform(),
- *getSdrLFSTAttribute().getLine(),
- getSdrLFSTAttribute().getLineStartEnd()));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getTail()),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect. It
- // is sufficient to use the tail; the body is already ensured with fill creation
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolygonLinePrimitive(
- getTail(),
+ aUnitOutline,
getTransform(),
- attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0))));
- }
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
- // add HitTest and BoundRect helper geometry (if exists)
- if(aHitTestContent.hasElements())
- {
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- Primitive2DReference(new HitTestPrimitive2D(aHitTestContent)));
+ createPolygonLinePrimitive(
+ getTail(),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createTextPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- *getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getText(),
getSdrLFSTAttribute().getLine(),
false,
false,
@@ -128,9 +125,9 @@ namespace drawinglayer
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
index 0c39f7a6480f..a729f8fcfc7a 100644
--- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
@@ -35,7 +35,8 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -51,34 +52,45 @@ namespace drawinglayer
{
Primitive2DSequence aRetval;
- // prepare unit transform
- ::basegfx::B2DHomMatrix aEmptyMatrix;
-
// add line
- if(getSdrLSTAttribute().getLine())
+ if(getSdrLSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getUnitPolygon())));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ getUnitPolygon(),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getLine(),
+ getSdrLSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLSTAttribute().getText())
+ if(!getSdrLSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(getUnitPolygon()),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getText(),
+ getSdrLSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLSTAttribute().getShadow())
+ if(!getSdrLSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
index 5b686bb5abae..3cf7b6415725 100644
--- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -36,6 +36,7 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -52,21 +53,23 @@ namespace drawinglayer
Primitive2DSequence aRetval(getSubPrimitives());
// add text
- if(getSdrSTAttribute().getText())
+ if(!getSdrSTAttribute().getText().isDefault())
{
- const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(
- basegfx::B2DPolyPolygon(aUnitOutline),
- getTextBox(),
- *getSdrSTAttribute().getText(),
- 0,
- false,
- getWordWrap(),
- isForceTextClipToTextRange()));
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTextBox(),
+ getSdrSTAttribute().getText(),
+ attribute::SdrLineAttribute(),
+ false,
+ getWordWrap(),
+ isForceTextClipToTextRange()));
}
// add shadow
- if(aRetval.hasElements() && getSdrSTAttribute().getShadow())
+ if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault())
{
// #i105323# add generic shadow only for 2D shapes. For
// 3D shapes shadow will be set at the individual created
@@ -80,7 +83,7 @@ namespace drawinglayer
// shadow will be correct (using ColorModifierStack), but expensive.
if(!get3DShape())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow());
}
}
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 8474b72be2e4..db55e4588fea 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -31,12 +31,10 @@
#include "precompiled_svx.hxx"
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
-#include <svx/sdr/attribute/sdrallattribute.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <drawinglayer/primitive2d/alphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
#include <drawinglayer/attribute/strokeattribute.hxx>
@@ -55,6 +53,10 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -70,25 +72,25 @@ namespace drawinglayer
const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrFillAttribute& rFill,
- const attribute::FillGradientAttribute* pFillGradient)
+ const attribute::FillGradientAttribute& rFillGradient)
{
// prepare fully scaled polygon
basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
aScaledPolyPolygon.transform(rObjectTransform);
BasePrimitive2D* pNewFillPrimitive = 0;
- if(rFill.isGradient())
+ if(!rFill.getGradient().isDefault())
{
- pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient());
+ pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient());
}
- else if(rFill.isHatch())
+ else if(!rFill.getHatch().isDefault())
{
- pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch());
+ pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch());
}
- else if(rFill.isBitmap())
+ else if(!rFill.getBitmap().isDefault())
{
const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
- pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange));
+ pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange));
}
else
{
@@ -100,9 +102,9 @@ namespace drawinglayer
// create simpleTransparencePrimitive, add created fill primitive
const Primitive2DReference xRefA(pNewFillPrimitive);
const Primitive2DSequence aContent(&xRefA, 1L);
- return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence()));
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence()));
}
- else if(pFillGradient)
+ else if(!rFillGradient.isDefault())
{
// create sequence with created fill primitive
const Primitive2DReference xRefA(pNewFillPrimitive);
@@ -111,11 +113,11 @@ namespace drawinglayer
// create FillGradientPrimitive2D for transparence and add to new sequence
// fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways
const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
- const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient));
+ const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient));
const Primitive2DSequence aAlpha(&xRefB, 1L);
- // create AlphaPrimitive2D using alpha and content
- return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha));
+ // create TransparencePrimitive2D using alpha and content
+ return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha));
}
else
{
@@ -128,7 +130,7 @@ namespace drawinglayer
const basegfx::B2DPolygon& rUnitPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrLineAttribute& rLine,
- const attribute::SdrLineStartEndAttribute* pStroke)
+ const attribute::SdrLineStartEndAttribute& rStroke)
{
// prepare fully scaled polygon
basegfx::B2DPolygon aScaledPolygon(rUnitPolygon);
@@ -139,10 +141,10 @@ namespace drawinglayer
const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen());
BasePrimitive2D* pNewLinePrimitive = 0L;
- if(!rUnitPolygon.isClosed() && pStroke)
+ if(!rUnitPolygon.isClosed() && !rStroke.isDefault())
{
- attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered());
- attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered());
+ attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered());
+ attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered());
// create data
pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd);
@@ -158,7 +160,7 @@ namespace drawinglayer
// create simpleTransparencePrimitive, add created fill primitive
const Primitive2DReference xRefA(pNewLinePrimitive);
const Primitive2DSequence aContent(&xRefA, 1L);
- return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence()));
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence()));
}
else
{
@@ -171,7 +173,7 @@ namespace drawinglayer
const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
const basegfx::B2DHomMatrix& rObjectTransform,
const attribute::SdrTextAttribute& rText,
- const attribute::SdrLineAttribute* pStroke,
+ const attribute::SdrLineAttribute& rStroke,
bool bCellText,
bool bWordWrap,
bool bClipOnBounds)
@@ -182,7 +184,7 @@ namespace drawinglayer
if(rText.isContour())
{
// contour text
- if(pStroke && 0.0 != pStroke->getWidth())
+ if(!rStroke.isDefault() && 0.0 != rStroke.getWidth())
{
// take line width into account and shrink contour polygon accordingly
// decompose to get scale
@@ -197,7 +199,7 @@ namespace drawinglayer
fabs(aScale.getX()), fabs(aScale.getY())));
// grow the polygon. To shrink, use negative value (half width)
- aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5));
+ aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5));
// scale back to unit polygon
aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(
@@ -221,7 +223,7 @@ namespace drawinglayer
rObjectTransform);
}
}
- else if(rText.getSdrFormTextAttribute())
+ else if(!rText.getSdrFormTextAttribute().isDefault())
{
// text on path, use scaled polygon
basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
@@ -230,7 +232,7 @@ namespace drawinglayer
&rText.getSdrText(),
rText.getOutlinerParaObject(),
aScaledPolyPolygon,
- *rText.getSdrFormTextAttribute());
+ rText.getSdrFormTextAttribute());
}
else
{
@@ -327,7 +329,7 @@ namespace drawinglayer
if(rText.isScroll())
{
// suppress scroll when FontWork
- if(!rText.getSdrFormTextAttribute())
+ if(rText.getSdrFormTextAttribute().isDefault())
{
// get scroll direction
const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection());
@@ -468,7 +470,7 @@ namespace drawinglayer
const Primitive2DSequence aTempContent(&aRetval[0], 1);
aRetval[0] = Primitive2DReference(
- new UnifiedAlphaPrimitive2D(
+ new UnifiedTransparencePrimitive2D(
aTempContent,
rShadow.getTransparence()));
}
diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
index 1327d2a422fa..302eabecbdf9 100644
--- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
@@ -36,10 +36,9 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <basegfx/color/bcolor.hxx>
-#include <drawinglayer/attribute/sdrattribute.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -59,52 +58,73 @@ namespace drawinglayer
// Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation.
// This is needed to have the same look when stroke is used since the polygon start point defines the
// stroke start, too.
- ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1));
// scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
- const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
// apply to the geometry
aUnitOutline.transform(aUnitCorrectionMatrix);
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(!getSdrLFSTAttribute().getFill().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
}
SdrEllipsePrimitive2D::SdrEllipsePrimitive2D(
- const ::basegfx::B2DHomMatrix& rTransform,
+ const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
@@ -142,7 +162,7 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle));
if(mbCloseSegment)
{
@@ -150,57 +170,77 @@ namespace drawinglayer
{
// for compatibility, insert the center point at polygon start to get the same
// line stroking pattern as the old painting mechanisms.
- aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0));
+ aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0));
}
aUnitOutline.setClosed(true);
}
// move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
- basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0));
- aUnitCorrectionMatrix.scale(0.5, 0.5);
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
// apply to the geometry
aUnitOutline.transform(aUnitCorrectionMatrix);
// add fill
- if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed())
+ if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()));
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
}
SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D(
- const ::basegfx::B2DHomMatrix& rTransform,
+ const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
double fStartAngle,
double fEndAngle,
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index befff1b0c539..d83fa53f812e 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -36,7 +36,8 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -49,21 +50,25 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
// add fill, but only when graphic ist transparent
- if(getSdrLFSTAttribute().getFill() && isTransparent())
+ if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(!getSdrLFSTAttribute().getLine().isDefault())
{
// if line width is given, polygon needs to be grown by half of it to make the
// outline to be outside of the bitmap
- if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
{
// decompose to get scale
basegfx::B2DVector aScale, aTranslate;
@@ -71,46 +76,61 @@ namespace drawinglayer
getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
// create expanded range (add relative half line width to unit rectangle)
- double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline, getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
}
- else
- {
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
- }
// add graphic content
if(255L != getGraphicAttr().GetTransparency())
{
- Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr()));
+ const Primitive2DReference xGraphicContentPrimitive(
+ new GraphicPrimitive2D(
+ getTransform(),
+ getGraphicObject(),
+ getGraphicAttr()));
+
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive);
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index e22e9eb61c5b..ebac828bb9d5 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -39,8 +39,8 @@
#include <basegfx/tools/canvastools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -60,36 +60,44 @@ namespace drawinglayer
bool bLeftActive,
bool bRightActive) const
{
- const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
basegfx::B2DPolygon aPolygon;
aPolygon.append(rStart);
aPolygon.append(rEnd);
- if(!pLineStartEnd || (!bLeftActive && !bRightActive))
+ if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive))
{
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0);
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ attribute::SdrLineStartEndAttribute());
}
if(bLeftActive && bRightActive)
{
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd);
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ rLineStartEnd);
}
const basegfx::B2DPolyPolygon aEmpty;
const attribute::SdrLineStartEndAttribute aLineStartEnd(
- bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty,
- bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0,
- bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false,
- bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false);
+ bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty,
+ bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0,
+ bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false,
+ bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false);
- return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd);
+ return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd);
}
Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
{
Primitive2DSequence aRetval;
- SdrBlockTextPrimitive2D* pBlockText = 0L;
+ SdrBlockTextPrimitive2D* pBlockText = 0;
basegfx::B2DRange aTextRange;
double fTextX((getStart().getX() + getEnd().getX()) * 0.5);
double fTextY((getStart().getX() + getEnd().getX()) * 0.5);
@@ -97,11 +105,13 @@ namespace drawinglayer
const double fDistance(aLine.getLength());
const double fAngle(atan2(aLine.getY(), aLine.getX()));
bool bAutoUpsideDown(false);
- const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText();
+ const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText();
const basegfx::B2DHomMatrix aObjectMatrix(
basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart()));
- if(pTextAttribute)
+ // preapare text, but do not add yet; it needs to be aligned to
+ // the line geometry
+ if(!rTextAttribute.isDefault())
{
basegfx::B2DHomMatrix aTextMatrix;
double fTestAngle(fAngle);
@@ -127,58 +137,52 @@ namespace drawinglayer
// create primitive and get text range
pBlockText = new SdrBlockTextPrimitive2D(
- &pTextAttribute->getSdrText(),
- pTextAttribute->getOutlinerParaObject(),
+ &rTextAttribute.getSdrText(),
+ rTextAttribute.getOutlinerParaObject(),
aTextMatrix,
SDRTEXTHORZADJUST_CENTER,
SDRTEXTVERTADJUST_CENTER,
- pTextAttribute->isScroll(),
+ rTextAttribute.isScroll(),
false,
false,
false,
false);
+
aTextRange = pBlockText->getB2DRange(aViewInformation);
}
// prepare line attribute and result
- const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine());
-
- if(!pLineAttribute)
- {
- // if initially no line is defined, create one for HitTest and BoundRect
- pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0));
- }
-
{
+ const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine());
bool bArrowsOutside(false);
bool bMainLineSplitted(false);
- const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
double fStartArrowW(0.0);
double fStartArrowH(0.0);
double fEndArrowW(0.0);
double fEndArrowH(0.0);
- if(pLineStartEnd)
+ if(!rLineStartEnd.isDefault())
{
- if(pLineStartEnd->isStartActive())
+ if(rLineStartEnd.isStartActive())
{
- const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon()));
- fStartArrowW = pLineStartEnd->getStartWidth();
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon()));
+ fStartArrowW = rLineStartEnd.getStartWidth();
fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth();
- if(pLineStartEnd->isStartCentered())
+ if(rLineStartEnd.isStartCentered())
{
fStartArrowH *= 0.5;
}
}
- if(pLineStartEnd->isEndActive())
+ if(rLineStartEnd.isEndActive())
{
- const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon()));
- fEndArrowW = pLineStartEnd->getEndWidth();
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon()));
+ fEndArrowW = rLineStartEnd.getEndWidth();
fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth();
- if(pLineStartEnd->isEndCentered())
+ if(rLineStartEnd.isEndCentered())
{
fEndArrowH *= 0.5;
}
@@ -187,7 +191,7 @@ namespace drawinglayer
const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5));
const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5);
- const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5);
+ const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5);
if(fSpaceNeededByArrows > fDistance)
{
@@ -279,12 +283,12 @@ namespace drawinglayer
const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY());
const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY());
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false));
if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal)
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false));
}
}
else
@@ -295,12 +299,12 @@ namespace drawinglayer
const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY());
const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY());
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true));
}
}
@@ -313,13 +317,13 @@ namespace drawinglayer
const basegfx::B2DPoint aLeftUp(0.0, fTopEdge);
const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft);
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false));
// right help line
const basegfx::B2DPoint aRightUp(fDistance, fTopEdge);
const basegfx::B2DPoint aRightDown(fDistance, fBottomRight);
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false));
// text horizontal position
if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal)
@@ -333,9 +337,9 @@ namespace drawinglayer
fTextX -= (fArrowsOutsideLen - fStartArrowH);
}
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX -= pTextAttribute->getTextRightDistance();
+ fTextX -= rTextAttribute.getTextRightDistance();
}
}
else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal)
@@ -349,9 +353,9 @@ namespace drawinglayer
fTextX += (fArrowsOutsideLen - fEndArrowH);
}
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX += pTextAttribute->getTextLeftDistance();
+ fTextX += rTextAttribute.getTextLeftDistance();
}
}
else // MEASURETEXTPOSITION_CENTERED
@@ -359,9 +363,9 @@ namespace drawinglayer
// centered
fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L;
+ fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L;
}
}
@@ -372,9 +376,9 @@ namespace drawinglayer
const double fSmall(fArrowsOutsideLen * 0.10);
fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY -= pTextAttribute->getTextLowerDistance();
+ fTextY -= rTextAttribute.getTextLowerDistance();
}
}
else if(MEASURETEXTPOSITION_POSITIVE == eVertical)
@@ -383,9 +387,9 @@ namespace drawinglayer
const double fSmall(fArrowsOutsideLen * 0.10);
fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY += pTextAttribute->getTextUpperDistance();
+ fTextY += rTextAttribute.getTextUpperDistance();
}
}
else // MEASURETEXTPOSITION_CENTERED
@@ -393,21 +397,19 @@ namespace drawinglayer
// centered
fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5);
- if(pTextAttribute)
+ if(!rTextAttribute.isDefault())
{
- fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L;
+ fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L;
}
}
}
- if(!getSdrLSTAttribute().getLine())
+ if(getSdrLSTAttribute().getLine().isDefault())
{
- // embed line geometry to invisible line group
- const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval));
- aRetval = Primitive2DSequence(&xHiddenLines, 1);
+ // embed line geometry to invisible (100% transparent) line group for HitTest
+ const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval));
- // delete temporary LineAttribute again
- delete pLineAttribute;
+ aRetval = Primitive2DSequence(&xHiddenLines, 1);
}
if(pBlockText)
@@ -437,9 +439,11 @@ namespace drawinglayer
}
// add shadow
- if(getSdrLSTAttribute().getShadow())
+ if(!getSdrLSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
index bf2df22fb2e6..cb9cb8bf3546 100644
--- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -34,7 +34,8 @@
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -84,23 +85,29 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// create unit outline polygon
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
// add fill
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getFill().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
// #i97981# condition was inverse to purpose. When being compatible to paint version,
// border needs to be suppressed
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getLine().isDefault())
{
// if line width is given, polygon needs to be grown by half of it to make the
// outline to be outside of the bitmap
- if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
{
// decompose to get scale
basegfx::B2DVector aScale, aTranslate;
@@ -108,27 +115,37 @@ namespace drawinglayer
getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
// create expanded range (add relative half line width to unit rectangle)
- double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
}
else
{
// if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline));
- const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1);
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
// add graphic content
@@ -136,15 +153,26 @@ namespace drawinglayer
// add text, no need to supress to stay compatible since text was
// always supported by the old paints, too
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow())
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
index d46ab7b4b14d..ea7ed0c808d1 100644
--- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -138,7 +138,7 @@ namespace drawinglayer
if(aColor.bIsVisible)
{
- basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
+ basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
const Color aVclColor(aColor.nColor);
aOutline.transform(getObjectTransform());
const drawinglayer::primitive2d::Primitive2DReference xOutline(
diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
index 39f3efc617f5..6b9da51e3b68 100644
--- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
@@ -35,7 +35,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -52,50 +52,67 @@ namespace drawinglayer
Primitive2DSequence aRetval;
// add fill
- if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed())
+ if(!getSdrLFSTAttribute().getFill().isDefault()
+ && getUnitPolyPolygon().isClosed())
{
// take care for orientations
- basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon()));
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient()));
+ const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(
+ basegfx::tools::correctOrientations(getUnitPolyPolygon()));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ aOrientedUnitPolyPolygon,
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(getSdrLFSTAttribute().getLine().isDefault())
{
- Primitive2DSequence aTemp(getUnitPolyPolygon().count());
-
- for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++)
- {
- aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd());
- }
-
- appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
+ // if initially no line is defined, create one for HitTest and BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ getUnitPolyPolygon(),
+ getTransform()));
}
else
{
- // if initially no line is defined, create one for HitTest and BoundRect
- const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0));
- Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count());
+ Primitive2DSequence aTemp(getUnitPolyPolygon().count());
for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
{
- xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline);
+ aTemp[a] = createPolygonLinePrimitive(
+ getUnitPolyPolygon().getB2DPolygon(a),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd());
}
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence)));
+ appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ getUnitPolyPolygon(),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;
diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
index 25b39ebb07d5..dd3c602266f7 100644
--- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
+++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
@@ -33,10 +33,6 @@
#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
#include <vcl/bmpacc.hxx>
#include <osl/mutex.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
#include <vcl/lazydelete.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -177,19 +173,6 @@ namespace drawinglayer
return aRetVal.get() ? *aRetVal.get() : BitmapEx();
}
- // #i99123#
- Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix)
- {
- // create PolygonHairlinePrimitive2D
- basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
- aUnitOutline.transform(rMatrix);
- const basegfx::BColor aBlack(0.0, 0.0, 0.0);
- const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack));
-
- // create HitTestPrimitive2D with it
- const Primitive2DSequence xSequence(&xReference, 1);
- return Primitive2DReference(new HitTestPrimitive2D(xSequence));
- }
} // end of namespace primitive2d
} // end of namespace drawinglayer
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
index 93ed597cb0a3..94da69bc7323 100644
--- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -35,7 +35,8 @@
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/hittestprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -50,7 +51,6 @@ namespace drawinglayer
Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
{
Primitive2DSequence aRetval;
- Primitive2DSequence aHitTestContent;
// create unit outline polygon
const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
@@ -59,64 +59,67 @@ namespace drawinglayer
getCornerRadiusY()));
// add fill
- if(getSdrLFSTAttribute().getFill())
+ if(!getSdrLFSTAttribute().getFill().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolyPolygonFillPrimitive(
basegfx::B2DPolyPolygon(aUnitOutline),
getTransform(),
- *getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFill(),
getSdrLFSTAttribute().getFillFloatTransGradient()));
}
else if(getForceFillForHitTest())
{
// if no fill and it's a text frame, create a fill for HitTest and
// BoundRect fallback
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
- createPolyPolygonFillPrimitive(
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ true,
basegfx::B2DPolyPolygon(aUnitOutline),
- getTransform(),
- attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)),
- getSdrLFSTAttribute().getFillFloatTransGradient()));
+ getTransform()));
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ if(!getSdrLFSTAttribute().getLine().isDefault())
{
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
createPolygonLinePrimitive(
aUnitOutline,
getTransform(),
- *getSdrLFSTAttribute().getLine()));
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
}
else if(!getForceFillForHitTest())
{
// if initially no line is defined and it's not a text frame, create
// a line for HitTest and BoundRect
- appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent,
- createPolygonLinePrimitive(
- aUnitOutline,
- getTransform(),
- attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0))));
- }
-
- // add HitTest and BoundRect helper geometry (if exists)
- if(aHitTestContent.hasElements())
- {
appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
- Primitive2DReference(new HitTestPrimitive2D(aHitTestContent)));
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
}
// add text
- if(getSdrLFSTAttribute().getText())
+ if(!getSdrLFSTAttribute().getText().isDefault())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
}
// add shadow
- if(getSdrLFSTAttribute().getShadow())
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
{
- aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow());
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
}
return aRetval;