summaryrefslogtreecommitdiff
path: root/svx/source/sdr/overlay
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr/overlay')
-rw-r--r--svx/source/sdr/overlay/makefile.mk17
-rw-r--r--svx/source/sdr/overlay/overlayanimatedbitmapex.cxx76
-rw-r--r--svx/source/sdr/overlay/overlaybitmap.cxx162
-rw-r--r--svx/source/sdr/overlay/overlaybitmapex.cxx50
-rw-r--r--svx/source/sdr/overlay/overlaycrosshair.cxx100
-rw-r--r--svx/source/sdr/overlay/overlayhatchrect.cxx88
-rw-r--r--svx/source/sdr/overlay/overlayhelpline.cxx189
-rw-r--r--svx/source/sdr/overlay/overlayline.cxx94
-rw-r--r--svx/source/sdr/overlay/overlaylinestriped.cxx47
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx300
-rw-r--r--svx/source/sdr/overlay/overlaymanagerbuffered.cxx55
-rw-r--r--svx/source/sdr/overlay/overlayobject.cxx221
-rw-r--r--svx/source/sdr/overlay/overlayobjectcell.cxx98
-rw-r--r--svx/source/sdr/overlay/overlayobjectlist.cxx95
-rw-r--r--svx/source/sdr/overlay/overlaypolypolygon.cxx93
-rw-r--r--svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx50
-rw-r--r--svx/source/sdr/overlay/overlayrollingrectangle.cxx229
-rw-r--r--svx/source/sdr/overlay/overlaysdrobject.cxx87
-rw-r--r--svx/source/sdr/overlay/overlayselection.cxx233
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx498
-rw-r--r--svx/source/sdr/overlay/overlaytriangle.cxx122
21 files changed, 1299 insertions, 1605 deletions
diff --git a/svx/source/sdr/overlay/makefile.mk b/svx/source/sdr/overlay/makefile.mk
index 1243a71e2585..d202992c090d 100644
--- a/svx/source/sdr/overlay/makefile.mk
+++ b/svx/source/sdr/overlay/makefile.mk
@@ -43,22 +43,21 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES=\
$(SLO)$/overlayanimatedbitmapex.obj \
- $(SLO)$/overlaybitmap.obj \
$(SLO)$/overlaybitmapex.obj \
+ $(SLO)$/overlaycrosshair.obj \
+ $(SLO)$/overlayhatchrect.obj \
+ $(SLO)$/overlayhelpline.obj \
$(SLO)$/overlayline.obj \
- $(SLO)$/overlaylinestriped.obj \
$(SLO)$/overlaymanager.obj \
$(SLO)$/overlaymanagerbuffered.obj \
$(SLO)$/overlayobject.obj \
+ $(SLO)$/overlayobjectcell.obj \
$(SLO)$/overlayobjectlist.obj \
- $(SLO)$/overlaytriangle.obj \
- $(SLO)$/overlaycrosshair.obj \
- $(SLO)$/overlayhelpline.obj \
- $(SLO)$/overlayhatchrect.obj \
- $(SLO)$/overlayrollingrectangle.obj \
$(SLO)$/overlaypolypolygon.obj \
- $(SLO)$/overlaysdrobject.obj \
$(SLO)$/overlayprimitive2dsequenceobject.obj \
- $(SLO)$/overlayobjectcell.obj
+ $(SLO)$/overlayrollingrectangle.obj \
+ $(SLO)$/overlayselection.obj \
+ $(SLO)$/overlaytools.obj \
+ $(SLO)$/overlaytriangle.obj
.INCLUDE : target.mk
diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
index 4781cc247e7e..dcfeb0ae3dc2 100644
--- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
+++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
@@ -34,9 +34,8 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
-
-// #i77674#
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -57,43 +56,30 @@ namespace sdr
}
}
- void OverlayAnimatedBitmapEx::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= (mbOverlayState)
- ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1)
- : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, (mbOverlayState) ? maBitmapEx1 : maBitmapEx2);
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayAnimatedBitmapEx::createBaseRange(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence()
{
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= (mbOverlayState)
- ? basegfx::B2DPoint((double)mnCenterX1, (double)mnCenterY1)
- : basegfx::B2DPoint((double)mnCenterX2, (double)mnCenterY2);
-
- // calculate discrete range
- const Size aBitmapPixelSize((mbOverlayState) ? maBitmapEx1.GetSizePixel() : maBitmapEx2.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ if(mbOverlayState)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx1(),
+ getBasePosition(),
+ getCenterX1(),
+ getCenterY1()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1);
+ }
+ else
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx2(),
+ getBasePosition(),
+ getCenterX2(),
+ getCenterY2()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1);
+ }
}
OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx(
@@ -111,10 +97,10 @@ namespace sdr
mnCenterX1(nCenX1), mnCenterY1(nCenY1),
mnCenterX2(nCenX2), mnCenterY2(nCenY2),
mnBlinkTime(nBlinkTime),
- mbOverlayState(sal_False)
+ mbOverlayState(false)
{
// set AllowsAnimation flag to mark this object as animation capable
- mbAllowsAnimation = sal_True;
+ mbAllowsAnimation = true;
// #i53216# check blink time value range
impCheckBlinkTimeValueRange();
@@ -213,11 +199,11 @@ namespace sdr
// switch state
if(mbOverlayState)
{
- mbOverlayState = sal_False;
+ mbOverlayState = false;
}
else
{
- mbOverlayState = sal_True;
+ mbOverlayState = true;
}
// re-insert me as event
@@ -227,12 +213,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayAnimatedBitmapEx::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaybitmap.cxx b/svx/source/sdr/overlay/overlaybitmap.cxx
deleted file mode 100644
index cc782d38bc7d..000000000000
--- a/svx/source/sdr/overlay/overlaybitmap.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: overlaybitmap.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlaybitmap.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/bitmapex.hxx>
-
-// #i77674#
-#include <basegfx/matrix/b2dhommatrix.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayBitmap::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
-
- if(mbUseTransparenceColor)
- {
- BitmapEx aBitmapEx(maBitmap, getBaseColor());
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, aBitmapEx);
- }
- else
- {
- rOutputDevice.DrawBitmap(aPixelTopLeft, maBitmap);
- }
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayBitmap::createBaseRange(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // calculate discrete range
- const Size aBitmapPixelSize(maBitmap.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
- }
-
- OverlayBitmap::OverlayBitmap(
- const basegfx::B2DPoint& rBasePos,
- const Bitmap& rBitmap,
- sal_uInt16 nCenX, sal_uInt16 nCenY,
- sal_Bool bUseTransCol,
- Color aTransColor)
- : OverlayObjectWithBasePosition(rBasePos, aTransColor),
- maBitmap(rBitmap),
- mnCenterX(nCenX),
- mnCenterY(nCenY),
- mbUseTransparenceColor(bUseTransCol)
- {
- }
-
- OverlayBitmap::~OverlayBitmap()
- {
- }
-
- void OverlayBitmap::setBitmap(const Bitmap& rNew)
- {
- if(rNew != maBitmap)
- {
- // remember new Bitmap
- maBitmap = rNew;
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::setTransparenceUsed(sal_Bool bNew)
- {
- if(bNew != mbUseTransparenceColor)
- {
- // remember new value
- mbUseTransparenceColor = bNew;
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY)
- {
- if(nNewX != mnCenterX || nNewY != mnCenterY)
- {
- // remember new values
- if(nNewX != mnCenterX)
- {
- mnCenterX = nNewX;
- }
-
- if(nNewY != mnCenterY)
- {
- mnCenterY = nNewY;
- }
-
- // register change (after change)
- objectChange();
- }
- }
-
- void OverlayBitmap::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx
index 9f0e183f420c..cd50c9149b27 100644
--- a/svx/source/sdr/overlay/overlaybitmapex.cxx
+++ b/svx/source/sdr/overlay/overlaybitmapex.cxx
@@ -33,9 +33,8 @@
#include <svx/sdr/overlay/overlaybitmapex.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
-
-// #i77674#
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -43,39 +42,16 @@ namespace sdr
{
namespace overlay
{
- void OverlayBitmapEx::drawGeometry(OutputDevice& rOutputDevice)
- {
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // remember MapMode and switch to pixels
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
- rOutputDevice.EnableMapMode(false);
-
- // draw the bitmap
- const Point aPixelTopLeft((sal_Int32)floor(aDiscreteTopLeft.getX()), (sal_Int32)floor(aDiscreteTopLeft.getY()));
- rOutputDevice.DrawBitmapEx(aPixelTopLeft, maBitmapEx);
-
- // restore MapMode
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayBitmapEx::createBaseRange(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence()
{
- // #i77674# calculate discrete top-left
- basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- aDiscreteTopLeft -= basegfx::B2DPoint((double)mnCenterX, (double)mnCenterY);
-
- // calculate discrete range
- const Size aBitmapPixelSize(maBitmapEx.GetSizePixel());
- const basegfx::B2DRange aDiscreteRange(
- aDiscreteTopLeft.getX(), aDiscreteTopLeft.getY(),
- aDiscreteTopLeft.getX() + (double)aBitmapPixelSize.getWidth(), aDiscreteTopLeft.getY() + (double)aBitmapPixelSize.getHeight());
-
- // set and go back to logic range
- maBaseRange = aDiscreteRange;
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx(),
+ getBasePosition(),
+ getCenterX(),
+ getCenterY()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
OverlayBitmapEx::OverlayBitmapEx(
@@ -124,12 +100,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayBitmapEx::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaycrosshair.cxx b/svx/source/sdr/overlay/overlaycrosshair.cxx
index 7107817fad04..90bd99bc289e 100644
--- a/svx/source/sdr/overlay/overlaycrosshair.cxx
+++ b/svx/source/sdr/overlay/overlaycrosshair.cxx
@@ -34,6 +34,8 @@
#include <tools/gen.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -41,31 +43,33 @@ namespace sdr
{
namespace overlay
{
- void OverlayCrosshairStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayCrosshairStriped::createOverlayObjectPrimitive2DSequence()
{
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- const basegfx::B2DPoint aStartA(aVisibleLogic.Left(), getBasePosition().getY());
- const basegfx::B2DPoint aEndA(aVisibleLogic.Right(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStartA, aEndA);
+ if(getOverlayManager())
+ {
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayCrosshairPrimitive(
+ getBasePosition(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
- const basegfx::B2DPoint aStartB(getBasePosition().getX(), aVisibleLogic.Top());
- const basegfx::B2DPoint aEndB(getBasePosition().getX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aStartB, aEndB);
+ return aRetval;
}
- void OverlayCrosshairStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayCrosshairStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- maBaseRange.reset();
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom()));
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayCrosshairStriped::OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos)
@@ -76,64 +80,6 @@ namespace sdr
OverlayCrosshairStriped::~OverlayCrosshairStriped()
{
}
-
- sal_Bool OverlayCrosshairStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- // test vertical
- if(rPos.getY() >= (getBasePosition().getY() - fTol)
- && rPos.getY() <= (getBasePosition().getY() + fTol))
- {
- return sal_True;
- }
-
- // test horizontal
- if(rPos.getX() >= (getBasePosition().getX() - fTol)
- && rPos.getX() <= (getBasePosition().getX() + fTol))
- {
- return sal_True;
- }
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayCrosshair::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y()));
- rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom()));
- }
-
- OverlayCrosshair::OverlayCrosshair(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor)
- : OverlayCrosshairStriped(rBasePos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayCrosshair::~OverlayCrosshair()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx
index a15d38f16bc9..9bda13816029 100644
--- a/svx/source/sdr/overlay/overlayhatchrect.cxx
+++ b/svx/source/sdr/overlay/overlayhatchrect.cxx
@@ -38,6 +38,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -45,81 +46,34 @@ namespace sdr
{
namespace overlay
{
- basegfx::B2DPolyPolygon OverlayHatchRect::getGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence()
{
- const basegfx::B2DPoint aDiscreteTopLeft(rOutputDevice.GetViewTransformation() * getBasePosition());
- const basegfx::B2DPoint aDiscreteBottomRight(rOutputDevice.GetViewTransformation() * getSecondPosition());
-
- basegfx::B2DRange aInnerRange(
- floor(aDiscreteTopLeft.getX()), floor(aDiscreteTopLeft.getY()),
- floor(aDiscreteBottomRight.getX()), floor(aDiscreteBottomRight.getY()));
- basegfx::B2DRange aOuterRange(aInnerRange);
- basegfx::B2DPolyPolygon aRetval;
-
- aOuterRange.grow(getDiscreteWidth() * 0.5);
- aInnerRange.grow(getDiscreteWidth() * -0.5);
-
- aRetval.append(basegfx::tools::createPolygonFromRect(aOuterRange));
- aRetval.append(basegfx::tools::createPolygonFromRect(aInnerRange));
-
- if(!basegfx::fTools::equalZero(mfRotation))
- {
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.translate(-aOuterRange.getMinX(), -aOuterRange.getMinY());
- aTransform.rotate(getRotation());
- aTransform.translate(aOuterRange.getMinX(), aOuterRange.getMinY());
-
- aRetval.transform(aTransform);
- }
-
- return aRetval;
- }
-
- void OverlayHatchRect::drawGeometry(OutputDevice& rOutputDevice)
- {
- const basegfx::B2DPolyPolygon aB2DGeometry(getGeometry(rOutputDevice));
- const bool bMapModeWasEnabled(rOutputDevice.IsMapModeEnabled());
-
- // use VCL polygon and methodology for paint
- double fFullRotation(getHatchRotation() - getRotation());
-
- while(fFullRotation < 0.0)
- {
- fFullRotation += F_2PI;
- }
-
- while(fFullRotation >= F_2PI)
- {
- fFullRotation -= F_2PI;
- }
-
- const Hatch aHatch(HATCH_SINGLE, getBaseColor(), 3, (sal_uInt16)basegfx::fround(fFullRotation * ( 10.0 / F_PI180)));
- rOutputDevice.EnableMapMode(false);
- rOutputDevice.DrawHatch(PolyPolygon(aB2DGeometry), aHatch);
- rOutputDevice.EnableMapMode(bMapModeWasEnabled);
- }
-
- void OverlayHatchRect::createBaseRange(OutputDevice& rOutputDevice)
- {
- // reset range and expand with fresh geometry
- maBaseRange = getGeometry(rOutputDevice).getB2DRange();
-
- // getGeometry data is in discrete coordinates (pixels), so transform back to
- // world coordinates (logic)
- maBaseRange.transform(rOutputDevice.GetInverseViewTransformation());
+ const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition());
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive(
+ aHatchRange,
+ 3.0,
+ getHatchRotation(),
+ getBaseColor().getBColor(),
+ getDiscreteGrow(),
+ getDiscreteShrink(),
+ getRotation()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
OverlayHatchRect::OverlayHatchRect(
const basegfx::B2DPoint& rBasePosition,
const basegfx::B2DPoint& rSecondPosition,
const Color& rHatchColor,
- double fDiscreteWidth,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
double fHatchRotation,
double fRotation)
: OverlayObjectWithBasePosition(rBasePosition, rHatchColor),
maSecondPosition(rSecondPosition),
- mfDiscreteWidth(fDiscreteWidth),
+ mfDiscreteGrow(fDiscreteGrow),
+ mfDiscreteShrink(fDiscreteShrink),
mfHatchRotation(fHatchRotation),
mfRotation(fRotation)
{
@@ -136,12 +90,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayHatchRect::zoomHasChanged()
- {
- // reset validity of range in logical coor to force recalculation
- mbIsChanged = sal_True;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayhelpline.cxx b/svx/source/sdr/overlay/overlayhelpline.cxx
index 5de8d071a292..12cb5ac660ba 100644
--- a/svx/source/sdr/overlay/overlayhelpline.cxx
+++ b/svx/source/sdr/overlay/overlayhelpline.cxx
@@ -35,6 +35,8 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <basegfx/vector/b2dvector.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,79 +44,38 @@ namespace sdr
{
namespace overlay
{
- void OverlayHelplineStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHelplineStriped::createOverlayObjectPrimitive2DSequence()
{
- // prepare OutputDevice
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- switch(meKind)
+ if(getOverlayManager())
{
- case SDRHELPLINE_VERTICAL :
- {
- const basegfx::B2DPoint aStart(getBasePosition().getX(), aVisibleLogic.Top());
- const basegfx::B2DPoint aEnd(getBasePosition().getX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aStart, aEnd);
- break;
- }
-
- case SDRHELPLINE_HORIZONTAL :
- {
- const basegfx::B2DPoint aStart(aVisibleLogic.Left(), getBasePosition().getY());
- const basegfx::B2DPoint aEnd(aVisibleLogic.Right(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStart, aEnd);
- break;
- }
-
- case SDRHELPLINE_POINT :
- {
- const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- const basegfx::B2DPoint aStartA(getBasePosition().getX(), getBasePosition().getY() - aLogicSize.Height());
- const basegfx::B2DPoint aEndA(getBasePosition().getX(), getBasePosition().getY() + aLogicSize.Height());
- ImpDrawLineStriped(rOutputDevice, aStartA, aEndA);
-
- const basegfx::B2DPoint aStartB(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY());
- const basegfx::B2DPoint aEndB(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY());
- ImpDrawLineStriped(rOutputDevice, aStartB, aEndB);
-
- break;
- }
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ const drawinglayer::primitive2d::HelplineStyle aStyle(
+ SDRHELPLINE_POINT == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_POINT :
+ SDRHELPLINE_VERTICAL == getKind() ? drawinglayer::primitive2d::HELPLINESTYLE_VERTICAL :
+ drawinglayer::primitive2d::HELPLINESTYLE_HORIZONTAL);
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayHelplineStripedPrimitive(
+ getBasePosition(),
+ aStyle,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
+
+ return aRetval;
}
- void OverlayHelplineStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayHelplineStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
-
- if(SDRHELPLINE_POINT == meKind)
- {
- const Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- const Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() - aLogicSize.Width(), getBasePosition().getY() - aLogicSize.Height()));
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX() + aLogicSize.Width(), getBasePosition().getY() + aLogicSize.Height()));
- }
- else
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), getBasePosition().getY()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), getBasePosition().getY()));
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(getBasePosition().getX(), aVisibleLogic.Bottom()));
- }
- }
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayHelplineStriped::OverlayHelplineStriped(
@@ -128,102 +89,6 @@ namespace sdr
OverlayHelplineStriped::~OverlayHelplineStriped()
{
}
-
- sal_Bool OverlayHelplineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- if(SDRHELPLINE_POINT == meKind)
- {
- // use distance to BasePosition
- const basegfx::B2DVector aVector(rPos - getBasePosition());
-
- return (aVector.getLength() < fTol);
- }
- else
- {
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- // test vertical
- if(rPos.getY() >= (getBasePosition().getY() - fTol)
- && rPos.getY() <= (getBasePosition().getY() + fTol))
- {
- return sal_True;
- }
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- // test horizontal
- if(rPos.getX() >= (getBasePosition().getX() - fTol)
- && rPos.getX() <= (getBasePosition().getX() + fTol))
- {
- return sal_True;
- }
- }
- }
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayHelpline::drawGeometry(OutputDevice& rOutputDevice)
- {
- Point aBasePos(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- if(SDRHELPLINE_POINT == meKind)
- {
- Size aPixelSize(SDRHELPLINE_POINT_PIXELSIZE, SDRHELPLINE_POINT_PIXELSIZE);
- Size aLogicSize(rOutputDevice.PixelToLogic(aPixelSize));
-
- rOutputDevice.DrawLine(
- Point(aBasePos.X() - aLogicSize.Width(), aBasePos.Y()),
- Point(aBasePos.X() + aLogicSize.Width(), aBasePos.Y()));
- rOutputDevice.DrawLine(
- Point(aBasePos.X(), aBasePos.Y() - aLogicSize.Height()),
- Point(aBasePos.X(), aBasePos.Y() + aLogicSize.Height()));
- }
- else
- {
- Point aEmptyPoint;
- Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- if(SDRHELPLINE_HORIZONTAL == meKind)
- {
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aBasePos.Y()), Point(aVisibleLogic.Right(), aBasePos.Y()));
- }
- else if(SDRHELPLINE_VERTICAL == meKind)
- {
- rOutputDevice.DrawLine(Point(aBasePos.X(), aVisibleLogic.Top()), Point(aBasePos.X(), aVisibleLogic.Bottom()));
- }
- }
- }
-
- OverlayHelpline::OverlayHelpline(
- const basegfx::B2DPoint& rBasePos,
- Color aLineColor,
- SdrHelpLineKind eNewKind)
- : OverlayHelplineStriped(rBasePos, eNewKind)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayHelpline::~OverlayHelpline()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayline.cxx b/svx/source/sdr/overlay/overlayline.cxx
index 003da41ee31d..90ecb869f4f6 100644
--- a/svx/source/sdr/overlay/overlayline.cxx
+++ b/svx/source/sdr/overlay/overlayline.cxx
@@ -37,6 +37,9 @@
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,17 +47,37 @@ namespace sdr
{
namespace overlay
{
- void OverlayLineStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayLineStriped::createOverlayObjectPrimitive2DSequence()
{
- ImpDrawLineStriped(rOutputDevice, getBasePosition(), getSecondPosition());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(getOverlayManager())
+ {
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(getBasePosition());
+ aLine.append(getSecondPosition());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
+ aLine,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ return aRetval;
}
- void OverlayLineStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
+ void OverlayLineStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayLineStriped::OverlayLineStriped(
@@ -80,63 +103,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayLineStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable() && !getBasePosition().equal(getSecondPosition()))
- {
- return basegfx::tools::isInEpsilonRange(getBasePosition(), getSecondPosition(), rPos, fTol);
- }
-
- return sal_False;
- }
-
- void OverlayLineStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayLine::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY()));
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawLine(aStart, aEnd);
- }
-
- OverlayLine::OverlayLine(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor)
- : OverlayLineStriped(rBasePos, rSecondPos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayLine::~OverlayLine()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaylinestriped.cxx b/svx/source/sdr/overlay/overlaylinestriped.cxx
deleted file mode 100644
index c00be65908e2..000000000000
--- a/svx/source/sdr/overlay/overlaylinestriped.cxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: overlaylinestriped.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlaylinestriped.hxx>
-#include <tools/gen.hxx>
-#include <vcl/outdev.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 8c682adfc166..79d493b6d9d0 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -50,33 +50,49 @@ namespace sdr
{
void OverlayManager::ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const
{
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
+ const sal_uInt32 nSize(maOverlayObjects.size());
- if(pCurrent)
+ if(nSize)
{
const sal_uInt16 nOriginalAA(rDestinationDevice.GetAntialiasing());
+ const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing());
- // react on AntiAliasing settings
- if(maDrawinglayerOpt.IsAntiAliasing())
- {
- rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
- }
- else
- {
- rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW);
- }
+ // create processor
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
+ rDestinationDevice,
+ getCurrentViewInformation2D());
- while(pCurrent)
+ if(pProcessor)
{
- if(pCurrent->isVisible())
+ for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
{
- if(rRange.overlaps(pCurrent->getBaseRange()))
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ const OverlayObject& rCandidate = **aIter;
+
+ if(rCandidate.isVisible())
{
- pCurrent->drawGeometry(rDestinationDevice);
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
+ {
+ if(rRange.overlaps(rCandidate.getBaseRange()))
+ {
+ if(bIsAntiAliasing && rCandidate.allowsAntiAliase())
+ {
+ rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
+ }
+ else
+ {
+ rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW);
+ }
+
+ pProcessor->process(rSequence);
+ }
+ }
}
}
- pCurrent = pCurrent->mpNext;
+ delete pProcessor;
}
// restore AA settings
@@ -84,87 +100,162 @@ namespace sdr
}
}
- void OverlayManager::ImpCheckMapModeChange() const
+ void OverlayManager::ImpStripeDefinitionChanged()
{
- sal_Bool bZoomHasChanged(sal_False);
- MapMode aOutputDeviceMapMode(getOutputDevice().GetMapMode());
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
+ const sal_uInt32 nSize(maOverlayObjects.size());
- if(maMapMode != aOutputDeviceMapMode)
+ if(nSize)
{
- bZoomHasChanged = (
- maMapMode.GetScaleX() != aOutputDeviceMapMode.GetScaleX()
- || maMapMode.GetScaleY() != aOutputDeviceMapMode.GetScaleY());
-
- // remember MapMode
- ((OverlayManager*)this)->maMapMode = aOutputDeviceMapMode;
- }
-
- if(bZoomHasChanged && pCurrent)
- {
- while(pCurrent)
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
{
- pCurrent->zoomHasChanged();
- pCurrent = pCurrent->mpNext;
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+ rCandidate.stripeDefinitionHasChanged();
}
}
}
- void OverlayManager::ImpStripeDefinitionChanged()
- {
- ::sdr::overlay::OverlayObject* pCurrent = mpOverlayObjectStart;
-
- while(pCurrent)
- {
- pCurrent->stripeDefinitionHasChanged();
- pCurrent = pCurrent->mpNext;
- }
- }
-
double OverlayManager::getDiscreteOne() const
{
- if(getOutputDevice().GetViewTransformation() != maViewTransformation)
+ if(basegfx::fTools::equalZero(mfDiscreteOne))
{
- OverlayManager* pThis = const_cast< OverlayManager* >(this);
- pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
const basegfx::B2DVector aDiscreteInLogic(getOutputDevice().GetInverseViewTransformation() * basegfx::B2DVector(1.0, 0.0));
- pThis->mfDiscreteOne = aDiscreteInLogic.getLength();
+ const_cast< OverlayManager* >(this)->mfDiscreteOne = aDiscreteInLogic.getLength();
}
return mfDiscreteOne;
}
- OverlayManager::OverlayManager(OutputDevice& rOutputDevice)
+ OverlayManager::OverlayManager(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager)
: Scheduler(),
rmOutputDevice(rOutputDevice),
- mpOverlayObjectStart(0L),
- mpOverlayObjectEnd(0L),
+ maOverlayObjects(),
maStripeColorA(Color(COL_BLACK)),
maStripeColorB(Color(COL_WHITE)),
- mnStripeLengthPixel(5L),
+ mnStripeLengthPixel(5),
maDrawinglayerOpt(),
maViewTransformation(),
+ maViewInformation2D(0),
mfDiscreteOne(0.0)
{
+ if(pOldOverlayManager)
+ {
+ // take over OverlayObjects from given OverlayManager. Copy
+ // the vector of pointers
+ maOverlayObjects = pOldOverlayManager->maOverlayObjects;
+ const sal_uInt32 nSize(maOverlayObjects.size());
+
+ if(nSize)
+ {
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
+ {
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+
+ // remove from old and add to new OverlayManager
+ pOldOverlayManager->impApplyRemoveActions(rCandidate);
+ impApplyAddActions(rCandidate);
+ }
+
+ pOldOverlayManager->maOverlayObjects.clear();
+ }
+ }
+ }
+
+ const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const
+ {
+ if(getOutputDevice().GetViewTransformation() != maViewTransformation)
+ {
+ basegfx::B2DRange aViewRange(maViewInformation2D.getViewport());
+
+ if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
+ {
+ const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel());
+ aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+ aViewRange.transform(getOutputDevice().GetInverseViewTransformation());
+ }
+
+ OverlayManager* pThis = const_cast< OverlayManager* >(this);
+
+ pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
+ pThis->maViewInformation2D = drawinglayer::geometry::ViewInformation2D(
+ maViewInformation2D.getObjectTransformation(),
+ maViewTransformation,
+ aViewRange,
+ maViewInformation2D.getVisualizedPage(),
+ maViewInformation2D.getViewTime(),
+ maViewInformation2D.getExtendedInformationSequence());
+ pThis->mfDiscreteOne = 0.0;
+ }
+
+ return maViewInformation2D;
+ }
+
+ void OverlayManager::impApplyRemoveActions(OverlayObject& rTarget)
+ {
+ // handle evtl. animation
+ if(rTarget.allowsAnimation())
+ {
+ // remove from event chain
+ RemoveEvent(&rTarget);
+ }
+
+ // make invisible
+ invalidateRange(rTarget.getBaseRange());
+
+ // clear manager
+ rTarget.mpOverlayManager = 0;
+ }
+
+ void OverlayManager::impApplyAddActions(OverlayObject& rTarget)
+ {
+ // set manager
+ rTarget.mpOverlayManager = this;
+
+ // make visible
+ invalidateRange(rTarget.getBaseRange());
+
+ // handle evtl. animation
+ if(rTarget.allowsAnimation())
+ {
+ // Trigger at current time to get alive. This will do the
+ // object-specific next time calculation and hand over adding
+ // again to the scheduler to the animated object, too. This works for
+ // a paused or non-paused animator.
+ rTarget.Trigger(GetTime());
+ }
}
OverlayManager::~OverlayManager()
{
- // the OverlayManager is not the owner of the OverlayObjects
- // and thus will not delete them, but remove them.
- while(mpOverlayObjectStart)
+ // The OverlayManager is not the owner of the OverlayObjects
+ // and thus will not delete them, but remove them. Profit here
+ // from knowing that all will be removed
+ const sal_uInt32 nSize(maOverlayObjects.size());
+
+ if(nSize)
{
- remove(*mpOverlayObjectStart);
+ for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
+ {
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ OverlayObject& rCandidate = **aIter;
+ impApplyRemoveActions(rCandidate);
+ }
+
+ // erase vector
+ maOverlayObjects.clear();
}
}
void OverlayManager::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
{
- if(!rRegion.IsEmpty() && mpOverlayObjectStart)
+ if(!rRegion.IsEmpty() && maOverlayObjects.size())
{
// check for changed MapModes. That may influence the
// logical size of pixel based OverlayObjects (like BitmapHandles)
- ImpCheckMapModeChange();
+ //ImpCheckMapModeChange();
// paint members
const Rectangle aRegionBoundRect(rRegion.GetBoundRect());
@@ -195,87 +286,38 @@ namespace sdr
void OverlayManager::add(OverlayObject& rOverlayObject)
{
- // add to the end of chain to preserve display order in paint
- DBG_ASSERT(0L == rOverlayObject.mpOverlayManager,
- "OverlayManager::add: OverlayObject is added to an OverlayManager (!)");
-
- if(mpOverlayObjectEnd)
- {
- // new element, add to end
- rOverlayObject.mpNext = mpOverlayObjectEnd->mpNext;
- rOverlayObject.mpPrevious = mpOverlayObjectEnd;
- mpOverlayObjectEnd->mpNext = &rOverlayObject;
- mpOverlayObjectEnd = &rOverlayObject;
- }
- else
- {
- // first element
- rOverlayObject.mpNext = rOverlayObject.mpPrevious = 0L;
- mpOverlayObjectEnd = mpOverlayObjectStart = &rOverlayObject;
- }
-
- // set manager
- rOverlayObject.mpOverlayManager = this;
+ OSL_ENSURE(0 == rOverlayObject.mpOverlayManager, "OverlayObject is added twice to an OverlayManager (!)");
- // make visible
- invalidateRange(rOverlayObject.getBaseRange());
+ // add to the end of chain to preserve display order in paint
+ maOverlayObjects.push_back(&rOverlayObject);
- // handle evtl. animation
- if(rOverlayObject.allowsAnimation())
- {
- // Trigger at current time to get alive. This will do the
- // object-specific next time calculation and hand over adding
- // again to the scheduler to the animated object, too. This works for
- // a paused or non-paused animator.
- rOverlayObject.Trigger(GetTime());
- }
+ // execute add actions
+ impApplyAddActions(rOverlayObject);
}
void OverlayManager::remove(OverlayObject& rOverlayObject)
{
- // handle evtl. animation
- if(rOverlayObject.allowsAnimation())
- {
- // remove from event chain
- RemoveEvent(&rOverlayObject);
- }
+ OSL_ENSURE(rOverlayObject.mpOverlayManager == this, "OverlayObject is removed from wrong OverlayManager (!)");
- // Remove from chain
- DBG_ASSERT(rOverlayObject.mpOverlayManager == this,
- "OverlayManager::remove: OverlayObject is removed from wrong OverlayManager (!)");
+ // execute remove actions
+ impApplyRemoveActions(rOverlayObject);
- if(rOverlayObject.mpPrevious)
- {
- rOverlayObject.mpPrevious->mpNext = rOverlayObject.mpNext;
- }
+ // remove from vector
+ const OverlayObjectVector::iterator aFindResult = ::std::find(maOverlayObjects.begin(), maOverlayObjects.end(), &rOverlayObject);
+ const bool bFound(aFindResult != maOverlayObjects.end());
+ OSL_ENSURE(bFound, "OverlayObject NOT found at OverlayManager (!)");
- if(rOverlayObject.mpNext)
+ if(bFound)
{
- rOverlayObject.mpNext->mpPrevious = rOverlayObject.mpPrevious;
+ maOverlayObjects.erase(aFindResult);
}
-
- if(&rOverlayObject == mpOverlayObjectStart)
- {
- mpOverlayObjectStart = rOverlayObject.mpNext;
- }
-
- if(&rOverlayObject == mpOverlayObjectEnd)
- {
- mpOverlayObjectEnd = rOverlayObject.mpPrevious;
- }
-
- // make invisible
- invalidateRange(rOverlayObject.getBaseRange());
-
- // clear manager
- rOverlayObject.mpOverlayManager = 0L;
}
void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange)
{
if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
{
- if(maDrawinglayerOpt.IsAntiAliasing())
+ if(getDrawinglayerOpt().IsAntiAliasing())
{
// assume AA needs one pixel more and invalidate one pixel more
const double fDiscreteOne(getDiscreteOne());
@@ -331,18 +373,6 @@ namespace sdr
ImpStripeDefinitionChanged();
}
}
-
- ::boost::shared_ptr<OverlayObjectVector> OverlayManager::GetOverlayObjects (void) const
- {
- ::boost::shared_ptr<OverlayObjectVector> pObjectList (new OverlayObjectVector());
- sdr::overlay::OverlayObject* pObject = mpOverlayObjectStart;
- while (pObject != NULL)
- {
- pObjectList->push_back(pObject);
- pObject = pObject->mpNext;
- }
- return pObjectList;
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 584faedcdda2..2b664e816d42 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -36,12 +36,8 @@
#include <basegfx/range/b2drange.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/window.hxx>
-
-// #i72754#
#include <vcl/bitmap.hxx>
#include <tools/stream.hxx>
-
-// #i75163#
#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -63,7 +59,7 @@ namespace sdr
// compare the MapModes for zoom/scroll changes
if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
{
- const sal_Bool bZoomed(
+ const bool bZoomed(
maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
|| maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
@@ -71,7 +67,7 @@ namespace sdr
{
const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
- const sal_Bool bScrolled(rOriginOld != rOriginNew);
+ const bool bScrolled(rOriginOld != rOriginNew);
if(bScrolled)
{
@@ -81,8 +77,8 @@ namespace sdr
const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
// remember and switch off MapMode
- const sal_Bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
// scroll internally buffered stuff
const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
@@ -132,10 +128,10 @@ namespace sdr
Rectangle aRegionRectanglePixel;
// MapModes off
- const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
- const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
- getOutputDevice().EnableMapMode(sal_False);
- ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
+ ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false);
while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
{
@@ -200,10 +196,10 @@ namespace sdr
Rectangle aRegionRectanglePixel;
// MapModes off
- const sal_Bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
- const sal_Bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
- rSource.EnableMapMode(sal_False);
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ rSource.EnableMapMode(false);
+ maBufferDevice.EnableMapMode(false);
while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
{
@@ -221,7 +217,7 @@ namespace sdr
static bool bDoPaintForVisualControl(false);
if(bDoPaintForVisualControl)
{
- const sal_Bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
+ const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
getOutputDevice().EnableMapMode(false);
getOutputDevice().SetLineColor(COL_LIGHTRED);
getOutputDevice().SetFillColor();
@@ -282,7 +278,7 @@ namespace sdr
}
maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
- maOutputBufferDevice.EnableMapMode(sal_False);
+ maOutputBufferDevice.EnableMapMode(false);
maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
@@ -320,8 +316,8 @@ namespace sdr
const Size aSize(aRegionRectanglePixel.GetSize());
{
- const sal_Bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
- maBufferDevice.EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
maOutputBufferDevice.DrawOutDev(
aTopLeft, aSize, // destination
@@ -334,14 +330,14 @@ namespace sdr
// paint overlay content for remembered region, use
// method from base class directly
- maOutputBufferDevice.EnableMapMode(sal_True);
+ maOutputBufferDevice.EnableMapMode(true);
OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
- maOutputBufferDevice.EnableMapMode(sal_False);
+ maOutputBufferDevice.EnableMapMode(false);
// copy to output
{
- const sal_Bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
- getOutputDevice().EnableMapMode(sal_False);
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
getOutputDevice().DrawOutDev(
aTopLeft, aSize, // destination
@@ -417,8 +413,11 @@ namespace sdr
return 0;
}
- OverlayManagerBuffered::OverlayManagerBuffered(OutputDevice& rOutputDevice, sal_Bool bRefreshWithPreRendering)
- : OverlayManager(rOutputDevice),
+ OverlayManagerBuffered::OverlayManagerBuffered(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager,
+ bool bRefreshWithPreRendering)
+ : OverlayManager(rOutputDevice, pOldOverlayManager),
mbRefreshWithPreRendering(bRefreshWithPreRendering)
{
// Init timer
@@ -515,9 +514,9 @@ namespace sdr
}
}
- void OverlayManagerBuffered::SetRefreshWithPreRendering(sal_Bool bNew)
+ void OverlayManagerBuffered::SetRefreshWithPreRendering(bool bNew)
{
- if(mbRefreshWithPreRendering != bNew)
+ if((bool)mbRefreshWithPreRendering != bNew)
{
mbRefreshWithPreRendering = bNew;
}
diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx
index 658b6719709e..5cddc3c63627 100644
--- a/svx/source/sdr/overlay/overlayobject.cxx
+++ b/svx/source/sdr/overlay/overlayobject.cxx
@@ -43,7 +43,6 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/sdr/contact/objectcontacttools.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/processor2d/baseprocessor2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -53,206 +52,94 @@ namespace sdr
{
void OverlayObject::objectChange()
{
- if(mpOverlayManager)
- {
- basegfx::B2DRange aPreviousRange(maBaseRange);
-
- if(!aPreviousRange.isEmpty())
- {
- mpOverlayManager->invalidateRange(aPreviousRange);
- }
-
- mbIsChanged = sal_True;
- const basegfx::B2DRange& rCurrentRange = getBaseRange();
-
- if(rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty())
- {
- mpOverlayManager->invalidateRange(rCurrentRange);
- }
- }
- }
+ const basegfx::B2DRange aPreviousRange(maBaseRange);
+ maBaseRange.reset();
+ setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence());
- // support method to draw striped geometries
- void OverlayObject::ImpDrawRangeStriped(OutputDevice& rOutputDevice, const basegfx::B2DRange& rRange)
- {
- if(getOverlayManager())
+ if(getOverlayManager() && !aPreviousRange.isEmpty())
{
- const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
-
- if(aPolygon.count())
- {
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ getOverlayManager()->invalidateRange(aPreviousRange);
}
- }
- void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, double x1, double y1, double x2, double y2)
- {
- if(getOverlayManager())
- {
- const basegfx::B2DPoint aStart(x1, y1);
- const basegfx::B2DPoint aEnd(x2, y2);
+ const basegfx::B2DRange& rCurrentRange = getBaseRange();
- if(!aStart.equal(aEnd))
- {
- basegfx::B2DPolygon aPolygon;
- aPolygon.append(aStart);
- aPolygon.append(aEnd);
-
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ if(getOverlayManager() && rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty())
+ {
+ getOverlayManager()->invalidateRange(rCurrentRange);
}
}
- void OverlayObject::ImpDrawLineStriped(OutputDevice& rOutputDevice, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd)
+ // OverlayObject implementations.
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObject::createOverlayObjectPrimitive2DSequence()
{
- if(getOverlayManager() && !rStart.equal(rEnd))
- {
- basegfx::B2DPolygon aPolygon;
- aPolygon.append(rStart);
- aPolygon.append(rEnd);
-
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ // Default implementation has to assert a missing implementation. It cannot
+ // be useful to have overlay object derivations which have no visualisation
+ // at all
+ OSL_ENSURE(false, "OverlayObject derivation without visualisation definition (missing createOverlayObjectPrimitive2DSequence implementation) (!)");
+ return drawinglayer::primitive2d::Primitive2DSequence();
}
- void OverlayObject::ImpDrawPolygonStriped(OutputDevice& rOutputDevice, const basegfx::B2DPolygon& rPolygon)
+ void OverlayObject::allowAntiAliase(bool bNew)
{
- if(getOverlayManager() && rPolygon.count())
+ if(bNew != (bool)mbAllowsAntiAliase)
{
- if(getOverlayManager() && getOverlayManager()->getDrawinglayerOpt().IsAntiAliasing())
- {
- // prepare ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- // create processor
- drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
- rOutputDevice,
- aViewInformation2D);
-
- if(pProcessor)
- {
- // prepare primitives
- const drawinglayer::primitive2d::Primitive2DReference aPolygonMarkerPrimitive2D(
- new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
- rPolygon,
- getOverlayManager()->getStripeColorA().getBColor(),
- getOverlayManager()->getStripeColorB().getBColor(),
- getOverlayManager()->getStripeLengthPixel()));
- const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aPolygonMarkerPrimitive2D, 1);
-
- pProcessor->process(aSequence);
-
- delete pProcessor;
- }
- }
- else
- {
- const sal_uInt32 nLenPixel(getOverlayManager()->getStripeLengthPixel());
- const Size aDashSizePixel(nLenPixel, nLenPixel);
- const Size aDashSizeLogic(rOutputDevice.PixelToLogic(aDashSizePixel));
- const double fDashLength(aDashSizeLogic.Width());
- const double fFullDotDashLength(fDashLength + fDashLength);
-
- // fill DashDot vector
- ::std::vector<double> aDotDashArray;
- aDotDashArray.push_back(fDashLength);
- aDotDashArray.push_back(fDashLength);
-
- // get dash polygons
- basegfx::B2DPolyPolygon aStripesA;
- basegfx::B2DPolyPolygon aStripesB;
- basegfx::tools::applyLineDashing(rPolygon, aDotDashArray, &aStripesA, &aStripesB, fFullDotDashLength);
-
- // draw stripes A
- if(aStripesA.count())
- {
- rOutputDevice.SetFillColor();
- rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorA());
-
- for(sal_uInt32 a(0L); a < aStripesA.count();a ++)
- {
- rOutputDevice.DrawPolyLine(aStripesA.getB2DPolygon(a));
- }
- }
-
- // draw stripes B
- if(aStripesB.count())
- {
- rOutputDevice.SetFillColor();
- rOutputDevice.SetLineColor(getOverlayManager()->getStripeColorB());
+ // remember new value
+ mbAllowsAntiAliase = bNew;
- for(sal_uInt32 a(0L); a < aStripesB.count();a ++)
- {
- rOutputDevice.DrawPolyLine(aStripesB.getB2DPolygon(a));
- }
- }
- }
+ // register change (after change)
+ objectChange();
}
}
OverlayObject::OverlayObject(Color aBaseColor)
- : Event(0L),
- mpOverlayManager(0L),
- mpNext(0L),
- mpPrevious(0L),
+ : Event(0),
+ mpOverlayManager(0),
maBaseColor(aBaseColor),
- mbIsVisible(sal_True),
- mbIsChanged(sal_True),
- mbIsHittable(sal_True),
- mbAllowsAnimation(sal_False)
+ mbIsVisible(true),
+ mbIsHittable(true),
+ mbAllowsAnimation(false),
+ mbAllowsAntiAliase(true)
{
}
OverlayObject::~OverlayObject()
{
- DBG_ASSERT(0L == mpOverlayManager,
- "OverlayObject is destructed which is still registered at OverlayManager (!)");
+ OSL_ENSURE(0 == getOverlayManager(), "OverlayObject is destructed which is still registered at OverlayManager (!)");
}
- sal_Bool OverlayObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObject::getOverlayObjectPrimitive2DSequence() const
{
- if(isHittable())
+ if(!getPrimitive2DSequence().hasElements())
{
- if(0.0 != fTol)
- {
- basegfx::B2DRange aRange(getBaseRange());
- aRange.grow(fTol);
- return aRange.isInside(rPos);
- }
- else
- {
- return getBaseRange().isInside(rPos);
- }
+ // no existing sequence; create one
+ const_cast< OverlayObject* >(this)->setPrimitive2DSequence(
+ const_cast< OverlayObject* >(this)->createOverlayObjectPrimitive2DSequence());
}
- return sal_False;
+ return getPrimitive2DSequence();
}
const basegfx::B2DRange& OverlayObject::getBaseRange() const
{
- if(mbIsChanged)
+ if(getOverlayManager() && maBaseRange.isEmpty())
{
- if(mpOverlayManager)
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
{
- ((::sdr::overlay::OverlayObject*)this)->createBaseRange(mpOverlayManager->getOutputDevice());
- }
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(getOverlayManager()->getCurrentViewInformation2D());
- ((::sdr::overlay::OverlayObject*)this)->mbIsChanged = sal_False;
+ const_cast< sdr::overlay::OverlayObject* >(this)->maBaseRange =
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(rSequence, aViewInformation2D);
+ }
}
return maBaseRange;
}
- void OverlayObject::setVisible(sal_Bool bNew)
+ void OverlayObject::setVisible(bool bNew)
{
- if(bNew != mbIsVisible)
+ if(bNew != (bool)mbIsVisible)
{
// remember new value
mbIsVisible = bNew;
@@ -262,9 +149,9 @@ namespace sdr
}
}
- void OverlayObject::setHittable(sal_Bool bNew)
+ void OverlayObject::setHittable(bool bNew)
{
- if(bNew != mbIsHittable)
+ if(bNew != (bool)mbIsHittable)
{
// remember new value
mbIsHittable = bNew;
@@ -291,11 +178,6 @@ namespace sdr
// default does not register again
}
- void OverlayObject::zoomHasChanged()
- {
- // default does not need to do anything
- }
-
void OverlayObject::stripeDefinitionHasChanged()
{
// default does not need to do anything
@@ -330,15 +212,6 @@ namespace sdr
objectChange();
}
}
-
- void OverlayObjectWithBasePosition::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- basegfx::B2DPoint aNewBasePosition = rMatrix * getBasePosition();
- setBasePosition(aNewBasePosition);
- }
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx
index 25d2dbbdd31b..5df0fc85f8f9 100644
--- a/svx/source/sdr/overlay/overlayobjectcell.cxx
+++ b/svx/source/sdr/overlay/overlayobjectcell.cxx
@@ -35,6 +35,11 @@
#include <vcl/outdev.hxx>
#include <vcl/hatch.hxx>
#include <svx/sdr/overlay/overlayobjectcell.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
using namespace ::basegfx;
@@ -48,83 +53,60 @@ namespace sdr
mePaintType( eType ),
maRectangles( rRects )
{
+ // no AA for selection overlays
+ allowAntiAliase(false);
}
OverlayObjectCell::~OverlayObjectCell()
{
}
- void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
{
- // set colors
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(maRectangles.size());
- if ( mePaintType == CELL_OVERLAY_INVERT )
+ if(nCount)
{
- rOutputDevice.Push();
- rOutputDevice.SetRasterOp( ROP_XOR );
- rOutputDevice.SetFillColor( COL_WHITE );
- }
-
- for(sal_uInt32 a(0L);a < maRectangles.size(); a++)
- {
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const Rectangle aRectangle(fround(rRange.getMinX()), fround(rRange.getMinY()), fround(rRange.getMaxX()), fround(rRange.getMaxY()));
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ aRetval.realloc(nCount);
- switch(mePaintType)
+ // create primitives for all ranges
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- case CELL_OVERLAY_INVERT :
- {
- rOutputDevice.DrawRect( aRectangle );
+ const basegfx::B2DRange& rRange(maRectangles[a]);
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
- // if(OUTDEV_WINDOW == rOutputDevice.GetOutDevType())
- // {
- // ((Window&)rOutputDevice).Invert(aRectangle, INVERT_HIGHLIGHT);
- // }
-
- break;
- }
- case CELL_OVERLAY_HATCH :
- {
- rOutputDevice.DrawHatch(PolyPolygon(Polygon(aRectangle)), Hatch(HATCH_SINGLE, getBaseColor(), 2, 450));
- break;
- }
- case CELL_OVERLAY_TRANSPARENT :
- {
- rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 50);
- break;
- }
- case CELL_OVERLAY_LIGHT_TRANSPARENT :
- {
- rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 80);
- break;
- }
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
}
- }
- if ( mePaintType == CELL_OVERLAY_INVERT )
- rOutputDevice.Pop();
- }
- void OverlayObjectCell::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- maBaseRange.reset();
+ if(mePaintType == CELL_OVERLAY_TRANSPARENT)
+ {
+ // embed in 50% transparent paint
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aRetval,
+ 0.5));
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maBaseRange.expand(maRectangles[a]);
- }
- }
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1);
+ }
+ else // CELL_OVERLAY_INVERT
+ {
+ // embed in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
- void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maRectangles[a].transform(rMatrix);
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
+ }
}
- }
+ return aRetval;
+ }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
index 3c9107d94bfe..370b6d66c225 100644
--- a/svx/source/sdr/overlay/overlayobjectlist.cxx
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -40,6 +40,8 @@
// get access to basic algos like ::std::find
#include <algorithm>
+#include <drawinglayer/processor2d/hittestprocessor2d.hxx>
+
//////////////////////////////////////////////////////////////////////////////
namespace sdr
@@ -73,63 +75,92 @@ namespace sdr
void OverlayObjectList::remove(OverlayObject& rOverlayObject)
{
const OverlayObjectVector::iterator aFindResult = ::std::find(maVector.begin(), maVector.end(), &rOverlayObject);
- DBG_ASSERT((aFindResult != maVector.end()),
- "OverlayObjectList::remove: Could not find given object in list (!)");
- maVector.erase(aFindResult);
+ const bool bFound(aFindResult != maVector.end());
+ OSL_ENSURE(bFound, "Could not find given object in list (!)");
+
+ if(bFound)
+ {
+ maVector.erase(aFindResult);
+ }
}
- sal_Bool OverlayObjectList::isHit(const basegfx::B2DPoint& rPos, double fTol) const
+ bool OverlayObjectList::isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance) const
{
if(maVector.size())
{
OverlayObjectVector::const_iterator aStart(maVector.begin());
+ sdr::overlay::OverlayObject* pFirst = *aStart;
+ OSL_ENSURE(pFirst, "Corrupt OverlayObjectList (!)");
+ OverlayManager* pManager = pFirst->getOverlayManager();
- if(0.0 == fTol)
+ if(pManager)
{
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
- OverlayManager* pManager = pCandidate->getOverlayManager();
-
- if(pManager)
+ if(0.0 == fLogicTolerance)
{
- Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL)));
- fTol = aSizeLogic.Width();
+ fLogicTolerance = aSizeLogic.Width();
}
- }
- for(; aStart != maVector.end(); aStart++)
- {
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(pManager->getCurrentViewInformation2D());
+ drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D(
+ aViewInformation2D,
+ rLogicPosition,
+ fLogicTolerance,
+ false);
- if(pCandidate->isHit(rPos, fTol))
+ for(; aStart != maVector.end(); aStart++)
{
- return sal_True;
+ sdr::overlay::OverlayObject* pCandidate = *aStart;
+ OSL_ENSURE(pCandidate, "Corrupt OverlayObjectList (!)");
+
+ if(pCandidate->isHittable())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = pCandidate->getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
+ {
+ aHitTestProcessor2D.process(rSequence);
+
+ if(aHitTestProcessor2D.getHit())
+ {
+ return true;
+ }
+ }
+ }
}
}
}
- return sal_False;
+ return false;
}
- sal_Bool OverlayObjectList::isHitPixel(const Point& rPos, sal_uInt32 nTol) const
+ bool OverlayObjectList::isHitPixel(const Point& rDiscretePosition, sal_uInt32 nDiscreteTolerance) const
{
if(maVector.size())
{
OverlayObjectVector::const_iterator aStart(maVector.begin());
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+ sdr::overlay::OverlayObject* pCandidate = *aStart;
OverlayManager* pManager = pCandidate->getOverlayManager();
if(pManager)
{
- Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rPos));
- Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nTol, nTol)));
- basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y());
+ const Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rDiscretePosition));
+ const basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y());
- return isHit(aPosition, (double)aSizeLogic.Width());
+ if(nDiscreteTolerance)
+ {
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nDiscreteTolerance, nDiscreteTolerance)));
+ return isHitLogic(aPosition, (double)aSizeLogic.Width());
+ }
+ else
+ {
+ return isHitLogic(aPosition);
+ }
}
}
- return sal_False;
+ return false;
}
basegfx::B2DRange OverlayObjectList::getBaseRange() const
@@ -149,20 +180,6 @@ namespace sdr
return aRetval;
}
-
- void OverlayObjectList::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity() && maVector.size())
- {
- OverlayObjectVector::iterator aStart(maVector.begin());
-
- for(; aStart != maVector.end(); aStart++)
- {
- ::sdr::overlay::OverlayObject* pCandidate = *aStart;
- pCandidate->transform(rMatrix);
- }
- }
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx
index 3d859a9b0659..a94dbdb9d1c4 100644
--- a/svx/source/sdr/overlay/overlaypolypolygon.cxx
+++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx
@@ -35,6 +35,8 @@
#include <vcl/outdev.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,21 +44,33 @@ namespace sdr
{
namespace overlay
{
- void OverlayPolyPolygonStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence()
{
- if(maPolyPolygon.count())
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(getOverlayManager())
{
- for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++)
- {
- ImpDrawPolygonStriped(rOutputDevice, maPolyPolygon.getB2DPolygon(a));
- }
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
+ getPolyPolygon(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
+
+ return aRetval;
}
- void OverlayPolyPolygonStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
+ void OverlayPolyPolygonStriped::stripeDefinitionHasChanged()
{
- // use tooling to get range from PolyPolygon
- maBaseRange = basegfx::tools::getRange(maPolyPolygon);
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayPolyPolygonStriped::OverlayPolyPolygonStriped(
@@ -81,67 +95,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayPolyPolygonStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- return basegfx::tools::isInEpsilonRange(maPolyPolygon, rPos, fTol);
- }
-
- return sal_False;
- }
-
- void OverlayPolyPolygonStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform maPolyPolygon
- maPolyPolygon.transform(rMatrix);
-
- // register change (after change)
- objectChange();
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayPolyPolygon::drawGeometry(OutputDevice& rOutputDevice)
- {
- if(maPolyPolygon.count())
- {
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- // iterate self, else the single polygons will be closed when
- // using DrawPolyPolygon
- for(sal_uInt32 a(0L); a < maPolyPolygon.count(); a++)
- {
- const Polygon aPaintPoly(maPolyPolygon.getB2DPolygon(a));
- rOutputDevice.DrawPolyLine(aPaintPoly);
- }
- }
- }
-
- OverlayPolyPolygon::OverlayPolyPolygon(
- const basegfx::B2DPolyPolygon& rPolyPolygon,
- Color aPolygonColor)
- : OverlayPolyPolygonStriped(rPolyPolygon)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aPolygonColor;
- }
-
- OverlayPolyPolygon::~OverlayPolyPolygon()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
index 1383a296709b..c43a9494901f 100644
--- a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
+++ b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
@@ -43,55 +43,9 @@ namespace sdr
{
namespace overlay
{
- void OverlayPrimitive2DSequenceObject::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPrimitive2DSequenceObject::createOverlayObjectPrimitive2DSequence()
{
- if(getOverlayManager())
- {
- // prepare ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- // create processor
- drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
- rOutputDevice,
- aViewInformation2D);
-
- if(pProcessor)
- {
- pProcessor->process(getSequence());
-
- delete pProcessor;
- }
- }
- }
-
- void OverlayPrimitive2DSequenceObject::createBaseRange(OutputDevice& rOutputDevice)
- {
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(),
- rOutputDevice.GetViewTransformation(),
- basegfx::B2DRange(),
- 0,
- 0.0,
- 0);
-
- maBaseRange = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
- getSequence(), aViewInformation2D);
- }
-
- sal_Bool OverlayPrimitive2DSequenceObject::isHit(const basegfx::B2DPoint& /*rPos*/, double /*fTol*/) const
- {
- if(isHittable())
- {
- return false;
- }
-
- return false;
+ return getSequence();
}
OverlayPrimitive2DSequenceObject::OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence)
diff --git a/svx/source/sdr/overlay/overlayrollingrectangle.cxx b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
index ea5be0e4f400..42a3575288be 100644
--- a/svx/source/sdr/overlay/overlayrollingrectangle.cxx
+++ b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
@@ -35,6 +35,11 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -42,65 +47,59 @@ namespace sdr
{
namespace overlay
{
- void OverlayRollingRectangleStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
{
- const basegfx::B2DRange aRange(getBasePosition(), getSecondPosition());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
- if(getShowBounds())
+ if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
{
- ImpDrawRangeStriped(rOutputDevice, aRange);
- }
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- // Left lines
- ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMinY(), aRange.getMinX(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aVisibleLogic.Left(), aRange.getMaxY(), aRange.getMinX(), aRange.getMaxY());
-
- // Right lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMinY(), aVisibleLogic.Right(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aVisibleLogic.Right(), aRange.getMaxY());
+ const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
+ const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
+ const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
+ const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
- // Top lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aVisibleLogic.Top(), aRange.getMinX(), aRange.getMinY());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aVisibleLogic.Top(), aRange.getMaxX(), aRange.getMinY());
+ if(getShowBounds())
+ {
+ // view-independent part, create directly
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle));
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
+ aPolygon,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
+ }
- // Bottom lines
- ImpDrawLineStriped(rOutputDevice, aRange.getMinX(), aRange.getMaxY(), aRange.getMinX(), aVisibleLogic.Bottom());
- ImpDrawLineStriped(rOutputDevice, aRange.getMaxX(), aRange.getMaxY(), aRange.getMaxX(), aVisibleLogic.Bottom());
+ if(getExtendedLines())
+ {
+ // view-dependent part, use helper primitive
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
+ aRollingRectangle,
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
+ }
}
+
+ return aRetval;
}
- void OverlayRollingRectangleStriped::createBaseRange(OutputDevice& rOutputDevice)
+ void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
{
- // reset range and expand it
- maBaseRange.reset();
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Left(), aVisibleLogic.Top()));
- maBaseRange.expand(basegfx::B2DPoint(aVisibleLogic.Right(), aVisibleLogic.Bottom()));
- }
-
- if(getShowBounds())
- {
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
- }
+ // react on OverlayManager's stripe definition change
+ objectChange();
}
OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- sal_Bool bExtendedLines,
- sal_Bool bShowBounds)
+ bool bExtendedLines,
+ bool bShowBounds)
: OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
maSecondPosition(rSecondPos),
mbExtendedLines(bExtendedLines),
@@ -124,9 +123,9 @@ namespace sdr
}
}
- void OverlayRollingRectangleStriped::setExtendedLines(sal_Bool bNew)
+ void OverlayRollingRectangleStriped::setExtendedLines(bool bNew)
{
- if(bNew != mbExtendedLines)
+ if(bNew != (bool)mbExtendedLines)
{
// remember new value
mbExtendedLines = bNew;
@@ -136,9 +135,9 @@ namespace sdr
}
}
- void OverlayRollingRectangleStriped::setShowBounds(sal_Bool bNew)
+ void OverlayRollingRectangleStriped::setShowBounds(bool bNew)
{
- if(bNew != mbShowBounds)
+ if(bNew != (bool)mbShowBounds)
{
// remember new value
mbShowBounds = bNew;
@@ -147,138 +146,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayRollingRectangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- if(getExtendedLines())
- {
- const basegfx::B2DRange aRange(getBaseRange());
- const basegfx::B2DPoint aMinimum(aRange.getMinimum());
- const basegfx::B2DPoint aMaximum(aRange.getMaximum());
-
- // test upper line horizontal
- if(rPos.getY() > (aMinimum.getY() - fTol) && rPos.getY() < (aMinimum.getY() + fTol))
- {
- return sal_True;
- }
-
- // test lower line horizontal
- if(rPos.getY() > (aMaximum.getY() - fTol) && rPos.getY() < (aMaximum.getY() + fTol))
- {
- return sal_True;
- }
-
- // test left line vertical
- if(rPos.getX() > (aMinimum.getX() - fTol) && rPos.getX() < (aMinimum.getX() + fTol))
- {
- return sal_True;
- }
-
- // test rightline vertical
- if(rPos.getX() > (aMaximum.getX() - fTol) && rPos.getX() < (aMaximum.getX() + fTol))
- {
- return sal_True;
- }
- }
-
- if(getShowBounds())
- {
- // test for inside grown range, outside shrinked one to test for border
- // hit without interiour
- basegfx::B2DRange aOuterRange(getBaseRange());
- aOuterRange.grow(fTol);
-
- if(aOuterRange.isInside(rPos))
- {
- basegfx::B2DRange aInnerRange(getBaseRange());
- aInnerRange.grow(-fTol);
-
- return !aInnerRange.isInside(rPos);
- }
- }
- }
-
- return sal_False;
- }
-
- void OverlayRollingRectangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayRollingRectangle::drawGeometry(OutputDevice& rOutputDevice)
- {
- const Point aStart(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- const Point aEnd(FRound(getSecondPosition().getX()), FRound(getSecondPosition().getY()));
- Rectangle aRectangle(aStart, aEnd);
- aRectangle.Justify();
-
- if(getShowBounds())
- {
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawRect(aRectangle);
- }
-
- if(getExtendedLines())
- {
- const Point aEmptyPoint;
- const Rectangle aVisiblePixel(aEmptyPoint, rOutputDevice.GetOutputSizePixel());
- const Rectangle aVisibleLogic(rOutputDevice.PixelToLogic(aVisiblePixel));
-
- // Left lines
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Top()), aRectangle.TopLeft());
- rOutputDevice.DrawLine(Point(aVisibleLogic.Left(), aRectangle.Bottom()), aRectangle.BottomLeft());
-
- // Right lines
- rOutputDevice.DrawLine(aRectangle.TopRight(), Point(aVisibleLogic.Right(), aRectangle.Top()));
- rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aVisibleLogic.Right(), aRectangle.Bottom()));
-
- // Top lines
- rOutputDevice.DrawLine(Point(aRectangle.Left(), aVisibleLogic.Top()), aRectangle.TopLeft());
- rOutputDevice.DrawLine(Point(aRectangle.Right(), aVisibleLogic.Top()), aRectangle.TopRight());
-
- // Bottom lines
- rOutputDevice.DrawLine(aRectangle.BottomLeft(), Point(aRectangle.Left(), aVisibleLogic.Bottom()));
- rOutputDevice.DrawLine(aRectangle.BottomRight(), Point(aRectangle.Right(), aVisibleLogic.Bottom()));
- }
- }
-
- OverlayRollingRectangle::OverlayRollingRectangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- Color aLineColor,
- sal_Bool bExtendedLines,
- sal_Bool bShowBounds)
- : OverlayRollingRectangleStriped(rBasePos, rSecondPos, bExtendedLines, bShowBounds)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aLineColor;
- }
-
- OverlayRollingRectangle::~OverlayRollingRectangle()
- {
- }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/svx/source/sdr/overlay/overlaysdrobject.cxx b/svx/source/sdr/overlay/overlaysdrobject.cxx
deleted file mode 100644
index 7f1dbf2d5a4f..000000000000
--- a/svx/source/sdr/overlay/overlaysdrobject.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: overlaysdrobject.cxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-#include <svx/sdr/overlay/overlaysdrobject.hxx>
-#include <svx/svdobj.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlaySdrObject::drawGeometry(OutputDevice& rOutputDevice)
- {
- mrSdrObject.SingleObjectPainter(rOutputDevice);
- }
-
- void OverlaySdrObject::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- // reset range and expand it
- maBaseRange.reset();
-
- // get BoundRect
- Rectangle aBoundRect(mrSdrObject.GetCurrentBoundRect());
- const basegfx::B2DPoint aTopLeft(aBoundRect.Left(), aBoundRect.Top());
- const basegfx::B2DPoint aBottomRight(aBoundRect.Right(), aBoundRect.Bottom());
-
- maBaseRange.expand(aTopLeft);
- maBaseRange.expand(aBottomRight);
- }
-
- OverlaySdrObject::OverlaySdrObject(
- const basegfx::B2DPoint& rBasePos,
- const SdrObject& rObject)
- : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
- mrSdrObject(rObject)
- {
- }
-
- OverlaySdrObject::~OverlaySdrObject()
- {
- }
-
- sal_Bool OverlaySdrObject::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- Point aPnt( (long)rPos.getX(), (long)rPos.getY() );
- return mrSdrObject.CheckHit(aPnt, (USHORT)fTol, 0) != 0 ? sal_True : sal_False;
- }
-
- return sal_False;
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx
new file mode 100644
index 000000000000..2411ca3c31b4
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayselection.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: overlayline.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayselection.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ // combine rages geometrically to a single, ORed polygon
+ basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
+ {
+ const sal_uInt32 nCount(rRanges.size());
+ basegfx::B2DPolyPolygon aRetval;
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
+
+ if(0 == a)
+ {
+ aRetval.append(aDiscretePolygon);
+ }
+ else
+ {
+ aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
+ }
+ }
+
+ return aRetval;
+ }
+
+ // check if wanted type OVERLAY_TRANSPARENT or OVERLAY_SOLID
+ // is possible. If not, fallback to invert mode (classic mode)
+ OverlayType impCheckPossibleOverlayType(OverlayType aOverlayType)
+ {
+ if(OVERLAY_INVERT != aOverlayType)
+ {
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+
+ if(!aSvtOptionsDrawinglayer.IsTransparentSelection())
+ {
+ // not possible when switched off by user
+ return OVERLAY_INVERT;
+ }
+ else
+ {
+ const OutputDevice *pOut = Application::GetDefaultDevice();
+
+ if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ // not possible when in high contrast mode
+ return OVERLAY_INVERT;
+ }
+
+ if(!pOut->supportsOperation(OutDevSupport_TransparentRect))
+ {
+ // not possible when no fast transparence paint is supported on the system
+ return OVERLAY_INVERT;
+ }
+ }
+ }
+
+ return aOverlayType;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(getRanges().size());
+
+ if(nCount)
+ {
+ // create range primitives
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ aRetval.realloc(nCount);
+
+ for(sal_uInt32 a(0);a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a]));
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
+ }
+
+ if(OVERLAY_INVERT == maLastOverlayType)
+ {
+ // embed all in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
+ }
+ else if(OVERLAY_TRANSPARENT == maLastOverlayType)
+ {
+ // embed all rectangles in transparent paint
+ const double fTransparence(mnLastTransparence / 100.0);
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aRetval,
+ fTransparence));
+
+ if(getBorder())
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
+ const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ aPolyPolygon,
+ aRGBColor));
+
+ // add both to result
+ aRetval.realloc(2);
+ aRetval[0] = aUnifiedAlpha;
+ aRetval[1] = aSelectionOutline;
+ }
+ else
+ {
+ // just add transparent part
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1);
+ }
+ }
+ }
+
+ return aRetval;
+ }
+
+ OverlaySelection::OverlaySelection(
+ OverlayType eType,
+ const Color& rColor,
+ const std::vector< basegfx::B2DRange >& rRanges,
+ bool bBorder)
+ : OverlayObject(rColor),
+ meOverlayType(eType),
+ maRanges(rRanges),
+ maLastOverlayType(eType),
+ mnLastTransparence(0),
+ mbBorder(bBorder)
+ {
+ // no AA for selection overlays
+ allowAntiAliase(false);
+ }
+
+ OverlaySelection::~OverlaySelection()
+ {
+ if(getOverlayManager())
+ {
+ getOverlayManager()->remove(*this);
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::getOverlayObjectPrimitive2DSequence() const
+ {
+ // get current values
+ const OverlayType aNewOverlayType(impCheckPossibleOverlayType(meOverlayType));
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const sal_uInt16 nNewTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent());
+
+ if(getPrimitive2DSequence().hasElements())
+ {
+ if(aNewOverlayType != maLastOverlayType
+ || nNewTransparence != mnLastTransparence)
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< OverlaySelection* >(this)->setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence());
+ }
+ }
+
+ if(!getPrimitive2DSequence().hasElements())
+ {
+ // remember new values
+ const_cast< OverlaySelection* >(this)->maLastOverlayType = aNewOverlayType;
+ const_cast< OverlaySelection* >(this)->mnLastTransparence = nNewTransparence;
+ }
+
+ // call base implementation
+ return OverlayObject::getOverlayObjectPrimitive2DSequence();
+ }
+
+ void OverlaySelection::setRanges(const std::vector< basegfx::B2DRange >& rNew)
+ {
+ if(rNew != maRanges)
+ {
+ maRanges = rNew;
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx
new file mode 100644
index 000000000000..664c487c7e43
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: overlayobject.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayBitmapExPrimitive::OverlayBitmapExPrimitive(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rBasePosition,
+ sal_uInt16 nCenterX,
+ sal_uInt16 nCenterY)
+ : DiscreteMetricDependentPrimitive2D(),
+ maBitmapEx(rBitmapEx),
+ maBasePosition(rBasePosition),
+ mnCenterX(nCenterX),
+ mnCenterY(nCenterY)
+ {}
+
+ Primitive2DSequence OverlayBitmapExPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+ const Size aBitmapSize(getBitmapEx().GetSizePixel());
+
+ if(aBitmapSize.Width() && aBitmapSize.Height() && basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ {
+ // calculate back from internal bitmap's extreme coordinates (the edges)
+ // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(),
+ // the prepared one which expresses how many logic units form a discrete unit)
+ // for this step. This primitive is to be displayed always unscaled (in it's pixel size)
+ // and unrotated, more like a marker
+ const double fLeft(((0.0 - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
+ const double fTop(((0.0 - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
+ const double fRight((((aBitmapSize.getWidth() - 1.0) - getCenterX()) * getDiscreteUnit()) + getBasePosition().getX());
+ const double fBottom((((aBitmapSize.getHeight() - 1.0) - getCenterY()) * getDiscreteUnit()) + getBasePosition().getY());
+
+ // create a BitmapPrimitive2D using those positions
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 0, fRight - fLeft);
+ aTransform.set(1, 1, fBottom - fTop);
+ aTransform.set(0, 2, fLeft);
+ aTransform.set(1, 2, fTop);
+
+ const Primitive2DReference aPrimitive(new BitmapPrimitive2D(getBitmapEx(), aTransform));
+ aRetval = Primitive2DSequence(&aPrimitive, 1);
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayBitmapExPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayBitmapExPrimitive& rCompare = static_cast< const OverlayBitmapExPrimitive& >(rPrimitive);
+
+ return (getBitmapEx() == rCompare.getBitmapEx()
+ && getBasePosition() == rCompare.getBasePosition()
+ && getCenterX() == rCompare.getCenterX()
+ && getCenterY() == rCompare.getCenterY());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayBitmapExPrimitive, PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayCrosshairPrimitive::OverlayCrosshairPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayCrosshairPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ aRetval.realloc(2);
+ basegfx::B2DPolygon aPolygon;
+
+ aPolygon.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
+ aPolygon.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aPolygon,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ aPolygon.clear();
+ aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
+ aPolygon.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
+
+ aRetval[1] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aPolygon,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayCrosshairPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayCrosshairPrimitive& rCompare = static_cast< const OverlayCrosshairPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayCrosshairPrimitive, PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayHatchRectanglePrimitive::OverlayHatchRectanglePrimitive(
+ const basegfx::B2DRange& rObjectRange,
+ double fDiscreteHatchDistance,
+ double fHatchRotation,
+ const basegfx::BColor& rHatchColor,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
+ double fRotation)
+ : DiscreteMetricDependentPrimitive2D(),
+ maObjectRange(rObjectRange),
+ mfDiscreteHatchDistance(fDiscreteHatchDistance),
+ mfHatchRotation(fHatchRotation),
+ maHatchColor(rHatchColor),
+ mfDiscreteGrow(fDiscreteGrow),
+ mfDiscreteShrink(fDiscreteShrink),
+ mfRotation(fRotation)
+ {}
+
+ Primitive2DSequence OverlayHatchRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ if(basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ {
+ basegfx::B2DRange aInnerRange(getObjectRange());
+ basegfx::B2DRange aOuterRange(getObjectRange());
+ basegfx::B2DPolyPolygon aHatchPolyPolygon;
+
+ aOuterRange.grow(getDiscreteUnit() * getDiscreteGrow());
+ aInnerRange.grow(getDiscreteUnit() * -getDiscreteShrink());
+
+ aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aOuterRange));
+
+ if(!aInnerRange.isEmpty())
+ {
+ aHatchPolyPolygon.append(basegfx::tools::createPolygonFromRect(aInnerRange));
+ }
+
+ if(!basegfx::fTools::equalZero(getRotation()))
+ {
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.translate(-getObjectRange().getMinX(), -getObjectRange().getMinY());
+ aTransform.rotate(getRotation());
+ aTransform.translate(getObjectRange().getMinX(), getObjectRange().getMinY());
+
+ aHatchPolyPolygon.transform(aTransform);
+ }
+
+ const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0);
+ const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute(
+ drawinglayer::attribute::HATCHSTYLE_SINGLE,
+ getDiscreteHatchDistance() * getDiscreteUnit(),
+ getHatchRotation() - getRotation(),
+ getHatchColor(),
+ false);
+ const Primitive2DReference aPrimitive(
+ new PolyPolygonHatchPrimitive2D(
+ aHatchPolyPolygon,
+ aEmptyColor,
+ aFillHatchAttribute));
+
+ aRetval = Primitive2DSequence(&aPrimitive, 1);
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayHatchRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayHatchRectanglePrimitive& rCompare = static_cast< const OverlayHatchRectanglePrimitive& >(rPrimitive);
+
+ return (getObjectRange() == rCompare.getObjectRange()
+ && getDiscreteHatchDistance() == rCompare.getDiscreteHatchDistance()
+ && getHatchRotation() == rCompare.getHatchRotation()
+ && getHatchColor() == rCompare.getHatchColor()
+ && getDiscreteGrow() == rCompare.getDiscreteGrow()
+ && getDiscreteShrink() == rCompare.getDiscreteShrink()
+ && getRotation() == rCompare.getRotation());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayHatchRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayHelplineStripedPrimitive::OverlayHelplineStripedPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ HelplineStyle eStyle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ meStyle(eStyle),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayHelplineStripedPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ switch(getStyle())
+ {
+ case HELPLINESTYLE_VERTICAL :
+ {
+ aRetval.realloc(1);
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getBasePosition().getX(), getViewport().getMaxY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLine,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ break;
+ }
+
+ case HELPLINESTYLE_HORIZONTAL :
+ {
+ aRetval.realloc(1);
+ basegfx::B2DPolygon aLine;
+
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getBasePosition().getY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getBasePosition().getY()));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLine,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+ break;
+ }
+
+ default: // case HELPLINESTYLE_POINT :
+ {
+ const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
+ aRetval.realloc(2);
+ basegfx::B2DPolygon aLineA, aLineB;
+
+ aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() - fDiscreteUnit));
+ aLineA.append(basegfx::B2DPoint(getBasePosition().getX(), getBasePosition().getY() + fDiscreteUnit));
+
+ aRetval[0] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLineA,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ aLineB.append(basegfx::B2DPoint(getBasePosition().getX() - fDiscreteUnit, getBasePosition().getY()));
+ aLineB.append(basegfx::B2DPoint(getBasePosition().getX() + fDiscreteUnit, getBasePosition().getY()));
+
+ aRetval[1] = Primitive2DReference(
+ new PolygonMarkerPrimitive2D(
+ aLineB,
+ getRGBColorA(),
+ getRGBColorB(),
+ getDiscreteDashLength()));
+
+ break;
+ }
+ }
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayHelplineStripedPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayHelplineStripedPrimitive& rCompare = static_cast< const OverlayHelplineStripedPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getStyle() == rCompare.getStyle()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayHelplineStripedPrimitive, PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ OverlayRollingRectanglePrimitive::OverlayRollingRectanglePrimitive(
+ const basegfx::B2DRange& aRollingRectangle,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength)
+ : ViewportDependentPrimitive2D(),
+ maRollingRectangle(aRollingRectangle),
+ maRGBColorA(rRGBColorA),
+ maRGBColorB(rRGBColorB),
+ mfDiscreteDashLength(fDiscreteDashLength)
+ {}
+
+ Primitive2DSequence OverlayRollingRectanglePrimitive::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ // use the prepared Viewport information accessible using getViewport()
+ Primitive2DSequence aRetval;
+
+ if(!getViewport().isEmpty())
+ {
+ basegfx::B2DPolygon aLine;
+ aRetval.realloc(8);
+
+ // Left lines
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ aRetval[0] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ aRetval[1] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Right lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY()));
+ aRetval[2] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY()));
+ aRetval[3] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Top lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ aRetval[4] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ aRetval[5] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Bottom lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY()));
+ aRetval[6] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY()));
+ aRetval[7] = Primitive2DReference(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+ }
+
+ return aRetval;
+ }
+
+ bool OverlayRollingRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
+ {
+ if(ViewportDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const OverlayRollingRectanglePrimitive& rCompare = static_cast< const OverlayRollingRectanglePrimitive& >(rPrimitive);
+
+ return (getRollingRectangle() == rCompare.getRollingRectangle()
+ && getRGBColorA() == rCompare.getRGBColorA()
+ && getRGBColorB() == rCompare.getRGBColorB()
+ && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
+ }
+
+ return false;
+ }
+
+ ImplPrimitrive2DIDBlock(OverlayRollingRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaytriangle.cxx b/svx/source/sdr/overlay/overlaytriangle.cxx
index 1d01ab24e388..74f23b8f845c 100644
--- a/svx/source/sdr/overlay/overlaytriangle.cxx
+++ b/svx/source/sdr/overlay/overlaytriangle.cxx
@@ -37,6 +37,9 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,7 +47,7 @@ namespace sdr
{
namespace overlay
{
- void OverlayTriangleStriped::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayTriangle::createOverlayObjectPrimitive2DSequence()
{
basegfx::B2DPolygon aPolygon;
@@ -53,33 +56,30 @@ namespace sdr
aPolygon.append(getThirdPosition());
aPolygon.setClosed(true);
- ImpDrawPolygonStriped(rOutputDevice, aPolygon);
- }
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ getBaseColor().getBColor()));
- void OverlayTriangleStriped::createBaseRange(OutputDevice& /*rOutputDevice*/)
- {
- // reset range and expand it
- maBaseRange.reset();
- maBaseRange.expand(getBasePosition());
- maBaseRange.expand(getSecondPosition());
- maBaseRange.expand(getThirdPosition());
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
}
- OverlayTriangleStriped::OverlayTriangleStriped(
+ OverlayTriangle::OverlayTriangle(
const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos)
- : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
+ const basegfx::B2DPoint& rThirdPos,
+ Color aTriangleColor)
+ : OverlayObjectWithBasePosition(rBasePos, aTriangleColor),
maSecondPosition(rSecondPos),
maThirdPosition(rThirdPos)
{
}
- OverlayTriangleStriped::~OverlayTriangleStriped()
+ OverlayTriangle::~OverlayTriangle()
{
}
- void OverlayTriangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
+ void OverlayTriangle::setSecondPosition(const basegfx::B2DPoint& rNew)
{
if(rNew != maSecondPosition)
{
@@ -91,7 +91,7 @@ namespace sdr
}
}
- void OverlayTriangleStriped::setThirdPosition(const basegfx::B2DPoint& rNew)
+ void OverlayTriangle::setThirdPosition(const basegfx::B2DPoint& rNew)
{
if(rNew != maThirdPosition)
{
@@ -102,96 +102,6 @@ namespace sdr
objectChange();
}
}
-
- sal_Bool OverlayTriangleStriped::isHit(const basegfx::B2DPoint& rPos, double fTol) const
- {
- if(isHittable())
- {
- // test with all lines and epsilon-range
- if(basegfx::tools::isInEpsilonRange(getBasePosition(), getThirdPosition(), rPos, fTol))
- {
- return sal_True;
- }
- else if(basegfx::tools::isInEpsilonRange(getSecondPosition(), getBasePosition(), rPos, fTol))
- {
- return sal_True;
- }
- else if(basegfx::tools::isInEpsilonRange(getThirdPosition(), getSecondPosition(), rPos, fTol))
- {
- return sal_True;
- }
-
- // test if inside triangle
- basegfx::B2DPolygon aTestPoly;
- aTestPoly.append(getBasePosition());
- aTestPoly.append(getSecondPosition());
- aTestPoly.append(getThirdPosition());
- aTestPoly.setClosed(true);
-
- return basegfx::tools::isInside(aTestPoly, rPos);
- }
-
- return sal_False;
- }
-
- void OverlayTriangleStriped::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- if(!rMatrix.isIdentity())
- {
- // transform base position
- OverlayObjectWithBasePosition::transform(rMatrix);
-
- // transform maSecondPosition
- const basegfx::B2DPoint aNewSecondPosition = rMatrix * getSecondPosition();
- setSecondPosition(aNewSecondPosition);
-
- // transform maThirdPosition
- const basegfx::B2DPoint aNewThirdPosition = rMatrix * getThirdPosition();
- setThirdPosition(aNewThirdPosition);
- }
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace sdr
-{
- namespace overlay
- {
- void OverlayTriangle::drawGeometry(OutputDevice& rOutputDevice)
- {
- Polygon aPolygon(4);
- Point aPosition(FRound(getBasePosition().getX()), FRound(getBasePosition().getY()));
- aPolygon[0] = aPolygon[3] = aPosition;
- aPosition.X() = FRound(getSecondPosition().getX());
- aPosition.Y() = FRound(getSecondPosition().getY());
- aPolygon[1] = aPosition;
- aPosition.X() = FRound(getThirdPosition().getX());
- aPosition.Y() = FRound(getThirdPosition().getY());
- aPolygon[2] = aPosition;
-
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
-
- rOutputDevice.DrawPolygon(aPolygon);
- }
-
- OverlayTriangle::OverlayTriangle(
- const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- Color aTriangleColor)
- : OverlayTriangleStriped(rBasePos, rSecondPos, rThirdPos)
- {
- // set base color here, OverlayCrosshairStriped constructor has set
- // it to it's own default.
- maBaseColor = aTriangleColor;
- }
-
- OverlayTriangle::~OverlayTriangle()
- {
- }
} // end of namespace overlay
} // end of namespace sdr