Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / app / scdll.cxx
blob84f5823ca461b24637a1c6cedbb1f47ae79bff01
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <editeng/eeitem.hxx>
23 #include <svx/fmobjfac.hxx>
24 #include <svx/objfac3d.hxx>
25 #include <svx/tbxcolor.hxx>
27 #include <comphelper/classids.hxx>
28 #include <sfx2/taskpane.hxx>
29 #include <sfx2/sidebar/SidebarChildWindow.hxx>
30 #include <sfx2/docfilt.hxx>
31 #include <sfx2/fcontnr.hxx>
32 #include <sfx2/docfile.hxx>
33 #include <sfx2/app.hxx>
34 #include <avmedia/mediaplayer.hxx>
35 #include <avmedia/mediatoolbox.hxx>
36 #include <comphelper/types.hxx>
37 #include <svx/extrusioncolorcontrol.hxx>
38 #include <svx/fontworkgallery.hxx>
39 #include <svx/tbxcustomshapes.hxx>
41 #include <svtools/parhtml.hxx>
42 #include <sot/formats.hxx>
44 #include "scitems.hxx"
45 #include "scmod.hxx"
46 #include "scresid.hxx"
47 #include "sc.hrc"
48 #include "cfgids.hxx"
50 //! Here used to be an old German comment: "die Registrierung wird
51 //! wegen CLOOKs in ein eigenes File wandern muessen..." which refers
52 //! to the infamous CLOOK (Compiler Limit: Out of Keys) problem
53 //! (http://msdn.microsoft.com/en-us/library/3d859kh1(v=vs.71).aspx ,
54 //! which has not been relevant for many years. Presumably that is
55 //! supposed to explain some odd arrangement of source code, or
56 //! something. Or maybe that comment is completely irrelevant.
58 #include "docsh.hxx"
59 #include "tabvwsh.hxx"
60 #include "prevwsh.hxx"
61 #include "drawsh.hxx"
62 #include "drformsh.hxx"
63 #include "drtxtob.hxx"
64 #include "editsh.hxx"
65 #include "pivotsh.hxx"
66 #include "auditsh.hxx"
67 #include "cellsh.hxx"
68 #include "oleobjsh.hxx"
69 #include "chartsh.hxx"
70 #include "graphsh.hxx"
71 #include "mediash.hxx"
72 #include "pgbrksh.hxx"
74 #include "docpool.hxx"
75 #include "appoptio.hxx"
77 // Controls
79 #include <svx/tbxalign.hxx>
80 #include <svx/tbxctl.hxx>
81 #include <svx/fillctrl.hxx>
82 #include <svx/linectrl.hxx>
83 #include <svx/tbcontrl.hxx>
84 #include <svx/selctrl.hxx>
85 #include <svx/insctrl.hxx>
86 #include <svx/zoomctrl.hxx>
87 #include <editeng/flditem.hxx>
88 #include <svx/modctrl.hxx>
89 #include <svx/pszctrl.hxx>
90 #include <svx/fntctl.hxx>
91 #include <svx/fntszctl.hxx>
92 #include <svx/grafctrl.hxx>
93 #include <svx/galbrws.hxx>
94 #include <svx/clipboardctl.hxx>
95 #include <svx/lboxctrl.hxx>
96 #include <svx/verttexttbxctrl.hxx>
97 #include <svx/formatpaintbrushctrl.hxx>
98 #include "tbinsert.hxx"
99 #include "tbzoomsliderctrl.hxx"
100 #include <svx/zoomsliderctrl.hxx>
102 #include <svx/xmlsecctrl.hxx>
103 // Child-Windows
104 #include "reffact.hxx"
105 #include "navipi.hxx"
106 #include "inputwin.hxx"
107 #include "spelldialog.hxx"
108 #include <svx/fontwork.hxx>
109 #include <svx/srchdlg.hxx>
110 #include <svx/hyperdlg.hxx>
111 #include <svx/imapdlg.hxx>
113 #include "editutil.hxx"
114 #include <svx/svdfield.hxx>
116 #include "dwfunctr.hxx"
117 #include "acredlin.hxx"
119 //------------------------------------------------------------------
122 //------------------------------------------------------------------
124 ScResId::ScResId( sal_uInt16 nId ) :
125 ResId( nId, *SC_MOD()->GetResMgr() )
129 //------------------------------------------------------------------
131 void ScDLL::Init()
133 ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
134 if ( *ppShlPtr )
135 return;
137 ScDocumentPool::InitVersionMaps(); // wird im ScModule ctor gebraucht
139 ScModule* pMod = new ScModule( &ScDocShell::Factory() );
140 (*ppShlPtr) = pMod;
142 ScDocShell::Factory().SetDocumentServiceName( OUString( "com.sun.star.sheet.SpreadsheetDocument" ) );
144 ScGlobal::Init(); // erst wenn der ResManager initialisiert ist
145 // erst nach ScGlobal::Init duerfen die App-Optionen
146 // initialisiert werden
148 // register your view-factories here
150 ScTabViewShell ::RegisterFactory(1);
151 ScPreviewShell ::RegisterFactory(2);
153 // register your shell-interfaces here
155 ScModule ::RegisterInterface(pMod);
156 ScDocShell ::RegisterInterface(pMod);
157 ScTabViewShell ::RegisterInterface(pMod);
158 ScPreviewShell ::RegisterInterface(pMod);
159 ScDrawShell ::RegisterInterface(pMod);
160 ScDrawFormShell ::RegisterInterface(pMod);
161 ScDrawTextObjectBar ::RegisterInterface(pMod);
162 ScEditShell ::RegisterInterface(pMod);
163 ScPivotShell ::RegisterInterface(pMod);
164 ScAuditingShell ::RegisterInterface(pMod);
165 ScFormatShell ::RegisterInterface(pMod);
166 ScCellShell ::RegisterInterface(pMod);
167 ScOleObjectShell ::RegisterInterface(pMod);
168 ScChartShell ::RegisterInterface(pMod);
169 ScGraphicShell ::RegisterInterface(pMod);
170 ScMediaShell ::RegisterInterface(pMod);
171 ScPageBreakShell ::RegisterInterface(pMod);
173 SfxRecentFilesToolBoxControl::RegisterControl(SID_OPEN_CALC, pMod);
175 // eigene Controller
176 ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSERT, pMod);
177 ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
178 ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSOBJ, pMod);
179 ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
181 // Svx-Toolbox-Controller
182 SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod);
183 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_BASIC, pMod);
184 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_SYMBOL, pMod);
185 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_ARROW, pMod);
186 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_FLOWCHART, pMod);
187 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_CALLOUT, pMod);
188 SvxTbxCtlCustomShapes ::RegisterControl(SID_DRAWTBX_CS_STAR, pMod);
189 SvxTbxCtlAlign ::RegisterControl(SID_OBJECT_ALIGN, pMod);
190 SvxFillToolBoxControl ::RegisterControl(0, pMod);
191 SvxLineStyleToolBoxControl ::RegisterControl(0, pMod);
192 SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
193 SvxLineColorToolBoxControl ::RegisterControl(0, pMod);
194 SvxLineEndToolBoxControl ::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod);
195 SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod);
196 SvxFontNameToolBoxControl ::RegisterControl(SID_ATTR_CHAR_FONT, pMod);
197 SvxColorExtToolBoxControl ::RegisterControl(SID_ATTR_CHAR_COLOR, pMod);
198 SvxColorExtToolBoxControl ::RegisterControl(SID_BACKGROUND_COLOR, pMod);
199 SvxFrameToolBoxControl ::RegisterControl(SID_ATTR_BORDER, pMod);
200 SvxFrameLineStyleToolBoxControl ::RegisterControl(SID_FRAME_LINESTYLE, pMod);
201 SvxColorExtToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR, pMod);
202 SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod );
203 SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod );
204 SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod );
205 svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
207 SvxGrafModeToolBoxControl ::RegisterControl(SID_ATTR_GRAF_MODE, pMod);
208 SvxGrafRedToolBoxControl ::RegisterControl(SID_ATTR_GRAF_RED, pMod);
209 SvxGrafGreenToolBoxControl ::RegisterControl(SID_ATTR_GRAF_GREEN, pMod);
210 SvxGrafBlueToolBoxControl ::RegisterControl(SID_ATTR_GRAF_BLUE, pMod);
211 SvxGrafLuminanceToolBoxControl ::RegisterControl(SID_ATTR_GRAF_LUMINANCE, pMod);
212 SvxGrafContrastToolBoxControl ::RegisterControl(SID_ATTR_GRAF_CONTRAST, pMod);
213 SvxGrafGammaToolBoxControl ::RegisterControl(SID_ATTR_GRAF_GAMMA, pMod);
214 SvxGrafTransparenceToolBoxControl::RegisterControl(SID_ATTR_GRAF_TRANSPARENCE, pMod);
215 SvxGrafFilterToolBoxControl ::RegisterControl(SID_GRFFILTER, pMod);
217 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
218 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
219 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
220 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
221 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
222 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
224 //Media Controller
225 ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
227 // common SFX controller
228 ::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod );
229 ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
231 // Svx-StatusBar-Controller
232 SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
233 SvxSelectionModeControl ::RegisterControl(SID_STATUS_SELMODE, pMod);
234 SvxZoomStatusBarControl ::RegisterControl(SID_ATTR_ZOOM, pMod);
235 SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod);
236 SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod);
237 XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod );
239 SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod);
241 // Svx-Menue-Controller
242 SvxFontMenuControl ::RegisterControl(SID_ATTR_CHAR_FONT, pMod);
243 SvxFontSizeMenuControl ::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod);
245 // CustomShape extrusion controller
246 svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
247 svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
249 // Child-Windows
251 // Hack: Eingabezeile mit 42 registrieren, damit sie im PlugIn immer sichtbar ist
252 ScInputWindowWrapper ::RegisterChildWindow(42, pMod, SFX_CHILDWIN_TASK|SFX_CHILDWIN_FORCEDOCK);
253 ScNavigatorDialogWrapper ::RegisterChildWindowContext(static_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
254 ScSolverDlgWrapper ::RegisterChildWindow(false, pMod);
255 ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod);
256 ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod);
257 ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
258 ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
259 ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod);
260 ScTabOpDlgWrapper ::RegisterChildWindow(false, pMod);
261 ScFilterDlgWrapper ::RegisterChildWindow(false, pMod);
262 ScSpecialFilterDlgWrapper ::RegisterChildWindow(false, pMod);
263 ScDbNameDlgWrapper ::RegisterChildWindow(false, pMod);
264 ScConsolidateDlgWrapper ::RegisterChildWindow(false, pMod);
265 ScPrintAreasDlgWrapper ::RegisterChildWindow(false, pMod);
266 ScColRowNameRangesDlgWrapper::RegisterChildWindow(false, pMod);
267 ScFormulaDlgWrapper ::RegisterChildWindow(false, pMod);
269 ScRandomNumberGeneratorDialogWrapper::RegisterChildWindow(false, pMod);
270 ScSamplingDialogWrapper ::RegisterChildWindow(false, pMod);
271 ScDescriptiveStatisticsDialogWrapper::RegisterChildWindow(false, pMod);
272 ScAnalysisOfVarianceDialogWrapper ::RegisterChildWindow(false, pMod);
273 ScCorrelationDialogWrapper ::RegisterChildWindow(false, pMod);
274 ScCovarianceDialogWrapper ::RegisterChildWindow(false, pMod);
275 ScExponentialSmoothingDialogWrapper ::RegisterChildWindow(false, pMod);
276 ScMovingAverageDialogWrapper ::RegisterChildWindow(false, pMod);
278 // First docking Window for Calc
279 ScFunctionChildWindow ::RegisterChildWindow(false, pMod);
281 // Redlining- Window
282 ScAcceptChgDlgWrapper ::RegisterChildWindow(false, pMod);
283 ScSimpleRefDlgWrapper ::RegisterChildWindow(false, pMod, SFX_CHILDWIN_ALWAYSAVAILABLE|SFX_CHILDWIN_NEVERHIDE );
284 ScHighlightChgDlgWrapper ::RegisterChildWindow(false, pMod);
286 SvxSearchDialogWrapper ::RegisterChildWindow(false, pMod);
287 SvxHlinkDlgWrapper ::RegisterChildWindow(false, pMod);
288 SvxFontWorkChildWindow ::RegisterChildWindow(false, pMod);
289 SvxIMapDlgChildWindow ::RegisterChildWindow(false, pMod);
290 GalleryChildWindow ::RegisterChildWindow(false, pMod);
291 ScSpellDialogChildWindow ::RegisterChildWindow(false, pMod);
293 ScValidityRefChildWin::RegisterChildWindow(false, pMod);
295 // Edit-Engine-Felder, soweit nicht schon in OfficeApplication::Init
297 SvClassManager& rClassManager = SvxFieldItem::GetClassManager();
298 rClassManager.Register(SvxPagesField::StaticClassId(), SvxPagesField::CreateInstance);
299 rClassManager.Register(SvxFileField::StaticClassId(), SvxFileField::CreateInstance);
300 rClassManager.Register(SvxTableField::StaticClassId(), SvxTableField::CreateInstance);
302 SdrRegisterFieldClasses(); // SvDraw-Felder registrieren
304 // 3D-Objekt-Factory eintragen
305 E3dObjFactory();
307 // ::com::sun::star::form::component::Form-Objekt-Factory eintragen
308 FmFormObjFactory();
310 pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, sal::static_int_cast<sal_uInt16>(pMod->GetAppOptions().GetAppMetric()) ) );
312 // StarOne Services are now handled in the registry
315 // DetectFilter functionality has moved - please update your bookmarks
316 // see sc/source/ui/unoobj/scdetect.cxx, have a nice day.
318 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */