1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 32 #include <hintids.hxx> 33 #ifndef _SWERROR_H 34 #include <swerror.h> 35 #endif 36 #include <vcl/wrkwin.hxx> 37 #include <vcl/graph.hxx> 38 #include <svx/galbrws.hxx> 39 #include <svx/svdobj.hxx> 40 #include <svtools/ehdl.hxx> 41 #include <svx/fntszctl.hxx> 42 #include <svx/fntctl.hxx> 43 #include <svx/SmartTagCtl.hxx> 44 #include <svx/pszctrl.hxx> 45 #include <svx/insctrl.hxx> 46 #include <svx/selctrl.hxx> 47 #include <svx/linectrl.hxx> 48 #include <svx/tbxctl.hxx> //z-Zt falscher includeschutz! 49 #include <svx/fillctrl.hxx> 50 #include <svx/tbcontrl.hxx> 51 #include <svx/verttexttbxctrl.hxx> 52 #include <svx/formatpaintbrushctrl.hxx> 53 #include <svx/contdlg.hxx> 54 #include <svx/layctrl.hxx> 55 #include <svx/fontwork.hxx> 56 #include <SwSpellDialogChildWindow.hxx> 57 #include <svx/tbxalign.hxx> 58 #include <svx/grafctrl.hxx> 59 #include <svx/tbxcolor.hxx> 60 #include <svx/clipboardctl.hxx> 61 #include <svx/lboxctrl.hxx> 62 #include <svx/hyprlink.hxx> 63 #include <svx/tbxcustomshapes.hxx> 64 #include <svx/imapdlg.hxx> 65 #include <svx/srchdlg.hxx> 66 #include <svx/hyperdlg.hxx> 67 #include <svx/extrusioncolorcontrol.hxx> 68 #include <svx/fontworkgallery.hxx> 69 #include <com/sun/star/scanner/XScannerManager.hpp> 70 #include <com/sun/star/container/XSet.hpp> 71 #include <comphelper/processfactory.hxx> 72 #ifndef _DOCSH_HXX 73 #include <docsh.hxx> 74 #endif 75 #include <swmodule.hxx> 76 #include <swevent.hxx> 77 #include <swacorr.hxx> 78 #ifndef _CMDID_H 79 #include <cmdid.h> 80 #endif 81 #include <dobjfac.hxx> 82 #include <init.hxx> 83 #include <pview.hxx> 84 #include <wview.hxx> 85 #include <wdocsh.hxx> 86 #include <globdoc.hxx> 87 #ifndef _SRCVIEW_HXX //autogen 88 #include <srcview.hxx> 89 #endif 90 #include <glshell.hxx> 91 #include <tabsh.hxx> 92 #include <listsh.hxx> 93 #include <grfsh.hxx> 94 #include <mediash.hxx> 95 #include <olesh.hxx> 96 #include <drawsh.hxx> 97 #include <wformsh.hxx> 98 #include <drwtxtsh.hxx> 99 #include <beziersh.hxx> 100 #include <wtextsh.hxx> 101 #include <wfrmsh.hxx> 102 #ifndef _DRFORMSH_HXX 103 #include <drformsh.hxx> 104 #endif 105 #ifndef _WGRFSH_HXX 106 #include <wgrfsh.hxx> 107 #endif 108 #ifndef _WOLESH_HXX 109 #include <wolesh.hxx> 110 #endif 111 #ifndef _WLISTSH_HXX 112 #include <wlistsh.hxx> 113 #endif 114 #ifndef _WTABSH_HXX 115 #include <wtabsh.hxx> 116 #endif 117 #include <navipi.hxx> 118 #include <chartins.hxx> 119 #include <inputwin.hxx> 120 #include <usrpref.hxx> 121 #include <uinums.hxx> 122 #include <prtopt.hxx> 123 #include <bookctrl.hxx> 124 #include <tmplctrl.hxx> 125 #include <viewlayoutctrl.hxx> 126 #include <svx/zoomsliderctrl.hxx> 127 #include <tblctrl.hxx> 128 #include <zoomctrl.hxx> 129 #include <workctrl.hxx> 130 #include <tbxanchr.hxx> 131 #include <fldwrap.hxx> 132 #ifndef _REDLNDLG_HXX 133 #include <redlndlg.hxx> 134 #endif 135 #ifndef _SYNCBTN_HXX 136 #include <syncbtn.hxx> 137 #endif 138 #include <mailmergechildwindow.hxx> 139 #include <modcfg.hxx> 140 #include <fontcfg.hxx> 141 #include <sfx2/taskpane.hxx> 142 #include <sfx2/evntconf.hxx> 143 #include <sfx2/appuno.hxx> 144 #include <swatrset.hxx> 145 #include <idxmrk.hxx> 146 #include <dlelstnr.hxx> 147 #ifndef _BARCFG_HXX 148 #include <barcfg.hxx> 149 #endif 150 #include <svx/rubydialog.hxx> 151 // OD 14.02.2003 #107424# 152 #include <svtools/colorcfg.hxx> 153 154 #include <editeng/acorrcfg.hxx> 155 #include <unotools/moduleoptions.hxx> 156 157 #ifndef _AVMEDIA_MEDIAPPLAYER_HXX 158 #include <avmedia/mediaplayer.hxx> 159 #endif 160 #include <avmedia/mediatoolbox.hxx> 161 162 #include <annotsh.hxx> 163 164 #include <app.hrc> 165 #include <svx/xmlsecctrl.hxx> 166 ResMgr *pSwResMgr = 0; 167 sal_Bool bNoInterrupt = sal_False; 168 169 #include <sfx2/app.hxx> 170 171 #include <svx/svxerr.hxx> 172 173 #include <unomid.h> 174 175 using namespace com::sun::star; 176 177 178 TYPEINIT1( SwModule, SfxModule ); 179 180 using namespace ::com::sun::star; 181 using namespace ::com::sun::star::uno; 182 183 //************************************************************************ 184 185 SwModule::SwModule( SfxObjectFactory* pWebFact, 186 SfxObjectFactory* pFact, 187 SfxObjectFactory* pGlobalFact ) 188 : SfxModule( SfxApplication::CreateResManager( "sw" ), sal_False, pWebFact, 189 pFact, pGlobalFact, NULL ), 190 pModuleConfig(0), 191 pUsrPref(0), 192 pWebUsrPref(0), 193 pPrtOpt(0), 194 pWebPrtOpt(0), 195 pChapterNumRules(0), 196 pStdFontConfig(0), 197 pNavigationConfig(0), 198 pToolbarConfig(0), 199 pWebToolbarConfig(0), 200 pDBConfig(0), 201 pColorConfig(0), 202 pAccessibilityOptions(0), 203 pCTLOptions(0), 204 pUserOptions(0), 205 pUndoOptions(0), 206 pAttrPool(0), 207 pView(0), 208 bAuthorInitialised(sal_False), 209 bEmbeddedLoadSave( sal_False ), 210 pDragDrop( 0 ), 211 pXSelection( 0 ) 212 { 213 SetName( String::CreateFromAscii("StarWriter") ); 214 pSwResMgr = GetResMgr(); 215 SvxErrorHandler::Get(); 216 pErrorHdl = new SfxErrorHandler( RID_SW_ERRHDL, 217 ERRCODE_AREA_SW, 218 ERRCODE_AREA_SW_END, 219 pSwResMgr ); 220 221 pModuleConfig = new SwModuleOptions; 222 223 //Die brauchen wie sowieso 224 pToolbarConfig = new SwToolbarConfigItem( sal_False ); 225 pWebToolbarConfig = new SwToolbarConfigItem( sal_True ); 226 227 pStdFontConfig = new SwStdFontConfig; 228 229 pAuthorNames = new SvStringsDtor(5, 1); // Alle Redlining-Autoren 230 231 //JP 18.10.96: SvxAutocorrect gegen die SwAutocorrect austauschen 232 SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get(); 233 if( pACfg ) 234 { 235 const SvxAutoCorrect* pOld = pACfg->GetAutoCorrect(); 236 pACfg->SetAutoCorrect(new SwAutoCorrect( *pOld )); 237 } 238 239 StartListening( *SFX_APP() ); 240 241 // OD 14.02.2003 #107424# - init color configuration 242 // member <pColorConfig> is created and the color configuration is applied 243 // at the view options. 244 GetColorConfig(); 245 } 246 247 //************************************************************************ 248 249 uno::Reference< scanner::XScannerManager > 250 SwModule::GetScannerManager() 251 { 252 if (!m_xScannerManager.is()) 253 { 254 uno::Reference< lang::XMultiServiceFactory > xMgr ( 255 comphelper::getProcessServiceFactory() ); 256 if( xMgr.is() ) 257 { 258 m_xScannerManager = 259 uno::Reference< scanner::XScannerManager >( 260 xMgr->createInstance( 261 rtl::OUString::createFromAscii( 262 "com.sun.star.scanner.ScannerManager" ) ), 263 uno::UNO_QUERY ); 264 } 265 } 266 return m_xScannerManager; 267 } 268 269 uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser() 270 { 271 if (!m_xLanguageGuesser.is()) 272 { 273 uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() ); 274 if (xMgr.is()) 275 { 276 m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >( 277 xMgr->createInstance( 278 rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ), 279 uno::UNO_QUERY ); 280 } 281 } 282 return m_xLanguageGuesser; 283 } 284 285 //************************************************************************ 286 287 SwModule::~SwModule() 288 { 289 SetPool(0); 290 SfxItemPool::Free(pAttrPool); 291 delete pErrorHdl; 292 EndListening( *SFX_APP() ); 293 } 294 295 //************************************************************************ 296 297 void SwModule::CreateLngSvcEvtListener() 298 { 299 if (!xLngSvcEvtListener.is()) 300 xLngSvcEvtListener = new SwLinguServiceEventListener; 301 } 302 303 //************************************************************************ 304 305 void SwDLL::RegisterFactories() 306 { 307 //Diese Id's duerfen nicht geaendert werden. Mittels der Id's wird vom 308 //Sfx die View (Dokumentansicht wiederherstellen) erzeugt. 309 if ( SvtModuleOptions().IsWriter() ) 310 SwView::RegisterFactory ( 2 ); 311 312 SwWebView::RegisterFactory ( 5 ); 313 314 if ( SvtModuleOptions().IsWriter() ) 315 { 316 SwSrcView::RegisterFactory ( 6 ); 317 SwPagePreView::RegisterFactory ( 7 ); 318 } 319 } 320 321 //************************************************************************ 322 323 324 void SwDLL::RegisterInterfaces() 325 { 326 SwModule* pMod = SW_MOD(); 327 SwModule::RegisterInterface( pMod ); 328 SwDocShell::RegisterInterface( pMod ); 329 SwWebDocShell::RegisterInterface( pMod ); 330 SwGlosDocShell::RegisterInterface( pMod ); 331 SwWebGlosDocShell::RegisterInterface( pMod ); 332 SwView::RegisterInterface( pMod ); 333 SwWebView::RegisterInterface( pMod ); 334 SwPagePreView::RegisterInterface( pMod ); 335 SwSrcView::RegisterInterface( pMod ); 336 337 338 SwBaseShell::RegisterInterface(pMod); 339 SwTextShell::RegisterInterface(pMod); 340 SwTableShell::RegisterInterface(pMod); 341 SwListShell::RegisterInterface(pMod); 342 SwFrameShell::RegisterInterface(pMod); 343 SwDrawBaseShell::RegisterInterface(pMod); 344 SwDrawShell::RegisterInterface(pMod); 345 SwDrawFormShell::RegisterInterface(pMod); 346 SwDrawTextShell::RegisterInterface(pMod); 347 SwBezierShell::RegisterInterface(pMod); 348 SwGrfShell::RegisterInterface(pMod); 349 SwOleShell::RegisterInterface(pMod); 350 SwWebTextShell::RegisterInterface(pMod); 351 SwWebFrameShell::RegisterInterface(pMod); 352 SwWebGrfShell::RegisterInterface(pMod); 353 SwWebListShell::RegisterInterface(pMod); 354 SwWebTableShell::RegisterInterface(pMod); 355 SwWebDrawFormShell::RegisterInterface(pMod); 356 SwWebOleShell::RegisterInterface(pMod); 357 SwMediaShell::RegisterInterface(pMod); 358 SwAnnotationShell::RegisterInterface(pMod); 359 } 360 361 //************************************************************************ 362 363 void SwDLL::RegisterControls() 364 { 365 SwModule* pMod = SW_MOD(); 366 SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod ); 367 SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod ); 368 SwTbxAnchor::RegisterControl(FN_TOOL_ANKER, pMod ); 369 SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod ); 370 SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod ); 371 SwTbxAutoTextCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod ); 372 SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod ); 373 374 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod ); 375 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod ); 376 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod ); 377 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod ); 378 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod ); 379 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod ); 380 381 svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); 382 svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); 383 384 SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); 385 SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod ); 386 SvxUndoRedoControl::RegisterControl(SID_REDO, pMod ); 387 svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod ); 388 389 SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod ); 390 SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod ); 391 SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod ); 392 SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod ); 393 SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod ); 394 395 SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod ); 396 // SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod ); 397 SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod ); 398 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod ); 399 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod ); 400 SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod ); 401 SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR, pMod ); 402 SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); 403 SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod ); 404 SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); 405 406 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod ); 407 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod ); 408 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION, pMod ); 409 SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE, pMod ); 410 SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES, pMod ); 411 412 SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod ); 413 SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod ); 414 415 SwZoomControl::RegisterControl(SID_ATTR_ZOOM, pMod ); 416 SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM, pMod); 417 SvxPosSizeStatusBarControl::RegisterControl(0, pMod ); 418 SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT, pMod ); 419 SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE, pMod ); 420 XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod ); 421 422 SwBookmarkControl::RegisterControl(FN_STAT_PAGE, pMod ); 423 SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE, pMod ); 424 SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT, pMod ); 425 SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod ); 426 427 SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE, pMod); 428 429 SvxIMapDlgChildWindow::RegisterChildWindow( sal_False, pMod ); 430 SvxSearchDialogWrapper::RegisterChildWindow( sal_False, pMod ); 431 SvxHlinkDlgWrapper::RegisterChildWindow( sal_False, pMod ); 432 SvxHyperlinkDlgWrapper::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK ); 433 SvxFontWorkChildWindow::RegisterChildWindow( sal_False, pMod ); 434 SwFldDlgWrapper::RegisterChildWindow( sal_False, pMod ); 435 SwFldDataOnlyDlgWrapper::RegisterChildWindow( sal_False, pMod ); 436 SvxContourDlgChildWindow::RegisterChildWindow( sal_False, pMod ); 437 SwNavigationChild::RegisterChildWindowContext( pMod ); 438 SwInputChild::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK ); 439 SwRedlineAcceptChild::RegisterChildWindow( sal_False, pMod ); 440 SwSyncChildWin::RegisterChildWindow( sal_True, pMod ); 441 SwMailMergeChildWindow::RegisterChildWindow( sal_False, pMod ); 442 // SwSendMailChildWindow::RegisterChildWindow( sal_False, pMod ); 443 SwInsertIdxMarkWrapper::RegisterChildWindow( sal_False, pMod ); 444 SwInsertAuthMarkWrapper::RegisterChildWindow( sal_False, pMod ); 445 SvxRubyChildWindow::RegisterChildWindow( sal_False, pMod); 446 SwSpellDialogChildWindow::RegisterChildWindow(sal_False, pMod); 447 448 SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod ); 449 SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod ); 450 SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod ); 451 SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod ); 452 SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod ); 453 SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod ); 454 SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod ); 455 SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod ); 456 SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod ); 457 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod); 458 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod); 459 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod); 460 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod); 461 462 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod); 463 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod); 464 465 GalleryChildWindow::RegisterChildWindow(0, pMod); 466 467 ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX, pMod); 468 ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); 469 470 SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); 471 ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod ); 472 } 473 474 475 476 /************************************************************************* 477 |* 478 |* Modul laden (nur Attrappe fuer das Linken der DLL) 479 |* 480 \************************************************************************/ 481 482 /* -----------------20.04.99 10:46------------------- 483 * 484 * --------------------------------------------------*/ 485 void SwModule::InitAttrPool() 486 { 487 DBG_ASSERT(!pAttrPool, "Pool ist schon da!"); 488 pAttrPool = new SwAttrPool(0); 489 SetPool(pAttrPool); 490 } 491 /* -----------------20.04.99 10:46------------------- 492 * 493 * --------------------------------------------------*/ 494 void SwModule::RemoveAttrPool() 495 { 496 SetPool(0); 497 SfxItemPool::Free(pAttrPool); 498 } 499 500 501