Turn a macro to a function

Change-Id: I39cfbe43e7f27ada9999daf93aa6ccfd38fb0c52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176561
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2024-11-14 11:46:10 +05:00
parent df8941ee5b
commit eecdaa02b6
18 changed files with 98 additions and 120 deletions

View File

@ -93,8 +93,8 @@ public:
virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override;
virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override; virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override;
static auto get() { return static_cast<SmModule*>(SfxApplication::GetModule(SfxToolsModule::Math)); }
}; };
#define SM_MOD() ( static_cast<SmModule*>(SfxApplication::GetModule(SfxToolsModule::Math)) )
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -503,7 +503,7 @@ struct ElementData
SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView) SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView)
: mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) : mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT))
, mnCurrentSetIndex(-1) , mnCurrentSetIndex(-1)
, m_nSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) , m_nSmSyntaxVersion(SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion())
, mpIconView(std::move(pIconView)) , mpIconView(std::move(pIconView))
{ {
maParser.reset(starmathdatabase::GetVersionSmParser(m_nSmSyntaxVersion)); maParser.reset(starmathdatabase::GetVersionSmParser(m_nSmSyntaxVersion));

View File

@ -471,10 +471,10 @@ IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, weld::Button&, void )
SaveDefaultsQuery aQuery(m_xDialog.get()); SaveDefaultsQuery aQuery(m_xDialog.get());
if (aQuery.run() == RET_YES) if (aQuery.run() == RET_YES)
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); SmFormat aFmt(config->GetStandardFormat());
WriteTo( aFmt ); WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt ); config->SetStandardFormat(aFmt);
} }
} }
@ -574,10 +574,10 @@ IMPL_LINK_NOARG(SmFontTypeDialog, DefaultButtonClickHdl, weld::Button&, void)
SaveDefaultsQuery aQuery(m_xDialog.get()); SaveDefaultsQuery aQuery(m_xDialog.get());
if (aQuery.run() == RET_YES) if (aQuery.run() == RET_YES)
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); SmFormat aFmt(config->GetStandardFormat());
WriteTo( aFmt ); WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt, true ); config->SetStandardFormat(aFmt, true);
} }
} }
@ -605,16 +605,16 @@ SmFontTypeDialog::~SmFontTypeDialog()
void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat) void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
*m_xMathFont = pp->GetConfig()->GetFontPickList(FNT_MATH); *m_xMathFont = config->GetFontPickList(FNT_MATH);
*m_xVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE); *m_xVariableFont = config->GetFontPickList(FNT_VARIABLE);
*m_xFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION); *m_xFunctionFont = config->GetFontPickList(FNT_FUNCTION);
*m_xNumberFont = pp->GetConfig()->GetFontPickList(FNT_NUMBER); *m_xNumberFont = config->GetFontPickList(FNT_NUMBER);
*m_xTextFont = pp->GetConfig()->GetFontPickList(FNT_TEXT); *m_xTextFont = config->GetFontPickList(FNT_TEXT);
*m_xSerifFont = pp->GetConfig()->GetFontPickList(FNT_SERIF); *m_xSerifFont = config->GetFontPickList(FNT_SERIF);
*m_xSansFont = pp->GetConfig()->GetFontPickList(FNT_SANS); *m_xSansFont = config->GetFontPickList(FNT_SANS);
*m_xFixedFont = pp->GetConfig()->GetFontPickList(FNT_FIXED); *m_xFixedFont = config->GetFontPickList(FNT_FIXED);
m_xMathFont->Insert( rFormat.GetFont(FNT_MATH) ); m_xMathFont->Insert( rFormat.GetFont(FNT_MATH) );
m_xVariableFont->Insert( rFormat.GetFont(FNT_VARIABLE) ); m_xVariableFont->Insert( rFormat.GetFont(FNT_VARIABLE) );
@ -629,16 +629,16 @@ void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
pp->GetConfig()->GetFontPickList(FNT_MATH) = *m_xMathFont; config->GetFontPickList(FNT_MATH) = *m_xMathFont;
pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = *m_xVariableFont; config->GetFontPickList(FNT_VARIABLE) = *m_xVariableFont;
pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = *m_xFunctionFont; config->GetFontPickList(FNT_FUNCTION) = *m_xFunctionFont;
pp->GetConfig()->GetFontPickList(FNT_NUMBER) = *m_xNumberFont; config->GetFontPickList(FNT_NUMBER) = *m_xNumberFont;
pp->GetConfig()->GetFontPickList(FNT_TEXT) = *m_xTextFont; config->GetFontPickList(FNT_TEXT) = *m_xTextFont;
pp->GetConfig()->GetFontPickList(FNT_SERIF) = *m_xSerifFont; config->GetFontPickList(FNT_SERIF) = *m_xSerifFont;
pp->GetConfig()->GetFontPickList(FNT_SANS) = *m_xSansFont; config->GetFontPickList(FNT_SANS) = *m_xSansFont;
pp->GetConfig()->GetFontPickList(FNT_FIXED) = *m_xFixedFont; config->GetFontPickList(FNT_FIXED) = *m_xFixedFont;
rFormat.SetFont( FNT_MATH, SmFace(m_xMathFont->Get()) ); rFormat.SetFont( FNT_MATH, SmFace(m_xMathFont->Get()) );
rFormat.SetFont( FNT_VARIABLE, SmFace(m_xVariableFont->Get()) ); rFormat.SetFont( FNT_VARIABLE, SmFace(m_xVariableFont->Get()) );
@ -758,10 +758,10 @@ IMPL_LINK_NOARG( SmDistanceDialog, DefaultButtonClickHdl, weld::Button&, void )
SaveDefaultsQuery aQuery(m_xDialog.get()); SaveDefaultsQuery aQuery(m_xDialog.get());
if (aQuery.run() == RET_YES) if (aQuery.run() == RET_YES)
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); SmFormat aFmt(config->GetStandardFormat());
WriteTo( aFmt ); WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt ); config->SetStandardFormat( aFmt );
} }
} }
@ -1003,10 +1003,10 @@ IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, weld::Button&, void )
SaveDefaultsQuery aQuery(m_xDialog.get()); SaveDefaultsQuery aQuery(m_xDialog.get());
if (aQuery.run() == RET_YES) if (aQuery.run() == RET_YES)
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); SmFormat aFmt(config->GetStandardFormat());
WriteTo( aFmt ); WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt ); config->SetStandardFormat(aFmt);
} }
} }

View File

@ -122,8 +122,7 @@ void SmDocShell::Notify(SfxBroadcaster&, const SfxHint& rHint)
void SmDocShell::LoadSymbols() void SmDocShell::LoadSymbols()
{ {
SmModule *pp = SM_MOD(); SmModule::get()->GetSymbolManager().Load();
pp->GetSymbolManager().Load();
} }
@ -253,7 +252,7 @@ void SmDocShell::ArrangeFormula()
pOutDev = &pView->GetGraphicWidget().GetDrawingArea()->get_ref_device(); pOutDev = &pView->GetGraphicWidget().GetDrawingArea()->get_ref_device();
else else
{ {
pOutDev = &SM_MOD()->GetDefaultVirtualDev(); pOutDev = &SmModule::get()->GetDefaultVirtualDev();
pOutDev->SetMapMode( MapMode(SmMapUnit()) ); pOutDev->SetMapMode( MapMode(SmMapUnit()) );
} }
} }
@ -515,8 +514,7 @@ Printer* SmDocShell::GetPrt()
SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS, SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS,
SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM, SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM,
SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>>(GetPool()); SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>>(GetPool());
SmModule *pp = SM_MOD(); SmModule::get()->GetConfig()->ConfigToItemSet(*pOptions);
pp->GetConfig()->ConfigToItemSet(*pOptions);
mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pOptions)); mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pOptions));
mpPrinter->SetMapMode(MapMode(SmMapUnit())); mpPrinter->SetMapMode(MapMode(SmMapUnit()));
} }
@ -579,17 +577,17 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
, mpTmpPrinter(nullptr) , mpTmpPrinter(nullptr)
, mnModifyCount(0) , mnModifyCount(0)
, mbFormulaArranged(false) , mbFormulaArranged(false)
, mnSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion())
{ {
SvtLinguConfig().GetOptions(maLinguOptions); SvtLinguConfig().GetOptions(maLinguOptions);
SetPool(&SfxGetpApp()->GetPool()); SetPool(&SfxGetpApp()->GetPool());
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
maFormat = pp->GetConfig()->GetStandardFormat(); mnSmSyntaxVersion = config->GetDefaultSmSyntaxVersion();
maFormat = config->GetStandardFormat();
StartListening(maFormat); StartListening(maFormat);
StartListening(*pp->GetConfig()); StartListening(*config);
SetBaseModel(new SmModel(this)); SetBaseModel(new SmModel(this));
SetSmSyntaxVersion(mnSmSyntaxVersion); SetSmSyntaxVersion(mnSmSyntaxVersion);
@ -599,10 +597,8 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
SmDocShell::~SmDocShell() SmDocShell::~SmDocShell()
{ {
SmModule *pp = SM_MOD();
EndListening(maFormat); EndListening(maFormat);
EndListening(*pp->GetConfig()); EndListening(*SmModule::get()->GetConfig());
mpCursor.reset(); mpCursor.reset();
mpEditEngine.reset(); mpEditEngine.reset();
@ -870,9 +866,8 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_AUTO_REDRAW : case SID_AUTO_REDRAW :
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
bool bRedraw = pp->GetConfig()->IsAutoRedraw(); config->SetAutoRedraw(!config->IsAutoRedraw());
pp->GetConfig()->SetAutoRedraw(!bRedraw);
} }
break; break;
@ -889,7 +884,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
// get device used to retrieve the FontList // get device used to retrieve the FontList
OutputDevice *pDev = GetPrinter(); OutputDevice *pDev = GetPrinter();
if (!pDev || pDev->GetFontFaceCollectionCount() == 0) if (!pDev || pDev->GetFontFaceCollectionCount() == 0)
pDev = &SM_MOD()->GetDefaultVirtualDev(); pDev = &SmModule::get()->GetDefaultVirtualDev();
OSL_ENSURE (pDev, "device for font list missing" ); OSL_ENSURE (pDev, "device for font list missing" );
SmFontTypeDialog aFontTypeDialog(rReq.GetFrameWeld(), pDev); SmFontTypeDialog aFontTypeDialog(rReq.GetFrameWeld(), pDev);
@ -970,10 +965,10 @@ void SmDocShell::Execute(SfxRequest& rReq)
aAlignDialog.WriteTo(aNewFormat); aAlignDialog.WriteTo(aNewFormat);
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); SmFormat aFmt(config->GetStandardFormat());
aAlignDialog.WriteTo( aFmt ); aAlignDialog.WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt ); config->SetStandardFormat(aFmt);
SfxUndoManager *pTmpUndoMgr = GetUndoManager(); SfxUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr) if (pTmpUndoMgr)
@ -1067,12 +1062,7 @@ void SmDocShell::GetState(SfxItemSet &rSet)
break; break;
case SID_AUTO_REDRAW : case SID_AUTO_REDRAW :
{ rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, SmModule::get()->GetConfig()->IsAutoRedraw()));
SmModule *pp = SM_MOD();
bool bRedraw = pp->GetConfig()->IsAutoRedraw();
rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, bRedraw));
}
break; break;
case SID_MODIFYSTATUS: case SID_MODIFYSTATUS:
@ -1159,8 +1149,7 @@ SfxUndoManager *SmDocShell::GetUndoManager()
void SmDocShell::SaveSymbols() void SmDocShell::SaveSymbols()
{ {
SmModule *pp = SM_MOD(); SmModule::get()->GetSymbolManager().Save();
pp->GetSymbolManager().Save();
} }

View File

@ -314,7 +314,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
OUString selected = pEditView->getEditEngine().GetText(aSelection); OUString selected = pEditView->getEditEngine().GetText(aSelection);
// Check is auto close brackets/braces is disabled // Check is auto close brackets/braces is disabled
SmModule *pMod = SM_MOD(); SmModule* pMod = SmModule::get();
if (pMod && !pMod->GetConfig()->IsAutoCloseBrackets()) if (pMod && !pMod->GetConfig()->IsAutoCloseBrackets())
autoClose = false; autoClose = false;
else if (o3tl::trim(selected) == u"<?>") else if (o3tl::trim(selected) == u"<?>")
@ -715,12 +715,13 @@ bool SmEditWindow::IsSelected() const
void SmEditTextWindow::UpdateStatus(bool bSetDocModified) void SmEditTextWindow::UpdateStatus(bool bSetDocModified)
{ {
SmModule *pMod = SM_MOD(); if (SmModule* pMod = SmModule::get())
if (pMod && pMod->GetConfig()->IsAutoRedraw()) if (pMod->GetConfig()->IsAutoRedraw())
Flush(); Flush();
if (SmDocShell *pModifyDoc = bSetDocModified ? mrEditWindow.GetDoc() : nullptr) if (bSetDocModified)
pModifyDoc->SetModified(); if (SmDocShell* pModifyDoc = mrEditWindow.GetDoc())
pModifyDoc->SetModified();
static_cast<SmEditEngine*>(GetEditEngine())->executeZoom(GetEditView()); static_cast<SmEditEngine*>(GetEditEngine())->executeZoom(GetEditView());
} }

