bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / svdraw / svdmark.cxx
blob2827c4f47f227547d592ddf281f531b5bed6e2fe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 #include <svx/svdmark.hxx>
24 #include <svx/svdetc.hxx>
25 #include <svx/svdobj.hxx>
26 #include <svx/svdpage.hxx>
27 #include "svx/svditer.hxx"
28 #include <svx/svdpagv.hxx>
29 #include <svx/svdopath.hxx> // To turn off
30 #include <svx/svdogrp.hxx> // the cache at
31 #include <svx/svdorect.hxx> // GetMarkDescription.
32 #include "svx/svdstr.hrc" // names taken from the resource
33 #include "svx/svdglob.hxx" // StringCache
35 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 #include <svx/obj3d.hxx>
37 #include <svx/scene3d.hxx>
38 #include <svl/brdcst.hxx>
39 #include <svx/svdoedge.hxx>
42 ////////////////////////////////////////////////////////////////////////////////////////////////////
44 SdrMark::SdrMark(SdrObject* pNewObj, SdrPageView* pNewPageView)
45 : mpSelectedSdrObject(pNewObj),
46 mpPageView(pNewPageView),
47 mpPoints(0L),
48 mpLines(0L),
49 mpGluePoints(0L),
50 mbCon1(sal_False),
51 mbCon2(sal_False),
52 mnUser(0)
54 if(mpSelectedSdrObject)
56 mpSelectedSdrObject->AddObjectUser( *this );
60 SdrMark::SdrMark(const SdrMark& rMark)
61 : ObjectUser(),
62 mpSelectedSdrObject(0L),
63 mpPageView(0L),
64 mpPoints(0L),
65 mpLines(0L),
66 mpGluePoints(0L),
67 mbCon1(sal_False),
68 mbCon2(sal_False),
69 mnUser(0)
71 *this = rMark;
74 SdrMark::~SdrMark()
76 if(mpSelectedSdrObject)
78 mpSelectedSdrObject->RemoveObjectUser( *this );
81 if(mpPoints)
83 delete mpPoints;
86 if(mpLines)
88 delete mpLines;
91 if(mpGluePoints)
93 delete mpGluePoints;
97 void SdrMark::ObjectInDestruction(const SdrObject& rObject)
99 (void) rObject; // avoid warnings
100 OSL_ENSURE(mpSelectedSdrObject && mpSelectedSdrObject == &rObject, "SdrMark::ObjectInDestruction: called form object different from hosted one (!)");
101 OSL_ENSURE(mpSelectedSdrObject, "SdrMark::ObjectInDestruction: still selected SdrObject is deleted, deselect first (!)");
102 mpSelectedSdrObject = 0L;
105 void SdrMark::SetMarkedSdrObj(SdrObject* pNewObj)
107 if(mpSelectedSdrObject)
109 mpSelectedSdrObject->RemoveObjectUser( *this );
112 mpSelectedSdrObject = pNewObj;
114 if(mpSelectedSdrObject)
116 mpSelectedSdrObject->AddObjectUser( *this );
120 SdrObject* SdrMark::GetMarkedSdrObj() const
122 return mpSelectedSdrObject;
125 SdrMark& SdrMark::operator=(const SdrMark& rMark)
127 SetMarkedSdrObj(rMark.mpSelectedSdrObject);
128 mpPageView = rMark.mpPageView;
129 mbCon1 = rMark.mbCon1;
130 mbCon2 = rMark.mbCon2;
131 mnUser = rMark.mnUser;
133 if(!rMark.mpPoints)
135 if(mpPoints)
137 delete mpPoints;
138 mpPoints = 0L;
141 else
143 if(!mpPoints)
145 mpPoints = new SdrUShortCont(*rMark.mpPoints);
147 else
149 *mpPoints = *rMark.mpPoints;
153 if(!rMark.mpLines)
155 if(mpLines)
157 delete mpLines;
158 mpLines = 0L;
161 else
163 if(!mpLines)
165 mpLines = new SdrUShortCont(*rMark.mpLines);
167 else
169 *mpLines = *rMark.mpLines;
173 if(!rMark.mpGluePoints)
175 if(mpGluePoints)
177 delete mpGluePoints;
178 mpGluePoints = 0L;
181 else
183 if(!mpGluePoints)
185 mpGluePoints = new SdrUShortCont(*rMark.mpGluePoints);
187 else
189 *mpGluePoints = *rMark.mpGluePoints;
193 return *this;
196 sal_Bool SdrMark::operator==(const SdrMark& rMark) const
198 sal_Bool bRet(mpSelectedSdrObject == rMark.mpSelectedSdrObject && mpPageView == rMark.mpPageView && mbCon1 == rMark.mbCon1 && mbCon2 == rMark.mbCon2 && mnUser == rMark.mnUser);
200 if((mpPoints != 0L) != (rMark.mpPoints != 0L))
201 bRet = sal_False;
203 if((mpLines != 0L) != (rMark.mpLines != 0L))
204 bRet = sal_False;
206 if((mpGluePoints != 0L) != (rMark.mpGluePoints != 0L))
207 bRet = sal_False;
209 if(bRet && mpPoints && *mpPoints != *rMark.mpPoints)
210 bRet = sal_False;
212 if(bRet && mpLines && *mpLines != *rMark.mpLines)
213 bRet = sal_False;
215 if(bRet && mpGluePoints && *mpGluePoints != *rMark.mpGluePoints)
216 bRet = sal_False;
218 return bRet;
221 ////////////////////////////////////////////////////////////////////////////////////////////////////
223 static bool ImpSdrMarkListSorter(SdrMark* const& lhs, SdrMark* const& rhs)
225 SdrObject* pObj1 = lhs->GetMarkedSdrObj();
226 SdrObject* pObj2 = rhs->GetMarkedSdrObj();
227 SdrObjList* pOL1 = (pObj1) ? pObj1->GetObjList() : 0L;
228 SdrObjList* pOL2 = (pObj2) ? pObj2->GetObjList() : 0L;
230 if (pOL1 == pOL2)
232 // AF: Note that I reverted a change from sal_uInt32 to sal_uLong (made
233 // for 64bit compliance, #i78198#) because internally in SdrObject
234 // both nOrdNum and mnNavigationPosition are stored as sal_uInt32.
235 sal_uInt32 nObjOrd1((pObj1) ? pObj1->GetNavigationPosition() : 0);
236 sal_uInt32 nObjOrd2((pObj2) ? pObj2->GetNavigationPosition() : 0);
238 return nObjOrd1 < nObjOrd2;
240 else
242 return (long)pOL1 < (long)pOL2;
246 ////////////////////////////////////////////////////////////////////////////////////////////////////
248 void SdrMarkList::ForceSort() const
250 if(!mbSorted)
252 ((SdrMarkList*)this)->ImpForceSort();
256 void SdrMarkList::ImpForceSort()
258 if(!mbSorted)
260 mbSorted = sal_True;
261 sal_uLong nAnz = maList.size();
263 // remove invalid
264 if(nAnz > 0 )
266 for(std::vector<SdrMark*>::iterator it = maList.begin(); it != maList.end(); )
268 SdrMark* pAkt = *it;
269 if(pAkt->GetMarkedSdrObj() == 0)
271 it = maList.erase( it );
272 delete pAkt;
274 else
275 ++it;
277 nAnz = maList.size();
280 if(nAnz > 1)
282 std::sort(maList.begin(), maList.end(), ImpSdrMarkListSorter);
284 // remove duplicates
285 if(maList.size() > 1)
287 SdrMark* pAkt = maList.back();
288 int i = maList.size() - 2;
289 while(i)
291 SdrMark* pCmp = maList[i];
292 if(pAkt->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj() && pAkt->GetMarkedSdrObj())
294 // Con1/Con2 Merging
295 if(pCmp->IsCon1())
296 pAkt->SetCon1(sal_True);
298 if(pCmp->IsCon2())
299 pAkt->SetCon2(sal_True);
301 // delete pCmp
302 maList.erase(maList.begin() + i);
304 delete pCmp;
306 else
308 pAkt = pCmp;
311 --i;
318 void SdrMarkList::Clear()
320 for(sal_uLong i(0L); i < GetMarkCount(); i++)
322 SdrMark* pMark = GetMark(i);
323 delete pMark;
326 maList.clear();
327 SetNameDirty();
330 void SdrMarkList::operator=(const SdrMarkList& rLst)
332 Clear();
334 for(sal_uLong i(0L); i < rLst.GetMarkCount(); i++)
336 SdrMark* pMark = rLst.GetMark(i);
337 SdrMark* pNeuMark = new SdrMark(*pMark);
338 maList.push_back(pNeuMark);
341 maMarkName = rLst.maMarkName;
342 mbNameOk = rLst.mbNameOk;
343 maPointName = rLst.maPointName;
344 mbPointNameOk = rLst.mbPointNameOk;
345 maGluePointName = rLst.maGluePointName;
346 mbGluePointNameOk = rLst.mbGluePointNameOk;
347 mbSorted = rLst.mbSorted;
350 SdrMark* SdrMarkList::GetMark(sal_uLong nNum) const
352 return (nNum < maList.size()) ? maList[nNum] : NULL;
355 sal_uLong SdrMarkList::FindObject(const SdrObject* pObj) const
357 // Since relying on OrdNums is not allowed for the selection because objects in the
358 // selection may not be inserted in a list if they are e.g. modified ATM, i changed
359 // this loop to just look if the object pointer is in the selection.
361 // Problem is that GetOrdNum() which is const, internally casts to non-const and
362 // hardly sets the OrdNum member of the object (nOrdNum) to 0 (ZERO) if the object
363 // is not inserted in a object list.
364 // Since this may be by purpose and necessary somewhere else i decided that it is
365 // less dangerous to change this method then changing SdrObject::GetOrdNum().
366 if(pObj && !maList.empty())
368 for(sal_uLong a(0L); a < maList.size(); a++)
370 if(maList[a]->GetMarkedSdrObj() == pObj)
372 return a;
377 return CONTAINER_ENTRY_NOTFOUND;
380 void SdrMarkList::InsertEntry(const SdrMark& rMark, sal_Bool bChkSort)
382 SetNameDirty();
383 sal_uLong nAnz(maList.size());
385 if(!bChkSort || !mbSorted || nAnz == 0)
387 if(!bChkSort)
388 mbSorted = sal_False;
390 maList.push_back(new SdrMark(rMark));
392 else
394 SdrMark* pLast = GetMark(sal_uLong(nAnz - 1));
395 const SdrObject* pLastObj = pLast->GetMarkedSdrObj();
396 const SdrObject* pNeuObj = rMark.GetMarkedSdrObj();
398 if(pLastObj == pNeuObj)
400 // This one already exists.
401 // Con1/Con2 Merging
402 if(rMark.IsCon1())
403 pLast->SetCon1(sal_True);
405 if(rMark.IsCon2())
406 pLast->SetCon2(sal_True);
408 else
410 SdrMark* pKopie = new SdrMark(rMark);
411 maList.push_back(pKopie);
413 // now check if the sort is ok
414 const SdrObjList* pLastOL = pLastObj!=0L ? pLastObj->GetObjList() : 0L;
415 const SdrObjList* pNeuOL = pNeuObj !=0L ? pNeuObj ->GetObjList() : 0L;
417 if(pLastOL == pNeuOL)
419 const sal_uLong nLastNum(pLastObj!=0L ? pLastObj->GetOrdNum() : 0);
420 const sal_uLong nNeuNum(pNeuObj !=0L ? pNeuObj ->GetOrdNum() : 0);
422 if(nNeuNum < nLastNum)
424 // at some point, we have to sort
425 mbSorted = sal_False;
428 else
430 // at some point, we have to sort
431 mbSorted = sal_False;
436 return;
439 void SdrMarkList::DeleteMark(sal_uLong nNum)
441 SdrMark* pMark = GetMark(nNum);
442 DBG_ASSERT(pMark!=0L,"DeleteMark: MarkEntry not found.");
444 if(pMark)
446 maList.erase(maList.begin() + nNum);
447 delete pMark;
448 SetNameDirty();
452 void SdrMarkList::ReplaceMark(const SdrMark& rNewMark, sal_uLong nNum)
454 SdrMark* pMark = GetMark(nNum);
455 DBG_ASSERT(pMark!=0L,"ReplaceMark: MarkEntry not found.");
457 if(pMark)
459 delete pMark;
460 SetNameDirty();
461 SdrMark* pKopie = new SdrMark(rNewMark);
462 maList[nNum] = pKopie;
463 mbSorted = sal_False;
467 void SdrMarkList::Merge(const SdrMarkList& rSrcList, sal_Bool bReverse)
469 sal_uLong nAnz(rSrcList.maList.size());
471 if(rSrcList.mbSorted)
473 // merge without forcing a Sort in rSrcList
474 bReverse = sal_False;
477 if(!bReverse)
479 for(sal_uLong i(0L); i < nAnz; i++)
481 SdrMark* pM = rSrcList.maList[i];
482 InsertEntry(*pM);
485 else
487 for(sal_uLong i(nAnz); i > 0;)
489 i--;
490 SdrMark* pM = rSrcList.maList[i];
491 InsertEntry(*pM);
496 sal_Bool SdrMarkList::DeletePageView(const SdrPageView& rPV)
498 sal_Bool bChgd(sal_False);
500 for(std::vector<SdrMark*>::iterator it = maList.begin(); it != maList.end(); )
502 SdrMark* pMark = *it;
504 if(pMark->GetPageView()==&rPV)
506 it = maList.erase(it);
507 delete pMark;
508 SetNameDirty();
509 bChgd = sal_True;
511 else
512 ++it;
515 return bChgd;
518 sal_Bool SdrMarkList::InsertPageView(const SdrPageView& rPV)
520 sal_Bool bChgd(sal_False);
521 DeletePageView(rPV); // delete all of them, then append the entire page
522 SdrObject* pObj;
523 const SdrObjList* pOL = rPV.GetObjList();
524 sal_uLong nObjAnz(pOL->GetObjCount());
526 for(sal_uLong nO(0L); nO < nObjAnz; nO++)
528 pObj = pOL->GetObj(nO);
529 sal_Bool bDoIt(rPV.IsObjMarkable(pObj));
531 if(bDoIt)
533 SdrMark* pM = new SdrMark(pObj, (SdrPageView*)&rPV);
534 maList.push_back(pM);
535 SetNameDirty();
536 bChgd = sal_True;
540 return bChgd;
543 const XubString& SdrMarkList::GetMarkDescription() const
545 sal_uLong nAnz(GetMarkCount());
547 if(mbNameOk && 1L == nAnz)
549 // if it's a single selection, cache only text frame
550 const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
551 const SdrTextObj* pTextObj = PTR_CAST(SdrTextObj, pObj);
553 if(!pTextObj || !pTextObj->IsTextFrame())
555 ((SdrMarkList*)(this))->mbNameOk = sal_False;
559 if(!mbNameOk)
561 SdrMark* pMark = GetMark(0);
562 XubString aNam;
564 if(!nAnz)
566 ((SdrMarkList*)(this))->maMarkName = ImpGetResStr(STR_ObjNameNoObj);
568 else if(1L == nAnz)
570 if(pMark->GetMarkedSdrObj())
572 pMark->GetMarkedSdrObj()->TakeObjNameSingul(aNam);
575 else
577 if(pMark->GetMarkedSdrObj())
579 pMark->GetMarkedSdrObj()->TakeObjNamePlural(aNam);
580 XubString aStr1;
581 sal_Bool bEq(sal_True);
583 for(sal_uLong i = 1; i < GetMarkCount() && bEq; i++)
585 SdrMark* pMark2 = GetMark(i);
586 pMark2->GetMarkedSdrObj()->TakeObjNamePlural(aStr1);
587 bEq = aNam.Equals(aStr1);
590 if(!bEq)
592 aNam = ImpGetResStr(STR_ObjNamePlural);
596 aNam.Insert(sal_Unicode(' '), 0);
597 aNam.Insert(OUString::number( nAnz ), 0);
600 ((SdrMarkList*)(this))->maMarkName = aNam;
601 ((SdrMarkList*)(this))->mbNameOk = sal_True;
604 return maMarkName;
607 const XubString& SdrMarkList::GetPointMarkDescription(sal_Bool bGlue) const
609 sal_Bool& rNameOk = (sal_Bool&)(bGlue ? mbGluePointNameOk : mbPointNameOk);
610 XubString& rName = (XubString&)(bGlue ? maGluePointName : maPointName);
611 sal_uLong nMarkAnz(GetMarkCount());
612 sal_uLong nMarkPtAnz(0L);
613 sal_uLong nMarkPtObjAnz(0L);
614 sal_uLong n1stMarkNum(ULONG_MAX);
616 for(sal_uLong nMarkNum(0L); nMarkNum < nMarkAnz; nMarkNum++)
618 const SdrMark* pMark = GetMark(nMarkNum);
619 const SdrUShortCont* pPts = bGlue ? pMark->GetMarkedGluePoints() : pMark->GetMarkedPoints();
620 sal_uLong nAnz(pPts ? pPts->size() : 0);
622 if(nAnz)
624 if(n1stMarkNum == ULONG_MAX)
626 n1stMarkNum = nMarkNum;
629 nMarkPtAnz += nAnz;
630 nMarkPtObjAnz++;
633 if(nMarkPtObjAnz > 1 && rNameOk)
635 // preliminary decision
636 return rName;
640 if(rNameOk && 1L == nMarkPtObjAnz)
642 // if it's a single selection, cache only text frame
643 const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
644 const SdrTextObj* pTextObj = PTR_CAST(SdrTextObj,pObj);
646 if(!pTextObj || !pTextObj->IsTextFrame())
648 rNameOk = sal_False;
652 if(!nMarkPtObjAnz)
654 rName.Erase();
655 rNameOk = sal_True;
657 else if(!rNameOk)
659 const SdrMark* pMark = GetMark(n1stMarkNum);
660 XubString aNam;
662 if(1L == nMarkPtObjAnz)
664 if(pMark->GetMarkedSdrObj())
666 pMark->GetMarkedSdrObj()->TakeObjNameSingul(aNam);
669 else
671 if(pMark->GetMarkedSdrObj())
673 pMark->GetMarkedSdrObj()->TakeObjNamePlural(aNam);
676 XubString aStr1;
677 sal_Bool bEq(sal_True);
679 for(sal_uLong i(n1stMarkNum + 1L); i < GetMarkCount() && bEq; i++)
681 const SdrMark* pMark2 = GetMark(i);
682 const SdrUShortCont* pPts = bGlue ? pMark2->GetMarkedGluePoints() : pMark2->GetMarkedPoints();
684 if(pPts && !pPts->empty() && pMark2->GetMarkedSdrObj())
686 pMark2->GetMarkedSdrObj()->TakeObjNamePlural(aStr1);
687 bEq = aNam.Equals(aStr1);
691 if(!bEq)
693 aNam = ImpGetResStr(STR_ObjNamePlural);
696 aNam.Insert(sal_Unicode(' '), 0);
697 aNam.Insert(OUString::number( nMarkPtObjAnz ), 0);
700 XubString aStr1;
702 if(1L == nMarkPtAnz)
704 aStr1 = (ImpGetResStr(bGlue ? STR_ViewMarkedGluePoint : STR_ViewMarkedPoint));
706 else
708 aStr1 = (ImpGetResStr(bGlue ? STR_ViewMarkedGluePoints : STR_ViewMarkedPoints));
709 aStr1.SearchAndReplaceAscii("%2", OUString::number( nMarkPtAnz ));
712 aStr1.SearchAndReplaceAscii("%1", aNam);
713 rName = aStr1;
714 rNameOk = sal_True;
717 return rName;
720 sal_Bool SdrMarkList::TakeBoundRect(SdrPageView* pPV, Rectangle& rRect) const
722 sal_Bool bFnd(sal_False);
723 Rectangle aR;
725 for(sal_uLong i(0L); i < GetMarkCount(); i++)
727 SdrMark* pMark = GetMark(i);
729 if(!pPV || pMark->GetPageView() == pPV)
731 if(pMark->GetMarkedSdrObj())
733 aR = pMark->GetMarkedSdrObj()->GetCurrentBoundRect();
735 if(bFnd)
737 rRect.Union(aR);
739 else
741 rRect = aR;
742 bFnd = sal_True;
748 return bFnd;
751 sal_Bool SdrMarkList::TakeSnapRect(SdrPageView* pPV, Rectangle& rRect) const
753 sal_Bool bFnd(sal_False);
755 for(sal_uLong i(0L); i < GetMarkCount(); i++)
757 SdrMark* pMark = GetMark(i);
759 if(!pPV || pMark->GetPageView() == pPV)
761 if(pMark->GetMarkedSdrObj())
763 Rectangle aR(pMark->GetMarkedSdrObj()->GetSnapRect());
765 if(bFnd)
767 rRect.Union(aR);
769 else
771 rRect = aR;
772 bFnd = sal_True;
778 return bFnd;
781 ////////////////////////////////////////////////////////////////////////////////////////////////////
783 namespace sdr
785 ViewSelection::ViewSelection()
786 : mbEdgesOfMarkedNodesDirty(sal_False)
790 void ViewSelection::SetEdgesOfMarkedNodesDirty()
792 if(!mbEdgesOfMarkedNodesDirty)
794 mbEdgesOfMarkedNodesDirty = sal_True;
795 maEdgesOfMarkedNodes.Clear();
796 maMarkedEdgesOfMarkedNodes.Clear();
797 maAllMarkedObjects.clear();
801 const SdrMarkList& ViewSelection::GetEdgesOfMarkedNodes() const
803 if(mbEdgesOfMarkedNodesDirty)
805 ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
808 return maEdgesOfMarkedNodes;
811 const SdrMarkList& ViewSelection::GetMarkedEdgesOfMarkedNodes() const
813 if(mbEdgesOfMarkedNodesDirty)
815 ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
818 return maMarkedEdgesOfMarkedNodes;
821 const std::vector<SdrObject*>& ViewSelection::GetAllMarkedObjects() const
823 if(mbEdgesOfMarkedNodesDirty)
824 ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
826 return maAllMarkedObjects;
829 void ViewSelection::ImplCollectCompleteSelection(SdrObject* pObj)
831 if(pObj)
833 sal_Bool bIsGroup(pObj->IsGroupObject());
835 if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene))
837 bIsGroup = sal_False;
840 if(bIsGroup)
842 SdrObjList* pList = pObj->GetSubList();
844 for(sal_uLong a(0L); a < pList->GetObjCount(); a++)
846 SdrObject* pObj2 = pList->GetObj(a);
847 ImplCollectCompleteSelection(pObj2);
851 maAllMarkedObjects.push_back(pObj);
855 void ViewSelection::ImpForceEdgesOfMarkedNodes()
857 if(mbEdgesOfMarkedNodesDirty)
859 mbEdgesOfMarkedNodesDirty = sal_False;
860 maMarkedObjectList.ForceSort();
861 maEdgesOfMarkedNodes.Clear();
862 maMarkedEdgesOfMarkedNodes.Clear();
863 maAllMarkedObjects.clear();
865 // GetMarkCount after ForceSort
866 const sal_uLong nMarkAnz(maMarkedObjectList.GetMarkCount());
868 for(sal_uLong a(0L); a < nMarkAnz; a++)
870 SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
872 if(pCandidate)
874 // build transitive hull
875 ImplCollectCompleteSelection(pCandidate);
877 if(pCandidate->IsNode())
879 // travel over broadcaster/listener to access edges connected to the selected object
880 const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
882 if(pBC)
884 sal_uInt16 nLstAnz(pBC->GetListenerCount());
886 for(sal_uInt16 nl(0); nl < nLstAnz; nl++)
888 SfxListener* pLst = pBC->GetListener(nl);
889 SdrEdgeObj* pEdge = PTR_CAST(SdrEdgeObj, pLst);
891 if(pEdge && pEdge->IsInserted() && pEdge->GetPage() == pCandidate->GetPage())
893 SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
895 if(pEdge->GetConnectedNode(sal_True) == pCandidate)
897 aM.SetCon1(sal_True);
900 if(pEdge->GetConnectedNode(sal_False) == pCandidate)
902 aM.SetCon2(sal_True);
905 if(CONTAINER_ENTRY_NOTFOUND == maMarkedObjectList.FindObject(pEdge))
907 // check if it itself is selected
908 maEdgesOfMarkedNodes.InsertEntry(aM);
910 else
912 maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
921 maEdgesOfMarkedNodes.ForceSort();
922 maMarkedEdgesOfMarkedNodes.ForceSort();
925 } // end of namespace sdr
927 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */