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/evntconf.hxx>
139 #include <sfx2/appuno.hxx>
140 #include <swatrset.hxx>
141 #include <idxmrk.hxx>
142 #include <dlelstnr.hxx>
143 #ifndef _BARCFG_HXX
144 #include <barcfg.hxx>
145 #endif
146 #include <svx/rubydialog.hxx>
147 // OD 14.02.2003 #107424#
148 #include <svtools/colorcfg.hxx>
149
150 #include <editeng/acorrcfg.hxx>
151 #include <unotools/moduleoptions.hxx>
152
153 #ifndef _AVMEDIA_MEDIAPPLAYER_HXX
154 #include <avmedia/mediaplayer.hxx>
155 #endif
156 #include <avmedia/mediatoolbox.hxx>
157
158 #include <annotsh.hxx>
159
160 #include <app.hrc>
161 #include <svx/xmlsecctrl.hxx>
162 ResMgr *pSwResMgr = 0;
163 sal_Bool bNoInterrupt = sal_False;
164
165 #include <sfx2/app.hxx>
166
167 #include <svx/svxerr.hxx>
168
169 #include <unomid.h>
170
171 using namespace com::sun::star;
172
173
174 TYPEINIT1( SwModule, SfxModule );
175
176 using namespace ::com::sun::star;
177 using namespace ::com::sun::star::uno;
178
179 //************************************************************************
180
SwModule(SfxObjectFactory * pWebFact,SfxObjectFactory * pFact,SfxObjectFactory * pGlobalFact)181 SwModule::SwModule( SfxObjectFactory* pWebFact,
182 SfxObjectFactory* pFact,
183 SfxObjectFactory* pGlobalFact )
184 : SfxModule( SfxApplication::CreateResManager( "sw" ), sal_False, pWebFact,
185 pFact, pGlobalFact, NULL ),
186 pModuleConfig(0),
187 pUsrPref(0),
188 pWebUsrPref(0),
189 pPrtOpt(0),
190 pWebPrtOpt(0),
191 pChapterNumRules(0),
192 pStdFontConfig(0),
193 pNavigationConfig(0),
194 pToolbarConfig(0),
195 pWebToolbarConfig(0),
196 pDBConfig(0),
197 pColorConfig(0),
198 pAccessibilityOptions(0),
199 pCTLOptions(0),
200 pUserOptions(0),
201 pUndoOptions(0),
202 pAttrPool(0),
203 pView(0),
204 bAuthorInitialised(sal_False),
205 bEmbeddedLoadSave( sal_False ),
206 pDragDrop( 0 ),
207 pXSelection( 0 )
208 {
209 SetName( String::CreateFromAscii("StarWriter") );
210 pSwResMgr = GetResMgr();
211 SvxErrorHandler::Get();
212 pErrorHdl = new SfxErrorHandler( RID_SW_ERRHDL,
213 ERRCODE_AREA_SW,
214 ERRCODE_AREA_SW_END,
215 pSwResMgr );
216
217 pModuleConfig = new SwModuleOptions;
218
219 //Die brauchen wie sowieso
220 pToolbarConfig = new SwToolbarConfigItem( sal_False );
221 pWebToolbarConfig = new SwToolbarConfigItem( sal_True );
222
223 pStdFontConfig = new SwStdFontConfig;
224
225 pAuthorNames = new SvStringsDtor(5, 1); // Alle Redlining-Autoren
226
227 //JP 18.10.96: SvxAutocorrect gegen die SwAutocorrect austauschen
228 SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
229 if( pACfg )
230 {
231 const SvxAutoCorrect* pOld = pACfg->GetAutoCorrect();
232 pACfg->SetAutoCorrect(new SwAutoCorrect( *pOld ));
233 }
234
235 StartListening( *SFX_APP() );
236
237 // OD 14.02.2003 #107424# - init color configuration
238 // member <pColorConfig> is created and the color configuration is applied
239 // at the view options.
240 GetColorConfig();
241 }
242
243 //************************************************************************
244
245 uno::Reference< scanner::XScannerManager >
GetScannerManager()246 SwModule::GetScannerManager()
247 {
248 if (!m_xScannerManager.is())
249 {
250 uno::Reference< lang::XMultiServiceFactory > xMgr (
251 comphelper::getProcessServiceFactory() );
252 if( xMgr.is() )
253 {
254 m_xScannerManager =
255 uno::Reference< scanner::XScannerManager >(
256 xMgr->createInstance(
257 rtl::OUString::createFromAscii(
258 "com.sun.star.scanner.ScannerManager" ) ),
259 uno::UNO_QUERY );
260 }
261 }
262 return m_xScannerManager;
263 }
264
GetLanguageGuesser()265 uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser()
266 {
267 if (!m_xLanguageGuesser.is())
268 {
269 uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
270 if (xMgr.is())
271 {
272 m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
273 xMgr->createInstance(
274 rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
275 uno::UNO_QUERY );
276 }
277 }
278 return m_xLanguageGuesser;
279 }
280
281 //************************************************************************
282
~SwModule()283 SwModule::~SwModule()
284 {
285 SetPool(0);
286 SfxItemPool::Free(pAttrPool);
287 delete pErrorHdl;
288 EndListening( *SFX_APP() );
289 }
290
291 //************************************************************************
292
CreateLngSvcEvtListener()293 void SwModule::CreateLngSvcEvtListener()
294 {
295 if (!xLngSvcEvtListener.is())
296 xLngSvcEvtListener = new SwLinguServiceEventListener;
297 }
298
299 //************************************************************************
300
RegisterFactories()301 void SwDLL::RegisterFactories()
302 {
303 //Diese Id's duerfen nicht geaendert werden. Mittels der Id's wird vom
304 //Sfx die View (Dokumentansicht wiederherstellen) erzeugt.
305 if ( SvtModuleOptions().IsWriter() )
306 SwView::RegisterFactory ( 2 );
307
308 SwWebView::RegisterFactory ( 5 );
309
310 if ( SvtModuleOptions().IsWriter() )
311 {
312 SwSrcView::RegisterFactory ( 6 );
313 SwPagePreView::RegisterFactory ( 7 );
314 }
315 }
316
317 //************************************************************************
318
319
RegisterInterfaces()320 void SwDLL::RegisterInterfaces()
321 {
322 SwModule* pMod = SW_MOD();
323 SwModule::RegisterInterface( pMod );
324 SwDocShell::RegisterInterface( pMod );
325 SwWebDocShell::RegisterInterface( pMod );
326 SwGlosDocShell::RegisterInterface( pMod );
327 SwWebGlosDocShell::RegisterInterface( pMod );
328 SwView::RegisterInterface( pMod );
329 SwWebView::RegisterInterface( pMod );
330 SwPagePreView::RegisterInterface( pMod );
331 SwSrcView::RegisterInterface( pMod );
332
333
334 SwBaseShell::RegisterInterface(pMod);
335 SwTextShell::RegisterInterface(pMod);
336 SwTableShell::RegisterInterface(pMod);
337 SwListShell::RegisterInterface(pMod);
338 SwFrameShell::RegisterInterface(pMod);
339 SwDrawBaseShell::RegisterInterface(pMod);
340 SwDrawShell::RegisterInterface(pMod);
341 SwDrawFormShell::RegisterInterface(pMod);
342 SwDrawTextShell::RegisterInterface(pMod);
343 SwBezierShell::RegisterInterface(pMod);
344 SwGrfShell::RegisterInterface(pMod);
345 SwOleShell::RegisterInterface(pMod);
346 SwWebTextShell::RegisterInterface(pMod);
347 SwWebFrameShell::RegisterInterface(pMod);
348 SwWebGrfShell::RegisterInterface(pMod);
349 SwWebListShell::RegisterInterface(pMod);
350 SwWebTableShell::RegisterInterface(pMod);
351 SwWebDrawFormShell::RegisterInterface(pMod);
352 SwWebOleShell::RegisterInterface(pMod);
353 SwMediaShell::RegisterInterface(pMod);
354 SwAnnotationShell::RegisterInterface(pMod);
355 }
356
357 //************************************************************************
358
RegisterControls()359 void SwDLL::RegisterControls()
360 {
361 SwModule* pMod = SW_MOD();
362 SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
363 SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod );
364 SwTbxAnchor::RegisterControl(FN_TOOL_ANKER, pMod );
365 SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod );
366 SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod );
367 SwTbxAutoTextCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod );
368 SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
369
370 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod );
371 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod );
372 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod );
373 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod );
374 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod );
375 SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod );
376
377 svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
378 svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
379
380 SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
381 SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
382 SvxUndoRedoControl::RegisterControl(SID_REDO, pMod );
383 svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
384
385 SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
386 SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
387 SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
388 SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
389 SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
390
391 SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
392 // SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
393 SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod );
394 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod );
395 SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
396 SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
397 SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR, pMod );
398 SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
399 SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
400 SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
401
402 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );
403 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod );
404 SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION, pMod );
405 SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE, pMod );
406 SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES, pMod );
407
408 SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
409 SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
410
411 SwZoomControl::RegisterControl(SID_ATTR_ZOOM, pMod );
412 SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM, pMod);
413 SvxPosSizeStatusBarControl::RegisterControl(0, pMod );
414 SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT, pMod );
415 SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE, pMod );
416 XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
417
418 SwBookmarkControl::RegisterControl(FN_STAT_PAGE, pMod );
419 SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE, pMod );
420 SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT, pMod );
421 SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod );
422
423 SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE, pMod);
424
425 SvxIMapDlgChildWindow::RegisterChildWindow( sal_False, pMod );
426 SvxSearchDialogWrapper::RegisterChildWindow( sal_False, pMod );
427 SvxHlinkDlgWrapper::RegisterChildWindow( sal_False, pMod );
428 SvxHyperlinkDlgWrapper::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
429 SvxFontWorkChildWindow::RegisterChildWindow( sal_False, pMod );
430 SwFldDlgWrapper::RegisterChildWindow( sal_False, pMod );
431 SwFldDataOnlyDlgWrapper::RegisterChildWindow( sal_False, pMod );
432 SvxContourDlgChildWindow::RegisterChildWindow( sal_False, pMod );
433 SwNavigationChild::RegisterChildWindowContext( pMod );
434 SwInputChild::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
435 SwRedlineAcceptChild::RegisterChildWindow( sal_False, pMod );
436 SwSyncChildWin::RegisterChildWindow( sal_True, pMod );
437 SwMailMergeChildWindow::RegisterChildWindow( sal_False, pMod );
438 // SwSendMailChildWindow::RegisterChildWindow( sal_False, pMod );
439 SwInsertIdxMarkWrapper::RegisterChildWindow( sal_False, pMod );
440 SwInsertAuthMarkWrapper::RegisterChildWindow( sal_False, pMod );
441 SvxRubyChildWindow::RegisterChildWindow( sal_False, pMod);
442 SwSpellDialogChildWindow::RegisterChildWindow(sal_False, pMod);
443
444 SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
445 SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
446 SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );
447 SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod );
448 SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod );
449 SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod );
450 SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod );
451 SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
452 SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod );
453 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
454 SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
455 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
456 SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
457
458 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
459 SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
460
461 GalleryChildWindow::RegisterChildWindow(0, pMod);
462
463 ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX, pMod);
464 ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
465
466 SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
467 ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod);
468 }
469
470
471
472 /*************************************************************************
473 |*
474 |* Modul laden (nur Attrappe fuer das Linken der DLL)
475 |*
476 \************************************************************************/
477
478 /* -----------------20.04.99 10:46-------------------
479 *
480 * --------------------------------------------------*/
InitAttrPool()481 void SwModule::InitAttrPool()
482 {
483 DBG_ASSERT(!pAttrPool, "Pool ist schon da!");
484 pAttrPool = new SwAttrPool(0);
485 SetPool(pAttrPool);
486 }
487 /* -----------------20.04.99 10:46-------------------
488 *
489 * --------------------------------------------------*/
RemoveAttrPool()490 void SwModule::RemoveAttrPool()
491 {
492 SetPool(0);
493 SfxItemPool::Free(pAttrPool);
494 }
495
496
497