xref: /trunk/main/sfx2/inc/sfx2/module.hxx (revision 353d8f4d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SFXMODULE_HXX
24 #define _SFXMODULE_HXX	// intern
25 #define _SFXMOD_HXX		// extern
26 
27 #include "sal/config.h"
28 #include "sfx2/dllapi.h"
29 #include <sfx2/shell.hxx>
30 #include <sfx2/imgdef.hxx>
31 #include <sal/types.h>
32 #include <tools/fldunit.hxx>
33 #include <com/sun/star/uno/Reference.hxx>
34 
35 class ImageList;
36 
37 class SfxBindings;
38 class SfxObjectFactory;
39 class ModalDialog;
40 class SfxObjectFactory;
41 class SfxModuleArr_Impl;
42 class SfxModule_Impl;
43 class SfxSlotPool;
44 struct SfxChildWinContextFactory;
45 struct SfxChildWinFactory;
46 struct SfxMenuCtrlFactory;
47 struct SfxStbCtrlFactory;
48 struct SfxTbxCtrlFactory;
49 class SfxTbxCtrlFactArr_Impl;
50 class SfxChildWinFactArr_Impl;
51 class SfxMenuCtrlFactArr_Impl;
52 class SfxStbCtrlFactArr_Impl;
53 class SfxTabPage;
54 class Window;
55 
56 namespace com { namespace sun { namespace star { namespace frame {
57     class XFrame;
58 } } } }
59 //====================================================================
60 
61 class SFX2_DLLPUBLIC SfxModule : public SfxShell
62 {
63 private:
64 	ResMgr*                     pResMgr;
65     sal_Bool                    bDummy : 1;
66 	SfxModule_Impl*             pImpl;
67 
68 //#if 0 // _SOLAR__PRIVATE
69 	SAL_DLLPRIVATE void Construct_Impl();
70 //#endif
71 
72 public:
73 								TYPEINFO();
74 								SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
75 
76 								SfxModule( ResMgr* pMgrP, sal_Bool bDummy,
77 									SfxObjectFactory* pFactoryP, ... );
78 								~SfxModule();
79 
GetResMgr() const80     ResMgr*                     GetResMgr() const { return SfxShell::GetResMgr(); }
81     virtual ResMgr*             GetResMgr();
82 	SfxSlotPool*				GetSlotPool() const;
83 
84 	void						RegisterToolBoxControl(SfxTbxCtrlFactory*);
85 	void                        RegisterChildWindow(SfxChildWinFactory*);
86 	void                        RegisterChildWindowContext( sal_uInt16,	SfxChildWinContextFactory* );
87 	void                        RegisterStatusBarControl(SfxStbCtrlFactory*);
88 	void                        RegisterMenuControl(SfxMenuCtrlFactory*);
89 
90 	virtual SfxTabPage*			CreateTabPage( sal_uInt16 nId,
91 											   Window* pParent,
92 											   const SfxItemSet& rSet );
93     virtual void                Invalidate(sal_uInt16 nId = 0);
94 	sal_Bool						IsActive() const;
95 
96     /*virtual*/ bool            IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const;
97 
98     static SfxModule*           GetActiveModule( SfxViewFrame* pFrame=NULL );
99 	static FieldUnit			GetCurrentFieldUnit();
100     /** retrieves the field unit of the module belonging to the document displayed in the given frame
101 
102         Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
103         the document in this frame, then this module's field unit.
104 
105         Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned.
106      */
107     static FieldUnit            GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame );
108 	FieldUnit					GetFieldUnit() const;
109 
110 //#if 0 // _SOLAR__PRIVATE
111     SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl();
112     SAL_DLLPRIVATE static void DestroyModules_Impl();
113     SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
114     SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
115     SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const;
116     SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
117     SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig );
118     SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig, sal_Bool bHiContrast );
119 //#endif
120 };
121 
122 #endif
123 
124