1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
25 #define __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
26 
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/util/XUpdatable.hpp>
30 #include <com/sun/star/frame/XFrame.hpp>
31 #include <com/sun/star/frame/XDispatch.hpp>
32 #include <com/sun/star/frame/XStatusListener.hpp>
33 #include <com/sun/star/util/XURLTransformer.hpp>
34 #include <com/sun/star/beans/NamedValue.hpp>
35 #include <com/sun/star/frame/XDispatch.hpp>
36 #include <com/sun/star/frame/ControlCommand.hpp>
37 #include <com/sun/star/frame/XLayoutManager.hpp>
38 #include <com/sun/star/frame/XToolbarController.hpp>
39 
40 //_________________________________________________________________________________________________________________
41 //	includes of other projects
42 //_________________________________________________________________________________________________________________
43 
44 #include <comphelper/broadcasthelper.hxx>
45 #include <cppuhelper/weak.hxx>
46 #include <vcl/toolbox.hxx>
47 
48 namespace framework
49 {
50 
51 class ToolBar;
52 class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener,
53                                 public ::com::sun::star::frame::XToolbarController,
54                                 public ::com::sun::star::lang::XInitialization,
55                                 public ::com::sun::star::util::XUpdatable,
56                                 public ::com::sun::star::lang::XComponent,
57                                 public ::comphelper::OBaseMutex,
58                                 public ::cppu::OWeakObject
59 {
60     public:
61         ButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
62                                  ToolBox*             pToolBar,
63                                  const rtl::OUString& aCommand );
64         virtual ~ButtonToolbarController();
65 
66         // XInterface
67 		virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
68 		virtual void SAL_CALL acquire() throw ();
69 		virtual void SAL_CALL release() throw ();
70 
71         // XInitialization
72         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);
73 
74         // XUpdatable
75         virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
76 
77         // XComponent
78         virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
79         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
80         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
81 
82         // XEventListener
83 		virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
84 
85         // XStatusListener
86 		virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
87 
88         // XToolbarController
89         virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
90         virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
91         virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
92         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
93         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);
94 
95     private:
96         sal_Bool                                                                         m_bInitialized : 1,
97                                                                                          m_bDisposed : 1;
98         rtl::OUString                                                                    m_aCommandURL;
99         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >              m_xFrame;
100         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
101         ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >      m_xURLTransformer;
102         ToolBox*                                                                         m_pToolbar;
103 };
104 
105 }
106 
107 #endif // __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_
108