Kaydet (Commit) a519c883 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

No need for IMenuBarWindow abstraction

Change-Id: I5be4cfb951100d36054e409043cb9becbe52338d
üst 8be00a3f
...@@ -48,7 +48,7 @@ class CommandEvent; ...@@ -48,7 +48,7 @@ class CommandEvent;
class MenuFloatingWindow; class MenuFloatingWindow;
namespace vcl { class Window; } namespace vcl { class Window; }
class SalMenu; class SalMenu;
class IMenuBarWindow; class MenuBarWindow;
struct SystemMenuData; struct SystemMenuData;
enum class FloatWinPopupFlags; enum class FloatWinPopupFlags;
...@@ -434,8 +434,8 @@ class VCL_DLLPUBLIC MenuBar : public Menu ...@@ -434,8 +434,8 @@ class VCL_DLLPUBLIC MenuBar : public Menu
protected: protected:
/// Return the IMenuBarWindow interface. /// Return the MenuBarWindow.
IMenuBarWindow* getMenuBarWindow(); MenuBarWindow* getMenuBarWindow();
public: public:
MenuBar(); MenuBar();
......
...@@ -2459,12 +2459,12 @@ void Menu::HighlightItem( sal_uInt16 nItemPos ) ...@@ -2459,12 +2459,12 @@ void Menu::HighlightItem( sal_uInt16 nItemPos )
} }
// - MenuBar - // - MenuBar -
IMenuBarWindow* MenuBar::getMenuBarWindow() MenuBarWindow* MenuBar::getMenuBarWindow()
{ {
// so far just a dynamic_cast, hopefully to be turned into something saner // so far just a dynamic_cast, hopefully to be turned into something saner
// at some stage // at some stage
IMenuBarWindow *pWin = dynamic_cast<IMenuBarWindow*>(pWindow.get()); MenuBarWindow *pWin = dynamic_cast<MenuBarWindow*>(pWindow.get());
//either there is no window (fdo#87663) or it is an IMenuBarWindow //either there is no window (fdo#87663) or it is a MenuBarWindow
assert(!pWindow || pWin); assert(!pWindow || pWin);
return pWin; return pWin;
} }
...@@ -2497,7 +2497,7 @@ MenuBar::~MenuBar() ...@@ -2497,7 +2497,7 @@ MenuBar::~MenuBar()
void MenuBar::ClosePopup(Menu *pMenu) void MenuBar::ClosePopup(Menu *pMenu)
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin) if (!pMenuWin)
return; return;
pMenuWin->PopupClosed(pMenu); pMenuWin->PopupClosed(pMenu);
...@@ -2505,7 +2505,7 @@ void MenuBar::ClosePopup(Menu *pMenu) ...@@ -2505,7 +2505,7 @@ void MenuBar::ClosePopup(Menu *pMenu)
sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId) sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId)
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
nFocusId = pMenuWin ? pMenuWin->GetFocusId() : 0; nFocusId = pMenuWin ? pMenuWin->GetFocusId() : 0;
if (nFocusId) if (nFocusId)
{ {
...@@ -2535,7 +2535,7 @@ void MenuBar::ShowButtons( bool bClose, bool bFloat, bool bHide ) ...@@ -2535,7 +2535,7 @@ void MenuBar::ShowButtons( bool bClose, bool bFloat, bool bHide )
mbCloseBtnVisible = bClose; mbCloseBtnVisible = bClose;
mbFloatBtnVisible = bFloat; mbFloatBtnVisible = bFloat;
mbHideBtnVisible = bHide; mbHideBtnVisible = bHide;
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin) if (pMenuWin)
pMenuWin->ShowButtons(bClose, bFloat, bHide); pMenuWin->ShowButtons(bClose, bFloat, bHide);
} }
...@@ -2546,7 +2546,7 @@ void MenuBar::SetDisplayable( bool bDisplayable ) ...@@ -2546,7 +2546,7 @@ void MenuBar::SetDisplayable( bool bDisplayable )
if( bDisplayable != mbDisplayable ) if( bDisplayable != mbDisplayable )
{ {
mbDisplayable = bDisplayable; mbDisplayable = bDisplayable;
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin) if (pMenuWin)
pMenuWin->LayoutChanged(); pMenuWin->LayoutChanged();
} }
...@@ -2581,7 +2581,7 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) ...@@ -2581,7 +2581,7 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete )
vcl::Window *pWindow = pMenu->ImplGetWindow(); vcl::Window *pWindow = pMenu->ImplGetWindow();
if (pWindow && bDelete) if (pWindow && bDelete)
{ {
IMenuBarWindow* pMenuWin = pMenu->getMenuBarWindow(); MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow();
if (pMenuWin) if (pMenuWin)
pMenuWin->KillActivePopup(); pMenuWin->KillActivePopup();
pWindow->disposeOnce(); pWindow->disposeOnce();
...@@ -2602,7 +2602,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu ) ...@@ -2602,7 +2602,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
vcl::Window* pWin = ImplGetWindow(); vcl::Window* pWin = ImplGetWindow();
if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode()) if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode())
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
bDone = pMenuWin && pMenuWin->HandleKeyEvent(rKEvent, bFromMenu); bDone = pMenuWin && pMenuWin->HandleKeyEvent(rKEvent, bFromMenu);
} }
return bDone; return bDone;
...@@ -2646,7 +2646,7 @@ void MenuBar::SelectItem(sal_uInt16 nId) ...@@ -2646,7 +2646,7 @@ void MenuBar::SelectItem(sal_uInt16 nId)
pWindow->GrabFocus(); pWindow->GrabFocus();
nId = GetItemPos( nId ); nId = GetItemPos( nId );
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin) if (pMenuWin)
{ {
// #99705# popup the selected menu // #99705# popup the selected menu
...@@ -2736,13 +2736,13 @@ bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId ) ...@@ -2736,13 +2736,13 @@ bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventId )
sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip ) sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link<>& i_rLink, const OUString& i_rToolTip )
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip) : 0; return pMenuWin ? pMenuWin->AddMenuBarButton(i_rImage, i_rLink, i_rToolTip) : 0;
} }
void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink ) void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink )
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin) if (!pMenuWin)
return; return;
pMenuWin->SetMenuBarButtonHighlightHdl(nId, rLink); pMenuWin->SetMenuBarButtonHighlightHdl(nId, rLink);
...@@ -2750,13 +2750,13 @@ void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink ...@@ -2750,13 +2750,13 @@ void MenuBar::SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link<>& rLink
Rectangle MenuBar::GetMenuBarButtonRectPixel( sal_uInt16 nId ) Rectangle MenuBar::GetMenuBarButtonRectPixel( sal_uInt16 nId )
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin ? pMenuWin->GetMenuBarButtonRectPixel(nId) : Rectangle(); return pMenuWin ? pMenuWin->GetMenuBarButtonRectPixel(nId) : Rectangle();
} }
void MenuBar::RemoveMenuBarButton( sal_uInt16 nId ) void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
if (!pMenuWin) if (!pMenuWin)
return; return;
pMenuWin->RemoveMenuBarButton(nId); pMenuWin->RemoveMenuBarButton(nId);
...@@ -2764,7 +2764,7 @@ void MenuBar::RemoveMenuBarButton( sal_uInt16 nId ) ...@@ -2764,7 +2764,7 @@ void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId ) bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId )
{ {
IMenuBarWindow* pMenuWin = getMenuBarWindow(); MenuBarWindow* pMenuWin = getMenuBarWindow();
return pMenuWin && pMenuWin->HandleMenuButtonEvent(i_nButtonId); return pMenuWin && pMenuWin->HandleMenuButtonEvent(i_nButtonId);
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
/** Class that implements the actual window of the menu bar. /** Class that implements the actual window of the menu bar.
*/ */
class MenuBarWindow : public vcl::Window, public IMenuBarWindow class MenuBarWindow : public vcl::Window, public MenuWindow
{ {
friend class MenuBar; friend class MenuBar;
friend class Menu; friend class Menu;
...@@ -92,11 +92,11 @@ private: ...@@ -92,11 +92,11 @@ private:
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons; std::map< sal_uInt16, AddButtonEntry > m_aAddButtons;
void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight); void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight);
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true) SAL_OVERRIDE; void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true);
sal_uInt16 ImplFindEntry( const Point& rMousePos ) const; sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
void ImplCreatePopup( bool bPreSelectFirst ); void ImplCreatePopup( bool bPreSelectFirst );
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) SAL_OVERRIDE; bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true);
Rectangle ImplGetItemRect( sal_uInt16 nPos ); Rectangle ImplGetItemRect( sal_uInt16 nPos );
void ImplInitStyleSettings(); void ImplInitStyleSettings();
...@@ -119,7 +119,7 @@ public: ...@@ -119,7 +119,7 @@ public:
virtual ~MenuBarWindow(); virtual ~MenuBarWindow();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE; void ShowButtons(bool bClose, bool bFloat, bool bHide);
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
...@@ -129,26 +129,26 @@ public: ...@@ -129,26 +129,26 @@ public:
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
virtual void SetFocusId(sal_uLong nId) SAL_OVERRIDE { nSaveFocusId = nId; } void SetFocusId(sal_uLong nId) { nSaveFocusId = nId; }
virtual sal_uLong GetFocusId() const SAL_OVERRIDE { return nSaveFocusId; } sal_uLong GetFocusId() const { return nSaveFocusId; }
virtual void SetMenu(MenuBar* pMenu) SAL_OVERRIDE; void SetMenu(MenuBar* pMenu);
virtual void SetHeight(long nHeight) SAL_OVERRIDE; void SetHeight(long nHeight);
virtual void KillActivePopup() SAL_OVERRIDE; void KillActivePopup();
virtual void PopupClosed(Menu* pMenu) SAL_OVERRIDE; void PopupClosed(Menu* pMenu);
virtual sal_uInt16 GetHighlightedItem() const SAL_OVERRIDE { return nHighlightedItem; } sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE; virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
virtual void SetAutoPopup(bool bAuto) SAL_OVERRIDE { mbAutoPopup = bAuto; } void SetAutoPopup(bool bAuto) { mbAutoPopup = bAuto; }
virtual void LayoutChanged() SAL_OVERRIDE; void LayoutChanged();
Size MinCloseButtonSize(); Size MinCloseButtonSize();
/// Add an arbitrary button to the menubar that will appear next to the close button. /// Add an arbitrary button to the menubar that will appear next to the close button.
virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) SAL_OVERRIDE; sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&);
virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) SAL_OVERRIDE; void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&);
virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) SAL_OVERRIDE; Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId);
virtual void RemoveMenuBarButton(sal_uInt16 nId) SAL_OVERRIDE; void RemoveMenuBarButton(sal_uInt16 nId);
virtual bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId) SAL_OVERRIDE; bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId);
virtual void SetMBWHideAccel (bool val) { mbHideAccel = val; } virtual void SetMBWHideAccel (bool val) { mbHideAccel = val; }
virtual bool GetMBWHideAccel (void) const { return mbHideAccel; } virtual bool GetMBWHideAccel (void) const { return mbHideAccel; }
virtual void SetMBWMenuKey (bool val) { mbMenuKey = val; } virtual void SetMBWMenuKey (bool val) { mbMenuKey = val; }
......
...@@ -58,35 +58,5 @@ public: ...@@ -58,35 +58,5 @@ public:
const HelpEvent& rHEvt, const Rectangle &rHighlightRect); const HelpEvent& rHEvt, const Rectangle &rHighlightRect);
}; };
/// Interface for the MenuBarWindow functionality.
class IMenuBarWindow : public MenuWindow
{
public:
virtual ~IMenuBarWindow() {}
virtual sal_uLong GetFocusId() const = 0;
virtual void SetFocusId(sal_uLong nId) = 0;
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) = 0;
virtual void LayoutChanged() = 0;
virtual void PopupClosed(Menu* pMenu) = 0;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) = 0;
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true ) = 0;
virtual sal_uInt16 GetHighlightedItem() const = 0;
virtual void SetAutoPopup(bool bAuto) = 0;
virtual void SetMenu(MenuBar* pMenu) = 0;
virtual void SetHeight(long nHeight) = 0;
virtual void KillActivePopup() = 0;
/// Add an arbitrary button to the menubar that will appear next to the close button.
virtual sal_uInt16 AddMenuBarButton(const Image&, const Link<>&, const OUString&) = 0;
virtual void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link<>&) = 0;
virtual Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId) = 0;
virtual void RemoveMenuBarButton(sal_uInt16 nId) = 0;
virtual bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId) = 0;
};
#endif // INCLUDED_VCL_SOURCE_WINDOW_MENUWINDOW_HXX #endif // INCLUDED_VCL_SOURCE_WINDOW_MENUWINDOW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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