basctl/source/basicide/baside2.cxx                           |   10 ++++
 basctl/source/basicide/basides1.cxx                          |   27 ++++++++---
 basctl/source/basicide/basidesh.cxx                          |    6 ++
 officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs |   18 +++++++
 4 files changed, 56 insertions(+), 5 deletions(-)

New commits:
commit c0075bf84ecb64186f42c861985af43e120101f9
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Tue Jan 9 23:01:02 2024 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Thu Jan 11 19:49:28 2024 +0100

    tdf#155381 Remember the visibility of UI components in the Basic IDE
    
    This patch remembers the visibility of the Object Catalog, Watched 
Expressions and Stack Window in the Basic IDE.
    
    Change-Id: I2fea038ffc56af45cd6570feeb14ab84307f8cef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161852
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 8eebbdb44e8d..a36cec6fe245 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1458,6 +1458,16 @@ ModulWindowLayout::ModulWindowLayout (vcl::Window* 
pParent, ObjectCatalog& rObje
     // Get active color scheme from the registry
     m_sColorSchemeId = 
GetShell()->GetColorConfig()->GetCurrentColorSchemeName();
     aSyntaxColors.ApplyColorScheme(m_sColorSchemeId, true);
+
+    // Initialize the visibility of the Stack Window
+    bool bStackVisible = 
::officecfg::Office::BasicIDE::EditorSettings::StackWindow::get();
+    if (!bStackVisible)
+        aStackWindow->Show(bStackVisible);
+
+    // Initialize the visibility of the Watched Expressions window
+    bool bWatchVisible = 
::officecfg::Office::BasicIDE::EditorSettings::WatchWindow::get();
+    if (!bWatchVisible)
+        aWatchWindow->Show(bWatchVisible);
 }
 
 ModulWindowLayout::~ModulWindowLayout()
diff --git a/basctl/source/basicide/basides1.cxx 
b/basctl/source/basicide/basides1.cxx
index 507902a34d0a..8052845983f3 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -423,14 +423,21 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
         break;
 
         case SID_BASICIDE_OBJCAT:
-            // toggling object catalog
-            aObjectCatalog->Show(!aObjectCatalog->IsVisible());
+        {
+            // Toggle the visibility of the object catalog
+            bool bVisible = aObjectCatalog->IsVisible();
+            aObjectCatalog->Show(!bVisible);
             if (pLayout)
                 pLayout->ArrangeWindows();
             // refresh the button state
             if (SfxBindings* pBindings = GetBindingsPtr())
                 pBindings->Invalidate(SID_BASICIDE_OBJCAT);
-            break;
+
+            std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
+            
officecfg::Office::BasicIDE::EditorSettings::ObjectCatalog::set(!bVisible, 
batch);
+            batch->commit();
+        }
+        break;
 
         case SID_BASICIDE_WATCH:
         {
@@ -438,9 +445,14 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             if (!dynamic_cast<ModulWindowLayout*>(pLayout.get()))
                 return;
 
-            
pModulLayout->ShowWatchWindow(!pModulLayout->IsWatchWindowVisible());
+            bool bVisible = pModulLayout->IsWatchWindowVisible();
+            pModulLayout->ShowWatchWindow(!bVisible);
             if (SfxBindings* pBindings = GetBindingsPtr())
                 pBindings->Invalidate(SID_BASICIDE_WATCH);
+
+            std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
+            
officecfg::Office::BasicIDE::EditorSettings::WatchWindow::set(!bVisible, batch);
+            batch->commit();
         }
         break;
 
@@ -450,9 +462,14 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
             if (!dynamic_cast<ModulWindowLayout*>(pLayout.get()))
                 return;
 
-            
pModulLayout->ShowStackWindow(!pModulLayout->IsStackWindowVisible());
+            bool bVisible = pModulLayout->IsStackWindowVisible();
+            pModulLayout->ShowStackWindow(!bVisible);
             if (SfxBindings* pBindings = GetBindingsPtr())
                 pBindings->Invalidate(SID_BASICIDE_STACK);
+
+            std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
+            
officecfg::Office::BasicIDE::EditorSettings::StackWindow::set(!bVisible, batch);
+            batch->commit();
         }
         break;
 
diff --git a/basctl/source/basicide/basidesh.cxx 
b/basctl/source/basicide/basidesh.cxx
index e64e34e0ff59..420a51a2de8b 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -75,6 +75,7 @@
 #include <vcl/svapp.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <BasicColorConfig.hxx>
+#include <officecfg/Office/BasicIDE.hxx>
 
 namespace basctl
 {
@@ -211,6 +212,11 @@ void Shell::Init()
     InitTabBar();
     InitZoomLevel();
 
+    // Initialize the visibility of the Object Catalog
+    bool bObjCatVisible = 
::officecfg::Office::BasicIDE::EditorSettings::ObjectCatalog::get();
+    if (!bObjCatVisible)
+        aObjectCatalog->Show(bObjCatVisible);
+
     SetCurLib( ScriptDocument::getApplicationScriptDocument(), "Standard", 
false, false );
 
     ShellCreated(this);
diff --git a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs 
b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
index 0a17b5f2d75b..1fe9af67f78f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
@@ -170,6 +170,24 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="StackWindow" oor:type="xs:boolean" oor:nillable="false">
+        <info>
+          <desc>Sets the visibility of the Call Stack window.</desc>
+        </info>
+        <value>true</value>
+      </prop>
+      <prop oor:name="WatchWindow" oor:type="xs:boolean" oor:nillable="false">
+        <info>
+          <desc>Sets the visibility of the Watched Expressions window.</desc>
+        </info>
+        <value>true</value>
+      </prop>
+      <prop oor:name="ObjectCatalog" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Sets the visibility of the Object Catalog window.</desc>
+        </info>
+        <value>true</value>
+      </prop>
       <prop oor:name="ColorScheme" oor:type="xs:string" oor:nillable="false">
         <info>
           <desc>Name of the selected color scheme used in the Basic IDE.</desc>

Reply via email to