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