bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / sfxbasecontroller.hxx
bloba414b1479a7c16bd12d076fb6a688d1641a1f1e3
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 INCLUDED_SFX2_SFXBASECONTROLLER_HXX
21 #define INCLUDED_SFX2_SFXBASECONTROLLER_HXX
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <sal/types.h>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <com/sun/star/frame/XDispatchProvider.hpp>
28 #include <com/sun/star/frame/DispatchDescriptor.hpp>
29 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
30 #include <com/sun/star/frame/XController2.hpp>
31 #include <com/sun/star/frame/XControllerBorder.hpp>
32 #include <com/sun/star/frame/XModel.hpp>
33 #include <com/sun/star/frame/XFrame.hpp>
34 #include <com/sun/star/frame/XTitle.hpp>
35 #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
36 #include <com/sun/star/util/URL.hpp>
37 #include <com/sun/star/lang/XTypeProvider.hpp>
38 #include <cppuhelper/implbase9.hxx>
39 #include <cppuhelper/basemutex.hxx>
40 #include <osl/mutex.hxx>
41 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
42 #include <com/sun/star/ui/XContextMenuInterception.hpp>
43 #include <com/sun/star/ui/XContextMenuInterceptor.hpp>
44 #include <com/sun/star/awt/XMouseClickHandler.hpp>
45 #include <com/sun/star/awt/XKeyHandler.hpp>
46 #include <com/sun/star/awt/XUserInputInterception.hpp>
47 #include <tools/link.hxx>
48 #include <vcl/button.hxx>
50 #include <sfx2/viewsh.hxx>
51 #include <sfx2/sfxuno.hxx>
53 struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
55 class SfxViewFrame;
57 sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID );
59 //________________________________________________________________________________________________________
60 // class declarations
61 //________________________________________________________________________________________________________
63 typedef ::cppu::WeakImplHelper9 < css::frame::XController2
64 , css::frame::XControllerBorder
65 , css::frame::XDispatchProvider
66 , css::task::XStatusIndicatorSupplier
67 , css::ui::XContextMenuInterception
68 , css::awt::XUserInputInterception
69 , css::frame::XDispatchInformationProvider
70 , css::frame::XTitle
71 , css::frame::XTitleChangeBroadcaster
72 > SfxBaseController_Base;
74 class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base
75 ,public ::cppu::BaseMutex
77 //________________________________________________________________________________________________________
78 // public methods
79 //________________________________________________________________________________________________________
81 public:
83 //____________________________________________________________________________________________________
84 // constructor/destructor
85 //____________________________________________________________________________________________________
87 /**___________________________________________________________________________________________________
88 @short -
89 @descr -
91 @seealso -
93 @param -
95 @return -
97 @onerror -
100 SfxBaseController( SfxViewShell* pView ) ;
102 /**___________________________________________________________________________________________________
103 @short -
104 @descr -
106 @seealso -
108 @param -
110 @return -
112 @onerror -
115 ~SfxBaseController() ;
117 SAL_DLLPRIVATE void ReleaseShell_Impl();
118 SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
120 css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (css::uno::RuntimeException);
122 //____________________________________________________________________________________________________
123 // XController2
124 //____________________________________________________________________________________________________
125 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw (css::uno::RuntimeException);
126 virtual OUString SAL_CALL getViewControllerName() throw (css::uno::RuntimeException);
127 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() throw (css::uno::RuntimeException);
129 //____________________________________________________________________________________________________
130 // XController
131 //____________________________________________________________________________________________________
133 /**___________________________________________________________________________________________________
134 @short -
135 @descr -
137 @seealso -
139 @param -
141 @return -
143 @onerror -
146 virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ) ;
148 /**___________________________________________________________________________________________________
149 @short -
150 @descr -
152 @seealso -
154 @param -
156 @return -
158 @onerror -
161 virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ) ;
163 /**___________________________________________________________________________________________________
164 @short -
165 @descr -
167 @seealso -
169 @param -
171 @return -
173 @onerror -
176 virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw( css::uno::RuntimeException ) ;
178 /**___________________________________________________________________________________________________
179 @short -
180 @descr -
182 @seealso -
184 @param -
186 @return -
188 @onerror -
191 css::uno::Any SAL_CALL getViewData() throw( css::uno::RuntimeException ) ;
193 /**___________________________________________________________________________________________________
194 @short -
195 @descr -
197 @seealso -
199 @param -
201 @return -
203 @onerror -
206 void SAL_CALL restoreViewData( const css::uno::Any& aValue ) throw( css::uno::RuntimeException ) ;
208 /**___________________________________________________________________________________________________
209 @short -
210 @descr -
212 @seealso -
214 @param -
216 @return -
218 @onerror -
221 css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() throw( css::uno::RuntimeException ) ;
223 /**___________________________________________________________________________________________________
224 @short -
225 @descr -
227 @seealso -
229 @param -
231 @return -
233 @onerror -
236 css::uno::Reference< css::frame::XModel > SAL_CALL getModel() throw( css::uno::RuntimeException ) ;
238 //____________________________________________________________________________________________________
239 // XDispatchProvider
240 //____________________________________________________________________________________________________
242 /**___________________________________________________________________________________________________
243 @short -
244 @descr -
246 @seealso -
248 @param -
250 @return -
252 @onerror -
255 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL ,
256 const OUString & sTargetFrameName,
257 FrameSearchFlags eSearchFlags ) throw( css::uno::RuntimeException ) ;
259 /**___________________________________________________________________________________________________
260 @short -
261 @descr -
263 @seealso -
265 @param -
267 @return -
269 @onerror -
272 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) throw( css::uno::RuntimeException ) ;
274 //____________________________________________________________________________________________________
275 // XControllerBorder
276 //____________________________________________________________________________________________________
278 virtual css::frame::BorderWidths SAL_CALL getBorder() throw (css::uno::RuntimeException);
279 virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException);
280 virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException);
281 virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) throw (css::uno::RuntimeException);
283 //____________________________________________________________________________________________________
284 // XComponent
285 //____________________________________________________________________________________________________
287 /**___________________________________________________________________________________________________
288 @short -
289 @descr -
291 @seealso -
293 @param -
295 @return -
297 @onerror -
300 virtual void SAL_CALL dispose() throw( css::uno::RuntimeException ) ;
302 /**___________________________________________________________________________________________________
303 @short -
304 @descr -
306 @seealso -
308 @param -
310 @return -
312 @onerror -
315 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ;
317 /**___________________________________________________________________________________________________
318 @short -
319 @descr -
321 @seealso -
323 @param -
325 @return -
327 @onerror -
330 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ;
331 virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException );
332 virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException );
334 virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException);
335 virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException);
336 virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException);
337 virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException);
339 //____________________________________________________________________________________________________
340 // XDispatchInformationProvider
341 //____________________________________________________________________________________________________
342 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (css::uno::RuntimeException);
343 virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException);
345 // css::frame::XTitle
346 virtual OUString SAL_CALL getTitle( ) throw (css::uno::RuntimeException);
347 virtual void SAL_CALL setTitle( const OUString& sTitle ) throw (css::uno::RuntimeException);
349 // css::frame::XTitleChangeBroadcaster
350 virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException);
351 virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException);
353 // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now;
354 // either the _Impl name should vanish or there should be an "official" API
355 SfxViewShell* GetViewShell_Impl() const;
356 SAL_DLLPRIVATE sal_Bool HandleEvent_Impl( NotifyEvent& rEvent );
357 SAL_DLLPRIVATE sal_Bool HasKeyListeners_Impl();
358 SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl();
359 SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs );
360 SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
361 private:
362 enum ConnectSfxFrame
364 E_CONNECT,
365 E_DISCONNECT,
366 E_RECONNECT
368 SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
369 SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
370 SAL_DLLPRIVATE void ShowInfoBars( );
372 DECL_LINK( CheckOutHandler, void * );
374 //________________________________________________________________________________________________________
375 // private variables
376 //________________________________________________________________________________________________________
378 private:
380 IMPL_SfxBaseController_DataContainer* m_pData ;
382 } ; // class SfxBaseController
384 #endif // _SFX_SFXBASECONTROLLER_HXX
386 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */