Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/source/ui/app/scdll.cxx
Line
Count
Source
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>
26
#include <sfx2/sidebar/SidebarChildWindow.hxx>
27
#include <sfx2/app.hxx>
28
#include <sfx2/devtools/DevelopmentToolChildWindow.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
#include <SparklineShell.hxx>
55
#include <tableshell.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/formatpaintbrushctrl.hxx>
74
#include <tbzoomsliderctrl.hxx>
75
#include <svx/zoomsliderctrl.hxx>
76
#include <SheetViewControl.hxx>
77
#include <TableStylesControl.hxx>
78
79
#include <svx/xmlsecctrl.hxx>
80
// Child windows
81
#include <reffact.hxx>
82
#include <navipi.hxx>
83
#include <inputwin.hxx>
84
#include <spelldialog.hxx>
85
#include <svx/fontwork.hxx>
86
#include <svx/srchdlg.hxx>
87
#include <svx/hyperdlg.hxx>
88
#include <svx/imapdlg.hxx>
89
90
#include <filter.hxx>
91
#include <scabstdlg.hxx>
92
#include <acctrl.hxx>
93
94
OUString ScResId(TranslateId aId)
95
1.63M
{
96
1.63M
    return Translate::get(aId, ScModule::get()->GetResLocale());
97
1.63M
}
98
99
OUString ScResId(TranslateNId aContextSingularPlural, int nCardinality)
100
0
{
101
0
    return Translate::nget(aContextSingularPlural, nCardinality, ScModule::get()->GetResLocale());
102
0
}
103
104
void ScDLL::Init()
105
166k
{
106
166k
    if ( SfxApplication::GetModule(SfxToolsModule::Calc) )    // Module already active
107
166k
        return;
108
109
11
    auto pUniqueModule = std::make_unique<ScModule>(&ScDocShell::Factory());
110
11
    ScModule* pMod = pUniqueModule.get();
111
11
    SfxApplication::SetModule(SfxToolsModule::Calc, std::move(pUniqueModule));
112
113
11
    ScDocShell::Factory().SetDocumentServiceName( u"com.sun.star.sheet.SpreadsheetDocument"_ustr );
114
115
    // Not until the ResManager is initialized
116
    // The AppOptions must be initialized not until after ScGlobal::Init
117
11
    ScGlobal::Init();
118
119
    // register your view-factories here
120
11
    ScTabViewShell      ::RegisterFactory(SFX_INTERFACE_SFXAPP);
121
11
    ScPreviewShell      ::RegisterFactory(SFX_INTERFACE_SFXDOCSH);
122
123
    // register your shell-interfaces here
124
11
    ScModule            ::RegisterInterface(pMod);
125
11
    ScDocShell          ::RegisterInterface(pMod);
126
11
    ScTabViewShell      ::RegisterInterface(pMod);
127
11
    ScPreviewShell      ::RegisterInterface(pMod);
128
11
    ScDrawShell         ::RegisterInterface(pMod);
129
11
    ScDrawFormShell     ::RegisterInterface(pMod);
130
11
    ScDrawTextObjectBar ::RegisterInterface(pMod);
131
11
    ScEditShell         ::RegisterInterface(pMod);
132
11
    ScPivotShell        ::RegisterInterface(pMod);
133
11
    sc::SparklineShell  ::RegisterInterface(pMod);
134
11
    ScTableShell        ::RegisterInterface(pMod);
135
11
    ScAuditingShell     ::RegisterInterface(pMod);
136
11
    ScFormatShell       ::RegisterInterface(pMod);
137
11
    ScCellShell         ::RegisterInterface(pMod);
138
11
    ScOleObjectShell    ::RegisterInterface(pMod);
139
11
    ScChartShell        ::RegisterInterface(pMod);
140
11
    ScGraphicShell      ::RegisterInterface(pMod);
141
11
    ScMediaShell        ::RegisterInterface(pMod);
142
11
    ScPageBreakShell    ::RegisterInterface(pMod);
143
144
    // Own Controller
145
11
    ScZoomSliderControl             ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
146
147
    // SvxToolboxController
148
11
    SvxTbxCtlDraw                   ::RegisterControl(SID_INSERT_DRAW,          pMod);
149
11
    SvxFillToolBoxControl           ::RegisterControl(0, pMod);
150
11
    SvxLineWidthToolBoxControl      ::RegisterControl(0, pMod);
151
11
    SvxClipBoardControl             ::RegisterControl(SID_PASTE,                pMod );
152
11
    SvxClipBoardControl             ::RegisterControl(SID_PASTE_UNFORMATTED,    pMod );
153
11
    svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH,  pMod );
154
11
    sc::ScNumberFormatControl       ::RegisterControl(SID_NUMBER_TYPE_FORMAT,   pMod );
155
11
    sc::SheetViewControl::RegisterControl(FID_CURRENT_SHEET_VIEW, pMod);
156
11
    sc::TableStylesControl          ::RegisterControl(SID_DATABASE_SETTINGS,    pMod);
157
158
11
    SvxGrafModeToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_MODE,       pMod);
159
11
    SvxGrafRedToolBoxControl        ::RegisterControl(SID_ATTR_GRAF_RED,        pMod);
160
11
    SvxGrafGreenToolBoxControl      ::RegisterControl(SID_ATTR_GRAF_GREEN,      pMod);
161
11
    SvxGrafBlueToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_BLUE,       pMod);
162
11
    SvxGrafLuminanceToolBoxControl  ::RegisterControl(SID_ATTR_GRAF_LUMINANCE,  pMod);
163
11
    SvxGrafContrastToolBoxControl   ::RegisterControl(SID_ATTR_GRAF_CONTRAST,   pMod);
164
11
    SvxGrafGammaToolBoxControl      ::RegisterControl(SID_ATTR_GRAF_GAMMA,      pMod);
165
11
    SvxGrafTransparenceToolBoxControl::RegisterControl(SID_ATTR_GRAF_TRANSPARENCE, pMod);
166
167
    // Media Controller
168
11
#if HAVE_FEATURE_AVMEDIA
169
11
    ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
170
11
#endif
171
172
    // Common SFX Controller
173
11
    sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
174
11
    DevelopmentToolChildWindow::RegisterChildWindow(false, pMod);
175
176
    // SvxStatusBar Controller
177
11
    SvxInsertStatusBarControl       ::RegisterControl(SID_ATTR_INSERT,      pMod);
178
11
    SvxSelectionModeControl         ::RegisterControl(SID_STATUS_SELMODE,   pMod);
179
11
    SvxZoomStatusBarControl         ::RegisterControl(SID_ATTR_ZOOM,        pMod);
180
11
    SvxZoomSliderControl            ::RegisterControl(SID_ATTR_ZOOMSLIDER,  pMod);
181
11
    SvxModifyControl                ::RegisterControl(SID_DOC_MODIFIED,     pMod);
182
11
    XmlSecStatusBarControl          ::RegisterControl( SID_SIGNATURE,       pMod );
183
11
    ScAutoCalculateControl          ::RegisterControl(FID_AUTO_CALC,        pMod);
184
185
11
    SvxPosSizeStatusBarControl      ::RegisterControl(SID_ATTR_SIZE,        pMod);
186
187
    // Child Windows
188
189
11
    ScInputWindowWrapper        ::RegisterChildWindow(true, pMod, SfxChildWindowFlags::TASK|SfxChildWindowFlags::FORCEDOCK);
190
11
    ScSolverDlgWrapper          ::RegisterChildWindow(false, pMod);
191
11
    ScOptSolverDlgWrapper       ::RegisterChildWindow(false, pMod);
192
11
    ScXMLSourceDlgWrapper       ::RegisterChildWindow(false, pMod);
193
11
    ScNameDlgWrapper            ::RegisterChildWindow(false, pMod);
194
11
    ScNameDefDlgWrapper         ::RegisterChildWindow(false, pMod);
195
11
    ScPivotLayoutWrapper        ::RegisterChildWindow(false, pMod);
196
11
    ScTabOpDlgWrapper           ::RegisterChildWindow(false, pMod);
197
11
    ScFilterDlgWrapper          ::RegisterChildWindow(false, pMod);
198
11
    ScSpecialFilterDlgWrapper   ::RegisterChildWindow(false, pMod);
199
11
    ScDbNameDlgWrapper          ::RegisterChildWindow(false, pMod);
200
11
    ScConsolidateDlgWrapper     ::RegisterChildWindow(false, pMod);
