starmath/inc/mathml/attribute.hxx           |    4 ++--
 starmath/inc/mathml/element.hxx             |    2 +-
 starmath/inc/token.hxx                      |    5 +++--
 starmath/inc/utility.hxx                    |    2 +-
 starmath/source/cfgitem.cxx                 |    2 +-
 starmath/source/dialog.cxx                  |   16 ++++++++--------
 starmath/source/mathml/starmathdatabase.cxx |   10 +++++-----
 starmath/source/node.cxx                    |    2 +-
 starmath/source/symbol.cxx                  |    2 +-
 starmath/source/unomodel.cxx                |    4 ++--
 10 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit 0705c05480401fd46349879ad456ae208cb1180b
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jul 18 12:04:13 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jul 18 15:33:56 2024 +0200

    make some single-arg constructors in starmath explicit
    
    Change-Id: I4b9a010a2cf42076b02c80732c8e35686482f9e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170684
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/starmath/inc/mathml/attribute.hxx 
b/starmath/inc/mathml/attribute.hxx
index 6d991c50c853..99751bbf3218 100644
--- a/starmath/inc/mathml/attribute.hxx
+++ b/starmath/inc/mathml/attribute.hxx
@@ -63,7 +63,7 @@ public:
 
     ~SmMlAttribute() { clearPreviousAttributeValue(); };
 
-    SmMlAttribute(SmMlAttributeValueType)
+    explicit SmMlAttribute(SmMlAttributeValueType)
         : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty)
         , m_bSet(false)
     {
@@ -77,7 +77,7 @@ public:
         setAttributeValue(&aMlAttribute);
     }
 
-    SmMlAttribute(const SmMlAttribute* aMlAttribute)
+    explicit SmMlAttribute(const SmMlAttribute* aMlAttribute)
         : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty)
         , m_bSet(aMlAttribute->isSet())
     {
diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx
index 90dc65439e62..030f93d422be 100644
--- a/starmath/inc/mathml/element.hxx
+++ b/starmath/inc/mathml/element.hxx
@@ -34,7 +34,7 @@ public:
     /* Mathml stuff */
 
 public:
-    SmMlElement(SmMlElementType aElementType)
+    explicit SmMlElement(SmMlElementType aElementType)
         : m_aElementType(aElementType)
         , m_aText(u"\u00B6"_ustr)
         , m_aESelection(0, 0, 0, 0)
diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index e22b8cdc1d63..00ffbc026d20 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -171,14 +171,15 @@ struct SmColorTokenTableEntry
     {
     }
 
-    SmColorTokenTableEntry(const SmColorTokenTableEntry* 
amColorTokenTableEntry)
+    explicit SmColorTokenTableEntry(const SmColorTokenTableEntry* 
amColorTokenTableEntry)
         : aIdent(amColorTokenTableEntry->aIdent)
         , eType(amColorTokenTableEntry->eType)
         , cColor(amColorTokenTableEntry->cColor)
     {
     }
 
-    SmColorTokenTableEntry(const std::unique_ptr<SmColorTokenTableEntry> 
amColorTokenTableEntry)
+    explicit SmColorTokenTableEntry(
+        const std::unique_ptr<SmColorTokenTableEntry> amColorTokenTableEntry)
         : aIdent(amColorTokenTableEntry->aIdent)
         , eType(amColorTokenTableEntry->eType)
         , cColor(amColorTokenTableEntry->cColor)
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index feaae1fedb40..465c2b8cb778 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -50,7 +50,7 @@ class SM_DLLPUBLIC SmFace final : public vcl::Font
 public:
     SmFace() :
         Font(), nBorderWidth(-1) { Impl_Init(); }
-    SmFace(const Font& rFont) :
+    explicit SmFace(const Font& rFont) :
         Font(rFont), nBorderWidth(-1) { Impl_Init(); }
     SmFace(const OUString& rName, const Size& rSize) :
         Font(rName, rSize), nBorderWidth(-1) { Impl_Init(); }
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index d8805f44dfd0..abe5fe4901c3 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -1042,7 +1042,7 @@ void SmMathConfig::LoadFormat()
         ++pVal;
 
         aFnt.SetFontSize( pFormat->GetBaseSize() );
-        pFormat->SetFont( i, aFnt, bUseDefaultFont );
+        pFormat->SetFont( i, SmFace(aFnt), bUseDefaultFont );
     }
 
     OSL_ENSURE( pVal - pValues == nProps, "property mismatch" );
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index eafee6070a89..d078264b1d49 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -640,14 +640,14 @@ void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const
     pp->GetConfig()->GetFontPickList(FNT_SANS)     = *m_xSansFont;
     pp->GetConfig()->GetFontPickList(FNT_FIXED)    = *m_xFixedFont;
 
-    rFormat.SetFont( FNT_MATH,     m_xMathFont->Get() );
-    rFormat.SetFont( FNT_VARIABLE, m_xVariableFont->Get() );
-    rFormat.SetFont( FNT_FUNCTION, m_xFunctionFont->Get() );
-    rFormat.SetFont( FNT_NUMBER,   m_xNumberFont->Get() );
-    rFormat.SetFont( FNT_TEXT,     m_xTextFont->Get() );
-    rFormat.SetFont( FNT_SERIF,    m_xSerifFont->Get() );
-    rFormat.SetFont( FNT_SANS,     m_xSansFont->Get() );
-    rFormat.SetFont( FNT_FIXED,    m_xFixedFont->Get() );
+    rFormat.SetFont( FNT_MATH,     SmFace(m_xMathFont->Get()) );
+    rFormat.SetFont( FNT_VARIABLE, SmFace(m_xVariableFont->Get()) );
+    rFormat.SetFont( FNT_FUNCTION, SmFace(m_xFunctionFont->Get()) );
+    rFormat.SetFont( FNT_NUMBER,   SmFace(m_xNumberFont->Get()) );
+    rFormat.SetFont( FNT_TEXT,     SmFace(m_xTextFont->Get()) );
+    rFormat.SetFont( FNT_SERIF,    SmFace(m_xSerifFont->Get()) );
+    rFormat.SetFont( FNT_SANS,     SmFace(m_xSansFont->Get()) );
+    rFormat.SetFont( FNT_FIXED,    SmFace(m_xFixedFont->Get()) );
 
     rFormat.RequestApplyChanges();
 }
diff --git a/starmath/source/mathml/starmathdatabase.cxx 
b/starmath/source/mathml/starmathdatabase.cxx
index b79b37a3537a..b8d3823bbf5b 100644
--- a/starmath/source/mathml/starmathdatabase.cxx
+++ b/starmath/source/mathml/starmathdatabase.cxx
@@ -711,10 +711,10 @@ SmColorTokenTableEntry 
starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor
 {
     for (auto i = std::begin(aColorTokenTableParse); i < 
std::end(aColorTokenTableParse); ++i)
         if (i->equals(cColor))
-            return i;
+            return SmColorTokenTableEntry(i);
     for (auto i = std::begin(aColorTokenTableDVIPS); i < 
std::end(aColorTokenTableDVIPS); ++i)
         if (i->equals(cColor))
-            return i;
+            return SmColorTokenTableEntry(i);
     if ((cColor & 0x00FFFFFF) == cColor)
         return SmColorTokenTableEntry(u""_ustr, TRGB, cColor);
     else
@@ -725,7 +725,7 @@ SmColorTokenTableEntry 
starmathdatabase::Identify_Color_MATHML(sal_uInt32 cColor
 {
     for (auto i = std::begin(aColorTokenTableMATHML); i < 
std::end(aColorTokenTableMATHML); ++i)
         if (i->equals(cColor))
-            return i;
+            return SmColorTokenTableEntry(i);
     if ((cColor & 0x00FFFFFF) == cColor)
         return SmColorTokenTableEntry(u""_ustr, TRGB, cColor);
     else
@@ -736,7 +736,7 @@ SmColorTokenTableEntry 
starmathdatabase::Identify_Color_DVIPSNAMES(sal_uInt32 cC
 {
     for (auto i = std::begin(aColorTokenTableDVIPS); i < 
std::end(aColorTokenTableDVIPS); ++i)
         if (i->equals(cColor))
-            return i;
+            return SmColorTokenTableEntry(i);
     if ((cColor & 0x00FFFFFF) == cColor)
         return SmColorTokenTableEntry(u""_ustr, TRGB, cColor);
     else
@@ -771,7 +771,7 @@ SmColorTokenTableEntry 
starmathdatabase::Identify_ColorName_HTML(std::u16string_
     {
         sal_Int32 matches = o3tl::compareToIgnoreAsciiCase(colorname, 
i->aIdent);
         if (matches == 0)
-            return i;
+            return SmColorTokenTableEntry(i);
         if (matches < 0)
             break;
     }
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 49ef500c2059..022596b4e2d2 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2196,7 +2196,7 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, 
const SmDocShell &rDocShell
         sal_UCS4 cChar = pSym->GetCharacter();
         OUString aTmp( &cChar, 1 );
         SetText( aTmp );
-        GetFont() = pSym->GetFace(&rFormat);
+        GetFont() = SmFace(pSym->GetFace(&rFormat));
 
         OUString aSymbolSetName = 
SmLocalizedSymbolData::GetExportSymbolSetName(pSym->GetSymbolSetName());
         if (aSymbolSetName == "Greek")
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index bad6484f1be4..9acf161a208c 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -49,7 +49,7 @@ SmSym::SmSym(const OUString& rName, const vcl::Font& rFont, 
sal_UCS4 cChar,
 {
     m_aUiName   = m_aExportName   = rName;
 
-    m_aFace     = rFont;
+    m_aFace     = SmFace(rFont);
     m_aFace.SetTransparent(true);
     m_aFace.SetAlignment(ALIGN_BASELINE);
 
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index e26b3425861f..04229244b4ed 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -693,14 +693,14 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** 
ppEntries, const Any*
         {
             vcl::Font aNewFont(aFormat.GetFont(nFontDesc));
             aNewFont.SetItalic(rFont.GetItalic());
-            aFormat.SetFont(nFontDesc, aNewFont);
+            aFormat.SetFont(nFontDesc, SmFace(aNewFont));
         }
 
         if (aFormat.GetFont(nFontDesc).GetWeight() != rFont.GetWeight())
         {
             vcl::Font aNewFont(aFormat.GetFont(nFontDesc));
             aNewFont.SetWeight(rFont.GetWeight());
-            aFormat.SetFont(nFontDesc, aNewFont);
+            aFormat.SetFont(nFontDesc, SmFace(aNewFont));
         }
 
         if (aFormat.GetFont(nFontDesc).GetFontSize() != rFont.GetFontSize())

Reply via email to