Convert RID_POPUP_TABBAR to xml

Change-Id: Ic4587b8e244c52089692908fe0d10e363b5ed4fb
This commit is contained in:
Maxim Monastirsky 2017-02-01 01:25:36 +02:00
parent 21f632d327
commit f3ba0c5d4d
17 changed files with 101 additions and 158 deletions

View file

@ -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,\

View file

@ -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 )

View file

@ -25,7 +25,7 @@
#include "docsignature.hxx"
#include "helpid.hrc"
#include "baside2.hrc"
#include <basidesh.hrc>
#include <basic/basmgr.hxx>
#include <basic/basrdll.hxx>

View file

@ -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: */

View file

@ -22,7 +22,7 @@
#include <cassert>
#include "helpid.hrc"
#include "baside2.hrc"
#include <basidesh.hrc>
#include "baside2.hxx"
#include "brkdlg.hxx"

View file

@ -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);

View file

@ -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";

View file

@ -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>

View file

@ -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>

View file

@ -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);
}
}

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -69,6 +69,31 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:NewModule" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">BASIC Module</value>
</prop>
</node>
<node oor:name=".uno:NewDialog" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">BASIC Dialog</value>
</prop>
</node>
<node oor:name=".uno:DeleteCurrent" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Delete</value>
</prop>
</node>
<node oor:name=".uno:RenameCurrent" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Rename</value>
</prop>
</node>
<node oor:name=".uno:HideCurPage" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Hide</value>
</prop>
</node>
</node>
<node oor:name="Popups"/>
</node>

View file

@ -25,6 +25,11 @@
<value xml:lang="en-US">Dialog</value>
</prop>
</node>
<node oor:name="private:resource/popupmenu/tabbar" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
<value xml:lang="en-US">Tab Bar</value>
</prop>
</node>
<node oor:name="private:resource/toolbar/standardbar" oor:op="replace">
<prop oor:name="DockPos" oor:type="xs:string">
<value>0,0</value>

View file

@ -1498,6 +1498,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Select Module</value>
</prop>
<prop oor:name="PopupLabel" oor:type="xs:string">
<value xml:lang="en-US">Modules...</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>