201
11
    ScPrintAreasDlgWrapper      ::RegisterChildWindow(false, pMod);
202
11
    ScColRowNameRangesDlgWrapper::RegisterChildWindow(false, pMod);
203
11
    ScFormulaDlgWrapper         ::RegisterChildWindow(false, pMod);
204
11
    ScTableLayoutWrapper        ::RegisterChildWindow(false, pMod);
205
206
11
    ScRandomNumberGeneratorDialogWrapper::RegisterChildWindow(false, pMod);
207
11
    ScSamplingDialogWrapper             ::RegisterChildWindow(false, pMod);
208
11
    ScDescriptiveStatisticsDialogWrapper::RegisterChildWindow(false, pMod);
209
11
    ScAnalysisOfVarianceDialogWrapper   ::RegisterChildWindow(false, pMod);
210
11
    ScCorrelationDialogWrapper          ::RegisterChildWindow(false, pMod);
211
11
    ScCovarianceDialogWrapper           ::RegisterChildWindow(false, pMod);
212
11
    ScExponentialSmoothingDialogWrapper ::RegisterChildWindow(false, pMod);
213
11
    ScMovingAverageDialogWrapper        ::RegisterChildWindow(false, pMod);
214
11
    ScRegressionDialogWrapper           ::RegisterChildWindow(false, pMod);
215
11
    ScTTestDialogWrapper                ::RegisterChildWindow(false, pMod);
216
11
    ScFTestDialogWrapper                ::RegisterChildWindow(false, pMod);
217
11
    ScZTestDialogWrapper                ::RegisterChildWindow(false, pMod);
218
11
    ScChiSquareTestDialogWrapper        ::RegisterChildWindow(false, pMod);
219
11
    ScFourierAnalysisDialogWrapper      ::RegisterChildWindow(false, pMod);
220
11
    sc::SparklineDialogWrapper          ::RegisterChildWindow(false, pMod);
221
11
    sc::SparklineDataRangeDialogWrapper ::RegisterChildWindow(false, pMod);
222
11
    sc::ConditionalFormatEasyDialogWrapper          ::RegisterChildWindow(false, pMod);
223
224
    // Redlining Window
225
11
    ScAcceptChgDlgWrapper       ::RegisterChildWindow(false, pMod);
226
11
    ScSimpleRefDlgWrapper       ::RegisterChildWindow(false, pMod, SfxChildWindowFlags::ALWAYSAVAILABLE|SfxChildWindowFlags::NEVERHIDE );
227
11
    ScHighlightChgDlgWrapper    ::RegisterChildWindow(false, pMod);
228
229
11
    SvxSearchDialogWrapper      ::RegisterChildWindow(false, pMod);
230
11
    SvxHlinkDlgWrapper          ::RegisterChildWindow(false, pMod);
231
11
    SvxFontWorkChildWindow      ::RegisterChildWindow(false, pMod);
232
11
    SvxIMapDlgChildWindow       ::RegisterChildWindow(false, pMod);
233
11
    ScSpellDialogChildWindow    ::RegisterChildWindow(false, pMod);
234
235
11
    ScValidityRefChildWin::RegisterChildWindow(false, pMod);
236
11
    sc::SearchResultsDlgWrapper::RegisterChildWindow(false, pMod);
237
11
    ScCondFormatDlgWrapper::RegisterChildWindow(false, pMod);
238
239
11
    ScNavigatorWrapper::RegisterChildWindow(false, pMod, SfxChildWindowFlags::NEVERHIDE);
240
241
    // Add 3DObject Factory
242
11
    E3dObjFactory();
243
244
    // Add css::form::component::FormObject Factory
245
11
    FmFormObjFactory();
246
247
11
    pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, sal::static_int_cast<sal_uInt16>(pMod->GetAppOptions().GetAppMetric()) ) );
248
249
    //  StarOne Services are now handled in the registry
250
11
}
251
252
#ifndef DISABLE_DYNLOADING
253
254
extern "C" SAL_DLLPUBLIC_EXPORT
255
void lok_preload_hook()
256
{
257
    // scfilt
258
    ScFormatFilter::Get();
259
    // scui
260
    ScAbstractDialogFactory::Create();
261
}
262
263
#endif
264
265
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */