From 4f48ca5bb396aebaf0a566a84be56fd1a36646e1 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Fri, 15 Feb 2002 15:56:24 +0000 Subject: #97016# Added ::CreateDefaultObject implementations to the FuCon classes --- sd/source/ui/func/fuconbez.cxx | 140 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 3 deletions(-) (limited to 'sd/source/ui/func/fuconbez.cxx') diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index 39ec3c725969..a1ad632cc084 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fuconbez.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tbe $ $Date: 2000-11-10 16:18:43 $ + * last change: $Author: aw $ $Date: 2002-02-15 16:51:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -380,7 +380,141 @@ void FuConstBezPoly::SetEditMode(USHORT nMode) rBindings.Invalidate(SID_BEZIER_INSERT); } +// #97016# +SdrObject* FuConstBezPoly::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle) +{ + // case SID_DRAW_POLYGON: + // case SID_DRAW_POLYGON_NOFILL: + // case SID_DRAW_XPOLYGON: + // case SID_DRAW_XPOLYGON_NOFILL: + // case SID_DRAW_FREELINE: + // case SID_DRAW_FREELINE_NOFILL: + // case SID_DRAW_BEZIER_FILL: // BASIC + // case SID_DRAW_BEZIER_NOFILL: // BASIC + + SdrObject* pObj = SdrObjFactory::MakeNewObject( + pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), + 0L, pDoc); + + if(pObj) + { + if(pObj->ISA(SdrPathObj)) + { + XPolyPolygon aPoly; + + switch(nID) + { + case SID_DRAW_BEZIER_FILL: + { + sal_Int32 nWdt(rRectangle.GetWidth() / 2); + sal_Int32 nHgt(rRectangle.GetHeight() / 2); + + XPolygon aInnerPoly(rRectangle.Center(), nWdt, nHgt); + + aPoly.Insert(aInnerPoly); + break; + } + case SID_DRAW_BEZIER_NOFILL: + { + XPolygon aInnerPoly; + aInnerPoly[0] = rRectangle.BottomLeft(); + aInnerPoly[1] = rRectangle.BottomCenter(); + aInnerPoly[2] = rRectangle.BottomCenter(); + aInnerPoly[3] = rRectangle.Center(); + aInnerPoly[4] = rRectangle.TopCenter(); + aInnerPoly[5] = rRectangle.TopCenter(); + aInnerPoly[6] = rRectangle.TopRight(); + + aInnerPoly.SetFlags(1, XPOLY_CONTROL); + aInnerPoly.SetFlags(2, XPOLY_CONTROL); + aInnerPoly.SetFlags(3, XPOLY_SYMMTR); + aInnerPoly.SetFlags(4, XPOLY_CONTROL); + aInnerPoly.SetFlags(5, XPOLY_CONTROL); + + aPoly.Insert(aInnerPoly); + break; + } + case SID_DRAW_FREELINE: + case SID_DRAW_FREELINE_NOFILL: + { + XPolygon aInnerPoly; + aInnerPoly[0] = rRectangle.BottomLeft(); + aInnerPoly[1] = rRectangle.TopLeft(); + aInnerPoly[2] = rRectangle.TopCenter(); + aInnerPoly[3] = rRectangle.Center(); + aInnerPoly[4] = rRectangle.BottomCenter(); + aInnerPoly[5] = rRectangle.BottomRight(); + aInnerPoly[6] = rRectangle.TopRight(); + + aInnerPoly.SetFlags(1, XPOLY_CONTROL); + aInnerPoly.SetFlags(2, XPOLY_CONTROL); + aInnerPoly.SetFlags(3, XPOLY_SMOOTH); + aInnerPoly.SetFlags(4, XPOLY_CONTROL); + aInnerPoly.SetFlags(5, XPOLY_CONTROL); + + if(SID_DRAW_FREELINE == nID) + { + aInnerPoly[7] = rRectangle.BottomRight(); + } + + aPoly.Insert(aInnerPoly); + break; + } + case SID_DRAW_XPOLYGON: + case SID_DRAW_XPOLYGON_NOFILL: + { + XPolygon aInnerPoly; + aInnerPoly[0] = rRectangle.BottomLeft(); + aInnerPoly[1] = rRectangle.TopLeft(); + aInnerPoly[2] = rRectangle.TopCenter(); + aInnerPoly[3] = rRectangle.Center(); + aInnerPoly[4] = rRectangle.RightCenter(); + aInnerPoly[5] = rRectangle.BottomRight(); + + if(SID_DRAW_XPOLYGON_NOFILL == nID) + { + aInnerPoly[6] = rRectangle.BottomCenter(); + } + + aPoly.Insert(aInnerPoly); + break; + } + case SID_DRAW_POLYGON: + case SID_DRAW_POLYGON_NOFILL: + { + XPolygon aInnerPoly; + sal_Int32 nWdt(rRectangle.GetWidth()); + sal_Int32 nHgt(rRectangle.GetHeight()); + + aInnerPoly[0] = rRectangle.BottomLeft(); + aInnerPoly[1] = rRectangle.TopLeft() + Point((nWdt * 30) / 100, (nHgt * 70) / 100); + aInnerPoly[2] = rRectangle.TopLeft() + Point(0, (nHgt * 15) / 100); + aInnerPoly[3] = rRectangle.TopLeft() + Point((nWdt * 65) / 100, 0); + aInnerPoly[4] = rRectangle.TopLeft() + Point(nWdt, (nHgt * 30) / 100); + aInnerPoly[5] = rRectangle.TopLeft() + Point((nWdt * 80) / 100, (nHgt * 50) / 100); + aInnerPoly[6] = rRectangle.TopLeft() + Point((nWdt * 80) / 100, (nHgt * 75) / 100); + aInnerPoly[7] = rRectangle.BottomRight(); + + if(SID_DRAW_POLYGON_NOFILL == nID) + { + aInnerPoly[8] = rRectangle.BottomCenter(); + } + + aPoly.Insert(aInnerPoly); + break; + } + } + + ((SdrPathObj*)pObj)->SetPathPoly(aPoly); + } + else + { + DBG_ERROR("Object is NO path object"); + } + pObj->SetLogicRect(rRectangle); + } - + return pObj; +} -- cgit