From ddec502caa272b9e19872329ed5c5cd2fe3f40eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 16 Aug 2024 21:09:04 +0100 Subject: [PATCH] tdf#160459 embedded starmath doesn't fit inside allocated area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit much to and fro with MapModes and rounding issue obscured that fundmentally that the 'etched-out' GtkScrolledWindow frame requires space which eats into what is available to show the formula, and in embedded mode we want the editing area to be equal in size to the area used for the preview. Change-Id: I1d126ddcc953131cf4add7da58ccd89e7fa86b66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171964 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- starmath/UIConfig_smath.mk | 1 + starmath/source/view.cxx | 15 ++++++++- starmath/uiconfig/smath/ui/embedwindow.ui | 38 +++++++++++++++++++++++ starmath/uiconfig/smath/ui/mathwindow.ui | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 starmath/uiconfig/smath/ui/embedwindow.ui diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk index d79d791a92df..824f54822db5 100644 --- a/starmath/UIConfig_smath.mk +++ b/starmath/UIConfig_smath.mk @@ -32,6 +32,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\ starmath/uiconfig/smath/ui/alignmentdialog \ starmath/uiconfig/smath/ui/catalogdialog \ starmath/uiconfig/smath/ui/editwindow \ + starmath/uiconfig/smath/ui/embedwindow \ starmath/uiconfig/smath/ui/fontdialog \ starmath/uiconfig/smath/ui/fontsizedialog \ starmath/uiconfig/smath/ui/fonttypedialog \ diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 6e7edfef4482..13bc165e3a54 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -105,8 +105,21 @@ using namespace css; using namespace css::accessibility; using namespace css::uno; +static OUString GetScrollUIName(const SmViewShell& rShell) +{ + const SmDocShell* pShell = rShell.GetDoc(); + if (pShell && pShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED) + { + // This one has no border on the scrolledwindow, to maximize the space + // available when in embedded mode and minimize the difference from + // the ole preview to give a more seamless embedded editing experience. + return "modules/smath/ui/embedwindow.ui"; + } + return "modules/smath/ui/mathwindow.ui"; +} + SmGraphicWindow::SmGraphicWindow(SmViewShell& rShell) - : InterimItemWindow(&rShell.GetViewFrame().GetWindow(), u"modules/smath/ui/mathwindow.ui"_ustr, u"MathWindow"_ustr) + : InterimItemWindow(&rShell.GetViewFrame().GetWindow(), GetScrollUIName(rShell), u"MathWindow"_ustr) , nLinePixH(GetSettings().GetStyleSettings().GetScrollBarSize()) , nColumnPixW(nLinePixH) , nZoom(100) diff --git a/starmath/uiconfig/smath/ui/embedwindow.ui b/starmath/uiconfig/smath/ui/embedwindow.ui new file mode 100644 index 000000000000..d63bceca8f0e --- /dev/null +++ b/starmath/uiconfig/smath/ui/embedwindow.ui @@ -0,0 +1,38 @@ + + + + + + True + False + True + True + 6 + + + True + True + True + 0 + + + True + False + + + True + True + GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK + + + + + + + False + True + 0 + + + + diff --git a/starmath/uiconfig/smath/ui/mathwindow.ui b/starmath/uiconfig/smath/ui/mathwindow.ui index 527e436fd6e1..3588e3a1c2c5 100644 --- a/starmath/uiconfig/smath/ui/mathwindow.ui +++ b/starmath/uiconfig/smath/ui/mathwindow.ui @@ -1,5 +1,5 @@ - +