From f3ba0c5d4dfc44f72aa7d4809c062227649f098f Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Wed, 1 Feb 2017 01:25:36 +0200 Subject: [PATCH] Convert RID_POPUP_TABBAR to xml Change-Id: Ic4587b8e244c52089692908fe0d10e363b5ed4fb --- basctl/UIConfig_basicide.mk | 1 + basctl/inc/basidesh.hrc | 1 - basctl/source/basicide/baside2.cxx | 2 +- basctl/source/basicide/baside2.hrc | 31 ---------- basctl/source/basicide/baside2b.cxx | 2 +- basctl/source/basicide/basides1.cxx | 37 +++++++++++ basctl/source/basicide/basidesh.src | 62 +------------------ basctl/source/basicide/bastype2.cxx | 2 +- basctl/source/basicide/bastype3.cxx | 2 +- basctl/source/basicide/bastypes.cxx | 54 +--------------- basctl/source/basicide/macrodlg.cxx | 2 +- basctl/source/basicide/moduldl2.cxx | 2 +- basctl/uiconfig/basicide/popupmenu/tabbar.xml | 22 +++++++ include/sfx2/sfxcommands.h | 6 -- .../openoffice/Office/UI/BasicIDECommands.xcu | 25 ++++++++ .../Office/UI/BasicIDEWindowState.xcu | 5 ++ .../openoffice/Office/UI/GenericCommands.xcu | 3 + 17 files changed, 101 insertions(+), 158 deletions(-) delete mode 100644 basctl/source/basicide/baside2.hrc create mode 100644 basctl/uiconfig/basicide/popupmenu/tabbar.xml 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 #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 #include #include 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 - -// 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 #include "helpid.hrc" -#include "baside2.hrc" +#include #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 #include +#include #include #include #include @@ -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(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 +#include #include #include "dlgresid.hrc" -#include -#include 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 #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include #include 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 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(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 #include #include -#include +#include #include #include 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 #include -#include +#include #include #include #include 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 @@ + + + + + + + + + + + + + + + diff --git a/include/sfx2/sfxcommands.h b/include/sfx2/sfxcommands.h index 099dfbf04feb..6ae8b6972287 100644 --- a/include/sfx2/sfxcommands.h +++ b/include/sfx2/sfxcommands.h @@ -22,18 +22,12 @@ #define CMD_SID_BROWSE_BACKWARD ".uno:BrowseBackward" #define CMD_SID_BROWSE_FORWARD ".uno:BrowseForward" #define CMD_SID_COPY ".uno:Copy" -#define CMD_SID_BASICIDE_DELETECURRENT ".uno:DeleteCurrent" #define CMD_SID_EDITDOC ".uno:EditDoc" #define CMD_SID_WIN_FULLSCREEN ".uno:FullScreen" -#define CMD_SID_BASICIDE_HIDECURPAGE ".uno:HideCurPage" -#define CMD_SID_BASICIDE_MODULEDLG ".uno:ModuleDialog" -#define CMD_SID_BASICIDE_NEWDIALOG ".uno:NewDialog" -#define CMD_SID_BASICIDE_NEWMODULE ".uno:NewModule" #define CMD_SID_OPENDOC ".uno:Open" #define CMD_SID_GALLERY_BG_BRUSH ".uno:BackgroundImage" #define CMD_SID_PASTE ".uno:Paste" #define CMD_SID_RELOAD ".uno:Reload" -#define CMD_SID_BASICIDE_RENAMECURRENT ".uno:RenameCurrent" #endif diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu index 45c1914a9513..7df7d91debb7 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu @@ -69,6 +69,31 @@ 1 + + + BASIC Module + + + + + BASIC Dialog + + + + + Delete + + + + + Rename + + + + + Hide + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu index df5a35de1f35..742dfddd0ef0 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu @@ -25,6 +25,11 @@ Dialog + + + Tab Bar + + 0,0 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index dd019018e120..3c495e6de2ce 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1498,6 +1498,9 @@ Select Module + + Modules... + 1