Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / sfxbasecontroller.hxx
blob95a082cdae32f62566aaf2c08aa827566d803500
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 <memory>
24 #include <sal/config.h>
25 #include <sfx2/dllapi.h>
26 #include <sal/types.h>
27 #include <com/sun/star/frame/XDispatchProvider.hpp>
28 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
29 #include <com/sun/star/frame/XController2.hpp>
30 #include <com/sun/star/frame/XControllerBorder.hpp>
31 #include <com/sun/star/frame/XInfobarProvider.hpp>
32 #include <com/sun/star/frame/XTitle.hpp>
33 #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <cppuhelper/implbase.hxx>
36 #include <cppuhelper/basemutex.hxx>
37 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
38 #include <com/sun/star/ui/XContextMenuInterception.hpp>
39 #include <com/sun/star/awt/XUserInputInterception.hpp>
40 #include <tools/link.hxx>
42 #include <sfx2/groupid.hxx>
44 namespace com::sun::star::awt { class XKeyHandler; }
45 namespace com::sun::star::awt { class XMouseClickHandler; }
46 namespace com::sun::star::frame { class XDispatch; }
47 namespace com::sun::star::frame { class XFrame; }
48 namespace com::sun::star::frame { class XModel; }
49 namespace com::sun::star::frame { struct DispatchDescriptor; }
50 namespace com::sun::star::ui { class XContextMenuInterceptor; }
51 namespace com::sun::star::ui { class XSidebarProvider; }
52 namespace com::sun::star::util { struct URL; }
54 struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
56 class Button;
57 class NotifyEvent;
58 class SfxViewFrame;
59 class SfxViewShell;
61 sal_Int16 MapGroupIDToCommandGroup( SfxGroupId nGroupID );
64 // class declarations
67 typedef ::cppu::WeakImplHelper < css::frame::XController2
68 , css::frame::XControllerBorder
69 , css::frame::XDispatchProvider
70 , css::task::XStatusIndicatorSupplier
71 , css::ui::XContextMenuInterception
72 , css::awt::XUserInputInterception
73 , css::frame::XDispatchInformationProvider
74 , css::frame::XInfobarProvider
75 , css::frame::XTitle
76 , css::frame::XTitleChangeBroadcaster
77 , css::lang::XInitialization
78 > SfxBaseController_Base;
80 class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base
81 ,public ::cppu::BaseMutex
84 // public methods
87 public:
90 // constructor/destructor
93 SfxBaseController( SfxViewShell* pView ) ;
95 virtual ~SfxBaseController() override ;
97 SAL_DLLPRIVATE void ReleaseShell_Impl();
98 SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
100 css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) override;
103 // XController2
104 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override;
105 virtual OUString SAL_CALL getViewControllerName() override;
106 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() override;
108 virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
111 // XController
114 virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) override ;
116 virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) override ;
118 virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) override ;
120 css::uno::Any SAL_CALL getViewData() override ;
122 void SAL_CALL restoreViewData( const css::uno::Any& aValue ) override ;
124 css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override ;
126 css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override ;
129 // XDispatchProvider
132 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL ,
133 const OUString & sTargetFrameName,
134 sal_Int32 eSearchFlags ) override ;
136 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) override ;
139 // XControllerBorder
142 virtual css::frame::BorderWidths SAL_CALL getBorder() override;
143 virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
144 virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
145 virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) override;
148 // XComponent
151 virtual void SAL_CALL dispose() override ;
153 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
155 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
156 virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
157 virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
159 virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
160 virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
161 virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
162 virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
165 // XDispatchInformationProvider
166 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() override;
167 virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) override;
169 // css::frame::XTitle
170 virtual OUString SAL_CALL getTitle( ) override;
171 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
173 // css::frame::XTitleChangeBroadcaster
174 virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
175 virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
177 // css::lang::XInitialization
178 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
180 // XInfobarProvider
181 virtual void SAL_CALL
182 appendInfobar(const OUString& sId, const OUString& sPrimaryMessage,
183 const OUString& sSecondaryMessage, sal_Int32 aInfobarType,
184 const css::uno::Sequence<css::beans::StringPair>& actionButtons,
185 sal_Bool bShowCloseButton) override;
186 virtual void SAL_CALL updateInfobar(const OUString& sId, const OUString& sPrimaryMessage,
187 const OUString& sSecondaryMessage,
188 sal_Int32 aInfobarType) override;
189 virtual void SAL_CALL removeInfobar(const OUString& sId) override;
191 // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now;
192 // either the _Impl name should vanish or there should be an "official" API
193 SfxViewShell* GetViewShell_Impl() const;
194 SAL_DLLPRIVATE bool HandleEvent_Impl( NotifyEvent const & rEvent );
195 SAL_DLLPRIVATE bool HasKeyListeners_Impl() const;
196 SAL_DLLPRIVATE bool HasMouseClickListeners_Impl() const;
197 SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs );
198 SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
199 private:
200 enum ConnectSfxFrame
202 E_CONNECT,
203 E_DISCONNECT,
204 E_RECONNECT
206 SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
207 SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
208 SAL_DLLPRIVATE void ShowInfoBars( );
210 DECL_LINK( CheckOutHandler, Button*, void );
212 std::unique_ptr<IMPL_SfxBaseController_DataContainer> m_pData ;
214 } ; // class SfxBaseController
216 #endif // _SFX_SFXBASECONTROLLER_HXX
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */