summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-02-22 15:18:16 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-19 17:57:19 +0100
commite3aeec6664273abc7917280032c3219d8672465f (patch)
tree2b270fbd90f7f13356565e10672eb816f48a6367 /drawinglayer
parentc0c2e9ed18b29c109ef1194e9b7b4fb48fa5f787 (diff)
svx::frame::DrawRange has now a drawinglayer equivalent
Diffstat (limited to 'drawinglayer')
-rwxr-xr-xdrawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx4
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx80
-rwxr-xr-xdrawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx1
-rwxr-xr-xdrawinglayer/prj/d.lst1
-rwxr-xr-xdrawinglayer/source/primitive2d/borderlineprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx81
-rwxr-xr-xdrawinglayer/source/primitive2d/makefile.mk1
7 files changed, 167 insertions, 3 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 12cdbbe21009..6080881cbb42 100755
--- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -120,9 +120,9 @@ namespace drawinglayer
return !basegfx::fTools::equalZero(mfRightWidth);
}
- basegfx::B2DPolyPolygon getClipPolygon( ) const;
-
protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon( ) const;
+
/// create local decomposition
virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
new file mode 100644
index 000000000000..bae79087a7a8
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Novell Inc. ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Cédric Bosdonnat <cbosdonnat@novell.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D clipped by the intersection with a provided
+ polygon.
+ */
+ class ClippedBorderLinePrimitive2D : public BorderLinePrimitive2D
+ {
+ private:
+ const basegfx::B2DPolygon maIntersection;
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon( ) const;
+
+ public:
+ /// constructor
+ ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index a86f82d84898..c90546148b9b 100755
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -104,6 +104,7 @@
#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 54f087d317e4..375889e5a12e 100755
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -14,6 +14,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx
..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx
..\inc\drawinglayer\primitive2d\controlprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\controlprimitive2d.hxx
..\inc\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 90e150c461eb..5c3a889483e8 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -74,7 +74,7 @@ namespace drawinglayer
Primitive2DSequence xRetval;
if(!getStart().equal(getEnd()) && getWidth() > 0)
- {
+ {
// get data and vectors
const double fWidth(getWidth());
basegfx::B2DVector aVector(getEnd() - getStart());
diff --git a/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx
new file mode 100644
index 000000000000..874c61746d48
--- /dev/null
+++ b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Novell Inc. ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Cédric Bosdonnat <cbosdonnat@novell.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ basegfx::B2DPolyPolygon ClippedBorderLinePrimitive2D::getClipPolygon( ) const
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append( maIntersection );
+ return aPolyPolygon;
+ }
+
+ ClippedBorderLinePrimitive2D::ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle)
+ : BorderLinePrimitive2D( rStart, rEnd, fLeftWidth,fDistance, fRightWidth,
+ 0.0, 0.0, 0.0, 0.0, rRGBColorRight, rRGBColorLeft,
+ rRGBColorGap, bHasGapColor, nStyle),
+ maIntersection( rIntersection )
+ {
+ }
+
+ bool ClippedBorderLinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BorderLinePrimitive2D::operator==(rPrimitive))
+ {
+ const ClippedBorderLinePrimitive2D& rCompare = (ClippedBorderLinePrimitive2D&)rPrimitive;
+
+ return maIntersection == rCompare.maIntersection;
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(ClippedBorderLinePrimitive2D, PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D)
+
+
+ } // namespace primitive2d
+} // namespace drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index 720769a0efd5..092612f7923f 100755
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -43,6 +43,7 @@ SLOFILES= \
$(SLO)$/backgroundcolorprimitive2d.obj \
$(SLO)$/bitmapprimitive2d.obj \
$(SLO)$/borderlineprimitive2d.obj \
+ $(SLO)$/clippedborderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \
$(SLO)$/controlprimitive2d.obj \
$(SLO)$/discretebitmapprimitive2d.obj \