sw/inc/crsrsh.hxx | 9 ++++----- sw/inc/fesh.hxx | 2 +- sw/inc/mdiexp.hxx | 4 +--- sw/inc/view.hxx | 7 ++----- sw/inc/viewsh.hxx | 9 +-------- sw/source/core/crsr/crsrsh.cxx | 19 +++++++++---------- sw/source/core/frmedt/feshview.cxx | 4 ++-- sw/source/core/view/viewsh.cxx | 4 ++-- sw/source/ui/dialog/uiregionsw.cxx | 2 +- sw/source/ui/index/swuiidxmrk.cxx | 2 +- sw/source/ui/misc/insfnote.cxx | 6 +++--- sw/source/uibase/dochdl/swdtflvr.cxx | 2 +- sw/source/uibase/docvw/edtdd.cxx | 4 ++-- sw/source/uibase/docvw/edtwin.cxx | 22 ++++++++-------------- sw/source/uibase/docvw/edtwin3.cxx | 5 ++--- sw/source/uibase/inc/edtwin.hxx | 4 +--- sw/source/uibase/inc/wrtsh.hxx | 20 +++++++------------- sw/source/uibase/shells/tabsh.cxx | 2 +- sw/source/uibase/shells/textsh1.cxx | 2 +- sw/source/uibase/uiview/viewport.cxx | 29 ++++++----------------------- sw/source/uibase/uno/unotxdoc.cxx | 2 +- sw/source/uibase/wrtsh/move.cxx | 6 +++--- sw/source/uibase/wrtsh/select.cxx | 16 ++++++++-------- sw/source/uibase/wrtsh/wrtsh3.cxx | 8 ++++---- 24 files changed, 72 insertions(+), 118 deletions(-)
New commits: commit db37276f60f5e1d93d5685918904beeb04daa80a Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Mon Feb 10 17:53:30 2025 +0000 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Tue Feb 11 17:38:23 2025 +0100 Revert "tdf#50743 Improve scrolling while selecting" This reverts commit b357de0cb6eb5108b6b31de2c8ee652c71d0fe7a. This was an older version of the patch than the one in master Change-Id: I98c33e72d4de1249dbbed8a83f2e4c245028577e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181414 Tested-by: allotropia jenkins <jenk...@allotropia.de> Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2cb968fb7905..2417fb507cae 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -169,7 +169,7 @@ public: SW_DLLPUBLIC void UpdateCursor( sal_uInt16 eFlags = SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, - bool bIdleEnd = false, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + bool bIdleEnd = false ); private: @@ -421,7 +421,7 @@ public: * the cursor is done in order to get at the properties under the mouse pointer. */ SW_DLLPUBLIC int SetCursor(const Point& rPt, bool bOnlyText = false, bool bBlock = true, - bool bFieldInfo = false, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault); + bool bFieldInfo = false); /* * Notification that the visible area was changed. m_aVisArea is reset, then @@ -731,8 +731,7 @@ public: // Place only the visible cursor at the given position in the document. // Return false if SPoint was corrected by layout. // (This is needed for displaying the Drag&Drop/Copy-Cursor.) - bool SetVisibleCursor( const Point &rPt, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + bool SetVisibleCursor( const Point &rPt ); inline void UnSetVisibleCursor(); SW_DLLPUBLIC SwVisibleCursor* GetVisibleCursor() const; @@ -814,7 +813,7 @@ public: bool GotoRegion( std::u16string_view rName ); // show the current selection - virtual void MakeSelVisible(ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault); + virtual void MakeSelVisible(); // set the cursor to a NOT protected/hidden node bool FindValidContentNode( bool bOnlyText ); diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index b6ccbee8b939..6e4466dc60d7 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -360,7 +360,7 @@ public: void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ); /// Show current selection (frame / draw object as required). - virtual void MakeSelVisible(ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault) override; + virtual void MakeSelVisible() override; /** @return FrameFormat of object that may be under Point. Object does not become selected! */ diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index 6d4af73bd80b..afe308e1ad89 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -22,7 +22,6 @@ #include "tblenum.hxx" #include "swdllapi.h" #include <unotools/resmgr.hxx> -#include "viewsh.hxx" #include <string_view> @@ -31,8 +30,7 @@ class Size; class SwViewShell; class SwDocShell; -extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY - , ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault); +extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY); extern bool IsScrollMDI(SwViewShell const * pVwSh, const SwRect &); extern void SizeNotify(SwViewShell const * pVwSh, const Size &); diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 6e7f0b4d2d05..d735e5e6e94a 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -31,7 +31,6 @@ #include "swdllapi.h" #include "swtypes.hxx" #include "shellid.hxx" -#include "viewsh.hxx" #include <svx/sdr/overlay/overlayobject.hxx> @@ -300,8 +299,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const; SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect, sal_uInt16 nRangeX, - sal_uInt16 nRangeY, - ScrollSizeMode eScrollSizeMode); + sal_uInt16 nRangeY); SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const; SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const; @@ -446,8 +444,7 @@ public: bool IsScroll(const tools::Rectangle& rRect) const; void Scroll( const tools::Rectangle& rRect, sal_uInt16 nRangeX = USHRT_MAX, - sal_uInt16 nRangeY = USHRT_MAX, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault); + sal_uInt16 nRangeY = USHRT_MAX); tools::Long SetVScrollMax(tools::Long lMax); tools::Long SetHScrollMax(tools::Long lMax); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index fd7c1e08a1fd..01a3cc259929 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -84,13 +84,6 @@ enum class LockPaintReason ExampleFrame }; -enum class ScrollSizeMode -{ - ScrollSizeDefault, //usually 30% of the visible area - ScrollSizeMouseSelection, //make target rectangle visible - ScrollSizeTimer, // increase of timer based scrolling - ScrollSizeTimer2 // more increase of timer based scrolling -}; namespace vcl { typedef OutputDevice RenderContext; @@ -288,7 +281,7 @@ public: void setLOKVisibleArea(const tools::Rectangle& rArea) { maLOKVisibleArea = rArea; } // If necessary scroll until passed Rect is situated in visible sector. - void MakeVisible( const SwRect &, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + void MakeVisible( const SwRect & ); // At nearest occasion pass new document size to UI. void SizeChgNotify(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 1d65422ee0ae..a092c19a6e68 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1058,8 +1058,7 @@ bool SwCursorShell::IsInHeaderFooter( bool* pbInHeader ) const return nullptr != pFrame; } -int SwCursorShell::SetCursor(const Point& rLPt, bool bOnlyText, bool bBlock, - bool bFieldInfo, ScrollSizeMode eScrollSizeMode) +int SwCursorShell::SetCursor(const Point& rLPt, bool bOnlyText, bool bBlock, bool bFieldInfo) { CurrShell aCurr( this ); @@ -1164,7 +1163,7 @@ int SwCursorShell::SetCursor(const Point& rLPt, bool bOnlyText, bool bBlock, if( !pCursor->IsSelOvr( SwCursorSelOverFlags::ChangePos ) ) { - UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE, false, eScrollSizeMode ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE ); bRet &= ~CRSR_POSOLD; } else if( bOnlyText && !m_pCurrentCursor->HasMark() ) @@ -1922,7 +1921,7 @@ class SwNotifyAccAboutInvalidTextSelections } #endif -void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd, ScrollSizeMode eScrollSizeMode ) +void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { CurrShell aCurr( this ); ClearUpCursors(); @@ -2365,7 +2364,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd, ScrollSizeMo // again, thus save and reset the flag here bool bSav = m_bSVCursorVis; m_bSVCursorVis = false; - MakeSelVisible(eScrollSizeMode); + MakeSelVisible(); m_bSVCursorVis = bSav; } @@ -3054,7 +3053,7 @@ bool SwCursorShell::ExtendSelection( bool bEnd, sal_Int32 nCount ) @param rPt The position to move the visible cursor to. @return <false> if SPoint was corrected by the layout. */ -bool SwCursorShell::SetVisibleCursor( const Point &rPt, ScrollSizeMode eScrollSizeMode ) +bool SwCursorShell::SetVisibleCursor( const Point &rPt ) { CurrShell aCurr( this ); Point aPt( rPt ); @@ -3093,7 +3092,7 @@ bool SwCursorShell::SetVisibleCursor( const Point &rPt, ScrollSizeMode eScrollSi m_pVisibleCursor->Hide(); // always hide visible cursor if( IsScrollMDI( this, m_aCharRect )) { - MakeVisible( m_aCharRect, eScrollSizeMode ); + MakeVisible( m_aCharRect ); m_pCurrentCursor->Show(nullptr); } @@ -3479,7 +3478,7 @@ size_t SwCursorShell::UpdateTableSelBoxes() } /// show the current selected "object" -void SwCursorShell::MakeSelVisible(ScrollSizeMode eScrollSizeMode) +void SwCursorShell::MakeSelVisible() { OSL_ENSURE( m_bHasFocus, "no focus but cursor should be made visible?" ); if( m_aCursorHeight.Y() < m_aCharRect.Height() && m_aCharRect.Height() > VisArea().Height() ) @@ -3503,13 +3502,13 @@ void SwCursorShell::MakeSelVisible(ScrollSizeMode eScrollSizeMode) else { if( m_aCharRect.HasArea() ) - MakeVisible( m_aCharRect, eScrollSizeMode ); + MakeVisible( m_aCharRect ); else { SwRect aTmp( m_aCharRect ); aTmp.AddHeight(1 ); aTmp.AddWidth(1 ); - MakeVisible( aTmp, eScrollSizeMode ); + MakeVisible( aTmp ); } } } diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 8bdc243762b0..0a3830009e99 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2658,7 +2658,7 @@ std::vector<SwFrameFormat const*> SwFEShell::GetFlyFrameFormats( } // show the current selected object -void SwFEShell::MakeSelVisible(ScrollSizeMode eScrollSizeMode) +void SwFEShell::MakeSelVisible() { if ( Imp()->HasDrawView() && Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() ) @@ -2667,7 +2667,7 @@ void SwFEShell::MakeSelVisible(ScrollSizeMode eScrollSizeMode) MakeVisible( SwRect(Imp()->GetDrawView()->GetAllMarkedRect()) ); } else - SwCursorShell::MakeSelVisible(eScrollSizeMode); + SwCursorShell::MakeSelVisible(); } // how is the selected object protected? diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 00e84594dab5..c4d9a551807c 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -646,7 +646,7 @@ const SwRect& SwViewShell::VisArea() const return comphelper::LibreOfficeKit::isActive()? GetLayout()->getFrameArea(): maVisArea; } -void SwViewShell::MakeVisible( const SwRect &rRect, ScrollSizeMode eScrollSizeMode ) +void SwViewShell::MakeVisible( const SwRect &rRect ) { if ( !(!VisArea().Contains( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this)) ) return; @@ -662,7 +662,7 @@ void SwViewShell::MakeVisible( const SwRect &rRect, ScrollSizeMode eScrollSizeMo do{ nOldH = pRoot->getFrameArea().Height(); StartAction(); - ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX, eScrollSizeMode ); + ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX ); EndAction(); } while( nOldH != pRoot->getFrameArea().Height() && nLoopCnt-- ); } diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 58f9e4012feb..f1499b6a28ca 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -764,7 +764,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) m_rSh.StartAllAction(); m_rSh.StartUndo(); - m_rSh.ResetSelect( nullptr,false, ScrollSizeMode::ScrollSizeDefault ); + m_rSh.ResetSelect( nullptr,false ); std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator()); if (m_xTree->get_iter_first(*xIter)) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 242439606e5e..0d30104f9e41 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -453,7 +453,7 @@ void SwIndexMarkPane::Apply() { InsertUpdate(); if(m_bSelected) - m_pSh->ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + m_pSh->ResetSelect(nullptr, false); } // apply changes diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index 22ea93ad5bc6..4ddc4c1f9117 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -58,7 +58,7 @@ void SwInsFootNoteDlg::Apply() m_eCharSet, RES_CHRATR_FONT ); aSet.Put( aFont ); m_rSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); - m_rSh.ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + m_rSh.ResetSelect(nullptr, false); m_rSh.Left(SwCursorSkipMode::Chars, false, 1, false ); } m_rSh.EndUndo( SwUndoId::END ); @@ -138,7 +138,7 @@ IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, weld::Button&, rBtn, void ) Apply(); // go to the next foot/endnote here - m_rSh.ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + m_rSh.ResetSelect(nullptr, false); if (&rBtn == m_xNextBT.get()) m_rSh.GotoNextFootnoteAnchor(); else @@ -188,7 +188,7 @@ SwInsFootNoteDlg::~SwInsFootNoteDlg() COVERITY_NOEXCEPT_FALSE SwViewShell::SetCareDialog(nullptr); if (m_bEdit) - m_rSh.ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + m_rSh.ResetSelect(nullptr, false); } void SwInsFootNoteDlg::Init() diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 84ae65d18c8a..0ec3b35e86b9 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3878,7 +3878,7 @@ bool SwTransferable::PrivatePaste(SwWrtShell& rShell, SwPasteContext* pContext, } if ( nSelection & SelectionType::DrawObject) //unselect hovering graphics { - rShell.ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + rShell.ResetSelect(nullptr,false); } bool bInWrd = false, bEndWrd = false, bSttWrd = false, diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index f44c38f68ac3..287d2969f632 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -371,7 +371,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt ) if(aPixPt.Y() < aWin.Top()) aPixPt.AdjustY( -nMargin ); Point aDocPt(PixelToLogic(aPixPt)); SwRect rect(aDocPt,Size(1,1)); - rSh.MakeVisible(rect, ScrollSizeMode::ScrollSizeTimer2); + rSh.MakeVisible(rect); } } @@ -461,7 +461,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt ) CleanupDropUserMarker(); SwContentAtPos aCont( IsAttrAtPos::ContentCheck ); if(rSh.GetContentAtPos(aDocPt, aCont)) - rSh.SwCursorShell::SetVisibleCursor( aDocPt, ScrollSizeMode::ScrollSizeTimer2 ); + rSh.SwCursorShell::SetVisibleCursor( aDocPt ); } else { diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 6893aea25a04..f60cfd1607a5 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -679,7 +679,7 @@ IMPL_LINK_NOARG(SwEditWin, TimerHandler, Timer *, void) rSh.SelectTableRowCol( *m_xRowColumnSelectionStart, &aPos, m_bIsRowDrag ); } else - rSh.CallSetCursor( &aModPt, false, m_eScrollSizeMode ); + rSh.CallSetCursor( &aModPt, false ); // It can be that a "jump" over a table cannot be accomplished like // that. So we jump over the table by Up/Down here. @@ -703,20 +703,15 @@ void SwEditWin::JustifyAreaTimer() { const tools::Rectangle &rVisArea = GetView().GetVisArea(); #ifdef UNX - const tools::Long coMinLen = 40; + const tools::Long coMinLen = 100; #else - const tools::Long coMinLen = 20; + const tools::Long coMinLen = 50; #endif tools::Long const nTimeout = 800, nDiff = std::max( std::max( m_aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - m_aMovePos.Y() ), std::max( m_aMovePos.X() - rVisArea.Right(), rVisArea.Left() - m_aMovePos.X())); - m_aTimer.SetTimeout( std::max( coMinLen, nTimeout - nDiff) ); - m_eScrollSizeMode = m_aTimer.GetTimeout() < 100 ? - ScrollSizeMode::ScrollSizeTimer2 : - m_aTimer.GetTimeout() < 400 ? - ScrollSizeMode::ScrollSizeTimer : - ScrollSizeMode::ScrollSizeMouseSelection; + m_aTimer.SetTimeout( std::max( coMinLen, nTimeout - nDiff*2L) ); } void SwEditWin::LeaveArea(const Point &rPos) @@ -3958,7 +3953,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if ( !bOverSelect || rSh.IsInSelect() ) { - MoveCursor( rSh, aDocPos, bOnlyText, bLockView); + MoveCursor( rSh, aDocPos, bOnlyText, bLockView ); bCallBase = false; } if (!bOverURLGrf && !bExecDrawTextLink && !bOnlyText) @@ -4542,8 +4537,8 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) rSh.IsAddMode() ) ) { rSh.Drag( &aDocPt, false ); - g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPt, false, - ScrollSizeMode::ScrollSizeMouseSelection)); + + g_bValidCursorPos = !(CRSR_POSCHG & rSh.CallSetCursor(&aDocPt, false)); EnterArea(); } } @@ -5460,7 +5455,6 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView): m_aTimer("SwEditWin"), m_aKeyInputFlushTimer("SwEditWin m_aKeyInputFlushTimer"), m_eBufferLanguage(LANGUAGE_DONTKNOW), - m_eScrollSizeMode(ScrollSizeMode::ScrollSizeMouseSelection), m_aTemplateTimer("SwEditWin m_aTemplateTimer"), m_pUserMarkerObj( nullptr ), @@ -6263,7 +6257,7 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) // the query against the content form doesn't work!!! SwMvContext aMvContext( &rSh ); if (rSh.HasSelection()) - rSh.ResetSelect(&aDocPos, false, ScrollSizeMode::ScrollSizeDefault); + rSh.ResetSelect(&aDocPos, false); rSh.SwCursorShell::SetCursor(aDocPos, false, /*Block=*/false, /*FieldInfo=*/true); } if( !bOverURLGrf ) diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx index 3eea118d5b42..423b6a53847e 100644 --- a/sw/source/uibase/docvw/edtwin3.cxx +++ b/sw/source/uibase/docvw/edtwin3.cxx @@ -33,13 +33,12 @@ // Core-Notify void ScrollMDI( SwViewShell const * pVwSh, const SwRect &rRect, - sal_uInt16 nRangeX, sal_uInt16 nRangeY, - ScrollSizeMode eScrollSizeMode) + sal_uInt16 nRangeX, sal_uInt16 nRangeY) { SfxViewShell *pSfxViewShell = pVwSh->GetSfxViewShell(); if (SwView* pSwView = dynamic_cast<SwView *>(pSfxViewShell)) - pSwView->Scroll(rRect.SVRect(), nRangeX, nRangeY, eScrollSizeMode); + pSwView->Scroll(rRect.SVRect(), nRangeX, nRangeY); } // Docmdi - movable diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index ddce03274402..ac6bbaeeeeff 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -28,7 +28,6 @@ #include <vcl/transfer.hxx> #include <swevent.hxx> #include <swtypes.hxx> -#include <viewsh.hxx> class SwWrtShell; class SwView; @@ -82,7 +81,6 @@ class SAL_DLLPUBLIC_RTTI SwEditWin final : public vcl::DocWindow, LanguageType m_eBufferLanguage; Point m_aStartPos; Point m_aMovePos; - ScrollSizeMode m_eScrollSizeMode; Point m_aRszMvHdlPt; Timer m_aTemplateTimer; @@ -173,7 +171,7 @@ class SAL_DLLPUBLIC_RTTI SwEditWin final : public vcl::DocWindow, DECL_LINK( TemplateTimerHdl, Timer *, void ); void MoveCursor( SwWrtShell &rSh, const Point& rDocPos, - const bool bOnlyText, bool bLockView); + const bool bOnlyText, bool bLockView ); virtual void DataChanged( const DataChangedEvent& ) override; virtual void PrePaint(vcl::RenderContext& rRenderContext) override; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 8e644a9952da..06f833040948 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -108,7 +108,7 @@ private: using SwEditShell::AutoCorrect; using SwCursorShell::GotoMark; - typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp, ScrollSizeMode eScrollSizeMode ); + typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); typedef void (SwWrtShell::*SELECTFUNC2)(const Point *, bool bProp ); SELECTFUNC2 m_fnDrag = &SwWrtShell::BeginDrag; @@ -120,20 +120,16 @@ public: using SwCursorShell::GotoFootnoteAnchor; using SwEditShell::Insert; - tools::Long CallSetCursor(const Point* pPt, bool bProp, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault) - { return (this->*m_fnSetCursor)(pPt, bProp, eScrollSizeMode); } + tools::Long CallSetCursor(const Point* pPt, bool bProp) { return (this->*m_fnSetCursor)(pPt, bProp); } void Drag (const Point* pPt, bool bProp) { (this->*m_fnDrag)(pPt, bProp); } void EndDrag (const Point* pPt, bool bProp) { (this->*m_fnEndDrag)(pPt, bProp); } - tools::Long KillSelection(const Point* pPt, bool bProp, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault) - { return (this->*m_fnKillSel)(pPt, bProp, eScrollSizeMode ); } + tools::Long KillSelection(const Point* pPt, bool bProp) { return (this->*m_fnKillSel)(pPt, bProp); } bool IsSplitVerticalByDefault() const; void SetSplitVerticalByDefault(bool value); // reset all selections - SW_DLLPUBLIC tools::Long ResetSelect( const Point *, bool, ScrollSizeMode ); + SW_DLLPUBLIC tools::Long ResetSelect( const Point *, bool ); // resets the cursorstack after movement with PageUp/-Down if a stack is built up inline void ResetCursorStack(); @@ -619,11 +615,9 @@ private: void ResetCursorStack_(); using SwCursorShell::SetCursor; - tools::Long SetCursor(const Point *, bool bProp=false, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + tools::Long SetCursor(const Point *, bool bProp=false ); - tools::Long SetCursorKillSel(const Point *, bool bProp, - ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + tools::Long SetCursorKillSel(const Point *, bool bProp ); void BeginDrag(const Point *, bool bProp ); void DefaultDrag(const Point *, bool bProp ); @@ -639,7 +633,7 @@ private: void SttLeaveSelect(); void AddLeaveSelect(); - tools::Long Ignore(const Point *, bool bProp, ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault ); + tools::Long Ignore(const Point *, bool bProp ); void LeaveExtSel() { m_bSelWrd = m_bSelLn = false;} diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 308123877c57..2fa9db78f6cb 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -862,7 +862,7 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case FN_TABLE_SET_READ_ONLY_CELLS: rSh.ProtectCells(); - rSh.ResetSelect( nullptr, false, ScrollSizeMode::ScrollSizeDefault ); + rSh.ResetSelect( nullptr, false ); bCallDone = true; break; case FN_TABLE_UNSET_READ_ONLY_CELLS: diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 5e47d67abdfd..5afb496f60e8 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -979,7 +979,7 @@ void SwTextShell::Execute(SfxRequest &rReq) SfxItemSetFixed<RES_CHRATR_FONT, RES_CHRATR_FONT> aSet( rWrtSh.GetAttrPool() ); rWrtSh.GetCurAttr( aSet ); rWrtSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); - rWrtSh.ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + rWrtSh.ResetSelect(nullptr, false); rWrtSh.EndSelect(); rWrtSh.GotoFootnoteText(); } diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 252b0aa34122..a7ec3f161b60 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -339,29 +339,14 @@ void SwView::CheckVisArea() // within the new visible area. // sal_uInt16 nRange optional accurate indication of the // range by which to scroll if necessary. -// eScrollSizeMode mouse selection should only bring the selected part -// into the visible area, timer call needs increased size -void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, sal_uInt16 nRangeX, - sal_uInt16 nRangeY, ScrollSizeMode eScrollSizeMode) +void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, + sal_uInt16 nRangeX, sal_uInt16 nRangeY) { const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0; - const tools::Long nDefaultYScroll = GetYScroll(); - tools::Long nYScroll; - if (eScrollSizeMode != ScrollSizeMode::ScrollSizeDefault) - { - nYScroll = m_aVisArea.Top() > rRect.Top() ? - m_aVisArea.Top() - rRect.Top() : - rRect.Bottom() - m_aVisArea.Bottom(); - if (eScrollSizeMode == ScrollSizeMode::ScrollSizeTimer) - nYScroll = std::min(nDefaultYScroll, nYScroll * 5); - else if (eScrollSizeMode == ScrollSizeMode::ScrollSizeTimer2) - nYScroll = 2 * nDefaultYScroll; - } - else - nYScroll = nDefaultYScroll; + tools::Long nYScroll = GetYScroll(); tools::Long nDesHeight = rRect.GetHeight(); tools::Long nCurHeight = m_aVisArea.GetHeight(); nYScroll = std::min(nYScroll, nCurHeight - nDesHeight); // If it is scarce, then scroll not too much. @@ -406,8 +391,7 @@ bool SwView::IsScroll( const tools::Rectangle &rRect ) const return m_bCenterCursor || m_bTopCursor || !m_aVisArea.Contains(rRect); } -void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY - , ScrollSizeMode eScrollSizeMode ) +void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY ) { if ( m_aVisArea.IsEmpty() ) return; @@ -479,8 +463,7 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt CalcPt( &aPt, tools::Rectangle( rRect.TopLeft(), aSize ), static_cast< sal_uInt16 >((aVisSize.Width() - aSize.Width()) / 2), - static_cast< sal_uInt16 >((aVisSize.Height()- aSize.Height())/ 2), - eScrollSizeMode ); + static_cast< sal_uInt16 >((aVisSize.Height()- aSize.Height())/ 2) ); if( m_bTopCursor ) { @@ -497,7 +480,7 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt if( !m_bCenterCursor ) { Point aPt( m_aVisArea.TopLeft() ); - CalcPt( &aPt, rRect, nRangeX, nRangeY, eScrollSizeMode ); + CalcPt( &aPt, rRect, nRangeX, nRangeY ); if( m_bTopCursor ) { diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 85950c3e5c93..07b052541eb4 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3942,7 +3942,7 @@ void SwXTextDocument::resetSelection() SolarMutexGuard aGuard; SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell(); - pWrtShell->ResetSelect(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + pWrtShell->ResetSelect(nullptr, false); } void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 2f9f1e275ea0..f68e08010f9a 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -85,7 +85,7 @@ void SwWrtShell::MoveCursor( bool bWithSelect ) else { EndSelect(); - (this->*m_fnKillSel)( nullptr, false, ScrollSizeMode::ScrollSizeDefault ); + (this->*m_fnKillSel)( nullptr, false ); } } @@ -505,7 +505,7 @@ bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect) CallChgLnk(); } - (this->*m_fnSetCursor)( &m_aDest, true, ScrollSizeMode::ScrollSizeDefault ); + (this->*m_fnSetCursor)( &m_aDest, true ); bDiff = aOldRect != GetCharRect(); @@ -546,7 +546,7 @@ bool SwWrtShell::PopCursor(bool bUpdate, bool bSelect) else EndSelect(); - (this->*m_fnSetCursor)(&m_pCursorStack->aDocPos, !m_pCursorStack->bIsFrameSel, ScrollSizeMode::ScrollSizeDefault); + (this->*m_fnSetCursor)(&m_pCursorStack->aDocPos, !m_pCursorStack->bIsFrameSel); if( m_pCursorStack->bIsFrameSel && IsObjSelectable(m_pCursorStack->aDocPos)) { HideCursor(); diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 1c2cfb39ced7..404ee207e5c6 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -318,7 +318,7 @@ void SwWrtShell::PopMode() // eponymous methods in the CursorShell, the second removes // all selections at first. -tools::Long SwWrtShell::SetCursor(const Point *pPt, bool bTextOnly, ScrollSizeMode eScrollSizeMode) +tools::Long SwWrtShell::SetCursor(const Point *pPt, bool bTextOnly) { // Remove a possibly present selection at the position // of the mouseclick @@ -327,14 +327,14 @@ tools::Long SwWrtShell::SetCursor(const Point *pPt, bool bTextOnly, ScrollSizeMo ClearMark(); } - return SwCursorShell::SetCursor(*pPt, bTextOnly, true, false, eScrollSizeMode ); + return SwCursorShell::SetCursor(*pPt, bTextOnly); } -tools::Long SwWrtShell::SetCursorKillSel(const Point *pPt, bool bTextOnly, ScrollSizeMode eScrollSizeMode ) +tools::Long SwWrtShell::SetCursorKillSel(const Point *pPt, bool bTextOnly ) { SwActContext aActContext(this); - ResetSelect(pPt, false, ScrollSizeMode::ScrollSizeDefault); - return SwCursorShell::SetCursor(*pPt, bTextOnly, true, false, eScrollSizeMode); + ResetSelect(pPt,false); + return SwCursorShell::SetCursor(*pPt, bTextOnly); } void SwWrtShell::UnSelectFrame() @@ -347,7 +347,7 @@ void SwWrtShell::UnSelectFrame() // Remove of all selections -tools::Long SwWrtShell::ResetSelect(const Point *, bool, ScrollSizeMode) +tools::Long SwWrtShell::ResetSelect(const Point *,bool) { if(IsSelFrameMode()) { @@ -393,8 +393,7 @@ void SwWrtShell::SetSplitVerticalByDefault(bool value) // Do nothing -tools::Long SwWrtShell::Ignore(const Point *, bool, ScrollSizeMode ) -{ +tools::Long SwWrtShell::Ignore(const Point *, bool ) { return 1; } @@ -675,6 +674,7 @@ void SwWrtShell::EnterAddMode() if(IsTableMode()) return; if(m_bBlockMode) LeaveBlockMode(); + m_fnKillSel = &SwWrtShell::Ignore; m_fnSetCursor = &SwWrtShell::SetCursor; m_bAddMode = true; m_bBlockMode = false; diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index 090e5a89798f..d441dcf89659 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -49,7 +49,7 @@ using namespace ::com::sun::star; bool SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark) { addCurrentPosition(); - (this->*m_fnKillSel)( nullptr, false, ScrollSizeMode::ScrollSizeDefault ); + (this->*m_fnKillSel)( nullptr, false ); bool bRet = true; switch(eFuncId) @@ -75,7 +75,7 @@ bool SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* co bool SwWrtShell::GotoField( const SwFormatField& rField ) { - (this->*m_fnKillSel)( nullptr, false, ScrollSizeMode::ScrollSizeDefault ); + (this->*m_fnKillSel)( nullptr, false ); bool bRet = SwCursorShell::GotoFormatField( rField ); if( bRet && IsSelFrameMode() ) @@ -122,7 +122,7 @@ bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentContro return true; } - (this->*m_fnKillSel)(nullptr, false, ScrollSizeMode::ScrollSizeDefault); + (this->*m_fnKillSel)(nullptr, false); bool bRet = SwCursorShell::GotoFormatContentControl(rContentControl); @@ -223,7 +223,7 @@ bool SwWrtShell::GotoContentControl(const SwFormatContentControl& rContentContro bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { - (this->*m_fnKillSel)( nullptr, false, ScrollSizeMode::ScrollSizeDefault ); + (this->*m_fnKillSel)( nullptr, false ); bool bRet = SwCursorShell::GotoFieldmark(pMark); if( bRet && IsSelFrameMode() ) {