starmath: Graduate inline (visual) editing from experimental features
It has been experimental for as long as LibreOffice existed, lets make it non-experimental but add an option to disable it. If it turns to be a disaster, we can flip the option and disable it by default. Change-Id: I63672c054d1ead269863079e7f9c118a44b3ba19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156486 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
This commit is contained in:
@@ -297,6 +297,12 @@
|
||||
<info>
|
||||
<desc>Contains miscellaneous settings.</desc>
|
||||
</info>
|
||||
<prop oor:name="InlineEditEnable" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>Enables inline (visual) editing mode.</desc>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="IgnoreSpacesRight" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>Ignores spacing symbols at the end of a line.</desc>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -46,6 +46,7 @@ class SmPrintOptionsTabPage final : public SfxTabPage
|
||||
std::unique_ptr<weld::RadioButton> m_xSizeScaled;
|
||||
std::unique_ptr<weld::RadioButton> m_xSizeZoomed;
|
||||
std::unique_ptr<weld::MetricSpinButton> m_xZoom;
|
||||
std::unique_ptr<weld::CheckButton> m_xEnableInlineEdit;
|
||||
std::unique_ptr<weld::CheckButton> m_xNoRightSpaces;
|
||||
std::unique_ptr<weld::CheckButton> m_xSaveOnlyUsedSymbols;
|
||||
std::unique_ptr<weld::CheckButton> m_xAutoCloseBrackets;
|
||||
|
||||
@@ -73,5 +73,6 @@ class SfxUInt16Item;
|
||||
#define SID_AUTO_CLOSE_BRACKETS TypedWhichId<SfxBoolItem>(SID_SMA_START + 127)
|
||||
#define SID_SMEDITWINDOWZOOM TypedWhichId<SfxUInt16Item>(SID_SMA_START + 129)
|
||||
#define SID_DEFAULT_SM_SYNTAX_VERSION TypedWhichId<SfxUInt16Item>(SID_SMA_START + 130)
|
||||
#define SID_INLINE_EDIT_ENABLE TypedWhichId<SfxBoolItem>(SID_SMA_START + 131)
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -73,6 +73,7 @@ static Sequence<OUString> 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<SmMathConfig*>(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()));
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -476,7 +476,8 @@ Printer* SmDocShell::GetPrt()
|
||||
auto pOptions = std::make_unique<SfxItemSetFixed<
|
||||
SID_PRINTTITLE, SID_PRINTZOOM,
|
||||
SID_NO_RIGHT_SPACES, SID_SAVE_ONLY_USED_SYMBOLS,
|
||||
SID_AUTO_CLOSE_BRACKETS, SID_SMEDITWINDOWZOOM>>(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<SfxPrinter>::Create(std::move(pOptions));
|
||||
|
||||
@@ -211,7 +211,8 @@ std::optional<SfxItemSet> 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);
|
||||
}
|
||||
|
||||
@@ -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<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -252,6 +252,21 @@
|
||||
<property name="margin-top">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="enableinlineedit">
|
||||
<property name="label" translatable="yes" context="smathsettings|enableinlineedit">Enable visual editing</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="norightspaces">
|
||||
<property name="label" translatable="yes" context="smathsettings|norightspaces">Ig_nore ~~ and ' at the end of the line</property>
|
||||
@@ -269,7 +284,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -289,7 +304,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -304,7 +319,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
Reference in New Issue
Block a user