framework/source/fwe/classes/addonmenu.cxx | 2 +- framework/source/fwe/xml/menuconfiguration.cxx | 12 ++++++------ framework/source/uielement/menubarmanager.cxx | 8 ++++---- framework/source/uielement/newmenucontroller.cxx | 10 +++++----- framework/source/uielement/popuptoolbarcontroller.cxx | 2 +- framework/source/uielement/toolbarsmenucontroller.cxx | 2 +- include/framework/menuconfiguration.hxx | 6 +++--- include/vcl/menu.hxx | 6 +++--- vcl/source/window/menu.cxx | 8 ++++---- vcl/source/window/menuitemlist.cxx | 4 ++-- vcl/source/window/menuitemlist.hxx | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-)
New commits: commit 6847deb1f7c68cf0402ccbc61c42ca5d285d3a61 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Dec 12 15:33:40 2017 +0200 sal_uLong->void* for userdata in Menu Change-Id: I58fb10136a23c445edfd63a1f86ace3995524704 Reviewed-on: https://gerrit.libreoffice.org/46350 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index a044870378a8..2fddbebe1aee 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -255,7 +255,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent // Store values from configuration to the New and Wizard menu entries to enable // sfx2 based code to support high contrast mode correctly! - sal_uIntPtr nAttributePtr = MenuAttributes::CreateAttribute(aTarget, aImageId); + void* nAttributePtr = MenuAttributes::CreateAttribute(aTarget, aImageId); pCurrentMenu->SetUserValue(nId, nAttributePtr, MenuAttributes::ReleaseAttribute); pCurrentMenu->SetItemCommand( nId, aURL ); diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx index d64a9793663d..dead1239926f 100644 --- a/framework/source/fwe/xml/menuconfiguration.cxx +++ b/framework/source/fwe/xml/menuconfiguration.cxx @@ -124,25 +124,25 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML( } } -sal_uIntPtr MenuAttributes::CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr) +void* MenuAttributes::CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr) { MenuAttributes* pAttributes = new MenuAttributes(rFrame, rImageIdStr); pAttributes->acquire(); - return reinterpret_cast<sal_uIntPtr>(pAttributes); + return pAttributes; } -sal_uIntPtr MenuAttributes::CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider) +void* MenuAttributes::CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider) { MenuAttributes* pAttributes = new MenuAttributes(rDispatchProvider); pAttributes->acquire(); - return reinterpret_cast<sal_uIntPtr>(pAttributes); + return pAttributes; } -void MenuAttributes::ReleaseAttribute(sal_uIntPtr nAttributePtr) +void MenuAttributes::ReleaseAttribute(void* nAttributePtr) { if (!nAttributePtr) return; - MenuAttributes* pAttributes = reinterpret_cast<MenuAttributes*>(nAttributePtr); + MenuAttributes* pAttributes = static_cast<MenuAttributes*>(nAttributePtr); pAttributes->release(); } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 3d336f00bf53..fa5215f80213 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1125,7 +1125,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF Reference< XDispatchProvider > xPopupMenuDispatchProvider( rDispatchProvider ); // Retrieve possible attributes struct - MenuAttributes* pAttributes = reinterpret_cast<MenuAttributes *>(pMenu->GetUserValue( nItemId )); + MenuAttributes* pAttributes = static_cast<MenuAttributes *>(pMenu->GetUserValue( nItemId )); if ( pAttributes ) xPopupMenuDispatchProvider = pAttributes->xDispatchProvider; @@ -1513,7 +1513,7 @@ void MenuBarManager::FillMenu( if ( xDispatchProvider.is() ) { // Use attributes struct to transport special dispatch provider - sal_uIntPtr nAttributePtr = MenuAttributes::CreateAttribute(xDispatchProvider); + void* nAttributePtr = MenuAttributes::CreateAttribute(xDispatchProvider); pMenu->SetUserValue(nId, nAttributePtr, MenuAttributes::ReleaseAttribute); } @@ -1766,7 +1766,7 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame, Menu* pAddonMenu, b { if ( pAddonMenu->GetItemType( i ) != MenuItemType::SEPARATOR ) { - MenuAttributes* pAddonAttributes = reinterpret_cast<MenuAttributes *>(pAddonMenu->GetUserValue( nItemId )); + MenuAttributes* pAddonAttributes = static_cast<MenuAttributes *>(pAddonMenu->GetUserValue( nItemId )); MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch ); if ( pAddonAttributes ) @@ -1905,7 +1905,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame > const & _xFrame, Menu* _ OUString aImageId; ::framework::MenuAttributes* pMenuAttributes = - reinterpret_cast< ::framework::MenuAttributes*>(_pMenu->GetUserValue( nId )); + static_cast< ::framework::MenuAttributes*>(_pMenu->GetUserValue( nId )); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index ec5d85dc4fde..55fefaad9368 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -83,8 +83,8 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) { OUString aImageId; OUString aCmd( pPopupMenu->GetItemCommand( nItemId ) ); - sal_uLong nAttributePtr = pPopupMenu->GetUserValue( nItemId ); - MenuAttributes* pAttributes = reinterpret_cast<MenuAttributes *>(nAttributePtr); + void* nAttributePtr = pPopupMenu->GetUserValue( nItemId ); + MenuAttributes* pAttributes = static_cast<MenuAttributes *>(nAttributePtr); if (pAttributes) aImageId = pAttributes->aImageId; @@ -354,7 +354,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & pVCLPopupMenu->InsertItem( nItemId, aTitle ); pVCLPopupMenu->SetItemCommand( nItemId, aURL ); - sal_uIntPtr nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId ); + void* nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId ); pVCLPopupMenu->SetUserValue( nItemId, nAttributePtr, MenuAttributes::ReleaseAttribute ); nItemId++; @@ -409,8 +409,8 @@ void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent SolarMutexGuard aSolarMutexGuard; PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu()); aURL = pVCLPopupMenu->GetItemCommand(rEvent.MenuId); - sal_uLong nAttributePtr = pVCLPopupMenu->GetUserValue(rEvent.MenuId); - MenuAttributes* pAttributes = reinterpret_cast<MenuAttributes *>(nAttributePtr); + void* nAttributePtr = pVCLPopupMenu->GetUserValue(rEvent.MenuId); + MenuAttributes* pAttributes = static_cast<MenuAttributes *>(nAttributePtr); if (pAttributes) aTargetFrame = pAttributes->aTargetFrame; } diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 3a2065fa6578..cb41c774fc10 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -671,7 +671,7 @@ void SAL_CALL NewToolbarController::execute( sal_Int16 /*KeyModifier*/ ) dynamic_cast< PopupMenu * >( pTkPopupMenu->GetMenu() ) : nullptr; if ( pVCLPopupMenu ) - pMenuAttributes = reinterpret_cast< MenuAttributes* >( + pMenuAttributes = static_cast< MenuAttributes* >( pVCLPopupMenu->GetUserValue( pVCLPopupMenu->GetCurItemId() ) ); if ( pMenuAttributes ) diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 7dab218d25c6..ba4b27744056 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -385,7 +385,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr; assert(pVCLPopupMenu); if (pVCLPopupMenu) - pVCLPopupMenu->SetUserValue( nIndex, sal_uLong( aSortedTbs[i].bContextSensitive ? 1 : 0 )); + pVCLPopupMenu->SetUserValue( nIndex, reinterpret_cast<void*>( aSortedTbs[i].bContextSensitive ? 1 : 0 )); } // use VCL popup menu pointer to set vital information that are not part of the awt implementation diff --git a/include/framework/menuconfiguration.hxx b/include/framework/menuconfiguration.hxx index 5b0a7f25f685..1707eeea583c 100644 --- a/include/framework/menuconfiguration.hxx +++ b/include/framework/menuconfiguration.hxx @@ -67,9 +67,9 @@ public: OUString aImageId; css::uno::WeakReference<css::frame::XDispatchProvider> xDispatchProvider; - static sal_uIntPtr CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr); - static sal_uIntPtr CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider); - static void ReleaseAttribute(sal_uIntPtr nAttributePtr); + static void* CreateAttribute(const OUString& rFrame, const OUString& rImageIdStr); + static void* CreateAttribute(const css::uno::WeakReference<css::frame::XDispatchProvider>& rDispatchProvider); + static void ReleaseAttribute(void* nAttributePtr); void acquire() { diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index df51890da053..a45eed9e6c70 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -115,7 +115,7 @@ struct ImplMenuDelData bool isDeleted() const { return mpMenu == nullptr; } }; -typedef void (*MenuUserDataReleaseFunction)(sal_uLong); +typedef void (*MenuUserDataReleaseFunction)(void*); class VCL_DLLPUBLIC Menu : public VclReferenceBase { @@ -265,8 +265,8 @@ public: void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits ); MenuItemBits GetItemBits( sal_uInt16 nItemId ) const; - void SetUserValue(sal_uInt16 nItemId, sal_uLong nValue, MenuUserDataReleaseFunction aFunc=nullptr); - sal_uLong GetUserValue(sal_uInt16 nItemId) const; + void SetUserValue(sal_uInt16 nItemId, void* nUserValue, MenuUserDataReleaseFunction aFunc=nullptr); + void* GetUserValue(sal_uInt16 nItemId) const; void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ); PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 28038bb53714..f2f45eadd965 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -678,7 +678,7 @@ MenuItemBits Menu::GetItemBits( sal_uInt16 nItemId ) const return nBits; } -void Menu::SetUserValue(sal_uInt16 nItemId, sal_uLong nValue, MenuUserDataReleaseFunction aFunc) +void Menu::SetUserValue(sal_uInt16 nItemId, void* nUserValue, MenuUserDataReleaseFunction aFunc) { MenuItemData* pData = pItemList->GetData(nItemId); if (pData) @@ -686,14 +686,14 @@ void Menu::SetUserValue(sal_uInt16 nItemId, sal_uLong nValue, MenuUserDataReleas if (pData->aUserValueReleaseFunc) pData->aUserValueReleaseFunc(pData->nUserValue); pData->aUserValueReleaseFunc = aFunc; - pData->nUserValue = nValue; + pData->nUserValue = nUserValue; } } -sal_uLong Menu::GetUserValue( sal_uInt16 nItemId ) const +void* Menu::GetUserValue( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); - return pData ? pData->nUserValue : 0; + return pData ? pData->nUserValue : nullptr; } void Menu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ) diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx index 0aeb0cb9def7..6eac7de94e56 100644 --- a/vcl/source/window/menuitemlist.cxx +++ b/vcl/source/window/menuitemlist.cxx @@ -59,7 +59,7 @@ MenuItemData* MenuItemList::Insert( pData->eType = eType; pData->nBits = nBits; pData->pSubMenu = nullptr; - pData->nUserValue = 0; + pData->nUserValue = nullptr; pData->bChecked = false; pData->bEnabled = true; pData->bVisible = true; @@ -91,7 +91,7 @@ void MenuItemList::InsertSeparator(const OString &rIdent, size_t nPos) pData->eType = MenuItemType::SEPARATOR; pData->nBits = MenuItemBits::NONE; pData->pSubMenu = nullptr; - pData->nUserValue = 0; + pData->nUserValue = nullptr; pData->bChecked = false; pData->bEnabled = true; pData->bVisible = true; diff --git a/vcl/source/window/menuitemlist.hxx b/vcl/source/window/menuitemlist.hxx index bd264e41fdfa..742c7728921b 100644 --- a/vcl/source/window/menuitemlist.hxx +++ b/vcl/source/window/menuitemlist.hxx @@ -42,7 +42,7 @@ struct MenuItemData OUString aHelpCommandStr; // Help command string (to reference external help) OString sIdent; OString aHelpId; // Help-Id - sal_uLong nUserValue; // User value + void* nUserValue; // User value MenuUserDataReleaseFunction aUserValueReleaseFunc; // called when MenuItemData is destroyed Image aImage; // Image vcl::KeyCode aAccelKey; // Accelerator-Key @@ -60,7 +60,7 @@ struct MenuItemData , eType(MenuItemType::DONTKNOW) , nBits(MenuItemBits::NONE) , pSubMenu(nullptr) - , nUserValue(0) + , nUserValue(nullptr) , aUserValueReleaseFunc(nullptr) , bChecked(false) , bEnabled(false) @@ -75,7 +75,7 @@ struct MenuItemData , nBits(MenuItemBits::NONE) , pSubMenu(nullptr) , aText(rStr) - , nUserValue(0) + , nUserValue(nullptr) , aUserValueReleaseFunc(nullptr) , aImage(rImage) , bChecked(false) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits