summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-05 11:15:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-08-05 14:56:43 +0200
commitcbef9c333bc6b41d9d0cd8d0d7142c7606ea1226 (patch)
treefb5f133335e38cf81923a1b26f4d0d7adc2d0cce
parentda9b11a50ac33c70324fe007aa03ca01531abeb3 (diff)
tdf#117388 use native scrollbar under gtk in writer's html source view
Change-Id: I233745165140ff47d9bb462ad2248fdb8d9dd3e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137854 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx40
-rw-r--r--sw/source/uibase/inc/srcedtw.hxx9
2 files changed, 24 insertions, 25 deletions
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index cbd0f132a943..71ee88e0ebbf 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -33,7 +33,6 @@
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/textview.hxx>
-#include <vcl/scrbar.hxx>
#include <vcl/ptrstyle.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
@@ -44,6 +43,7 @@
#include <editeng/flstitem.hxx>
#include <vcl/metric.hxx>
#include <svtools/ctrltool.hxx>
+#include <svtools/scrolladaptor.hxx>
#include <tools/time.hxx>
#include <swmodule.hxx>
#include <docsh.hxx>
@@ -490,15 +490,14 @@ void SwSrcEditWindow::CreateTextEngine()
m_pOutWin->Show();
// create Scrollbars
- m_pHScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
+ m_pHScrollbar = VclPtr<ScrollAdaptor>::Create(this, true);
m_pHScrollbar->EnableRTL( false );
- m_pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
+ m_pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, HorzScrollHdl));
m_pHScrollbar->Show();
- m_pVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ m_pVScrollbar = VclPtr<ScrollAdaptor>::Create(this, false);
m_pVScrollbar->EnableRTL( false );
- m_pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
- m_pHScrollbar->EnableDrag();
+ m_pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, VertScrollHdl));
m_pVScrollbar->Show();
m_pTextEngine.reset(new ExtTextEngine);
@@ -555,22 +554,21 @@ void SwSrcEditWindow::InitScrollBars()
}
-IMPL_LINK(SwSrcEditWindow, ScrollHdl, ScrollBar*, pScroll, void)
+IMPL_LINK_NOARG(SwSrcEditWindow, HorzScrollHdl, weld::Scrollbar&, void)
{
- if(pScroll == m_pVScrollbar)
- {
- tools::Long nDiff = m_pTextView->GetStartDocPos().Y() - pScroll->GetThumbPos();
- GetTextView()->Scroll( 0, nDiff );
- m_pTextView->ShowCursor( false );
- pScroll->SetThumbPos( m_pTextView->GetStartDocPos().Y() );
- }
- else
- {
- tools::Long nDiff = m_pTextView->GetStartDocPos().X() - pScroll->GetThumbPos();
- GetTextView()->Scroll( nDiff, 0 );
- m_pTextView->ShowCursor( false );
- pScroll->SetThumbPos( m_pTextView->GetStartDocPos().X() );
- }
+ tools::Long nDiff = m_pTextView->GetStartDocPos().X() - m_pHScrollbar->GetThumbPos();
+ GetTextView()->Scroll( nDiff, 0 );
+ m_pTextView->ShowCursor( false );
+ m_pHScrollbar->SetThumbPos( m_pTextView->GetStartDocPos().X() );
+ GetSrcView()->GetViewFrame()->GetBindings().Invalidate( SID_TABLE_CELL );
+}
+
+IMPL_LINK_NOARG(SwSrcEditWindow, VertScrollHdl, weld::Scrollbar&, void)
+{
+ tools::Long nDiff = m_pTextView->GetStartDocPos().Y() - m_pVScrollbar->GetThumbPos();
+ GetTextView()->Scroll( 0, nDiff );
+ m_pTextView->ShowCursor( false );
+ m_pVScrollbar->SetThumbPos( m_pTextView->GetStartDocPos().Y() );
GetSrcView()->GetViewFrame()->GetBindings().Invalidate( SID_TABLE_CELL );
}
diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx
index 0042060cbaf1..030f510d594d 100644
--- a/sw/source/uibase/inc/srcedtw.hxx
+++ b/sw/source/uibase/inc/srcedtw.hxx
@@ -29,7 +29,8 @@
#include <set>
namespace com::sun::star::beans { class XMultiPropertySet; }
-class ScrollBar;
+namespace weld { class Scrollbar; }
+class ScrollAdaptor;
class SwSrcView;
class SwSrcEditWindow;
class TextEngine;
@@ -65,7 +66,7 @@ private:
std::unique_ptr<ExtTextEngine> m_pTextEngine;
VclPtr<TextViewOutWin> m_pOutWin;
- VclPtr<ScrollBar> m_pHScrollbar,
+ VclPtr<ScrollAdaptor> m_pHScrollbar,
m_pVScrollbar;
SwSrcView* m_pSrcView;
@@ -95,14 +96,14 @@ private:
virtual void Resize() override;
virtual void DataChanged( const DataChangedEvent& ) override;
virtual void GetFocus() override;
-// virtual void LoseFocus();
void CreateTextEngine();
void DoSyntaxHighlight( sal_uInt16 nPara );
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
- DECL_LINK(ScrollHdl, ScrollBar*, void);
+ DECL_LINK(HorzScrollHdl, weld::Scrollbar&, void);
+ DECL_LINK(VertScrollHdl, weld::Scrollbar&, void);
public:
SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView );