summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-01-20 15:04:43 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-01-21 00:54:54 +0100
commit049bbd95c190e0844da3a8dd88b1ce7a9ccf83b7 (patch)
treebd19faddc850498494539d1899c6a7b9e848ad3a /starmath
parent06aea80b0482c03e8f0a5f735d3a31ec816a07fe (diff)
editeng: change EditEngine getter to ref in {Imp}EditView
{Imp}EditView always needs to have EditEngine set (or it would crash otherwise), so we can change the getter to return a referece instead of a pointer. This simplifies things a bit because we get rid of all the nullptr checks and makes the interface more clear. Also change direct access to mpEditEngine in {Imp}EditView to use getEditEngine() and getImpEditEngine() (returning a reference) instead. Change-Id: Ib8f9c565b8364144bb9c35c3093c4975af1970c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162333 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/edit.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index bc1138a18d44..f36634a16b14 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -312,7 +312,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
// as we don't support RTL in Math, we need to swap values from selection when they were done
// in RTL form
aSelection.Adjust();
- OUString selected = pEditView->GetEditEngine()->GetText(aSelection);
+ OUString selected = pEditView->getEditEngine().GetText(aSelection);
// Check is auto close brackets/braces is disabled
SmModule *pMod = SM_MOD();
@@ -322,7 +322,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
autoClose = true;
else if (selected.isEmpty() && !aSelection.HasRange())
{
- selected = pEditView->GetEditEngine()->GetText(aSelection.nEndPara);
+ selected = pEditView->getEditEngine().GetText(aSelection.nEndPara);
if (!selected.isEmpty())
{
sal_Int32 index = selected.indexOf("\n", aSelection.nEndPos);
@@ -543,7 +543,7 @@ void SmEditTextWindow::SetText(const OUString& rText)
aModifyIdle.Start();
// Apply zoom to smeditwindow text
- static_cast<SmEditEngine*>(pEditView->GetEditEngine())->executeZoom(pEditView);
+ static_cast<SmEditEngine&>(pEditView->getEditEngine()).executeZoom(pEditView);
pEditView->SetSelection(eSelection);
}
@@ -780,7 +780,7 @@ void SmEditTextWindow::InsertText(const OUString& rText)
// Note: Insertion of a space in front of commands is done here and
// in SmEditWindow::InsertCommand.
ESelection aSelection = pEditView->GetSelection();
- OUString aCurrentFormula = pEditView->GetEditEngine()->GetText();
+ OUString aCurrentFormula = pEditView->getEditEngine().GetText();
sal_Int32 nStartIndex = 0;
// get the start position (when we get a multi line formula)
@@ -850,11 +850,9 @@ void SmEditWindow::DeleteEditView()
{
if (EditView* pEditView = GetEditView())
{
- if (EditEngine* pEditEngine = pEditView->GetEditEngine())
- {
- pEditEngine->SetStatusEventHdl( Link<EditStatus&,void>() );
- pEditEngine->RemoveView(pEditView);
- }
+ EditEngine& rEditEngine = pEditView->getEditEngine();
+ rEditEngine.SetStatusEventHdl( Link<EditStatus&,void>() );
+ rEditEngine.RemoveView(pEditView);
mxTextControlWin.reset();
mxTextControl.reset();
}