xref: /aoo42x/main/sc/source/ui/app/scdll.cxx (revision b3f79822)
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_sc.hxx"
26 
27 
28 
29 #include <editeng/eeitem.hxx>
30 
31 
32 #ifndef _FM_FMOBJFAC_HXX
33 #include <svx/fmobjfac.hxx>
34 #endif
35 #include <svx/objfac3d.hxx>
36 #include <svx/tbxcolor.hxx>
37 
38 #include <sot/clsids.hxx>
39 #include <sfx2/taskpane.hxx>
40 #include <sfx2/docfilt.hxx>
41 #include <sfx2/fcontnr.hxx>
42 #include <sfx2/docfile.hxx>
43 #include <sfx2/app.hxx>
44 #include <avmedia/mediaplayer.hxx>
45 #include <avmedia/mediatoolbox.hxx>
46 #include <comphelper/types.hxx>
47 #include <svx/extrusioncolorcontrol.hxx>
48 #include <svx/fontworkgallery.hxx>
49 #include <svx/tbxcustomshapes.hxx>
50 
51 #include <svtools/parhtml.hxx>
52 #include <sot/formats.hxx>
53 #define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
54 
55 #include "scitems.hxx"		// fuer tbxctrls etc.
56 #include "scmod.hxx"
57 #include "scresid.hxx"
58 #include "sc.hrc"
59 #include "cfgids.hxx"
60 
61 //!	die Registrierung wird wegen CLOOKs in ein eigenes File wandern muessen...
62 
63 // Interface-Registrierung
64 #include "docsh.hxx"
65 #include "tabvwsh.hxx"
66 #include "prevwsh.hxx"
67 #include "drawsh.hxx"
68 #include "drformsh.hxx"
69 #include "drtxtob.hxx"
70 #include "editsh.hxx"
71 #include "pivotsh.hxx"
72 #include "auditsh.hxx"
73 #include "cellsh.hxx"
74 #include "oleobjsh.hxx"
75 #include "chartsh.hxx"
76 #include "graphsh.hxx"
77 #include "mediash.hxx"
78 #include "pgbrksh.hxx"
79 
80 #include "docpool.hxx"
81 #include "appoptio.hxx"
82 
83 // Controls
84 
85 #include <svx/tbxalign.hxx>
86 #include <svx/tbxctl.hxx>
87 #include <svx/fillctrl.hxx>
88 #include <svx/linectrl.hxx>
89 #include <svx/tbcontrl.hxx>
90 #include <svx/selctrl.hxx>
91 #include <svx/insctrl.hxx>
92 #include <svx/zoomctrl.hxx>
93 #include <editeng/flditem.hxx>
94 #include <svx/modctrl.hxx>
95 #include <svx/pszctrl.hxx>
96 #include <svx/fntctl.hxx>
97 #include <svx/fntszctl.hxx>
98 #include <svx/grafctrl.hxx>
99 #include <svx/galbrws.hxx>
100 #include <svx/clipboardctl.hxx>
101 #include <svx/lboxctrl.hxx>
102 #include <svx/verttexttbxctrl.hxx>
103 #include <svx/formatpaintbrushctrl.hxx>
104 #include "tbinsert.hxx"
105 #include "tbzoomsliderctrl.hxx"
106 #include <svx/zoomsliderctrl.hxx>
107 
108 #include <svx/xmlsecctrl.hxx>
109 // Child-Windows
110 #include "reffact.hxx"
111 #include "navipi.hxx"
112 #include "inputwin.hxx"
113 #include "spelldialog.hxx"
114 #include <svx/fontwork.hxx>
115 #include <svx/srchdlg.hxx>
116 #include <svx/hyprlink.hxx>
117 #include <svx/hyperdlg.hxx>
118 #include <svx/imapdlg.hxx>
119 
120 #include "editutil.hxx"
121 #include <svx/svdfield.hxx>		//	SdrRegisterFieldClasses
122 #include <rtl/logfile.hxx>
123 
124 #include "dwfunctr.hxx"
125 #include "acredlin.hxx"
126 
127 //------------------------------------------------------------------
128 
129 //UNUSED2008-05  //	filter detection can't use ScFilterOptions (in sc-dll),
130 //UNUSED2008-05  //	so access to wk3 flag must be implemented here again
131 //UNUSED2008-05
132 //UNUSED2008-05  class ScLibOptions : public utl::ConfigItem
133 //UNUSED2008-05  {
134 //UNUSED2008-05      sal_Bool        bWK3Flag;
135 //UNUSED2008-05
136 //UNUSED2008-05  public:
137 //UNUSED2008-05                  ScLibOptions();
138 //UNUSED2008-05      sal_Bool        GetWK3Flag() const          { return bWK3Flag; }
139 //UNUSED2008-05  };
140 //UNUSED2008-05
141 //UNUSED2008-05  #define CFGPATH_LIBFILTER		"Office.Calc/Filter/Import/Lotus123"
142 //UNUSED2008-05  #define ENTRYSTR_WK3			"WK3"
143 //UNUSED2008-05
144 //UNUSED2008-05  ScLibOptions::ScLibOptions() :
145 //UNUSED2008-05      ConfigItem( rtl::OUString::createFromAscii( CFGPATH_LIBFILTER ) ),
146 //UNUSED2008-05      bWK3Flag( sal_False )
147 //UNUSED2008-05  {
148 //UNUSED2008-05      com::sun::star::uno::Sequence<rtl::OUString> aNames(1);
149 //UNUSED2008-05      aNames[0] = rtl::OUString::createFromAscii( ENTRYSTR_WK3 );
150 //UNUSED2008-05      com::sun::star::uno::Sequence<com::sun::star::uno::Any> aValues = GetProperties(aNames);
151 //UNUSED2008-05      if ( aValues.getLength() == 1 && aValues[0].hasValue() )
152 //UNUSED2008-05          bWK3Flag = comphelper::getBOOL( aValues[0] );
153 //UNUSED2008-05  }
154 
155 //------------------------------------------------------------------
156 
157 ScResId::ScResId( sal_uInt16 nId ) :
158 	ResId( nId, *SC_MOD()->GetResMgr() )
159 {
160 }
161 
162 //------------------------------------------------------------------
163 
164 void ScDLL::Init()
165 {
166 	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDLL::Init" );
167 
168 	ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
169 	if ( *ppShlPtr )
170 		return;
171 
172 	ScDocumentPool::InitVersionMaps();	// wird im ScModule ctor gebraucht
173 
174 	ScModule* pMod = new ScModule( &ScDocShell::Factory() );
175 	(*ppShlPtr) = pMod;
176 
177 //REMOVE		ScDocShell::RegisterFactory( SDT_SC_DOCFACTPRIO );
178 
179 	ScDocShell::Factory().SetDocumentServiceName( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
180 
181 	ScGlobal::Init();		// erst wenn der ResManager initialisiert ist
182 							//	erst nach ScGlobal::Init duerfen die App-Optionen
183 							//	initialisiert werden
184 
185 	// register your view-factories here
186 
187 	ScTabViewShell		::RegisterFactory(1);
188 	ScPreviewShell		::RegisterFactory(2);
189 
190 	// register your shell-interfaces here
191 
192 	ScModule			::RegisterInterface(pMod);
193 	ScDocShell			::RegisterInterface(pMod);
194 	ScTabViewShell		::RegisterInterface(pMod);
195 	ScPreviewShell		::RegisterInterface(pMod);
196 	ScDrawShell			::RegisterInterface(pMod);
197 	ScDrawFormShell		::RegisterInterface(pMod);
198 	ScDrawTextObjectBar	::RegisterInterface(pMod);
199 	ScEditShell			::RegisterInterface(pMod);
200 	ScPivotShell		::RegisterInterface(pMod);
201 	ScAuditingShell		::RegisterInterface(pMod);
202 	ScFormatShell		::RegisterInterface(pMod);
203 	ScCellShell			::RegisterInterface(pMod);
204 	ScOleObjectShell	::RegisterInterface(pMod);
205 	ScChartShell		::RegisterInterface(pMod);
206 	ScGraphicShell		::RegisterInterface(pMod);
207 	ScMediaShell		::RegisterInterface(pMod);
208 	ScPageBreakShell	::RegisterInterface(pMod);
209 
210 	//	eigene Controller
211 	ScTbxInsertCtrl		::RegisterControl(SID_TBXCTL_INSERT, pMod);
212 	ScTbxInsertCtrl		::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
213 	ScTbxInsertCtrl		::RegisterControl(SID_TBXCTL_INSOBJ, pMod);
214     ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
215 
216 	//	Svx-Toolbox-Controller
217     SvxTbxCtlDraw                   ::RegisterControl(SID_INSERT_DRAW,          pMod);
218 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_BASIC,		pMod);
219 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_SYMBOL,	pMod);
220 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_ARROW,		pMod);
221 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_FLOWCHART, pMod);
222 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_CALLOUT,	pMod);
223 	SvxTbxCtlCustomShapes			::RegisterControl(SID_DRAWTBX_CS_STAR,		pMod);
224 	SvxTbxCtlAlign					::RegisterControl(SID_OBJECT_ALIGN,			pMod);
225 	SvxFillToolBoxControl			::RegisterControl(0, pMod);
226 	SvxLineStyleToolBoxControl		::RegisterControl(0, pMod);
227 	SvxLineWidthToolBoxControl		::RegisterControl(0, pMod);
228 	SvxLineColorToolBoxControl		::RegisterControl(0, pMod);
229 	SvxLineEndToolBoxControl		::RegisterControl(SID_ATTR_LINEEND_STYLE,	pMod);
230 	SvxStyleToolBoxControl			::RegisterControl(SID_STYLE_APPLY,			pMod);
231 	SvxFontNameToolBoxControl		::RegisterControl(SID_ATTR_CHAR_FONT,		pMod);
232 //	SvxFontHeightToolBoxControl		::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT,	pMod);
233 	SvxFontColorToolBoxControl		::RegisterControl(SID_ATTR_CHAR_COLOR,		pMod);
234 	SvxColorToolBoxControl			::RegisterControl(SID_BACKGROUND_COLOR,		pMod);
235 	SvxFrameToolBoxControl			::RegisterControl(SID_ATTR_BORDER,			pMod);
236 	SvxFrameLineStyleToolBoxControl	::RegisterControl(SID_FRAME_LINESTYLE,		pMod);
237 	SvxFrameLineColorToolBoxControl	::RegisterControl(SID_FRAME_LINECOLOR,		pMod);
238 	SvxClipBoardControl				::RegisterControl(SID_PASTE,				pMod );
239 	SvxUndoRedoControl				::RegisterControl(SID_UNDO,					pMod );
240 	SvxUndoRedoControl				::RegisterControl(SID_REDO,					pMod );
241     svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH,  pMod );
242 
243 	SvxGrafModeToolBoxControl		::RegisterControl(SID_ATTR_GRAF_MODE,		pMod);
244 	SvxGrafRedToolBoxControl		::RegisterControl(SID_ATTR_GRAF_RED,		pMod);
245 	SvxGrafGreenToolBoxControl		::RegisterControl(SID_ATTR_GRAF_GREEN,		pMod);
246 	SvxGrafBlueToolBoxControl		::RegisterControl(SID_ATTR_GRAF_BLUE,		pMod);
247 	SvxGrafLuminanceToolBoxControl	::RegisterControl(SID_ATTR_GRAF_LUMINANCE,	pMod);
248 	SvxGrafContrastToolBoxControl	::RegisterControl(SID_ATTR_GRAF_CONTRAST,	pMod);
249 	SvxGrafGammaToolBoxControl		::RegisterControl(SID_ATTR_GRAF_GAMMA,		pMod);
250 	SvxGrafTransparenceToolBoxControl::RegisterControl(SID_ATTR_GRAF_TRANSPARENCE, pMod);
251 	SvxGrafFilterToolBoxControl		::RegisterControl(SID_GRFFILTER,			pMod);
252 
253     SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL,          pMod);
254     SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL,             pMod);
255     SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT,    pMod);
256     SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM,    pMod);
257     SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
258     SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
259 
260 	//Media Controller
261 	::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
262 
263     // common SFX controller
264     ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod );
265 
266 	// Svx-StatusBar-Controller
267 	SvxInsertStatusBarControl		::RegisterControl(SID_ATTR_INSERT,		pMod);
268 	SvxSelectionModeControl			::RegisterControl(SID_STATUS_SELMODE,	pMod);
269 	SvxZoomStatusBarControl			::RegisterControl(SID_ATTR_ZOOM,		pMod);
270     SvxZoomSliderControl            ::RegisterControl(SID_ATTR_ZOOMSLIDER,  pMod);
271 	SvxModifyControl 				::RegisterControl(SID_DOC_MODIFIED,		pMod);
272 	XmlSecStatusBarControl          ::RegisterControl( SID_SIGNATURE,       pMod );
273 
274 	SvxPosSizeStatusBarControl		::RegisterControl(SID_ATTR_SIZE,		pMod);
275 
276 	// Svx-Menue-Controller
277 	SvxFontMenuControl				::RegisterControl(SID_ATTR_CHAR_FONT,		pMod);
278 	SvxFontSizeMenuControl			::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT,	pMod);
279 
280 	// CustomShape extrusion controller
281 	svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
282 	svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
283 
284 	//	Child-Windows
285 
286 	// Hack: Eingabezeile mit 42 registrieren, damit sie im PlugIn immer sichtbar ist
287 	ScInputWindowWrapper		::RegisterChildWindow(42, pMod, SFX_CHILDWIN_TASK|SFX_CHILDWIN_FORCEDOCK);
288     ScNavigatorDialogWrapper    ::RegisterChildWindowContext(
289             sal::static_int_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
290 	ScSolverDlgWrapper			::RegisterChildWindow(sal_False, pMod);
291     ScOptSolverDlgWrapper       ::RegisterChildWindow(sal_False, pMod);
292 	ScNameDlgWrapper			::RegisterChildWindow(sal_False, pMod);
293 	ScPivotLayoutWrapper		::RegisterChildWindow(sal_False, pMod);
294 	ScTabOpDlgWrapper			::RegisterChildWindow(sal_False, pMod);
295 	ScFilterDlgWrapper			::RegisterChildWindow(sal_False, pMod);
296 	ScSpecialFilterDlgWrapper	::RegisterChildWindow(sal_False, pMod);
297 	ScDbNameDlgWrapper			::RegisterChildWindow(sal_False, pMod);
298 	ScConsolidateDlgWrapper		::RegisterChildWindow(sal_False, pMod);
299 	ScPrintAreasDlgWrapper		::RegisterChildWindow(sal_False, pMod);
300 	ScCondFormatDlgWrapper		::RegisterChildWindow(sal_False, pMod);
301 	ScColRowNameRangesDlgWrapper::RegisterChildWindow(sal_False, pMod);
302 	ScFormulaDlgWrapper			::RegisterChildWindow(sal_False, pMod);
303 
304 	// First docking Window for Calc
305 	ScFunctionChildWindow		::RegisterChildWindow(sal_False, pMod);
306 
307 	// Redlining- Window
308 	ScAcceptChgDlgWrapper		::RegisterChildWindow(sal_False, pMod);
309     ScSimpleRefDlgWrapper       ::RegisterChildWindow(sal_False, pMod, SFX_CHILDWIN_ALWAYSAVAILABLE|SFX_CHILDWIN_NEVERHIDE );
310 	ScHighlightChgDlgWrapper	::RegisterChildWindow(sal_False, pMod);
311 
312     SvxSearchDialogWrapper      ::RegisterChildWindow(sal_False, pMod);
313     SvxHlinkDlgWrapper          ::RegisterChildWindow(sal_False, pMod);
314 	SvxFontWorkChildWindow		::RegisterChildWindow(sal_False, pMod);
315 	SvxHyperlinkDlgWrapper		::RegisterChildWindow(sal_False, pMod, SFX_CHILDWIN_FORCEDOCK);
316 	SvxIMapDlgChildWindow		::RegisterChildWindow(sal_False, pMod);
317 	GalleryChildWindow			::RegisterChildWindow(sal_False, pMod);
318     ScSpellDialogChildWindow    ::RegisterChildWindow(sal_False, pMod);
319 	::avmedia::MediaPlayer		::RegisterChildWindow(sal_False, pMod);
320 
321 	//<!--Added by PengYunQuan for Validity Cell Range Picker
322 	ScValidityRefChildWin::RegisterChildWindow(sal_False, pMod);
323 	//-->Added by PengYunQuan for Validity Cell Range Picker
324 
325 	//	Edit-Engine-Felder, soweit nicht schon in OfficeApplication::Init
326 
327 	SvClassManager& rClassManager = SvxFieldItem::GetClassManager();
328 //	rClassManager.SV_CLASS_REGISTER( SvxURLField );
329 //	rClassManager.SV_CLASS_REGISTER( SvxDateField );
330 //	rClassManager.SV_CLASS_REGISTER( SvxPageField );
331 	rClassManager.SV_CLASS_REGISTER( SvxPagesField );
332 //	rClassManager.SV_CLASS_REGISTER( SvxTimeField );
333 	rClassManager.SV_CLASS_REGISTER( SvxFileField );
334 //	rClassManager.SV_CLASS_REGISTER( SvxExtFileField );
335 	rClassManager.SV_CLASS_REGISTER( SvxTableField );
336 
337 	SdrRegisterFieldClasses();		// SvDraw-Felder registrieren
338 
339 	// 3D-Objekt-Factory eintragen
340     E3dObjFactory();
341 
342     // ::com::sun::star::form::component::Form-Objekt-Factory eintragen
343     FmFormObjFactory();
344 
345     pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, sal::static_int_cast<sal_uInt16>(pMod->GetAppOptions().GetAppMetric()) ) );
346 
347 	//	StarOne Services are now handled in the registry
348 }
349 
350 void ScDLL::Exit()
351 {
352 	// the SxxModule must be destroyed
353 	ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
354 	delete (*ppShlPtr);
355 	(*ppShlPtr) = NULL;
356 
357 	//	ScGlobal::Clear ist schon im Module-dtor
358 }
359 
360 // DetectFilter functionality has moved - please update your bookmarks
361 // see sc/source/ui/unoobj/scdetect.cxx, have a nice day.
362