Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / sfx2 / module.hxx
blob099222c1aa3a320c46e7d8904b245bb33190579b
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 .
19 #ifndef INCLUDED_SFX2_MODULE_HXX
20 #define INCLUDED_SFX2_MODULE_HXX
22 #include <memory>
23 #include <optional>
24 #include <sal/config.h>
25 #include <sfx2/dllapi.h>
26 #include <sfx2/shell.hxx>
27 #include <sfx2/styfitem.hxx>
28 #include <sal/types.h>
29 #include <tools/fldunit.hxx>
30 #include <com/sun/star/uno/Reference.hxx>
32 class SfxObjectFactory;
33 class SfxModule_Impl;
34 class SfxSlotPool;
35 struct SfxChildWinFactory;
36 struct SfxStbCtrlFactory;
37 struct SfxTbxCtrlFactory;
38 class SfxTabPage;
40 namespace com::sun::star::frame {
41 class XFrame;
44 namespace weld {
45 class Container;
46 class DialogController;
49 class SFX2_DLLPUBLIC SfxModule : public SfxShell
51 private:
52 // Warning this cannot be turned into a unique_ptr.
53 // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
54 SfxModule_Impl* pImpl;
56 SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
58 public:
59 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
61 private:
62 /// SfxInterface initializer.
63 static void InitInterface_Impl() {}
65 public:
67 SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
68 virtual ~SfxModule() override;
70 std::locale GetResLocale() const;
71 SfxSlotPool* GetSlotPool() const;
73 void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
74 void RegisterChildWindow(const SfxChildWinFactory&);
75 void RegisterStatusBarControl(const SfxStbCtrlFactory&);
77 virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
78 weld::Container* pPage, weld::DialogController* pController,
79 const SfxItemSet& rSet );
80 virtual void Invalidate(sal_uInt16 nId = 0) override;
82 virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() { return {}; }
84 static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr );
85 static FieldUnit GetCurrentFieldUnit();
86 /** retrieves the field unit of the module belonging to the document displayed in the given frame
88 Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
89 the document in this frame, then this module's field unit.
91 Failures in any of those steps are reported as assertion in non-product builds, and then FieldUnit::MM_100TH is returned.
93 static FieldUnit GetModuleFieldUnit( css::uno::Reference< css::frame::XFrame > const & i_frame );
94 FieldUnit GetFieldUnit() const;
96 SAL_DLLPRIVATE SfxTbxCtrlFactory* GetTbxCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
97 SAL_DLLPRIVATE SfxStbCtrlFactory* GetStbCtrlFactory(const std::type_info& rSlotType, sal_uInt16 nSlotID) const;
98 SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const;
101 #endif
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */