Line data Source code
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 : #ifndef INCLUDED_SFX2_MODULE_HXX
20 : #define INCLUDED_SFX2_MODULE_HXX // internal
21 : #define _SFXMOD_HXX // external
22 :
23 : #include <sal/config.h>
24 : #include <sfx2/app.hxx>
25 : #include <sfx2/dllapi.h>
26 : #include <sfx2/shell.hxx>
27 : #include <svtools/imgdef.hxx>
28 : #include <sal/types.h>
29 : #include <tools/fldunit.hxx>
30 : #include <com/sun/star/uno/Reference.hxx>
31 : #include <vector>
32 :
33 : class ImageList;
34 :
35 : class SfxBindings;
36 : class SfxObjectFactory;
37 : class ModalDialog;
38 : class SfxObjectFactory;
39 : class SfxModule;
40 : typedef ::std::vector<SfxModule*> SfxModuleArr_Impl;
41 : class SfxModule_Impl;
42 : class SfxSlotPool;
43 : struct SfxChildWinContextFactory;
44 : struct SfxChildWinFactory;
45 : struct SfxMenuCtrlFactory;
46 : struct SfxStbCtrlFactory;
47 : struct SfxTbxCtrlFactory;
48 : class SfxTabPage;
49 : namespace vcl { class Window; }
50 :
51 : namespace com { namespace sun { namespace star { namespace frame {
52 : class XFrame;
53 : } } } }
54 :
55 :
56 : class SFX2_DLLPUBLIC SfxModule : public SfxShell
57 : {
58 : private:
59 : ResMgr* pResMgr;
60 : bool bDummy : 1;
61 : SfxModule_Impl* pImpl;
62 :
63 : SAL_DLLPRIVATE void Construct_Impl();
64 :
65 : public:
66 : TYPEINFO_OVERRIDE();
67 303 : SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
68 :
69 : private:
70 : /// SfxInterface initializer.
71 : static void InitInterface_Impl();
72 :
73 : public:
74 :
75 : SfxModule( ResMgr* pMgrP, bool bDummy,
76 : SfxObjectFactory* pFactoryP, ... );
77 : virtual ~SfxModule();
78 :
79 : ResMgr* GetResMgr() const { return SfxShell::GetResMgr(); }
80 : virtual ResMgr* GetResMgr();
81 : SfxSlotPool* GetSlotPool() const;
82 :
83 : void RegisterToolBoxControl(SfxTbxCtrlFactory*);
84 : void RegisterChildWindow(SfxChildWinFactory*);
85 : void RegisterStatusBarControl(SfxStbCtrlFactory*);
86 : void RegisterMenuControl(SfxMenuCtrlFactory*);
87 :
88 : virtual SfxTabPage* CreateTabPage( sal_uInt16 nId,
89 : vcl::Window* pParent,
90 : const SfxItemSet& rSet );
91 : virtual void Invalidate(sal_uInt16 nId = 0) SAL_OVERRIDE;
92 :
93 : bool IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const;
94 :
95 : static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL );
96 : static FieldUnit GetCurrentFieldUnit();
97 : /** retrieves the field unit of the module belonging to the document displayed in the given frame
98 :
99 : Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
100 : the document in this frame, then this module's field unit.
101 :
102 : Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned.
103 : */
104 : static FieldUnit GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame );
105 : FieldUnit GetFieldUnit() const;
106 :
107 : SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl();
108 : SAL_DLLPRIVATE static void DestroyModules_Impl();
109 : SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
110 : SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
111 : SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const;
112 : SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
113 : SAL_DLLPRIVATE ImageList* GetImageList_Impl( bool bBig );
114 : };
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|