Coverage Report

Created: 2025-12-31 10:39

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