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