diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-05 11:37:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-05 17:05:04 +0200 |
commit | 5ae01ffa70549b1a4d9f166d0528a8d04a5dc858 (patch) | |
tree | 3006d72ec6befba6f8d81bc55bcdcccc0b27a2cf | |
parent | f5109c38e2d5bd608fc6b94fde75e73d70e0c4f7 (diff) |
tdf#117388 use native scrollbar under gtk in basic editor
Change-Id: Id8f2b4fdc40116bb28053dc6fbbf6fa86e6808fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137862
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 11 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 2 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 41 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 6 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedfunc.cxx | 8 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedview.cxx | 2 | ||||
-rw-r--r-- | basctl/source/inc/baside3.hxx | 2 | ||||
-rw-r--r-- | basctl/source/inc/basidesh.hxx | 5 | ||||
-rw-r--r-- | basctl/source/inc/bastypes.hxx | 16 | ||||
-rw-r--r-- | basctl/source/inc/dlged.hxx | 12 |
13 files changed, 59 insertions, 61 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index e75bb32a6478..1eb4b9027b7b 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1164,7 +1164,7 @@ void ModulWindow::GetState( SfxItemSet &rSet ) } } -void ModulWindow::DoScroll( ScrollBar* pCurScrollBar ) +void ModulWindow::DoScroll( Scrollable* pCurScrollBar ) { if ( ( pCurScrollBar == GetHScrollBar() ) && GetEditView() ) { diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index bf84323a3200..38ca2aec6ea7 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -32,6 +32,7 @@ #include <vcl/weld.hxx> #include <svtools/colorcfg.hxx> +#include <svtools/scrolladaptor.hxx> #include <o3tl/enumarray.hxx> #include <rtl/ustrbuf.hxx> @@ -253,12 +254,12 @@ private: VclPtr<BreakPointWindow> aBrkWindow; VclPtr<LineNumberWindow> aLineNumberWindow; VclPtr<EditorWindow> aEdtWindow; - VclPtr<ScrollBar> aEWVScrollBar; + VclPtr<ScrollAdaptor> aEWVScrollBar; virtual void DataChanged(DataChangedEvent const & rDCEvt) override; virtual void Resize() override; - DECL_LINK( ScrollHdl, ScrollBar*, void ); + DECL_LINK(ScrollHdl, weld::Scrollbar&, void); public: explicit ComplexEditorWindow( ModulWindow* pParent ); @@ -267,7 +268,7 @@ public: BreakPointWindow& GetBrkWindow() { return *aBrkWindow; } LineNumberWindow& GetLineNumberWindow() { return *aLineNumberWindow; } EditorWindow& GetEdtWindow() { return *aEdtWindow; } - ScrollBar& GetEWVScrollBar() { return *aEWVScrollBar; } + ScrollAdaptor& GetEWVScrollBar() { return *aEWVScrollBar; } void SetLineNumberDisplay(bool b); }; @@ -294,7 +295,7 @@ protected: virtual void GetFocus() override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; virtual void DoInit() override; - virtual void DoScroll( ScrollBar* pCurScrollBar ) override; + virtual void DoScroll(Scrollable* pCurScrollBar) override; public: ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName, OUString aModule ); @@ -360,7 +361,7 @@ public: EditorWindow& GetEditorWindow() { return m_aXEditorWindow->GetEdtWindow(); } BreakPointWindow& GetBreakPointWindow() { return m_aXEditorWindow->GetBrkWindow(); } LineNumberWindow& GetLineNumberWindow() { return m_aXEditorWindow->GetLineNumberWindow(); } - ScrollBar& GetEditVScrollBar() { return m_aXEditorWindow->GetEWVScrollBar(); } + ScrollAdaptor& GetEditVScrollBar() { return m_aXEditorWindow->GetEWVScrollBar(); } ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); } TextView* GetEditView() { return GetEditorWindow().GetEditView(); } BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); } diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index fbda4447191e..249a636fdee7 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1940,7 +1940,7 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : aBrkWindow(VclPtr<BreakPointWindow>::Create(this, pParent)), aLineNumberWindow(VclPtr<LineNumberWindow>::Create(this, pParent)), aEdtWindow(VclPtr<EditorWindow>::Create(this, pParent)), - aEWVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ) + aEWVScrollBar( VclPtr<ScrollAdaptor>::Create(this, false) ) { aEdtWindow->Show(); aBrkWindow->Show(); @@ -1995,17 +1995,16 @@ void ComplexEditorWindow::Resize() aEWVScrollBar->SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); } -IMPL_LINK(ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar, void ) +IMPL_LINK_NOARG(ComplexEditorWindow, ScrollHdl, weld::Scrollbar&, void) { if (aEdtWindow->GetEditView()) { - DBG_ASSERT( pCurScrollBar == aEWVScrollBar.get(), "Who is scrolling?" ); - tools::Long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos(); + tools::Long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - aEWVScrollBar->GetThumbPos(); aEdtWindow->GetEditView()->Scroll( 0, nDiff ); aBrkWindow->DoScroll( nDiff ); aLineNumberWindow->DoScroll( nDiff ); aEdtWindow->GetEditView()->ShowCursor(false); - pCurScrollBar->SetThumbPos( aEdtWindow->GetEditView()->GetStartDocPos().Y() ); + aEWVScrollBar->SetThumbPos( aEdtWindow->GetEditView()->GetStartDocPos().Y() ); } } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 1424573b0ea5..be271265f493 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -237,7 +237,7 @@ void DialogWindow::DoInit() m_pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() ); } -void DialogWindow::DoScroll( ScrollBar* ) +void DialogWindow::DoScroll( Scrollable* ) { m_pEditor->DoScroll(); } diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 0e85219824b2..a075b1f8f2db 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -159,8 +159,8 @@ unsigned Shell::nShellCount = 0; Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : SfxViewShell( pFrame_, SfxViewShellFlags::NO_NEWWINDOW ), m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ), - aHScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ), - aVScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ), + aHScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame()->GetWindow(), true) ), + aVScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame()->GetWindow(), false) ), aScrollBarBox( VclPtr<ScrollBarBox>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ), pLayout(nullptr), aObjectCatalog(VclPtr<ObjectCatalog>::Create(&GetViewFrame()->GetWindow())), diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 8d26fc4cacc8..1790c4b5444f 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -72,49 +72,51 @@ BaseWindow::~BaseWindow() void BaseWindow::dispose() { - if ( pShellVScrollBar ) - pShellVScrollBar->SetScrollHdl( Link<ScrollBar*,void>() ); - if ( pShellHScrollBar ) - pShellHScrollBar->SetScrollHdl( Link<ScrollBar*,void>() ); + if (pShellVScrollBar && !pShellVScrollBar>isDisposed()) + pShellVScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() ); + if (pShellHScrollBar && !pShellHScrollBar->isDisposed()) + pShellHScrollBar->SetScrollHdl( Link<weld::Scrollbar&,void>() ); pShellVScrollBar.clear(); pShellHScrollBar.clear(); vcl::Window::dispose(); } - void BaseWindow::Init() { if ( pShellVScrollBar ) - pShellVScrollBar->SetScrollHdl( LINK( this, BaseWindow, ScrollHdl ) ); + pShellVScrollBar->SetScrollHdl( LINK( this, BaseWindow, VertScrollHdl ) ); if ( pShellHScrollBar ) - pShellHScrollBar->SetScrollHdl( LINK( this, BaseWindow, ScrollHdl ) ); + pShellHScrollBar->SetScrollHdl( LINK( this, BaseWindow, HorzScrollHdl ) ); DoInit(); // virtual... } - void BaseWindow::DoInit() -{ } - +{ +} -void BaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ) +void BaseWindow::GrabScrollBars(ScrollAdaptor* pHScroll, ScrollAdaptor* pVScroll) { pShellHScrollBar = pHScroll; pShellVScrollBar = pVScroll; -// Init(); // does not make sense, leads to flickering and errors... } +IMPL_LINK_NOARG(BaseWindow, VertScrollHdl, weld::Scrollbar&, void) +{ + DoScroll(pShellVScrollBar); +} -IMPL_LINK( BaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar, void ) +IMPL_LINK_NOARG(BaseWindow, HorzScrollHdl, weld::Scrollbar&, void) { - DoScroll( pCurScrollBar ); + DoScroll(pShellHScrollBar); } void BaseWindow::ExecuteCommand (SfxRequest&) -{ } +{ +} void BaseWindow::ExecuteGlobal (SfxRequest&) -{ } - +{ +} bool BaseWindow::EventNotify( NotifyEvent& rNEvt ) { @@ -145,12 +147,10 @@ bool BaseWindow::EventNotify( NotifyEvent& rNEvt ) return bDone || Window::EventNotify( rNEvt ); } - -void BaseWindow::DoScroll( ScrollBar* ) +void BaseWindow::DoScroll( Scrollable* ) { } - void BaseWindow::StoreData() { } @@ -160,7 +160,6 @@ bool BaseWindow::AllowUndo() return true; } - void BaseWindow::UpdateData() { } diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 81fa3f14e837..e61249650c0f 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -237,7 +237,6 @@ DlgEditor::DlgEditor ( SetDialog(xDialogModel); } - DlgEditor::~DlgEditor() { aMarkIdle.Stop(); @@ -245,7 +244,6 @@ DlgEditor::~DlgEditor() ::comphelper::disposeComponent( m_xControlContainer ); } - Reference< awt::XControlContainer > const & DlgEditor::GetWindowControlContainer() { if (!m_xControlContainer.is()) @@ -253,8 +251,7 @@ Reference< awt::XControlContainer > const & DlgEditor::GetWindowControlContainer return m_xControlContainer; } - -void DlgEditor::SetScrollBars( ScrollBar* pHS, ScrollBar* pVS ) +void DlgEditor::SetScrollBars(ScrollAdaptor* pHS, ScrollAdaptor* pVS) { pHScroll = pHS; pVScroll = pVS; @@ -262,7 +259,6 @@ void DlgEditor::SetScrollBars( ScrollBar* pHS, ScrollBar* pVS ) InitScrollBars(); } - void DlgEditor::InitScrollBars() { DBG_ASSERT( pHScroll, "DlgEditor::InitScrollBars: no horizontal scroll bar!" ); diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index c43b22c8e16a..7f1a0388eeaa 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/scrbar.hxx> +#include <svtools/scrolladaptor.hxx> #include <svx/svdview.hxx> #include <dlgedfunc.hxx> #include <dlged.hxx> @@ -45,8 +45,8 @@ void DlgEdFunc::ForceScroll( const Point& rPos ) tools::Rectangle aOutRect( aDefPoint, rWindow.GetOutputSizePixel() ); aOutRect = rWindow.PixelToLogic( aOutRect ); - ScrollBar* pHScroll = rParent.GetHScroll(); - ScrollBar* pVScroll = rParent.GetVScroll(); + ScrollAdaptor* pHScroll = rParent.GetHScroll(); + ScrollAdaptor* pVScroll = rParent.GetVScroll(); tools::Long nDeltaX = pHScroll->GetLineSize(); tools::Long nDeltaY = pVScroll->GetLineSize(); @@ -294,7 +294,7 @@ bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) else { // scroll page - ScrollBar* pScrollBar = ( nX != 0 ) ? rParent.GetHScroll() : rParent.GetVScroll(); + ScrollAdaptor* pScrollBar = ( nX != 0 ) ? rParent.GetHScroll() : rParent.GetVScroll(); if ( pScrollBar ) { tools::Long nRangeMin = pScrollBar->GetRangeMin(); diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx index d6c67b7e9f7a..81271d38f8bd 100644 --- a/basctl/source/dlged/dlgedview.cxx +++ b/basctl/source/dlged/dlgedview.cxx @@ -21,8 +21,8 @@ #include <dlged.hxx> #include <dlgedpage.hxx> +#include <svtools/scrolladaptor.hxx> #include <vcl/canvastools.hxx> -#include <vcl/scrbar.hxx> #include <dlgedobj.hxx> diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index cc53d0f11f69..5b61e1b88748 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -67,7 +67,7 @@ protected: static void NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> ); virtual void DoInit() override; - virtual void DoScroll( ScrollBar* pCurScrollBar ) override; + virtual void DoScroll( Scrollable* pCurScrollBar ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; void InitSettings(); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 2d494cd8d4ee..cecf060c4074 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -26,6 +26,7 @@ #include <sfx2/viewsh.hxx> #include <svx/ifaceids.hxx> #include <svl/srchitem.hxx> +#include <svtools/scrolladaptor.hxx> #include <vcl/scrbar.hxx> #include <map> #include <memory> @@ -68,8 +69,8 @@ private: OUString m_aCurLibName; std::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr; - VclPtr<ScrollBar> aHScrollBar; - VclPtr<ScrollBar> aVScrollBar; + VclPtr<ScrollAdaptor> aHScrollBar; + VclPtr<ScrollAdaptor> aVScrollBar; VclPtr<ScrollBarBox> aScrollBarBox; VclPtr<TabBar> pTabBar; // basctl::TabBar bool bCreatingWindow; diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index 04d308fc7b22..a0809d902969 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -21,6 +21,7 @@ #include "scriptdocument.hxx" #include "sbxitem.hxx" +#include <svtools/scrolladaptor.hxx> #include <svtools/tabbar.hxx> #include <basic/sbdef.hxx> #include <vcl/dockwin.hxx> @@ -155,10 +156,11 @@ class EntryDescriptor; class BaseWindow : public vcl::Window { private: - VclPtr<ScrollBar> pShellHScrollBar; - VclPtr<ScrollBar> pShellVScrollBar; + VclPtr<ScrollAdaptor> pShellHScrollBar; + VclPtr<ScrollAdaptor> pShellVScrollBar; - DECL_LINK( ScrollHdl, ScrollBar*, void ); + DECL_LINK( VertScrollHdl, weld::Scrollbar&, void ); + DECL_LINK( HorzScrollHdl, weld::Scrollbar&, void ); int nStatus; ScriptDocument m_aDocument; @@ -169,7 +171,7 @@ private: friend class DialogWindow; protected: - virtual void DoScroll( ScrollBar* pCurScrollBar ); + virtual void DoScroll(Scrollable* pCurScrollBar); public: BaseWindow( vcl::Window* pParent, ScriptDocument aDocument, OUString aLibName, OUString aName ); @@ -180,10 +182,10 @@ public: virtual void DoInit(); virtual void Activating () = 0; virtual void Deactivating () = 0; - void GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); + void GrabScrollBars(ScrollAdaptor* pHScroll, ScrollAdaptor* pVScroll); - ScrollBar* GetHScrollBar() const { return pShellHScrollBar; } - ScrollBar* GetVScrollBar() const { return pShellVScrollBar; } + ScrollAdaptor* GetHScrollBar() const { return pShellHScrollBar; } + ScrollAdaptor* GetVScrollBar() const { return pShellVScrollBar; } virtual void ExecuteCommand (SfxRequest&); virtual void ExecuteGlobal (SfxRequest&); diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx index 9e5147dfcfc2..0d1c461ad106 100644 --- a/basctl/source/inc/dlged.hxx +++ b/basctl/source/inc/dlged.hxx @@ -36,7 +36,7 @@ #include <memory> -class ScrollBar; +class ScrollAdaptor; class Printer; class KeyEvent; class MouseEvent; @@ -107,8 +107,8 @@ private: static void Print( Printer* pPrinter, const OUString& rTitle ); private: - VclPtr<ScrollBar> pHScroll; - VclPtr<ScrollBar> pVScroll; + VclPtr<ScrollAdaptor> pHScroll; + VclPtr<ScrollAdaptor> pVScroll; std::unique_ptr<DlgEdModel> pDlgEdModel; // never nullptr DlgEdPage* pDlgEdPage; // never nullptr std::unique_ptr<DlgEdView> pDlgEdView; // never nullptr @@ -149,10 +149,10 @@ public: css::uno::Reference< css::awt::XControlContainer > const & GetWindowControlContainer(); - void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); + void SetScrollBars(ScrollAdaptor* pHScroll, ScrollAdaptor* pVScroll); void InitScrollBars(); - ScrollBar* GetHScroll() const { return pHScroll; } - ScrollBar* GetVScroll() const { return pVScroll; } + ScrollAdaptor* GetHScroll() const { return pHScroll; } + ScrollAdaptor* GetVScroll() const { return pVScroll; } void DoScroll(); void UpdateScrollBars(); |