Kaydet (Commit) b2764a9b authored tarafından Noel Grandin's avatar Noel Grandin

convert EDynamicMenuType to scoped enum

and drop unused E_HELPBOOKMARKS

Change-Id: I5756ea326bdc1a99f7d6f1ba43baf6aca9f7f2fc
Reviewed-on: https://gerrit.libreoffice.org/36728Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2373babc
...@@ -166,7 +166,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList () ...@@ -166,7 +166,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
EnterWait(); EnterWait();
uno::Sequence< uno::Sequence< beans::PropertyValue > > uno::Sequence< uno::Sequence< beans::PropertyValue > >
aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( E_NEWMENU ) ); aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( EDynamicMenuType::NewMenu ) );
sal_uInt32 i, nCount = aDynamicMenuEntries.getLength(); sal_uInt32 i, nCount = aDynamicMenuEntries.getLength();
for ( i = 0; i < nCount; i++ ) for ( i = 0; i < nCount; i++ )
......
...@@ -322,7 +322,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup ...@@ -322,7 +322,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup
return; return;
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aDynamicMenuEntries = 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 aTitle;
OUString aURL; OUString aURL;
......
...@@ -39,11 +39,10 @@ ...@@ -39,11 +39,10 @@
/*-************************************************************************************************************ /*-************************************************************************************************************
@descr You can use these enum values to specify right menu if you call our interface methods. @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, NewMenu = 0,
E_WIZARDMENU = 1, WizardMenu = 1
E_HELPBOOKMARKS = 2
}; };
/*-************************************************************************************************************ /*-************************************************************************************************************
......
...@@ -408,7 +408,7 @@ void aqua_init_systray() ...@@ -408,7 +408,7 @@ void aqua_init_systray()
SvtModuleOptions aModuleOptions; SvtModuleOptions aModuleOptions;
std::set< rtl::OUString > aFileNewAppsAvailable; std::set< rtl::OUString > aFileNewAppsAvailable;
SvtDynamicMenuOptions aOpt; 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 >* pNewMenu = aNewMenu.getConstArray();
const css::uno::Sequence< css::beans::PropertyValue >* pNewMenuEnd = aNewMenu.getConstArray() + aNewMenu.getLength(); const css::uno::Sequence< css::beans::PropertyValue >* pNewMenuEnd = aNewMenu.getConstArray() + aNewMenu.getLength();
......
...@@ -155,7 +155,7 @@ static void add_ugly_db_item( GtkMenuShell *pMenuShell, const char *pAsciiURL, ...@@ -155,7 +155,7 @@ static void add_ugly_db_item( GtkMenuShell *pMenuShell, const char *pAsciiURL,
sal_uInt16 nResId, GCallback pFnCallback ) sal_uInt16 nResId, GCallback pFnCallback )
{ {
SvtDynamicMenuOptions aOpt; 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++ ) for ( sal_Int32 n=0; n<aMenu.getLength(); n++ )
{ {
OUString aURL; OUString aURL;
......
...@@ -149,7 +149,7 @@ static HMENU createSystrayMenu( ) ...@@ -149,7 +149,7 @@ static HMENU createSystrayMenu( )
// collect the URLs of the entries in the File/New menu // collect the URLs of the entries in the File/New menu
::std::set< OUString > aFileNewAppsAvailable; ::std::set< OUString > aFileNewAppsAvailable;
SvtDynamicMenuOptions aOpt; SvtDynamicMenuOptions aOpt;
Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU ); Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
const OUString sURLKey( "URL" ); const OUString sURLKey( "URL" );
const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray(); const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray();
......
...@@ -221,7 +221,7 @@ void BackingWindow::initControls() ...@@ -221,7 +221,7 @@ void BackingWindow::initControls()
SvtModuleOptions aModuleOptions; SvtModuleOptions aModuleOptions;
std::set< OUString > aFileNewAppsAvailable; std::set< OUString > aFileNewAppsAvailable;
SvtDynamicMenuOptions aOpt; SvtDynamicMenuOptions aOpt;
Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( E_NEWMENU ); Sequence < Sequence < PropertyValue > > aNewMenu = aOpt.GetMenu( EDynamicMenuType::NewMenu );
const OUString sURLKey( "URL" ); const OUString sURLKey( "URL" );
const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray(); const Sequence< PropertyValue >* pNewMenu = aNewMenu.getConstArray();
......
...@@ -129,25 +129,25 @@ void TestApplication::impl_testDynamicMenuOptions() ...@@ -129,25 +129,25 @@ void TestApplication::impl_testDynamicMenuOptions()
// } // }
// output content // output content
Sequence< Sequence< PropertyValue > > lNewMenu = aCFG.GetMenu( E_NEWMENU ); Sequence< Sequence< PropertyValue > > lNewMenu = aCFG.GetMenu( EDynamicMenuType::NewMenu );
Sequence< Sequence< PropertyValue > > lWizardMenu = aCFG.GetMenu( E_WIZARDMENU ); Sequence< Sequence< PropertyValue > > lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
if( lNewMenu.getLength() < 1 ) if( lNewMenu.getLength() < 1 )
{ {
aCFG.AppendItem( E_NEWMENU, "private:factory/swriter", "new writer", "icon_writer", "_blank"); aCFG.AppendItem( EDynamicMenuType::NewMenu, "private:factory/swriter", "new writer", "icon_writer", "_blank");
aCFG.AppendItem( E_NEWMENU, "private:factory/scalc", "new calc", "icon_calc", "_blank"); aCFG.AppendItem( EDynamicMenuType::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/sdraw", "new draw", "icon_draw", "_blank");
lNewMenu = aCFG.GetMenu( E_NEWMENU ); lNewMenu = aCFG.GetMenu( EDynamicMenuType::NewMenu );
} }
if( lWizardMenu.getLength() < 1 ) if( lWizardMenu.getLength() < 1 )
{ {
aCFG.AppendItem( E_WIZARDMENU, "file://a", "system file", "icon_file", "_self"); aCFG.AppendItem( EDynamicMenuType::WizardMenu, "file://a", "system file", "icon_file", "_self");
aCFG.AppendItem( E_WIZARDMENU, "ftp://b", "ftp host", "icon_ftp", "_self"); aCFG.AppendItem( EDynamicMenuType::WizardMenu, "ftp://b", "ftp host", "icon_ftp", "_self");
aCFG.AppendItem( E_WIZARDMENU, "http://c", "www", "icon_www", "_self"); aCFG.AppendItem( EDynamicMenuType::WizardMenu, "http://c", "www", "icon_www", "_self");
lWizardMenu = aCFG.GetMenu( E_WIZARDMENU ); lWizardMenu = aCFG.GetMenu( EDynamicMenuType::WizardMenu );
} }
sal_uInt32 nItemCount ; sal_uInt32 nItemCount ;
......
...@@ -45,7 +45,6 @@ using namespace ::com::sun::star::beans; ...@@ -45,7 +45,6 @@ using namespace ::com::sun::star::beans;
#define SETNODE_NEWMENU "New" #define SETNODE_NEWMENU "New"
#define SETNODE_WIZARDMENU "Wizard" #define SETNODE_WIZARDMENU "Wizard"
#define SETNODE_HELPBOOKMARKS "HelpBookmarks"
#define PROPERTYNAME_URL DYNAMICMENU_PROPERTYNAME_URL #define PROPERTYNAME_URL DYNAMICMENU_PROPERTYNAME_URL
#define PROPERTYNAME_TITLE DYNAMICMENU_PROPERTYNAME_TITLE #define PROPERTYNAME_TITLE DYNAMICMENU_PROPERTYNAME_TITLE
...@@ -191,7 +190,7 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem ...@@ -191,7 +190,7 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem
@return A list of configuration key names is returned. @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 @short sort given source list and expand it for all well known properties to destination
...@@ -240,7 +239,6 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem ...@@ -240,7 +239,6 @@ class SvtDynamicMenuOptions_Impl : public ConfigItem
SvtDynMenu m_aNewMenu; SvtDynMenu m_aNewMenu;
SvtDynMenu m_aWizardMenu; SvtDynMenu m_aWizardMenu;
SvtDynMenu m_aHelpBookmarksMenu;
}; };
// constructor // constructor
...@@ -254,10 +252,8 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl() ...@@ -254,10 +252,8 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()
// See impl_GetPropertyNames() for further information. // See impl_GetPropertyNames() for further information.
sal_uInt32 nNewCount = 0; sal_uInt32 nNewCount = 0;
sal_uInt32 nWizardCount = 0; sal_uInt32 nWizardCount = 0;
sal_uInt32 nHelpBookmarksCount = 0;
Sequence< OUString > lNames = impl_GetPropertyNames ( nNewCount , Sequence< OUString > lNames = impl_GetPropertyNames ( nNewCount ,
nWizardCount , nWizardCount );
nHelpBookmarksCount );
Sequence< Any > lValues = GetProperties ( lNames ); Sequence< Any > lValues = GetProperties ( lNames );
// Safe impossible cases. // Safe impossible cases.
...@@ -327,22 +323,6 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl() ...@@ -327,22 +323,6 @@ SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()
// Attention: Don't reset nPosition here! // 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() ... /*TODO: Not used in the moment! see Notify() ...
// Enable notification mechanism of our baseclass. // Enable notification mechanism of our baseclass.
// We need it to get information about changes outside these class on our used configuration keys! // We need it to get information about changes outside these class on our used configuration keys!
...@@ -374,7 +354,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit() ...@@ -374,7 +354,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit()
// Delete complete sets first. // Delete complete sets first.
ClearNodeSet( SETNODE_NEWMENU ); ClearNodeSet( SETNODE_NEWMENU );
ClearNodeSet( SETNODE_WIZARDMENU ); ClearNodeSet( SETNODE_WIZARDMENU );
ClearNodeSet( SETNODE_HELPBOOKMARKS );
MenuEntry aItem; MenuEntry aItem;
OUString sNode; OUString sNode;
...@@ -427,28 +406,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit() ...@@ -427,28 +406,6 @@ void SvtDynamicMenuOptions_Impl::ImplCommit()
SetSetProperties( SETNODE_WIZARDMENU, lPropertyValues ); 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 ...@@ -459,43 +416,33 @@ Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions_Impl::GetMenu( EDyna
Sequence< Sequence< PropertyValue > > lReturn; Sequence< Sequence< PropertyValue > > lReturn;
switch( eMenu ) switch( eMenu )
{ {
case E_NEWMENU : { case EDynamicMenuType::NewMenu :
lReturn = m_aNewMenu.GetList(); lReturn = m_aNewMenu.GetList();
} break;
break;
case EDynamicMenuType::WizardMenu :
case E_WIZARDMENU : { lReturn = m_aWizardMenu.GetList();
lReturn = m_aWizardMenu.GetList(); break;
}
break;
case E_HELPBOOKMARKS : {
lReturn = m_aHelpBookmarksMenu.GetList();
}
break;
} }
return lReturn; return lReturn;
} }
// private method // 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! // First get ALL names of current existing list items in configuration!
Sequence< OUString > lNewItems = GetNodeNames( SETNODE_NEWMENU ); Sequence< OUString > lNewItems = GetNodeNames( SETNODE_NEWMENU );
Sequence< OUString > lWizardItems = GetNodeNames( SETNODE_WIZARDMENU ); Sequence< OUString > lWizardItems = GetNodeNames( SETNODE_WIZARDMENU );
Sequence< OUString > lHelpBookmarksItems = GetNodeNames( SETNODE_HELPBOOKMARKS );
// Get information about list counts ... // Get information about list counts ...
nNewCount = lNewItems.getLength (); nNewCount = lNewItems.getLength ();
nWizardCount = lWizardItems.getLength (); nWizardCount = lWizardItems.getLength ();
nHelpBookmarksCount = lHelpBookmarksItems.getLength();
// Sort and expand all three list to result list ... // Sort and expand all three list to result list ...
Sequence< OUString > lProperties; Sequence< OUString > lProperties;
impl_SortAndExpandPropertyNames( lNewItems , lProperties, SETNODE_NEWMENU ); impl_SortAndExpandPropertyNames( lNewItems , lProperties, SETNODE_NEWMENU );
impl_SortAndExpandPropertyNames( lWizardItems , lProperties, SETNODE_WIZARDMENU ); impl_SortAndExpandPropertyNames( lWizardItems , lProperties, SETNODE_WIZARDMENU );
impl_SortAndExpandPropertyNames( lHelpBookmarksItems, lProperties, SETNODE_HELPBOOKMARKS );
// Return result. // Return result.
return lProperties; return lProperties;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment