summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-02 20:15:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-03 21:08:57 +0200
commit2de0eaf467715662e68b9429c9d5050f65ffcec9 (patch)
treea103455778e805f2124f08b5a627f8d642f48802 /starmath
parent9b1b29325ba988e5307a34d234cf6ba17e4350ec (diff)
There's no longer a purpose to the math horizontal scrollbar
since... commit f89860807baaa901629ce2a814b7a6c994318fe5 Date: Sat Feb 13 16:43:01 2021 +0100 Resolves tdf#140221 auto-adjust Formula Editor width so remove that. And merge the starmath Resize logic into the baseclass, and emit EditViewScrollStateChange from there. The goal is that resizing the starmath window does not visually horizontally scroll content negatively outside the widget Change-Id: I1a79a0d5a194e8cfb0d2d2cb07b0b80172f1f66c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115012 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/edit.hxx1
-rw-r--r--starmath/source/edit.cxx48
-rw-r--r--starmath/uiconfig/smath/ui/editwindow.ui2
3 files changed, 4 insertions, 47 deletions
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 536885794c06..773355cfff14 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -110,7 +110,6 @@ public:
// Window
virtual void SetText(const OUString& rText) override;
virtual OUString GetText() const override;
- virtual void Resize() override;
virtual void Command(const CommandEvent& rCEvt) override;
ESelection GetSelection() const;
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index ae9b6b7c61da..5287eeca9664 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -41,9 +41,6 @@
#include <cfgitem.hxx>
#include "accessibility.hxx"
-#define SCROLL_LINE 24
-
-
using namespace com::sun::star::accessibility;
using namespace com::sun::star;
@@ -136,7 +133,6 @@ SmEditWindow::SmEditWindow(SmCmdBoxWindow &rMyCmdBoxWin)
// compare DataChanged
SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
- mxScrolledWindow->connect_hadjustment_changed(LINK(this, SmEditWindow, ScrollHdl));
mxScrolledWindow->connect_vadjustment_changed(LINK(this, SmEditWindow, ScrollHdl));
CreateEditView();
@@ -234,8 +230,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
pEditEngine->Clear(); //incorrect font size
pEditEngine->SetText( aTxt );
- AdjustScrollBars();
- Resize();
+ mxTextControl->Resize();
}
}
@@ -270,34 +265,6 @@ IMPL_LINK_NOARG(SmEditTextWindow, CursorMoveTimerHdl, Timer *, void)
aCursorMoveIdle.Stop();
}
-void SmEditWindow::Resize()
-{
- InterimItemWindow::Resize();
-
- if (EditView* pEditView = GetEditView())
- {
- // Resizes the edit engine to adjust to the size of the output area
- const Size aSize( pEditView->GetOutputArea().GetSize() );
- pEditView->GetEditEngine()->SetPaperSize(aSize);
-
- pEditView->SetOutputArea(AdjustScrollBars());
- pEditView->ShowCursor();
-
- OSL_ENSURE( pEditView->GetEditEngine(), "EditEngine missing" );
- const tools::Long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() -
- pEditView->GetOutputArea().GetHeight();
- if (pEditView->GetVisArea().Top() > nMaxVisAreaStart)
- {
- tools::Rectangle aVisArea(pEditView->GetVisArea() );
- aVisArea.SetTop( std::max<tools::Long>(nMaxVisAreaStart, 0) );
- aVisArea.SetSize(pEditView->GetOutputArea().GetSize());
- pEditView->SetVisArea(aVisArea);
- pEditView->ShowCursor();
- }
- SetScrollBarRanges();
- }
-}
-
bool SmEditTextWindow::MouseButtonUp(const MouseEvent &rEvt)
{
bool bRet = WeldEditView::MouseButtonUp(rEvt);
@@ -488,8 +455,7 @@ void SmEditWindow::CreateEditView()
IMPL_LINK_NOARG(SmEditTextWindow, EditStatusHdl, EditStatus&, void)
{
- if (GetEditView())
- mrEditWindow.Resize();
+ Resize();
}
IMPL_LINK(SmEditWindow, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
@@ -497,7 +463,7 @@ IMPL_LINK(SmEditWindow, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
if (EditView* pEditView = GetEditView())
{
pEditView->SetVisArea(tools::Rectangle(
- Point(rScrolledWindow.hadjustment_get_value(),
+ Point(0,
rScrolledWindow.vadjustment_get_value()),
pEditView->GetVisArea().GetSize()));
pEditView->Invalidate();
@@ -531,16 +497,11 @@ void SmEditWindow::SetScrollBarRanges()
return;
int nVUpper = pEditEngine->GetTextHeight();
- int nHUpper = pEditEngine->GetPaperSize().Width();
int nVCurrentDocPos = pEditView->GetVisArea().Top();
- int nHCurrentDocPos = pEditView->GetVisArea().Left();
const Size aOut(pEditView->GetOutputArea().GetSize());
int nVStepIncrement = aOut.Height() * 2 / 10;
- int nHStepIncrement = SCROLL_LINE;
int nVPageIncrement = aOut.Height() * 8 / 10;
- int nHPageIncrement = aOut.Width() * 8 / 10;
int nVPageSize = aOut.Height();
- int nHPageSize = aOut.Width();
/* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
effectively...
@@ -551,12 +512,9 @@ void SmEditWindow::SetScrollBarRanges()
and requires that upper > lower or the deceleration animation never ends
*/
nVPageSize = std::min(nVPageSize, nVUpper);
- nHPageSize = std::min(nHPageSize, nHUpper);
mxScrolledWindow->vadjustment_configure(nVCurrentDocPos, 0, nVUpper,
nVStepIncrement, nVPageIncrement, nVPageSize);
- mxScrolledWindow->hadjustment_configure(nHCurrentDocPos, 0, nHUpper,
- nHStepIncrement, nHPageIncrement, nHPageSize);
}
OUString SmEditWindow::GetText() const
diff --git a/starmath/uiconfig/smath/ui/editwindow.ui b/starmath/uiconfig/smath/ui/editwindow.ui
index 0907ff20cb2c..fc1300887fcf 100644
--- a/starmath/uiconfig/smath/ui/editwindow.ui
+++ b/starmath/uiconfig/smath/ui/editwindow.ui
@@ -13,7 +13,7 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="border-width">0</property>
- <property name="hscrollbar-policy">always</property>
+ <property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">always</property>
<property name="shadow-type">etched-out</property>
<child>