1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swmodule.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hintids.hxx>
39 #include <vcl/wrkwin.hxx>
40 #include <vcl/graph.hxx>
41 #include <svx/galbrws.hxx>
42 #include <svx/svdobj.hxx>
43 #include <svtools/ehdl.hxx>
44 #include <svx/fntszctl.hxx>
45 #include <svx/fntctl.hxx>
46 #include <svx/SmartTagCtl.hxx>
47 #include <svx/pszctrl.hxx>
48 #include <svx/insctrl.hxx>
49 #include <svx/selctrl.hxx>
50 #include <svx/linectrl.hxx>
51 #include <svx/tbxctl.hxx> //z-Zt falscher includeschutz!
52 #include <svx/fillctrl.hxx>
53 #include <svx/tbcontrl.hxx>
54 #include <svx/verttexttbxctrl.hxx>
55 #include <svx/formatpaintbrushctrl.hxx>
56 #include <svx/contdlg.hxx>
57 #include <svx/layctrl.hxx>
58 #include <svx/fontwork.hxx>
59 #include <SwSpellDialogChildWindow.hxx>
60 #include <svx/tbxalign.hxx>
61 #include <svx/grafctrl.hxx>
62 #include <svx/tbxcolor.hxx>
63 #include <svx/clipboardctl.hxx>
64 #include <svx/lboxctrl.hxx>
65 #include <svx/extrusioncontrols.hxx>
66 #include <svx/hyprlink.hxx>
67 #include <svx/tbxcustomshapes.hxx>
68 #include <svx/fontworkgallery.hxx>
69 #include <svx/imapdlg.hxx>
70 #include <svx/srchdlg.hxx>
71 #include <svx/hyperdlg.hxx>
72 #include <svx/modctrl.hxx>
73 #include <com/sun/star/scanner/XScannerManager.hpp>
74 #include <com/sun/star/container/XSet.hpp>
75 #include <comphelper/processfactory.hxx>
79 #include <swmodule.hxx>
80 #include <swevent.hxx>
81 #include <swacorr.hxx>
85 #include <dobjfac.hxx>
90 #include <globdoc.hxx>
91 #ifndef _SRCVIEW_HXX //autogen
92 #include <srcview.hxx>
94 #include <glshell.hxx>
98 #include <mediash.hxx>
100 #include <drawsh.hxx>
101 #include <wformsh.hxx>
102 #include <drwtxtsh.hxx>
103 #include <beziersh.hxx>
104 #include <wtextsh.hxx>
105 #include <wfrmsh.hxx>
106 #ifndef _DRFORMSH_HXX
107 #include <drformsh.hxx>
110 #include <wgrfsh.hxx>
113 #include <wolesh.hxx>
116 #include <wlistsh.hxx>
119 #include <wtabsh.hxx>
121 #include <navipi.hxx>
122 #include <chartins.hxx>
123 #include <inputwin.hxx>
124 #include <usrpref.hxx>
125 #include <uinums.hxx>
126 #include <prtopt.hxx>
127 #include <bookctrl.hxx>
128 #include <tmplctrl.hxx>
129 #include <viewlayoutctrl.hxx>
130 #include <svx/zoomsliderctrl.hxx>
131 #include <tblctrl.hxx>
132 #include <zoomctrl.hxx>
133 #include <workctrl.hxx>
134 #include <tbxanchr.hxx>
135 #include <fldwrap.hxx>
136 #ifndef _REDLNDLG_HXX
137 #include <redlndlg.hxx>
140 #include <syncbtn.hxx>
142 #include <mailmergechildwindow.hxx>
143 #include <modcfg.hxx>
144 #include <fontcfg.hxx>
145 #include <sfx2/evntconf.hxx>
146 #include <sfx2/appuno.hxx>
147 #include <swatrset.hxx>
148 #include <idxmrk.hxx>
149 #include <dlelstnr.hxx>
151 #include <barcfg.hxx>
153 #include <svx/rubydialog.hxx>
154 // OD 14.02.2003 #107424#
155 #include <svtools/colorcfg.hxx>
157 #include <svx/acorrcfg.hxx>
158 #include <svtools/moduleoptions.hxx>
160 #ifndef _AVMEDIA_MEDIAPPLAYER_HXX
161 #include <avmedia/mediaplayer.hxx>
163 #include <avmedia/mediatoolbox.hxx>
165 #include <annotsh.hxx>
168 #include <svx/xmlsecctrl.hxx>
169 ResMgr
*pSwResMgr
= 0;
170 sal_Bool bNoInterrupt
= sal_False
;
172 #include <sfx2/app.hxx>
174 #include <svx/svxerr.hxx>
178 using namespace com::sun::star
;
181 TYPEINIT1( SwModule
, SfxModule
);
183 using namespace ::com::sun::star
;
184 using namespace ::com::sun::star::uno
;
186 //************************************************************************
188 SwModule::SwModule( SfxObjectFactory
* pWebFact
,
189 SfxObjectFactory
* pFact
,
190 SfxObjectFactory
* pGlobalFact
)
191 : SfxModule( SfxApplication::CreateResManager( "sw" ), sal_False
, pWebFact
,
192 pFact
, pGlobalFact
, NULL
),
200 pNavigationConfig(0),
202 pWebToolbarConfig(0),
205 pAccessibilityOptions(0),
211 bAuthorInitialised(sal_False
),
212 bEmbeddedLoadSave( sal_False
),
217 SetName( String::CreateFromAscii("StarWriter") );
218 pSwResMgr
= GetResMgr();
219 SvxErrorHandler::Get();
220 pErrorHdl
= new SfxErrorHandler( RID_SW_ERRHDL
,
225 SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE
, SW_RES(STR_PRINT_MERGE_MACRO
), String::CreateFromAscii("OnMailMerge"));
226 SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE_END
, SW_RES(STR_PRINT_MERGE_MACRO
), String::CreateFromAscii("OnMailMergeFinished"));
227 SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE
, String(), String::CreateFromAscii("OnFieldMerge"));
228 SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE_FINISHED
, String(), String::CreateFromAscii("OnFieldMergeFinished"));
229 SfxEventConfiguration::RegisterEvent(SW_EVENT_PAGE_COUNT
, SW_RES(STR_PAGE_COUNT_MACRO
), String::CreateFromAscii("OnPageCountChange"));
230 pModuleConfig
= new SwModuleOptions
;
232 //Die brauchen wie sowieso
233 pToolbarConfig
= new SwToolbarConfigItem( sal_False
);
234 pWebToolbarConfig
= new SwToolbarConfigItem( sal_True
);
236 pStdFontConfig
= new SwStdFontConfig
;
238 pAuthorNames
= new SvStringsDtor(5, 1); // Alle Redlining-Autoren
240 //JP 18.10.96: SvxAutocorrect gegen die SwAutocorrect austauschen
241 SvxAutoCorrCfg
* pACfg
= SvxAutoCorrCfg::Get();
244 const SvxAutoCorrect
* pOld
= pACfg
->GetAutoCorrect();
245 pACfg
->SetAutoCorrect(new SwAutoCorrect( *pOld
));
248 StartListening( *SFX_APP() );
250 // OD 14.02.2003 #107424# - init color configuration
251 // member <pColorConfig> is created and the color configuration is applied
252 // at the view options.
256 //************************************************************************
258 uno::Reference
< scanner::XScannerManager
>
259 SwModule::GetScannerManager()
261 if (!m_xScannerManager
.is())
263 uno::Reference
< lang::XMultiServiceFactory
> xMgr (
264 comphelper::getProcessServiceFactory() );
268 uno::Reference
< scanner::XScannerManager
>(
269 xMgr
->createInstance(
270 rtl::OUString::createFromAscii(
271 "com.sun.star.scanner.ScannerManager" ) ),
275 return m_xScannerManager
;
278 uno::Reference
< linguistic2::XLanguageGuessing
> SwModule::GetLanguageGuesser()
280 if (!m_xLanguageGuesser
.is())
282 uno::Reference
< lang::XMultiServiceFactory
> xMgr ( comphelper::getProcessServiceFactory() );
285 m_xLanguageGuesser
= uno::Reference
< linguistic2::XLanguageGuessing
>(
286 xMgr
->createInstance(
287 rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
291 return m_xLanguageGuesser
;
294 //************************************************************************
296 SwModule::~SwModule()
299 SfxItemPool::Free(pAttrPool
);
301 EndListening( *SFX_APP() );
304 //************************************************************************
306 void SwModule::CreateLngSvcEvtListener()
308 if (!xLngSvcEvtListener
.is())
309 xLngSvcEvtListener
= new SwLinguServiceEventListener
;
312 //************************************************************************
314 void SwDLL::RegisterFactories()
316 //Diese Id's duerfen nicht geaendert werden. Mittels der Id's wird vom
317 //Sfx die View (Dokumentansicht wiederherstellen) erzeugt.
318 if ( SvtModuleOptions().IsWriter() )
319 SwView::RegisterFactory ( 2 );
321 SwWebView::RegisterFactory ( 5 );
323 if ( SvtModuleOptions().IsWriter() )
325 SwSrcView::RegisterFactory ( 6 );
326 SwPagePreView::RegisterFactory ( 7 );
330 //************************************************************************
333 void SwDLL::RegisterInterfaces()
335 SwModule
* pMod
= SW_MOD();
336 SwModule::RegisterInterface( pMod
);
337 SwDocShell::RegisterInterface( pMod
);
338 SwWebDocShell::RegisterInterface( pMod
);
339 SwGlosDocShell::RegisterInterface( pMod
);
340 SwWebGlosDocShell::RegisterInterface( pMod
);
341 SwView::RegisterInterface( pMod
);
342 SwWebView::RegisterInterface( pMod
);
343 SwPagePreView::RegisterInterface( pMod
);
344 SwSrcView::RegisterInterface( pMod
);
347 SwBaseShell::RegisterInterface(pMod
);
348 SwTextShell::RegisterInterface(pMod
);
349 SwTableShell::RegisterInterface(pMod
);
350 SwListShell::RegisterInterface(pMod
);
351 SwFrameShell::RegisterInterface(pMod
);
352 SwDrawBaseShell::RegisterInterface(pMod
);
353 SwDrawShell::RegisterInterface(pMod
);
354 SwDrawFormShell::RegisterInterface(pMod
);
355 SwDrawTextShell::RegisterInterface(pMod
);
356 SwBezierShell::RegisterInterface(pMod
);
357 SwGrfShell::RegisterInterface(pMod
);
358 SwOleShell::RegisterInterface(pMod
);
359 SwWebTextShell::RegisterInterface(pMod
);
360 SwWebFrameShell::RegisterInterface(pMod
);
361 SwWebGrfShell::RegisterInterface(pMod
);
362 SwWebListShell::RegisterInterface(pMod
);
363 SwWebTableShell::RegisterInterface(pMod
);
364 SwWebDrawFormShell::RegisterInterface(pMod
);
365 SwWebOleShell::RegisterInterface(pMod
);
366 SwMediaShell::RegisterInterface(pMod
);
367 SwAnnotationShell::RegisterInterface(pMod
);
370 //************************************************************************
372 void SwDLL::RegisterControls()
374 SwModule
* pMod
= SW_MOD();
375 SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW
, pMod
);
376 SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN
, pMod
);
377 SwTbxAnchor::RegisterControl(FN_TOOL_ANKER
, pMod
);
378 SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL
, pMod
);
379 SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL
, pMod
);
380 SwTbxAutoTextCtrl::RegisterControl(FN_INSERT_FIELD_CTRL
, pMod
);
381 SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG
, pMod
);
383 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC
, pMod
);
384 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL
, pMod
);
385 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW
, pMod
);
386 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART
, pMod
);
387 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT
, pMod
);
388 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR
, pMod
);
390 svx::ExtrusionDepthControl::RegisterControl( SID_EXTRUSION_DEPTH_FLOATER
, pMod
);
391 svx::ExtrusionDirectionControl::RegisterControl( SID_EXTRUSION_DIRECTION_FLOATER
, pMod
);
392 svx::ExtrusionLightingControl::RegisterControl( SID_EXTRUSION_LIGHTING_FLOATER
, pMod
);
393 svx::ExtrusionSurfaceControl::RegisterControl( SID_EXTRUSION_SURFACE_FLOATER
, pMod
);
394 svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR
, pMod
);
396 svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE
, pMod
);
397 svx::FontWorkAlignmentControl::RegisterControl( SID_FONTWORK_ALIGNMENT_FLOATER
, pMod
);
398 svx::FontWorkCharacterSpacingControl::RegisterControl( SID_FONTWORK_CHARACTER_SPACING_FLOATER
, pMod
);
400 SvxClipBoardControl::RegisterControl(SID_PASTE
, pMod
);
401 SvxUndoRedoControl::RegisterControl(SID_UNDO
, pMod
);
402 SvxUndoRedoControl::RegisterControl(SID_REDO
, pMod
);
403 svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH
, pMod
);
405 SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE
, pMod
);
406 SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE
, pMod
);
407 SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH
, pMod
);
408 SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR
, pMod
);
409 SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE
, pMod
);
411 SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT
, pMod
);
412 // SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
413 SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR
, pMod
);
414 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2
, pMod
);
415 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND
, pMod
);
416 SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY
, pMod
);
417 SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR
, pMod
);
418 SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER
, pMod
);
419 SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE
, pMod
);
420 SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR
, pMod
);
422 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT
, pMod
);
423 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME
, pMod
);
424 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION
, pMod
);
425 SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE
, pMod
);
426 SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES
, pMod
);
428 SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT
, pMod
);
429 SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT
, pMod
);
431 SwZoomControl::RegisterControl(SID_ATTR_ZOOM
, pMod
);
432 SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM
, pMod
);
433 SvxPosSizeStatusBarControl::RegisterControl(0, pMod
);
434 SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT
, pMod
);
435 SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE
, pMod
);
436 XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE
, pMod
);
438 SwBookmarkControl::RegisterControl(FN_STAT_PAGE
, pMod
);
439 SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE
, pMod
);
440 SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT
, pMod
);
441 SvxModifyControl::RegisterControl( SID_DOC_MODIFIED
, pMod
);
442 SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER
, pMod
);
444 SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE
, pMod
);
446 SvxIMapDlgChildWindow::RegisterChildWindow( sal_False
, pMod
);
447 SvxSearchDialogWrapper::RegisterChildWindow( sal_False
, pMod
);
448 SvxHlinkDlgWrapper::RegisterChildWindow( sal_False
, pMod
);
449 SvxHyperlinkDlgWrapper::RegisterChildWindow( sal_False
, pMod
, SFX_CHILDWIN_FORCEDOCK
);
450 SvxFontWorkChildWindow::RegisterChildWindow( sal_False
, pMod
);
451 SwFldDlgWrapper::RegisterChildWindow( sal_False
, pMod
);
452 SwFldDataOnlyDlgWrapper::RegisterChildWindow( sal_False
, pMod
);
453 SvxContourDlgChildWindow::RegisterChildWindow( sal_False
, pMod
);
454 SwNavigationChild::RegisterChildWindowContext( pMod
);
455 SwInputChild::RegisterChildWindow( sal_False
, pMod
, SFX_CHILDWIN_FORCEDOCK
);
456 SwRedlineAcceptChild::RegisterChildWindow( sal_False
, pMod
);
457 SwSyncChildWin::RegisterChildWindow( sal_True
, pMod
);
458 SwMailMergeChildWindow::RegisterChildWindow( sal_False
, pMod
);
459 // SwSendMailChildWindow::RegisterChildWindow( sal_False, pMod );
460 SwInsertIdxMarkWrapper::RegisterChildWindow( sal_False
, pMod
);
461 SwInsertAuthMarkWrapper::RegisterChildWindow( sal_False
, pMod
);
462 SvxRubyChildWindow::RegisterChildWindow( sal_False
, pMod
);
463 SwSpellDialogChildWindow::RegisterChildWindow(sal_False
, pMod
);
465 SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED
, pMod
);
466 SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN
, pMod
);
467 SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE
, pMod
);
468 SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE
, pMod
);
469 SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST
, pMod
);
470 SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA
, pMod
);
471 SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE
, pMod
);
472 SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE
, pMod
);
473 SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER
, pMod
);
474 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT
, pMod
);
475 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM
, pMod
);
476 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL
, pMod
);
477 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL
, pMod
);
479 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT
, pMod
);
480 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT
, pMod
);
482 svx::ExtrusionDepthControl::RegisterControl( SID_EXTRUSION_DEPTH_FLOATER
, pMod
);
483 svx::ExtrusionDirectionControl::RegisterControl( SID_EXTRUSION_DIRECTION_FLOATER
, pMod
);
484 svx::ExtrusionLightingControl::RegisterControl( SID_EXTRUSION_LIGHTING_FLOATER
, pMod
);
485 svx::ExtrusionSurfaceControl::RegisterControl( SID_EXTRUSION_SURFACE_FLOATER
, pMod
);
486 svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR
, pMod
);
488 GalleryChildWindow::RegisterChildWindow(0, pMod
);
490 ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX
, pMod
);
491 ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod
);
493 SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU
, pMod
);
498 /*************************************************************************
500 |* Modul laden (nur Attrappe fuer das Linken der DLL)
502 \************************************************************************/
504 /* -----------------20.04.99 10:46-------------------
506 * --------------------------------------------------*/
507 void SwModule::InitAttrPool()
509 DBG_ASSERT(!pAttrPool
, "Pool ist schon da!");
510 pAttrPool
= new SwAttrPool(0);
513 /* -----------------20.04.99 10:46-------------------
515 * --------------------------------------------------*/
516 void SwModule::RemoveAttrPool()
519 SfxItemPool::Free(pAttrPool
);