diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
commit | f088879bac7cb8149b116eea22a51cfb54012b3c (patch) | |
tree | 7fe914382ccef332b3c7579ba6dc09eeb8b3657f /basctl/source/dlged | |
parent | 78fe4e5d494327cd0d0ea21f1663b1722583629e (diff) | |
parent | b4f7e9e44292d81c4645e790545461943fb003c6 (diff) |
merge commit to DEV300_m57
Diffstat (limited to 'basctl/source/dlged')
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 101 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedview.cxx | 66 |
2 files changed, 66 insertions, 101 deletions
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index f8cec9ee785f..6211b8552bc3 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -88,16 +88,6 @@ DlgEdObj::DlgEdObj() //---------------------------------------------------------------------------- -DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName) - :SdrUnoObj(rModelName, sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm( NULL ) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac) :SdrUnoObj(rModelName, rxSFac, sal_False) @@ -1377,76 +1367,11 @@ 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); //---------------------------------------------------------------------------- -DlgEdForm::DlgEdForm(const ::rtl::OUString& rModelName) - :DlgEdObj(rModelName) -{ - DBG_CTOR(DlgEdForm, NULL); -} - -//---------------------------------------------------------------------------- - -DlgEdForm::DlgEdForm(const ::rtl::OUString& rModelName, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac) - :DlgEdObj(rModelName, rxSFac) -{ - DBG_CTOR(DlgEdForm, NULL); -} - -//---------------------------------------------------------------------------- - DlgEdForm::DlgEdForm() :DlgEdObj() { @@ -1857,32 +1782,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 |