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