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