LibreOffice Module sfx2 (master) 1
sfxbasecontroller.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SFX2_SFXBASECONTROLLER_HXX
21#define INCLUDED_SFX2_SFXBASECONTROLLER_HXX
22
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>
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>
41
42#include <sfx2/groupid.hxx>
43
44namespace com::sun::star::awt { class XKeyHandler; }
45namespace com::sun::star::awt { class XMouseClickHandler; }
46namespace com::sun::star::frame { class XDispatch; }
47namespace com::sun::star::frame { class XFrame; }
48namespace com::sun::star::frame { class XModel; }
49namespace com::sun::star::frame { struct DispatchDescriptor; }
50namespace com::sun::star::ui { class XContextMenuInterceptor; }
51namespace com::sun::star::ui { class XSidebarProvider; }
52namespace com::sun::star::util { struct URL; }
53namespace weld { class Button; }
54
55struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
56
57class NotifyEvent;
58class SfxViewFrame;
59class SfxViewShell;
60
61sal_Int16 MapGroupIDToCommandGroup( SfxGroupId nGroupID );
62
63
64
65
66typedef ::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
78
80 ,public ::cppu::BaseMutex
81{
82
83// public methods
84
85
86public:
87
88
89 // constructor/destructor
90
91
93
94 virtual ~SfxBaseController() override ;
95
96 SAL_DLLPRIVATE void ReleaseShell_Impl();
97 SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
98
99 css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) override;
100
101
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;
106
107 virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
108
109
110 // XController
111
112
113 virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) override ;
114
115 virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) override ;
116
117 virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) override ;
118
119 css::uno::Any SAL_CALL getViewData() override ;
120
121 void SAL_CALL restoreViewData( const css::uno::Any& aValue ) override ;
122
123 css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override ;
124
125 css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override ;
126
127
128 // XDispatchProvider
129
130
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 ;
134
135 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) override ;
136
137
138 // XControllerBorder
139
140
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;
145
146
147 // XComponent
148
149
150 virtual void SAL_CALL dispose() override ;
151
152 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override ;
153
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;
157
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;
162
163
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;
167
168 // css::frame::XTitle
169 virtual OUString SAL_CALL getTitle( ) override;
170 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
171
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;
175
176 // css::lang::XInitialization
177 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
178
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;
190
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
200protected:
201 void CopyLokViewCallbackFromFrameCreator();
202
203private:
205 {
208 E_RECONNECT
209 };
210 SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
211 SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
212 SAL_DLLPRIVATE void ShowInfoBars( );
213
214 DECL_DLLPRIVATE_LINK( CheckOutHandler, weld::Button&, void );
215
216 std::unique_ptr<IMPL_SfxBaseController_DataContainer> m_pData ;
217
218} ; // class SfxBaseController
219
220#endif // _SFX_SFXBASECONTROLLER_HXX
221
222/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< IMPL_SfxBaseController_DataContainer > m_pData
DECL_DLLPRIVATE_LINK(CheckOutHandler, weld::Button &, void)
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
Definition: viewsh.hxx:165
URL aURL
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
SfxGroupId
Definition: groupid.hxx:30
Sequence< PropertyValue > aArguments
std::u16string_view getTitle(std::u16string_view aPath)
void dispose()
sal_Int16 MapGroupIDToCommandGroup(SfxGroupId nGroupID)
::cppu::WeakImplHelper< css::frame::XController2, css::frame::XControllerBorder, css::frame::XDispatchProvider, css::task::XStatusIndicatorSupplier, css::ui::XContextMenuInterception, css::awt::XUserInputInterception, css::frame::XDispatchInformationProvider, css::frame::XInfobarProvider, css::frame::XTitle, css::frame::XTitleChangeBroadcaster, css::lang::XInitialization > SfxBaseController_Base
Reference< XFrame > xFrame
Reference< XModel > xModel
unsigned char sal_Bool
OUString sId