Drop useless indirection

Change-Id: I87f26e2a2cf10d3000b0955a6ba2d877ee92bdf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128547
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2022-01-18 12:04:01 +03:00
parent 5d40e80926
commit 009e7406f2
2 changed files with 13 additions and 19 deletions

View File

@@ -135,7 +135,6 @@ private:
} }
void SetCursor(const SmNode *pNode); void SetCursor(const SmNode *pNode);
void SetCursor(const tools::Rectangle &rRect); void SetCursor(const tools::Rectangle &rRect);
static bool IsInlineEditEnabled();
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
virtual bool KeyInput(const KeyEvent& rKEvt) override; virtual bool KeyInput(const KeyEvent& rKEvt) override;

View File

@@ -338,7 +338,7 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt)
if (!pTree) if (!pTree)
return true; return true;
if (IsInlineEditEnabled()) { if (SmViewShell::IsInlineEditEnabled()) {
mrViewShell.GetDoc()->GetCursor().MoveTo(&rDevice, aPos, !rMEvt.IsShift()); mrViewShell.GetDoc()->GetCursor().MoveTo(&rDevice, aPos, !rMEvt.IsShift());
return true; return true;
} }
@@ -368,7 +368,7 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt)
bool SmGraphicWidget::MouseMove(const MouseEvent &rMEvt) bool SmGraphicWidget::MouseMove(const MouseEvent &rMEvt)
{ {
if (rMEvt.IsLeft() && IsInlineEditEnabled()) if (rMEvt.IsLeft() && SmViewShell::IsInlineEditEnabled())
{ {
OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
Point aPos(rDevice.PixelToLogic(rMEvt.GetPosPixel()) - GetFormulaDrawPos()); Point aPos(rDevice.PixelToLogic(rMEvt.GetPosPixel()) - GetFormulaDrawPos());
@@ -382,14 +382,9 @@ bool SmGraphicWidget::MouseMove(const MouseEvent &rMEvt)
return true; return true;
} }
bool SmGraphicWidget::IsInlineEditEnabled()
{
return SmViewShell::IsInlineEditEnabled();
}
void SmGraphicWidget::GetFocus() void SmGraphicWidget::GetFocus()
{ {
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return; return;
if (mrViewShell.GetEditWindow()) if (mrViewShell.GetEditWindow())
mrViewShell.GetEditWindow()->Flush(); mrViewShell.GetEditWindow()->Flush();
@@ -411,7 +406,7 @@ void SmGraphicWidget::LoseFocus()
mxAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED, mxAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED,
aOldValue, aNewValue ); aOldValue, aNewValue );
} }
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return; return;
SetIsCursorVisible(false); SetIsCursorVisible(false);
ShowLine(false); ShowLine(false);
@@ -444,7 +439,7 @@ void SmGraphicWidget::CaretBlinkInit()
void SmGraphicWidget::CaretBlinkStart() void SmGraphicWidget::CaretBlinkStart()
{ {
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return; return;
if (aCaretBlinkTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME) if (aCaretBlinkTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME)
aCaretBlinkTimer.Start(); aCaretBlinkTimer.Start();
@@ -452,7 +447,7 @@ void SmGraphicWidget::CaretBlinkStart()
void SmGraphicWidget::CaretBlinkStop() void SmGraphicWidget::CaretBlinkStop()
{ {
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return; return;
aCaretBlinkTimer.Stop(); aCaretBlinkTimer.Stop();
} }
@@ -460,7 +455,7 @@ void SmGraphicWidget::CaretBlinkStop()
// shows or hides the formula-cursor depending on 'bShow' is true or not // shows or hides the formula-cursor depending on 'bShow' is true or not
void SmGraphicWidget::ShowCursor(bool bShow) void SmGraphicWidget::ShowCursor(bool bShow)
{ {
if (IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
return; return;
bool bInvert = bShow != IsCursorVisible(); bool bInvert = bShow != IsCursorVisible();
@@ -475,7 +470,7 @@ void SmGraphicWidget::ShowCursor(bool bShow)
void SmGraphicWidget::ShowLine(bool bShow) void SmGraphicWidget::ShowLine(bool bShow)
{ {
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return; return;
bIsLineVisible = bShow; bIsLineVisible = bShow;
@@ -483,7 +478,7 @@ void SmGraphicWidget::ShowLine(bool bShow)
void SmGraphicWidget::SetCursor(const SmNode *pNode) void SmGraphicWidget::SetCursor(const SmNode *pNode)
{ {
if (IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
return; return;
const SmNode *pTree = mrViewShell.GetDoc()->GetFormulaTree(); const SmNode *pTree = mrViewShell.GetDoc()->GetFormulaTree();
@@ -502,7 +497,7 @@ void SmGraphicWidget::SetCursor(const tools::Rectangle &rRect)
// The old cursor will be removed, and the new one will be shown if // The old cursor will be removed, and the new one will be shown if
// that is activated in the ConfigItem // that is activated in the ConfigItem
{ {
if (IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
return; return;
SmModule *pp = SM_MOD(); SmModule *pp = SM_MOD();
@@ -522,7 +517,7 @@ const SmNode * SmGraphicWidget::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol)
// rectangle. If not the formula-cursor will be hidden. // rectangle. If not the formula-cursor will be hidden.
// In any case the search result is being returned. // In any case the search result is being returned.
{ {
if (IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
return nullptr; return nullptr;
// find visible node with token at nRow, nCol // find visible node with token at nRow, nCol
@@ -547,7 +542,7 @@ void SmGraphicWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
rDoc.DrawFormula(rRenderContext, aPoint, true); //! modifies aPoint to be the topleft rDoc.DrawFormula(rRenderContext, aPoint, true); //! modifies aPoint to be the topleft
//! corner of the formula //! corner of the formula
aFormulaDrawPos = aPoint; aFormulaDrawPos = aPoint;
if (IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
{ {
//Draw cursor if any... //Draw cursor if any...
if (mrViewShell.GetDoc()->HasCursor() && IsLineVisible()) if (mrViewShell.GetDoc()->HasCursor() && IsLineVisible())
@@ -583,7 +578,7 @@ void SmGraphicWidget::SetTotalSize()
bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt)
{ {
if (!IsInlineEditEnabled()) if (!SmViewShell::IsInlineEditEnabled())
return mrViewShell.KeyInput(rKEvt); return mrViewShell.KeyInput(rKEvt);
bool bConsumed = true; bool bConsumed = true;