fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / inc / classes / menumanager.hxx
blob4c471a29f3982180c6612c4b3716e87908def06a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_FRAMEWORK_INC_CLASSES_MENUMANAGER_HXX
21 #define INCLUDED_FRAMEWORK_INC_CLASSES_MENUMANAGER_HXX
23 #include <vector>
25 #include <com/sun/star/frame/XFrame.hpp>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <com/sun/star/frame/FeatureStateEvent.hpp>
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <com/sun/star/util/XURLTransformer.hpp>
31 #include <rtl/ustring.hxx>
32 #include <vcl/menu.hxx>
33 #include <vcl/accel.hxx>
34 #include <cppuhelper/implbase1.hxx>
36 namespace com { namespace sun { namespace star { namespace uno {
37 class XComponentContext;
38 } } } }
40 namespace framework
43 class BmkMenu;
44 class AddonMenu;
45 class AddonPopupMenu;
46 class MenuManager : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
48 public:
49 MenuManager(
50 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
51 css::uno::Reference< css::frame::XFrame >& rFrame,
52 Menu* pMenu,
53 bool bDelete,
54 bool bDeleteChildren );
56 virtual ~MenuManager();
58 // XStatusListener
59 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
61 // XEventListener
62 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
64 DECL_LINK( Select, Menu * );
66 Menu* GetMenu() const { return m_pVCLMenu; }
68 void RemoveListener();
70 static void UpdateSpecialWindowMenu( Menu* pMenu ,const css::uno::Reference< css::uno::XComponentContext >& xContext);
71 static void FillMenuImages(
72 css::uno::Reference< css::frame::XFrame >& xFrame,
73 Menu* _pMenu,
74 bool bShowMenuImages
77 protected:
78 DECL_LINK_TYPED(Highlight, Menu *, bool);
79 DECL_LINK_TYPED( Activate, Menu *, bool );
80 DECL_LINK_TYPED( Deactivate, Menu *, bool );
82 private:
83 void UpdateSpecialFileMenu( Menu* pMenu );
84 void UpdateSpecialWindowMenu( Menu* pMenu );
85 void ClearMenuDispatch(const css::lang::EventObject& Source = css::lang::EventObject(),bool _bRemoveOnly = true);
86 void SetHdl();
87 void AddMenu(PopupMenu* _pPopupMenu,const OUString& _sItemCommand,sal_uInt16 _nItemId,bool _bDelete,bool _bDeleteChildren);
88 sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const;
90 struct MenuItemHandler
92 MenuItemHandler( sal_uInt16 aItemId, MenuManager* pManager, css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
93 nItemId( aItemId ), pSubMenuManager( pManager ), xMenuItemDispatch( rDispatch ) {}
95 sal_uInt16 nItemId;
96 OUString aTargetFrame;
97 OUString aMenuItemURL;
98 OUString aFilter;
99 OUString aPassword;
100 OUString aTitle;
101 MenuManager* pSubMenuManager;
102 css::uno::Reference< css::frame::XDispatch > xMenuItemDispatch;
105 void CreatePicklistArguments(
106 css::uno::Sequence< css::beans::PropertyValue >& aArgsList,
107 const MenuItemHandler* );
109 MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId );
111 bool m_bInitialized;
112 bool m_bDeleteMenu;
113 bool m_bDeleteChildren;
114 bool m_bActive;
115 bool m_bIsBookmarkMenu;
116 bool m_bShowMenuImages;
117 OUString m_aMenuItemCommand;
118 Menu* m_pVCLMenu;
119 css::uno::Reference< css::frame::XFrame > m_xFrame;
120 ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
122 css::uno::Reference< css::uno::XComponentContext > m_xContext;
123 css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
126 } // namespace
128 #endif
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */