Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / include / sfx2 / module.hxx
blob6f9777aca7cb678a1f01227e89dbdef5ca6cd4bd
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 <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;
32 class SfxModule_Impl;
33 class SfxSlotPool;
34 struct SfxChildWinFactory;
35 struct SfxStbCtrlFactory;
36 struct SfxTbxCtrlFactory;
37 class SfxTabPage;
38 class SfxTbxCtrlFactArr_Impl;
39 class SfxStbCtrlFactArr_Impl;
40 class SfxChildWinFactArr_Impl;
42 namespace com { namespace sun { namespace star { namespace frame {
43 class XFrame;
44 } } } }
46 namespace weld {
47 class Container;
48 class DialogController;
51 class SFX2_DLLPUBLIC SfxModule : public SfxShell
53 private:
54 // Warning this cannot be turned into a unique_ptr.
55 // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
56 SfxModule_Impl* pImpl;
58 SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
60 public:
61 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
63 private:
64 /// SfxInterface initializer.
65 static void InitInterface_Impl() {}
67 public:
69 SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
70 virtual ~SfxModule() override;
72 std::locale GetResLocale() const;
73 SfxSlotPool* GetSlotPool() const;
75 void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
76 void RegisterChildWindow(std::unique_ptr<SfxChildWinFactory>);
77 void RegisterStatusBarControl(const SfxStbCtrlFactory&);
79 virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
80 weld::Container* pPage, weld::DialogController* pController,
81 const SfxItemSet& rSet );
82 virtual void Invalidate(sal_uInt16 nId = 0) override;
84 virtual std::unique_ptr<SfxStyleFamilies> CreateStyleFamilies() { return nullptr; }
86 static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr );
87 static FieldUnit GetCurrentFieldUnit();
88 /** retrieves the field unit of the module belonging to the document displayed in the given frame
90 Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
91 the document in this frame, then this module's field unit.
93 Failures in any of those steps are reported as assertion in non-product builds, and then FieldUnit::MM_100TH is returned.
95 static FieldUnit GetModuleFieldUnit( css::uno::Reference< css::frame::XFrame > const & i_frame );
96 FieldUnit GetFieldUnit() const;
98 SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
99 SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
100 SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */