LibreOffice Module sc (master)  1
scdll.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <config_features.h>
21 
22 #include <svx/fmobjfac.hxx>
23 #include <svx/objfac3d.hxx>
24 
25 #include <comphelper/lok.hxx>
27 #include <sfx2/app.hxx>
29 #include <avmedia/mediatoolbox.hxx>
30 #include <NumberFormatControl.hxx>
31 
32 #include <unotools/resmgr.hxx>
33 
34 #include <scmod.hxx>
35 #include <scresid.hxx>
36 #include <sc.hrc>
37 
38 #include <docsh.hxx>
39 #include <tabvwsh.hxx>
40 #include <prevwsh.hxx>
41 #include <drawsh.hxx>
42 #include <drformsh.hxx>
43 #include <drtxtob.hxx>
44 #include <editsh.hxx>
45 #include <pivotsh.hxx>
46 #include <auditsh.hxx>
47 #include <cellsh.hxx>
48 #include <oleobjsh.hxx>
49 #include <chartsh.hxx>
50 #include <graphsh.hxx>
51 #include <mediash.hxx>
52 #include <pgbrksh.hxx>
53 #include <scdll.hxx>
54 
55 #include <appoptio.hxx>
56 #include <searchresults.hxx>
57 
58 // Controls
59 
60 #include <svx/tbxctl.hxx>
61 #include <svx/fillctrl.hxx>
62 #include <svx/linectrl.hxx>
63 //#include <svx/tbcontrl.hxx>
64 #include <svx/selctrl.hxx>
65 #include <svx/insctrl.hxx>
66 #include <svx/zoomctrl.hxx>
67 #include <svx/modctrl.hxx>
68 #include <svx/pszctrl.hxx>
69 #include <svx/grafctrl.hxx>
70 #include <svx/clipboardctl.hxx>
72 #include <tbzoomsliderctrl.hxx>
73 #include <svx/zoomsliderctrl.hxx>
74 
75 #include <svx/xmlsecctrl.hxx>
76 // Child windows
77 #include <reffact.hxx>
78 #include <navipi.hxx>
79 #include <inputwin.hxx>
80 #include <spelldialog.hxx>
81 #include <svx/fontwork.hxx>
82 #include <svx/srchdlg.hxx>
83 #include <svx/hyperdlg.hxx>
84 #include <svx/imapdlg.hxx>
85 
86 #include <filter.hxx>
87 #include <scabstdlg.hxx>
88 
89 OUString ScResId(const char* pId)
90 {
91  return Translate::get(pId, SC_MOD()->GetResLocale());
92 }
93 
94 OUString ScResId(const char* pId, int nCardinality)
95 {
96  return Translate::nget(pId, nCardinality, SC_MOD()->GetResLocale());
97 }
98 
100 {
101  if ( SfxApplication::GetModule(SfxToolsModule::Calc) ) // Module already active
102  return;
103 
104  auto pUniqueModule = std::make_unique<ScModule>(&ScDocShell::Factory());
105  ScModule* pMod = pUniqueModule.get();
106  SfxApplication::SetModule(SfxToolsModule::Calc, std::move(pUniqueModule));
107 
108  ScDocShell::Factory().SetDocumentServiceName( "com.sun.star.sheet.SpreadsheetDocument" );
109 
110  // Not until the ResManager is initialized
111  // The AppOptions must be initialized not until after ScGlobal::Init
112  ScGlobal::Init();
113 
114  // register your view-factories here
115  ScTabViewShell ::RegisterFactory(SFX_INTERFACE_SFXAPP);
116  ScPreviewShell ::RegisterFactory(SFX_INTERFACE_SFXDOCSH);
117 
118  // register your shell-interfaces here
119  ScModule ::RegisterInterface(pMod);
120  ScDocShell ::RegisterInterface(pMod);
121  ScTabViewShell ::RegisterInterface(pMod);
122  ScPreviewShell ::RegisterInterface(pMod);
123  ScDrawShell ::RegisterInterface(pMod);
124  ScDrawFormShell ::RegisterInterface(pMod);
125  ScDrawTextObjectBar ::RegisterInterface(pMod);
126  ScEditShell ::RegisterInterface(pMod);
127  ScPivotShell ::RegisterInterface(pMod);
128  ScAuditingShell ::RegisterInterface(pMod);
129  ScFormatShell ::RegisterInterface(pMod);
130  ScCellShell ::RegisterInterface(pMod);
131  ScOleObjectShell ::RegisterInterface(pMod);
132  ScChartShell ::RegisterInterface(pMod);
133  ScGraphicShell ::RegisterInterface(pMod);
134  ScMediaShell ::RegisterInterface(pMod);
135  ScPageBreakShell ::RegisterInterface(pMod);
136 
137  // Own Controller
138  ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
139 
140  // SvxToolboxController
141  SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod);
142  SvxFillToolBoxControl ::RegisterControl(0, pMod);
143  SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
144  SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod );
145  SvxClipBoardControl ::RegisterControl(SID_PASTE_UNFORMATTED, pMod );
146  svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
147  sc::ScNumberFormatControl ::RegisterControl(SID_NUMBER_TYPE_FORMAT, pMod );
148 
149  SvxGrafModeToolBoxControl ::RegisterControl(SID_ATTR_GRAF_MODE, pMod);
150  SvxGrafRedToolBoxControl ::RegisterControl(SID_ATTR_GRAF_RED, pMod);
151  SvxGrafGreenToolBoxControl ::RegisterControl(SID_ATTR_GRAF_GREEN, pMod);
152  SvxGrafBlueToolBoxControl ::RegisterControl(SID_ATTR_GRAF_BLUE, pMod);
153  SvxGrafLuminanceToolBoxControl ::RegisterControl(SID_ATTR_GRAF_LUMINANCE, pMod);
154  SvxGrafContrastToolBoxControl ::RegisterControl(SID_ATTR_GRAF_CONTRAST, pMod);
155  SvxGrafGammaToolBoxControl ::RegisterControl(SID_ATTR_GRAF_GAMMA, pMod);
156  SvxGrafTransparenceToolBoxControl::RegisterControl(SID_ATTR_GRAF_TRANSPARENCE, pMod);
157 
158  // Media Controller
159 #if HAVE_FEATURE_AVMEDIA
160  ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
161 #endif
162 
163  // Common SFX Controller
165  DevelopmentToolChildWindow::RegisterChildWindow(false, pMod);
166 
167  // SvxStatusBar Controller
168  SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
169  SvxSelectionModeControl ::RegisterControl(SID_STATUS_SELMODE, pMod);
170  SvxZoomStatusBarControl ::RegisterControl(SID_ATTR_ZOOM, pMod);
171  SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod);
172  SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod);
173  XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod );
174 
175  SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod);
176 
177  // Child Windows
178 
179  ScInputWindowWrapper ::RegisterChildWindow(true, pMod, SfxChildWindowFlags::TASK|SfxChildWindowFlags::FORCEDOCK);
180  ScNavigatorDialogWrapper ::RegisterChildWindowContext(static_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
181  ScSolverDlgWrapper ::RegisterChildWindow(false, pMod);
182  ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod);
183  ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod);
184  ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
185  ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
186  ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod);
187  ScTabOpDlgWrapper ::RegisterChildWindow(false, pMod);
188  ScFilterDlgWrapper ::RegisterChildWindow(false, pMod);
189  ScSpecialFilterDlgWrapper ::RegisterChildWindow(false, pMod);
190  ScDbNameDlgWrapper ::RegisterChildWindow(false, pMod);
191  ScConsolidateDlgWrapper ::RegisterChildWindow(false, pMod);
192  ScPrintAreasDlgWrapper ::RegisterChildWindow(false, pMod);
193  ScColRowNameRangesDlgWrapper::RegisterChildWindow(false, pMod);
194  ScFormulaDlgWrapper ::RegisterChildWindow(false, pMod);
195 
197  ScSamplingDialogWrapper ::RegisterChildWindow(false, pMod);
199  ScAnalysisOfVarianceDialogWrapper ::RegisterChildWindow(false, pMod);
200  ScCorrelationDialogWrapper ::RegisterChildWindow(false, pMod);
201  ScCovarianceDialogWrapper ::RegisterChildWindow(false, pMod);
203  ScMovingAverageDialogWrapper ::RegisterChildWindow(false, pMod);
204  ScRegressionDialogWrapper ::RegisterChildWindow(false, pMod);
205  ScTTestDialogWrapper ::RegisterChildWindow(false, pMod);
206  ScFTestDialogWrapper ::RegisterChildWindow(false, pMod);
207  ScZTestDialogWrapper ::RegisterChildWindow(false, pMod);
208  ScChiSquareTestDialogWrapper ::RegisterChildWindow(false, pMod);
209  ScFourierAnalysisDialogWrapper ::RegisterChildWindow(false, pMod);
210 
211  // Redlining Window
212  ScAcceptChgDlgWrapper ::RegisterChildWindow(false, pMod);
213  ScSimpleRefDlgWrapper ::RegisterChildWindow(false, pMod, SfxChildWindowFlags::ALWAYSAVAILABLE|SfxChildWindowFlags::NEVERHIDE );
214  ScHighlightChgDlgWrapper ::RegisterChildWindow(false, pMod);
215 
216  SvxSearchDialogWrapper ::RegisterChildWindow(false, pMod);
217  SvxHlinkDlgWrapper ::RegisterChildWindow(false, pMod);
218  SvxFontWorkChildWindow ::RegisterChildWindow(false, pMod);
219  SvxIMapDlgChildWindow ::RegisterChildWindow(false, pMod);
220  ScSpellDialogChildWindow::RegisterChildWindow(
221  false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE
222  : SfxChildWindowFlags::NONE);
223 
226  ScCondFormatDlgWrapper::RegisterChildWindow(false, pMod);
227 
228  // Add 3DObject Factory
229  E3dObjFactory();
230 
231  // Add css::form::component::FormObject Factory
233 
234  pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, sal::static_int_cast<sal_uInt16>(pMod->GetAppOptions().GetAppMetric()) ) );
235 
236  // StarOne Services are now handled in the registry
237 }
238 
239 #ifndef DISABLE_DYNLOADING
240 
241 extern "C" SAL_DLLPUBLIC_EXPORT
243 {
244  // scfilt
246  // scui
248 }
249 
250 #endif
251 
252 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto SFX_INTERFACE_SFXAPP
static SC_DLLPUBLIC void Init()
Definition: global.cxx:432
static void RegisterChildWindow(bool bVisible=false, SfxModule *pModule=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE)
static SC_DLLPUBLIC ScFormatFilterPlugin & Get()
Definition: impex.cxx:2399
static void SetModule(SfxToolsModule nSharedLib, std::unique_ptr< SfxModule > pModule)
OUString nget(const char *pContextAndIds, int n, const std::locale &loc)
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:99
#define SC_MOD()
Definition: scmod.hxx:250
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
static void RegisterChildWindow(SfxModule *, std::unique_ptr< SfxChildWinFactory >)
constexpr auto SFX_INTERFACE_SFXDOCSH
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
OUString get(const char *pContextAndId, const std::locale &loc)
static SfxModule * GetModule(SfxToolsModule nSharedLib)
SAL_DLLPUBLIC_EXPORT void lok_preload_hook()
Definition: scdll.cxx:242