summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2017-12-22 23:36:55 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2017-12-27 16:34:13 +0100
commitaa109e6a6fe771965acd17c00126aff74ca6f5c2 (patch)
tree6eb5d3442499980a110b83321d7b6b661ce9c9f3
parent828a7ffd3e76d21d65edb822299ca0c5a2b70ef2 (diff)
Share common code
Change-Id: Ia6ee42c799e566ad837e89d6456c50c7217da1eb
-rw-r--r--include/svx/svdmrkv.hxx5
-rw-r--r--svx/source/svdraw/svdmrkv.cxx22
2 files changed, 5 insertions, 22 deletions
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 1741f7c8ca38..b670782d3137 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -162,6 +162,7 @@ protected:
bool MarkGluePoints(const tools::Rectangle* pRect, bool bUnmark);
void SetMoveOutside(bool bOn);
+ bool MarkableObjectsExceed( int n ) const;
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
@@ -200,7 +201,7 @@ public:
bool IsFrameHandles() const { return mbForceFrameHandles; }
// returns true if number of markable objects is greater than 1
- bool HasMultipleMarkableObjects() const;
+ bool HasMultipleMarkableObjects() const { return MarkableObjectsExceed(1); };
void SetEditMode(SdrViewEditMode eMode);
SdrViewEditMode GetEditMode() const { return meEditMode; }
@@ -218,7 +219,7 @@ public:
void SetFrameDragSingles(bool bOn=true) { SetFrameHandles(bOn); }
bool IsFrameDragSingles() const { return IsFrameHandles(); }
- bool HasMarkableObj() const;
+ bool HasMarkableObj() const { return MarkableObjectsExceed(0); };
// migrate selections
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index d02758a6eee8..2afc197bb8b8 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -522,41 +522,23 @@ void SdrMarkView::BrkMarkGluePoints()
}
}
-bool SdrMarkView::HasMultipleMarkableObjects() const
+bool SdrMarkView::MarkableObjectsExceed( int n ) const
{
SdrPageView* pPV = GetSdrPageView();
if (!pPV)
return false;
- int nCount=0;
SdrObjList* pOL=pPV->GetObjList();
const size_t nObjCount = pOL->GetObjCount();
for (size_t nObjNum=0; nObjNum<nObjCount; ++nObjNum) {
SdrObject* pObj=pOL->GetObj(nObjNum);
- if (IsObjMarkable(pObj,pPV) && ++nCount>1)
+ if (IsObjMarkable(pObj,pPV) && --n<0)
return true;
}
return false;
}
-bool SdrMarkView::HasMarkableObj() const
-{
- SdrPageView* pPV = GetSdrPageView();
- if(pPV)
- {
- SdrObjList* pOL=pPV->GetObjList();
- const size_t nObjCount = pOL->GetObjCount();
- for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) {
- SdrObject* pObj=pOL->GetObj(nObjNum);
- if (IsObjMarkable(pObj,pPV)) {
- return true;
- }
- }
- }
- return false;
-}
-
void SdrMarkView::hideMarkHandles()
{
if(!mbMarkHandlesHidden)