[Libreoffice-commits] core.git: cui/source framework/source include/unotools sfx2/source svtools/source unotools/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Apr 20 10:56:16 UTC 2017


 cui/source/dialogs/hldocntp.cxx                  |    2 
 framework/source/uielement/newmenucontroller.cxx |    2 
 include/unotools/dynamicmenuoptions.hxx          |    7 --
 sfx2/source/appl/shutdowniconaqua.mm             |    2 
 sfx2/source/appl/shutdowniconunx.cxx             |    2 
 sfx2/source/appl/shutdowniconw32.cxx             |    2 
 sfx2/source/dialog/backingwindow.cxx             |    2 
 svtools/source/config/test/test.cxx              |   20 +++---
 unotools/source/config/dynamicmenuoptions.cxx    |   73 +++--------------------
 9 files changed, 29 insertions(+), 83 deletions(-)

New commits:
commit b2764a9b66d1bab85256e5f9c3577b994448ce4a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Apr 20 12:17:30 2017 +0200

    convert EDynamicMenuType to scoped enum
    
    and drop unused E_HELPBOOKMARKS
    
    Change-Id: I5756ea326bdc1a99f7d6f1ba43baf6aca9f7f2fc
    Reviewed-on: https://gerrit.libreoffice.org/36728
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 6015ef853ad8..efe4ccc75969 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -166,7 +166,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
     EnterWait();
 
     uno::Sequence< uno::Sequence< beans::PropertyValue > >
-        aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( E_NEWMENU ) );
+        aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( EDynamicMenuType::NewMenu ) );
 
     sal_uInt32 i, nCount = aDynamicMenuEntries.getLength();
     for ( i = 0; i < nCount; i++ )
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index 0d2fa663aeb4..ddc51da96d3b 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -322,7 +322,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup
             return;
 
         css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aDynamicMenuEntries =
-            SvtDynamicMenuOptions().GetMenu( m_bNewMenu ? E_NEWMENU : E_WIZARDMENU );
+            SvtDynamicMenuOptions().GetMenu( m_bNewMenu ? EDynamicMenuType::NewMenu : EDynamicMenuType::WizardMenu );
 
         OUString aTitle;
         OUString aURL;
diff --git a/include/unotools/dynamicmenuoptions.hxx b/include/unotools/dynamicmenuoptions.hxx
index a7dfd8b813f2..56ada999fac6 100644
--- a/include/unotools/dynamicmenuoptions.hxx
+++ b/include/unotools/dynamicmenuoptions.hxx
@@ -39,11 +39,10 @@
 /*-************************************************************************************************************
     @descr          You can use these enum values to specify right menu if you call our interface methods.
 *//*-*************************************************************************************************************/
