[Libreoffice-commits] core.git: basctl/inc basctl/source basctl/uiconfig basctl/UIConfig_basicide.mk include/sfx2 officecfg/registry

Maxim Monastirsky momonasmon at gmail.com
Tue Jan 31 23:37:59 UTC 2017


 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 
 officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu    |   25 ++++
 officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu |    5 
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu     |    3 
 17 files changed, 101 insertions(+), 158 deletions(-)

New commits:
commit f3ba0c5d4dfc44f72aa7d4809c062227649f098f
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Feb 1 01:25:36 2017 +0200

    Convert RID_POPUP_TABBAR to xml
    
    Change-Id: Ic4587b8e244c52089692908fe0d10e363b5ed4fb

diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk
index f79d9ce..97ced73 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 34f8d3a..fea24c0 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 675a0ea..aa6b7b0 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 038b35c..0000000
--- 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 56e4280..72d656f 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 251c916..1fe82da 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 5775b6b..3538b0c 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 a50abbe..4238ebd 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 1aabfe9..ddb7def 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 92282d7..14381ef 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 88dd8e6..2f417b1 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 3e7842a..0a2f421 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 0000000..1e0991f
--- /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>
diff --git a/include/sfx2/sfxcommands.h b/include/sfx2/sfxcommands.h
index 099dfbf..6ae8b69 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 45c1914..7df7d91 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 @@
           <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>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDEWindowState.xcu
index df5a35d..742dfdd 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 @@
           <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>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index dd01901..3c495e6 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 @@
         <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>


More information about the Libreoffice-commits mailing list