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 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;
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: */

View file

@ -503,7 +503,7 @@ struct ElementData
SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView)
: mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT))
, mnCurrentSetIndex(-1)
, m_nSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion())
, m_nSmSyntaxVersion(SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion())
, mpIconView(std::move(pIconView))
{
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());
if (aQuery.run() == RET_YES)
{
SmModule *pp = SM_MOD();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
auto* config = SmModule::get()->GetConfig();
SmFormat aFmt(config->GetStandardFormat());
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());
if (aQuery.run() == RET_YES)
{
SmModule *pp = SM_MOD();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
auto* config = SmModule::get()->GetConfig();
SmFormat aFmt(config->GetStandardFormat());
WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt, true );
config->SetStandardFormat(aFmt, true);
}
}
@ -605,16 +605,16 @@ SmFontTypeDialog::~SmFontTypeDialog()
void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
{
SmModule *pp = SM_MOD();
auto* config = SmModule::get()->GetConfig();
*m_xMathFont = pp->GetConfig()->GetFontPickList(FNT_MATH);
*m_xVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE);
*m_xFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION);
*m_xNumberFont = pp->GetConfig()->GetFontPickList(FNT_NUMBER);
*m_xTextFont = pp->GetConfig()->GetFontPickList(FNT_TEXT);
*m_xSerifFont = pp->GetConfig()->GetFontPickList(FNT_SERIF);
*m_xSansFont = pp->GetConfig()->GetFontPickList(FNT_SANS);
*m_xFixedFont = pp->GetConfig()->GetFontPickList(FNT_FIXED);
*m_xMathFont = config->GetFontPickList(FNT_MATH);
*m_xVariableFont = config->GetFontPickList(FNT_VARIABLE);
*m_xFunctionFont = config->GetFontPickList(FNT_FUNCTION);
*m_xNumberFont = config->GetFontPickList(FNT_NUMBER);
*m_xTextFont = config->GetFontPickList(FNT_TEXT);
*m_xSerifFont = config->GetFontPickList(FNT_SERIF);
*m_xSansFont = config->GetFontPickList(FNT_SANS);
*m_xFixedFont = config->GetFontPickList(FNT_FIXED);
m_xMathFont->Insert( rFormat.GetFont(FNT_MATH) );
m_xVariableFont->Insert( rFormat.GetFont(FNT_VARIABLE) );
@ -629,16 +629,16 @@ void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const
{
SmModule *pp = SM_MOD();
auto* config = SmModule::get()->GetConfig();
pp->GetConfig()->GetFontPickList(FNT_MATH) = *m_xMathFont;
pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = *m_xVariableFont;
pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = *m_xFunctionFont;
pp->GetConfig()->GetFontPickList(FNT_NUMBER) = *m_xNumberFont;
pp->GetConfig()->GetFontPickList(FNT_TEXT) = *m_xTextFont;
pp->GetConfig()->GetFontPickList(FNT_SERIF) = *m_xSerifFont;
pp->GetConfig()->GetFontPickList(FNT_SANS) = *m_xSansFont;
pp->GetConfig()->GetFontPickList(FNT_FIXED) = *m_xFixedFont;
config->GetFontPickList(FNT_MATH) = *m_xMathFont;
config->GetFontPickList(FNT_VARIABLE) = *m_xVariableFont;
config->GetFontPickList(FNT_FUNCTION) = *m_xFunctionFont;
config->GetFontPickList(FNT_NUMBER) = *m_xNumberFont;
config->GetFontPickList(FNT_TEXT) = *m_xTextFont;
config->GetFontPickList(FNT_SERIF) = *m_xSerifFont;
config->GetFontPickList(FNT_SANS) = *m_xSansFont;
config->GetFontPickList(FNT_FIXED) = *m_xFixedFont;
rFormat.SetFont( FNT_MATH, SmFace(m_xMathFont->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());
if (aQuery.run() == RET_YES)
{
SmModule *pp = SM_MOD();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
auto* config = SmModule::get()->GetConfig();
SmFormat aFmt(config->GetStandardFormat());
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());
if (aQuery.run() == RET_YES)
{
SmModule *pp = SM_MOD();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
auto* config = SmModule::get()->GetConfig();
SmFormat aFmt(config->GetStandardFormat());
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()
{
SmModule *pp = SM_MOD();
pp->GetSymbolManager().Load();
SmModule::get()->GetSymbolManager().Load();
}
@ -253,7 +252,7 @@ void SmDocShell::ArrangeFormula()
pOutDev = &pView->GetGraphicWidget().GetDrawingArea()->get_ref_device();
else
{
pOutDev = &SM_MOD()->GetDefaultVirtualDev();
pOutDev = &SmModule::get()->GetDefaultVirtualDev();
pOutDev->SetMapMode( MapMode(SmMapUnit()) );
}
}
@ -515,8 +514,7 @@ Printer* SmDocShell::GetPrt()
SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS,
SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM,
SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>>(GetPool());
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pOptions);
SmModule::get()->GetConfig()->ConfigToItemSet(*pOptions);
mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pOptions));
mpPrinter->SetMapMode(MapMode(SmMapUnit()));
}
@ -579,17 +577,17 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
, mpTmpPrinter(nullptr)
, mnModifyCount(0)
, mbFormulaArranged(false)
, mnSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion())
{
SvtLinguConfig().GetOptions(maLinguOptions);
SetPool(&SfxGetpApp()->GetPool());
SmModule *pp = SM_MOD();
maFormat = pp->GetConfig()->GetStandardFormat();
auto* config = SmModule::get()->GetConfig();
mnSmSyntaxVersion = config->GetDefaultSmSyntaxVersion();
maFormat = config->GetStandardFormat();
StartListening(maFormat);
StartListening(*pp->GetConfig());
StartListening(*config);
SetBaseModel(new SmModel(this));
SetSmSyntaxVersion(mnSmSyntaxVersion);
@ -599,10 +597,8 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
SmDocShell::~SmDocShell()
{
SmModule *pp = SM_MOD();
EndListening(maFormat);
EndListening(*pp->GetConfig());
EndListening(*SmModule::get()->GetConfig());
mpCursor.reset();
mpEditEngine.reset();
@ -870,9 +866,8 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_AUTO_REDRAW :
{
SmModule *pp = SM_MOD();
bool bRedraw = pp->GetConfig()->IsAutoRedraw();
pp->GetConfig()->SetAutoRedraw(!bRedraw);
auto* config = SmModule::get()->GetConfig();
config->SetAutoRedraw(!config->IsAutoRedraw());
}
break;
@ -889,7 +884,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
// get device used to retrieve the FontList
OutputDevice *pDev = GetPrinter();
if (!pDev || pDev->GetFontFaceCollectionCount() == 0)
pDev = &SM_MOD()->GetDefaultVirtualDev();
pDev = &SmModule::get()->GetDefaultVirtualDev();
OSL_ENSURE (pDev, "device for font list missing" );
SmFontTypeDialog aFontTypeDialog(rReq.GetFrameWeld(), pDev);
@ -970,10 +965,10 @@ void SmDocShell::Execute(SfxRequest& rReq)
aAlignDialog.WriteTo(aNewFormat);
SmModule *pp = SM_MOD();
SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
auto* config = SmModule::get()->GetConfig();
SmFormat aFmt(config->GetStandardFormat());
aAlignDialog.WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt );
config->SetStandardFormat(aFmt);
SfxUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
@ -1067,12 +1062,7 @@ void SmDocShell::GetState(SfxItemSet &rSet)
break;
case SID_AUTO_REDRAW :
{
SmModule *pp = SM_MOD();
bool bRedraw = pp->GetConfig()->IsAutoRedraw();
rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, bRedraw));
}
rSet.Put(SfxBoolItem(SID_AUTO_REDRAW, SmModule::get()->GetConfig()->IsAutoRedraw()));
break;
case SID_MODIFYSTATUS:
@ -1159,8 +1149,7 @@ SfxUndoManager *SmDocShell::GetUndoManager()
void SmDocShell::SaveSymbols()
{
SmModule *pp = SM_MOD();
pp->GetSymbolManager().Save();
SmModule::get()->GetSymbolManager().Save();
}

View file

@ -314,7 +314,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
OUString selected = pEditView->getEditEngine().GetText(aSelection);
// Check is auto close brackets/braces is disabled
SmModule *pMod = SM_MOD();
SmModule* pMod = SmModule::get();
if (pMod && !pMod->GetConfig()->IsAutoCloseBrackets())
autoClose = false;
else if (o3tl::trim(selected) == u"<?>")
@ -715,12 +715,13 @@ bool SmEditWindow::IsSelected() const
void SmEditTextWindow::UpdateStatus(bool bSetDocModified)
{
SmModule *pMod = SM_MOD();
if (pMod && pMod->GetConfig()->IsAutoRedraw())
Flush();
if (SmModule* pMod = SmModule::get())
if (pMod->GetConfig()->IsAutoRedraw())
Flush();
if (SmDocShell *pModifyDoc = bSetDocModified ? mrEditWindow.GetDoc() : nullptr)
pModifyDoc->SetModified();
if (bSetDocModified)
if (SmDocShell* pModifyDoc = mrEditWindow.GetDoc())
pModifyDoc->SetModified();
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)
, m_pElementTree(nullptr)
, 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())
return;
SmModule* pMod = SM_MOD();
sal_Int16 nSmSyntaxVersion = pMod->GetConfig()->GetDefaultSmSyntaxVersion();
sal_Int16 nSmSyntaxVersion = SmModule::get()->GetConfig()->GetDefaultSmSyntaxVersion();
// Convert symbol names
if (pDocShell)
@ -525,7 +524,7 @@ void SmXMLExport::GetConfigurationSettings(Sequence<PropertyValue>& rProps)
return;
rProps.realloc(nCount);
SmMathConfig* pConfig = SM_MOD()->GetConfig();
SmMathConfig* pConfig = SmModule::get()->GetConfig();
const bool bUsedSymbolsOnly = pConfig && pConfig->IsSaveOnlyUsedSymbols();
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)
, bSuccess(false)
, 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);
const SmSym *pSym;
SmModule *pp = SM_MOD();
const SmSym* pSym
= GetToken().aText.isEmpty()
? nullptr
: SmModule::get()->GetSymbolManager().GetSymbolByName(GetToken().aText.subView(1));
bool bIsGreekSymbol = false;
bool bIsSpecialSymbol = false;
bool bIsArabic = false;
if ((!GetToken().aText.isEmpty())
&& (nullptr
!= (pSym = pp->GetSymbolManager().GetSymbolByName(GetToken().aText.subView(1)))))
if (pSym)
{
sal_UCS4 cChar = pSym->GetCharacter();
OUString aTmp( &cChar, 1 );

View file

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

View file

@ -357,7 +357,7 @@ static bool IsDelimiter(const OUString& rTxt, sal_Int32 nPos)
}
//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
|| nTypJp == css::i18n::UnicodeType::CONTROL);
}
@ -1595,7 +1595,7 @@ std::unique_ptr<SmBlankNode> SmParser5::DoBlank()
// Ignore trailing spaces, if corresponding option is set
if (m_aCurToken.eType == TNEWLINE
|| (m_aCurToken.eType == TEND && !comphelper::IsFuzzing()
&& SM_MOD()->GetConfig()->IsIgnoreSpacesRight()))
&& SmModule::get()->GetConfig()->IsIgnoreSpacesRight()))
{
pBlankNode->Clear();
}
@ -2665,7 +2665,7 @@ std::unique_ptr<SmSpecialNode> SmParser5::DoSpecial()
if (IsImportSymbolNames())
{
const SmSym* pSym
= SM_MOD()->GetSymbolManager().GetSymbolByExportName(rName.subView(1));
= SmModule::get()->GetSymbolManager().GetSymbolByExportName(rName.subView(1));
if (pSym)
{
aNewName = pSym->GetUiName();
@ -2674,7 +2674,8 @@ std::unique_ptr<SmSpecialNode> SmParser5::DoSpecial()
}
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)
{
aNewName = pSym->GetExportName();
@ -2745,7 +2746,7 @@ SmParser5::SmParser5()
, m_bExportSymNames(false)
, m_nParseDepth(0)
, 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)
// we need a virtual device here.
pGlyphDev = &SM_MOD()->GetDefaultVirtualDev();
pGlyphDev = &SmModule::get()->GetDefaultVirtualDev();
}
const FontMetric aDevFM (rDev.GetFontMetric());

View file

@ -59,7 +59,7 @@ SmEditEngine::SmEditEngine(SfxItemPool* pItemPool)
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)

View file

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

View file

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

View file

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

View file

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