bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / unoctitm.hxx
blob2641c455566b6a1a496c9d6592376513bdebb8fe
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 .
19 #ifndef INCLUDED_SFX2_UNOCTITM_HXX
20 #define INCLUDED_SFX2_UNOCTITM_HXX
22 #include <functional>
23 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
24 #include <com/sun/star/frame/XDispatchResultListener.hpp>
25 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <com/sun/star/frame/XDispatchProvider.hpp>
28 #include <com/sun/star/frame/XStatusListener.hpp>
29 #include <com/sun/star/frame/FrameSearchFlag.hpp>
30 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
31 #include <com/sun/star/frame/FeatureStateEvent.hpp>
32 #include <com/sun/star/frame/DispatchDescriptor.hpp>
33 #include <com/sun/star/util/XURLTransformer.hpp>
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include <com/sun/star/frame/XFrame.hpp>
36 #include <cppuhelper/implbase1.hxx>
37 #include <cppuhelper/interfacecontainer.hxx>
39 #include <sfx2/ctrlitem.hxx>
40 #include <osl/mutex.hxx>
42 class SfxBindings;
43 class SfxFrame;
44 class SfxDispatcher;
46 class SfxUnoControllerItem : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
48 ::com::sun::star::util::URL aCommand;
49 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
50 SfxControllerItem* pCtrlItem;
51 SfxBindings* pBindings;
53 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > TryGetDispatch( SfxFrame* pFrame );
55 public:
57 SfxUnoControllerItem( SfxControllerItem*, SfxBindings&, const OUString& );
58 ~SfxUnoControllerItem();
60 const ::com::sun::star::util::URL& GetCommand() const
61 { return aCommand; }
63 // XStatusListener
64 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
66 // Something else
67 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
68 void UnBind();
69 void GetNewDispatch();
70 void ReleaseDispatch();
71 void ReleaseBindings();
74 struct SfxStatusDispatcher_Impl_hashType
76 size_t operator()(const OUString& s) const
77 { return s.hashCode(); }
80 typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< OUString, SfxStatusDispatcher_Impl_hashType, std::equal_to< OUString > > SfxStatusDispatcher_Impl_ListenerContainer ;
82 class SfxStatusDispatcher : public ::cppu::WeakImplHelper1< css::frame::XNotifyingDispatch >
84 ::osl::Mutex aMutex;
85 SfxStatusDispatcher_Impl_ListenerContainer aListeners;
87 public:
89 SfxStatusDispatcher();
91 // XDispatch
92 virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL,
93 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
94 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException );
95 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException );
96 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 );
97 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 );
99 // Something else
100 void ReleaseAll();
101 SfxStatusDispatcher_Impl_ListenerContainer& GetListeners()
102 { return aListeners; }
105 class SfxSlotServer;
106 class SfxDispatchController_Impl;
107 class SfxOfficeDispatch : public ::cppu::ImplInheritanceHelper1< SfxStatusDispatcher, css::lang::XUnoTunnel >
109 friend class SfxDispatchController_Impl;
110 SfxDispatchController_Impl* pControllerItem;
111 public:
112 SfxOfficeDispatch( SfxBindings& rBind,
113 SfxDispatcher* pDispat,
114 const SfxSlot* pSlot,
115 const ::com::sun::star::util::URL& rURL );
116 SfxOfficeDispatch( SfxDispatcher* pDispat,
117 const SfxSlot* pSlot,
118 const ::com::sun::star::util::URL& rURL );
119 ~SfxOfficeDispatch();
121 virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL,
122 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
123 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener )
124 throw( ::com::sun::star::uno::RuntimeException );
125 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
126 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs )
127 throw( ::com::sun::star::uno::RuntimeException );
128 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl,
129 const ::com::sun::star::util::URL& aURL)
130 throw( ::com::sun::star::uno::RuntimeException );
132 // XUnoTunnel
133 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) ;
134 static const ::com::sun::star::uno::Sequence< sal_Int8 >& impl_getStaticIdentifier();
136 static sal_Bool IsMasterUnoCommand( const ::com::sun::star::util::URL& aURL );
137 static OUString GetMasterUnoCommand( const ::com::sun::star::util::URL& aURL );
139 void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
141 void SetMasterUnoCommand( sal_Bool bSet );
143 SfxDispatcher* GetDispatcher_Impl();
146 class SfxDispatchController_Impl : public SfxControllerItem
148 ::com::sun::star::util::URL aDispatchURL;
149 SfxDispatcher* pDispatcher;
150 SfxBindings* pBindings;
151 const SfxPoolItem* pLastState;
152 sal_uInt16 nSlot;
153 SfxOfficeDispatch* pDispatch;
154 sal_Bool bMasterSlave;
155 sal_Bool bVisible;
156 const char* pUnoName;
157 ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xFrame;
159 void addParametersToArgs( const com::sun::star::util::URL& aURL,
160 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ) const;
161 SfxMapUnit GetCoreMetric( SfxItemPool& rPool, sal_uInt16 nSlot );
163 public:
164 SfxDispatchController_Impl( SfxOfficeDispatch* pDisp,
165 SfxBindings* pBind,
166 SfxDispatcher* pDispat,
167 const SfxSlot* pSlot,
168 const ::com::sun::star::util::URL& rURL );
169 ~SfxDispatchController_Impl();
171 static OUString getSlaveCommand( const ::com::sun::star::util::URL& rURL );
173 void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer* pServ );
174 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
175 void setMasterSlaveCommand( sal_Bool bSet );
176 void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
177 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
178 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException );
179 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 );
180 void UnBindController();
181 SfxDispatcher* GetDispatcher();
182 void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
185 #endif
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */