summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2023-01-11 20:21:29 +0000
committerRafael Lima <rafael.palma.lima@gmail.com>2023-02-08 11:46:34 +0000
commit9ebba1d99457a1049c2f61ba15cd4c99a68d74e7 (patch)
tree537effe77cedf1f3767f55101321f36c2fa6eb03 /basctl
parent54298f7f23e699e99e979bdf945c6ae2bee1a12f (diff)
tdf#147488 BASIC: Create empty module when an empty library is selected
If the Standard library is empty (has no modules), when the Basic IDE is opened it shows only a black screen with nothing. This patch makes it so that when the Standard library has no modules, a generic module is created and shown. Change-Id: I26dbe41b4244492a21649ab08c5fc2df24ca12a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145309 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/basidesh.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index eb3d6996c191..ae61007c7bf8 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -628,6 +628,9 @@ void Shell::UpdateWindows()
{
// remove all windows that may not be displayed
bool bChangeCurWindow = pCurWin == nullptr;
+ // stores the total number of modules and dialogs visible
+ sal_uInt16 nTotalTabs = 0;
+
if ( !m_aCurLibName.isEmpty() )
{
std::vector<VclPtr<BaseWindow> > aDeleteVec;
@@ -704,6 +707,7 @@ void Shell::UpdateWindows()
Sequence< OUString > aModNames( doc.getObjectNames( E_SCRIPTS, aLibName ) );
sal_Int32 nModCount = aModNames.getLength();
const OUString* pModNames = aModNames.getConstArray();
+ nTotalTabs += nModCount;
for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
{
@@ -733,6 +737,7 @@ void Shell::UpdateWindows()
Sequence< OUString > aDlgNames = doc.getObjectNames( E_DIALOGS, aLibName );
sal_Int32 nDlgCount = aDlgNames.getLength();
const OUString* pDlgNames = aDlgNames.getConstArray();
+ nTotalTabs += nDlgCount;
for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
{
@@ -761,7 +766,12 @@ void Shell::UpdateWindows()
if ( bChangeCurWindow )
{
- if ( !pNextActiveWindow )
+ if ( nTotalTabs == 0 )
+ {
+ // If no tabs are opened, create a generic module and make it visible
+ pNextActiveWindow = CreateBasWin( m_aCurDocument, m_aCurLibName, OUString() );
+ }
+ else if ( !pNextActiveWindow )
{
pNextActiveWindow = FindApplicationWindow().get();
}