diff options
author | hg <hg@oosvn01.> | 2009-10-08 15:56:43 +0000 |
---|---|---|
committer | hg <hg@oosvn01.> | 2009-10-08 15:56:43 +0000 |
commit | f583724a28504c9d0bd710e87b760b9a0c903e43 (patch) | |
tree | fdf29eb15dc63d37634d74d7af0adf67387a0210 /basctl | |
parent | a72dade8aa93bf07e5e66d0f61ae92e11f505c67 (diff) | |
parent | 5fb2028499e85dfe2ceaa2328adc90439946ff25 (diff) |
merge with m53
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/prj/build.lst | 2 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 74 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedview.cxx | 66 | ||||
-rw-r--r-- | basctl/source/inc/dlgedobj.hxx | 3 | ||||
-rw-r--r-- | basctl/source/inc/dlgedview.hxx | 5 |
5 files changed, 72 insertions, 78 deletions
diff --git a/basctl/prj/build.lst b/basctl/prj/build.lst index d452aa3b6475..a48a698a99a7 100644 --- a/basctl/prj/build.lst +++ b/basctl/prj/build.lst @@ -1,4 +1,4 @@ -bc basctl : svx NULL +bc basctl : l10n svx NULL bc basctl usr1 - all bc_mkout NULL bc basctl\inc nmake - all bc_inc NULL bc basctl\source\inc get - all bc_sinc NULL diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index f8cec9ee785f..ff0cafc80177 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -1377,54 +1377,6 @@ void DlgEdObj::SetLayer(SdrLayerID nLayer) //---------------------------------------------------------------------------- -SdrObject* DlgEdObj::CheckHit( const Point& rPnt, USHORT nTol,const SetOfByte* pSet ) const -{ - // #109994# fixed here, because the drawing layer doesn't handle objects - // with a width or height of 0 in a proper way - Rectangle aRect_( aOutRect ); - if ( aRect_.IsEmpty() ) - { - aRect_.Left() -= nTol; - aRect_.Top() -= nTol; - aRect_.Right() = ( aRect_.Right() == RECT_EMPTY ? aOutRect.Left() + nTol : aRect_.Right() + nTol ); - aRect_.Bottom() = ( aRect_.Bottom() == RECT_EMPTY ? aOutRect.Top() + nTol : aRect_.Bottom() + nTol ); - - if ( aRect_.IsInside( rPnt ) ) - return (SdrObject*)this; - else - return 0; - } - - if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" )) - { - Rectangle aROuter = aOutRect; - aROuter.Left() -= nTol; - aROuter.Right() += nTol; - aROuter.Top() -= nTol; - aROuter.Bottom() += nTol; - - Rectangle aRInner = aOutRect; - if( (aRInner.GetSize().Height() > (long)nTol*2) && - (aRInner.GetSize().Width() > (long)nTol*2) ) - { - aRInner.Left() += nTol; - aRInner.Right() -= nTol; - aRInner.Top() += nTol; - aRInner.Bottom() -= nTol; - } - - if( aROuter.IsInside( rPnt ) && !aRInner.IsInside( rPnt ) ) - return (SdrObject*)this; - else - return 0; - } - else - return SdrUnoObj::CheckHit( rPnt, nTol, pSet ); -} - - -//---------------------------------------------------------------------------- - TYPEINIT1(DlgEdForm, DlgEdObj); DBG_NAME(DlgEdForm); @@ -1857,32 +1809,6 @@ void DlgEdForm::UpdateTabOrderAndGroups() //---------------------------------------------------------------------------- -SdrObject* DlgEdForm::CheckHit( const Point& rPnt, USHORT nTol, const SetOfByte* ) const -{ - Rectangle aROuter = aOutRect; - aROuter.Left() -= nTol; - aROuter.Right() += nTol; - aROuter.Top() -= nTol; - aROuter.Bottom() += nTol; - - Rectangle aRInner = aOutRect; - if( (aRInner.GetSize().Height() > (long)nTol*2) && - (aRInner.GetSize().Width() > (long)nTol*2) ) - { - aRInner.Left() += nTol; - aRInner.Right() -= nTol; - aRInner.Top() += nTol; - aRInner.Bottom() -= nTol; - } - - if( aROuter.IsInside( rPnt ) && !aRInner.IsInside( rPnt ) ) - return (SdrObject*)this; - else - return 0; -} - -//---------------------------------------------------------------------------- - void DlgEdForm::NbcMove( const Size& rSize ) { SdrUnoObj::NbcMove( rSize ); diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx index 50b7ae7f28df..19b58e763113 100644 --- a/basctl/source/dlged/dlgedview.cxx +++ b/basctl/source/dlged/dlgedview.cxx @@ -43,6 +43,7 @@ #include <basidesh.hxx> #include <iderdll.hxx> +#include "dlgedobj.hxx" TYPEINIT1( DlgEdView, SdrView ); @@ -151,3 +152,68 @@ void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) //---------------------------------------------------------------------------- +SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, USHORT nTol) +{ + DlgEdObj* pDlgEdObj = dynamic_cast< DlgEdObj* >(pRetval); + + if(pDlgEdObj) + { + bool bExcludeInner(false); + + if(0 != dynamic_cast< DlgEdForm* >(pRetval)) + { + // from DlgEdForm::CheckHit; exclude inner for DlgEdForm + bExcludeInner = true; + } + else if(pDlgEdObj->supportsService("com.sun.star.awt.UnoControlGroupBoxModel")) + { + // from DlgEdObj::CheckHit; exclude inner for group shapes + bExcludeInner = true; + } + + if(bExcludeInner) + { + // use direct model data; it's a DlgEdObj, so GetLastBoundRect() + // will access aOutRect directly + const Rectangle aOuterRectangle(pDlgEdObj->GetLastBoundRect()); + + if(!aOuterRectangle.IsEmpty() + && RECT_EMPTY != aOuterRectangle.Right() + && RECT_EMPTY != aOuterRectangle.Bottom()) + { + basegfx::B2DRange aOuterRange( + aOuterRectangle.Left(), aOuterRectangle.Top(), + aOuterRectangle.Right(), aOuterRectangle.Bottom()); + + if(nTol) + { + aOuterRange.grow(-1.0 * nTol); + } + + if(aOuterRange.isInside(basegfx::B2DPoint(rPnt.X(), rPnt.Y()))) + { + pRetval = 0; + } + } + } + } + + return pRetval; +} + +SdrObject* DlgEdView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const +{ + // call parent + SdrObject* pRetval = SdrView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay); + + if(pRetval) + { + // check hitted object locally + pRetval = impLocalHitCorrection(pRetval, rPnt, nTol); + } + + return pRetval; +} + +//---------------------------------------------------------------------------- +// eof diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index 6061eff2a8df..8d0f46b089f0 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -140,7 +140,6 @@ public: virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); virtual void SetLayer(SdrLayerID nLayer); - virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const; }; @@ -194,8 +193,6 @@ public: virtual void UpdateGroups(); virtual void UpdateTabOrderAndGroups(); - virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const; - ::com::sun::star::awt::DeviceInfo getDeviceInfo() const; private: diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx index 5b9538c347f8..11d580634e99 100644 --- a/basctl/source/inc/dlgedview.hxx +++ b/basctl/source/inc/dlgedview.hxx @@ -53,6 +53,11 @@ public: virtual void MarkListHasChanged(); virtual void MakeVisible( const Rectangle& rRect, Window& rWin ); + +protected: + // overloaded to handle HitTest for some objects special + using SdrView::CheckSingleSdrObjectHit; + virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const; }; #endif //_BASCTL_DLGEDVIEW_HXX |