tdf#67379 - sw: treat clicking h/f-fly the same as any other

Why should clicking on a frame/image in a header act any differently from
a one insde the text body?

(The only time frames (or any kind of fly) required a double click occured
when switching from inside a header to a body-fly or from inside the body
to a h/f-fly. This patch removes that oddball corner-case.)

Now all frames are handled with a single click and there will not be
an impact on double-clicking anymore.

regression caused by 7e2f98d0a0c4a0f36a94353a256e7cc5caa3113b and its
prior commit which say:
> Header/Footer: fixed click on frames over the header/footer area.
> The main problem here was due to the click to show the separator when
> there is no header or footer under the frame. That code was just exiting
> MouseButtonDown too early, which isn't good.

> Now, double-click actually selects a frame anchored in header/footer.

confirmed that single-clicking on frames over the header/footer section
still shows the header blue-line.
Change-Id: I4770cfe7898202929742743931e22de8bf233b03
Reviewed-on: https://gerrit.libreoffice.org/30693
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
Justin Luth 2016-11-08 11:33:02 +03:00 committed by Michael Stahl
parent bec9e673ad
commit 70f41634d0

View File

@ -2855,7 +2855,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) ); const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
// How many clicks do we need to select a fly frame?
FrameControlType eControl; FrameControlType eControl;
bool bOverFly = false; bool bOverFly = false;
bool bPageAnchored = false; bool bPageAnchored = false;
@ -2866,16 +2865,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
// We have a field here, that should have priority over header/footer fly. // We have a field here, that should have priority over header/footer fly.
bOverHeaderFooterFly = false; bOverHeaderFooterFly = false;
int nNbFlyClicks = 1;
// !bOverHeaderFooterFly doesn't mean we have a frame to select
if ( !bPageAnchored && ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) ||
( !rSh.IsHeaderFooterEdit( ) && bOverHeaderFooterFly ) ) )
{
nNbFlyClicks = 2;
if ( _rMEvt.GetClicks( ) < nNbFlyClicks )
return;
}
// Are we clicking on a blank header/footer area? // Are we clicking on a blank header/footer area?
if ( IsInHeaderFooter( aDocPos, eControl ) || bOverHeaderFooterFly ) if ( IsInHeaderFooter( aDocPos, eControl ) || bOverHeaderFooterFly )
{ {
@ -3211,10 +3200,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
} }
} }
bool bHandledFlyClick = false; if (1 == nNumberOfClicks && !bExecDrawTextLink)
if (!bExecDrawTextLink && nNumberOfClicks == nNbFlyClicks)
{ {
bHandledFlyClick = true;
// only try to select frame, if pointer already was // only try to select frame, if pointer already was
// switched accordingly // switched accordingly
if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() && if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() &&
@ -3339,7 +3326,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
case 2: case 2:
{ {
g_bFrameDrag = false; g_bFrameDrag = false;
if ( !bHandledFlyClick && !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) && if ( !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) &&
FlyProtectFlags::NONE == rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) ) FlyProtectFlags::NONE == rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) )
{ {
/* This is no good: on the one hand GetSelectionType is used as flag field /* This is no good: on the one hand GetSelectionType is used as flag field