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