[Libreoffice-commits] core.git: basctl/source officecfg/registry

tagezi lera.goncharuk at gmail.com
Thu May 25 14:58:13 UTC 2017


 basctl/source/basicide/baside2.cxx                           |   23 ++++++-----
 officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs |   11 +++++
 2 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 3bdd04cd54a42a98f7f679e749f3da0f164ac18f
Author: tagezi <lera.goncharuk at gmail.com>
Date:   Wed May 24 23:56:57 2017 +0300

    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 at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

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>


More information about the Libreoffice-commits mailing list