summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortagezi <lera.goncharuk@gmail.com>2017-05-24 23:56:57 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-05-25 16:57:49 +0200
commit3bdd04cd54a42a98f7f679e749f3da0f164ac18f (patch)
tree8ef562b545e2c846ffea6e8ffc462b90f380ed62
parent021ff0c97f3dabd423740782155c77cbcbc3a93a (diff)
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 <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--basctl/source/basicide/baside2.cxx23
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs11
2 files changed, 24 insertions, 10 deletions
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 <basidesh.hrc>
@@ -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<SfxBoolItem>(rReq.GetSlot());
- bSourceLinesEnabled = pItem && pItem->GetValue();
- m_aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
+ bool bLineNumbers = pItem && pItem->GetValue();
+ m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers);
+
+ std::shared_ptr<comphelper::ConfigurationChanges> 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: */
diff --git a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
index 9bf9b3dfd238..94f108c179bf 100644
--- a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
@@ -63,5 +63,16 @@
<value>false</value>
</prop>
</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>
</oor:component-schema>