From 3bdd04cd54a42a98f7f679e749f3da0f164ac18f Mon Sep 17 00:00:00 2001 From: tagezi Date: Wed, 24 May 2017 23:56:57 +0300 Subject: 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/38013 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- basctl/source/basicide/baside2.cxx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'basctl') diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index fb9f3d11939f..f0070aa5fe01 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -23,6 +23,7 @@ #include "iderdll.hxx" #include "moduldlg.hxx" #include "docsignature.hxx" +#include "officecfg/Office/BasicIDE.hxx" #include "helpid.hrc" #include @@ -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 ModulWindow::ModulWindow (ModulWindowLayout* pParent, ScriptDocument const& rDocument, @@ -985,8 +982,12 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) case SID_SHOWLINES: { const SfxBoolItem* pItem = rReq.GetArg(rReq.GetSlot()); - bSourceLinesEnabled = pItem && pItem->GetValue(); - m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); + bool bLineNumbers = pItem && pItem->GetValue(); + m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers); + + std::shared_ptr batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::BasicIDE::EditorSettings::LineNumbering::set(bLineNumbers, batch); + batch->commit(); } break; case SID_BASICIDE_DELETECURRENT: @@ -1121,7 +1122,8 @@ void ModulWindow::GetState( SfxItemSet &rSet ) break; case SID_SHOWLINES: { - rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled)); + bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get(); + rSet.Put(SfxBoolItem(nWh, bLineNumbers)); break; } case SID_SELECTALL: @@ -1188,7 +1190,8 @@ void ModulWindow::AssertValidEditEngine() void ModulWindow::Activating () { - m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); + bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get(); + m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers); Show(); } @@ -1370,7 +1373,8 @@ bool ModulWindow::IsPasteAllowed() void ModulWindow::OnNewDocument () { - m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); + bool bLineNumbers = ::officecfg::Office::BasicIDE::EditorSettings::LineNumbering::get(); + m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers); } char const* ModulWindow::GetHid () const @@ -1566,7 +1570,6 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst) pEditor->UpdateSyntaxHighlighting(); } - } // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit