sw: keep the drag start point in a Point
The two coordinate statics were always written and read together, and every reader outside the edit window built a Point out of them anyway. Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com> Change-Id: I7333728d5c51a15d435bd9ced2f1d8770f1e10c7 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8999 Tested-by: Jenkins CPCI <releng@collaboraoffice.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.com> (cherry picked from commit f7f785e565b208649065441ccbd0f0d056f3e29d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209829 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Xisco Fauli
parent
dfc2a54bce
commit
45225d31c4
@@ -541,12 +541,10 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
|
||||
{
|
||||
SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
|
||||
|
||||
Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
|
||||
|
||||
bool bSelect = g_bExecuteDrag &&
|
||||
m_pWrtShell->GetView().GetDocShell() &&
|
||||
!m_pWrtShell->GetView().GetDocShell()->IsReadOnly();
|
||||
if( m_pWrtShell->GetContentAtPos( aPos, aContentAtPos, bSelect ) )
|
||||
if (m_pWrtShell->GetContentAtPos(SwEditWin::GetDDStartPos(), aContentAtPos, bSelect))
|
||||
{
|
||||
m_oBookmark.emplace(
|
||||
static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr)->GetValue(),
|
||||
@@ -3783,9 +3781,8 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
|
||||
{
|
||||
// is only one field - selected?
|
||||
SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
|
||||
Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
|
||||
|
||||
if( m_pWrtShell->GetContentAtPos( aPos, aContentAtPos ) )
|
||||
if (m_pWrtShell->GetContentAtPos(SwEditWin::GetDDStartPos(), aContentAtPos))
|
||||
{
|
||||
AddFormat( SotClipboardFormatId::STRING );
|
||||
AddFormat( SotClipboardFormatId::SOLK );
|
||||
@@ -4332,7 +4329,7 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
|
||||
bSttWrd = !bEndWrd && rSh.IsStartWord();
|
||||
bSttPara= rSh.IsSttPara();
|
||||
|
||||
Point aSttPt( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY() );
|
||||
Point aSttPt = SwEditWin::GetDDStartPos();
|
||||
|
||||
// at first, select InetFields!
|
||||
if( TransferBufferType::InetField == m_eBufferType )
|
||||
|
||||
@@ -148,8 +148,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
|
||||
ReleaseMouse();
|
||||
g_bFrameDrag = false;
|
||||
g_bExecuteDrag = true;
|
||||
SwEditWin::s_nDDStartPosY = aDocPos.Y();
|
||||
SwEditWin::s_nDDStartPosX = aDocPos.X();
|
||||
s_aDDStartPos = aDocPos;
|
||||
m_aMovePos = aDocPos;
|
||||
StartExecuteDrag();
|
||||
if( bDelSelect )
|
||||
|
||||
@@ -189,8 +189,7 @@ static SdrHdlKind g_eSdrMoveHdl = SdrHdlKind::User;
|
||||
|
||||
QuickHelpData* SwEditWin::s_pQuickHlpData = nullptr;
|
||||
|
||||
tools::Long SwEditWin::s_nDDStartPosY = 0;
|
||||
tools::Long SwEditWin::s_nDDStartPosX = 0;
|
||||
Point SwEditWin::s_aDDStartPos;
|
||||
|
||||
static SfxShell* lcl_GetTextShellFromDispatcher( SwView const & rView );
|
||||
|
||||
@@ -2967,8 +2966,7 @@ void SwEditWin::ArmFrameDrag(SwWrtShell& rSh, const Point& rDocPos)
|
||||
{
|
||||
// the mode has to be (re-)entered here: a drag counts from where it was entered
|
||||
rSh.EnterSelFrameMode(&rDocPos);
|
||||
s_nDDStartPosY = rDocPos.Y();
|
||||
s_nDDStartPosX = rDocPos.X();
|
||||
s_aDDStartPos = rDocPos;
|
||||
g_bFrameDrag = true;
|
||||
}
|
||||
|
||||
@@ -3355,8 +3353,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
|
||||
if (!bHitHandle)
|
||||
{
|
||||
StartDDTimer();
|
||||
SwEditWin::s_nDDStartPosY = aDocPos.Y();
|
||||
SwEditWin::s_nDDStartPosX = aDocPos.X();
|
||||
s_aDDStartPos = aDocPos;
|
||||
}
|
||||
g_bFrameDrag = true;
|
||||
}
|
||||
@@ -3395,8 +3392,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
|
||||
if (1 == nNumberOfClicks)
|
||||
{
|
||||
UpdatePointer(aDocPos, aMEvt.GetModifier());
|
||||
SwEditWin::s_nDDStartPosY = aDocPos.Y();
|
||||
SwEditWin::s_nDDStartPosX = aDocPos.X();
|
||||
s_aDDStartPos = aDocPos;
|
||||
|
||||
// hit a URL in DrawText object?
|
||||
if (bExecHyperlinks && pSdrView)
|
||||
@@ -4339,8 +4335,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
|
||||
// a MB-Move is called immediately.
|
||||
if( g_bDDTimerStarted )
|
||||
{
|
||||
Point aDD( SwEditWin::s_nDDStartPosX, SwEditWin::s_nDDStartPosY );
|
||||
aDD = LogicToPixel( aDD );
|
||||
Point aDD = LogicToPixel(s_aDDStartPos);
|
||||
tools::Rectangle aRect( aDD.X()-3, aDD.Y()-3, aDD.X()+3, aDD.Y()+3 );
|
||||
if ( !aRect.Contains( aPixPt ) )
|
||||
StopDDTimer( &rSh, aDocPt );
|
||||
|
||||
@@ -73,8 +73,7 @@ class SAL_DLLPUBLIC_RTTI SwEditWin final : public vcl::DocWindow,
|
||||
{
|
||||
static QuickHelpData* s_pQuickHlpData;
|
||||
|
||||
static tools::Long s_nDDStartPosX;
|
||||
static tools::Long s_nDDStartPosY;
|
||||
static Point s_aDDStartPos;
|
||||
|
||||
Color m_aWaterCanTextColor; // text color; for the watering can
|
||||
Color m_aWaterCanTextBackColor; // text background; for the watering can
|
||||
@@ -267,8 +266,7 @@ public:
|
||||
|
||||
virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
|
||||
|
||||
static tools::Long GetDDStartPosX() { return s_nDDStartPosX; }
|
||||
static tools::Long GetDDStartPosY() { return s_nDDStartPosY; }
|
||||
static const Point& GetDDStartPos() { return s_aDDStartPos; }
|
||||
|
||||
static void InitStaticData();
|
||||
static void FinitStaticData();
|
||||
|
||||
Reference in New Issue
Block a user