Kaydet (Commit) fcc49e11 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

vcl menu: Make CloseStartedFrom() virtual to eliminate IsMenuBar() call.

Change-Id: Ifd89b7a9264075b166dd621fcb2c55225e25ea87
üst 11b6b13f
......@@ -187,7 +187,7 @@ protected:
SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel );
/// Close the 'pStartedFrom' menu window.
SAL_DLLPRIVATE void CloseStartedFrom();
virtual void CloseStartedFrom() = 0;
/// Deactivate the MenuBarWindow.
SAL_DLLPRIVATE sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
......@@ -420,6 +420,9 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return true; }
/// Close the 'pStartedFrom' menu window.
virtual void CloseStartedFrom() SAL_OVERRIDE;
void ShowCloseButton( bool bShow = true );
bool HasCloseButton() const { return mbCloseBtnVisible; }
bool HasFloatButton() const { return mbFloatBtnVisible; }
......@@ -504,6 +507,9 @@ public:
virtual bool IsMenuBar() const SAL_OVERRIDE { return false; }
/// Close the 'pStartedFrom' menu window.
virtual void CloseStartedFrom() SAL_OVERRIDE;
void SetText( const OUString& rTitle ) { aTitleText = rTitle; }
const OUString& GetText() const { return aTitleText; }
......
......@@ -2263,30 +2263,6 @@ bool Menu::HasValidEntries( bool bCheckPopups )
return bValidEntries;
}
void Menu::CloseStartedFrom()
{
// if the window was closed by TH, there is another menu
// which has this window as pActivePopup
if (!pStartedFrom)
return;
// pWin from parent could be 0, if the list is
// cleaned from the start, now clean up the endpopup-events
if (pStartedFrom->IsMenuBar())
{
MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow();
if (p)
p->PopupClosed(this);
}
else
{
MenuFloatingWindow* p = (MenuFloatingWindow*) pStartedFrom->ImplGetWindow();
PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this);
if (p && pMenu)
p->KillActivePopup(pMenu);
}
}
sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId)
{
if (!IsMenuBar())
......@@ -2491,6 +2467,18 @@ MenuBar::~MenuBar()
ImplDestroy( this, true );
}
void MenuBar::CloseStartedFrom()
{
// if the window was closed by TH, there is another menu
// which has this window as pActivePopup
if (!pStartedFrom)
return;
MenuBarWindow* p = (MenuBarWindow*) pStartedFrom->ImplGetWindow();
if (p)
p->PopupClosed(this);
}
void MenuBar::ShowCloseButton(bool bShow)
{
ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible );
......@@ -2717,6 +2705,19 @@ PopupMenu::~PopupMenu()
*pRefAutoSubMenu = NULL; // #111060# avoid second delete in ~MenuItemData
}
void PopupMenu::CloseStartedFrom()
{
// if the window was closed by TH, there is another menu
// which has this window as pActivePopup
if (!pStartedFrom)
return;
MenuFloatingWindow* p = (MenuFloatingWindow*) pStartedFrom->ImplGetWindow();
PopupMenu *pMenu = dynamic_cast<PopupMenu*>(this);
if (p && pMenu)
p->KillActivePopup(pMenu);
}
bool PopupMenu::IsInExecute()
{
return GetActivePopupMenu() ? true : false;
......
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