Kaydet (Commit) f80c3e37 authored tarafından tagezi's avatar tagezi Kaydeden (comit) Mike Kaganski

tdf#91913 Saving line numbering into setting

It saves setting of the line numbering for next start
Now the line numbering is enabled by default

Change-Id: Ib658d417882996eb843fed9b236496fe2fb42166
Reviewed-on: https://gerrit.libreoffice.org/38013Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 3bdd04cd)
Reviewed-on: https://gerrit.libreoffice.org/38031
üst d0548cc4
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "iderdll.hxx" #include "iderdll.hxx"
#include "moduldlg.hxx" #include "moduldlg.hxx"
#include "docsignature.hxx" #include "docsignature.hxx"
#include "officecfg/Office/BasicIDE.hxx"
#include "helpid.hrc" #include "helpid.hrc"
#include <basidesh.hrc> #include <basidesh.hrc>
...@@ -172,10 +173,6 @@ void lcl_ConvertTabsToSpaces( OUString& rLine ) ...@@ -172,10 +173,6 @@ void lcl_ConvertTabsToSpaces( OUString& rLine )
} }
} }
// until we have some configuration lets just keep
// persist this value for the process lifetime
bool bSourceLinesEnabled = false;
} // namespace } // namespace
ModulWindow::ModulWindow (ModulWindowLayout* pParent, ScriptDocument const& rDocument, ModulWindow::ModulWindow (ModulWindowLayout* pParent, ScriptDocument const& rDocument,
...@@ -985,8 +982,12 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) ...@@ -985,8 +982,12 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
case SID_SHOWLINES: case SID_SHOWLINES:
{ {
const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot()); const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot());
bSourceLinesEnabled = pItem && pItem->GetValue(); bool bLineNumbers = pItem && pItem->GetValue();
m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers);
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
officecfg::Office::BasicIDE::EditorSettings::LineNumbering::set(bLineNumbers, batch);
batch->commit();
} }
break; break;
case SID_BASICIDE_DELETECURRENT: case SID_BASICIDE_DELETECURRENT:
...@@ -1121,7 +1122,8 @@ void ModulWindow::GetState( SfxItemSet &rSet ) ...@@ -1121,7 +1122,8 @@ void ModulWindow::GetState( SfxItemSet &rSet )
break; break;
case SID_SHOWLINES: case SID_SHOWLINES:
{ {
rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled)); bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get();
rSet.Put(SfxBoolItem(nWh, bLineNumbers));
break; break;
} }
case SID_SELECTALL: case SID_SELECTALL:
...@@ -1188,7 +1190,8 @@ void ModulWindow::AssertValidEditEngine() ...@@ -1188,7 +1190,8 @@ void ModulWindow::AssertValidEditEngine()
void ModulWindow::Activating () void ModulWindow::Activating ()
{ {
m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get();
m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers);
Show(); Show();
} }
...@@ -1370,7 +1373,8 @@ bool ModulWindow::IsPasteAllowed() ...@@ -1370,7 +1373,8 @@ bool ModulWindow::IsPasteAllowed()
void ModulWindow::OnNewDocument () void ModulWindow::OnNewDocument ()
{ {
m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get();
m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers);
} }
char const* ModulWindow::GetHid () const char const* ModulWindow::GetHid () const
...@@ -1566,7 +1570,6 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst) ...@@ -1566,7 +1570,6 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst)
pEditor->UpdateSyntaxHighlighting(); pEditor->UpdateSyntaxHighlighting();
} }
} // namespace basctl } // namespace basctl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -63,5 +63,16 @@ ...@@ -63,5 +63,16 @@
<value>false</value> <value>false</value>
</prop> </prop>
</group> </group>
<group oor:name="EditorSettings">
<info>
<desc>Contains user configuration.</desc>
</info>
<prop oor:name="LineNumbering" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Sets the line numbering on/off. Default is true.</desc>
</info>
<value>true</value>
</prop>
</group>
</component> </component>
</oor:component-schema> </oor:component-schema>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment