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