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/svdglev.hxx>
28cdf0e10cSrcweir #include <math.h>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <svx/svdundo.hxx>
31cdf0e10cSrcweir #include "svx/svdstr.hrc" // Namen aus der Resource
32cdf0e10cSrcweir #include "svx/svdglob.hxx" // StringCache
33cdf0e10cSrcweir #include <svx/svdpagv.hxx>
34cdf0e10cSrcweir #include <svx/svdglue.hxx>
35cdf0e10cSrcweir #include <svx/svdtrans.hxx>
36cdf0e10cSrcweir #include <svx/svdobj.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
39cdf0e10cSrcweir
ImpClearVars()40cdf0e10cSrcweir void SdrGlueEditView::ImpClearVars()
41cdf0e10cSrcweir {
42cdf0e10cSrcweir }
43cdf0e10cSrcweir
SdrGlueEditView(SdrModel * pModel1,OutputDevice * pOut)44cdf0e10cSrcweir SdrGlueEditView::SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut):
45cdf0e10cSrcweir SdrPolyEditView(pModel1,pOut)
46cdf0e10cSrcweir {
47cdf0e10cSrcweir ImpClearVars();
48cdf0e10cSrcweir }
49cdf0e10cSrcweir
~SdrGlueEditView()50cdf0e10cSrcweir SdrGlueEditView::~SdrGlueEditView()
51cdf0e10cSrcweir {
52cdf0e10cSrcweir }
53cdf0e10cSrcweir
54cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
55cdf0e10cSrcweir
ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc,sal_Bool bConst,const void * p1,const void * p2,const void * p3,const void * p4,const void * p5)56cdf0e10cSrcweir void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, sal_Bool bConst, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
59cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
60cdf0e10cSrcweir SdrMark* pM=GetSdrMarkByIndex(nm);
61cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj();
62cdf0e10cSrcweir const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
63cdf0e10cSrcweir sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
64cdf0e10cSrcweir if (nPtAnz!=0) {
65cdf0e10cSrcweir SdrGluePointList* pGPL=NULL;
66cdf0e10cSrcweir if (bConst) {
67cdf0e10cSrcweir const SdrGluePointList* pConstGPL=pObj->GetGluePointList();
68cdf0e10cSrcweir pGPL=(SdrGluePointList*)pConstGPL;
69cdf0e10cSrcweir } else {
70cdf0e10cSrcweir pGPL=pObj->ForceGluePointList();
71cdf0e10cSrcweir }
72cdf0e10cSrcweir if (pGPL!=NULL)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir if(!bConst && IsUndoEnabled() )
75cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
76cdf0e10cSrcweir
77cdf0e10cSrcweir for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
78cdf0e10cSrcweir {
79cdf0e10cSrcweir sal_uInt16 nPtId=pPts->GetObject(nPtNum);
80cdf0e10cSrcweir sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
81cdf0e10cSrcweir if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
84cdf0e10cSrcweir (*pDoFunc)(rGP,pObj,p1,p2,p3,p4,p5);
85cdf0e10cSrcweir }
86cdf0e10cSrcweir }
87cdf0e10cSrcweir if (!bConst)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir pObj->SetChanged();
90cdf0e10cSrcweir pObj->BroadcastObjectChange();
91cdf0e10cSrcweir }
92cdf0e10cSrcweir }
93cdf0e10cSrcweir }
94cdf0e10cSrcweir }
95cdf0e10cSrcweir if (!bConst && nMarkAnz!=0) pMod->SetChanged();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
99cdf0e10cSrcweir
ImpGetEscDir(SdrGluePoint & rGP,const SdrObject *,const void * pbFirst,const void * pnThisEsc,const void * pnRet,const void *,const void *)100cdf0e10cSrcweir static void ImpGetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir sal_uInt16& nRet=*(sal_uInt16*)pnRet;
103cdf0e10cSrcweir sal_Bool& bFirst=*(sal_Bool*)pbFirst;
104cdf0e10cSrcweir if (nRet!=FUZZY) {
105cdf0e10cSrcweir sal_uInt16 nEsc=rGP.GetEscDir();
106cdf0e10cSrcweir sal_Bool bOn=(nEsc & *(sal_uInt16*)pnThisEsc)!=0;
107cdf0e10cSrcweir if (bFirst) { nRet=bOn; bFirst=sal_False; }
108cdf0e10cSrcweir else if (nRet!=bOn) nRet=FUZZY;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir }
111cdf0e10cSrcweir
IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const112cdf0e10cSrcweir TRISTATE SdrGlueEditView::IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const
113cdf0e10cSrcweir {
114cdf0e10cSrcweir ForceUndirtyMrkPnt();
115cdf0e10cSrcweir sal_Bool bFirst=sal_True;
116cdf0e10cSrcweir sal_uInt16 nRet=sal_False;
117cdf0e10cSrcweir ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetEscDir,sal_True,&bFirst,&nThisEsc,&nRet);
118cdf0e10cSrcweir return (TRISTATE)nRet;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
ImpSetEscDir(SdrGluePoint & rGP,const SdrObject *,const void * pnThisEsc,const void * pbOn,const void *,const void *,const void *)121cdf0e10cSrcweir static void ImpSetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir sal_uInt16 nEsc=rGP.GetEscDir();
124cdf0e10cSrcweir if (*(sal_Bool*)pbOn) nEsc|=*(sal_uInt16*)pnThisEsc;
125cdf0e10cSrcweir else nEsc&=~*(sal_uInt16*)pnThisEsc;
126cdf0e10cSrcweir rGP.SetEscDir(nEsc);
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc,sal_Bool bOn)129cdf0e10cSrcweir void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, sal_Bool bOn)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir ForceUndirtyMrkPnt();
132cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_EditSetGlueEscDir),GetDescriptionOfMarkedGluePoints());
133cdf0e10cSrcweir ImpDoMarkedGluePoints(ImpSetEscDir,sal_False,&nThisEsc,&bOn);
134cdf0e10cSrcweir EndUndo();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
138cdf0e10cSrcweir
ImpGetPercent(SdrGluePoint & rGP,const SdrObject *,const void * pbFirst,const void * pnRet,const void *,const void *,const void *)139cdf0e10cSrcweir static void ImpGetPercent(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
140cdf0e10cSrcweir {
141cdf0e10cSrcweir sal_uInt16& nRet=*(sal_uInt16*)pnRet;
142cdf0e10cSrcweir sal_Bool& bFirst=*(sal_Bool*)pbFirst;
143cdf0e10cSrcweir if (nRet!=FUZZY) {
144cdf0e10cSrcweir bool bOn=rGP.IsPercent();
145cdf0e10cSrcweir if (bFirst) { nRet=bOn; bFirst=sal_False; }
146cdf0e10cSrcweir else if ((nRet!=0)!=bOn) nRet=FUZZY;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
IsMarkedGluePointsPercent() const150cdf0e10cSrcweir TRISTATE SdrGlueEditView::IsMarkedGluePointsPercent() const
151cdf0e10cSrcweir {
152cdf0e10cSrcweir ForceUndirtyMrkPnt();
153cdf0e10cSrcweir sal_Bool bFirst=sal_True;
154cdf0e10cSrcweir sal_uInt16 nRet=sal_True;
155cdf0e10cSrcweir ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetPercent,sal_True,&bFirst,&nRet);
156cdf0e10cSrcweir return (TRISTATE)nRet;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir
ImpSetPercent(SdrGluePoint & rGP,const SdrObject * pObj,const void * pbOn,const void *,const void *,const void *,const void *)159cdf0e10cSrcweir static void ImpSetPercent(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbOn, const void*, const void*, const void*, const void*)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir Point aPos(rGP.GetAbsolutePos(*pObj));
162cdf0e10cSrcweir rGP.SetPercent(*(sal_Bool*)pbOn);
163cdf0e10cSrcweir rGP.SetAbsolutePos(aPos,*pObj);
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
SetMarkedGluePointsPercent(sal_Bool bOn)166cdf0e10cSrcweir void SdrGlueEditView::SetMarkedGluePointsPercent(sal_Bool bOn)
167cdf0e10cSrcweir {
168cdf0e10cSrcweir ForceUndirtyMrkPnt();
169cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_EditSetGluePercent),GetDescriptionOfMarkedGluePoints());
170cdf0e10cSrcweir ImpDoMarkedGluePoints(ImpSetPercent,sal_False,&bOn);
171cdf0e10cSrcweir EndUndo();
172cdf0e10cSrcweir }
173cdf0e10cSrcweir
174cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
175cdf0e10cSrcweir
ImpGetAlign(SdrGluePoint & rGP,const SdrObject *,const void * pbFirst,const void * pbDontCare,const void * pbVert,const void * pnRet,const void *)176cdf0e10cSrcweir static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
177cdf0e10cSrcweir {
178cdf0e10cSrcweir sal_uInt16& nRet=*(sal_uInt16*)pnRet;
179cdf0e10cSrcweir sal_Bool& bFirst=*(sal_Bool*)pbFirst;
180cdf0e10cSrcweir sal_Bool& bDontCare=*(sal_Bool*)pbDontCare;
181cdf0e10cSrcweir sal_Bool bVert=*(sal_Bool*)pbVert;
182cdf0e10cSrcweir if (!bDontCare) {
183cdf0e10cSrcweir sal_uInt16 nAlg=0;
184cdf0e10cSrcweir if (bVert) {
185cdf0e10cSrcweir nAlg=rGP.GetVertAlign();
186cdf0e10cSrcweir } else {
187cdf0e10cSrcweir nAlg=rGP.GetHorzAlign();
188cdf0e10cSrcweir }
189cdf0e10cSrcweir if (bFirst) { nRet=nAlg; bFirst=sal_False; }
190cdf0e10cSrcweir else if (nRet!=nAlg) {
191cdf0e10cSrcweir if (bVert) {
192cdf0e10cSrcweir nRet=SDRVERTALIGN_DONTCARE;
193cdf0e10cSrcweir } else {
194cdf0e10cSrcweir nRet=SDRHORZALIGN_DONTCARE;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir bDontCare=sal_True;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir }
199cdf0e10cSrcweir }
200cdf0e10cSrcweir
GetMarkedGluePointsAlign(sal_Bool bVert) const201cdf0e10cSrcweir sal_uInt16 SdrGlueEditView::GetMarkedGluePointsAlign(sal_Bool bVert) const
202cdf0e10cSrcweir {
203cdf0e10cSrcweir ForceUndirtyMrkPnt();
204cdf0e10cSrcweir sal_Bool bFirst=sal_True;
205cdf0e10cSrcweir sal_Bool bDontCare=sal_False;
206cdf0e10cSrcweir sal_uInt16 nRet=0;
207cdf0e10cSrcweir ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetAlign,sal_True,&bFirst,&bDontCare,&bVert,&nRet);
208cdf0e10cSrcweir return nRet;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir
ImpSetAlign(SdrGluePoint & rGP,const SdrObject * pObj,const void * pbVert,const void * pnAlign,const void *,const void *,const void *)211cdf0e10cSrcweir static void ImpSetAlign(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
212cdf0e10cSrcweir {
213cdf0e10cSrcweir Point aPos(rGP.GetAbsolutePos(*pObj));
214cdf0e10cSrcweir if (*(sal_Bool*)pbVert) { // bVert?
215cdf0e10cSrcweir rGP.SetVertAlign(*(sal_uInt16*)pnAlign);
216cdf0e10cSrcweir } else {
217cdf0e10cSrcweir rGP.SetHorzAlign(*(sal_uInt16*)pnAlign);
218cdf0e10cSrcweir }
219cdf0e10cSrcweir rGP.SetAbsolutePos(aPos,*pObj);
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
SetMarkedGluePointsAlign(sal_Bool bVert,sal_uInt16 nAlign)222cdf0e10cSrcweir void SdrGlueEditView::SetMarkedGluePointsAlign(sal_Bool bVert, sal_uInt16 nAlign)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir ForceUndirtyMrkPnt();
225cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_EditSetGlueAlign),GetDescriptionOfMarkedGluePoints());
226cdf0e10cSrcweir ImpDoMarkedGluePoints(ImpSetAlign,sal_False,&bVert,&nAlign);
227cdf0e10cSrcweir EndUndo();
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
231cdf0e10cSrcweir
IsDeleteMarkedGluePointsPossible() const232cdf0e10cSrcweir sal_Bool SdrGlueEditView::IsDeleteMarkedGluePointsPossible() const
233cdf0e10cSrcweir {
234cdf0e10cSrcweir return HasMarkedGluePoints();
235cdf0e10cSrcweir }
236cdf0e10cSrcweir
DeleteMarkedGluePoints()237cdf0e10cSrcweir void SdrGlueEditView::DeleteMarkedGluePoints()
238cdf0e10cSrcweir {
239cdf0e10cSrcweir BrkAction();
240cdf0e10cSrcweir ForceUndirtyMrkPnt();
241cdf0e10cSrcweir const bool bUndo = IsUndoEnabled();
242cdf0e10cSrcweir if( bUndo )
243cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_DELETE);
244cdf0e10cSrcweir
245cdf0e10cSrcweir sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
246cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir SdrMark* pM=GetSdrMarkByIndex(nm);
249cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj();
250cdf0e10cSrcweir const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
251cdf0e10cSrcweir sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
252cdf0e10cSrcweir if (nPtAnz!=0)
253cdf0e10cSrcweir {
254cdf0e10cSrcweir SdrGluePointList* pGPL=pObj->ForceGluePointList();
255cdf0e10cSrcweir if (pGPL!=NULL)
256cdf0e10cSrcweir {
257cdf0e10cSrcweir if( bUndo )
258cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
259cdf0e10cSrcweir
260cdf0e10cSrcweir for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
261cdf0e10cSrcweir {
262cdf0e10cSrcweir sal_uInt16 nPtId=pPts->GetObject(nPtNum);
263cdf0e10cSrcweir sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
264cdf0e10cSrcweir if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir pGPL->Delete(nGlueIdx);
267cdf0e10cSrcweir }
268cdf0e10cSrcweir }
269cdf0e10cSrcweir pObj->SetChanged();
270cdf0e10cSrcweir pObj->BroadcastObjectChange();
271cdf0e10cSrcweir }
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir if( bUndo )
275cdf0e10cSrcweir EndUndo();
276cdf0e10cSrcweir UnmarkAllGluePoints();
277cdf0e10cSrcweir if (nMarkAnz!=0)
278cdf0e10cSrcweir pMod->SetChanged();
279cdf0e10cSrcweir }
280cdf0e10cSrcweir
281cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
282cdf0e10cSrcweir
ImpCopyMarkedGluePoints()283cdf0e10cSrcweir void SdrGlueEditView::ImpCopyMarkedGluePoints()
284cdf0e10cSrcweir {
285cdf0e10cSrcweir const bool bUndo = IsUndoEnabled();
286cdf0e10cSrcweir
287cdf0e10cSrcweir if( bUndo )
288cdf0e10cSrcweir BegUndo();
289cdf0e10cSrcweir
290cdf0e10cSrcweir sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
291cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
292cdf0e10cSrcweir {
293cdf0e10cSrcweir SdrMark* pM=GetSdrMarkByIndex(nm);
294cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj();
295cdf0e10cSrcweir SdrUShortCont* pPts=pM->GetMarkedGluePoints();
296cdf0e10cSrcweir SdrGluePointList* pGPL=pObj->ForceGluePointList();
297cdf0e10cSrcweir sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
298cdf0e10cSrcweir if (nPtAnz!=0 && pGPL!=NULL)
299cdf0e10cSrcweir {
300cdf0e10cSrcweir if( bUndo )
301cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
302cdf0e10cSrcweir
303cdf0e10cSrcweir for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir sal_uInt16 nPtId=pPts->GetObject(nPtNum);
306cdf0e10cSrcweir sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
307cdf0e10cSrcweir if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
308cdf0e10cSrcweir {
309cdf0e10cSrcweir SdrGluePoint aNewGP((*pGPL)[nGlueIdx]); // GluePoint klonen
310cdf0e10cSrcweir sal_uInt16 nNewIdx=pGPL->Insert(aNewGP); // und einfuegen
311cdf0e10cSrcweir sal_uInt16 nNewId=(*pGPL)[nNewIdx].GetId(); // Id des neuen GluePoints ermitteln
312cdf0e10cSrcweir pPts->Replace(nNewId,nPtNum); // und diesen markieren (anstelle des alten)
313cdf0e10cSrcweir }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir }
316cdf0e10cSrcweir }
317cdf0e10cSrcweir if( bUndo )
318cdf0e10cSrcweir EndUndo();
319cdf0e10cSrcweir
320cdf0e10cSrcweir if (nMarkAnz!=0)
321cdf0e10cSrcweir pMod->SetChanged();
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
324cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
325cdf0e10cSrcweir
ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc,const void * p1,const void * p2,const void * p3,const void * p4,const void * p5)326cdf0e10cSrcweir void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
329cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
330cdf0e10cSrcweir SdrMark* pM=GetSdrMarkByIndex(nm);
331cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj();
332cdf0e10cSrcweir const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
333cdf0e10cSrcweir sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
334cdf0e10cSrcweir if (nPtAnz!=0) {
335cdf0e10cSrcweir SdrGluePointList* pGPL=pObj->ForceGluePointList();
336cdf0e10cSrcweir if (pGPL!=NULL)
337cdf0e10cSrcweir {
338cdf0e10cSrcweir if( IsUndoEnabled() )
339cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
340cdf0e10cSrcweir
341cdf0e10cSrcweir for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++) {
342cdf0e10cSrcweir sal_uInt16 nPtId=pPts->GetObject(nPtNum);
343cdf0e10cSrcweir sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
344cdf0e10cSrcweir if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND) {
345cdf0e10cSrcweir SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
346cdf0e10cSrcweir Point aPos(rGP.GetAbsolutePos(*pObj));
347cdf0e10cSrcweir (*pTrFunc)(aPos,p1,p2,p3,p4,p5);
348cdf0e10cSrcweir rGP.SetAbsolutePos(aPos,*pObj);
349cdf0e10cSrcweir }
350cdf0e10cSrcweir }
351cdf0e10cSrcweir pObj->SetChanged();
352cdf0e10cSrcweir pObj->BroadcastObjectChange();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir }
356cdf0e10cSrcweir if (nMarkAnz!=0) pMod->SetChanged();
357cdf0e10cSrcweir }
358cdf0e10cSrcweir
359cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
360cdf0e10cSrcweir
ImpMove(Point & rPt,const void * p1,const void *,const void *,const void *,const void *)361cdf0e10cSrcweir static void ImpMove(Point& rPt, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
362cdf0e10cSrcweir {
363cdf0e10cSrcweir rPt.X()+=((const Size*)p1)->Width();
364cdf0e10cSrcweir rPt.Y()+=((const Size*)p1)->Height();
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
MoveMarkedGluePoints(const Size & rSiz,bool bCopy)367cdf0e10cSrcweir void SdrGlueEditView::MoveMarkedGluePoints(const Size& rSiz, bool bCopy)
368cdf0e10cSrcweir {
369cdf0e10cSrcweir ForceUndirtyMrkPnt();
370cdf0e10cSrcweir XubString aStr(ImpGetResStr(STR_EditMove));
371cdf0e10cSrcweir if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
372cdf0e10cSrcweir BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_MOVE);
373cdf0e10cSrcweir if (bCopy) ImpCopyMarkedGluePoints();
374cdf0e10cSrcweir ImpTransformMarkedGluePoints(ImpMove,&rSiz);
375cdf0e10cSrcweir EndUndo();
376cdf0e10cSrcweir AdjustMarkHdl();
377cdf0e10cSrcweir }
378cdf0e10cSrcweir
379cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
380cdf0e10cSrcweir
ImpResize(Point & rPt,const void * p1,const void * p2,const void * p3,const void *,const void *)381cdf0e10cSrcweir static void ImpResize(Point& rPt, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
ResizeMarkedGluePoints(const Point & rRef,const Fraction & xFact,const Fraction & yFact,bool bCopy)386cdf0e10cSrcweir void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir ForceUndirtyMrkPnt();
389cdf0e10cSrcweir XubString aStr(ImpGetResStr(STR_EditResize));
390cdf0e10cSrcweir if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
391cdf0e10cSrcweir BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_RESIZE);
392cdf0e10cSrcweir if (bCopy) ImpCopyMarkedGluePoints();
393cdf0e10cSrcweir ImpTransformMarkedGluePoints(ImpResize,&rRef,&xFact,&yFact);
394cdf0e10cSrcweir EndUndo();
395cdf0e10cSrcweir AdjustMarkHdl();
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
398cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
399cdf0e10cSrcweir
ImpRotate(Point & rPt,const void * p1,const void *,const void * p3,const void * p4,const void *)400cdf0e10cSrcweir static void ImpRotate(Point& rPt, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
401cdf0e10cSrcweir {
402cdf0e10cSrcweir RotatePoint(rPt,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
RotateMarkedGluePoints(const Point & rRef,long nWink,bool bCopy)405cdf0e10cSrcweir void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, long nWink, bool bCopy)
406cdf0e10cSrcweir {
407cdf0e10cSrcweir ForceUndirtyMrkPnt();
408cdf0e10cSrcweir XubString aStr(ImpGetResStr(STR_EditRotate));
409cdf0e10cSrcweir if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
410cdf0e10cSrcweir BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_ROTATE);
411cdf0e10cSrcweir if (bCopy) ImpCopyMarkedGluePoints();
412cdf0e10cSrcweir double nSin=sin(nWink*nPi180);
413cdf0e10cSrcweir double nCos=cos(nWink*nPi180);
414cdf0e10cSrcweir ImpTransformMarkedGluePoints(ImpRotate,&rRef,&nWink,&nSin,&nCos);
415cdf0e10cSrcweir EndUndo();
416cdf0e10cSrcweir AdjustMarkHdl();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir
419