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