build fix
[LibreOffice.git] / include / sfx2 / module.hxx
blob77c0781bd3214a74541ef2012539caf1aa967503
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 <sal/config.h>
23 #include <sfx2/app.hxx>
24 #include <sfx2/dllapi.h>
25 #include <sfx2/shell.hxx>
26 #include <sfx2/styfitem.hxx>
27 #include <svtools/imgdef.hxx>
28 #include <sal/types.h>
29 #include <tools/fldunit.hxx>
30 #include <com/sun/star/uno/Reference.hxx>
32 class ImageList;
34 class SfxBindings;
35 class SfxObjectFactory;
36 class ModalDialog;
37 class SfxObjectFactory;
38 class SfxModule;
39 class SfxModule_Impl;
40 class SfxSlotPool;
41 struct SfxChildWinContextFactory;
42 struct SfxChildWinFactory;
43 struct SfxStbCtrlFactory;
44 struct SfxTbxCtrlFactory;
45 class SfxTabPage;
46 namespace vcl { class Window; }
48 namespace com { namespace sun { namespace star { namespace frame {
49 class XFrame;
50 } } } }
53 class SFX2_DLLPUBLIC SfxModule : public SfxShell
55 private:
56 // Warning this cannot be turned into a unique_ptr.
57 // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
58 SfxModule_Impl* pImpl;
60 SAL_DLLPRIVATE void Construct_Impl(const OString& rResName);
62 public:
63 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
65 private:
66 /// SfxInterface initializer.
67 static void InitInterface_Impl() {}
69 public:
71 SfxModule(const OString& rResName, std::initializer_list<SfxObjectFactory*> pFactoryList);
72 virtual ~SfxModule() override;
74 ResMgr* GetResMgr();
75 SfxSlotPool* GetSlotPool() const;
77 void RegisterToolBoxControl(const SfxTbxCtrlFactory&);
78 void RegisterChildWindow(SfxChildWinFactory*);
79 void RegisterStatusBarControl(const SfxStbCtrlFactory&);
81 virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId,
82 vcl::Window* pParent,
83 const SfxItemSet& rSet );
84 virtual void Invalidate(sal_uInt16 nId = 0) override;
86 virtual SfxStyleFamilies* CreateStyleFamilies() { return nullptr; }
88 static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr );
89 static FieldUnit GetCurrentFieldUnit();
90 /** retrieves the field unit of the module belonging to the document displayed in the given frame
92 Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
93 the document in this frame, then this module's field unit.
95 Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned.
97 static FieldUnit GetModuleFieldUnit( css::uno::Reference< css::frame::XFrame > const & i_frame );
98 FieldUnit GetFieldUnit() const;
100 SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
101 SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
102 SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
103 SAL_DLLPRIVATE ImageList* GetImageList_Impl( bool bBig );
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */