xref: /AOO41X/main/sfx2/inc/sfx2/module.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SFXMODULE_HXX
28 #define _SFXMODULE_HXX	// intern
29 #define _SFXMOD_HXX		// extern
30 
31 #include "sal/config.h"
32 #include "sfx2/dllapi.h"
33 #include <sfx2/shell.hxx>
34 #include <sfx2/imgdef.hxx>
35 #include <sal/types.h>
36 #include <tools/fldunit.hxx>
37 #include <com/sun/star/uno/Reference.hxx>
38 
39 class ImageList;
40 
41 class SfxBindings;
42 class SfxObjectFactory;
43 class ModalDialog;
44 class SfxObjectFactory;
45 class SfxModuleArr_Impl;
46 class SfxModule_Impl;
47 class SfxSlotPool;
48 struct SfxChildWinContextFactory;
49 struct SfxChildWinFactory;
50 struct SfxMenuCtrlFactory;
51 struct SfxStbCtrlFactory;
52 struct SfxTbxCtrlFactory;
53 class SfxTbxCtrlFactArr_Impl;
54 class SfxChildWinFactArr_Impl;
55 class SfxMenuCtrlFactArr_Impl;
56 class SfxStbCtrlFactArr_Impl;
57 class SfxTabPage;
58 class Window;
59 
60 namespace com { namespace sun { namespace star { namespace frame {
61     class XFrame;
62 } } } }
63 //====================================================================
64 
65 class SFX2_DLLPUBLIC SfxModule : public SfxShell
66 {
67 private:
68 	ResMgr*                     pResMgr;
69     sal_Bool                    bDummy : 1;
70 	SfxModule_Impl*             pImpl;
71 
72 //#if 0 // _SOLAR__PRIVATE
73 	SAL_DLLPRIVATE void Construct_Impl();
74 //#endif
75 
76 public:
77 								TYPEINFO();
78 								SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
79 
80 								SfxModule( ResMgr* pMgrP, sal_Bool bDummy,
81 									SfxObjectFactory* pFactoryP, ... );
82 								~SfxModule();
83 
84     ResMgr*                     GetResMgr() const { return SfxShell::GetResMgr(); }
85     virtual ResMgr*             GetResMgr();
86 	SfxSlotPool*				GetSlotPool() const;
87 
88 	void						RegisterToolBoxControl(SfxTbxCtrlFactory*);
89 	void                        RegisterChildWindow(SfxChildWinFactory*);
90 	void                        RegisterChildWindowContext( sal_uInt16,	SfxChildWinContextFactory* );
91 	void                        RegisterStatusBarControl(SfxStbCtrlFactory*);
92 	void                        RegisterMenuControl(SfxMenuCtrlFactory*);
93 
94 	virtual SfxTabPage*			CreateTabPage( sal_uInt16 nId,
95 											   Window* pParent,
96 											   const SfxItemSet& rSet );
97     virtual void                Invalidate(sal_uInt16 nId = 0);
98 	sal_Bool						IsActive() const;
99 
100     /*virtual*/ bool            IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const;
101 
102     static SfxModule*           GetActiveModule( SfxViewFrame* pFrame=NULL );
103 	static FieldUnit			GetCurrentFieldUnit();
104     /** retrieves the field unit of the module belonging to the document displayed in the given frame
105 
106         Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
107         the document in this frame, then this module's field unit.
108 
109         Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned.
110      */
111     static FieldUnit            GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame );
112 	FieldUnit					GetFieldUnit() const;
113 
114 //#if 0 // _SOLAR__PRIVATE
115     SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl();
116     SAL_DLLPRIVATE static void DestroyModules_Impl();
117     SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
118     SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
119     SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const;
120     SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
121     SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig );
122     SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig, sal_Bool bHiContrast );
123 //#endif
124 };
125 
126 #endif
127 
128