Update ooo320-m1
[ooovba.git] / framework / inc / helper / popupmenucontrollerbase.hxx
blob18bc9c29d9d82500121fc2e9ad9a6f841ed272d2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: popupmenucontrollerbase.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_
32 #define __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
42 #include <macros/xserviceinfo.hxx>
43 #include <stdtypes.h>
45 //_________________________________________________________________________________________________________________
46 // interface includes
47 //_________________________________________________________________________________________________________________
48 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #include <com/sun/star/lang/XTypeProvider.hpp>
50 #include <com/sun/star/lang/XInitialization.hpp>
51 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 #include <com/sun/star/frame/XFrame.hpp>
53 #include <com/sun/star/frame/XDispatchProvider.hpp>
54 #include <com/sun/star/frame/XDispatch.hpp>
55 #include <com/sun/star/frame/XStatusListener.hpp>
56 #include <com/sun/star/frame/XPopupMenuController.hpp>
57 #include <com/sun/star/uri/XUriReferenceFactory.hpp>
58 #include <com/sun/star/uri/XUriReference.hpp>
59 #include <com/sun/star/util/XURLTransformer.hpp>
60 //_________________________________________________________________________________________________________________
61 // includes of other projects
62 //_________________________________________________________________________________________________________________
63 #include <toolkit/awt/vclxmenu.hxx>
64 #include <cppuhelper/weak.hxx>
65 #include <rtl/ustring.hxx>
67 namespace framework
69 class PopupMenuControllerBase : public com::sun::star::lang::XTypeProvider ,
70 public com::sun::star::lang::XServiceInfo ,
71 public ::com::sun::star::frame::XPopupMenuController ,
72 public com::sun::star::lang::XInitialization ,
73 public com::sun::star::frame::XStatusListener ,
74 public com::sun::star::awt::XMenuListener ,
75 public com::sun::star::frame::XDispatchProvider ,
76 public com::sun::star::frame::XDispatch ,
77 public com::sun::star::lang::XComponent ,
78 protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
79 public ::cppu::OBroadcastHelper ,
80 public ::cppu::OWeakObject
82 public:
83 PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
84 virtual ~PopupMenuControllerBase();
86 // XInterface, XTypeProvider, XServiceInfo
87 FWK_DECLARE_XINTERFACE
88 FWK_DECLARE_XTYPEPROVIDER
90 // XServiceInfo
91 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
92 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0;
93 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
95 // XPopupMenuController
96 virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
97 virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
99 // XInitialization
100 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
102 // XStatusListener
103 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
105 // XMenuListener
106 virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
107 virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
108 virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
109 virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
111 // XDispatchProvider
112 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 );
113 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
115 // XDispatch
116 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 );
117 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 );
118 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 );
120 // XEventListener
121 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
123 // XComponent
124 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
125 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
126 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
128 protected:
129 virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
130 virtual void impl_setPopupMenu();
131 virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
132 ::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL );
135 bool m_bInitialized;
136 bool m_bDisposed;
137 rtl::OUString m_aCommandURL;
138 rtl::OUString m_aBaseURL;
139 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch;
140 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
141 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
142 ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
143 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu;
144 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
148 #endif // __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_