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