-enum EDynamicMenuType
+enum class EDynamicMenuType
 {
-    E_NEWMENU       =   0,
-    E_WIZARDMENU    =   1,
-    E_HELPBOOKMARKS =   2
+    NewMenu       =   0,
+    WizardMenu    =   1
 };
 
 /*-************************************************************************************************************
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index cd69b46a70fe..2b082b6457dd 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -408,7 +408,7 @@ void aqua_init_systray()
             SvtModuleOptions    aModuleOptions;
             std::set< rtl::OUString > aFileNewAppsAvailable;
             SvtDynamicMenuOptions aOpt;
-            css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU );
+            css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
 
             const css::uno::Sequence< css::beans::PropertyValue >* pNewMenu = aNewMenu.getConstArray();
             const css::uno::Sequence< css::beans::PropertyValue >* pNewMenuEnd = aNewMenu.getConstArray() + aNewMenu.getLength();
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx
index 9b5e53f5d544..fd5aa1d069f2 100644
--- a/sfx2/source/appl/shutdowniconunx.cxx
+++ b/sfx2/source/appl/shutdowniconunx.cxx
@@ -155,7 +155,7 @@ static void add_ugly_db_item( GtkMenuShell *pMenuShell, const char *pAsciiURL,
                               sal_uInt16 nResId, GCallback pFnCallback )
 {
     SvtDynamicMenuOptions aOpt;
-    Sequence < Sequence < PropertyValue > > aMenu = aOpt.GetMenu( E_NEWMENU );
+    Sequence < Sequence < PropertyValue > > aMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
     for ( sal_Int32 n=0; n<aMenu.getLength(); n++ )
     {
         OUString aURL;
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index cf8d1255d808..4c80752aaad8 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -149,7 +149,7 @@ static HMENU createSystrayMenu( )
     // collect the URLs of the entries in the File/New menu
     ::std::set< OUString > aFileNewAppsAvailable;
     SvtDynamicMenuOptions aOpt;
-    Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU );
+    Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
     const OUString sURLKey( "URL"  );
 
     const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray();
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 966bab0ef268..142a571b6e45 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -221,7 +221,7 @@ void BackingWindow::initControls()
     SvtModuleOptions    aModuleOptions;
     std::set< OUString > aFileNewAppsAvailable;
     SvtDynamicMenuOptions aOpt;
-    Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU );
+    Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
     const OUString sURLKey( "URL"  );
 
     const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray();
diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx
index 362089fb4e66..4fd54c54142e 100644
--- a/svtools/source/config/test/test.cxx
+++ b/svtools/source/config/test/test.cxx
@@ -129,25 +129,25 @@ void TestApplication::impl_testDynamicMenuOptions()
     //      }
     //      output content
 
-    Sequence< Sequence< PropertyValue > > lNewMenu    = aCFG.GetMenu( E_NEWMENU    );
-    Sequence< Sequence< PropertyValue > > lWizardMenu = aCFG.GetMenu( E_WIZARDMENU );
+    Sequence< Sequence< PropertyValue > > lNewMenu    = aCFG.GetMenu( EDynamicMenuType::NewMenu    );
+    Sequence< Sequence< PropertyValue > > lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
 
     if( lNewMenu.getLength() < 1 )
     {
-        aCFG.AppendItem( E_NEWMENU, "private:factory/swriter", "new writer", "icon_writer", "_blank");
-        aCFG.AppendItem( E_NEWMENU, "private:factory/scalc",   "new calc",   "icon_calc",   "_blank");
-        aCFG.AppendItem( E_NEWMENU, "private:factory/sdraw",   "new draw",   "icon_draw",   "_blank");
+        aCFG.AppendItem( EDynamicMenuType::NewMenu, "private:factory/swriter", "new writer", "icon_writer", "_blank");
+        aCFG.AppendItem( EDynamicMenuType::NewMenu, "private:factory/scalc",   "new calc",   "icon_calc",   "_blank");
+        aCFG.AppendItem( EDynamicMenuType::NewMenu, "private:factory/sdraw",   "new draw",   "icon_draw",   "_blank");
 
-        lNewMenu = aCFG.GetMenu( E_NEWMENU );
+        lNewMenu = aCFG.GetMenu( EDynamicMenuType::NewMenu );
     }
 
     if( lWizardMenu.getLength() < 1 )
     {
-        aCFG.AppendItem( E_WIZARDMENU, "file://a", "system file", "icon_file", "_self");
-        aCFG.AppendItem( E_WIZARDMENU, "ftp://b",  "ftp host",    "icon_ftp",  "_self");
-        aCFG.AppendItem( E_WIZARDMENU, "http://c", "www",         "icon_www",  "_self");
+        aCFG.AppendItem( EDynamicMenuType::WizardMenu, "file://a", "system file", "icon_file", "_self");
+        aCFG.AppendItem( EDynamicMenuType::WizardMenu, "ftp://b",  "ftp host",    "icon_ftp",  "_self");
+        aCFG.AppendItem( EDynamicMenuType::WizardMenu, "http://c", "www",         "icon_www",  "_self");
 
-        lWizardMenu = aCFG.GetMenu( E_WIZARDMENU );
+        lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
     }
 
     sal_uInt32     nItemCount    ;
diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx
index efce8d09ba2b..68e09e420af9 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -45,7 +45,6 @@ using namespace ::com::sun::star::beans;
 
 #define SETNODE_NEWMENU                                 "New"
 #define SETNODE_WIZARDMENU                              "Wizard"
-#define SETNODE_HELPBOOKMARKS                           "HelpBookmarks"
 
 #define PROPERTYNAME_URL                                DYNAMICMENU_PROPERTYNAME_URL
 #define PROPERTYNAME_TITLE                              DYNAMICMENU_PROPERTYNAME_TITLE
@@ -191,7 +190,7 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem
             @return     A list of configuration key names is returned.
         *//*-*****************************************************************************************************/
 
