diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | 8d669bc21b9d1976842ba8252d2f0fb953160bdd (patch) | |
tree | 63e5a53c8ff9c4cdff33070e177eda653922f28a /sfx2/source/menu | |
parent | f232b25c1eceb8e1c32cfd917d666b3a16b14405 (diff) | |
parent | 875ac20478f16e5107acb222c0b851b99d2e0f27 (diff) |
merge to m67
Diffstat (limited to 'sfx2/source/menu')
-rw-r--r-- | sfx2/source/menu/mnuitem.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/menu/virtmenu.cxx | 20 |
2 files changed, 31 insertions, 9 deletions
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index a9d654e7af52..0e80cc207ce0 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -542,6 +542,13 @@ SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, return new SfxUnoMenuControl( rCmd, nId, rMenu, rBindings, pVirt ); } +SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, + USHORT nId, Menu& rMenu, const String& sItemText, const String& sHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) +{ + return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, sHelpText, rBindings, pVirt); +} + SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, Menu& rMenu, SfxBindings& rBindings, SfxVirtualMenu* pVirt ) : SfxMenuControl( nSlotId, rBindings ) @@ -554,6 +561,19 @@ SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, pUnoCtrl->GetNewDispatch(); } +SfxUnoMenuControl::SfxUnoMenuControl( + const String& rCmd, USHORT nSlotId, Menu& /*rMenu*/, + const String& rItemText, const String& rHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) + : SfxMenuControl( nSlotId, rBindings ) +{ + Bind( pVirt, nSlotId, rItemText, rHelpText, rBindings); + UnBind(); + pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); + pUnoCtrl->acquire(); + pUnoCtrl->GetNewDispatch(); +} + SfxUnoMenuControl::~SfxUnoMenuControl() { pUnoCtrl->UnBind(); diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 9ef69de172a3..87f35805d1e7 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -417,8 +417,12 @@ void SfxVirtualMenu::CreateFromSVMenu() DELETEZ( pPopup ); } + const String sItemText = pSVMenu->GetItemText(nSlotId); + const String sHelpText = pSVMenu->GetHelpText(nSlotId); + if ( pPopup ) { + SfxMenuControl *pMnuCtrl = SfxMenuControl::CreateControl(nSlotId, *pPopup, *pBindings); @@ -434,10 +438,8 @@ void SfxVirtualMenu::CreateFromSVMenu() SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count() ); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) { @@ -473,7 +475,7 @@ void SfxVirtualMenu::CreateFromSVMenu() { pMnuCtrl->Bind( this, nSlotId, *new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor), - pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), + sItemText, sHelpText, *pBindings ); } } @@ -510,12 +512,12 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) { // try to create control via comand name - pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, *pBindings, this ); + pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, sHelpText, *pBindings, this ); if ( pMnuCtrl ) { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } } @@ -527,13 +529,13 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } else // take default control pMnuCtrl = (pItems+nPos); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); } if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) |