View File

@ -1391,7 +1391,7 @@ SmMLImport::SmMLImport(const css::uno::Reference<css::uno::XComponentContext>& r
: SvXMLImport(rContext, implementationName, nImportFlags) : SvXMLImport(rContext, implementationName, nImportFlags)
, m_pElementTree(nullptr) , m_pElementTree(nullptr)
, m_bSuccess(false) , m_bSuccess(false)
, m_nSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) , m_nSmSyntaxVersion(SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion())
{ {
} }

View File

@ -447,8 +447,7 @@ void SmXMLExport::ExportContent_()
if (aText.isEmpty()) if (aText.isEmpty())
return; return;
SmModule* pMod = SM_MOD(); sal_Int16 nSmSyntaxVersion = SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion();
sal_Int16 nSmSyntaxVersion = pMod->GetConfig()->GetDefaultSmSyntaxVersion();
// Convert symbol names // Convert symbol names
if (pDocShell) if (pDocShell)
@ -525,7 +524,7 @@ void SmXMLExport::GetConfigurationSettings(Sequence<PropertyValue>& rProps)
return; return;
rProps.realloc(nCount); rProps.realloc(nCount);
SmMathConfig* pConfig = SM_MOD()->GetConfig(); SmMathConfig* pConfig = SmModule::get()->GetConfig();
const bool bUsedSymbolsOnly = pConfig && pConfig->IsSaveOnlyUsedSymbols(); const bool bUsedSymbolsOnly = pConfig && pConfig->IsSaveOnlyUsedSymbols();
std::transform(aProps.begin(), aProps.end(), rProps.getArray(), std::transform(aProps.begin(), aProps.end(), rProps.getArray(),

View File

@ -391,7 +391,7 @@ SmXMLImport::SmXMLImport(const css::uno::Reference<css::uno::XComponentContext>&
: SvXMLImport(rContext, implementationName, nImportFlags) : SvXMLImport(rContext, implementationName, nImportFlags)
, bSuccess(false) , bSuccess(false)
, nParseDepth(0) , nParseDepth(0)
, mnSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) , mnSmSyntaxVersion(SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion())
{ {
} }

View File

@ -2182,16 +2182,16 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
{ {
SmNode::Prepare(rFormat, rDocShell, nDepth); SmNode::Prepare(rFormat, rDocShell, nDepth);
const SmSym *pSym; const SmSym* pSym
SmModule *pp = SM_MOD(); = GetToken().aText.isEmpty()
? nullptr
: SmModule::get()->GetSymbolManager().GetSymbolByName(GetToken().aText.subView(1));
bool bIsGreekSymbol = false; bool bIsGreekSymbol = false;
bool bIsSpecialSymbol = false; bool bIsSpecialSymbol = false;
bool bIsArabic = false; bool bIsArabic = false;
if ((!GetToken().aText.isEmpty()) if (pSym)
&& (nullptr
!= (pSym = pp->GetSymbolManager().GetSymbolByName(GetToken().aText.subView(1)))))
{ {
sal_UCS4 cChar = pSym->GetCharacter(); sal_UCS4 cChar = pSym->GetCharacter();
OUString aTmp( &cChar, 1 ); OUString aTmp( &cChar, 1 );

View File

@ -24,7 +24,7 @@
AbstractSmParser* starmathdatabase::GetDefaultSmParser() AbstractSmParser* starmathdatabase::GetDefaultSmParser()
{ {
switch(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) switch (SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion())
{ {
case 5: case 5:
{ {

View File

@ -357,7 +357,7 @@ static bool IsDelimiter(const OUString& rTxt, sal_Int32 nPos)
} }
//special chars support //special chars support
sal_Int16 nTypJp = SM_MOD()->GetSysLocale().GetCharClass().getType(rTxt, nPos); sal_Int16 nTypJp = SmModule::get()->GetSysLocale().GetCharClass().getType(rTxt, nPos);
return (nTypJp == css::i18n::UnicodeType::SPACE_SEPARATOR return (nTypJp == css::i18n::UnicodeType::SPACE_SEPARATOR
|| nTypJp == css::i18n::UnicodeType::CONTROL); || nTypJp == css::i18n::UnicodeType::CONTROL);
} }
@ -1595,7 +1595,7 @@ std::unique_ptr<SmBlankNode> SmParser5::DoBlank()
// Ignore trailing spaces, if corresponding option is set // Ignore trailing spaces, if corresponding option is set
if (m_aCurToken.eType == TNEWLINE if (m_aCurToken.eType == TNEWLINE
|| (m_aCurToken.eType == TEND && !comphelper::IsFuzzing() || (m_aCurToken.eType == TEND && !comphelper::IsFuzzing()
&& SM_MOD()->GetConfig()->IsIgnoreSpacesRight())) && SmModule::get()->GetConfig()->IsIgnoreSpacesRight()))
{ {
pBlankNode->Clear(); pBlankNode->Clear();
} }
@ -2665,7 +2665,7 @@ std::unique_ptr<SmSpecialNode> SmParser5::DoSpecial()
if (IsImportSymbolNames()) if (IsImportSymbolNames())
{ {
const SmSym* pSym const SmSym* pSym
= SM_MOD()->GetSymbolManager().GetSymbolByExportName(rName.subView(1)); = SmModule::get()->GetSymbolManager().GetSymbolByExportName(rName.subView(1));
if (pSym) if (pSym)
{ {
aNewName = pSym->GetUiName(); aNewName = pSym->GetUiName();
@ -2674,7 +2674,8 @@ std::unique_ptr<SmSpecialNode> SmParser5::DoSpecial()
} }
else if (IsExportSymbolNames()) else if (IsExportSymbolNames())
{ {
const SmSym* pSym = SM_MOD()->GetSymbolManager().GetSymbolByUiName(rName.subView(1)); const SmSym* pSym
= SmModule::get()->GetSymbolManager().GetSymbolByUiName(rName.subView(1));
if (pSym) if (pSym)
{ {
aNewName = pSym->GetExportName(); aNewName = pSym->GetExportName();
@ -2745,7 +2746,7 @@ SmParser5::SmParser5()
, m_bExportSymNames(false) , m_bExportSymNames(false)
, m_nParseDepth(0) , m_nParseDepth(0)
, m_aNumCC(LanguageTag(LANGUAGE_ENGLISH_US)) , m_aNumCC(LanguageTag(LANGUAGE_ENGLISH_US))
, m_pSysCC(&SM_MOD()->GetSysLocale().GetCharClass()) , m_pSysCC(&SmModule::get()->GetSysLocale().GetCharClass())
{ {
} }

View File

@ -51,7 +51,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev,
{ {
// since we format for the printer (where GetTextBoundRect will fail) // since we format for the printer (where GetTextBoundRect will fail)
// we need a virtual device here. // we need a virtual device here.
pGlyphDev = &SM_MOD()->GetDefaultVirtualDev(); pGlyphDev = &SmModule::get()->GetDefaultVirtualDev();
} }
const FontMetric aDevFM (rDev.GetFontMetric()); const FontMetric aDevFM (rDev.GetFontMetric());

View File

@ -59,7 +59,7 @@ SmEditEngine::SmEditEngine(SfxItemPool* pItemPool)
bool SmEditEngine::checkZoom() bool SmEditEngine::checkZoom()
{ {
return m_nOldZoom != (m_nNewZoom = SM_MOD()->GetConfig()->GetSmEditWindowZoomFactor()); return m_nOldZoom != (m_nNewZoom = SmModule::get()->GetConfig()->GetSmEditWindowZoomFactor());
} }
void SmEditEngine::executeZoom(EditView* pEditView) void SmEditEngine::executeZoom(EditView* pEditView)

View File

@ -39,10 +39,7 @@
#define ShellClass_SmModule #define ShellClass_SmModule
#include <smslots.hxx> #include <smslots.hxx>
OUString SmResId(TranslateId aId) OUString SmResId(TranslateId aId) { return Translate::get(aId, SmModule::get()->GetResLocale()); }
{
return Translate::get(aId, SM_MOD()->GetResLocale());
}
OUString SmLocalizedSymbolData::GetUiSymbolName( std::u16string_view rExportName ) OUString SmLocalizedSymbolData::GetUiSymbolName( std::u16string_view rExportName )
{ {

View File

@ -68,7 +68,7 @@ SmSym& SmSym::operator = (const SmSym& rSymbol)
m_aSetName = rSymbol.m_aSetName; m_aSetName = rSymbol.m_aSetName;
m_bPredefined = rSymbol.m_bPredefined; m_bPredefined = rSymbol.m_bPredefined;
SM_MOD()->GetSymbolManager().SetModified(true); SmModule::get()->GetSymbolManager().SetModified(true);
return *this; return *this;
} }
@ -86,7 +86,7 @@ const vcl::Font& SmSym::GetFace(const SmFormat* pFormat) const
if (m_aFace.GetFamilyName().isEmpty()) if (m_aFace.GetFamilyName().isEmpty())
{ {
if (!pFormat) if (!pFormat)
pFormat = &SM_MOD()->GetConfig()->GetStandardFormat(); pFormat = &SmModule::get()->GetConfig()->GetStandardFormat();
return pFormat->GetFont(FNT_VARIABLE); return pFormat->GetFont(FNT_VARIABLE);
} }
return m_aFace; return m_aFace;
@ -239,8 +239,7 @@ SymbolPtrVec_t SmSymbolManager::GetSymbolSet( std::u16string_view rSymbolSetName
void SmSymbolManager::Load() void SmSymbolManager::Load()
{ {
std::vector< SmSym > aSymbols; std::vector< SmSym > aSymbols;
SmMathConfig &rCfg = *SM_MOD()->GetConfig(); SmModule::get()->GetConfig()->GetSymbols(aSymbols);
rCfg.GetSymbols( aSymbols );
size_t nSymbolCount = aSymbols.size(); size_t nSymbolCount = aSymbols.size();
m_aSymbols.clear(); m_aSymbols.clear();
@ -285,8 +284,6 @@ void SmSymbolManager::Save()
if (!m_bModified) if (!m_bModified)
return; return;
SmMathConfig &rCfg = *SM_MOD()->GetConfig();
// prepare to skip symbols from iGreek on saving // prepare to skip symbols from iGreek on saving
OUString aSymbolSetName = "i" + OUString aSymbolSetName = "i" +
SmLocalizedSymbolData::GetUiSymbolSetName(u"Greek"); SmLocalizedSymbolData::GetUiSymbolSetName(u"Greek");
@ -300,7 +297,7 @@ void SmSymbolManager::Save()
if (i->GetSymbolSetName() != aSymbolSetName) if (i->GetSymbolSetName() != aSymbolSetName)
aSymbols.push_back( *i ); aSymbols.push_back( *i );
} }
rCfg.SetSymbols( aSymbols ); SmModule::get()->GetConfig()->SetSymbols(aSymbols);
m_bModified = false; m_bModified = false;
} }

View File

@ -50,8 +50,9 @@ Color SmTmpDevice::GetTextColor(const Color& rTextColor)
{ {
if (rTextColor == COL_AUTO) if (rTextColor == COL_AUTO)
{ {
Color aConfigFontColor = SM_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; auto& config = SmModule::get()->GetColorConfig();
Color aConfigDocColor = SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; Color aConfigFontColor = config.GetColorValue(svtools::FONTCOLOR).nColor;
Color aConfigDocColor = config.GetColorValue(svtools::DOCCOLOR).nColor;
return rOutDev.GetReadableFontColor(aConfigFontColor, aConfigDocColor); return rOutDev.GetReadableFontColor(aConfigFontColor, aConfigDocColor);
} }

View File

@ -66,8 +66,7 @@ using namespace ::com::sun::star::script;
SmPrintUIOptions::SmPrintUIOptions() SmPrintUIOptions::SmPrintUIOptions()
{ {
SmModule *pp = SM_MOD(); SmMathConfig* pConfig = SmModule::get()->GetConfig();
SmMathConfig *pConfig = pp->GetConfig();
SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" ); SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" );
if (!pConfig) if (!pConfig)
return; return;
@ -610,8 +609,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM, SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM,
SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>> ( SmDocShell::GetPool() ); SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>> ( SmDocShell::GetPool() );
SmModule *pp = SM_MOD(); SmModule::get()->GetConfig()->ConfigToItemSet(*pItemSet);
pp->GetConfig()->ConfigToItemSet(*pItemSet);
VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) ); VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
pDocSh->SetPrinter( pPrinter ); pDocSh->SetPrinter( pPrinter );
@ -624,8 +622,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
if ( !(*pValues >>= aSequence) ) if ( !(*pValues >>= aSequence) )
throw IllegalArgumentException(); throw IllegalArgumentException();
SmModule *pp = SM_MOD(); SmSymbolManager& rManager = SmModule::get()->GetSymbolManager();
SmSymbolManager &rManager = pp->GetSymbolManager();
for (const SymbolDescriptor& rDescriptor : aSequence) for (const SymbolDescriptor& rDescriptor : aSequence)
{ {
vcl::Font aFont; vcl::Font aFont;
@ -860,8 +857,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
const std::set< OUString > &rUsedSymbols = pDocSh->GetUsedSymbols(); const std::set< OUString > &rUsedSymbols = pDocSh->GetUsedSymbols();
// this is get // this is get
SmModule *pp = SM_MOD(); const SmSymbolManager& rManager = SmModule::get()->GetSymbolManager();
const SmSymbolManager &rManager = pp->GetSymbolManager();
std::vector < const SmSym * > aVector; std::vector < const SmSym * > aVector;
const SymbolPtrVec_t aSymbols( rManager.GetSymbols() ); const SymbolPtrVec_t aSymbols( rManager.GetSymbols() );

View File

@ -322,7 +322,8 @@ void SmGraphicWidget::SetDrawingArea(weld::DrawingArea* pDrawingArea)
OutputDevice& rDevice = GetOutputDevice(); OutputDevice& rDevice = GetOutputDevice();
rDevice.EnableRTL(GetDoc()->GetFormat().IsRightToLeft()); rDevice.EnableRTL(GetDoc()->GetFormat().IsRightToLeft());
rDevice.SetBackground(SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor); rDevice.SetBackground(
SmModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor);
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
{ {
@ -552,12 +553,10 @@ void SmGraphicWidget::SetCursor(const tools::Rectangle &rRect)
if (SmViewShell::IsInlineEditEnabled()) if (SmViewShell::IsInlineEditEnabled())
return; return;
SmModule *pp = SM_MOD();
if (IsCursorVisible()) if (IsCursorVisible())
ShowCursor(false); // clean up remainings of old cursor ShowCursor(false); // clean up remainings of old cursor
aCursorRect = rRect; aCursorRect = rRect;
if (pp->GetConfig()->IsShowFormulaCursor()) if (SmModule::get()->GetConfig()->IsShowFormulaCursor())
ShowCursor(true); // draw new cursor ShowCursor(true); // draw new cursor
} }
@ -612,8 +611,7 @@ void SmGraphicWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
SmGetLeftSelectionPart(pEdit->GetSelection(), nRow, nCol); SmGetLeftSelectionPart(pEdit->GetSelection(), nRow, nCol);
const SmNode *pFound = SetCursorPos(static_cast<sal_uInt16>(nRow), nCol); const SmNode *pFound = SetCursorPos(static_cast<sal_uInt16>(nRow), nCol);
SmModule *pp = SM_MOD(); if (pFound && SmModule::get()->GetConfig()->IsShowFormulaCursor())
if (pFound && pp->GetConfig()->IsShowFormulaCursor())
ShowCursor(true); ShowCursor(true);
} }
} }
@ -1236,8 +1234,7 @@ sal_uInt16 SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlag
if ((nDiffFlags & SfxPrinterChangeFlags::OPTIONS) == SfxPrinterChangeFlags::OPTIONS) if ((nDiffFlags & SfxPrinterChangeFlags::OPTIONS) == SfxPrinterChangeFlags::OPTIONS)
{ {
SmModule *pp = SM_MOD(); SmModule::get()->GetConfig()->ItemSetToConfig(pNewPrinter->GetOptions());
pp->GetConfig()->ItemSetToConfig(pNewPrinter->GetOptions());
} }
return 0; return 0;
} }
@ -1381,7 +1378,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
{ {
case SID_FORMULACURSOR: case SID_FORMULACURSOR:
{ {
SmModule *pp = SM_MOD(); auto* config = SmModule::get()->GetConfig();
const SfxItemSet *pArgs = rReq.GetArgs(); const SfxItemSet *pArgs = rReq.GetArgs();
const SfxPoolItem *pItem; const SfxPoolItem *pItem;
@ -1391,9 +1388,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
SfxItemState::SET == pArgs->GetItemState( SID_FORMULACURSOR, false, &pItem)) SfxItemState::SET == pArgs->GetItemState( SID_FORMULACURSOR, false, &pItem))
bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue(); bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
else else
bVal = !pp->GetConfig()->IsShowFormulaCursor(); bVal = !config->IsShowFormulaCursor();
pp->GetConfig()->SetShowFormulaCursor(bVal); config->SetShowFormulaCursor(bVal);
if (!IsInlineEditEnabled()) if (!IsInlineEditEnabled())
GetGraphicWidget().ShowCursor(bVal); GetGraphicWidget().ShowCursor(bVal);
break; break;
@ -1790,15 +1787,15 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SID_SYMBOLS_CATALOGUE: case SID_SYMBOLS_CATALOGUE:
{ {
SmModule* pp = SmModule::get();
// get device used to retrieve the FontList // get device used to retrieve the FontList
SmDocShell *pDoc = GetDoc(); SmDocShell *pDoc = GetDoc();
OutputDevice *pDev = pDoc->GetPrinter(); OutputDevice *pDev = pDoc->GetPrinter();
if (!pDev || pDev->GetFontFaceCollectionCount() == 0) if (!pDev || pDev->GetFontFaceCollectionCount() == 0)
pDev = &SM_MOD()->GetDefaultVirtualDev(); pDev = &pp->GetDefaultVirtualDev();
SAL_WARN_IF( !pDev, "starmath", "device for font list missing" ); SAL_WARN_IF( !pDev, "starmath", "device for font list missing" );
SmModule *pp = SM_MOD();
SmSymbolDialog aDialog(pWin ? pWin->GetFrameWeld() : nullptr, pDev, pp->GetSymbolManager(), *this); SmSymbolDialog aDialog(pWin ? pWin->GetFrameWeld() : nullptr, pDev, pp->GetSymbolManager(), *this);
aDialog.run(); aDialog.run();
} }
@ -1926,7 +1923,7 @@ void SmViewShell::GetState(SfxItemSet &rSet)
if (IsInlineEditEnabled()) if (IsInlineEditEnabled())
rSet.DisableItem(nWh); rSet.DisableItem(nWh);
else else
rSet.Put(SfxBoolItem(nWh, SM_MOD()->GetConfig()->IsShowFormulaCursor())); rSet.Put(SfxBoolItem(nWh, SmModule::get()->GetConfig()->IsShowFormulaCursor()));
} }
break; break;
case SID_ELEMENTSDOCKINGWINDOW: case SID_ELEMENTSDOCKINGWINDOW:
@ -2130,7 +2127,7 @@ void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint )
bool SmViewShell::IsInlineEditEnabled() bool SmViewShell::IsInlineEditEnabled()
{ {
return comphelper::LibreOfficeKit::isActive() return comphelper::LibreOfficeKit::isActive()
|| SM_MOD()->GetConfig()->IsInlineEditEnable(); || SmModule::get()->GetConfig()->IsInlineEditEnable();
} }
void SmViewShell::StartMainHelp() void SmViewShell::StartMainHelp()