summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/weldeditview.hxx2
-rw-r--r--starmath/inc/edit.hxx1
-rw-r--r--starmath/source/edit.cxx48
-rw-r--r--starmath/uiconfig/smath/ui/editwindow.ui2
-rw-r--r--svx/source/dialog/weldeditview.cxx17
5 files changed, 22 insertions, 48 deletions
diff --git a/include/svx/weldeditview.hxx b/include/svx/weldeditview.hxx
index c40a754a2fc8..65bc9c979bf3 100644
--- a/include/svx/weldeditview.hxx
+++ b/include/svx/weldeditview.hxx
@@ -61,6 +61,7 @@ protected:
void DoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+public:
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual bool MouseMove(const MouseEvent& rMEvt) override;
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
@@ -78,6 +79,7 @@ protected:
void SetAcceptsTab(bool bAcceptsTab) { m_bAcceptsTab = bAcceptsTab; }
+protected:
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
virtual void EditViewInvalidate(const tools::Rectangle& rRect) override { Invalidate(rRect); }
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>
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 2ffa6b3b6670..4f035f67df6f 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -135,8 +135,23 @@ void WeldEditView::Resize()
{
OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
Size aOutputSize(rDevice.PixelToLogic(GetOutputSizePixel()));
- GetEditEngine()->SetPaperSize(aOutputSize);
+ // Resizes the edit engine to adjust to the size of the output area
pEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
+ GetEditEngine()->SetPaperSize(aOutputSize);
+ pEditView->ShowCursor();
+
+ const tools::Long nMaxVisAreaStart
+ = pEditView->GetEditEngine()->GetTextHeight() - aOutputSize.Height();
+ tools::Rectangle aVisArea(pEditView->GetVisArea());
+ if (aVisArea.Top() > nMaxVisAreaStart)
+ {
+ aVisArea.SetTop(std::max<tools::Long>(nMaxVisAreaStart, 0));
+ aVisArea.SetSize(aOutputSize);
+ pEditView->SetVisArea(aVisArea);
+ pEditView->ShowCursor();
+ }
+
+ EditViewScrollStateChange();
}
weld::CustomWidgetController::Resize();
}