[Libreoffice-commits] core.git: editeng/source include/editeng
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 8 12:30:18 UTC 2020
editeng/source/editeng/editeng.cxx | 4 +++-
editeng/source/editeng/impedit.cxx | 12 ++++++++++++
editeng/source/editeng/impedit.hxx | 2 ++
editeng/source/editeng/impedit3.cxx | 9 +++++++++
include/editeng/editview.hxx | 5 +++++
5 files changed, 31 insertions(+), 1 deletion(-)
New commits:
commit e67a755e6d4e3241360c75c3362f90a3af5999ac
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 8 10:47:34 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 8 14:29:30 2020 +0200
add EditViewCallbacks handler to support updating scrollbar state
the problem is that since...
commit 319d8be9dad248a3ced5ac311e0b20ec3ed4cef7
Date: Tue Nov 22 16:21:20 2011 +0000
tweak experimental gsoc multiline input bar, better resizing, enable scroll
that uses SetNofifyHdl to try and keep its scrollbar up to date, but that
SetNotifyHdl is also used by a11y to listen to the editengine and only one can
be set at a time, so with a11y enabled (the gtk default case) either a11y works
or the multiline scroll doesn't or vice versa.
Seeing as the a11y case is the very complicated case, leave a11y alone and
plot a route to disentangle the straightforward calc multiline edit from a11y.
Change-Id: Iedc7ffc39940354e8a05c0620944f617eee6b550
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104080
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 15b140cd97a3..03836af7b511 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2501,13 +2501,15 @@ void EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ )
void EditEngine::ParagraphHeightChanged( sal_Int32 nPara )
{
-
if ( GetNotifyHdl().IsSet() )
{
EENotify aNotify( EE_NOTIFY_TextHeightChanged );
aNotify.nParagraph = nPara;
pImpEditEngine->GetNotifyHdl().Call( aNotify );
}
+
+ for (EditView* pView : pImpEditEngine->aEditViews)
+ pView->pImpEditView->ScrollStateChange();
}
OUString EditEngine::GetUndoComment( sal_uInt16 nId ) const
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 2fc7252c5f23..8b61a4aee975 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1428,6 +1428,15 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
}
}
+// call this so users of EditViewCallbacks can update their scrollbar state
+// so called when we have either scrolled to a new location
+// or the size of document has changed
+void ImpEditView::ScrollStateChange()
+{
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ pCallbacks->EditViewScrollStateChange();
+}
+
Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
{
DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not formatted!" );
@@ -1561,6 +1570,9 @@ Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
pEditEngine->pImpEditEngine->GetNotifyHdl().Call( aNotify );
}
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ pCallbacks->EditViewScrollStateChange();
+
if (comphelper::LibreOfficeKit::isActive())
{
DrawSelectionXOR();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 59db76fea44d..da33598365dd 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -390,6 +390,8 @@ public:
void DrawSelectionXOR( EditSelection, vcl::Region* pRegion = nullptr, OutputDevice* pTargetDevice = nullptr );
void GetSelectionRectangles(EditSelection aTmpSel, std::vector<tools::Rectangle>& rLogicRects);
+ void ScrollStateChange();
+
vcl::Window* GetWindow() const { return pOutWin; }
void SetSelectionMode( EESelectionMode eMode );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 3b362a7704d4..0d88eeba800d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -399,7 +399,16 @@ void ImpEditEngine::FormatDoc()
}
bGrow = true;
if ( IsCallParaInsertedOrDeleted() )
+ {
GetEditEnginePtr()->ParagraphHeightChanged( nPara );
+
+ for (EditView* pView : aEditViews)
+ {
+ ImpEditView* pImpView = pView->pImpEditView.get();
+ pImpView->ScrollStateChange();
+ }
+
+ }
pParaPortion->SetMustRepaint( false );
}
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index ccc2be551ca9..97b77609fe60 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -114,6 +114,11 @@ public:
// Triggered to update InputEngine cursor position
virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) = 0;
+ // Triggered if scroll bar state should change
+ virtual void EditViewScrollStateChange()
+ {
+ }
+
// implemented if drag and drop support is wanted
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget()
{
More information about the Libreoffice-commits
mailing list