desktop/source/lib/init.cxx | 2 include/sfx2/lokcomponenthelpers.hxx | 23 ++++ include/vcl/window.hxx | 1 sc/source/ui/unoobj/docuno.cxx | 2 sd/source/ui/unoidl/unomodel.cxx | 2 sfx2/Library_sfx.mk | 1 sfx2/source/view/lokcharthelper.cxx | 2 sfx2/source/view/lokstarmathhelper.cxx | 169 ++++++++++++++++++++++++++++++ solenv/clang-format/excludelist | 2 starmath/inc/view.hxx | 4 starmath/source/view.cxx | 180 ++++++++++++++++++++++----------- svx/source/svdraw/svdmrkv.cxx | 2 sw/source/uibase/uno/unotxdoc.cxx | 32 +++-- sw/source/uibase/wrtsh/wrtsh1.cxx | 8 + 14 files changed, 348 insertions(+), 82 deletions(-)
New commits: commit 737a270c61cd2038ede7911b7d7b4afcf020f53c Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jan 17 17:15:46 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jan 25 17:36:08 2022 +0100 lok: enable in-place editing of math equations Change-Id: Ic4d187d1e2ee92eab74a6bb43e47bb4f3d47ebd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128506 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ef2365a017e6..dfbf503b269f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -108,7 +108,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <sfx2/DocumentSigner.hxx> #include <sfx2/sidebar/SidebarDockingWindow.hxx> #include <sfx2/sidebar/SidebarController.hxx> diff --git a/include/sfx2/lokcharthelper.hxx b/include/sfx2/lokcomponenthelpers.hxx similarity index 77% rename from include/sfx2/lokcharthelper.hxx rename to include/sfx2/lokcomponenthelpers.hxx index 26f14b4c3129..114912253043 100644 --- a/include/sfx2/lokcharthelper.hxx +++ b/include/sfx2/lokcomponenthelpers.hxx @@ -57,6 +57,29 @@ public: double fScaleX = 1.0, double fScaleY = 1.0); }; +/// A class for math editing support via LibreOfficeKit. +class SFX2_DLLPUBLIC LokStarMathHelper +{ +public: + LokStarMathHelper(SfxViewShell* pViewShell) + : mpViewShell(pViewShell) + { + } + + vcl::Window* GetWindow(); + + bool postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier, + double fScaleX = 1.0, double fScaleY = 1.0); + +private: + css::uno::Reference<css::frame::XController>& GetXController(); + tools::Rectangle GetBoundingBox(); + + SfxViewShell* mpViewShell; + css::uno::Reference<css::frame::XController> mxController; + VclPtr<vcl::Window> mpWindow; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index ce2464a1e976..fb87796bdcd3 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1458,6 +1458,7 @@ public: virtual FactoryFunction GetUITestFactory() const; virtual bool IsChart() const { return false; } + virtual bool IsStarMath() const { return false; } void SetHelpHdl(const Link<vcl::Window&, bool>& rLink); void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 5e2bc1dc5c1e..ccb98469bbde 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -81,7 +81,7 @@ #include <opencl/platforminfo.hxx> #endif #include <sfx2/lokhelper.hxx> -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <sfx2/LokControlHandler.hxx> #include <cellsuno.hxx> diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1fb8982a17fa..0bfd6fd3dc74 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -119,7 +119,7 @@ #include <drawinglayer/primitive2d/structuretagprimitive2d.hxx> -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <tools/gen.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index b38e8b1d60b8..a8873df7c1f5 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -309,6 +309,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/view/frmload \ sfx2/source/view/ipclient \ sfx2/source/view/lokcharthelper \ + sfx2/source/view/lokstarmathhelper \ sfx2/source/view/lokhelper \ sfx2/source/view/printer \ sfx2/source/view/sfxbasecontroller \ diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index 69ec1a941421..e5965802306c 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <comphelper/lok.hxx> #include <comphelper/propertyvalue.hxx> diff --git a/sfx2/source/view/lokstarmathhelper.cxx b/sfx2/source/view/lokstarmathhelper.cxx new file mode 100644 index 000000000000..fedd931b08fd --- /dev/null +++ b/sfx2/source/view/lokstarmathhelper.cxx @@ -0,0 +1,169 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <sfx2/ipclient.hxx> +#include <sfx2/lokcomponenthelpers.hxx> +#include <sfx2/lokhelper.hxx> + +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/fract.hxx> +#include <vcl/layout.hxx> +#include <vcl/window.hxx> + +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +css::uno::Reference<css::frame::XController>& LokStarMathHelper::GetXController() +{ + if (!mxController && mpViewShell) + { + if (const SfxInPlaceClient* pIPClient = mpViewShell->GetIPClient()) + { + if (const auto& xEmbObj = pIPClient->GetObject()) + { + css::uno::Reference<css::lang::XServiceInfo> xComp(xEmbObj->getComponent(), + css::uno::UNO_QUERY); + if (xComp && xComp->supportsService("com.sun.star.formula.FormulaProperties")) + if (css::uno::Reference<css::frame::XModel> xModel{ xComp, + css::uno::UNO_QUERY }) + mxController = xModel->getCurrentController(); + } + } + } + + return mxController; +} + +namespace +{ +// Find a child SmGraphicWindow* +vcl::Window* FindSmGraphicWindow(vcl::Window* pWin) +{ + if (!pWin) + return nullptr; + + if (pWin->IsStarMath()) + return pWin; + + pWin = pWin->GetWindow(GetWindowType::FirstChild); + while (pWin) + { + if (vcl::Window* pSmGraphicWindow = FindSmGraphicWindow(pWin)) + return pSmGraphicWindow; + pWin = pWin->GetWindow(GetWindowType::Next); + } + return nullptr; +} + +// Find a child window that corresponds to SmGraphicWidget +vcl::Window* FindChildSmGraphicWidgetWindow(vcl::Window* pWin) +{ + if (!pWin) + return nullptr; + + // The needed window is a VclDrawingArea + if (dynamic_cast<VclDrawingArea*>(pWin)) + return pWin; + + pWin = pWin->GetWindow(GetWindowType::FirstChild); + while (pWin) + { + if (vcl::Window* pSmGraphicWidgetWindow = FindChildSmGraphicWidgetWindow(pWin)) + return pSmGraphicWidgetWindow; + pWin = pWin->GetWindow(GetWindowType::Next); + } + return nullptr; +} + +vcl::Window* FindSmGraphicWidgetWindow(vcl::Window* pWin) +{ + return FindChildSmGraphicWidgetWindow(FindSmGraphicWindow(pWin)); +} +} + +vcl::Window* LokStarMathHelper::GetWindow() +{ + if (!mpWindow) + { + if (const css::uno::Reference<css::frame::XController>& xController = GetXController()) + { + if (const css::uno::Reference<css::frame::XFrame> xFrame = xController->getFrame()) + { + css::uno::Reference<css::awt::XWindow> xDockerWin = xFrame->getContainerWindow(); + mpWindow.set(FindSmGraphicWidgetWindow(VCLUnoHelper::GetWindow(xDockerWin))); + } + } + } + + return mpWindow.get(); +} + +tools::Rectangle LokStarMathHelper::GetBoundingBox() +{ + if (mpViewShell) + { + if (SfxInPlaceClient* pIPClient = mpViewShell->GetIPClient()) + { + if (vcl::Window* pRootWin = pIPClient->GetEditWin()) + { + if (vcl::Window* pWindow = GetWindow()) + { + // In all cases, the following code fragment + // returns the bounding box in twips. + const MapMode& aMapMode = pWindow->GetMapMode(); + const auto & [ m, d ] + = o3tl::getConversionMulDiv(o3tl::Length::px, o3tl::Length::twip); + const Fraction& scaleX = aMapMode.GetScaleX(); + const Fraction& scaleY = aMapMode.GetScaleY(); + const auto nXNum = m * scaleX.GetDenominator(); + const auto nXDen = d * scaleX.GetNumerator(); + const auto nYNum = m * scaleY.GetDenominator(); + const auto nYDen = d * scaleY.GetNumerator(); + + Point aOffset + = pWindow->GetOffsetPixelFrom(*pRootWin).scale(nXNum, nXDen, nYNum, nYDen); + Size aSize = pWindow->GetSizePixel().scale(nXNum, nXDen, nYNum, nYDen); + return { aOffset, aSize }; + } + } + } + } + return {}; +} + +bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, + int nModifier, double fScaleX, double fScaleY) +{ + if (vcl::Window* pWindow = GetWindow()) + { + Point aMousePos(nX, nY); + tools::Rectangle rBBox = GetBoundingBox(); + if (rBBox.Contains(aMousePos)) + { + int nWinX = nX - rBBox.Left(); + int nWinY = nY - rBBox.Top(); + + // window expects pixels, but the conversion factor + // can depend on the client zoom + Point aPos(nWinX * fScaleX, nWinY * fScaleY); + + LokMouseEventData aMouseEventData(nType, aPos, nCount, MouseEventModifiers::SIMPLECLICK, + nButtons, nModifier); + SfxLokHelper::postMouseEventAsync(pWindow, aMouseEventData); + + return true; + } + } + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 119393df542e..90ff78ab4dc9 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5630,7 +5630,7 @@ include/sfx2/ipclient.hxx include/sfx2/linkmgr.hxx include/sfx2/linksrc.hxx include/sfx2/lnkbase.hxx -include/sfx2/lokcharthelper.hxx +include/sfx2/lokcomponenthelpers.hxx include/sfx2/lokhelper.hxx include/sfx2/mailmodelapi.hxx include/sfx2/minfitem.hxx diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 90cb04831755..8b49b117ef35 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -61,6 +61,8 @@ public: virtual void dispose() override; virtual ~SmGraphicWindow() override; + virtual bool IsStarMath() const override { return true; } + void SetTotalSize(const Size& rNewSize); Size GetTotalSize() const; @@ -107,6 +109,7 @@ public: virtual bool MouseMove(const MouseEvent &rMEvt) override; virtual void GetFocus() override; virtual void LoseFocus() override; + virtual bool KeyInput(const KeyEvent& rKEvt) override; void SetTotalSize(); @@ -137,7 +140,6 @@ private: void SetCursor(const tools::Rectangle &rRect); virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - virtual bool KeyInput(const KeyEvent& rKEvt) override; virtual bool Command(const CommandEvent& rCEvt) override; void RepaintViewShellDoc(); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 4eda4001e81c..eb1555a9a29b 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/container/XChild.hpp> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> @@ -576,6 +577,90 @@ void SmGraphicWidget::SetTotalSize() mrGraphicWindow.SetTotalSize(aTmp); } +namespace +{ +SmBracketType BracketTypeOf(sal_uInt32 c) +{ + switch (c) + { + case '(': + case ')': + return SmBracketType::Round; + case '[': + case ']': + return SmBracketType::Square; + case '{': + case '}': + return SmBracketType::Curly; + } + assert(false); // Unreachable + return SmBracketType::Round; +} + +bool CharInput(sal_uInt32 c, SmCursor& rCursor, OutputDevice& rDevice) +{ + switch (c) + { + case 0: + return false; + case ' ': + rCursor.InsertElement(BlankElement); + break; + case '!': + rCursor.InsertElement(FactorialElement); + break; + case '%': + rCursor.InsertElement(PercentElement); + break; + case '*': + rCursor.InsertElement(CDotElement); + break; + case '+': + rCursor.InsertElement(PlusElement); + break; + case '-': + rCursor.InsertElement(MinusElement); + break; + case '<': + rCursor.InsertElement(LessThanElement); + break; + case '=': + rCursor.InsertElement(EqualElement); + break; + case '>': + rCursor.InsertElement(GreaterThanElement); + break; + case '^': + rCursor.InsertSubSup(RSUP); + break; + case '_': + rCursor.InsertSubSup(RSUB); + break; + case '/': + rCursor.InsertFraction(); + break; + case '(': + case '[': + case '{': + rCursor.InsertBrackets(BracketTypeOf(c)); + break; + case ')': + case ']': + case '}': + if (rCursor.IsAtTailOfBracket(BracketTypeOf(c))) + { + rCursor.Move(&rDevice, MoveRight); + break; + } + [[fallthrough]]; + default: + rCursor.InsertText(OUString(&c, 1)); + break; + } + return true; +} +} + bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { if (!SmViewShell::IsInlineEditEnabled()) @@ -629,61 +714,10 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { rCursor.DeletePrev(&rDevice); }break; - case KEY_ADD: - rCursor.InsertElement(PlusElement); - break; - case KEY_SUBTRACT: - if(rKEvt.GetKeyCode().IsShift()) - rCursor.InsertSubSup(RSUB); - else - rCursor.InsertElement(MinusElement); - break; - case KEY_MULTIPLY: - rCursor.InsertElement(CDotElement); - break; - case KEY_DIVIDE: - rCursor.InsertFraction(); - break; - case KEY_LESS: - rCursor.InsertElement(LessThanElement); - break; - case KEY_GREATER: - rCursor.InsertElement(GreaterThanElement); - break; - case KEY_EQUAL: - rCursor.InsertElement(EqualElement); - break; default: { - sal_Unicode code = rKEvt.GetCharCode(); - - if(code == ' ') { - rCursor.InsertElement(BlankElement); - }else if(code == '^') { - rCursor.InsertSubSup(RSUP); - }else if(code == '(') { - rCursor.InsertBrackets(SmBracketType::Round); - }else if(code == '[') { - rCursor.InsertBrackets(SmBracketType::Square); - }else if(code == '{') { - rCursor.InsertBrackets(SmBracketType::Curly); - }else if(code == '!') { - rCursor.InsertElement(FactorialElement); - }else if(code == '%') { - rCursor.InsertElement(PercentElement); - } - else if ((code == ')' && rCursor.IsAtTailOfBracket(SmBracketType::Round)) - || (code == ']' && rCursor.IsAtTailOfBracket(SmBracketType::Square)) - || (code == '}' && rCursor.IsAtTailOfBracket(SmBracketType::Curly))) - { - rCursor.Move(&rDevice, MoveRight); - } - else{ - if(code != 0){ - rCursor.InsertText(OUString(code)); - }else if (!mrViewShell.KeyInput(rKEvt)) - bConsumed = false; - } + if (!CharInput(rKEvt.GetCharCode(), rCursor, rDevice)) + bConsumed = mrViewShell.KeyInput(rKEvt); } } } @@ -728,6 +762,27 @@ bool SmGraphicWidget::Command(const CommandEvent& rCEvt) default: break; } } + else + { + switch (rCEvt.GetCommand()) + { + case CommandEventId::ExtTextInput: + if (comphelper::LibreOfficeKit::isActive()) + { + const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData(); + assert(pData); + const OUString& rText = pData->GetText(); + SmCursor& rCursor = mrViewShell.GetDoc()->GetCursor(); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + for (sal_Int32 i = 0; i < rText.getLength();) + CharInput(rText.iterateCodePoints(&i), rCursor, rDevice); + bCallBase = false; + } + break; + default: + break; + } + } return !bCallBase; } @@ -822,8 +877,12 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi Hide(); - aInitialFocusTimer.SetInvokeHandler(LINK(this, SmCmdBoxWindow, InitialFocusTimerHdl)); - aInitialFocusTimer.SetTimeout(100); + // Don't try to grab focus in LOK inline edit mode + if (!comphelper::LibreOfficeKit::isActive()) + { + aInitialFocusTimer.SetInvokeHandler(LINK(this, SmCmdBoxWindow, InitialFocusTimerHdl)); + aInitialFocusTimer.SetTimeout(100); + } } Point SmCmdBoxWindow::WidgetToWindowPos(const weld::Widget& rWidget, const Point& rPos) @@ -2089,8 +2148,12 @@ void SmViewShell::Activate( bool bIsMDIActivate ) { SfxViewShell::Activate( bIsMDIActivate ); - SmEditWindow *pEdit = GetEditWindow(); - if ( pEdit ) + if (comphelper::LibreOfficeKit::isActive()) + { + // In LOK, activate in-place editing + GetGraphicWidget().GrabFocus(); + } + else if (SmEditWindow *pEdit = GetEditWindow()) { //! Since there is no way to be informed if a "drag and drop" //! event has taken place, we call SetText here in order to @@ -2149,7 +2212,8 @@ void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) bool SmViewShell::IsInlineEditEnabled() { - return officecfg::Office::Common::Misc::ExperimentalMode::get(); + return comphelper::LibreOfficeKit::isActive() + || officecfg::Office::Common::Misc::ExperimentalMode::get(); } void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 1aa6d8a2e8b2..42aa011ab8b4 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -55,7 +55,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> #include <sfx2/lokhelper.hxx> -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <sfx2/viewsh.hxx> #include <svtools/optionsdrawinglayer.hxx> diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 959f7abd7527..4c732f1e5dee 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -35,7 +35,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/awt/vclxdevice.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> -#include <sfx2/lokcharthelper.hxx> +#include <sfx2/lokcomponenthelpers.hxx> #include <sfx2/ipclient.hxx> #include <editeng/svxacorr.hxx> #include <editeng/acorrcfg.hxx> @@ -3395,17 +3395,17 @@ OUString SwXTextDocument::getPartHash(int nPart) VclPtr<vcl::Window> SwXTextDocument::getDocWindow() { SolarMutexGuard aGuard; - VclPtr<vcl::Window> pWindow; SwView* pView = m_pDocShell->GetView(); - if (pView) - pWindow = &(pView->GetEditWin()); - LokChartHelper aChartHelper(pView); - VclPtr<vcl::Window> pChartWindow = aChartHelper.GetWindow(); - if (pChartWindow) - pWindow = pChartWindow; + if (VclPtr<vcl::Window> pWindow = LokChartHelper(pView).GetWindow()) + return pWindow; + if (VclPtr<vcl::Window> pWindow = LokStarMathHelper(pView).GetWindow()) + return pWindow; + + if (pView) + return &(pView->GetEditWin()); - return pWindow; + return {}; } void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) @@ -3500,12 +3500,14 @@ void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int SwViewOption aOption(*(pWrtViewShell->GetViewOptions())); double fScale = aOption.GetZoom() / o3tl::convert(100.0, o3tl::Length::px, o3tl::Length::twip); - // check if the user hit a chart which is being edited by this view - SfxViewShell* pViewShell = m_pDocShell->GetView(); - LokChartHelper aChartHelper(pViewShell); - if (aChartHelper.postMouseEvent(nType, nX, nY, - nCount, nButtons, nModifier, - fScale, fScale)) + // check if the user hit a chart/math object which is being edited by this view + if (LokChartHelper(m_pDocShell->GetView()).postMouseEvent(nType, nX, nY, + nCount, nButtons, nModifier, + fScale, fScale)) + return; + if (LokStarMathHelper(m_pDocShell->GetView()).postMouseEvent(nType, nX, nY, + nCount, nButtons, nModifier, + fScale, fScale)) return; // check if the user hit a chart which is being edited by someone else diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 176183ac90db..f267368c65c1 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -641,8 +641,12 @@ void SwWrtShell::LaunchOLEObj(sal_Int32 nVerb) // LOK: we don't want to handle any other embedded objects than // charts, there are too many problems with eg. embedded spreadsheets // (like it creates a separate view for the calc sheet) - if (comphelper::LibreOfficeKit::isActive() && !SotExchange::IsChart(xRef->getClassID())) - return; + if (comphelper::LibreOfficeKit::isActive()) + { + const auto classId = xRef->getClassID(); + if (!SotExchange::IsChart(classId) && !SotExchange::IsMath(classId)) + return; + } SfxInPlaceClient* pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() ); if ( !pCli )