1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
29 #define __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
30 
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/util/XUpdatable.hpp>
34 #include <com/sun/star/frame/XFrame.hpp>
35 #include <com/sun/star/frame/XDispatch.hpp>
36 #include <com/sun/star/frame/XStatusListener.hpp>
37 #include <com/sun/star/util/XURLTransformer.hpp>
38 #include <com/sun/star/beans/NamedValue.hpp>
39 #include <com/sun/star/frame/XDispatch.hpp>
40 #include <com/sun/star/frame/ControlCommand.hpp>
41 #include <com/sun/star/frame/XLayoutManager.hpp>
42 #include <com/sun/star/frame/XToolbarController.hpp>
43 
44 //_________________________________________________________________________________________________________________
45 //	includes of other projects
46 //_________________________________________________________________________________________________________________
47 
48 #include <comphelper/broadcasthelper.hxx>
49 #include <cppuhelper/weak.hxx>
50 #include <vcl/toolbox.hxx>
51 
52 namespace framework
53 {
54 
55 class ToolBar;
56 class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener,
57                                 public ::com::sun::star::frame::XToolbarController,
58                                 public ::com::sun::star::lang::XInitialization,
59                                 public ::com::sun::star::util::XUpdatable,
60                                 public ::com::sun::star::lang::XComponent,
61                                 public ::comphelper::OBaseMutex,
62                                 public ::cppu::OWeakObject
63 {
64     public:
65         ButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
66                                  ToolBox*             pToolBar,
67                                  const rtl::OUString& aCommand );
68         virtual ~ButtonToolbarController();
69 
70         // XInterface
71 		virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
72 		virtual void SAL_CALL acquire() throw ();
73 		virtual void SAL_CALL release() throw ();
74 
75         // XInitialization
76         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);
77 
78         // XUpdatable
79         virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
80 
81         // XComponent
82         virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
83         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
84         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
85 
86         // XEventListener
87 		virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
88 
89         // XStatusListener
90 		virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
91 
92         // XToolbarController
93         virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
94         virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
95         virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
96         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
97         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
98 
99     private:
100         sal_Bool                                                                         m_bInitialized : 1,
101                                                                                          m_bDisposed : 1;
102         rtl::OUString                                                                    m_aCommandURL;
103         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >              m_xFrame;
104         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
105         ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >      m_xURLTransformer;
106         ToolBox*                                                                         m_pToolbar;
107 };
108 
109 }
110 
111 #endif // __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
112