Line data Source code
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 <hintids.hxx>
23 : #include <swerror.h>
24 : #include <vcl/wrkwin.hxx>
25 : #include <vcl/graph.hxx>
26 : #include <svx/svdobj.hxx>
27 : #include <svtools/ehdl.hxx>
28 : #include <svx/fntszctl.hxx>
29 : #include <svx/fntctl.hxx>
30 : #include <svx/SmartTagCtl.hxx>
31 : #include <svx/pszctrl.hxx>
32 : #include <svx/insctrl.hxx>
33 : #include <svx/selctrl.hxx>
34 : #include <svx/linectrl.hxx>
35 : #include <svx/tbxctl.hxx>
36 : #include <svx/fillctrl.hxx>
37 : #include <svx/tbcontrl.hxx>
38 : #include <svx/verttexttbxctrl.hxx>
39 : #include <svx/formatpaintbrushctrl.hxx>
40 : #include <svx/contdlg.hxx>
41 : #include <svx/layctrl.hxx>
42 : #include <svx/fontwork.hxx>
43 : #include <SwSpellDialogChildWindow.hxx>
44 : #include <svx/tbxalign.hxx>
45 : #include <svx/grafctrl.hxx>
46 : #include <svx/tbxcolor.hxx>
47 : #include <svx/clipboardctl.hxx>
48 : #include <svx/lboxctrl.hxx>
49 : #include <svx/tbxcustomshapes.hxx>
50 : #include <svx/imapdlg.hxx>
51 : #include <svx/srchdlg.hxx>
52 : #include <svx/hyperdlg.hxx>
53 : #include <svx/fontworkgallery.hxx>
54 : #include <svx/modctrl.hxx>
55 : #include <com/sun/star/scanner/ScannerManager.hpp>
56 : #include <com/sun/star/container/XSet.hpp>
57 : #include <com/sun/star/linguistic2/LanguageGuessing.hpp>
58 : #include <comphelper/processfactory.hxx>
59 : #include <docsh.hxx>
60 : #include <swmodule.hxx>
61 : #include <swevent.hxx>
62 : #include <swacorr.hxx>
63 : #include <cmdid.h>
64 : #include <dobjfac.hxx>
65 : #include <init.hxx>
66 : #include <pview.hxx>
67 : #include <wview.hxx>
68 : #include <wdocsh.hxx>
69 : #include <globdoc.hxx>
70 : #include <srcview.hxx>
71 : #include <glshell.hxx>
72 : #include <tabsh.hxx>
73 : #include <listsh.hxx>
74 : #include <grfsh.hxx>
75 : #include <mediash.hxx>
76 : #include <olesh.hxx>
77 : #include <drawsh.hxx>
78 : #include <wformsh.hxx>
79 : #include <drwtxtsh.hxx>
80 : #include <beziersh.hxx>
81 : #include <wtextsh.hxx>
82 : #include <wfrmsh.hxx>
83 : #include <drformsh.hxx>
84 : #include <wgrfsh.hxx>
85 : #include <wolesh.hxx>
86 : #include <wlistsh.hxx>
87 : #include <wtabsh.hxx>
88 : #include <navipi.hxx>
89 : #include <chartins.hxx>
90 : #include <inputwin.hxx>
91 : #include <usrpref.hxx>
92 : #include <uinums.hxx>
93 : #include <prtopt.hxx>
94 : #include <bookctrl.hxx>
95 : #include <tmplctrl.hxx>
96 : #include <viewlayoutctrl.hxx>
97 : #include <svx/zoomsliderctrl.hxx>
98 : #include <tblctrl.hxx>
99 : #include <zoomctrl.hxx>
100 : #include <wordcountctrl.hxx>
101 : #include <workctrl.hxx>
102 : #include <tbxanchr.hxx>
103 : #include <fldwrap.hxx>
104 : #include <redlndlg.hxx>
105 : #include <syncbtn.hxx>
106 : #include <mailmergechildwindow.hxx>
107 : #include <modcfg.hxx>
108 : #include <fontcfg.hxx>
109 : #include <sfx2/sidebar/SidebarChildWindow.hxx>
110 : #include <sfx2/taskpane.hxx>
111 : #include <sfx2/evntconf.hxx>
112 : #include <swatrset.hxx>
113 : #include <idxmrk.hxx>
114 : #include <wordcountdialog.hxx>
115 : #include <dlelstnr.hxx>
116 : #include <barcfg.hxx>
117 : #include <svx/rubydialog.hxx>
118 : #include <svtools/colorcfg.hxx>
119 :
120 : #include <editeng/acorrcfg.hxx>
121 : #include <unotools/moduleoptions.hxx>
122 :
123 : #include <avmedia/mediaplayer.hxx>
124 : #include <avmedia/mediatoolbox.hxx>
125 :
126 : #include <annotsh.hxx>
127 : #include <navsh.hxx>
128 :
129 : #include <app.hrc>
130 : #include <svx/xmlsecctrl.hxx>
131 : ResMgr *pSwResMgr = 0;
132 : bool bNoInterrupt = false;
133 :
134 : #include <sfx2/app.hxx>
135 :
136 : #include <svx/svxerr.hxx>
137 :
138 : #include <unomid.h>
139 :
140 : #include "swdllimpl.hxx"
141 :
142 : using namespace com::sun::star;
143 :
144 30858 : TYPEINIT1( SwModule, SfxModule );
145 :
146 : using namespace ::com::sun::star;
147 : using namespace ::com::sun::star::uno;
148 :
149 90 : SwModule::SwModule( SfxObjectFactory* pWebFact,
150 : SfxObjectFactory* pFact,
151 : SfxObjectFactory* pGlobalFact )
152 : : SfxModule( ResMgr::CreateResMgr( "sw" ), false, pWebFact,
153 : pFact, pGlobalFact, NULL ),
154 : pModuleConfig(0),
155 : pUsrPref(0),
156 : pWebUsrPref(0),
157 : pPrtOpt(0),
158 : pWebPrtOpt(0),
159 : pChapterNumRules(0),
160 : pStdFontConfig(0),
161 : pNavigationConfig(0),
162 : pToolbarConfig(0),
163 : pWebToolbarConfig(0),
164 : pDBConfig(0),
165 : pColorConfig(0),
166 : pAccessibilityOptions(0),
167 : pCTLOptions(0),
168 : pUserOptions(0),
169 : pAttrPool(0),
170 : pView(0),
171 : bAuthorInitialised(false),
172 : bEmbeddedLoadSave( false ),
173 : pDragDrop( 0 ),
174 90 : pXSelection( 0 )
175 : {
176 90 : SetName( OUString("StarWriter") );
177 90 : pSwResMgr = GetResMgr();
178 90 : SvxErrorHandler::ensure();
179 : pErrorHdl = new SfxErrorHandler( RID_SW_ERRHDL,
180 : ERRCODE_AREA_SW,
181 : ERRCODE_AREA_SW_END,
182 90 : pSwResMgr );
183 :
184 90 : pModuleConfig = new SwModuleOptions;
185 :
186 : // We need them anyways
187 90 : pToolbarConfig = new SwToolbarConfigItem( false );
188 90 : pWebToolbarConfig = new SwToolbarConfigItem( true );
189 :
190 90 : pStdFontConfig = new SwStdFontConfig;
191 :
192 90 : pAuthorNames = new std::vector<OUString>; // All Redlining-Authors
193 :
194 : // replace SvxAutocorrect with SwAutocorrect
195 90 : SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
196 90 : const SvxAutoCorrect* pOld = rACfg.GetAutoCorrect();
197 90 : rACfg.SetAutoCorrect(new SwAutoCorrect( *pOld ));
198 :
199 90 : StartListening( *SfxGetpApp() );
200 :
201 : // OD 14.02.2003 #107424# - init color configuration
202 : // member <pColorConfig> is created and the color configuration is applied
203 : // at the view options.
204 90 : GetColorConfig();
205 90 : }
206 : uno::Reference< scanner::XScannerManager2 >
207 0 : SwModule::GetScannerManager()
208 : {
209 0 : if (!m_xScannerManager.is())
210 : {
211 0 : m_xScannerManager = scanner::ScannerManager::create( comphelper::getProcessComponentContext() );
212 : }
213 0 : return m_xScannerManager;
214 : }
215 :
216 2 : uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser()
217 : {
218 2 : if (!m_xLanguageGuesser.is())
219 : {
220 2 : m_xLanguageGuesser = linguistic2::LanguageGuessing::create( comphelper::getProcessComponentContext() );
221 : }
222 2 : return m_xLanguageGuesser;
223 : }
224 :
225 108 : SwModule::~SwModule()
226 : {
227 36 : delete pErrorHdl;
228 36 : EndListening( *SfxGetpApp() );
229 72 : }
230 :
231 52 : void SwModule::CreateLngSvcEvtListener()
232 : {
233 52 : if (!xLngSvcEvtListener.is())
234 52 : xLngSvcEvtListener = new SwLinguServiceEventListener;
235 52 : }
236 :
237 90 : void SwDLL::RegisterFactories()
238 : {
239 : // These Id's must not be changed. Through these Id's the View (resume Documentview)
240 : // is created by Sfx.
241 90 : if ( SvtModuleOptions().IsWriter() )
242 90 : SwView::RegisterFactory ( 2 );
243 :
244 : #if HAVE_FEATURE_DESKTOP
245 90 : SwWebView::RegisterFactory ( 5 );
246 :
247 90 : if ( SvtModuleOptions().IsWriter() )
248 : {
249 90 : SwSrcView::RegisterFactory ( 6 );
250 90 : SwPagePreview::RegisterFactory ( 7 );
251 : }
252 : #endif
253 90 : }
254 :
255 90 : void SwDLL::RegisterInterfaces()
256 : {
257 90 : SwModule* pMod = SW_MOD();
258 90 : SwModule::RegisterInterface( pMod );
259 90 : SwDocShell::RegisterInterface( pMod );
260 90 : SwWebDocShell::RegisterInterface( pMod );
261 90 : SwGlosDocShell::RegisterInterface( pMod );
262 90 : SwWebGlosDocShell::RegisterInterface( pMod );
263 90 : SwView::RegisterInterface( pMod );
264 90 : SwWebView::RegisterInterface( pMod );
265 90 : SwPagePreview::RegisterInterface( pMod );
266 90 : SwSrcView::RegisterInterface( pMod );
267 :
268 90 : SwBaseShell::RegisterInterface(pMod);
269 90 : SwTextShell::RegisterInterface(pMod);
270 90 : SwTableShell::RegisterInterface(pMod);
271 90 : SwListShell::RegisterInterface(pMod);
272 90 : SwFrameShell::RegisterInterface(pMod);
273 90 : SwDrawBaseShell::RegisterInterface(pMod);
274 90 : SwDrawShell::RegisterInterface(pMod);
275 90 : SwDrawFormShell::RegisterInterface(pMod);
276 90 : SwDrawTextShell::RegisterInterface(pMod);
277 90 : SwBezierShell::RegisterInterface(pMod);
278 90 : SwGrfShell::RegisterInterface(pMod);
279 90 : SwOleShell::RegisterInterface(pMod);
280 90 : SwNavigationShell::RegisterInterface(pMod);
281 90 : SwWebTextShell::RegisterInterface(pMod);
282 90 : SwWebFrameShell::RegisterInterface(pMod);
283 90 : SwWebGrfShell::RegisterInterface(pMod);
284 90 : SwWebListShell::RegisterInterface(pMod);
285 90 : SwWebTableShell::RegisterInterface(pMod);
286 90 : SwWebDrawFormShell::RegisterInterface(pMod);
287 90 : SwWebOleShell::RegisterInterface(pMod);
288 90 : SwMediaShell::RegisterInterface(pMod);
289 90 : SwAnnotationShell::RegisterInterface(pMod);
290 90 : }
291 :
292 90 : void SwDLL::RegisterControls()
293 : {
294 90 : SwModule* pMod = SW_MOD();
295 :
296 90 : SfxRecentFilesToolBoxControl::RegisterControl( FN_OPEN_FILE, pMod );
297 90 : SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
298 90 : SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod );
299 90 : SwTbxAnchor::RegisterControl(FN_TOOL_ANCHOR, pMod );
300 90 : SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod );
301 90 : SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod );
302 90 : SwTbxFieldCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod );
303 90 : SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
304 :
305 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod );
306 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod );
307 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod );
308 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod );
309 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod );
310 90 : SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod );
311 :
312 90 : SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
313 90 : svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
314 :
315 90 : SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
316 90 : SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
317 90 : SvxUndoRedoControl::RegisterControl(SID_REDO, pMod );
318 90 : svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
319 :
320 90 : SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
321 90 : SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
322 90 : SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
323 90 : SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
324 90 : SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
325 90 : SvxColorToolBoxControl::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
326 :
327 90 : SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
328 90 : SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod );
329 90 : SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod );
330 90 : SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
331 90 : SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
332 90 : SvxColorToolBoxControl::RegisterControl( SID_BACKGROUND_COLOR, pMod );
333 90 : SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
334 90 : SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
335 90 : SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
336 :
337 90 : SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );
338 90 : SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod );
339 90 : SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION, pMod );
340 90 : SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE, pMod );
341 90 : SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES, pMod );
342 :
343 90 : SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
344 90 : SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
345 :
346 90 : SwZoomControl::RegisterControl(SID_ATTR_ZOOM, pMod );
347 90 : SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM, pMod);
348 90 : SvxPosSizeStatusBarControl::RegisterControl(0, pMod );
349 90 : SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT, pMod );
350 90 : SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE, pMod );
351 90 : XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
352 90 : SwWordCountStatusBarControl::RegisterControl(FN_STAT_WORDCOUNT, pMod);
353 :
354 90 : SwBookmarkControl::RegisterControl(FN_STAT_PAGE, pMod );
355 90 : SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE, pMod );
356 90 : SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT, pMod );
357 90 : SvxModifyControl::RegisterControl( SID_DOC_MODIFIED, pMod );
358 90 : SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod );
359 :
360 90 : SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE, pMod);
361 :
362 90 : SvxIMapDlgChildWindow::RegisterChildWindow( false, pMod );
363 90 : SvxSearchDialogWrapper::RegisterChildWindow( false, pMod );
364 90 : SvxHlinkDlgWrapper::RegisterChildWindow( false, pMod );
365 90 : SvxFontWorkChildWindow::RegisterChildWindow( false, pMod );
366 90 : SwFldDlgWrapper::RegisterChildWindow( false, pMod );
367 90 : SwFldDataOnlyDlgWrapper::RegisterChildWindow( false, pMod );
368 90 : SvxContourDlgChildWindow::RegisterChildWindow( false, pMod );
369 90 : SwNavigationChild::RegisterChildWindowContext( pMod );
370 90 : SwInputChild::RegisterChildWindow( false, pMod, SFX_CHILDWIN_FORCEDOCK );
371 90 : SwRedlineAcceptChild::RegisterChildWindow( false, pMod );
372 90 : SwSyncChildWin::RegisterChildWindow( true, pMod );
373 90 : SwMailMergeChildWindow::RegisterChildWindow( false, pMod );
374 90 : SwInsertIdxMarkWrapper::RegisterChildWindow( false, pMod );
375 90 : SwInsertAuthMarkWrapper::RegisterChildWindow( false, pMod );
376 90 : SwWordCountWrapper::RegisterChildWindow( false, pMod );
377 90 : SvxRubyChildWindow::RegisterChildWindow( false, pMod);
378 90 : SwSpellDialogChildWindow::RegisterChildWindow(false, pMod);
379 :
380 90 : SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
381 90 : SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
382 90 : SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );
383 90 : SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod );
384 90 : SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod );
385 90 : SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod );
386 90 : SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod );
387 90 : SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
388 90 : SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod );
389 90 : SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
390 90 : SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
391 90 : SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
392 90 : SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
393 :
394 90 : SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
395 90 : SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
396 :
397 90 : ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX, pMod);
398 90 : ::avmedia::MediaPlayer::RegisterChildWindow(false, pMod);
399 :
400 90 : SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
401 90 : ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
402 90 : ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pMod);
403 90 : }
404 :
405 : // Load Module (only dummy for linking of the DLL)
406 90 : void SwModule::InitAttrPool()
407 : {
408 : OSL_ENSURE(!pAttrPool, "Pool already exists!");
409 90 : pAttrPool = new SwAttrPool(0);
410 90 : SetPool(pAttrPool);
411 90 : }
412 :
413 90 : void SwModule::RemoveAttrPool()
414 : {
415 90 : SetPool(0);
416 90 : SfxItemPool::Free(pAttrPool);
417 360 : }
418 :
419 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|