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 @@
+
+
+
+
+
+
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 @@
-
+