1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
57 sal_Int16
MapGroupIDToCommandGroup( sal_Int16 nGroupID
);
59 //________________________________________________________________________________________________________
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
71 , css::frame::XTitleChangeBroadcaster
72 > SfxBaseController_Base
;
74 class SFX2_DLLPUBLIC SfxBaseController
:public SfxBaseController_Base
75 ,public ::cppu::BaseMutex
77 //________________________________________________________________________________________________________
79 //________________________________________________________________________________________________________
83 //____________________________________________________________________________________________________
84 // constructor/destructor
85 //____________________________________________________________________________________________________
87 /**___________________________________________________________________________________________________
100 SfxBaseController( SfxViewShell
* pView
) ;
102 /**___________________________________________________________________________________________________
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 //____________________________________________________________________________________________________
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 //____________________________________________________________________________________________________
131 //____________________________________________________________________________________________________
133 /**___________________________________________________________________________________________________
146 virtual void SAL_CALL
attachFrame( const css::uno::Reference
< css::frame::XFrame
>& xFrame
) throw( css::uno::RuntimeException
) ;
148 /**___________________________________________________________________________________________________
161 virtual sal_Bool SAL_CALL
attachModel( const css::uno::Reference
< css::frame::XModel
>& xModel
) throw( css::uno::RuntimeException
) ;
163 /**___________________________________________________________________________________________________
176 virtual sal_Bool SAL_CALL
suspend( sal_Bool bSuspend
) throw( css::uno::RuntimeException
) ;
178 /**___________________________________________________________________________________________________
191 css::uno::Any SAL_CALL
getViewData() throw( css::uno::RuntimeException
) ;
193 /**___________________________________________________________________________________________________
206 void SAL_CALL
restoreViewData( const css::uno::Any
& aValue
) throw( css::uno::RuntimeException
) ;
208 /**___________________________________________________________________________________________________
221 css::uno::Reference
< css::frame::XFrame
> SAL_CALL
getFrame() throw( css::uno::RuntimeException
) ;
223 /**___________________________________________________________________________________________________
236 css::uno::Reference
< css::frame::XModel
> SAL_CALL
getModel() throw( css::uno::RuntimeException
) ;
238 //____________________________________________________________________________________________________
240 //____________________________________________________________________________________________________
242 /**___________________________________________________________________________________________________
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 /**___________________________________________________________________________________________________
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 //____________________________________________________________________________________________________
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 //____________________________________________________________________________________________________
285 //____________________________________________________________________________________________________
287 /**___________________________________________________________________________________________________
300 virtual void SAL_CALL
dispose() throw( css::uno::RuntimeException
) ;
302 /**___________________________________________________________________________________________________
315 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) throw( css::uno::RuntimeException
) ;
317 /**___________________________________________________________________________________________________
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 ();
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 //________________________________________________________________________________________________________
376 //________________________________________________________________________________________________________
380 IMPL_SfxBaseController_DataContainer
* m_pData
;
382 } ; // class SfxBaseController
384 #endif // _SFX_SFXBASECONTROLLER_HXX
386 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */