summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-02 01:18:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-02 18:46:47 +0200
commit116b9d6ddf2b61186b29f0370234eec9c1bbe306 (patch)
tree7f90a12333274086e33c4e0fabfd96a8e54e6b6c /starmath
parentd7ba78e9c7be835a1e2ecdacd25995663e96862f (diff)
Avoid conversions between OUString and OString in VCL
Standardize on OUString, which is the main internal string class. Convert from/to OUString only when communicating with respective external APIs. Removes about 200 conversions from the code. Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/dialog.hxx4
-rw-r--r--starmath/inc/helpids.h56
-rw-r--r--starmath/source/dialog.cxx37
3 files changed, 49 insertions, 48 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index fee12d9a5130..a595917d450d 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -141,7 +141,7 @@ class SmFontTypeDialog final : public weld::GenericDialogController
std::unique_ptr<weld::MenuButton> m_xMenuButton;
std::unique_ptr<weld::Button> m_xDefaultButton;
- DECL_LINK(MenuSelectHdl, const OString&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
public:
@@ -205,7 +205,7 @@ class SmDistanceDialog final : public weld::GenericDialogController
bool bScaleAllBrackets;
DECL_LINK(GetFocusHdl, weld::Widget&, void);
- DECL_LINK(MenuSelectHdl, const OString&, void);
+ DECL_LINK(MenuSelectHdl, const OUString&, void);
DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
DECL_LINK(CheckBoxClickHdl, weld::Toggleable&, void);
diff --git a/starmath/inc/helpids.h b/starmath/inc/helpids.h
index 59489e57ac0d..195ccfb570a9 100644
--- a/starmath/inc/helpids.h
+++ b/starmath/inc/helpids.h
@@ -19,36 +19,36 @@
#pragma once
-#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
-inline constexpr OStringLiteral HID_SMA_WIN_DOCUMENT = "STARMATH_HID_SMA_WIN_DOCUMENT";
-inline constexpr OStringLiteral HID_SMA_COMMAND_WIN_EDIT = "STARMATH_HID_SMA_COMMAND_WIN_EDIT";
+inline constexpr OUStringLiteral HID_SMA_WIN_DOCUMENT = u"STARMATH_HID_SMA_WIN_DOCUMENT";
+inline constexpr OUStringLiteral HID_SMA_COMMAND_WIN_EDIT = u"STARMATH_HID_SMA_COMMAND_WIN_EDIT";
-inline constexpr OStringLiteral HID_SMA_COMMAND_WIN = "STARMATH_HID_SMA_COMMAND_WIN";
+inline constexpr OUStringLiteral HID_SMA_COMMAND_WIN = u"STARMATH_HID_SMA_COMMAND_WIN";
-#define HID_SMA_DEFAULT_DIST "STARMATH_HID_SMA_DEFAULT_DIST"
-#define HID_SMA_LINE_DIST "STARMATH_HID_SMA_LINE_DIST"
-#define HID_SMA_ROOT_DIST "STARMATH_HID_SMA_ROOT_DIST"
-#define HID_SMA_SUP_DIST "STARMATH_HID_SMA_SUP_DIST"
-#define HID_SMA_SUB_DIST "STARMATH_HID_SMA_SUB_DIST"
-#define HID_SMA_NUMERATOR_DIST "STARMATH_HID_SMA_NUMERATOR_DIST"
-#define HID_SMA_DENOMINATOR_DIST "STARMATH_HID_SMA_DENOMINATOR_DIST"
-#define HID_SMA_FRACLINE_EXCWIDTH "STARMATH_HID_SMA_FRACLINE_EXCWIDTH"
-#define HID_SMA_FRACLINE_LINEWIDTH "STARMATH_HID_SMA_FRACLINE_LINEWIDTH"
-#define HID_SMA_UPPERLIMIT_DIST "STARMATH_HID_SMA_UPPERLIMIT_DIST"
-#define HID_SMA_LOWERLIMIT_DIST "STARMATH_HID_SMA_LOWERLIMIT_DIST"
-#define HID_SMA_BRACKET_EXCHEIGHT "STARMATH_HID_SMA_BRACKET_EXCHEIGHT"
-#define HID_SMA_BRACKET_DIST "STARMATH_HID_SMA_BRACKET_DIST"
-#define HID_SMA_MATRIXROW_DIST "STARMATH_HID_SMA_MATRIXROW_DIST"
-#define HID_SMA_MATRIXCOL_DIST "STARMATH_HID_SMA_MATRIXCOL_DIST"
-#define HID_SMA_ATTRIBUT_DIST "STARMATH_HID_SMA_ATTRIBUT_DIST"
-#define HID_SMA_INTERATTRIBUT_DIST "STARMATH_HID_SMA_INTERATTRIBUT_DIST"
-#define HID_SMA_OPERATOR_EXCHEIGHT "STARMATH_HID_SMA_OPERATOR_EXCHEIGHT"
-#define HID_SMA_OPERATOR_DIST "STARMATH_HID_SMA_OPERATOR_DIST"
-#define HID_SMA_LEFTBORDER_DIST "STARMATH_HID_SMA_LEFTBORDER_DIST"
-#define HID_SMA_RIGHTBORDER_DIST "STARMATH_HID_SMA_RIGHTBORDER_DIST"
-#define HID_SMA_UPPERBORDER_DIST "STARMATH_HID_SMA_UPPERBORDER_DIST"
-#define HID_SMA_LOWERBORDER_DIST "STARMATH_HID_SMA_LOWERBORDER_DIST"
-#define HID_SMA_BRACKET_EXCHEIGHT2 "STARMATH_HID_SMA_BRACKET_EXCHEIGHT2"
+inline constexpr OUStringLiteral HID_SMA_DEFAULT_DIST = u"STARMATH_HID_SMA_DEFAULT_DIST";
+inline constexpr OUStringLiteral HID_SMA_LINE_DIST = u"STARMATH_HID_SMA_LINE_DIST";
+inline constexpr OUStringLiteral HID_SMA_ROOT_DIST = u"STARMATH_HID_SMA_ROOT_DIST";
+inline constexpr OUStringLiteral HID_SMA_SUP_DIST = u"STARMATH_HID_SMA_SUP_DIST";
+inline constexpr OUStringLiteral HID_SMA_SUB_DIST = u"STARMATH_HID_SMA_SUB_DIST";
+inline constexpr OUStringLiteral HID_SMA_NUMERATOR_DIST = u"STARMATH_HID_SMA_NUMERATOR_DIST";
+inline constexpr OUStringLiteral HID_SMA_DENOMINATOR_DIST = u"STARMATH_HID_SMA_DENOMINATOR_DIST";
+inline constexpr OUStringLiteral HID_SMA_FRACLINE_EXCWIDTH = u"STARMATH_HID_SMA_FRACLINE_EXCWIDTH";
+inline constexpr OUStringLiteral HID_SMA_FRACLINE_LINEWIDTH = u"STARMATH_HID_SMA_FRACLINE_LINEWIDTH";
+inline constexpr OUStringLiteral HID_SMA_UPPERLIMIT_DIST = u"STARMATH_HID_SMA_UPPERLIMIT_DIST";
+inline constexpr OUStringLiteral HID_SMA_LOWERLIMIT_DIST = u"STARMATH_HID_SMA_LOWERLIMIT_DIST";
+inline constexpr OUStringLiteral HID_SMA_BRACKET_EXCHEIGHT = u"STARMATH_HID_SMA_BRACKET_EXCHEIGHT";
+inline constexpr OUStringLiteral HID_SMA_BRACKET_DIST = u"STARMATH_HID_SMA_BRACKET_DIST";
+inline constexpr OUStringLiteral HID_SMA_MATRIXROW_DIST = u"STARMATH_HID_SMA_MATRIXROW_DIST";
+inline constexpr OUStringLiteral HID_SMA_MATRIXCOL_DIST = u"STARMATH_HID_SMA_MATRIXCOL_DIST";
+inline constexpr OUStringLiteral HID_SMA_ATTRIBUT_DIST = u"STARMATH_HID_SMA_ATTRIBUT_DIST";
+inline constexpr OUStringLiteral HID_SMA_INTERATTRIBUT_DIST = u"STARMATH_HID_SMA_INTERATTRIBUT_DIST";
+inline constexpr OUStringLiteral HID_SMA_OPERATOR_EXCHEIGHT = u"STARMATH_HID_SMA_OPERATOR_EXCHEIGHT";
+inline constexpr OUStringLiteral HID_SMA_OPERATOR_DIST = u"STARMATH_HID_SMA_OPERATOR_DIST";
+inline constexpr OUStringLiteral HID_SMA_LEFTBORDER_DIST = u"STARMATH_HID_SMA_LEFTBORDER_DIST";
+inline constexpr OUStringLiteral HID_SMA_RIGHTBORDER_DIST = u"STARMATH_HID_SMA_RIGHTBORDER_DIST";
+inline constexpr OUStringLiteral HID_SMA_UPPERBORDER_DIST = u"STARMATH_HID_SMA_UPPERBORDER_DIST";
+inline constexpr OUStringLiteral HID_SMA_LOWERBORDER_DIST = u"STARMATH_HID_SMA_LOWERBORDER_DIST";
+inline constexpr OUStringLiteral HID_SMA_BRACKET_EXCHEIGHT2 = u"STARMATH_HID_SMA_BRACKET_EXCHEIGHT2";
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 19d5b4352b1b..76dd40a13268 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -423,7 +423,7 @@ void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
rFormat.RequestApplyChanges();
}
-IMPL_LINK(SmFontTypeDialog, MenuSelectHdl, const OString&, rIdent, void)
+IMPL_LINK(SmFontTypeDialog, MenuSelectHdl, const OUString&, rIdent, void)
{
SmFontPickListBox *pActiveListBox;
@@ -582,19 +582,19 @@ const FieldMinMax pMinMaxData[10][4] =
SmCategoryDesc::SmCategoryDesc(weld::Builder& rBuilder, sal_uInt16 nCategoryIdx)
{
++nCategoryIdx;
- std::unique_ptr<weld::Label> xTitle(rBuilder.weld_label(OString::number(nCategoryIdx)+"title"));
+ std::unique_ptr<weld::Label> xTitle(rBuilder.weld_label(OUString::number(nCategoryIdx)+"title"));
if (xTitle)
{
Name = xTitle->get_label();
}
for (int i = 0; i < 4; ++i)
{
- std::unique_ptr<weld::Label> xLabel(rBuilder.weld_label(OString::number(nCategoryIdx)+"label"+OString::number(i+1)));
+ std::unique_ptr<weld::Label> xLabel(rBuilder.weld_label(OUString::number(nCategoryIdx)+"label"+OUString::number(i+1)));
if (xLabel)
{
Strings[i] = xLabel->get_label();
- Graphics[i] = rBuilder.weld_widget(OString::number(nCategoryIdx)+"image"+OString::number(i+1));
+ Graphics[i] = rBuilder.weld_widget(OUString::number(nCategoryIdx)+"image"+OUString::number(i+1));
}
else
{
@@ -637,7 +637,7 @@ IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, rControl, void )
m_pCurrentImage->show();
}
-IMPL_LINK(SmDistanceDialog, MenuSelectHdl, const OString&, rId, void)
+IMPL_LINK(SmDistanceDialog, MenuSelectHdl, const OUString&, rId, void)
{
assert(rId.startsWith("menuitem"));
SetCategory(rId.replaceFirst("menuitem", "").toInt32() - 1);
@@ -672,17 +672,18 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
// array to convert category- and metricfield-number in help ids.
// 0 is used in case of unused combinations.
assert(NOCATEGORIES == 10 && "Sm : array doesn't fit into the number of categories");
- static const char * aCatMf2Hid[10][4] =
+ static constexpr OUStringLiteral EMPTY(u"");
+ static constexpr rtl::OUStringConstExpr aCatMf2Hid[10][4] =
{
- { HID_SMA_DEFAULT_DIST, HID_SMA_LINE_DIST, HID_SMA_ROOT_DIST, nullptr },
- { HID_SMA_SUP_DIST, HID_SMA_SUB_DIST , nullptr, nullptr },
- { HID_SMA_NUMERATOR_DIST, HID_SMA_DENOMINATOR_DIST, nullptr, nullptr },
- { HID_SMA_FRACLINE_EXCWIDTH, HID_SMA_FRACLINE_LINEWIDTH, nullptr, nullptr },
- { HID_SMA_UPPERLIMIT_DIST, HID_SMA_LOWERLIMIT_DIST, nullptr, nullptr },
- { HID_SMA_BRACKET_EXCHEIGHT, HID_SMA_BRACKET_DIST, nullptr, HID_SMA_BRACKET_EXCHEIGHT2 },
- { HID_SMA_MATRIXROW_DIST, HID_SMA_MATRIXCOL_DIST, nullptr, nullptr },
- { HID_SMA_ATTRIBUT_DIST, HID_SMA_INTERATTRIBUT_DIST, nullptr, nullptr },
- { HID_SMA_OPERATOR_EXCHEIGHT, HID_SMA_OPERATOR_DIST, nullptr, nullptr },
+ { HID_SMA_DEFAULT_DIST, HID_SMA_LINE_DIST, HID_SMA_ROOT_DIST, EMPTY },
+ { HID_SMA_SUP_DIST, HID_SMA_SUB_DIST , EMPTY, EMPTY },
+ { HID_SMA_NUMERATOR_DIST, HID_SMA_DENOMINATOR_DIST, EMPTY, EMPTY },
+ { HID_SMA_FRACLINE_EXCWIDTH, HID_SMA_FRACLINE_LINEWIDTH, EMPTY, EMPTY },
+ { HID_SMA_UPPERLIMIT_DIST, HID_SMA_LOWERLIMIT_DIST, EMPTY, EMPTY },
+ { HID_SMA_BRACKET_EXCHEIGHT, HID_SMA_BRACKET_DIST, EMPTY, HID_SMA_BRACKET_EXCHEIGHT2 },
+ { HID_SMA_MATRIXROW_DIST, HID_SMA_MATRIXCOL_DIST, EMPTY, EMPTY },
+ { HID_SMA_ATTRIBUT_DIST, HID_SMA_INTERATTRIBUT_DIST, EMPTY, EMPTY },
+ { HID_SMA_OPERATOR_EXCHEIGHT, HID_SMA_OPERATOR_DIST, EMPTY, EMPTY },
{ HID_SMA_LEFTBORDER_DIST, HID_SMA_RIGHTBORDER_DIST, HID_SMA_UPPERBORDER_DIST, HID_SMA_LOWERBORDER_DIST }
};
@@ -710,7 +711,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
if (nActiveCategory == 5)
bScaleAllBrackets = m_xCheckBox1->get_active();
- m_xMenuButton->set_item_active("menuitem" + OString::number(nActiveCategory + 1), false);
+ m_xMenuButton->set_item_active("menuitem" + OUString::number(nActiveCategory + 1), false);
}
// activation/deactivation of the associated controls depending on the chosen category
@@ -722,7 +723,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
// To determine which Controls should be active, the existence
// of an associated HelpID is checked
- bActive = aCatMf2Hid[nCategory][i] != nullptr;
+ bActive = !aCatMf2Hid[nCategory][i].asView().empty();
pFT->set_visible(bActive);
pFT->set_sensitive(bActive);
@@ -769,7 +770,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
m_xMetricField4->set_sensitive( bChecked );
}
- m_xMenuButton->set_item_active("menuitem" + OString::number(nCategory + 1), true);
+ m_xMenuButton->set_item_active("menuitem" + OUString::number(nCategory + 1), true);
m_xFrame->set_label(m_xCategories[nCategory]->GetName());
nActiveCategory = nCategory;