Kaydet (Commit) 2a6806a8 authored tarafından Noel Grandin's avatar Noel Grandin

convert SDRSNAP_ constants to scoped enum

Change-Id: Ida0b0e3f017c53588ea9208d078c24948a63eb92
üst 62f9bc73
...@@ -169,7 +169,7 @@ protected: ...@@ -169,7 +169,7 @@ protected:
const Rectangle& GetDragLimitRect() { return getSdrDragView().aDragLimit; } const Rectangle& GetDragLimitRect() { return getSdrDragView().aDragLimit; }
const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); } const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); }
Point GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().pMarkedPV); } Point GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().pMarkedPV); }
sal_uInt16 SnapPos(Point& rPt) const { return getSdrDragView().SnapPos(rPt,getSdrDragView().pMarkedPV); } SdrSnap SnapPos(Point& rPt) const { return getSdrDragView().SnapPos(rPt,getSdrDragView().pMarkedPV); }
inline const Rectangle& GetMarkedRect() const; inline const Rectangle& GetMarkedRect() const;
SdrPageView* GetDragPV() const; SdrPageView* GetDragPV() const;
SdrObject* GetDragObj() const; SdrObject* GetDragObj() const;
......
...@@ -23,12 +23,21 @@ ...@@ -23,12 +23,21 @@
#include <svx/svdpntv.hxx> #include <svx/svdpntv.hxx>
#include <svx/svdhlpln.hxx> #include <svx/svdhlpln.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <o3tl/typed_flags_set.hxx>
#define SDRSNAP_NOTSNAPPED 0x0000 /** return value for SnapPos() method */
#define SDRSNAP_XSNAPPED 0x0001 enum class SdrSnap
#define SDRSNAP_YSNAPPED 0x0002 {
#define SDRSNAP_XYSNAPPED 0x0003 NOTSNAPPED = 0x00,
XSNAPPED = 0x01,
YSNAPPED = 0x02,
XYSNAPPED = XSNAPPED | YSNAPPED,
};
namespace o3tl
{
template<> struct typed_flags<SdrSnap> : is_typed_flags<SdrSnap, 3> {};
}
// SDRCROOK_STRETCH is not implemented yet! // SDRCROOK_STRETCH is not implemented yet!
enum SdrCrookMode { enum SdrCrookMode {
...@@ -112,9 +121,9 @@ public: ...@@ -112,9 +121,9 @@ public:
void SetActualWin(const OutputDevice* pWin) { SdrPaintView::SetActualWin(pWin); if (pWin!=NULL) RecalcLogicSnapMagnetic(*pWin); } void SetActualWin(const OutputDevice* pWin) { SdrPaintView::SetActualWin(pWin); if (pWin!=NULL) RecalcLogicSnapMagnetic(*pWin); }
// Coordinates referred to the view! // Coordinates referred to the view!
// Returnvalues are SDRSNAP_NOTSNAPPED,SDRSNAP_XSNAPPED, // Returnvalues are SdrSnap::NOTSNAPPED,SdrSnap::XSNAPPED,
// SDRSNAP_YSNAPPED or SDRSNAP_XYSNAPPED // SdrSnap::YSNAPPED or SdrSnap::XYSNAPPED
sal_uInt16 SnapPos(Point& rPnt, const SdrPageView* pPV) const; SdrSnap SnapPos(Point& rPnt, const SdrPageView* pPV) const;
Point GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const; Point GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const;
void CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const; void CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const;
......
...@@ -1557,10 +1557,10 @@ basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation() ...@@ -1557,10 +1557,10 @@ basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation()
void SdrDragMove::ImpCheckSnap(const Point& rPt) void SdrDragMove::ImpCheckSnap(const Point& rPt)
{ {
Point aPt(rPt); Point aPt(rPt);
sal_uInt16 nRet=SnapPos(aPt); SdrSnap nRet=SnapPos(aPt);
aPt-=rPt; aPt-=rPt;
if ((nRet & SDRSNAP_XSNAPPED) !=0) if (nRet & SdrSnap::XSNAPPED)
{ {
if (bXSnapped) if (bXSnapped)
{ {
...@@ -1576,7 +1576,7 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt) ...@@ -1576,7 +1576,7 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt)
} }
} }
if ((nRet & SDRSNAP_YSNAPPED) !=0) if (nRet & SdrSnap::YSNAPPED)
{ {
if (bYSnapped) if (bYSnapped)
{ {
......
...@@ -282,14 +282,14 @@ Point SdrSnapView::GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const ...@@ -282,14 +282,14 @@ Point SdrSnapView::GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const
} }
#define NOT_SNAPPED 0x7FFFFFFF #define NOT_SNAPPED 0x7FFFFFFF
sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
{ {
if (!bSnapEnab) return SDRSNAP_NOTSNAPPED; if (!bSnapEnab) return SdrSnap::NOTSNAPPED;
long x=rPnt.X(); long x=rPnt.X();
long y=rPnt.Y(); long y=rPnt.Y();
if (pPV==NULL) { if (pPV==NULL) {
pPV=GetSdrPageView(); pPV=GetSdrPageView();
if (pPV==NULL) return SDRSNAP_NOTSNAPPED; if (pPV==NULL) return SdrSnap::NOTSNAPPED;
} }
long dx=NOT_SNAPPED; long dx=NOT_SNAPPED;
...@@ -424,9 +424,9 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const ...@@ -424,9 +424,9 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
dy = 0; dy = 0;
} }
} }
sal_uInt16 bRet=SDRSNAP_NOTSNAPPED; SdrSnap bRet=SdrSnap::NOTSNAPPED;
if (dx==NOT_SNAPPED) dx=0; else bRet|=SDRSNAP_XSNAPPED; if (dx==NOT_SNAPPED) dx=0; else bRet|=SdrSnap::XSNAPPED;
if (dy==NOT_SNAPPED) dy=0; else bRet|=SDRSNAP_YSNAPPED; if (dy==NOT_SNAPPED) dy=0; else bRet|=SdrSnap::YSNAPPED;
rPnt.X()=x+dx; rPnt.X()=x+dx;
rPnt.Y()=y+dy; rPnt.Y()=y+dy;
return bRet; return bRet;
...@@ -435,9 +435,9 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const ...@@ -435,9 +435,9 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
void SdrSnapView::CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const void SdrSnapView::CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const
{ {
Point aPt(rPt); Point aPt(rPt);
sal_uInt16 nRet=SnapPos(aPt,pPV); SdrSnap nRet=SnapPos(aPt,pPV);
aPt-=rPt; aPt-=rPt;
if ((nRet & SDRSNAP_XSNAPPED) !=0) { if (nRet & SdrSnap::XSNAPPED) {
if (bXSnapped) { if (bXSnapped) {
if (std::abs(aPt.X())<std::abs(nBestXSnap)) { if (std::abs(aPt.X())<std::abs(nBestXSnap)) {
nBestXSnap=aPt.X(); nBestXSnap=aPt.X();
...@@ -447,7 +447,7 @@ void SdrSnapView::CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBes ...@@ -447,7 +447,7 @@ void SdrSnapView::CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBes
bXSnapped=true; bXSnapped=true;
} }
} }
if ((nRet & SDRSNAP_YSNAPPED) !=0) { if (nRet & SdrSnap::YSNAPPED) {
if (bYSnapped) { if (bYSnapped) {
if (std::abs(aPt.Y())<std::abs(nBestYSnap)) { if (std::abs(aPt.Y())<std::abs(nBestYSnap)) {
nBestYSnap=aPt.Y(); nBestYSnap=aPt.Y();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment