xref: /AOO41X/main/svx/source/svdraw/svdpoev.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svx/svdpoev.hxx>
32*cdf0e10cSrcweir #include <math.h>
33*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
34*cdf0e10cSrcweir #include <svx/svdpage.hxx>
35*cdf0e10cSrcweir #include <svx/svdopath.hxx>
36*cdf0e10cSrcweir #include <svx/svdundo.hxx>
37*cdf0e10cSrcweir #include "svx/svdstr.hrc"   // Namen aus der Resource
38*cdf0e10cSrcweir #include "svx/svdglob.hxx"  // StringCache
39*cdf0e10cSrcweir #include <svx/svdtrans.hxx>
40*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
41*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
42*cdf0e10cSrcweir #include <vcl/salbtype.hxx>		// FRound
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include <svx/polypolygoneditor.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir using namespace sdr;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir void SdrPolyEditView::ImpResetPolyPossibilityFlags()
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	eMarkedPointsSmooth=SDRPATHSMOOTH_DONTCARE;
53*cdf0e10cSrcweir 	eMarkedSegmentsKind=SDRPATHSEGMENT_DONTCARE;
54*cdf0e10cSrcweir 	bSetMarkedPointsSmoothPossible=sal_False;
55*cdf0e10cSrcweir 	bSetMarkedSegmentsKindPossible=sal_False;
56*cdf0e10cSrcweir }
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir void SdrPolyEditView::ImpClearVars()
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir 	ImpResetPolyPossibilityFlags();
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir SdrPolyEditView::SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut):
64*cdf0e10cSrcweir 	SdrEditView(pModel1,pOut)
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir 	ImpClearVars();
67*cdf0e10cSrcweir }
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir SdrPolyEditView::~SdrPolyEditView()
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir void SdrPolyEditView::ImpCheckPolyPossibilities()
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir 	ImpResetPolyPossibilityFlags();
76*cdf0e10cSrcweir 	const sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 	if(nMarkAnz && !ImpIsFrameHandles())
79*cdf0e10cSrcweir 	{
80*cdf0e10cSrcweir 		bool b1stSmooth(true);
81*cdf0e10cSrcweir 		bool b1stSegm(true);
82*cdf0e10cSrcweir 		bool bCurve(false);
83*cdf0e10cSrcweir 		bool bSmoothFuz(false);
84*cdf0e10cSrcweir 		bool bSegmFuz(false);
85*cdf0e10cSrcweir 		basegfx::B2VectorContinuity eSmooth = basegfx::CONTINUITY_NONE;
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 		for(sal_uIntPtr nMarkNum(0L); nMarkNum < nMarkAnz; nMarkNum++)
88*cdf0e10cSrcweir 		{
89*cdf0e10cSrcweir 			SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
90*cdf0e10cSrcweir 			CheckPolyPossibilitiesHelper( pM, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
91*cdf0e10cSrcweir 		}
92*cdf0e10cSrcweir 	}
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth )
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir 	SdrObject* pObj = pM->GetMarkedSdrObj();
98*cdf0e10cSrcweir 	SdrUShortCont* pPts = pM->GetMarkedPoints();
99*cdf0e10cSrcweir 	SdrPathObj* pPath = PTR_CAST(SdrPathObj,pObj);
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 	if(pPath && pPts)
102*cdf0e10cSrcweir 	{
103*cdf0e10cSrcweir 		const sal_uInt32 nMarkedPntAnz(pPts->GetCount());
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 		if(nMarkedPntAnz)
106*cdf0e10cSrcweir 		{
107*cdf0e10cSrcweir 			bool bClosed(pPath->IsClosed());
108*cdf0e10cSrcweir 			bSetMarkedPointsSmoothPossible = true;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 			if(bClosed)
111*cdf0e10cSrcweir 			{
112*cdf0e10cSrcweir 				bSetMarkedSegmentsKindPossible = true;
113*cdf0e10cSrcweir 			}
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 			for(sal_uInt32 nMarkedPntNum(0L); nMarkedPntNum < nMarkedPntAnz; nMarkedPntNum++)
116*cdf0e10cSrcweir 			{
117*cdf0e10cSrcweir 				sal_uInt32 nNum(pPts->GetObject(nMarkedPntNum));
118*cdf0e10cSrcweir 				sal_uInt32 nPolyNum, nPntNum;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 				if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
121*cdf0e10cSrcweir 				{
122*cdf0e10cSrcweir 					const basegfx::B2DPolygon aLocalPolygon(pPath->GetPathPoly().getB2DPolygon(nPolyNum));
123*cdf0e10cSrcweir 					bool bCanSegment(bClosed || nPntNum < aLocalPolygon.count() - 1L);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 					if(!bSetMarkedSegmentsKindPossible && bCanSegment)
126*cdf0e10cSrcweir 					{
127*cdf0e10cSrcweir 						bSetMarkedSegmentsKindPossible = true;
128*cdf0e10cSrcweir 					}
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 					if(!bSmoothFuz)
131*cdf0e10cSrcweir 					{
132*cdf0e10cSrcweir 						if (b1stSmooth)
133*cdf0e10cSrcweir 						{
134*cdf0e10cSrcweir 							b1stSmooth = false;
135*cdf0e10cSrcweir 							eSmooth = basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum);
136*cdf0e10cSrcweir 						}
137*cdf0e10cSrcweir 						else
138*cdf0e10cSrcweir 						{
139*cdf0e10cSrcweir 							bSmoothFuz = (eSmooth != basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum));
140*cdf0e10cSrcweir 						}
141*cdf0e10cSrcweir 					}
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 					if(!bSegmFuz)
144*cdf0e10cSrcweir 					{
145*cdf0e10cSrcweir 						if(bCanSegment)
146*cdf0e10cSrcweir 						{
147*cdf0e10cSrcweir 							bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 							if(b1stSegm)
150*cdf0e10cSrcweir 							{
151*cdf0e10cSrcweir 								b1stSegm = false;
152*cdf0e10cSrcweir 								bCurve = bCrv;
153*cdf0e10cSrcweir 							}
154*cdf0e10cSrcweir 							else
155*cdf0e10cSrcweir 							{
156*cdf0e10cSrcweir 								bSegmFuz = (bCrv != bCurve);
157*cdf0e10cSrcweir 							}
158*cdf0e10cSrcweir 						}
159*cdf0e10cSrcweir 					}
160*cdf0e10cSrcweir 				}
161*cdf0e10cSrcweir 			}
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 			if(!b1stSmooth && !bSmoothFuz)
164*cdf0e10cSrcweir 			{
165*cdf0e10cSrcweir 				if(basegfx::CONTINUITY_NONE == eSmooth)
166*cdf0e10cSrcweir 				{
167*cdf0e10cSrcweir 					eMarkedPointsSmooth = SDRPATHSMOOTH_ANGULAR;
168*cdf0e10cSrcweir 				}
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 				if(basegfx::CONTINUITY_C1 == eSmooth)
171*cdf0e10cSrcweir 				{
172*cdf0e10cSrcweir 					eMarkedPointsSmooth = SDRPATHSMOOTH_ASYMMETRIC;
173*cdf0e10cSrcweir 				}
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 				if(basegfx::CONTINUITY_C2 == eSmooth)
176*cdf0e10cSrcweir 				{
177*cdf0e10cSrcweir 					eMarkedPointsSmooth = SDRPATHSMOOTH_SYMMETRIC;
178*cdf0e10cSrcweir 				}
179*cdf0e10cSrcweir 			}
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 			if(!b1stSegm && !bSegmFuz)
182*cdf0e10cSrcweir 			{
183*cdf0e10cSrcweir 				eMarkedSegmentsKind = (bCurve) ? SDRPATHSEGMENT_CURVE : SDRPATHSEGMENT_LINE;
184*cdf0e10cSrcweir 			}
185*cdf0e10cSrcweir 		}
186*cdf0e10cSrcweir 	}
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 	basegfx::B2VectorContinuity eFlags;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	if(SDRPATHSMOOTH_ANGULAR == eKind)
194*cdf0e10cSrcweir 	{
195*cdf0e10cSrcweir 		eFlags = basegfx::CONTINUITY_NONE;
196*cdf0e10cSrcweir 	}
197*cdf0e10cSrcweir 	else if(SDRPATHSMOOTH_ASYMMETRIC == eKind)
198*cdf0e10cSrcweir 	{
199*cdf0e10cSrcweir 		eFlags = basegfx::CONTINUITY_C1;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir 	else if(SDRPATHSMOOTH_SYMMETRIC == eKind)
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		eFlags = basegfx::CONTINUITY_C2;
204*cdf0e10cSrcweir 	}
205*cdf0e10cSrcweir 	else
206*cdf0e10cSrcweir 	{
207*cdf0e10cSrcweir 		return;
208*cdf0e10cSrcweir 	}
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	if(HasMarkedPoints())
211*cdf0e10cSrcweir 	{
212*cdf0e10cSrcweir 		SortMarkedObjects();
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
215*cdf0e10cSrcweir 		if( bUndo )
216*cdf0e10cSrcweir 			BegUndo(ImpGetResStr(STR_EditSetPointsSmooth), GetDescriptionOfMarkedPoints());
217*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 		for(sal_uIntPtr nMarkNum(nMarkAnz); nMarkNum > 0L;)
220*cdf0e10cSrcweir 		{
221*cdf0e10cSrcweir 			nMarkNum--;
222*cdf0e10cSrcweir 			SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
223*cdf0e10cSrcweir 			SdrUShortCont* pPts = pM->GetMarkedPoints();
224*cdf0e10cSrcweir 			SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 			if(pPts && pPath)
227*cdf0e10cSrcweir 			{
228*cdf0e10cSrcweir 				PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
229*cdf0e10cSrcweir 				if(aEditor.SetPointsSmooth( eFlags, pPts->getContainer() ) )
230*cdf0e10cSrcweir 				{
231*cdf0e10cSrcweir 					if( bUndo )
232*cdf0e10cSrcweir 						AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
233*cdf0e10cSrcweir 					pPath->SetPathPoly(aEditor.GetPolyPolygon());
234*cdf0e10cSrcweir 				}
235*cdf0e10cSrcweir 			}
236*cdf0e10cSrcweir 		}
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 		if( bUndo )
239*cdf0e10cSrcweir 			EndUndo();
240*cdf0e10cSrcweir 	}
241*cdf0e10cSrcweir }
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir 	if(HasMarkedPoints())
246*cdf0e10cSrcweir 	{
247*cdf0e10cSrcweir 		SortMarkedObjects();
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
250*cdf0e10cSrcweir 		if( bUndo )
251*cdf0e10cSrcweir 			BegUndo(ImpGetResStr(STR_EditSetSegmentsKind), GetDescriptionOfMarkedPoints());
252*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 		for(sal_uIntPtr nMarkNum(nMarkAnz); nMarkNum > 0L;)
255*cdf0e10cSrcweir 		{
256*cdf0e10cSrcweir 			nMarkNum--;
257*cdf0e10cSrcweir 			SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
258*cdf0e10cSrcweir 			SdrUShortCont* pPts = pM->GetMarkedPoints();
259*cdf0e10cSrcweir 			SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 			if(pPts && pPath)
262*cdf0e10cSrcweir 			{
263*cdf0e10cSrcweir 				PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
264*cdf0e10cSrcweir 				if(aEditor.SetSegmentsKind( eKind, pPts->getContainer()) )
265*cdf0e10cSrcweir 				{
266*cdf0e10cSrcweir 					if( bUndo )
267*cdf0e10cSrcweir 						AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
268*cdf0e10cSrcweir 					pPath->SetPathPoly(aEditor.GetPolyPolygon());
269*cdf0e10cSrcweir 				}
270*cdf0e10cSrcweir 			}
271*cdf0e10cSrcweir 		}
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 		if( bUndo )
274*cdf0e10cSrcweir 			EndUndo();
275*cdf0e10cSrcweir 	}
276*cdf0e10cSrcweir }
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir sal_Bool SdrPolyEditView::IsSetMarkedPointsSmoothPossible() const
279*cdf0e10cSrcweir {
280*cdf0e10cSrcweir 	ForcePossibilities();
281*cdf0e10cSrcweir 	return bSetMarkedPointsSmoothPossible;
282*cdf0e10cSrcweir }
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir SdrPathSmoothKind SdrPolyEditView::GetMarkedPointsSmooth() const
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir 	ForcePossibilities();
287*cdf0e10cSrcweir 	return eMarkedPointsSmooth;
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir sal_Bool SdrPolyEditView::IsSetMarkedSegmentsKindPossible() const
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir 	ForcePossibilities();
293*cdf0e10cSrcweir 	return bSetMarkedSegmentsKindPossible;
294*cdf0e10cSrcweir }
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir SdrPathSegmentKind SdrPolyEditView::GetMarkedSegmentsKind() const
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir 	ForcePossibilities();
299*cdf0e10cSrcweir 	return eMarkedSegmentsKind;
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir sal_Bool SdrPolyEditView::IsDeleteMarkedPointsPossible() const
303*cdf0e10cSrcweir {
304*cdf0e10cSrcweir 	return HasMarkedPoints();
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir void SdrPolyEditView::DeleteMarkedPoints()
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	if (HasMarkedPoints())
310*cdf0e10cSrcweir 	{
311*cdf0e10cSrcweir 		BrkAction();
312*cdf0e10cSrcweir 		SortMarkedObjects();
313*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
316*cdf0e10cSrcweir 		if( bUndo )
317*cdf0e10cSrcweir 		{
318*cdf0e10cSrcweir 			// Description
319*cdf0e10cSrcweir 			BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_DELETE);
320*cdf0e10cSrcweir 		}
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 		for (sal_uIntPtr nMarkNum=nMarkAnz; nMarkNum>0;)
323*cdf0e10cSrcweir 		{
324*cdf0e10cSrcweir 			nMarkNum--;
325*cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
326*cdf0e10cSrcweir 			SdrUShortCont* pPts=pM->GetMarkedPoints();
327*cdf0e10cSrcweir 			SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 			if( pPath && pPts )
330*cdf0e10cSrcweir 			{
331*cdf0e10cSrcweir 				PolyPolygonEditor aEditor( pPath ->GetPathPoly(), pPath->IsClosed() );
332*cdf0e10cSrcweir 				if( aEditor.DeletePoints( pPts->getContainer() ) )
333*cdf0e10cSrcweir 				{
334*cdf0e10cSrcweir 					if( aEditor.GetPolyPolygon().count() )
335*cdf0e10cSrcweir 					{
336*cdf0e10cSrcweir 						if( bUndo )
337*cdf0e10cSrcweir 							AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath ));
338*cdf0e10cSrcweir 						pPath->SetPathPoly( aEditor.GetPolyPolygon() );
339*cdf0e10cSrcweir 					}
340*cdf0e10cSrcweir 					else
341*cdf0e10cSrcweir 					{
342*cdf0e10cSrcweir 						if( bUndo )
343*cdf0e10cSrcweir 							AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) );
344*cdf0e10cSrcweir 						pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum());
345*cdf0e10cSrcweir 						if( !bUndo )
346*cdf0e10cSrcweir 						{
347*cdf0e10cSrcweir 							SdrObject* pObj = pPath;
348*cdf0e10cSrcweir 							SdrObject::Free(pObj);
349*cdf0e10cSrcweir 						}
350*cdf0e10cSrcweir 					}
351*cdf0e10cSrcweir 				}
352*cdf0e10cSrcweir 			}
353*cdf0e10cSrcweir 		}
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 		if( bUndo )
356*cdf0e10cSrcweir 			EndUndo();
357*cdf0e10cSrcweir 		UnmarkAllPoints();
358*cdf0e10cSrcweir 		MarkListHasChanged();
359*cdf0e10cSrcweir 	}
360*cdf0e10cSrcweir }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir void SdrPolyEditView::RipUpAtMarkedPoints()
363*cdf0e10cSrcweir {
364*cdf0e10cSrcweir 	if(HasMarkedPoints())
365*cdf0e10cSrcweir 	{
366*cdf0e10cSrcweir 		SortMarkedObjects();
367*cdf0e10cSrcweir 		sal_uInt32 nMarkAnz(GetMarkedObjectCount());
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
370*cdf0e10cSrcweir 		if( bUndo )
371*cdf0e10cSrcweir 			BegUndo(ImpGetResStr(STR_EditRipUp), GetDescriptionOfMarkedPoints());
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 		for(sal_uInt32 nMarkNum(nMarkAnz); nMarkNum > 0L;)
374*cdf0e10cSrcweir 		{
375*cdf0e10cSrcweir 			nMarkNum--;
376*cdf0e10cSrcweir 			SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
377*cdf0e10cSrcweir 			SdrUShortCont* pPts = pM->GetMarkedPoints();
378*cdf0e10cSrcweir 			SdrPathObj* pObj = PTR_CAST(SdrPathObj, pM->GetMarkedSdrObj());
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 			if(pPts && pObj)
381*cdf0e10cSrcweir 			{
382*cdf0e10cSrcweir 				pPts->ForceSort();
383*cdf0e10cSrcweir 				if( bUndo )
384*cdf0e10cSrcweir 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
385*cdf0e10cSrcweir 				sal_Bool bKorregFlag(sal_False);
386*cdf0e10cSrcweir 				sal_Bool bInsAny(sal_False);
387*cdf0e10cSrcweir 				sal_uInt32 nMarkPtsAnz(pPts->GetCount());
388*cdf0e10cSrcweir 				sal_uInt32 nMax(pObj->GetHdlCount());
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 				for(sal_uInt32 i(nMarkPtsAnz); i > 0L;)
391*cdf0e10cSrcweir 				{
392*cdf0e10cSrcweir 					i--;
393*cdf0e10cSrcweir 					sal_uInt32 nNewPt0Idx(0L);
394*cdf0e10cSrcweir 					SdrObject* pNeuObj = pObj->RipPoint(pPts->GetObject(i), nNewPt0Idx);
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 					if(pNeuObj)
397*cdf0e10cSrcweir 					{
398*cdf0e10cSrcweir 						bInsAny = sal_True;
399*cdf0e10cSrcweir 						SdrInsertReason aReason(SDRREASON_VIEWCALL, pObj);
400*cdf0e10cSrcweir 						pM->GetPageView()->GetObjList()->InsertObject(pNeuObj, pObj->GetOrdNum() + 1, &aReason);
401*cdf0e10cSrcweir 						if( bUndo )
402*cdf0e10cSrcweir 							AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
403*cdf0e10cSrcweir 						MarkObj(pNeuObj, pM->GetPageView(), sal_False, sal_True);
404*cdf0e10cSrcweir 					}
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir 					if(nNewPt0Idx)
407*cdf0e10cSrcweir 					{
408*cdf0e10cSrcweir 						// Korrektur notwendig?
409*cdf0e10cSrcweir 						DBG_ASSERT(bKorregFlag==sal_False,"Mehrfache Indexkorrektur bei SdrPolyEditView::RipUp()");
410*cdf0e10cSrcweir 						if(!bKorregFlag)
411*cdf0e10cSrcweir 						{
412*cdf0e10cSrcweir 							bKorregFlag = sal_True;
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir 							for(sal_uInt32 nBla(0L); nBla < nMarkPtsAnz; nBla++)
415*cdf0e10cSrcweir 							{
416*cdf0e10cSrcweir 								sal_uInt32 nPntNum(pPts->GetObject(nBla));
417*cdf0e10cSrcweir 								nPntNum += nNewPt0Idx;
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir 								if(nPntNum >= nMax)
420*cdf0e10cSrcweir 								{
421*cdf0e10cSrcweir 									nPntNum -= nMax;
422*cdf0e10cSrcweir 								}
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 								pPts->Replace((sal_uInt16)nPntNum, nBla);
425*cdf0e10cSrcweir 							}
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir 							i = nMarkPtsAnz; // ... und nochmal von vorn
428*cdf0e10cSrcweir 						}
429*cdf0e10cSrcweir 					}
430*cdf0e10cSrcweir 				}
431*cdf0e10cSrcweir 			}
432*cdf0e10cSrcweir 		}
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 		UnmarkAllPoints();
435*cdf0e10cSrcweir 		if( bUndo )
436*cdf0e10cSrcweir 			EndUndo();
437*cdf0e10cSrcweir 		MarkListHasChanged();
438*cdf0e10cSrcweir 	}
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	bool bRetval(false);
444*cdf0e10cSrcweir 	const sal_uInt32 nMarkCount(GetMarkedObjectCount());
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir 	for(sal_uInt32 a(0); a < nMarkCount; a++)
447*cdf0e10cSrcweir 	{
448*cdf0e10cSrcweir 		const SdrMark* pMark = GetSdrMarkByIndex(a);
449*cdf0e10cSrcweir 		const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir 		if(pMarkedPathObject)
452*cdf0e10cSrcweir 		{
453*cdf0e10cSrcweir 			const SdrUShortCont* pSelectedPoints = pMark->GetMarkedPoints();
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 			if(pSelectedPoints && pSelectedPoints->GetCount())
456*cdf0e10cSrcweir 			{
457*cdf0e10cSrcweir 				const basegfx::B2DPolyPolygon& rPathPolyPolygon = pMarkedPathObject->GetPathPoly();
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir 				if(1 == rPathPolyPolygon.count())
460*cdf0e10cSrcweir 				{
461*cdf0e10cSrcweir 					// #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
462*cdf0e10cSrcweir 					// are different and methods need to be changed thoroughly with interaction rework
463*cdf0e10cSrcweir 					const Polygon aPathPolygon(rPathPolyPolygon.getB2DPolygon(0));
464*cdf0e10cSrcweir 					const sal_uInt16 nPointCount(aPathPolygon.GetSize());
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 					if(nPointCount >= 3)
467*cdf0e10cSrcweir 					{
468*cdf0e10cSrcweir 						bRetval = pMarkedPathObject->IsClosedObj(); // #i76617# aPathPolygon.isClosed();
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir 						for(sal_uInt32 b(0); !bRetval && b < pSelectedPoints->GetCount(); b++)
471*cdf0e10cSrcweir 						{
472*cdf0e10cSrcweir 							const sal_uInt16 nMarkedPointNum(pSelectedPoints->GetObject(b));
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir 							bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
475*cdf0e10cSrcweir 						}
476*cdf0e10cSrcweir 					}
477*cdf0e10cSrcweir 				}
478*cdf0e10cSrcweir 			}
479*cdf0e10cSrcweir 		}
480*cdf0e10cSrcweir 	}
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 	return bRetval;
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir bool SdrPolyEditView::IsOpenCloseMarkedObjectsPossible() const
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir 	bool bRetval(false);
488*cdf0e10cSrcweir 	const sal_uInt32 nMarkCount(GetMarkedObjectCount());
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 	for(sal_uInt32 a(0); a < nMarkCount; a++)
491*cdf0e10cSrcweir 	{
492*cdf0e10cSrcweir 		const SdrMark* pMark = GetSdrMarkByIndex(a);
493*cdf0e10cSrcweir 		const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 		if(pMarkedPathObject)
496*cdf0e10cSrcweir 		{
497*cdf0e10cSrcweir 			// #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
498*cdf0e10cSrcweir 			// are different and methods need to be changed thoroughly with interaction rework
499*cdf0e10cSrcweir 			const PolyPolygon aPathPolyPolygon(pMarkedPathObject->GetPathPoly());
500*cdf0e10cSrcweir 			const sal_uInt16 nPolygonCount(aPathPolyPolygon.Count());
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 			for(sal_uInt16 b(0); !bRetval && b < nPolygonCount; b++)
503*cdf0e10cSrcweir 			{
504*cdf0e10cSrcweir 				const Polygon& rPathPolygon = aPathPolyPolygon[b];
505*cdf0e10cSrcweir 				const sal_uInt16 nPointCount(rPathPolygon.GetSize());
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 				bRetval = (nPointCount >= 3);
508*cdf0e10cSrcweir 			}
509*cdf0e10cSrcweir 		}
510*cdf0e10cSrcweir 	}
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir 	return bRetval;
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir SdrObjClosedKind SdrPolyEditView::GetMarkedObjectsClosedState() const
516*cdf0e10cSrcweir {
517*cdf0e10cSrcweir 	bool bOpen(false);
518*cdf0e10cSrcweir 	bool bClosed(false);
519*cdf0e10cSrcweir 	const sal_uInt32 nMarkCount(GetMarkedObjectCount());
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 	for(sal_uInt32 a(0); !(bOpen && bClosed) && a < nMarkCount; a++)
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir 		const SdrMark* pMark = GetSdrMarkByIndex(a);
524*cdf0e10cSrcweir 		const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir 		if(pMarkedPathObject)
527*cdf0e10cSrcweir 		{
528*cdf0e10cSrcweir 			if(pMarkedPathObject->IsClosedObj())
529*cdf0e10cSrcweir 			{
530*cdf0e10cSrcweir 				bClosed = true;
531*cdf0e10cSrcweir 			}
532*cdf0e10cSrcweir 			else
533*cdf0e10cSrcweir 			{
534*cdf0e10cSrcweir 				bOpen = true;
535*cdf0e10cSrcweir 			}
536*cdf0e10cSrcweir 		}
537*cdf0e10cSrcweir 	}
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir 	if(bOpen && bClosed)
540*cdf0e10cSrcweir 	{
541*cdf0e10cSrcweir 		return SDROBJCLOSED_DONTCARE;
542*cdf0e10cSrcweir 	}
543*cdf0e10cSrcweir 	else if(bOpen)
544*cdf0e10cSrcweir 	{
545*cdf0e10cSrcweir 		return SDROBJCLOSED_OPEN;
546*cdf0e10cSrcweir 	}
547*cdf0e10cSrcweir 	else
548*cdf0e10cSrcweir 	{
549*cdf0e10cSrcweir 		return SDROBJCLOSED_CLOSED;
550*cdf0e10cSrcweir 	}
551*cdf0e10cSrcweir }
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir void SdrPolyEditView::ShutMarkedObjects()
554*cdf0e10cSrcweir {
555*cdf0e10cSrcweir 	CloseMarkedObjects();
556*cdf0e10cSrcweir }
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir void SdrPolyEditView::CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen) // , long nOpenDistance)
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir 	if (AreObjectsMarked())
561*cdf0e10cSrcweir 	{
562*cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
563*cdf0e10cSrcweir 		if( bUndo )
564*cdf0e10cSrcweir 			BegUndo(ImpGetResStr(STR_EditShut),GetDescriptionOfMarkedPoints());
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 		bool bChg=false;
567*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
568*cdf0e10cSrcweir 		for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
569*cdf0e10cSrcweir 		{
570*cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nm);
571*cdf0e10cSrcweir 			SdrObject* pO=pM->GetMarkedSdrObj();
572*cdf0e10cSrcweir 			sal_Bool bClosed=pO->IsClosedObj();
573*cdf0e10cSrcweir 			if (pO->IsPolyObj() && (bClosed==bOpen) || bToggle)
574*cdf0e10cSrcweir 			{
575*cdf0e10cSrcweir 				if( bUndo )
576*cdf0e10cSrcweir 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 				SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( pO );
579*cdf0e10cSrcweir 				if(pPathObj)
580*cdf0e10cSrcweir 					pPathObj->ToggleClosed();
581*cdf0e10cSrcweir 				bChg=true;
582*cdf0e10cSrcweir 			}
583*cdf0e10cSrcweir 		}
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir 		if( bUndo )
586*cdf0e10cSrcweir 			EndUndo();
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 		if (bChg)
589*cdf0e10cSrcweir 		{
590*cdf0e10cSrcweir 			UnmarkAllPoints();
591*cdf0e10cSrcweir 			MarkListHasChanged();
592*cdf0e10cSrcweir 		}
593*cdf0e10cSrcweir 	}
594*cdf0e10cSrcweir }
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir void SdrPolyEditView::ImpCopyMarkedPoints()
599*cdf0e10cSrcweir {
600*cdf0e10cSrcweir }
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
605*cdf0e10cSrcweir {
606*cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
609*cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
610*cdf0e10cSrcweir 	{
611*cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
612*cdf0e10cSrcweir 		SdrObject* pObj=pM->GetMarkedSdrObj();
613*cdf0e10cSrcweir 		const SdrUShortCont* pPts=pM->GetMarkedPoints();
614*cdf0e10cSrcweir 		sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
615*cdf0e10cSrcweir 		SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj);
616*cdf0e10cSrcweir 		if (nPtAnz!=0 && pPath!=NULL)
617*cdf0e10cSrcweir 		{
618*cdf0e10cSrcweir 			if( bUndo )
619*cdf0e10cSrcweir 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 			for(sal_uInt32 nPtNum(0L); nPtNum < nPtAnz; nPtNum++)
624*cdf0e10cSrcweir 			{
625*cdf0e10cSrcweir 				sal_uInt32 nPt(pPts->GetObject(nPtNum));
626*cdf0e10cSrcweir 				sal_uInt32 nPolyNum, nPointNum;
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 				if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
629*cdf0e10cSrcweir 				{
630*cdf0e10cSrcweir 					//#i83671# used nLocalPointNum (which was the polygon point count)
631*cdf0e10cSrcweir 					// instead of the point index (nPointNum). This of course leaded
632*cdf0e10cSrcweir 					// to a wrong point access to the B2DPolygon.
633*cdf0e10cSrcweir 					basegfx::B2DPolygon aNewXP(aXPP.getB2DPolygon(nPolyNum));
634*cdf0e10cSrcweir 					Point aPos, aC1, aC2;
635*cdf0e10cSrcweir 					bool bC1(false);
636*cdf0e10cSrcweir 					bool bC2(false);
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 					const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
639*cdf0e10cSrcweir 					aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir 					if(aNewXP.isPrevControlPointUsed(nPointNum))
642*cdf0e10cSrcweir 					{
643*cdf0e10cSrcweir 						const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
644*cdf0e10cSrcweir 						aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
645*cdf0e10cSrcweir 						bC1 = true;
646*cdf0e10cSrcweir 					}
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 					if(aNewXP.isNextControlPointUsed(nPointNum))
649*cdf0e10cSrcweir 					{
650*cdf0e10cSrcweir 						const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
651*cdf0e10cSrcweir 						aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
652*cdf0e10cSrcweir 						bC2 = true;
653*cdf0e10cSrcweir 					}
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 					(*pTrFunc)(aPos,&aC1,&aC2,p1,p2,p3,p4,p5);
656*cdf0e10cSrcweir 					aNewXP.setB2DPoint(nPointNum, basegfx::B2DPoint(aPos.X(), aPos.Y()));
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 					if (bC1)
659*cdf0e10cSrcweir 					{
660*cdf0e10cSrcweir 						aNewXP.setPrevControlPoint(nPointNum, basegfx::B2DPoint(aC1.X(), aC1.Y()));
661*cdf0e10cSrcweir 					}
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir 					if (bC2)
664*cdf0e10cSrcweir 					{
665*cdf0e10cSrcweir 						aNewXP.setNextControlPoint(nPointNum, basegfx::B2DPoint(aC2.X(), aC2.Y()));
666*cdf0e10cSrcweir 					}
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir 					aXPP.setB2DPolygon(nPolyNum, aNewXP);
669*cdf0e10cSrcweir 				}
670*cdf0e10cSrcweir 			}
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 			pPath->SetPathPoly(aXPP);
673*cdf0e10cSrcweir 		}
674*cdf0e10cSrcweir 	}
675*cdf0e10cSrcweir }
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir static void ImpMove(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
680*cdf0e10cSrcweir {
681*cdf0e10cSrcweir 	MovePoint(rPt,*(const Size*)p1);
682*cdf0e10cSrcweir 	if (pC1!=NULL) MovePoint(*pC1,*(const Size*)p1);
683*cdf0e10cSrcweir 	if (pC2!=NULL) MovePoint(*pC2,*(const Size*)p1);
684*cdf0e10cSrcweir }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz, bool bCopy)
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir 	bCopy=sal_False; // noch nicht implementiert
689*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
690*cdf0e10cSrcweir 	XubString aStr(ImpGetResStr(STR_EditMove));
691*cdf0e10cSrcweir 	if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
692*cdf0e10cSrcweir 	BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_MOVE);
693*cdf0e10cSrcweir 	if (bCopy) ImpCopyMarkedPoints();
694*cdf0e10cSrcweir 	ImpTransformMarkedPoints(ImpMove,&rSiz);
695*cdf0e10cSrcweir 	EndUndo();
696*cdf0e10cSrcweir 	AdjustMarkHdl();
697*cdf0e10cSrcweir }
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir static void ImpResize(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
702*cdf0e10cSrcweir {
703*cdf0e10cSrcweir 	ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
704*cdf0e10cSrcweir 	if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
705*cdf0e10cSrcweir 	if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
706*cdf0e10cSrcweir }
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
709*cdf0e10cSrcweir {
710*cdf0e10cSrcweir 	bCopy=sal_False; // noch nicht implementiert
711*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
712*cdf0e10cSrcweir 	XubString aStr(ImpGetResStr(STR_EditResize));
713*cdf0e10cSrcweir 	if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
714*cdf0e10cSrcweir 	BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_RESIZE);
715*cdf0e10cSrcweir 	if (bCopy) ImpCopyMarkedPoints();
716*cdf0e10cSrcweir 	ImpTransformMarkedPoints(ImpResize,&rRef,&xFact,&yFact);
717*cdf0e10cSrcweir 	EndUndo();
718*cdf0e10cSrcweir 	AdjustMarkHdl();
719*cdf0e10cSrcweir }
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir static void ImpRotate(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
724*cdf0e10cSrcweir {
725*cdf0e10cSrcweir 	RotatePoint(rPt,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
726*cdf0e10cSrcweir 	if (pC1!=NULL) RotatePoint(*pC1,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
727*cdf0e10cSrcweir 	if (pC2!=NULL) RotatePoint(*pC2,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
728*cdf0e10cSrcweir }
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, long nWink, bool bCopy)
731*cdf0e10cSrcweir {
732*cdf0e10cSrcweir 	bCopy=sal_False; // noch nicht implementiert
733*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
734*cdf0e10cSrcweir 	XubString aStr(ImpGetResStr(STR_EditResize));
735*cdf0e10cSrcweir 	if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
736*cdf0e10cSrcweir 	BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_ROTATE);
737*cdf0e10cSrcweir 	if (bCopy) ImpCopyMarkedPoints();
738*cdf0e10cSrcweir 	double nSin=sin(nWink*nPi180);
739*cdf0e10cSrcweir 	double nCos=cos(nWink*nPi180);
740*cdf0e10cSrcweir 	ImpTransformMarkedPoints(ImpRotate,&rRef,&nWink,&nSin,&nCos);
741*cdf0e10cSrcweir 	EndUndo();
742*cdf0e10cSrcweir 	AdjustMarkHdl();
743*cdf0e10cSrcweir }
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir // eof
746