-        Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount );
+        Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount );
 
         /*-****************************************************************************************************
             @short      sort given source list and expand it for all well known properties to destination
@@ -240,7 +239,6 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem
 
         SvtDynMenu  m_aNewMenu;
         SvtDynMenu  m_aWizardMenu;
-        SvtDynMenu  m_aHelpBookmarksMenu;
 };
 
 //  constructor
@@ -254,10 +252,8 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()
     // See impl_GetPropertyNames() for further information.
     sal_uInt32              nNewCount           = 0;
     sal_uInt32              nWizardCount        = 0;
-    sal_uInt32              nHelpBookmarksCount = 0;
     Sequence< OUString >    lNames              = impl_GetPropertyNames ( nNewCount           ,
-                                                                          nWizardCount        ,
-                                                                          nHelpBookmarksCount );
+                                                                          nWizardCount        );
     Sequence< Any >         lValues             = GetProperties         ( lNames              );
 
     // Safe impossible cases.
@@ -327,22 +323,6 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()
 
     // Attention: Don't reset nPosition here!
 
-    // Get names/values for wizard menu.
-    // 4 subkeys for every item!
-    for( nItem=0; nItem<nHelpBookmarksCount; ++nItem )
-    {
-        SvtDynMenuEntry   aItem;
-        lValues[nPosition] >>= aItem.sURL;
-        ++nPosition;
-        lValues[nPosition] >>= aItem.sTitle;
-        ++nPosition;
-        lValues[nPosition] >>= aItem.sImageIdentifier;
-        ++nPosition;
-        lValues[nPosition] >>= aItem.sTargetName;
-        ++nPosition;
-        m_aHelpBookmarksMenu.AppendSetupEntry( aItem );
-    }
-
 /*TODO: Not used in the moment! see Notify() ...
     // Enable notification mechanism of our baseclass.
     // We need it to get information about changes outside these class on our used configuration keys!
@@ -374,7 +354,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit()
     // Delete complete sets first.
     ClearNodeSet( SETNODE_NEWMENU    );
     ClearNodeSet( SETNODE_WIZARDMENU );
-    ClearNodeSet( SETNODE_HELPBOOKMARKS );
 
     MenuEntry                    aItem;
     OUString                    sNode;
@@ -427,28 +406,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit()
         SetSetProperties( SETNODE_WIZARDMENU, lPropertyValues );
     }
 
-    // Copy help bookmarks entries to save-list!
-    sal_uInt32 nHelpBookmarksCount = m_aHelpBookmarksMenu.size();
-    for( nItem=0; nItem<nHelpBookmarksCount; ++nItem )
-    {
-        aItem = m_aHelpBookmarksMenu[nItem];
-        // Format:  "HelpBookmarks/1/URL"
-        //          "HelpBookmarks/1/Title"
-        //          ...
-        sNode = SETNODE_HELPBOOKMARKS + PATHDELIMITER + PATHPREFIX + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
-
-        lPropertyValues[OFFSET_URL             ].Name  =   sNode + PROPERTYNAME_URL;
-        lPropertyValues[OFFSET_TITLE           ].Name  =   sNode + PROPERTYNAME_TITLE;
-        lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Name  =   sNode + PROPERTYNAME_IMAGEIDENTIFIER;
-        lPropertyValues[OFFSET_TARGETNAME      ].Name  =   sNode + PROPERTYNAME_TARGETNAME;
-
-        lPropertyValues[OFFSET_URL             ].Value <<= aItem.sURL;
-        lPropertyValues[OFFSET_TITLE           ].Value <<= aItem.sTitle;
-        lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Value <<= aItem.sImageIdentifier;
-        lPropertyValues[OFFSET_TARGETNAME      ].Value <<= aItem.sTargetName;
-
-        SetSetProperties( SETNODE_HELPBOOKMARKS, lPropertyValues );
-    }
     */
 }
 
@@ -459,43 +416,33 @@ Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions_Impl::GetMenu( EDyna
     Sequence< Sequence< PropertyValue > > lReturn;
     switch( eMenu )
     {
-        case E_NEWMENU      :   {
-                                    lReturn = m_aNewMenu.GetList();
-                                }
-                                break;
-
-        case E_WIZARDMENU   :   {
-                                    lReturn = m_aWizardMenu.GetList();
-                                }
-                                break;
-
-        case E_HELPBOOKMARKS :  {
-                                    lReturn = m_aHelpBookmarksMenu.GetList();
-                                }
-                                break;
+        case EDynamicMenuType::NewMenu      :
+            lReturn = m_aNewMenu.GetList();
+            break;
+
+        case EDynamicMenuType::WizardMenu   :
+            lReturn = m_aWizardMenu.GetList();
+            break;
     }
     return lReturn;
 }
 
 //  private method
 
-Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount )
+Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount )
 {
     // First get ALL names of current existing list items in configuration!
     Sequence< OUString > lNewItems           = GetNodeNames( SETNODE_NEWMENU       );
     Sequence< OUString > lWizardItems        = GetNodeNames( SETNODE_WIZARDMENU    );
-    Sequence< OUString > lHelpBookmarksItems = GetNodeNames( SETNODE_HELPBOOKMARKS );
 
     // Get information about list counts ...
     nNewCount           = lNewItems.getLength          ();
     nWizardCount        = lWizardItems.getLength       ();
-    nHelpBookmarksCount = lHelpBookmarksItems.getLength();
 
     // Sort and expand all three list to result list ...
     Sequence< OUString > lProperties;
     impl_SortAndExpandPropertyNames( lNewItems          , lProperties, SETNODE_NEWMENU       );
     impl_SortAndExpandPropertyNames( lWizardItems       , lProperties, SETNODE_WIZARDMENU    );
-    impl_SortAndExpandPropertyNames( lHelpBookmarksItems, lProperties, SETNODE_HELPBOOKMARKS );
 
     // Return result.
     return lProperties;


More information about the Libreoffice-commits mailing list