summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:16:30 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:16:30 +0000
commitf8dbb161c3f94e43f260470252823ce285b644a4 (patch)
tree7bc0f837f1861b8deba6ace5d9a4fdbfb0981d54 /svx/source/sdr
parent8fa017cdea9aaa4a353e4840060bb23561d6fecf (diff)
INTEGRATION: CWS aw033 (1.1.2); FILE ADDED
2008/08/19 16:46:29 cl 1.1.2.8: fixed license files 2008/05/27 14:49:59 aw 1.1.2.7: #i39532# changes DEV300 m12 resync corrections 2008/04/04 06:07:50 aw 1.1.2.6: #i39532# added primitive support for tables 2007/03/06 12:39:33 aw 1.1.2.5: #i39532# 2007/01/25 12:48:34 aw 1.1.2.4: #i39532# change 3D scene content generation to be usable from API implementation, too 2006/11/28 11:17:56 aw 1.1.2.3: #i39532# 2006/11/07 15:52:21 aw 1.1.2.2: #i39532# changed various aspevcts of XPrimitive2D implementations 2006/10/19 10:57:50 aw 1.1.2.1: #i39532# primitive
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx126
1 files changed, 126 insertions, 0 deletions
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
new file mode 100644
index 0000000000..56f5e0493f
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * 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: sdrrectangleprimitive2d.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrRectanglePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromRect(::basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), mfCornerRadiusX, mfCornerRadiusY));
+
+ // add fill
+ if(maSdrLFSTAttribute.getFill())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getFill(), maSdrLFSTAttribute.getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(maSdrLFSTAttribute.getLine())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, maTransform, *maSdrLFSTAttribute.getLine()));
+ }
+
+ // add text
+ if(maSdrLFSTAttribute.getText())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), maTransform, *maSdrLFSTAttribute.getText(), maSdrLFSTAttribute.getLine(), false));
+ }
+
+ // add shadow
+ if(maSdrLFSTAttribute.getShadow())
+ {
+ // attention: shadow is added BEFORE object stuff to render it BEHIND object (!)
+ const Primitive2DReference xShadow(createShadowPrimitive(aRetval, *maSdrLFSTAttribute.getShadow()));
+
+ if(xShadow.is())
+ {
+ Primitive2DSequence aContentWithShadow(2L);
+ aContentWithShadow[0L] = xShadow;
+ aContentWithShadow[1L] = Primitive2DReference(new GroupPrimitive2D(aRetval));
+ aRetval = aContentWithShadow;
+ }
+ }
+
+ return aRetval;
+ }
+
+ SdrRectanglePrimitive2D::SdrRectanglePrimitive2D(
+ const ::basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ double fCornerRadiusX,
+ double fCornerRadiusY)
+ : BasePrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute),
+ mfCornerRadiusX(fCornerRadiusX),
+ mfCornerRadiusY(fCornerRadiusY)
+ {
+ }
+
+ bool SdrRectanglePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BasePrimitive2D::operator==(rPrimitive))
+ {
+ const SdrRectanglePrimitive2D& rCompare = (SdrRectanglePrimitive2D&)rPrimitive;
+
+ return (mfCornerRadiusX == rCompare.mfCornerRadiusX
+ && mfCornerRadiusY == rCompare.mfCornerRadiusY
+ && maTransform == rCompare.maTransform
+ && maSdrLFSTAttribute == rCompare.maSdrLFSTAttribute);
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrRectanglePrimitive2D, PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof