tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / sfx2 / sfxbasecontroller.hxx
blob978cd5669d45c5d82599a4e87eab4fd6c026a850
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; }
53 namespace weld { class Button; }
55 struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
57 class NotifyEvent;
58 class SfxViewFrame;
59 class SfxViewShell;
61 sal_Int16 MapGroupIDToCommandGroup( SfxGroupId nGroupID );
66 typedef ::cppu::WeakImplHelper < css::frame::XController2
67 , css::frame::XControllerBorder
68 , css::frame::XDispatchProvider
69 , css::task::XStatusIndicatorSupplier
70 , css::ui::XContextMenuInterception
71 , css::awt::XUserInputInterception
72 , css::frame::XDispatchInformationProvider
73 , css::frame::XInfobarProvider
74 , css::frame::XTitle
75 , css::frame::XTitleChangeBroadcaster
76 , css::lang::XInitialization
77 > SfxBaseController_Base;
79 class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base
80 ,public ::cppu::BaseMutex
83 // public methods
86 public:
89 // constructor/destructor
92 SfxBaseController( SfxViewShell* pView ) ;
94 virtual ~SfxBaseController() override ;
96 SAL_DLLPRIVATE void ReleaseShell_Impl();
97 SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
99 css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) override;
102 // XController2
103 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override;
104 virtual OUString SAL_CALL getViewControllerName() override;
105 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() override;
107 virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
110 // XController
113 virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) override ;
115 virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) override ;
117 virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) override ;
119 css::uno::Any SAL_CALL getViewData() override ;
121 void SAL_CALL restoreViewData( const css::uno::Any& aValue ) override ;
123 css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override ;
125 css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override ;
128 // XDispatchProvider
131 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL ,
132 const OUString & sTargetFrameName,
133 sal_Int32 eSearchFlags ) override ;
135 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) override ;
138 // XControllerBorder
141 virtual css::frame::BorderWidths SAL_CALL getBorder() override;
142 virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
143 virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) override;
144 virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) override;
147 // XComponent
150 virtual void SAL_CALL dispose() override ;
152 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
154 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
155 virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
156 virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) override;
158 virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
159 virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
160 virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
161 virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
164 // XDispatchInformationProvider
165 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() override;
166 virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) override;
168 // css::frame::XTitle
169 virtual OUString SAL_CALL getTitle( ) override;
170 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
172 // css::frame::XTitleChangeBroadcaster
173 virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
174 virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
176 // css::lang::XInitialization
177 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
179 // XInfobarProvider
180 virtual void SAL_CALL
181 appendInfobar(const OUString& sId, const OUString& sPrimaryMessage,
182 const OUString& sSecondaryMessage, sal_Int32 aInfobarType,
183 const css::uno::Sequence<css::beans::StringPair>& actionButtons,
184 sal_Bool bShowCloseButton) override;
185 virtual void SAL_CALL updateInfobar(const OUString& sId, const OUString& sPrimaryMessage,
186 const OUString& sSecondaryMessage,
187 sal_Int32 aInfobarType) override;
188 virtual void SAL_CALL removeInfobar(const OUString& sId) override;
189 virtual sal_Bool SAL_CALL hasInfobar(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 ();
200 protected:
201 void CopyLokViewCallbackFromFrameCreator();
203 private:
204 enum ConnectSfxFrame
206 E_CONNECT,
207 E_DISCONNECT,
208 E_RECONNECT
210 SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
211 SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
212 SAL_DLLPRIVATE void ShowInfoBars( );
214 DECL_DLLPRIVATE_LINK( CheckOutHandler, weld::Button&, void );
216 std::unique_ptr<IMPL_SfxBaseController_DataContainer> m_pData ;
218 } ; // class SfxBaseController
220 #endif // _SFX_SFXBASECONTROLLER_HXX
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */