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