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