Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_
30 : : #define __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_
31 : :
32 : : #include <macros/xserviceinfo.hxx>
33 : : #include <stdtypes.h>
34 : :
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/lang/XTypeProvider.hpp>
37 : : #include <com/sun/star/lang/XInitialization.hpp>
38 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 : : #include <com/sun/star/frame/XFrame.hpp>
40 : : #include <com/sun/star/frame/XDispatchProvider.hpp>
41 : : #include <com/sun/star/frame/XDispatch.hpp>
42 : : #include <com/sun/star/frame/XStatusListener.hpp>
43 : : #include <com/sun/star/frame/XPopupMenuController.hpp>
44 : : #include <com/sun/star/beans/XPropertySet.hpp>
45 : :
46 : : #include <svtools/popupmenucontrollerbase.hxx>
47 : : #include <toolkit/awt/vclxmenu.hxx>
48 : : #include <cppuhelper/weak.hxx>
49 : : #include <rtl/ustring.hxx>
50 : :
51 : : namespace framework
52 : : {
53 [ # # ][ # # ]: 0 : struct LoadRecentFile
54 : : {
55 : : ::com::sun::star::util::URL aTargetURL;
56 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq;
57 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
58 : : };
59 : :
60 : : class RecentFilesMenuController : public svt::PopupMenuControllerBase
61 : : {
62 : : using svt::PopupMenuControllerBase::disposing;
63 : :
64 : : public:
65 : : RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
66 : : virtual ~RecentFilesMenuController();
67 : :
68 : : // XServiceInfo
69 : : DECLARE_XSERVICEINFO
70 : :
71 : : // XPopupMenuController
72 : : virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
73 : :
74 : : // XStatusListener
75 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
76 : :
77 : : // XMenuListener
78 : : virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
79 : : virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
80 : :
81 : : // XDispatchProvider
82 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
83 : :
84 : : // XDispatch
85 : : virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException );
86 : : virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
87 : : virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
88 : :
89 : : // XEventListener
90 : : virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
91 : :
92 : : DECL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile* );
93 : :
94 : : private:
95 : : virtual void impl_setPopupMenu();
96 : 0 : struct RecentFile
97 : : {
98 : : rtl::OUString aURL;
99 : : rtl::OUString aTitle;
100 : : rtl::OUString aPassword;
101 : : };
102 : :
103 : : void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
104 : : void executeEntry( sal_Int32 nIndex );
105 : :
106 : : std::vector< RecentFile > m_aRecentFilesItems;
107 : : sal_Bool m_bDisabled : 1;
108 : : };
109 : : }
110 : :
111 : : #endif // __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_
112 : :
113 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|