merge the formfield patch from ooo-build
[ooovba.git] / svx / source / svdraw / svdpoev.cxx
blob9f6fd4da5ce48baa0b80e3784e0412ec45e49312
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdpoev.cxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include <svx/svdpoev.hxx>
35 #include <math.h>
36 #include <svx/svdpagv.hxx>
37 #include <svx/svdpage.hxx>
38 #include <svx/svdopath.hxx>
39 #include <svx/svdundo.hxx>
40 #include "svdstr.hrc" // Namen aus der Resource
41 #include "svdglob.hxx" // StringCache
42 #include <svx/svdtrans.hxx>
43 #include <basegfx/polygon/b2dpolygon.hxx>
44 #include <basegfx/polygon/b2dpolygontools.hxx>
45 #include <vcl/salbtype.hxx> // FRound
47 #include <svx/polypolygoneditor.hxx>
49 using namespace sdr;
51 ////////////////////////////////////////////////////////////////////////////////////////////////////
53 void SdrPolyEditView::ImpResetPolyPossibilityFlags()
55 eMarkedPointsSmooth=SDRPATHSMOOTH_DONTCARE;
56 eMarkedSegmentsKind=SDRPATHSEGMENT_DONTCARE;
57 bSetMarkedPointsSmoothPossible=FALSE;
58 bSetMarkedSegmentsKindPossible=FALSE;
61 void SdrPolyEditView::ImpClearVars()
63 ImpResetPolyPossibilityFlags();
66 SdrPolyEditView::SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut):
67 SdrEditView(pModel1,pOut)
69 ImpClearVars();
72 SdrPolyEditView::~SdrPolyEditView()
76 void SdrPolyEditView::ImpCheckPolyPossibilities()
78 ImpResetPolyPossibilityFlags();
79 const ULONG nMarkAnz(GetMarkedObjectCount());
81 if(nMarkAnz && !ImpIsFrameHandles())
83 bool b1stSmooth(true);
84 bool b1stSegm(true);
85 bool bCurve(false);
86 bool bSmoothFuz(false);
87 bool bSegmFuz(false);
88 basegfx::B2VectorContinuity eSmooth = basegfx::CONTINUITY_NONE;
90 for(ULONG nMarkNum(0L); nMarkNum < nMarkAnz; nMarkNum++)
92 SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
93 CheckPolyPossibilitiesHelper( pM, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
98 void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth )
100 SdrObject* pObj = pM->GetMarkedSdrObj();
101 SdrUShortCont* pPts = pM->GetMarkedPoints();
102 SdrPathObj* pPath = PTR_CAST(SdrPathObj,pObj);
104 if(pPath && pPts)
106 const sal_uInt32 nMarkedPntAnz(pPts->GetCount());
108 if(nMarkedPntAnz)
110 bool bClosed(pPath->IsClosed());
111 bSetMarkedPointsSmoothPossible = true;
113 if(bClosed)
115 bSetMarkedSegmentsKindPossible = true;
118 for(sal_uInt32 nMarkedPntNum(0L); nMarkedPntNum < nMarkedPntAnz; nMarkedPntNum++)
120 sal_uInt32 nNum(pPts->GetObject(nMarkedPntNum));
121 sal_uInt32 nPolyNum, nPntNum;
123 if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
125 const basegfx::B2DPolygon aLocalPolygon(pPath->GetPathPoly().getB2DPolygon(nPolyNum));
126 bool bCanSegment(bClosed || nPntNum < aLocalPolygon.count() - 1L);
128 if(!bSetMarkedSegmentsKindPossible && bCanSegment)
130 bSetMarkedSegmentsKindPossible = true;
133 if(!bSmoothFuz)
135 if (b1stSmooth)
137 b1stSmooth = false;
138 eSmooth = basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum);
140 else
142 bSmoothFuz = (eSmooth != basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum));
146 if(!bSegmFuz)
148 if(bCanSegment)
150 bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
152 if(b1stSegm)
154 b1stSegm = false;
155 bCurve = bCrv;
157 else
159 bSegmFuz = (bCrv != bCurve);
166 if(!b1stSmooth && !bSmoothFuz)
168 if(basegfx::CONTINUITY_NONE == eSmooth)
170 eMarkedPointsSmooth = SDRPATHSMOOTH_ANGULAR;
173 if(basegfx::CONTINUITY_C1 == eSmooth)
175 eMarkedPointsSmooth = SDRPATHSMOOTH_ASYMMETRIC;
178 if(basegfx::CONTINUITY_C2 == eSmooth)
180 eMarkedPointsSmooth = SDRPATHSMOOTH_SYMMETRIC;
184 if(!b1stSegm && !bSegmFuz)
186 eMarkedSegmentsKind = (bCurve) ? SDRPATHSEGMENT_CURVE : SDRPATHSEGMENT_LINE;
192 void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
194 basegfx::B2VectorContinuity eFlags;
196 if(SDRPATHSMOOTH_ANGULAR == eKind)
198 eFlags = basegfx::CONTINUITY_NONE;
200 else if(SDRPATHSMOOTH_ASYMMETRIC == eKind)
202 eFlags = basegfx::CONTINUITY_C1;
204 else if(SDRPATHSMOOTH_SYMMETRIC == eKind)
206 eFlags = basegfx::CONTINUITY_C2;
208 else
210 return;
213 if(HasMarkedPoints())
215 SortMarkedObjects();
217 const bool bUndo = IsUndoEnabled();
218 if( bUndo )
219 BegUndo(ImpGetResStr(STR_EditSetPointsSmooth), GetDescriptionOfMarkedPoints());
220 ULONG nMarkAnz(GetMarkedObjectCount());
222 for(ULONG nMarkNum(nMarkAnz); nMarkNum > 0L;)
224 nMarkNum--;
225 SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
226 SdrUShortCont* pPts = pM->GetMarkedPoints();
227 SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
229 if(pPts && pPath)
231 PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
232 if(aEditor.SetPointsSmooth( eFlags, pPts->getContainer() ) )
234 if( bUndo )
235 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
236 pPath->SetPathPoly(aEditor.GetPolyPolygon());
241 if( bUndo )
242 EndUndo();
246 void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
248 if(HasMarkedPoints())
250 SortMarkedObjects();
252 const bool bUndo = IsUndoEnabled();
253 if( bUndo )
254 BegUndo(ImpGetResStr(STR_EditSetSegmentsKind), GetDescriptionOfMarkedPoints());
255 ULONG nMarkAnz(GetMarkedObjectCount());
257 for(ULONG nMarkNum(nMarkAnz); nMarkNum > 0L;)
259 nMarkNum--;
260 SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
261 SdrUShortCont* pPts = pM->GetMarkedPoints();
262 SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
264 if(pPts && pPath)
266 PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
267 if(aEditor.SetSegmentsKind( eKind, pPts->getContainer()) )
269 if( bUndo )
270 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
271 pPath->SetPathPoly(aEditor.GetPolyPolygon());
276 if( bUndo )
277 EndUndo();
281 BOOL SdrPolyEditView::IsSetMarkedPointsSmoothPossible() const
283 ForcePossibilities();
284 return bSetMarkedPointsSmoothPossible;
287 SdrPathSmoothKind SdrPolyEditView::GetMarkedPointsSmooth() const
289 ForcePossibilities();
290 return eMarkedPointsSmooth;
293 BOOL SdrPolyEditView::IsSetMarkedSegmentsKindPossible() const
295 ForcePossibilities();
296 return bSetMarkedSegmentsKindPossible;
299 SdrPathSegmentKind SdrPolyEditView::GetMarkedSegmentsKind() const
301 ForcePossibilities();
302 return eMarkedSegmentsKind;
305 BOOL SdrPolyEditView::IsDeleteMarkedPointsPossible() const
307 return HasMarkedPoints();
310 void SdrPolyEditView::DeleteMarkedPoints()
312 if (HasMarkedPoints())
314 BrkAction();
315 SortMarkedObjects();
316 ULONG nMarkAnz=GetMarkedObjectCount();
318 const bool bUndo = IsUndoEnabled();
319 if( bUndo )
321 // Description
322 BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_DELETE);
325 for (ULONG nMarkNum=nMarkAnz; nMarkNum>0;)
327 nMarkNum--;
328 SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
329 SdrUShortCont* pPts=pM->GetMarkedPoints();
330 SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
332 if( pPath && pPts )
334 PolyPolygonEditor aEditor( pPath ->GetPathPoly(), pPath->IsClosed() );
335 if( aEditor.DeletePoints( pPts->getContainer() ) )
337 if( aEditor.GetPolyPolygon().count() )
339 if( bUndo )
340 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath ));
341 pPath->SetPathPoly( aEditor.GetPolyPolygon() );
343 else
345 if( bUndo )
346 AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) );
347 pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum());
348 if( !bUndo )
350 SdrObject* pObj = pPath;
351 SdrObject::Free(pObj);
358 if( bUndo )
359 EndUndo();
360 UnmarkAllPoints();
361 MarkListHasChanged();
365 void SdrPolyEditView::RipUpAtMarkedPoints()
367 if(HasMarkedPoints())
369 SortMarkedObjects();
370 sal_uInt32 nMarkAnz(GetMarkedObjectCount());
372 const bool bUndo = IsUndoEnabled();
373 if( bUndo )
374 BegUndo(ImpGetResStr(STR_EditRipUp), GetDescriptionOfMarkedPoints());
376 for(sal_uInt32 nMarkNum(nMarkAnz); nMarkNum > 0L;)
378 nMarkNum--;
379 SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
380 SdrUShortCont* pPts = pM->GetMarkedPoints();
381 SdrPathObj* pObj = PTR_CAST(SdrPathObj, pM->GetMarkedSdrObj());
383 if(pPts && pObj)
385 pPts->ForceSort();
386 if( bUndo )
387 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
388 sal_Bool bKorregFlag(sal_False);
389 sal_Bool bInsAny(sal_False);
390 sal_uInt32 nMarkPtsAnz(pPts->GetCount());
391 sal_uInt32 nMax(pObj->GetHdlCount());
393 for(sal_uInt32 i(nMarkPtsAnz); i > 0L;)
395 i--;
396 sal_uInt32 nNewPt0Idx(0L);
397 SdrObject* pNeuObj = pObj->RipPoint(pPts->GetObject(i), nNewPt0Idx);
399 if(pNeuObj)
401 bInsAny = sal_True;
402 SdrInsertReason aReason(SDRREASON_VIEWCALL, pObj);
403 pM->GetPageView()->GetObjList()->InsertObject(pNeuObj, pObj->GetOrdNum() + 1, &aReason);
404 if( bUndo )
405 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
406 MarkObj(pNeuObj, pM->GetPageView(), FALSE, TRUE);
409 if(nNewPt0Idx)
411 // Korrektur notwendig?
412 DBG_ASSERT(bKorregFlag==FALSE,"Mehrfache Indexkorrektur bei SdrPolyEditView::RipUp()");
413 if(!bKorregFlag)
415 bKorregFlag = sal_True;
417 for(sal_uInt32 nBla(0L); nBla < nMarkPtsAnz; nBla++)
419 sal_uInt32 nPntNum(pPts->GetObject(nBla));
420 nPntNum += nNewPt0Idx;
422 if(nPntNum >= nMax)
424 nPntNum -= nMax;
427 pPts->Replace((sal_uInt16)nPntNum, nBla);
430 i = nMarkPtsAnz; // ... und nochmal von vorn
437 UnmarkAllPoints();
438 if( bUndo )
439 EndUndo();
440 MarkListHasChanged();
444 bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const
446 bool bRetval(false);
447 const sal_uInt32 nMarkCount(GetMarkedObjectCount());
449 for(sal_uInt32 a(0); a < nMarkCount; a++)
451 const SdrMark* pMark = GetSdrMarkByIndex(a);
452 const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
454 if(pMarkedPathObject)
456 const SdrUShortCont* pSelectedPoints = pMark->GetMarkedPoints();
458 if(pSelectedPoints && pSelectedPoints->GetCount())
460 const basegfx::B2DPolyPolygon& rPathPolyPolygon = pMarkedPathObject->GetPathPoly();
462 if(1 == rPathPolyPolygon.count())
464 // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
465 // are different and methods need to be changed thoroughly with interaction rework
466 const Polygon aPathPolygon(rPathPolyPolygon.getB2DPolygon(0));
467 const sal_uInt16 nPointCount(aPathPolygon.GetSize());
469 if(nPointCount >= 3)
471 bRetval = pMarkedPathObject->IsClosedObj(); // #i76617# aPathPolygon.isClosed();
473 for(sal_uInt32 b(0); !bRetval && b < pSelectedPoints->GetCount(); b++)
475 const sal_uInt16 nMarkedPointNum(pSelectedPoints->GetObject(b));
477 bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
485 return bRetval;
488 bool SdrPolyEditView::IsOpenCloseMarkedObjectsPossible() const
490 bool bRetval(false);
491 const sal_uInt32 nMarkCount(GetMarkedObjectCount());
493 for(sal_uInt32 a(0); a < nMarkCount; a++)
495 const SdrMark* pMark = GetSdrMarkByIndex(a);
496 const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
498 if(pMarkedPathObject)
500 // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
501 // are different and methods need to be changed thoroughly with interaction rework
502 const PolyPolygon aPathPolyPolygon(pMarkedPathObject->GetPathPoly());
503 const sal_uInt16 nPolygonCount(aPathPolyPolygon.Count());
505 for(sal_uInt16 b(0); !bRetval && b < nPolygonCount; b++)
507 const Polygon& rPathPolygon = aPathPolyPolygon[b];
508 const sal_uInt16 nPointCount(rPathPolygon.GetSize());
510 bRetval = (nPointCount >= 3);
515 return bRetval;
518 SdrObjClosedKind SdrPolyEditView::GetMarkedObjectsClosedState() const
520 bool bOpen(false);
521 bool bClosed(false);
522 const sal_uInt32 nMarkCount(GetMarkedObjectCount());
524 for(sal_uInt32 a(0); !(bOpen && bClosed) && a < nMarkCount; a++)
526 const SdrMark* pMark = GetSdrMarkByIndex(a);
527 const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
529 if(pMarkedPathObject)
531 if(pMarkedPathObject->IsClosedObj())
533 bClosed = true;
535 else
537 bOpen = true;
542 if(bOpen && bClosed)
544 return SDROBJCLOSED_DONTCARE;
546 else if(bOpen)
548 return SDROBJCLOSED_OPEN;
550 else
552 return SDROBJCLOSED_CLOSED;
556 void SdrPolyEditView::ShutMarkedObjects()
558 CloseMarkedObjects();
561 void SdrPolyEditView::CloseMarkedObjects(BOOL bToggle, BOOL bOpen) // , long nOpenDistance)
563 if (AreObjectsMarked())
565 const bool bUndo = IsUndoEnabled();
566 if( bUndo )
567 BegUndo(ImpGetResStr(STR_EditShut),GetDescriptionOfMarkedPoints());
569 bool bChg=false;
570 ULONG nMarkAnz=GetMarkedObjectCount();
571 for (ULONG nm=0; nm<nMarkAnz; nm++)
573 SdrMark* pM=GetSdrMarkByIndex(nm);
574 SdrObject* pO=pM->GetMarkedSdrObj();
575 BOOL bClosed=pO->IsClosedObj();
576 if (pO->IsPolyObj() && (bClosed==bOpen) || bToggle)
578 if( bUndo )
579 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
581 SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( pO );
582 if(pPathObj)
583 pPathObj->ToggleClosed();
584 bChg=true;
588 if( bUndo )
589 EndUndo();
591 if (bChg)
593 UnmarkAllPoints();
594 MarkListHasChanged();
599 ////////////////////////////////////////////////////////////////////////////////////////////////////
601 void SdrPolyEditView::ImpCopyMarkedPoints()
605 ////////////////////////////////////////////////////////////////////////////////////////////////////
607 void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
609 const bool bUndo = IsUndoEnabled();
611 ULONG nMarkAnz=GetMarkedObjectCount();
612 for (ULONG nm=0; nm<nMarkAnz; nm++)
614 SdrMark* pM=GetSdrMarkByIndex(nm);
615 SdrObject* pObj=pM->GetMarkedSdrObj();
616 const SdrUShortCont* pPts=pM->GetMarkedPoints();
617 ULONG nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
618 SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj);
619 if (nPtAnz!=0 && pPath!=NULL)
621 if( bUndo )
622 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
624 basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
626 for(sal_uInt32 nPtNum(0L); nPtNum < nPtAnz; nPtNum++)
628 sal_uInt32 nPt(pPts->GetObject(nPtNum));
629 sal_uInt32 nPolyNum, nPointNum;
631 if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
633 //#i83671# used nLocalPointNum (which was the polygon point count)
634 // instead of the point index (nPointNum). This of course leaded
635 // to a wrong point access to the B2DPolygon.
636 basegfx::B2DPolygon aNewXP(aXPP.getB2DPolygon(nPolyNum));
637 Point aPos, aC1, aC2;
638 bool bC1(false);
639 bool bC2(false);
641 const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
642 aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
644 if(aNewXP.isPrevControlPointUsed(nPointNum))
646 const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
647 aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
648 bC1 = true;
651 if(aNewXP.isNextControlPointUsed(nPointNum))
653 const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
654 aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
655 bC2 = true;
658 (*pTrFunc)(aPos,&aC1,&aC2,p1,p2,p3,p4,p5);
659 aNewXP.setB2DPoint(nPointNum, basegfx::B2DPoint(aPos.X(), aPos.Y()));
661 if (bC1)
663 aNewXP.setPrevControlPoint(nPointNum, basegfx::B2DPoint(aC1.X(), aC1.Y()));
666 if (bC2)
668 aNewXP.setNextControlPoint(nPointNum, basegfx::B2DPoint(aC2.X(), aC2.Y()));
671 aXPP.setB2DPolygon(nPolyNum, aNewXP);
675 pPath->SetPathPoly(aXPP);
680 ////////////////////////////////////////////////////////////////////////////////////////////////////
682 static void ImpMove(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
684 MovePoint(rPt,*(const Size*)p1);
685 if (pC1!=NULL) MovePoint(*pC1,*(const Size*)p1);
686 if (pC2!=NULL) MovePoint(*pC2,*(const Size*)p1);
689 void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz, bool bCopy)
691 bCopy=FALSE; // noch nicht implementiert
692 ForceUndirtyMrkPnt();
693 XubString aStr(ImpGetResStr(STR_EditMove));
694 if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
695 BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_MOVE);
696 if (bCopy) ImpCopyMarkedPoints();
697 ImpTransformMarkedPoints(ImpMove,&rSiz);
698 EndUndo();
699 AdjustMarkHdl();
702 ////////////////////////////////////////////////////////////////////////////////////////////////////
704 static void ImpResize(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
706 ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
707 if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
708 if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
711 void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
713 bCopy=FALSE; // noch nicht implementiert
714 ForceUndirtyMrkPnt();
715 XubString aStr(ImpGetResStr(STR_EditResize));
716 if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
717 BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_RESIZE);
718 if (bCopy) ImpCopyMarkedPoints();
719 ImpTransformMarkedPoints(ImpResize,&rRef,&xFact,&yFact);
720 EndUndo();
721 AdjustMarkHdl();
724 ////////////////////////////////////////////////////////////////////////////////////////////////////
726 static void ImpRotate(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
728 RotatePoint(rPt,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
729 if (pC1!=NULL) RotatePoint(*pC1,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
730 if (pC2!=NULL) RotatePoint(*pC2,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
733 void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, long nWink, bool bCopy)
735 bCopy=FALSE; // noch nicht implementiert
736 ForceUndirtyMrkPnt();
737 XubString aStr(ImpGetResStr(STR_EditResize));
738 if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
739 BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_ROTATE);
740 if (bCopy) ImpCopyMarkedPoints();
741 double nSin=sin(nWink*nPi180);
742 double nCos=cos(nWink*nPi180);
743 ImpTransformMarkedPoints(ImpRotate,&rRef,&nWink,&nSin,&nCos);
744 EndUndo();
745 AdjustMarkHdl();
748 // eof