xref: /aoo41x/main/sfx2/source/appl/appreg.cxx (revision 3dcccbb6)
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 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 #include <vcl/toolbox.hxx>
32 
33 #ifndef GCC
34 #endif
35 
36 #include <sfx2/app.hxx>
37 #include "appdata.hxx"
38 #include "arrdecl.hxx"
39 #include "sfx2/sfxhelp.hxx"
40 #include <sfx2/templdlg.hxx>
41 #include "inettbc.hxx"
42 #include "sfx2/stbitem.hxx"
43 #include <sfx2/navigat.hxx>
44 #include <sfx2/taskpane.hxx>
45 #include <sfx2/module.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include "partwnd.hxx"
48 #include <sfx2/sfxsids.hrc>
49 #include "recfloat.hxx"
50 #include <sfx2/objsh.hxx>
51 #include <sfx2/viewsh.hxx>
52 #include <sfx2/objface.hxx>
53 #include <sfx2/mnuitem.hxx>
54 
55 //===================================================================
56 
57 void SfxApplication::Registrations_Impl()
58 {
59 	// Interfaces
60 	SfxApplication::RegisterInterface();
61 	SfxModule::RegisterInterface();
62 	SfxViewFrame::RegisterInterface();
63 	SfxObjectShell::RegisterInterface();
64 	SfxViewShell::RegisterInterface();
65 
66 	// ChildWindows
67 	SfxRecordingFloatWrapper_Impl::RegisterChildWindow();
68 	SfxNavigatorWrapper::RegisterChildWindow( sal_False, NULL, SFX_CHILDWIN_NEVERHIDE );
69 	SfxPartChildWnd_Impl::RegisterChildWindow();
70 	SfxTemplateDialogWrapper::RegisterChildWindow(sal_True);
71 	SfxDockingWrapper::RegisterChildWindow();
72 
73 	// Controller
74 	SfxToolBoxControl::RegisterControl(SID_REPEAT);
75 	SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL);
76 	SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT );
77 	SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU );
78 };
79 
80 //--------------------------------------------------------------------
81 
82 void SfxApplication::RegisterToolBoxControl_Impl( SfxModule *pMod, SfxTbxCtrlFactory *pFact )
83 {
84 	if ( pMod )
85 	{
86 		pMod->RegisterToolBoxControl( pFact );
87 		return;
88 	}
89 
90 #ifdef DBG_UTIL
91     for ( sal_uInt16 n=0; n<pAppData_Impl->pTbxCtrlFac->Count(); n++ )
92 	{
93         SfxTbxCtrlFactory *pF = (*pAppData_Impl->pTbxCtrlFac)[n];
94 		if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId &&
95 			(pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) )
96 		{
97 			DBG_WARNING("TbxController-Registrierung ist nicht eindeutig!");
98 		}
99 	}
100 #endif
101 
102     pAppData_Impl->pTbxCtrlFac->C40_INSERT( SfxTbxCtrlFactory, pFact, pAppData_Impl->pTbxCtrlFac->Count() );
103 }
104 
105 //--------------------------------------------------------------------
106 
107 void SfxApplication::RegisterStatusBarControl_Impl( SfxModule *pMod, SfxStbCtrlFactory *pFact )
108 {
109 	if ( pMod )
110 	{
111 		pMod->RegisterStatusBarControl( pFact );
112 		return;
113 	}
114 
115 #ifdef DBG_UTIL
116     for ( sal_uInt16 n=0; n<pAppData_Impl->pStbCtrlFac->Count(); n++ )
117 	{
118         SfxStbCtrlFactory *pF = (*pAppData_Impl->pStbCtrlFac)[n];
119 		if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId &&
120 			(pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) )
121 		{
122 			DBG_WARNING("StbController-Registrierung ist nicht eindeutig!");
123 		}
124 	}
125 #endif
126 
127     pAppData_Impl->pStbCtrlFac->C40_INSERT( SfxStbCtrlFactory, pFact, pAppData_Impl->pStbCtrlFac->Count() );
128 }
129 
130 //--------------------------------------------------------------------
131 
132 void SfxApplication::RegisterMenuControl_Impl( SfxModule *pMod, SfxMenuCtrlFactory *pFact )
133 {
134 	if ( pMod )
135 	{
136 		pMod->RegisterMenuControl( pFact );
137 		return;
138 	}
139 
140 #ifdef DBG_UTIL
141     for ( sal_uInt16 n=0; n<pAppData_Impl->pMenuCtrlFac->Count(); n++ )
142 	{
143         SfxMenuCtrlFactory *pF = (*pAppData_Impl->pMenuCtrlFac)[n];
144 		if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId &&
145 			(pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) )
146 		{
147 			DBG_WARNING("MenuController-Registrierung ist nicht eindeutig!");
148 		}
149 	}
150 #endif
151 
152     pAppData_Impl->pMenuCtrlFac->C40_INSERT( SfxMenuCtrlFactory, pFact, pAppData_Impl->pMenuCtrlFac->Count() );
153 }
154