summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu29
-rw-r--r--starmath/Library_sm.mk1
-rw-r--r--starmath/UIConfig_smath.mk1
-rw-r--r--starmath/source/SmPanelFactory.cxx7
-rw-r--r--starmath/source/SmPropertiesPanel.cxx88
-rw-r--r--starmath/source/SmPropertiesPanel.hxx51
-rw-r--r--starmath/uiconfig/smath/ui/sidebarproperties_math.ui81
7 files changed, 257 insertions, 1 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index 41e11f78c61a..a7151ed3da07 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -759,6 +759,35 @@
</prop>
</node>
+ <node oor:name="MathPropertiesPanel" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Properties</value>
+ </prop>
+ <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ <prop oor:name="Id" oor:type="xs:string">
+ <value>MathPropertiesPanel</value>
+ </prop>
+ <prop oor:name="DeckId" oor:type="xs:string">
+ <value>PropertyDeck</value>
+ </prop>
+ <prop oor:name="ContextList">
+ <value oor:separator=";">
+ Math, any, visible;
+ </value>
+ </prop>
+ <prop oor:name="ImplementationURL" oor:type="xs:string">
+ <value>private:resource/toolpanel/SmPanelFactory/MathPropertiesPanel</value>
+ </prop>
+ <prop oor:name="OrderIndex" oor:type="xs:int">
+ <value>100</value>
+ </prop>
+ <prop oor:name="WantsAWT" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+
<node oor:name="MathElementsPanel" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Elements</value>
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index ba4c59fdfd75..e4eca13440d7 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -69,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\
starmath/source/ElementsDockingWindow \
starmath/source/SmElementsPanel \
starmath/source/SmPanelFactory \
+ starmath/source/SmPropertiesPanel \
starmath/source/accessibility \
starmath/source/action \
starmath/source/caret \
diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk
index 45b12819731a..a54f2e4553c4 100644
--- a/starmath/UIConfig_smath.mk
+++ b/starmath/UIConfig_smath.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\
starmath/uiconfig/smath/ui/printeroptions \
starmath/uiconfig/smath/ui/savedefaultsdialog \
starmath/uiconfig/smath/ui/sidebarelements_math \
+ starmath/uiconfig/smath/ui/sidebarproperties_math \
starmath/uiconfig/smath/ui/smathsettings \
starmath/uiconfig/smath/ui/spacingdialog \
starmath/uiconfig/smath/ui/symdefinedialog \
diff --git a/starmath/source/SmPanelFactory.cxx b/starmath/source/SmPanelFactory.cxx
index 593b2e4a14d6..8e9f146a1959 100644
--- a/starmath/source/SmPanelFactory.cxx
+++ b/starmath/source/SmPanelFactory.cxx
@@ -30,6 +30,7 @@
#include <vcl/weldutils.hxx>
#include "SmElementsPanel.hxx"
+#include "SmPropertiesPanel.hxx"
namespace
{
@@ -80,7 +81,11 @@ css::uno::Reference<css::ui::XUIElement> SAL_CALL SmPanelFactory::createUIElemen
std::unique_ptr<PanelLayout> pPanel;
css::ui::LayoutSize aLayoutSize{ -1, -1, -1 };
- if (ResourceURL.endsWith("/MathElementsPanel"))
+ if (ResourceURL.endsWith("/MathPropertiesPanel"))
+ {
+ pPanel = sm::sidebar::SmPropertiesPanel::Create(*pParent);
+ }
+ else if (ResourceURL.endsWith("/MathElementsPanel"))
{
pPanel = sm::sidebar::SmElementsPanel::Create(*pParent, *pBindings);
aLayoutSize = { 300, -1, -1 };
diff --git a/starmath/source/SmPropertiesPanel.cxx b/starmath/source/SmPropertiesPanel.cxx
new file mode 100644
index 000000000000..3ffd25c40e79
--- /dev/null
+++ b/starmath/source/SmPropertiesPanel.cxx
@@ -0,0 +1,88 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/theUICommandDescription.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+
+#include "SmPropertiesPanel.hxx"
+
+namespace sm::sidebar
+{
+// static
+std::unique_ptr<PanelLayout> SmPropertiesPanel::Create(weld::Widget& rParent)
+{
+ return std::make_unique<SmPropertiesPanel>(rParent);
+}
+
+SmPropertiesPanel::SmPropertiesPanel(weld::Widget& rParent)
+ : PanelLayout(&rParent, "MathPropertiesPanel", "modules/smath/ui/sidebarproperties_math.ui")
+ , mpFormatFontsButton(m_xBuilder->weld_button("btnFormatFonts"))
+ , mpFormatFontSizeButton(m_xBuilder->weld_button("btnFormatFontSize"))
+ , mpFormatSpacingButton(m_xBuilder->weld_button("btnFormatSpacing"))
+ , mpFormatAlignmentButton(m_xBuilder->weld_button("btnFormatAlignment"))
+ , maButtonCommands{ { mpFormatFontsButton.get(), ".uno:ChangeFont" },
+ { mpFormatFontSizeButton.get(), ".uno:ChangeFontSize" },
+ { mpFormatSpacingButton.get(), ".uno:ChangeDistance" },
+ { mpFormatAlignmentButton.get(), ".uno:ChangeAlignment" } }
+{
+ // Set localized labels to the buttons
+ auto xConfs
+ = css::frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ if (css::uno::Reference<css::container::XNameAccess> xConf{
+ xConfs->getByName("com.sun.star.formula.FormulaProperties"), css::uno::UNO_QUERY })
+ {
+ for (const auto & [ button, command ] : maButtonCommands)
+ {
+ comphelper::SequenceAsHashMap props(xConf->getByName(command));
+ button->set_label(props.getUnpackedValueOrDefault("Name", button->get_label()));
+ }
+ }
+
+ mpFormatFontsButton->connect_clicked(LINK(this, SmPropertiesPanel, ButtonClickHandler));
+ mpFormatFontSizeButton->connect_clicked(LINK(this, SmPropertiesPanel, ButtonClickHandler));
+ mpFormatSpacingButton->connect_clicked(LINK(this, SmPropertiesPanel, ButtonClickHandler));
+ mpFormatAlignmentButton->connect_clicked(LINK(this, SmPropertiesPanel, ButtonClickHandler));
+}
+
+SmPropertiesPanel::~SmPropertiesPanel()
+{
+ maButtonCommands.clear();
+
+ mpFormatFontsButton.reset();
+ mpFormatFontSizeButton.reset();
+ mpFormatSpacingButton.reset();
+ mpFormatAlignmentButton.reset();
+}
+
+IMPL_LINK(SmPropertiesPanel, ButtonClickHandler, weld::Button&, rButton, void)
+{
+ if (OUString command = maButtonCommands[&rButton]; !command.isEmpty())
+ comphelper::dispatchCommand(command, {});
+}
+
+} // end of namespace sm::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/starmath/source/SmPropertiesPanel.hxx b/starmath/source/SmPropertiesPanel.hxx
new file mode 100644
index 000000000000..e81463f37022
--- /dev/null
+++ b/starmath/source/SmPropertiesPanel.hxx
@@ -0,0 +1,51 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sfx2/sidebar/PanelLayout.hxx>
+
+#include <map>
+#include <memory>
+
+namespace sm::sidebar
+{
+class SmPropertiesPanel : public PanelLayout
+{
+public:
+ static std::unique_ptr<PanelLayout> Create(weld::Widget& rParent);
+ SmPropertiesPanel(weld::Widget& rParent);
+ ~SmPropertiesPanel();
+
+private:
+ DECL_LINK(ButtonClickHandler, weld::Button&, void);
+
+ std::unique_ptr<weld::Button> mpFormatFontsButton;
+ std::unique_ptr<weld::Button> mpFormatFontSizeButton;
+ std::unique_ptr<weld::Button> mpFormatSpacingButton;
+ std::unique_ptr<weld::Button> mpFormatAlignmentButton;
+
+ std::map<weld::Button*, OUString> maButtonCommands;
+};
+
+} // end of namespace sm::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/starmath/uiconfig/smath/ui/sidebarproperties_math.ui b/starmath/uiconfig/smath/ui/sidebarproperties_math.ui
new file mode 100644
index 000000000000..b2d8b05eddf0
--- /dev/null
+++ b/starmath/uiconfig/smath/ui/sidebarproperties_math.ui
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.1 -->
+<interface domain="svx">
+ <requires lib="gtk+" version="3.20"/>
+ <!-- n-columns=1 n-rows=1 -->
+ <object class="GtkGrid" id="MathPropertiesPanel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border-width">6</property>
+ <child>
+ <!-- n-columns=1 n-rows=1 -->
+ <object class="GtkBox" id="container">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="btnFormatFonts">
+ <property name="label">Fonts</property> <!-- No need to translate - set in code -->
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">start</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="btnFormatFontSize">
+ <property name="label">Font Size</property> <!-- No need to translate - set in code -->
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">start</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="btnFormatSpacing">
+ <property name="label">Spacing</property> <!-- No need to translate - set in code -->
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">start</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="btnFormatAlignment">
+ <property name="label">Alignment</property> <!-- No need to translate - set in code -->
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">start</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>