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