27#include <svx/strings.hrc>
35#include <osl/diagnose.h>
42 osl_getSystemTime(&aNow);
43 mnTimeStamp = sal_Int64(aNow.Seconds) * 1000000000 + aNow.Nanosec;
47: mpSelectedSdrObject(pNewObj),
48 mpPageView(pNewPageView),
63 mpSelectedSdrObject(nullptr),
84 OSL_ENSURE(
mpSelectedSdrObject,
"SdrMark::ObjectInDestruction: still selected SdrObject is deleted, deselect first (!)");
120 SdrObject* pObj1 = lhs->GetMarkedSdrObj();
121 SdrObject* pObj2 = rhs->GetMarkedSdrObj();
133 return nObjOrd1 < nObjOrd2;
162 [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
232 return (nNum <
maList.size()) ?
maList[nNum].get() :
nullptr;
248 for(
size_t a = 0;
a <
maList.size(); ++
a)
250 if(
maList[
a]->GetMarkedSdrObj() == pObj)
278 if(pLastObj == pNewObj)
296 if(pLastOL == pNewOL)
299 const sal_uLong nNewNum(pNewObj !=
nullptr ? pNewObj ->GetOrdNum() : 0);
301 if(nNewNum < nLastNum)
319 DBG_ASSERT(pMark!=
nullptr,
"DeleteMark: MarkEntry not found.");
333 DBG_ASSERT(pMark!=
nullptr,
"ReplaceMark: MarkEntry not found.");
400 for(
size_t nO = 0; nO < nObjCount; ++nO)
468 aNam = OUString::number(
nCount ) +
" " + aNam;
483 size_t nMarkPtCnt(0);
484 size_t nMarkPtObjCnt(0);
485 size_t n1stMarkNum(SAL_MAX_SIZE);
487 for(
size_t nMarkNum = 0; nMarkNum < nMarkCount; ++nMarkNum)
494 if(n1stMarkNum == SAL_MAX_SIZE)
496 n1stMarkNum = nMarkNum;
499 nMarkPtCnt += rPts.
size();
503 if(nMarkPtObjCnt > 1 && rNameOk)
510 if(rNameOk && 1 == nMarkPtObjCnt)
532 if(1 == nMarkPtObjCnt)
565 aNam = OUString::number( nMarkPtObjCnt ) +
" " + aNam;
572 aStr1 =
SvxResId(bGlue ? STR_ViewMarkedGluePoint : STR_ViewMarkedPoint);
576 aStr1 =
SvxResId(bGlue ? STR_ViewMarkedGluePoints : STR_ViewMarkedPoints);
577 aStr1 = aStr1.replaceFirst(
"%2", OUString::number( nMarkPtCnt ));
580 aStr1 = aStr1.replaceFirst(
"%1", aNam);
652 ViewSelection::ViewSelection()
653 : mbEdgesOfMarkedNodesDirty(false)
657 void ViewSelection::SetEdgesOfMarkedNodesDirty()
659 if(!mbEdgesOfMarkedNodesDirty)
661 mbEdgesOfMarkedNodesDirty =
true;
662 maEdgesOfMarkedNodes.Clear();
663 maMarkedEdgesOfMarkedNodes.Clear();
664 maAllMarkedObjects.clear();
668 const SdrMarkList& ViewSelection::GetEdgesOfMarkedNodes()
const
670 if(mbEdgesOfMarkedNodesDirty)
672 const_cast<ViewSelection*
>(
this)->ImpForceEdgesOfMarkedNodes();
675 return maEdgesOfMarkedNodes;
678 const SdrMarkList& ViewSelection::GetMarkedEdgesOfMarkedNodes()
const
680 if(mbEdgesOfMarkedNodesDirty)
682 const_cast<ViewSelection*
>(
this)->ImpForceEdgesOfMarkedNodes();
685 return maMarkedEdgesOfMarkedNodes;
688 const std::vector<SdrObject*>& ViewSelection::GetAllMarkedObjects()
const
690 if(mbEdgesOfMarkedNodesDirty)
691 const_cast<ViewSelection*
>(
this)->ImpForceEdgesOfMarkedNodes();
693 return maAllMarkedObjects;
696 void ViewSelection::ImplCollectCompleteSelection(
SdrObject* pObj)
715 ImplCollectCompleteSelection(pObj2);
719 maAllMarkedObjects.push_back(pObj);
722 void ViewSelection::ImpForceEdgesOfMarkedNodes()
724 if(!mbEdgesOfMarkedNodesDirty)
727 mbEdgesOfMarkedNodesDirty =
false;
728 maMarkedObjectList.ForceSort();
729 maEdgesOfMarkedNodes.Clear();
730 maMarkedEdgesOfMarkedNodes.Clear();
731 maAllMarkedObjects.clear();
734 const size_t nMarkCount(maMarkedObjectList.GetMarkCount());
736 for(
size_t a = 0;
a < nMarkCount; ++
a)
738 SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
743 ImplCollectCompleteSelection(pCandidate);
757 SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
769 if(SAL_MAX_SIZE == maMarkedObjectList.FindObject(pEdge))
772 maEdgesOfMarkedNodes.InsertEntry(aM);
776 maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
782 maEdgesOfMarkedNodes.ForceSort();
783 maMarkedEdgesOfMarkedNodes.ForceSort();
Utility class SdrEdgeObj.
SdrObject * GetConnectedNode(bool bTail1) const override
const OUString & GetMarkDescription() const
size_t FindObject(const SdrObject *pObj) const
SVX_DLLPRIVATE void ImpForceSort()
void ReplaceMark(const SdrMark &rNewMark, size_t nNum)
size_t GetMarkCount() const
bool InsertPageView(const SdrPageView &rPV)
bool TakeBoundRect(SdrPageView const *pPageView, tools::Rectangle &rRect) const
bool TakeSnapRect(SdrPageView const *pPageView, tools::Rectangle &rRect) const
bool DeletePageView(const SdrPageView &rPV)
SdrMarkList & operator=(const SdrMarkList &rLst)
void InsertEntry(const SdrMark &rMark, bool bChkSort=true)
std::vector< std::unique_ptr< SdrMark > > maList
SdrMark * GetMark(size_t nNum) const
void DeleteMark(size_t nNum)
void Merge(const SdrMarkList &rSrcList, bool bReverse=false)
const OUString & GetPointMarkDescription() const
Everything a View needs to know about a selected object.
SdrMark & operator=(const SdrMark &rMark)
SdrPageView * GetPageView() const
SdrMark(SdrObject *pNewObj=nullptr, SdrPageView *pNewPageView=nullptr)
void SetMarkedSdrObj(SdrObject *pNewObj)
SdrObject * GetMarkedSdrObj() const
virtual void ObjectInDestruction(const SdrObject &rObject) override
SdrObject * mpSelectedSdrObject
SdrUShortCont maGluePoints
const SdrUShortCont & GetMarkedGluePoints() const
const SdrUShortCont & GetMarkedPoints() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
const SfxBroadcaster * GetBroadcaster() const
virtual OUString TakeObjNamePlural() const
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
virtual SdrObjList * GetSubList() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrObjList * getParentSdrObjListFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
bool IsGroupObject() const
void AddObjectUser(sdr::ObjectUser &rNewUser)
sal_uInt32 GetNavigationPosition() const
SdrPage * getSdrPageFromSdrObject() const
virtual OUString TakeObjNameSingul() const
void RemoveObjectUser(sdr::ObjectUser &rOldUser)
bool IsObjMarkable(SdrObject const *pObj) const
At least one member must be visible for the Group object and it must not be locked.
SdrObjList * GetObjList() const
Return current List.
void ForAllListeners(std::function< bool(SfxListener *)> f) const
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
static bool ImpSdrMarkListSorter(std::unique_ptr< SdrMark > const &lhs, std::unique_ptr< SdrMark > const &rhs)
E3dObject * DynCastE3dObject(SdrObject *pObj)
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
E3dScene * DynCastE3dScene(SdrObject *pObj)