110b918a5SAriel Constenla-Haile /**************************************************************
210b918a5SAriel Constenla-Haile  *
310b918a5SAriel Constenla-Haile  * Licensed to the Apache Software Foundation (ASF) under one
410b918a5SAriel Constenla-Haile  * or more contributor license agreements.  See the NOTICE file
510b918a5SAriel Constenla-Haile  * distributed with this work for additional information
610b918a5SAriel Constenla-Haile  * regarding copyright ownership.  The ASF licenses this file
710b918a5SAriel Constenla-Haile  * to you under the Apache License, Version 2.0 (the
810b918a5SAriel Constenla-Haile  * "License"); you may not use this file except in compliance
910b918a5SAriel Constenla-Haile  * with the License.  You may obtain a copy of the License at
1010b918a5SAriel Constenla-Haile  *
1110b918a5SAriel Constenla-Haile  *   http://www.apache.org/licenses/LICENSE-2.0
1210b918a5SAriel Constenla-Haile  *
1310b918a5SAriel Constenla-Haile  * Unless required by applicable law or agreed to in writing,
1410b918a5SAriel Constenla-Haile  * software distributed under the License is distributed on an
1510b918a5SAriel Constenla-Haile  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1610b918a5SAriel Constenla-Haile  * KIND, either express or implied.  See the License for the
1710b918a5SAriel Constenla-Haile  * specific language governing permissions and limitations
1810b918a5SAriel Constenla-Haile  * under the License.
1910b918a5SAriel Constenla-Haile  *
2010b918a5SAriel Constenla-Haile  *************************************************************/
2110b918a5SAriel Constenla-Haile 
2210b918a5SAriel Constenla-Haile #ifndef __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
2310b918a5SAriel Constenla-Haile #define __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
2410b918a5SAriel Constenla-Haile 
2510b918a5SAriel Constenla-Haile #include <com/sun/star/awt/XPopupMenu.hpp>
2610b918a5SAriel Constenla-Haile #include <com/sun/star/frame/XPopupMenuController.hpp>
2710b918a5SAriel Constenla-Haile #include <com/sun/star/frame/XUIControllerFactory.hpp>
2810b918a5SAriel Constenla-Haile #include <com/sun/star/lang/XServiceInfo.hpp>
2910b918a5SAriel Constenla-Haile #include <cppuhelper/implbase1.hxx>
3010b918a5SAriel Constenla-Haile #include <macros/xserviceinfo.hxx>
3110b918a5SAriel Constenla-Haile #include <svtools/toolboxcontroller.hxx>
3210b918a5SAriel Constenla-Haile 
3310b918a5SAriel Constenla-Haile namespace framework
3410b918a5SAriel Constenla-Haile {
3510b918a5SAriel Constenla-Haile     class PopupMenuToolbarController : public svt::ToolboxController
3610b918a5SAriel Constenla-Haile     {
3710b918a5SAriel Constenla-Haile     public:
3810b918a5SAriel Constenla-Haile         virtual ~PopupMenuToolbarController();
3910b918a5SAriel Constenla-Haile 
4010b918a5SAriel Constenla-Haile         // XComponent
4110b918a5SAriel Constenla-Haile         virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
4210b918a5SAriel Constenla-Haile         // XInitialization
4310b918a5SAriel Constenla-Haile         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);
4410b918a5SAriel Constenla-Haile         // XToolbarController
4510b918a5SAriel Constenla-Haile         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
4610b918a5SAriel Constenla-Haile         // XStatusListener
4710b918a5SAriel Constenla-Haile         virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
4810b918a5SAriel Constenla-Haile 
4910b918a5SAriel Constenla-Haile     protected:
5010b918a5SAriel Constenla-Haile         PopupMenuToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
5110b918a5SAriel Constenla-Haile                                     const ::rtl::OUString &rPopupCommand = rtl::OUString() );
5210b918a5SAriel Constenla-Haile         virtual void functionExecuted( const rtl::OUString &rCommand );
5310b918a5SAriel Constenla-Haile         virtual sal_uInt16 getDropDownStyle() const;
5410b918a5SAriel Constenla-Haile         void createPopupMenuController();
5510b918a5SAriel Constenla-Haile 
5610b918a5SAriel Constenla-Haile         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >      m_xContext;
5710b918a5SAriel Constenla-Haile         sal_Bool                                                                      m_bHasController;
5810b918a5SAriel Constenla-Haile         com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >             m_xPopupMenu;
5910b918a5SAriel Constenla-Haile 
6010b918a5SAriel Constenla-Haile     private:
6110b918a5SAriel Constenla-Haile         rtl::OUString                                                                 m_aPopupCommand;
6210b918a5SAriel Constenla-Haile         com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > m_xPopupMenuFactory;
6310b918a5SAriel Constenla-Haile         com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > m_xPopupMenuController;
6410b918a5SAriel Constenla-Haile     };
6510b918a5SAriel Constenla-Haile 
6610b918a5SAriel Constenla-Haile     class OpenToolbarController : public PopupMenuToolbarController
6710b918a5SAriel Constenla-Haile     {
6810b918a5SAriel Constenla-Haile     public:
6910b918a5SAriel Constenla-Haile         OpenToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
7010b918a5SAriel Constenla-Haile 
7110b918a5SAriel Constenla-Haile         // XServiceInfo
7210b918a5SAriel Constenla-Haile         DECLARE_XSERVICEINFO
7310b918a5SAriel Constenla-Haile     };
7410b918a5SAriel Constenla-Haile 
7510b918a5SAriel Constenla-Haile     class NewToolbarController : public PopupMenuToolbarController
7610b918a5SAriel Constenla-Haile     {
7710b918a5SAriel Constenla-Haile     public:
7810b918a5SAriel Constenla-Haile         NewToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
7910b918a5SAriel Constenla-Haile 
8010b918a5SAriel Constenla-Haile         // XServiceInfo
8110b918a5SAriel Constenla-Haile         DECLARE_XSERVICEINFO
8210b918a5SAriel Constenla-Haile     private:
8310b918a5SAriel Constenla-Haile         void functionExecuted( const rtl::OUString &rCommand );
8410b918a5SAriel Constenla-Haile         void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
85*7ca83afaSAriel Constenla-Haile         void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
8610b918a5SAriel Constenla-Haile         void setItemImage( const rtl::OUString &rCommand );
87*7ca83afaSAriel Constenla-Haile 
88*7ca83afaSAriel Constenla-Haile         rtl::OUString m_aLastURL;
8910b918a5SAriel Constenla-Haile     };
9010b918a5SAriel Constenla-Haile 
9110b918a5SAriel Constenla-Haile     class WizardsToolbarController : public PopupMenuToolbarController
9210b918a5SAriel Constenla-Haile     {
9310b918a5SAriel Constenla-Haile     public:
9410b918a5SAriel Constenla-Haile         WizardsToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
9510b918a5SAriel Constenla-Haile 
9610b918a5SAriel Constenla-Haile         // XServiceInfo
9710b918a5SAriel Constenla-Haile         DECLARE_XSERVICEINFO
9810b918a5SAriel Constenla-Haile     private:
9910b918a5SAriel Constenla-Haile         sal_uInt16 getDropDownStyle() const;
10010b918a5SAriel Constenla-Haile     };
10110b918a5SAriel Constenla-Haile }
10210b918a5SAriel Constenla-Haile 
10310b918a5SAriel Constenla-Haile #endif
104