xref: /AOO41X/main/svx/source/svdraw/svdmrkv1.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/svdmrkv.hxx>
32*cdf0e10cSrcweir #include <svx/svdetc.hxx>
33*cdf0e10cSrcweir #include <svx/svdoedge.hxx>
34*cdf0e10cSrcweir #include "svx/svdglob.hxx"
35*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
36*cdf0e10cSrcweir #include <svx/svdpage.hxx>
37*cdf0e10cSrcweir #include "svddrgm1.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
40*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
41*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
42*cdf0e10cSrcweir //
43*cdf0e10cSrcweir //  @@@@@  @@  @@ @@  @@ @@  @@ @@@@@@ @@   @@  @@@@  @@@@@  @@  @@ @@ @@@@@ @@@@@  @@  @@ @@  @@  @@@@
44*cdf0e10cSrcweir //  @@  @@ @@  @@ @@@ @@ @@  @@   @@   @@@ @@@ @@  @@ @@  @@ @@  @@ @@ @@    @@  @@ @@  @@ @@@ @@ @@  @@
45*cdf0e10cSrcweir //  @@  @@ @@  @@ @@@@@@ @@ @@    @@   @@@@@@@ @@  @@ @@  @@ @@ @@  @@ @@    @@  @@ @@  @@ @@@@@@ @@
46*cdf0e10cSrcweir //  @@@@@  @@  @@ @@@@@@ @@@@     @@   @@@@@@@ @@@@@@ @@@@@  @@@@   @@ @@@@  @@@@@  @@  @@ @@@@@@ @@ @@@
47*cdf0e10cSrcweir //  @@     @@  @@ @@ @@@ @@ @@    @@   @@ @ @@ @@  @@ @@  @@ @@ @@  @@ @@    @@  @@ @@  @@ @@ @@@ @@  @@
48*cdf0e10cSrcweir //  @@     @@  @@ @@  @@ @@  @@   @@   @@   @@ @@  @@ @@  @@ @@  @@ @@ @@    @@  @@ @@  @@ @@  @@ @@  @@
49*cdf0e10cSrcweir //  @@      @@@@  @@  @@ @@  @@   @@   @@   @@ @@  @@ @@  @@ @@  @@ @@ @@@@@ @@  @@  @@@@  @@  @@  @@@@@
50*cdf0e10cSrcweir //
51*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir sal_Bool SdrMarkView::HasMarkablePoints() const
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
56*cdf0e10cSrcweir 	bool bRet=false;
57*cdf0e10cSrcweir 	if (!ImpIsFrameHandles()) {
58*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
59*cdf0e10cSrcweir 		if (nMarkAnz<=nFrameHandlesLimit) {
60*cdf0e10cSrcweir 			for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
61*cdf0e10cSrcweir 				const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
62*cdf0e10cSrcweir 				const SdrObject* pObj=pM->GetMarkedSdrObj();
63*cdf0e10cSrcweir 				bRet=pObj->IsPolyObj();
64*cdf0e10cSrcweir 			}
65*cdf0e10cSrcweir 		}
66*cdf0e10cSrcweir 	}
67*cdf0e10cSrcweir 	return bRet;
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir sal_uIntPtr SdrMarkView::GetMarkablePointCount() const
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
73*cdf0e10cSrcweir 	sal_uIntPtr nAnz=0;
74*cdf0e10cSrcweir 	if (!ImpIsFrameHandles()) {
75*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
76*cdf0e10cSrcweir 		if (nMarkAnz<=nFrameHandlesLimit) {
77*cdf0e10cSrcweir 			for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
78*cdf0e10cSrcweir 				const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
79*cdf0e10cSrcweir 				const SdrObject* pObj=pM->GetMarkedSdrObj();
80*cdf0e10cSrcweir 				if (pObj->IsPolyObj()) {
81*cdf0e10cSrcweir 					nAnz+=pObj->GetPointCount();
82*cdf0e10cSrcweir 				}
83*cdf0e10cSrcweir 			}
84*cdf0e10cSrcweir 		}
85*cdf0e10cSrcweir 	}
86*cdf0e10cSrcweir 	return nAnz;
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir sal_Bool SdrMarkView::HasMarkedPoints() const
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
92*cdf0e10cSrcweir 	sal_Bool bRet=sal_False;
93*cdf0e10cSrcweir 	if (!ImpIsFrameHandles()) {
94*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
95*cdf0e10cSrcweir 		if (nMarkAnz<=nFrameHandlesLimit) {
96*cdf0e10cSrcweir 			for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
97*cdf0e10cSrcweir 				const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
98*cdf0e10cSrcweir 				const SdrUShortCont* pPts=pM->GetMarkedPoints();
99*cdf0e10cSrcweir 				bRet=pPts!=NULL && pPts->GetCount()!=0;
100*cdf0e10cSrcweir 			}
101*cdf0e10cSrcweir 		}
102*cdf0e10cSrcweir 	}
103*cdf0e10cSrcweir 	return bRet;
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir sal_uIntPtr SdrMarkView::GetMarkedPointCount() const
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
109*cdf0e10cSrcweir 	sal_uIntPtr nAnz=0;
110*cdf0e10cSrcweir 	if (!ImpIsFrameHandles()) {
111*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
112*cdf0e10cSrcweir 		if (nMarkAnz<=nFrameHandlesLimit) {
113*cdf0e10cSrcweir 			for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
114*cdf0e10cSrcweir 				const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
115*cdf0e10cSrcweir 				const SdrUShortCont* pPts=pM->GetMarkedPoints();
116*cdf0e10cSrcweir 				if (pPts!=NULL) nAnz+=pPts->GetCount();
117*cdf0e10cSrcweir 			}
118*cdf0e10cSrcweir 		}
119*cdf0e10cSrcweir 	}
120*cdf0e10cSrcweir 	return nAnz;
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir sal_Bool SdrMarkView::IsPointMarkable(const SdrHdl& rHdl) const
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	return !ImpIsFrameHandles() && &rHdl!=NULL && !rHdl.IsPlusHdl() && rHdl.GetKind()!=HDL_GLUE && rHdl.GetKind()!=HDL_SMARTTAG && rHdl.GetObj()!=NULL && rHdl.GetObj()->IsPolyObj();
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark)
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir 	return ImpMarkPoint( pHdl, pMark, bUnmark );
131*cdf0e10cSrcweir }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir sal_Bool SdrMarkView::ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark)
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir 	if (pHdl==NULL || pHdl->IsPlusHdl() || pHdl->GetKind()==HDL_GLUE)
136*cdf0e10cSrcweir 		return sal_False;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	if (pHdl->IsSelected() != bUnmark)
139*cdf0e10cSrcweir 		return sal_False;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	SdrObject* pObj=pHdl->GetObj();
142*cdf0e10cSrcweir 	if (pObj==NULL || !pObj->IsPolyObj())
143*cdf0e10cSrcweir 		return sal_False;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	if (pMark==NULL)
146*cdf0e10cSrcweir 	{
147*cdf0e10cSrcweir 		sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj);
148*cdf0e10cSrcweir 		if (nMarkNum==CONTAINER_ENTRY_NOTFOUND)
149*cdf0e10cSrcweir 			return sal_False;
150*cdf0e10cSrcweir 		pMark=GetSdrMarkByIndex(nMarkNum);
151*cdf0e10cSrcweir 	}
152*cdf0e10cSrcweir 	const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
153*cdf0e10cSrcweir 	SdrUShortCont* pPts=pMark->ForceMarkedPoints();
154*cdf0e10cSrcweir 	if (!bUnmark)
155*cdf0e10cSrcweir 	{
156*cdf0e10cSrcweir 		pPts->Insert((sal_uInt16)nHdlNum);
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 	else
159*cdf0e10cSrcweir 	{
160*cdf0e10cSrcweir 		sal_uIntPtr nBla=pPts->GetPos((sal_uInt16)nHdlNum);
161*cdf0e10cSrcweir 		if (nBla!=CONTAINER_ENTRY_NOTFOUND)
162*cdf0e10cSrcweir 		{
163*cdf0e10cSrcweir 			pPts->Remove(nBla);
164*cdf0e10cSrcweir 		}
165*cdf0e10cSrcweir 		else
166*cdf0e10cSrcweir 		{
167*cdf0e10cSrcweir 			return sal_False; // Fehlerfall!
168*cdf0e10cSrcweir 		}
169*cdf0e10cSrcweir 	}
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	pHdl->SetSelected(!bUnmark);
172*cdf0e10cSrcweir 	if (!bPlusHdlAlways)
173*cdf0e10cSrcweir 	{
174*cdf0e10cSrcweir 		if (!bUnmark)
175*cdf0e10cSrcweir 		{
176*cdf0e10cSrcweir 			sal_uInt32 nAnz(pObj->GetPlusHdlCount(*pHdl));
177*cdf0e10cSrcweir 			for (sal_uInt32 i=0; i<nAnz; i++)
178*cdf0e10cSrcweir 			{
179*cdf0e10cSrcweir 				SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,i);
180*cdf0e10cSrcweir 				if (pPlusHdl!=NULL)
181*cdf0e10cSrcweir 				{
182*cdf0e10cSrcweir 					pPlusHdl->SetObj(pObj);
183*cdf0e10cSrcweir 					pPlusHdl->SetPageView(pMark->GetPageView());
184*cdf0e10cSrcweir 					pPlusHdl->SetPlusHdl(sal_True);
185*cdf0e10cSrcweir 					aHdl.AddHdl(pPlusHdl);
186*cdf0e10cSrcweir 				}
187*cdf0e10cSrcweir 			}
188*cdf0e10cSrcweir 		}
189*cdf0e10cSrcweir 		else
190*cdf0e10cSrcweir 		{
191*cdf0e10cSrcweir 			for (sal_uIntPtr i = aHdl.GetHdlCount(); i>0;)
192*cdf0e10cSrcweir 			{
193*cdf0e10cSrcweir 				i--;
194*cdf0e10cSrcweir 				SdrHdl* pPlusHdl=aHdl.GetHdl(i);
195*cdf0e10cSrcweir 				if (pPlusHdl->IsPlusHdl() && pPlusHdl->GetSourceHdlNum()==nHdlNum)
196*cdf0e10cSrcweir 				{
197*cdf0e10cSrcweir 					aHdl.RemoveHdl(i);
198*cdf0e10cSrcweir 					delete pPlusHdl;
199*cdf0e10cSrcweir 				}
200*cdf0e10cSrcweir 			}
201*cdf0e10cSrcweir 		}
202*cdf0e10cSrcweir 	}
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 	// #97016# II: Sort handles. This was missing in ImpMarkPoint all the time.
205*cdf0e10cSrcweir 	aHdl.Sort();
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	return sal_True;
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark)
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir 	if (&rHdl==NULL) return sal_False;
214*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
215*cdf0e10cSrcweir 	sal_Bool bRet=sal_False;
216*cdf0e10cSrcweir 	const SdrObject* pObj=rHdl.GetObj();
217*cdf0e10cSrcweir 	if (IsPointMarkable(rHdl) && rHdl.IsSelected()==bUnmark) {
218*cdf0e10cSrcweir 		sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj);
219*cdf0e10cSrcweir 		if (nMarkNum!=CONTAINER_ENTRY_NOTFOUND) {
220*cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
221*cdf0e10cSrcweir 			SdrUShortCont* pPts=pM->ForceMarkedPoints();
222*cdf0e10cSrcweir 			pPts->ForceSort();
223*cdf0e10cSrcweir 			if (ImpMarkPoint(&rHdl,pM,bUnmark)) {
224*cdf0e10cSrcweir 				pPts->ForceSort();
225*cdf0e10cSrcweir 				MarkListHasChanged();
226*cdf0e10cSrcweir 				bRet=sal_True;
227*cdf0e10cSrcweir 			}
228*cdf0e10cSrcweir 		}
229*cdf0e10cSrcweir 	}
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 	return bRet;
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
235*cdf0e10cSrcweir {
236*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
237*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
238*cdf0e10cSrcweir 	SortMarkedObjects();
239*cdf0e10cSrcweir 	const SdrObject* pObj0=NULL;
240*cdf0e10cSrcweir 	const SdrPageView* pPV0=NULL;
241*cdf0e10cSrcweir 	SdrMark* pM=NULL;
242*cdf0e10cSrcweir 	aHdl.Sort();
243*cdf0e10cSrcweir 	//HMHBOOL bHideHdl=IsMarkHdlShown() && IsSolidMarkHdl() && !bPlusHdlAlways;
244*cdf0e10cSrcweir 	sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
245*cdf0e10cSrcweir 	for (sal_uIntPtr nHdlNum=nHdlAnz; nHdlNum>0;) {
246*cdf0e10cSrcweir 		nHdlNum--;
247*cdf0e10cSrcweir 		SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
248*cdf0e10cSrcweir 		if (IsPointMarkable(*pHdl) && pHdl->IsSelected()==bUnmark) {
249*cdf0e10cSrcweir 			const SdrObject* pObj=pHdl->GetObj();
250*cdf0e10cSrcweir 			const SdrPageView* pPV=pHdl->GetPageView();
251*cdf0e10cSrcweir 			if (pObj!=pObj0 || pPV!=pPV0 || pM==NULL) { // Dieser Abschnitt dient zur Optimierung,
252*cdf0e10cSrcweir 				if (pM!=NULL) {
253*cdf0e10cSrcweir 					SdrUShortCont* pPts=pM->GetMarkedPoints();
254*cdf0e10cSrcweir 					if (pPts!=NULL) pPts->ForceSort();
255*cdf0e10cSrcweir 				}
256*cdf0e10cSrcweir 				sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj);  // damit ImpMarkPoint() nicht staendig das
257*cdf0e10cSrcweir 				if (nMarkNum!=CONTAINER_ENTRY_NOTFOUND) { // Objekt in der MarkList suchen muss.
258*cdf0e10cSrcweir 					pM=GetSdrMarkByIndex(nMarkNum);
259*cdf0e10cSrcweir 					pObj0=pObj;
260*cdf0e10cSrcweir 					pPV0=pPV;
261*cdf0e10cSrcweir 					SdrUShortCont* pPts=pM->ForceMarkedPoints();
262*cdf0e10cSrcweir 					pPts->ForceSort();
263*cdf0e10cSrcweir 				} else {
264*cdf0e10cSrcweir #ifdef DBG_UTIL
265*cdf0e10cSrcweir 					if (pObj->IsInserted()) {
266*cdf0e10cSrcweir 						DBG_ERROR("SdrMarkView::MarkPoints(const Rectangle* pRect): Markiertes Objekt nicht gefunden");
267*cdf0e10cSrcweir 					}
268*cdf0e10cSrcweir #endif
269*cdf0e10cSrcweir 					pM=NULL;
270*cdf0e10cSrcweir 				}
271*cdf0e10cSrcweir 			}
272*cdf0e10cSrcweir 			Point aPos(pHdl->GetPos());
273*cdf0e10cSrcweir 			if (pM!=NULL && (pRect==NULL || pRect->IsInside(aPos))) {
274*cdf0e10cSrcweir 				//HMHif (bHideHdl && IsMarkHdlShown() && pHdl->GetObj()!=NULL) {
275*cdf0e10cSrcweir 					//HMHsal_uInt32 nAnz=pHdl->GetObj()->GetPlusHdlCount(*pHdl);
276*cdf0e10cSrcweir 					//HMHif (nAnz!=0L) HideMarkHdl(); // #36987#
277*cdf0e10cSrcweir 				//HMH}
278*cdf0e10cSrcweir 				if (ImpMarkPoint(pHdl,pM,bUnmark)) bChgd=sal_True;
279*cdf0e10cSrcweir 			}
280*cdf0e10cSrcweir 		}
281*cdf0e10cSrcweir 	}
282*cdf0e10cSrcweir 	if (pM!=NULL) { // Den zuletzt geaenderten MarkEntry ggf. noch aufraeumen
283*cdf0e10cSrcweir 		SdrUShortCont* pPts=pM->GetMarkedPoints();
284*cdf0e10cSrcweir 		if (pPts!=NULL) pPts->ForceSort();
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir 	//HMHif (bHideHdl) ShowMarkHdl(); // #36987#
287*cdf0e10cSrcweir 	if (bChgd) {
288*cdf0e10cSrcweir 		MarkListHasChanged();
289*cdf0e10cSrcweir 	}
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 	return bChgd;
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkNextPoint(sal_Bool /*bPrev*/)
295*cdf0e10cSrcweir {
296*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
297*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
298*cdf0e10cSrcweir 	SortMarkedObjects();
299*cdf0e10cSrcweir 	// ...
300*cdf0e10cSrcweir 	if (bChgd) {
301*cdf0e10cSrcweir 		MarkListHasChanged();
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 	return bChgd;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkNextPoint(const Point& /*rPnt*/, sal_Bool /*bPrev*/)
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
309*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
310*cdf0e10cSrcweir 	SortMarkedObjects();
311*cdf0e10cSrcweir 	// ...
312*cdf0e10cSrcweir 	if (bChgd) {
313*cdf0e10cSrcweir 		MarkListHasChanged();
314*cdf0e10cSrcweir 	}
315*cdf0e10cSrcweir 	return bChgd;
316*cdf0e10cSrcweir }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir const Rectangle& SdrMarkView::GetMarkedPointsRect() const
319*cdf0e10cSrcweir {
320*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
321*cdf0e10cSrcweir 	if (bMarkedPointsRectsDirty) ImpSetPointsRects();
322*cdf0e10cSrcweir 	return aMarkedPointsRect;
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir void SdrMarkView::SetPlusHandlesAlwaysVisible(sal_Bool bOn)
326*cdf0e10cSrcweir { // HandlePaint optimieren !!!!!!!
327*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
328*cdf0e10cSrcweir 	if (bOn!=bPlusHdlAlways) {
329*cdf0e10cSrcweir 		//HMHBOOL bVis=IsMarkHdlShown();
330*cdf0e10cSrcweir 		//HMHif (bVis) HideMarkHdl();
331*cdf0e10cSrcweir 		bPlusHdlAlways=bOn;
332*cdf0e10cSrcweir 		SetMarkHandles();
333*cdf0e10cSrcweir 		//HMHif (bVis) ShowMarkHdl();
334*cdf0e10cSrcweir 		MarkListHasChanged();
335*cdf0e10cSrcweir 	}
336*cdf0e10cSrcweir }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
339*cdf0e10cSrcweir // ImpSetPointsRects() ist fuer PolyPoints und GluePoints!
340*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir void SdrMarkView::ImpSetPointsRects() const
343*cdf0e10cSrcweir {
344*cdf0e10cSrcweir 	Rectangle aPnts;
345*cdf0e10cSrcweir 	Rectangle aGlue;
346*cdf0e10cSrcweir 	sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
347*cdf0e10cSrcweir 	for (sal_uIntPtr nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) {
348*cdf0e10cSrcweir 		const SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
349*cdf0e10cSrcweir 		SdrHdlKind eKind=pHdl->GetKind();
350*cdf0e10cSrcweir 		if ((eKind==HDL_POLY && pHdl->IsSelected()) || eKind==HDL_GLUE) {
351*cdf0e10cSrcweir 			Point aPt(pHdl->GetPos());
352*cdf0e10cSrcweir 			Rectangle& rR=eKind==HDL_GLUE ? aGlue : aPnts;
353*cdf0e10cSrcweir 			if (rR.IsEmpty()) {
354*cdf0e10cSrcweir 				rR=Rectangle(aPt,aPt);
355*cdf0e10cSrcweir 			} else {
356*cdf0e10cSrcweir 				if (aPt.X()<rR.Left  ()) rR.Left  ()=aPt.X();
357*cdf0e10cSrcweir 				if (aPt.X()>rR.Right ()) rR.Right ()=aPt.X();
358*cdf0e10cSrcweir 				if (aPt.Y()<rR.Top   ()) rR.Top   ()=aPt.Y();
359*cdf0e10cSrcweir 				if (aPt.Y()>rR.Bottom()) rR.Bottom()=aPt.Y();
360*cdf0e10cSrcweir 			}
361*cdf0e10cSrcweir 		}
362*cdf0e10cSrcweir 	}
363*cdf0e10cSrcweir 	((SdrMarkView*)this)->aMarkedPointsRect=aPnts;
364*cdf0e10cSrcweir 	((SdrMarkView*)this)->aMarkedGluePointsRect=aGlue;
365*cdf0e10cSrcweir 	((SdrMarkView*)this)->bMarkedPointsRectsDirty=sal_False;
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
369*cdf0e10cSrcweir // UndirtyMrkPnt() ist fuer PolyPoints und GluePoints!
370*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir void SdrMarkView::UndirtyMrkPnt() const
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir 	sal_Bool bChg=sal_False;
375*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
376*cdf0e10cSrcweir 	for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
377*cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
378*cdf0e10cSrcweir 		const SdrObject* pObj=pM->GetMarkedSdrObj();
379*cdf0e10cSrcweir 		// PolyPoints
380*cdf0e10cSrcweir 		SdrUShortCont* pPts=pM->GetMarkedPoints();
381*cdf0e10cSrcweir 		if (pPts!=NULL) {
382*cdf0e10cSrcweir 			if (pObj->IsPolyObj()) {
383*cdf0e10cSrcweir 				// Ungueltig markierte Punkte entfernen, also alle
384*cdf0e10cSrcweir 				// Eintraege die groesser sind als die Punktanzahl des Objekts
385*cdf0e10cSrcweir 				sal_uInt32 nMax(pObj->GetPointCount());
386*cdf0e10cSrcweir 				sal_uInt32 nPtNum(0xffffffff);
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 				pPts->ForceSort();
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 				for (sal_uInt32 nIndex(pPts->GetCount()); nIndex > 0L && nPtNum >= nMax;)
391*cdf0e10cSrcweir 				{
392*cdf0e10cSrcweir 					nIndex--;
393*cdf0e10cSrcweir 					nPtNum = pPts->GetObject(nIndex);
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 					if(nPtNum >= nMax)
396*cdf0e10cSrcweir 					{
397*cdf0e10cSrcweir 						pPts->Remove(nIndex);
398*cdf0e10cSrcweir 						bChg = sal_True;
399*cdf0e10cSrcweir 					}
400*cdf0e10cSrcweir 				}
401*cdf0e10cSrcweir 			}
402*cdf0e10cSrcweir 			else
403*cdf0e10cSrcweir 			{
404*cdf0e10cSrcweir 				DBG_ERROR("SdrMarkView::UndirtyMrkPnt(): Markierte Punkte an einem Objekt, dass kein PolyObj ist!");
405*cdf0e10cSrcweir 				if(pPts && pPts->GetCount())
406*cdf0e10cSrcweir 				{
407*cdf0e10cSrcweir 					pPts->Clear();
408*cdf0e10cSrcweir 					bChg = sal_True;
409*cdf0e10cSrcweir 				}
410*cdf0e10cSrcweir 			}
411*cdf0e10cSrcweir 		}
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir 		// GluePoints
414*cdf0e10cSrcweir 		pPts=pM->GetMarkedGluePoints();
415*cdf0e10cSrcweir 		const SdrGluePointList* pGPL=pObj->GetGluePointList();
416*cdf0e10cSrcweir 		if (pPts!=NULL) {
417*cdf0e10cSrcweir 			if (pGPL!=NULL) {
418*cdf0e10cSrcweir 				// Ungueltig markierte Klebepunkte entfernen, also alle
419*cdf0e10cSrcweir 				// Eintraege (Id's) die nicht in der GluePointList des
420*cdf0e10cSrcweir 				// Objekts enthalten sind
421*cdf0e10cSrcweir 				pPts->ForceSort();
422*cdf0e10cSrcweir 				for (sal_uIntPtr nIndex=pPts->GetCount(); nIndex>0;) {
423*cdf0e10cSrcweir 					nIndex--;
424*cdf0e10cSrcweir 					sal_uInt16 nId=pPts->GetObject(nIndex);
425*cdf0e10cSrcweir 					if (pGPL->FindGluePoint(nId)==SDRGLUEPOINT_NOTFOUND) {
426*cdf0e10cSrcweir 						pPts->Remove(nIndex);
427*cdf0e10cSrcweir 						bChg=sal_True;
428*cdf0e10cSrcweir 					}
429*cdf0e10cSrcweir 				}
430*cdf0e10cSrcweir 			} else {
431*cdf0e10cSrcweir 				if (pPts!=NULL && pPts->GetCount()!=0) {
432*cdf0e10cSrcweir 					pPts->Clear(); // Objekt hat keine Klebepunkte (mehr)
433*cdf0e10cSrcweir 					bChg=sal_True;
434*cdf0e10cSrcweir 				}
435*cdf0e10cSrcweir 			}
436*cdf0e10cSrcweir 		}
437*cdf0e10cSrcweir 	}
438*cdf0e10cSrcweir 	if (bChg) ((SdrMarkView*)this)->bMarkedPointsRectsDirty=sal_True;
439*cdf0e10cSrcweir 	((SdrMarkView*)this)->bMrkPntDirty=sal_False;
440*cdf0e10cSrcweir }
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
443*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
444*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir sal_Bool SdrMarkView::HasMarkableGluePoints() const
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir 	sal_Bool bRet=sal_False;
449*cdf0e10cSrcweir 	if (IsGluePointEditMode()) {
450*cdf0e10cSrcweir 		ForceUndirtyMrkPnt();
451*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
452*cdf0e10cSrcweir 		for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
453*cdf0e10cSrcweir 			const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
454*cdf0e10cSrcweir 			const SdrObject* pObj=pM->GetMarkedSdrObj();
455*cdf0e10cSrcweir 			const SdrGluePointList* pGPL=pObj->GetGluePointList();
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 			// #i38892#
458*cdf0e10cSrcweir 			if(pGPL && pGPL->GetCount())
459*cdf0e10cSrcweir 			{
460*cdf0e10cSrcweir 				for(sal_uInt16 a(0); !bRet && a < pGPL->GetCount(); a++)
461*cdf0e10cSrcweir 				{
462*cdf0e10cSrcweir 					if((*pGPL)[a].IsUserDefined())
463*cdf0e10cSrcweir 					{
464*cdf0e10cSrcweir 						bRet = sal_True;
465*cdf0e10cSrcweir 					}
466*cdf0e10cSrcweir 				}
467*cdf0e10cSrcweir 			}
468*cdf0e10cSrcweir 		}
469*cdf0e10cSrcweir 	}
470*cdf0e10cSrcweir 	return bRet;
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir sal_uIntPtr SdrMarkView::GetMarkableGluePointCount() const
474*cdf0e10cSrcweir {
475*cdf0e10cSrcweir 	sal_uIntPtr nAnz=0;
476*cdf0e10cSrcweir 	if (IsGluePointEditMode()) {
477*cdf0e10cSrcweir 		ForceUndirtyMrkPnt();
478*cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
479*cdf0e10cSrcweir 		for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
480*cdf0e10cSrcweir 			const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
481*cdf0e10cSrcweir 			const SdrObject* pObj=pM->GetMarkedSdrObj();
482*cdf0e10cSrcweir 			const SdrGluePointList* pGPL=pObj->GetGluePointList();
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 			// #i38892#
485*cdf0e10cSrcweir 			if(pGPL && pGPL->GetCount())
486*cdf0e10cSrcweir 			{
487*cdf0e10cSrcweir 				for(sal_uInt16 a(0); a < pGPL->GetCount(); a++)
488*cdf0e10cSrcweir 				{
489*cdf0e10cSrcweir 					if((*pGPL)[a].IsUserDefined())
490*cdf0e10cSrcweir 					{
491*cdf0e10cSrcweir 						nAnz++;
492*cdf0e10cSrcweir 					}
493*cdf0e10cSrcweir 				}
494*cdf0e10cSrcweir 			}
495*cdf0e10cSrcweir 		}
496*cdf0e10cSrcweir 	}
497*cdf0e10cSrcweir 	return nAnz;
498*cdf0e10cSrcweir }
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir sal_Bool SdrMarkView::HasMarkedGluePoints() const
501*cdf0e10cSrcweir {
502*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
503*cdf0e10cSrcweir 	sal_Bool bRet=sal_False;
504*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
505*cdf0e10cSrcweir 	for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
506*cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
507*cdf0e10cSrcweir 		const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
508*cdf0e10cSrcweir 		bRet=pPts!=NULL && pPts->GetCount()!=0;
509*cdf0e10cSrcweir 	}
510*cdf0e10cSrcweir 	return bRet;
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir sal_uIntPtr SdrMarkView::GetMarkedGluePointCount() const
514*cdf0e10cSrcweir {
515*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
516*cdf0e10cSrcweir 	sal_uIntPtr nAnz=0;
517*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
518*cdf0e10cSrcweir 	for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
519*cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
520*cdf0e10cSrcweir 		const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
521*cdf0e10cSrcweir 		if (pPts!=NULL) nAnz+=pPts->GetCount();
522*cdf0e10cSrcweir 	}
523*cdf0e10cSrcweir 	return nAnz;
524*cdf0e10cSrcweir }
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkGluePoints(const Rectangle* pRect, sal_Bool bUnmark)
527*cdf0e10cSrcweir {
528*cdf0e10cSrcweir 	if (!IsGluePointEditMode() && !bUnmark) return sal_False;
529*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
530*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
531*cdf0e10cSrcweir 	SortMarkedObjects();
532*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
533*cdf0e10cSrcweir 	for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
534*cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
535*cdf0e10cSrcweir 		const SdrObject* pObj=pM->GetMarkedSdrObj();
536*cdf0e10cSrcweir 		const SdrGluePointList* pGPL=pObj->GetGluePointList();
537*cdf0e10cSrcweir 		SdrUShortCont* pPts=pM->GetMarkedGluePoints();
538*cdf0e10cSrcweir 		if (bUnmark && pRect==NULL) { // UnmarkAll
539*cdf0e10cSrcweir 			if (pPts!=NULL && pPts->GetCount()!=0) {
540*cdf0e10cSrcweir 				pPts->Clear();
541*cdf0e10cSrcweir 				bChgd=sal_True;
542*cdf0e10cSrcweir 			}
543*cdf0e10cSrcweir 		} else {
544*cdf0e10cSrcweir 			if (pGPL!=NULL && (pPts!=NULL || !bUnmark)) {
545*cdf0e10cSrcweir 				sal_uInt16 nGPAnz=pGPL->GetCount();
546*cdf0e10cSrcweir 				for (sal_uInt16 nGPNum=0; nGPNum<nGPAnz; nGPNum++) {
547*cdf0e10cSrcweir 					const SdrGluePoint& rGP=(*pGPL)[nGPNum];
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 					// #i38892#
550*cdf0e10cSrcweir 					if(rGP.IsUserDefined())
551*cdf0e10cSrcweir 					{
552*cdf0e10cSrcweir 						Point aPos(rGP.GetAbsolutePos(*pObj));
553*cdf0e10cSrcweir 						if (pRect==NULL || pRect->IsInside(aPos)) {
554*cdf0e10cSrcweir 							if (pPts==NULL) pPts=pM->ForceMarkedGluePoints();
555*cdf0e10cSrcweir 							else pPts->ForceSort();
556*cdf0e10cSrcweir 							sal_uIntPtr nPos=pPts->GetPos(rGP.GetId());
557*cdf0e10cSrcweir 							if (!bUnmark && nPos==CONTAINER_ENTRY_NOTFOUND) {
558*cdf0e10cSrcweir 								bChgd=sal_True;
559*cdf0e10cSrcweir 								pPts->Insert(rGP.GetId());
560*cdf0e10cSrcweir 							}
561*cdf0e10cSrcweir 							if (bUnmark && nPos!=CONTAINER_ENTRY_NOTFOUND) {
562*cdf0e10cSrcweir 								bChgd=sal_True;
563*cdf0e10cSrcweir 								pPts->Remove(nPos);
564*cdf0e10cSrcweir 							}
565*cdf0e10cSrcweir 						}
566*cdf0e10cSrcweir 					}
567*cdf0e10cSrcweir 				}
568*cdf0e10cSrcweir 			}
569*cdf0e10cSrcweir 		}
570*cdf0e10cSrcweir 	}
571*cdf0e10cSrcweir 	if (bChgd) {
572*cdf0e10cSrcweir 		AdjustMarkHdl();
573*cdf0e10cSrcweir 		MarkListHasChanged();
574*cdf0e10cSrcweir 	}
575*cdf0e10cSrcweir 	return bChgd;
576*cdf0e10cSrcweir }
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir sal_Bool SdrMarkView::PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV, sal_uIntPtr nOptions) const
579*cdf0e10cSrcweir {
580*cdf0e10cSrcweir 	SdrObject* pObj0=rpObj;
581*cdf0e10cSrcweir 	//SdrPageView* pPV0=rpPV;
582*cdf0e10cSrcweir 	sal_uInt16 nId0=rnId;
583*cdf0e10cSrcweir 	rpObj=NULL; rpPV=NULL; rnId=0;
584*cdf0e10cSrcweir 	if (!IsGluePointEditMode()) return sal_False;
585*cdf0e10cSrcweir 	sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
586*cdf0e10cSrcweir 	sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
587*cdf0e10cSrcweir 	OutputDevice* pOut=(OutputDevice*)pActualOutDev;
588*cdf0e10cSrcweir 	if (pOut==NULL) pOut=GetFirstOutputDevice(); //GetWin(0);
589*cdf0e10cSrcweir 	if (pOut==NULL) return sal_False;
590*cdf0e10cSrcweir 	SortMarkedObjects();
591*cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
592*cdf0e10cSrcweir 	sal_uIntPtr nMarkNum=bBack ? 0 : nMarkAnz;
593*cdf0e10cSrcweir 	if (bNext) {
594*cdf0e10cSrcweir 		nMarkNum=((SdrMarkView*)this)->TryToFindMarkedObject(pObj0);
595*cdf0e10cSrcweir 		if (nMarkNum==CONTAINER_ENTRY_NOTFOUND) return sal_False;
596*cdf0e10cSrcweir 		if (!bBack) nMarkNum++;
597*cdf0e10cSrcweir 	}
598*cdf0e10cSrcweir 	while (bBack ? nMarkNum<nMarkAnz : nMarkNum>0) {
599*cdf0e10cSrcweir 		if (!bBack) nMarkNum--;
600*cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
601*cdf0e10cSrcweir 		SdrObject* pObj=pM->GetMarkedSdrObj();
602*cdf0e10cSrcweir 		SdrPageView* pPV=pM->GetPageView();
603*cdf0e10cSrcweir 		const SdrGluePointList* pGPL=pObj->GetGluePointList();
604*cdf0e10cSrcweir 		if (pGPL!=NULL) {
605*cdf0e10cSrcweir 			sal_uInt16 nNum=pGPL->HitTest(rPnt,*pOut,pObj,bBack,bNext,nId0);
606*cdf0e10cSrcweir 			if (nNum!=SDRGLUEPOINT_NOTFOUND)
607*cdf0e10cSrcweir 			{
608*cdf0e10cSrcweir 				// #i38892#
609*cdf0e10cSrcweir 				const SdrGluePoint& rCandidate = (*pGPL)[nNum];
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 				if(rCandidate.IsUserDefined())
612*cdf0e10cSrcweir 				{
613*cdf0e10cSrcweir 					rpObj=pObj;
614*cdf0e10cSrcweir 					rnId=(*pGPL)[nNum].GetId();
615*cdf0e10cSrcweir 					rpPV=pPV;
616*cdf0e10cSrcweir 					return sal_True;
617*cdf0e10cSrcweir 				}
618*cdf0e10cSrcweir 			}
619*cdf0e10cSrcweir 		}
620*cdf0e10cSrcweir 		bNext=sal_False; // HitNextGluePoint nur beim ersten Obj
621*cdf0e10cSrcweir 		if (bBack) nMarkNum++;
622*cdf0e10cSrcweir 	}
623*cdf0e10cSrcweir 	return sal_False;
624*cdf0e10cSrcweir }
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* /*pPV*/, sal_Bool bUnmark)
627*cdf0e10cSrcweir {
628*cdf0e10cSrcweir 	if (!IsGluePointEditMode()) return sal_False;
629*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
630*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
631*cdf0e10cSrcweir 	if (pObj!=NULL) {
632*cdf0e10cSrcweir 		sal_uIntPtr nMarkPos=TryToFindMarkedObject(pObj);
633*cdf0e10cSrcweir 		if (nMarkPos!=CONTAINER_ENTRY_NOTFOUND) {
634*cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nMarkPos);
635*cdf0e10cSrcweir 			SdrUShortCont* pPts=bUnmark ? pM->GetMarkedGluePoints() : pM->ForceMarkedGluePoints();
636*cdf0e10cSrcweir 			if (pPts!=NULL) {
637*cdf0e10cSrcweir 				sal_uIntPtr nPointPos=pPts->GetPos(nId);
638*cdf0e10cSrcweir 				if (!bUnmark && nPointPos==CONTAINER_ENTRY_NOTFOUND) {
639*cdf0e10cSrcweir 					bChgd=sal_True;
640*cdf0e10cSrcweir 					pPts->Insert(nId);
641*cdf0e10cSrcweir 				}
642*cdf0e10cSrcweir 				if (bUnmark && nPointPos!=CONTAINER_ENTRY_NOTFOUND) {
643*cdf0e10cSrcweir 					bChgd=sal_True;
644*cdf0e10cSrcweir 					pPts->Remove(nPointPos);
645*cdf0e10cSrcweir 				}
646*cdf0e10cSrcweir 			}
647*cdf0e10cSrcweir 		} else {
648*cdf0e10cSrcweir 			// Objekt implizit markieren ...
649*cdf0e10cSrcweir 			// ... fehlende Implementation
650*cdf0e10cSrcweir 		}
651*cdf0e10cSrcweir 	}
652*cdf0e10cSrcweir 	if (bChgd) {
653*cdf0e10cSrcweir 		AdjustMarkHdl();
654*cdf0e10cSrcweir 		MarkListHasChanged();
655*cdf0e10cSrcweir 	}
656*cdf0e10cSrcweir 	return bChgd;
657*cdf0e10cSrcweir }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir sal_Bool SdrMarkView::IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const
660*cdf0e10cSrcweir {
661*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
662*cdf0e10cSrcweir 	sal_Bool bRet=sal_False;
663*cdf0e10cSrcweir 	sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj); // casting auf NonConst
664*cdf0e10cSrcweir 	if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
665*cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nPos);
666*cdf0e10cSrcweir 		const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
667*cdf0e10cSrcweir 		if (pPts!=NULL) {
668*cdf0e10cSrcweir 			bRet=pPts->Exist(nId);
669*cdf0e10cSrcweir 		}
670*cdf0e10cSrcweir 	}
671*cdf0e10cSrcweir 	return bRet;
672*cdf0e10cSrcweir }
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir sal_Bool SdrMarkView::UnmarkGluePoint(const SdrHdl& rHdl)
675*cdf0e10cSrcweir {
676*cdf0e10cSrcweir 	if (&rHdl!=NULL && rHdl.GetKind()==HDL_GLUE && rHdl.GetObj()!=NULL) {
677*cdf0e10cSrcweir 		return MarkGluePoint(rHdl.GetObj(),(sal_uInt16)rHdl.GetObjHdlNum(),rHdl.GetPageView(),sal_True);
678*cdf0e10cSrcweir 	} else return sal_False;
679*cdf0e10cSrcweir }
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir SdrHdl* SdrMarkView::GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
684*cdf0e10cSrcweir 	sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
685*cdf0e10cSrcweir 	for (sal_uIntPtr nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) {
686*cdf0e10cSrcweir 		SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
687*cdf0e10cSrcweir 		if (pHdl->GetObj()==pObj &&
688*cdf0e10cSrcweir 			pHdl->GetKind()==HDL_GLUE &&
689*cdf0e10cSrcweir 			pHdl->GetObjHdlNum()==nId ) return pHdl;
690*cdf0e10cSrcweir 	}
691*cdf0e10cSrcweir 	return NULL;
692*cdf0e10cSrcweir }
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkNextGluePoint(sal_Bool /*bPrev*/)
695*cdf0e10cSrcweir {
696*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
697*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
698*cdf0e10cSrcweir 	SortMarkedObjects();
699*cdf0e10cSrcweir 	// ...
700*cdf0e10cSrcweir 	if (bChgd) {
701*cdf0e10cSrcweir 		MarkListHasChanged();
702*cdf0e10cSrcweir 	}
703*cdf0e10cSrcweir 	return bChgd;
704*cdf0e10cSrcweir }
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir sal_Bool SdrMarkView::MarkNextGluePoint(const Point& /*rPnt*/, sal_Bool /*bPrev*/)
707*cdf0e10cSrcweir {
708*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
709*cdf0e10cSrcweir 	sal_Bool bChgd=sal_False;
710*cdf0e10cSrcweir 	SortMarkedObjects();
711*cdf0e10cSrcweir 	// ...
712*cdf0e10cSrcweir 	if (bChgd) {
713*cdf0e10cSrcweir 		MarkListHasChanged();
714*cdf0e10cSrcweir 	}
715*cdf0e10cSrcweir 	return bChgd;
716*cdf0e10cSrcweir }
717*cdf0e10cSrcweir 
718*cdf0e10cSrcweir const Rectangle& SdrMarkView::GetMarkedGluePointsRect() const
719*cdf0e10cSrcweir {
720*cdf0e10cSrcweir 	ForceUndirtyMrkPnt();
721*cdf0e10cSrcweir 	if (bMarkedPointsRectsDirty) ImpSetPointsRects();
722*cdf0e10cSrcweir 	return aMarkedGluePointsRect;
723*cdf0e10cSrcweir }
724*cdf0e10cSrcweir 
725