Kaydet (Commit) f9f3e97c authored tarafından Stephan Bergmann's avatar Stephan Bergmann

SdrObjEditView::IsTextEditHit effectively ignores its nTol argument

...ever since

  nTol=0; // Joe am 6.3.1997: Keine Hittoleranz mehr hier

had been added into it sometime prior to
fd069bee "initial import."  So lets assume Joe
meant that as a permanent fix rather than a temporal hack (which would have
survived for longer than 18 years anyway).

Change-Id: Ib30ac8d578f70c861d4c0f5f71bf4c13e9281db8
üst 2bff291a
...@@ -215,8 +215,6 @@ OUString lcl_getFormatCommandForObjectCID( const OUString& rCID ) ...@@ -215,8 +215,6 @@ OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
} // anonymous namespace } // anonymous namespace
const short HITPIX=2; //hit-tolerance in pixel
// awt::XWindow // awt::XWindow
void SAL_CALL ChartController::setPosSize( void SAL_CALL ChartController::setPosSize(
sal_Int32 X, sal_Int32 X,
...@@ -581,7 +579,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -581,7 +579,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
if( pDrawViewWrapper->IsTextEdit() ) if( pDrawViewWrapper->IsTextEdit() )
{ {
SdrViewEvent aVEvt; SdrViewEvent aVEvt;
if ( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX ) || if ( pDrawViewWrapper->IsTextEditHit( aMPos ) ||
// #i12587# support for shapes in chart // #i12587# support for shapes in chart
( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) ) ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) )
{ {
...@@ -1836,7 +1834,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) ...@@ -1836,7 +1834,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
if ( m_pDrawViewWrapper->IsTextEdit() ) if ( m_pDrawViewWrapper->IsTextEdit() )
{ {
if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) ) if( m_pDrawViewWrapper->IsTextEditHit( aMousePos ) )
{ {
m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer( m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferredPointer(
aMousePos, m_pChartWindow, nModifier, bLeftDown ) ); aMousePos, m_pChartWindow, nModifier, bLeftDown ) );
......
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
// This method returns sal_True, if the point rHit is inside the // This method returns sal_True, if the point rHit is inside the
// objectspace or the OutlinerView. // objectspace or the OutlinerView.
bool IsTextEditHit(const Point& rHit, short nTol) const; bool IsTextEditHit(const Point& rHit) const;
// This method returns sal_True, if the point rHit is inside the // This method returns sal_True, if the point rHit is inside the
// handle-thick frame, which surrounds the OutlinerView at TextFrames. // handle-thick frame, which surrounds the OutlinerView at TextFrames.
......
...@@ -1125,26 +1125,17 @@ void SdrObjEditView::SetTextEditWin(vcl::Window* pWin) ...@@ -1125,26 +1125,17 @@ void SdrObjEditView::SetTextEditWin(vcl::Window* pWin)
} }
} }
bool SdrObjEditView::IsTextEditHit(const Point& rHit, short nTol) const bool SdrObjEditView::IsTextEditHit(const Point& rHit) const
{ {
bool bOk=false; bool bOk=false;
if(mxTextEditObj.is()) if(mxTextEditObj.is())
{ {
nTol=ImpGetHitTolLogic(nTol,NULL);
// only a third of the tolerance here, so handles can be hit well
nTol=nTol/3;
nTol=0; // no hit tolerance here any more
Rectangle aEditArea; Rectangle aEditArea;
OutlinerView* pOLV=pTextEditOutliner->GetView(0); OutlinerView* pOLV=pTextEditOutliner->GetView(0);
if (pOLV!=NULL) if (pOLV!=NULL)
{ {
aEditArea.Union(pOLV->GetOutputArea()); aEditArea.Union(pOLV->GetOutputArea());
} }
aEditArea.Left()-=nTol;
aEditArea.Top()-=nTol;
aEditArea.Right()+=nTol;
aEditArea.Bottom()+=nTol;
bOk=aEditArea.IsInside(rHit); bOk=aEditArea.IsInside(rHit);
if (bOk) if (bOk)
{ // check if any characters were actually hit { // check if any characters were actually hit
...@@ -1221,7 +1212,7 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) ...@@ -1221,7 +1212,7 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin)
Point aPt(rMEvt.GetPosPixel()); Point aPt(rMEvt.GetPosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt); if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt); else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,mnHitTolLog); bPostIt=IsTextEditHit(aPt);
} }
if (bPostIt) { if (bPostIt) {
Point aPixPos(rMEvt.GetPosPixel()); Point aPixPos(rMEvt.GetPosPixel());
...@@ -1256,7 +1247,7 @@ bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) ...@@ -1256,7 +1247,7 @@ bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin)
Point aPt(rMEvt.GetPosPixel()); Point aPt(rMEvt.GetPosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt); if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt); else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,mnHitTolLog); bPostIt=IsTextEditHit(aPt);
} }
if (bPostIt) { if (bPostIt) {
Point aPixPos(rMEvt.GetPosPixel()); Point aPixPos(rMEvt.GetPosPixel());
...@@ -1290,7 +1281,7 @@ bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) ...@@ -1290,7 +1281,7 @@ bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin)
aPt=pWin->PixelToLogic(aPt); aPt=pWin->PixelToLogic(aPt);
else if (pTextEditWin) else if (pTextEditWin)
aPt=pTextEditWin->PixelToLogic(aPt); aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,mnHitTolLog); bPostIt=IsTextEditHit(aPt);
} }
if (bPostIt) { if (bPostIt) {
Point aPixPos(rMEvt.GetPosPixel()); Point aPixPos(rMEvt.GetPosPixel());
...@@ -1328,7 +1319,7 @@ bool SdrObjEditView::Command(const CommandEvent& rCEvt, vcl::Window* pWin) ...@@ -1328,7 +1319,7 @@ bool SdrObjEditView::Command(const CommandEvent& rCEvt, vcl::Window* pWin)
Point aPt(rCEvt.GetMousePosPixel()); Point aPt(rCEvt.GetMousePosPixel());
if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt); if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt); else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
bPostIt=IsTextEditHit(aPt,mnHitTolLog); bPostIt=IsTextEditHit(aPt);
} }
if (bPostIt) { if (bPostIt) {
Point aPixPos(rCEvt.GetMousePosPixel()); Point aPixPos(rCEvt.GetMousePosPixel());
......
...@@ -334,7 +334,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co ...@@ -334,7 +334,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible(); bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible();
bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible(); bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible();
bool bIsTextEdit=IsTextEdit(); bool bIsTextEdit=IsTextEdit();
bool bTextEditHit=IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/); bool bTextEditHit=IsTextEditHit(aLocalLogicPosition);
bool bTextEditSel=IsTextEditInSelectionMode(); bool bTextEditSel=IsTextEditInSelectionMode();
bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0; bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0; bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
...@@ -976,7 +976,7 @@ Pointer SdrView::GetPreferredPointer(const Point& rMousePos, const OutputDevice* ...@@ -976,7 +976,7 @@ Pointer SdrView::GetPreferredPointer(const Point& rMousePos, const OutputDevice*
} }
// TextEdit, ObjEdit, Macro // TextEdit, ObjEdit, Macro
if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos,0/*nTol*/))) if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos)))
{ {
if(!pOut || IsTextEditInSelectionMode()) if(!pOut || IsTextEditInSelectionMode())
{ {
......
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