summaryrefslogtreecommitdiffstats
path: root/basctl
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-02-01 01:25:36 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2017-02-01 01:36:11 +0200
commitf3ba0c5d4dfc44f72aa7d4809c062227649f098f (patch)
treec3219aa0d88d621ed40f80703386997758299416 /basctl
parentSolarMutexGuard for ImplDbgTestSolarMutex assert in JunitTest_dbaccess_complex (diff)
downloadcore-f3ba0c5d4dfc44f72aa7d4809c062227649f098f.tar.gz
core-f3ba0c5d4dfc44f72aa7d4809c062227649f098f.zip
Convert RID_POPUP_TABBAR to xml
Change-Id: Ic4587b8e244c52089692908fe0d10e363b5ed4fb
Diffstat (limited to 'basctl')
-rw-r--r--basctl/UIConfig_basicide.mk1
-rw-r--r--basctl/inc/basidesh.hrc1
-rw-r--r--basctl/source/basicide/baside2.cxx2
-rw-r--r--basctl/source/basicide/baside2.hrc31
-rw-r--r--basctl/source/basicide/baside2b.cxx2
-rw-r--r--basctl/source/basicide/basides1.cxx37
-rw-r--r--basctl/source/basicide/basidesh.src62
-rw-r--r--basctl/source/basicide/bastype2.cxx2
-rw-r--r--basctl/source/basicide/bastype3.cxx2
-rw-r--r--basctl/source/basicide/bastypes.cxx54
-rw-r--r--basctl/source/basicide/macrodlg.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/uiconfig/basicide/popupmenu/tabbar.xml22
13 files changed, 68 insertions, 152 deletions
diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk
index f79d9ce5f39b..97ced734236a 100644
--- a/basctl/UIConfig_basicide.mk
+++ b/basctl/UIConfig_basicide.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,modules/BasicIDE))
$(eval $(call gb_UIConfig_add_popupmenufiles,modules/BasicIDE,\
basctl/uiconfig/basicide/popupmenu/dialog \
+ basctl/uiconfig/basicide/popupmenu/tabbar \
))
$(eval $(call gb_UIConfig_add_menubarfiles,modules/BasicIDE,\
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index 34f8d3a04ef0..fea24c038ef6 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -23,7 +23,6 @@
#include <svx/svxids.hrc>
#define RID_BASICIDE_OBJECTBAR ( RID_BASICIDE_START + 0 )
-#define RID_POPUP_TABBAR ( RID_BASICIDE_START + 12 )
#define RID_BMP_REMOVEWATCH ( RID_BASICIDE_START + 8 )
#define RID_BMP_INSTALLATION ( RID_BASICIDE_START + 20 )
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 675a0ea57f4a..aa6b7b080527 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -25,7 +25,7 @@
#include "docsignature.hxx"
#include "helpid.hrc"
-#include "baside2.hrc"
+#include <basidesh.hrc>
#include <basic/basmgr.hxx>
#include <basic/basrdll.hxx>
diff --git a/basctl/source/basicide/baside2.hrc b/basctl/source/basicide/baside2.hrc
deleted file mode 100644
index 038b35ca7228..000000000000
--- a/basctl/source/basicide/baside2.hrc
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef BASCTL_BASIDE2_HRC
-#define BASCTL_BASIDE2_HRC
-
-#include <basidesh.hrc>
-
-// Diese Dateien enthaelt nur die lokalen ID's.
-
-// RID_POPUP_TABBAR
-#define RID_INSERT 1
-
-#endif // BASCTL_BASIDE2_HRC
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 56e428069e40..72d656feec2b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -22,7 +22,7 @@
#include <cassert>
#include "helpid.hrc"
-#include "baside2.hrc"
+#include <basidesh.hrc>
#include "baside2.hxx"
#include "brkdlg.hxx"
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 251c91652598..1fe82da30dbe 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -30,6 +30,7 @@
#include <basic/basmgr.hxx>
#include <basic/sbmeth.hxx>
+#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <sfx2/childwin.hxx>
@@ -943,6 +944,42 @@ void Shell::GetState(SfxItemSet &rSet)
}
break;
}
+ case SID_BASICIDE_HIDECURPAGE:
+ {
+ if (pTabBar->GetPageCount() == 0)
+ rSet.DisableItem(nWh);
+ }
+ break;
+ case SID_BASICIDE_DELETECURRENT:
+ case SID_BASICIDE_RENAMECURRENT:
+ {
+ if (pTabBar->GetPageCount() == 0 || StarBASIC::IsRunning())
+ rSet.DisableItem(nWh);
+ else if (m_aCurDocument.isInVBAMode())
+ {
+ // disable to delete or rename object modules in IDE
+ BasicManager* pBasMgr = m_aCurDocument.getBasicManager();
+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib(m_aCurLibName) : nullptr;
+ if (pBasic && dynamic_cast<ModulWindow*>(pCurWin.get()))
+ {
+ SbModule* pActiveModule = pBasic->FindModule( pCurWin->GetName() );
+ if ( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
+ rSet.DisableItem(nWh);
+ }
+ }
+ }
+ SAL_FALLTHROUGH;
+
+ case SID_BASICIDE_NEWMODULE:
+ case SID_BASICIDE_NEWDIALOG:
+ {
+ Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) && xModLibContainer->isLibraryReadOnly( m_aCurLibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( m_aCurLibName ) && xDlgLibContainer->isLibraryReadOnly( m_aCurLibName ) ) )
+ rSet.DisableItem(nWh);
+ }
+ break;
default:
if (pLayout)
pLayout->GetState(rSet, nWh);
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index 5775b6b98d4f..3538b0c1c18c 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <baside2.hrc>
+#include <basidesh.hrc>
#include <helpid.hrc>
#include "dlgresid.hrc"
-#include <sfx2/sfxcommands.h>
-#include <svx/svxcommands.h>
String RID_STR_FILTER_ALLFILES
{
@@ -326,64 +324,6 @@ String RID_STR_SHAREMACROSDIALOGS
Text [ en-US ] = "%PRODUCTNAME Macros & Dialogs" ;
};
-Menu RID_POPUP_TABBAR
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_INSERT ;
- Text [ en-US ] = "Insert" ;
- Submenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_BASICIDE_NEWMODULE ;
- HelpId = CMD_SID_BASICIDE_NEWMODULE ;
- Text [ en-US ] = "BASIC Module" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_NEWDIALOG ;
- HelpId = CMD_SID_BASICIDE_NEWDIALOG ;
- Text [ en-US ] = "BASIC Dialog" ;
- };
- };
- };
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_DELETECURRENT ;
- HelpId = CMD_SID_BASICIDE_DELETECURRENT ;
- Text [ en-US ] = "Delete" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_RENAMECURRENT ;
- HelpId = CMD_SID_BASICIDE_RENAMECURRENT ;
- Text [ en-US ] = "Rename" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_HIDECURPAGE ;
- HelpId = CMD_SID_BASICIDE_HIDECURPAGE ;
- Text [ en-US ] = "Hide" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_MODULEDLG ;
- HelpId = CMD_SID_BASICIDE_MODULEDLG ;
- Text [ en-US ] = "Modules..." ;
- };
- };
-};
-
Bitmap RID_BMP_BRKENABLED
{
File = "im30838.png";
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index a50abbe7585a..4238ebd357c7 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -20,7 +20,7 @@
#include <bastypes.hxx>
#include <bastype2.hxx>
-#include <baside2.hrc>
+#include <basidesh.hrc>
#include <iderid.hxx>
#include <o3tl/make_unique.hxx>
#include <tools/urlobj.hxx>
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 1aabfe999066..ddb7defa8fd6 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -20,7 +20,7 @@
#include <basic/basmgr.hxx>
#include <basic/sbmod.hxx>
#include <bastype2.hxx>
-#include <baside2.hrc>
+#include <basidesh.hrc>
#include <bastypes.hxx>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 92282d76acd0..14381efba979 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -470,60 +470,8 @@ void TabBar::Command( const CommandEvent& rCEvt )
MouseEvent aMouseEvent( aP, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT );
::TabBar::MouseButtonDown( aMouseEvent ); // base class
}
-
- ScopedVclPtrInstance<PopupMenu> aPopup( IDEResId( RID_POPUP_TABBAR ) );
- if ( GetPageCount() == 0 )
- {
- aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_HIDECURPAGE, false);
- }
-
- if ( StarBASIC::IsRunning() )
- {
- aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_MODULEDLG, false);
- }
-
- if (Shell* pShell = GetShell())
- {
- ScriptDocument aDocument( pShell->GetCurDocument() );
- OUString aOULibName( pShell->GetCurLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
- {
- aPopup->EnableItem(aPopup->GetItemId( 0 ), false);
- aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
- aPopup->RemoveDisabledEntries();
- }
- if ( aDocument.isInVBAMode() )
- {
- // disable to delete or remove object modules in IDE
- if (BasicManager* pBasMgr = aDocument.getBasicManager())
- {
- if (StarBASIC* pBasic = pBasMgr->GetLib(aOULibName))
- {
- Shell::WindowTable& aWindowTable = pShell->GetWindowTable();
- Shell::WindowTableIt it = aWindowTable.find( GetCurPageId() );
- if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second.get()))
- {
- SbModule* pActiveModule = pBasic->FindModule( it->second->GetName() );
- if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
- {
- aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
- aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
- }
- }
- }
- }
- }
- }
if (SfxDispatcher* pDispatcher = GetDispatcher())
- pDispatcher->Execute(aPopup->Execute(this, aPos));
+ pDispatcher->ExecutePopup("tabbar", this, &aPos);
}
}
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 88dd8e6c46c8..2f417b10e4fb 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -21,7 +21,7 @@
#include <macrodlg.hxx>
#include <macrodlg.hrc>
#include <basidesh.hxx>
-#include <baside2.hrc>
+#include <basidesh.hrc>
#include <iderdll.hxx>
#include <iderdll2.hxx>
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 3e7842aea543..0a2f4214d047 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -20,7 +20,7 @@
#include <moduldlg.hxx>
#include <basidesh.hxx>
-#include <baside2.hrc>
+#include <basidesh.hrc>
#include <iderdll.hxx>
#include <iderdll2.hxx>
#include <o3tl/make_unique.hxx>
diff --git a/basctl/uiconfig/basicide/popupmenu/tabbar.xml b/basctl/uiconfig/basicide/popupmenu/tabbar.xml
new file mode 100644
index 000000000000..1e0991f16a0c
--- /dev/null
+++ b/basctl/uiconfig/basicide/popupmenu/tabbar.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+ <menu:menu menu:id=".uno:InsertMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:NewModule"/>
+ <menu:menuitem menu:id=".uno:NewDialog"/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:DeleteCurrent"/>
+ <menu:menuitem menu:id=".uno:RenameCurrent"/>
+ <menu:menuitem menu:id=".uno:HideCurPage"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:ModuleDialog"/>
+</menu:menupopup>