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 .
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <sfx2/shell.hxx>
26 #include <sfx2/styfitem.hxx>
27 #include <sal/types.h>
28 #include <tools/fldunit.hxx>
29 #include <com/sun/star/uno/Reference.hxx>
31 class SfxObjectFactory
;
34 struct SfxChildWinFactory
;
35 struct SfxStbCtrlFactory
;
36 struct SfxTbxCtrlFactory
;
39 namespace com::sun::star::frame
{
45 class DialogController
;
48 class SFX2_DLLPUBLIC SfxModule
: public SfxShell
51 // Warning this cannot be turned into a unique_ptr.
52 // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
53 SfxModule_Impl
* pImpl
;
55 SAL_DLLPRIVATE
void Construct_Impl(const OString
& rResName
);
58 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE
)
61 /// SfxInterface initializer.
62 static void InitInterface_Impl() {}
66 SfxModule(const OString
& rResName
, std::initializer_list
<SfxObjectFactory
*> pFactoryList
);
67 virtual ~SfxModule() override
;
69 std::locale
GetResLocale() const;
70 SfxSlotPool
* GetSlotPool() const;
72 void RegisterToolBoxControl(const SfxTbxCtrlFactory
&);
73 void RegisterChildWindow(const SfxChildWinFactory
&);
74 void RegisterStatusBarControl(const SfxStbCtrlFactory
&);
76 virtual std::unique_ptr
<SfxTabPage
> CreateTabPage( sal_uInt16 nId
,
77 weld::Container
* pPage
, weld::DialogController
* pController
,
78 const SfxItemSet
& rSet
);
79 virtual void Invalidate(sal_uInt16 nId
= 0) override
;
81 virtual std::optional
<SfxStyleFamilies
> CreateStyleFamilies() { return {}; }
83 static SfxModule
* GetActiveModule( SfxViewFrame
* pFrame
=nullptr );
84 static FieldUnit
GetCurrentFieldUnit();
85 /** retrieves the field unit of the module belonging to the document displayed in the given frame
87 Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
88 the document in this frame, then this module's field unit.
90 Failures in any of those steps are reported as assertion in non-product builds, and then FieldUnit::MM_100TH is returned.
92 static FieldUnit
GetModuleFieldUnit( css::uno::Reference
< css::frame::XFrame
> const & i_frame
);
93 FieldUnit
GetFieldUnit() const;
95 SAL_DLLPRIVATE SfxTbxCtrlFactory
* GetTbxCtrlFactory(const std::type_info
& rSlotType
, sal_uInt16 nSlotID
) const;
96 SAL_DLLPRIVATE SfxStbCtrlFactory
* GetStbCtrlFactory(const std::type_info
& rSlotType
, sal_uInt16 nSlotID
) const;
97 SAL_DLLPRIVATE SfxChildWinFactory
* GetChildWinFactoryById(sal_uInt16 nId
) const;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */