fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svtools / toolboxcontroller.hxx
blob6bccf935be9c352007110ca845a97d3e1959295c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SVTOOLS_TOOLBOXCONTROLLER_HXX
21 #define _SVTOOLS_TOOLBOXCONTROLLER_HXX
23 #include "svtools/svtdllapi.h"
24 #include <com/sun/star/frame/XFrame.hpp>
25 #include <com/sun/star/frame/XDispatch.hpp>
26 #include <com/sun/star/frame/XStatusListener.hpp>
27 #include <com/sun/star/frame/XToolbarController.hpp>
28 #include <com/sun/star/frame/XLayoutManager.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/util/XUpdatable.hpp>
32 #include <com/sun/star/util/XURLTransformer.hpp>
33 #include <cppuhelper/weak.hxx>
34 #include <cppuhelper/interfacecontainer.hxx>
35 #include <comphelper/broadcasthelper.hxx>
36 #include <comphelper/proparrhlp.hxx>
37 #include <comphelper/property.hxx>
38 #include <comphelper/propertycontainer.hxx>
39 #include <cppuhelper/propshlp.hxx>
41 #include <boost/unordered_map.hpp>
43 class ToolBox;
45 namespace svt
47 struct ToolboxController_Impl;
49 class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
50 public ::com::sun::star::frame::XToolbarController,
51 public ::com::sun::star::lang::XInitialization,
52 public ::com::sun::star::util::XUpdatable,
53 public ::com::sun::star::lang::XComponent,
54 public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
55 public ::comphelper::OPropertyContainer,//shizhoubo
56 public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
57 public ::cppu::OWeakObject
59 private:
60 sal_Bool m_bSupportVisible; //shizhoubo
61 public:
62 ToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
63 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
64 const OUString& aCommandURL );
65 ToolboxController();
66 virtual ~ToolboxController();
68 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
69 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const;
70 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > getLayoutManager() const;
72 void updateStatus( const OUString aCommandURL );
73 void updateStatus();
75 // XInterface
76 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
77 virtual void SAL_CALL acquire() throw ();
78 virtual void SAL_CALL release() throw ();
80 // XInitialization
81 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);
83 // XUpdatable
84 virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
86 // XComponent
87 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
88 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
89 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
91 // XEventListener
92 using cppu::OPropertySetHelper::disposing;
93 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
95 // XStatusListener
96 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
98 // XToolbarController
99 virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
100 virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
101 virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
103 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);
104 // OPropertySetHelper //shizhoubo
105 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
106 virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
107 // XPropertySet //shizhoubo
108 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
109 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
110 // OPropertyArrayUsageHelper //shizhoubo
111 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
114 const OUString& getCommandURL() const { return m_aCommandURL; }
115 const OUString& getModuleName() const;
117 void dispatchCommand( const OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
119 void enable( bool bEnable );
121 protected:
122 bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
123 void setSupportVisibleProperty(sal_Bool bValue); //shizhoubo
124 struct Listener
126 Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
127 aURL( rURL ), xDispatch( rDispatch ) {}
129 ::com::sun::star::util::URL aURL;
130 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
133 typedef ::boost::unordered_map< OUString,
134 com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
135 OUStringHash,
136 ::std::equal_to< OUString > > URLToDispatchMap;
138 // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
139 void addStatusListener( const OUString& aCommandURL );
140 void removeStatusListener( const OUString& aCommandURL );
141 void bindListener();
142 void unbindListener();
143 sal_Bool isBound() const;
144 sal_Bool hasBigImages() const;
145 ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
146 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParent() const;
148 sal_Bool m_bInitialized : 1,
149 m_bDisposed : 1;
150 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
151 ToolboxController_Impl* m_pImpl;
152 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
153 OUString m_aCommandURL;
154 URLToDispatchMap m_aListenerMap;
155 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
160 #endif // _SVTOOLS_TOOLBOXCONTROLLER_HXX
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */