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