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