diff --git a/officecfg/registry/schema/org/openoffice/Office/Math.xcs b/officecfg/registry/schema/org/openoffice/Office/Math.xcs index c4466e0da278..7c052633bad0 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Math.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Math.xcs @@ -297,6 +297,12 @@ Contains miscellaneous settings. + + + Enables inline (visual) editing mode. + + true + Ignores spacing symbols at the end of a line. diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index c81e9d086aed..1dfbd3ef9dd4 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -186,6 +186,8 @@ public: void SetSaveOnlyUsedSymbols(bool bVal); bool IsAutoCloseBrackets() const; void SetAutoCloseBrackets(bool bVal); + bool IsInlineEditEnable() const; + void SetInlineEditEnable(bool bVal); bool IsIgnoreSpacesRight() const; void SetIgnoreSpacesRight(bool bVal); bool IsAutoRedraw() const; diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index ad283920a0d7..bed55f9ddabf 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -46,6 +46,7 @@ class SmPrintOptionsTabPage final : public SfxTabPage std::unique_ptr m_xSizeScaled; std::unique_ptr m_xSizeZoomed; std::unique_ptr m_xZoom; + std::unique_ptr m_xEnableInlineEdit; std::unique_ptr m_xNoRightSpaces; std::unique_ptr m_xSaveOnlyUsedSymbols; std::unique_ptr m_xAutoCloseBrackets; diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 378aca8bc838..1127e6660cbd 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -73,5 +73,6 @@ class SfxUInt16Item; #define SID_AUTO_CLOSE_BRACKETS TypedWhichId(SID_SMA_START + 127) #define SID_SMEDITWINDOWZOOM TypedWhichId(SID_SMA_START + 129) #define SID_DEFAULT_SM_SYNTAX_VERSION TypedWhichId(SID_SMA_START + 130) +#define SID_INLINE_EDIT_ENABLE TypedWhichId(SID_SMA_START + 131) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 3bf170c0afe4..2146c366cd1e 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -73,6 +73,7 @@ static Sequence lcl_GetOtherPropertyNames() "Misc/AutoCloseBrackets", "Misc/DefaultSmSyntaxVersion", "Misc/IgnoreSpacesRight", + "Misc/InlineEditEnable", "Misc/SmEditWindowZoomFactor", "Print/FormulaText", "Print/Frame", @@ -144,6 +145,7 @@ struct SmCfgOther bool bPrintFrame; bool bIsSaveOnlyUsedSymbols; bool bIsAutoCloseBrackets; + bool bInlineEditEnable; bool bIgnoreSpacesRight; bool bToolboxVisible; bool bAutoRedraw; @@ -165,6 +167,7 @@ SmCfgOther::SmCfgOther() , bPrintFrame(true) , bIsSaveOnlyUsedSymbols(true) , bIsAutoCloseBrackets(true) + , bInlineEditEnable(true) , bIgnoreSpacesRight(true) , bToolboxVisible(true) , bAutoRedraw(true) @@ -793,6 +796,10 @@ void SmMathConfig::LoadOther() if (sal_Int16 nTmp; pVal->hasValue() && (*pVal >>= nTmp)) pOther->nSmSyntaxVersion = nTmp; ++pVal; + // Misc/InlineEditEnable + if (bool bTmp; pVal->hasValue() && (*pVal >>= bTmp)) + pOther->bInlineEditEnable = bTmp; + ++pVal; // Misc/IgnoreSpacesRight if (bool bTmp; pVal->hasValue() && (*pVal >>= bTmp)) pOther->bIgnoreSpacesRight = bTmp; @@ -856,6 +863,8 @@ void SmMathConfig::SaveOther() *pVal++ <<= pOther->bIsAutoCloseBrackets; // Misc/DefaultSmSyntaxVersion *pVal++ <<= pOther->nSmSyntaxVersion; + // Misc/InlineEditEnable + *pVal++ <<= pOther->bInlineEditEnable; // Misc/IgnoreSpacesRight *pVal++ <<= pOther->bIgnoreSpacesRight; // Misc/SmEditWindowZoomFactor @@ -1293,6 +1302,27 @@ void SmMathConfig::SetDefaultSmSyntaxVersion( sal_uInt16 nVal ) } } +bool SmMathConfig::IsInlineEditEnable() const +{ + if (utl::ConfigManager::IsFuzzing()) + return false; + if (!pOther) + const_cast(this)->LoadOther(); + return pOther->bInlineEditEnable; +} + + +void SmMathConfig::SetInlineEditEnable( bool bVal ) +{ + if (!pOther) + LoadOther(); + if (SetOtherIfNotEqual( pOther->bInlineEditEnable, bVal )) + { + // reformat (displayed) formulas accordingly + Broadcast(SfxHint(SfxHintId::MathFormatChanged)); + } +} + bool SmMathConfig::IsIgnoreSpacesRight() const { if (utl::ConfigManager::IsFuzzing()) @@ -1389,6 +1419,10 @@ void SmMathConfig::ItemSetToConfig(const SfxItemSet &rSet) { bVal = pRedrawItem->GetValue(); SetAutoRedraw( bVal ); } + if (const SfxBoolItem* pSpacesItem = rSet.GetItemIfSet(SID_INLINE_EDIT_ENABLE)) + { bVal = pSpacesItem->GetValue(); + SetInlineEditEnable( bVal ); + } if (const SfxBoolItem* pSpacesItem = rSet.GetItemIfSet(SID_NO_RIGHT_SPACES)) { bVal = pSpacesItem->GetValue(); SetIgnoreSpacesRight( bVal ); @@ -1425,6 +1459,7 @@ void SmMathConfig::ConfigToItemSet(SfxItemSet &rSet) const rSet.Put(SfxBoolItem(SID_PRINTTEXT, IsPrintFormulaText())); rSet.Put(SfxBoolItem(SID_PRINTFRAME, IsPrintFrame())); rSet.Put(SfxBoolItem(SID_AUTOREDRAW, IsAutoRedraw())); + rSet.Put(SfxBoolItem(SID_INLINE_EDIT_ENABLE, IsInlineEditEnable())); rSet.Put(SfxBoolItem(SID_NO_RIGHT_SPACES, IsIgnoreSpacesRight())); rSet.Put(SfxBoolItem(SID_SAVE_ONLY_USED_SYMBOLS, IsSaveOnlyUsedSymbols())); rSet.Put(SfxBoolItem(SID_AUTO_CLOSE_BRACKETS, IsAutoCloseBrackets())); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index a377e59a27b1..8625072c90e8 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -167,6 +167,7 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::Dialo , m_xSizeScaled(m_xBuilder->weld_radio_button("sizescaled")) , m_xSizeZoomed(m_xBuilder->weld_radio_button("sizezoomed")) , m_xZoom(m_xBuilder->weld_metric_spin_button("zoom", FieldUnit::PERCENT)) + , m_xEnableInlineEdit(m_xBuilder->weld_check_button("enableinlineedit")) , m_xNoRightSpaces(m_xBuilder->weld_check_button("norightspaces")) , m_xSaveOnlyUsedSymbols(m_xBuilder->weld_check_button("saveonlyusedsymbols")) , m_xAutoCloseBrackets(m_xBuilder->weld_check_button("autoclosebrackets")) @@ -223,6 +224,7 @@ bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) rSet->Put(SfxBoolItem(SID_PRINTTITLE, m_xTitle->get_active())); rSet->Put(SfxBoolItem(SID_PRINTTEXT, m_xText->get_active())); rSet->Put(SfxBoolItem(SID_PRINTFRAME, m_xFrame->get_active())); + rSet->Put(SfxBoolItem(SID_INLINE_EDIT_ENABLE, m_xEnableInlineEdit->get_active())); rSet->Put(SfxBoolItem(SID_NO_RIGHT_SPACES, m_xNoRightSpaces->get_active())); rSet->Put(SfxBoolItem(SID_SAVE_ONLY_USED_SYMBOLS, m_xSaveOnlyUsedSymbols->get_active())); rSet->Put(SfxBoolItem(SID_AUTO_CLOSE_BRACKETS, m_xAutoCloseBrackets->get_active())); @@ -251,6 +253,7 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet) m_xSmZoom->set_value(rSet->Get(SID_SMEDITWINDOWZOOM).GetValue(), FieldUnit::PERCENT); m_xTitle->set_active(rSet->Get(SID_PRINTTITLE).GetValue()); + m_xEnableInlineEdit->set_active(rSet->Get(SID_INLINE_EDIT_ENABLE).GetValue()); m_xNoRightSpaces->set_active(rSet->Get(SID_NO_RIGHT_SPACES).GetValue()); m_xSaveOnlyUsedSymbols->set_active(rSet->Get(SID_SAVE_ONLY_USED_SYMBOLS).GetValue()); m_xAutoCloseBrackets->set_active(rSet->Get(SID_AUTO_CLOSE_BRACKETS).GetValue()); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index cafd291fe14e..5c09cf40d3c0 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -476,7 +476,8 @@ Printer* SmDocShell::GetPrt() auto pOptions = std::make_unique>(GetPool()); + SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM, + SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>>(GetPool()); SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pOptions); mpPrinter = VclPtr::Create(std::move(pOptions)); diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 934e6090eaf1..5e8886ebdc3c 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -211,7 +211,8 @@ std::optional SmModule::CreateItemSet( sal_uInt16 nId ) svl::Items< //TP_SMPRINT SID_PRINTTITLE, SID_PRINTZOOM, 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>); GetConfig()->ConfigToItemSet(*pRet); } diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index a75dfe68799c..c3a5bc1ff02d 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -600,7 +600,8 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* SID_PRINTZOOM, SID_PRINTZOOM, SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS, - SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM>> ( SmDocShell::GetPool() ); + SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM, + SID_INLINE_EDIT_ENABLE, SID_INLINE_EDIT_ENABLE>> ( SmDocShell::GetPool() ); SmModule *pp = SM_MOD(); pp->GetConfig()->ConfigToItemSet(*pItemSet); VclPtr pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) ); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 1a1a236deca5..3e1e4909ea1d 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2334,7 +2334,7 @@ void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) bool SmViewShell::IsInlineEditEnabled() { return comphelper::LibreOfficeKit::isActive() - || officecfg::Office::Common::Misc::ExperimentalMode::get(); + || SM_MOD()->GetConfig()->IsInlineEditEnable(); } void SmViewShell::StartMainHelp() diff --git a/starmath/uiconfig/smath/ui/smathsettings.ui b/starmath/uiconfig/smath/ui/smathsettings.ui index d3908d751450..ae9adb655e93 100644 --- a/starmath/uiconfig/smath/ui/smathsettings.ui +++ b/starmath/uiconfig/smath/ui/smathsettings.ui @@ -252,6 +252,21 @@ 6 vertical 6 + + + Enable visual editing + True + True + False + True + True + + + False + True + 0 + + Ig_nore ~~ and ' at the end of the line @@ -269,7 +284,7 @@ False True - 0 + 1 @@ -289,7 +304,7 @@ False True - 1 + 2 @@ -304,7 +319,7 @@ False True - 2 + 3