xref: /aoo42x/main/sw/source/ui/app/swmodul1.cxx (revision cdf0e10c)
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 #include <sfx2/request.hxx>
34 #include <sfx2/dispatch.hxx>
35 #include <sfx2/childwin.hxx>
36 #include <unotools/useroptions.hxx>
37 #include <cppuhelper/weak.hxx>
38 #include <com/sun/star/frame/FrameSearchFlag.hpp>
39 #include <com/sun/star/view/XSelectionSupplier.hpp>
40 #include <cppuhelper/implbase1.hxx>	// helper for implementations
41 #include <svx/dataaccessdescriptor.hxx>
42 #include <editeng/wghtitem.hxx>
43 #include <editeng/postitem.hxx>
44 #include <editeng/udlnitem.hxx>
45 #include <editeng/crsditem.hxx>
46 #include <editeng/cmapitem.hxx>
47 #include <editeng/colritem.hxx>
48 #include <editeng/brshitem.hxx>
49 #include <vcl/msgbox.hxx>
50 #include <swmodule.hxx>
51 #include <swtypes.hxx>
52 #include <usrpref.hxx>
53 #include <modcfg.hxx>
54 #include <view.hxx>
55 #include <pview.hxx>
56 #include <wview.hxx>
57 #include <wrtsh.hxx>
58 #include <docsh.hxx>
59 #include <dbmgr.hxx>
60 #include <uinums.hxx>
61 #include <prtopt.hxx>		// fuer PrintOptions
62 #include <navicfg.hxx>
63 #include <doc.hxx>
64 #include <cmdid.h>
65 #include <app.hrc>
66 #include "helpid.h"
67 
68 #include <unomid.h>
69 #include <tools/color.hxx>
70 #include "PostItMgr.hxx"
71 
72 using ::rtl::OUString;
73 using namespace ::svx;
74 using namespace ::com::sun::star;
75 using namespace ::com::sun::star::uno;
76 using namespace ::com::sun::star::beans;
77 using namespace ::com::sun::star::frame;
78 using namespace ::com::sun::star::view;
79 using namespace ::com::sun::star::lang;
80 
81 
82 /*-----------------08/28/97 08:41pm-----------------
83 
84 --------------------------------------------------*/
85 void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh )
86 {
87 	// in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen
88 	sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
89     sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
90     sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
91 
92     pSh->SetUIOptions(*pPref);
93     const SwViewOption* pNewPref = pSh->GetViewOptions();
94 
95 	// Scrollbars an / aus
96 	if(bVScrollChanged)
97 	{
98         pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
99 	}
100 	if(bHScrollChanged)
101 	{
102         pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() );
103 	}
104     //if only the position of the vertical ruler has been changed initiate an update
105     if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
106         pView->InvalidateBorder();
107 
108 	// Lineale an / aus
109     if(pNewPref->IsViewVRuler())
110 		pView->CreateVLineal();
111 	else
112 		pView->KillVLineal();
113 
114 	// TabWindow an/aus
115     if(pNewPref->IsViewHRuler())
116 		pView->CreateTab();
117 	else
118 		pView->KillTab();
119 
120 	pView->GetPostItMgr()->PrepareView(true);
121 }
122 
123 /*--------------------------------------------------------------------
124 	Beschreibung:	Aktuelle SwWrtShell
125  --------------------------------------------------------------------*/
126 
127 
128 SwWrtShell*	GetActiveWrtShell()
129 {
130 	SwView *pActive = ::GetActiveView();
131 	if( pActive )
132 		return &pActive->GetWrtShell();
133 	return 0;
134 }
135 
136 /*--------------------------------------------------------------------
137 	Beschreibung: 	Pointer auf die aktuelle Sicht
138  --------------------------------------------------------------------*/
139 
140 
141 SwView* GetActiveView()
142 {
143 	SfxViewShell* pView = SfxViewShell::Current();
144 	return PTR_CAST( SwView, pView );
145 }
146 /*--------------------------------------------------------------------
147 	Beschreibung:	Ueber Views iterieren - static
148  --------------------------------------------------------------------*/
149 
150 SwView* SwModule::GetFirstView()
151 {
152 	// liefert nur sichtbare SwViews
153 	const TypeId aTypeId = TYPE(SwView);
154 	SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
155 	return pView;
156 }
157 
158 
159 SwView* SwModule::GetNextView(SwView* pView)
160 {
161 	DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben");
162 	const TypeId aTypeId = TYPE(SwView);
163     SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, sal_True);
164 	return pNView;
165 }
166 
167 /*------------------------------------------------------------------------
168  Beschreibung:	Neuer Master fuer die Einstellungen wird gesetzt;
169 				dieser wirkt sich auf die aktuelle Sicht und alle
170 				folgenden aus.
171 ------------------------------------------------------------------------*/
172 
173 void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
174 							sal_uInt16 nDest )
175 {
176     SwView* pCurrView = pActView;
177     ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
178 
179     SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
180 										 VIEWOPT_DEST_WEB == nDest ? sal_True  :
181 										 VIEWOPT_DEST_TEXT== nDest ? sal_False :
182                                          pCurrView && pCurrView->ISA(SwWebView) ));
183 
184 	//per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden
185 	sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
186 	//PreView abfruehstuecken
187 	SwPagePreView* pPPView;
188     if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
189 	{
190 		if(!bViewOnly)
191 			pPref->SetUIOptions( rUsrPref );
192         pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
193         pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
194 		if(!bViewOnly)
195 		{
196 			pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
197 			pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
198 		}
199 		return;
200 	}
201 
202 	if(!bViewOnly)
203 	{
204 		pPref->SetUsrPref( rUsrPref );
205 		pPref->SetModified();
206 	}
207 
208     if( !pCurrView )
209 		return;
210 
211 	// Weitergabe an die CORE
212     sal_Bool bReadonly;
213     const SwDocShell* pDocSh = pCurrView->GetDocShell();
214     if (pDocSh)
215         bReadonly = pDocSh->IsReadOnly();
216     else //Use existing option if DocShell missing
217         bReadonly = pSh->GetViewOptions()->IsReadonly();
218 	SwViewOption* pViewOpt;
219 	if(!bViewOnly)
220 		pViewOpt = new SwViewOption( *pPref );
221 	else
222 		pViewOpt = new SwViewOption( rUsrPref );
223 	pViewOpt->SetReadonly( bReadonly );
224 	if( !(*pSh->GetViewOptions() == *pViewOpt) )
225 	{
226 		//Ist evtl. nur eine ViewShell
227 		pSh->StartAction();
228 		pSh->ApplyViewOptions( *pViewOpt );
229 		((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea());
230 		pSh->EndAction();
231 	}
232 	if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
233 		pSh->SetReadonlyOption(bReadonly);
234 
235     lcl_SetUIPrefs(pViewOpt, pCurrView, pSh);
236 
237     // zum Schluss wird das Idle-Flag wieder gesetzt
238 	// #42510#
239 	pPref->SetIdle(sal_True);
240 }
241 /* -----------------------------28.09.00 12:36--------------------------------
242 
243  ---------------------------------------------------------------------------*/
244 void SwModule::ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb )
245 {
246 		SwMasterUsrPref* pPref;
247 		if(bWeb)
248 		{
249 			if(!pWebUsrPref)
250 				GetUsrPref(sal_True);
251 			pPref = pWebUsrPref;
252 		}
253 		else
254 		{
255 			if(!pUsrPref)
256 				GetUsrPref(sal_False);
257 			pPref = pUsrPref;
258 		}
259 		FieldUnit eOldMetric = pPref->GetMetric();
260 		if(eOldMetric != eMetric)
261 			pPref->SetMetric(eMetric);
262 
263         FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
264         FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
265 
266 		SwView* pTmpView = SwModule::GetFirstView();
267 		// fuer alle MDI-Fenster das Lineal umschalten
268 		while(pTmpView)
269 		{
270 			if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
271 			{
272                 pTmpView->ChangeVLinealMetric(eVScrollMetric);
273                 pTmpView->ChangeTabMetric(eHScrollMetric);
274 			}
275 
276 			pTmpView = SwModule::GetNextView(pTmpView);
277 		}
278 }
279 /*-- 12.11.2008 14:47:58---------------------------------------------------
280 
281   -----------------------------------------------------------------------*/
282 void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb )
283 {
284     SwMasterUsrPref* pPref;
285     if(bWeb)
286     {
287         if(!pWebUsrPref)
288             GetUsrPref(sal_True);
289         pPref = pWebUsrPref;
290     }
291     else
292     {
293         if(!pUsrPref)
294             GetUsrPref(sal_False);
295         pPref = pUsrPref;
296     }
297     if( bHorizontal )
298         pPref->SetHScrollMetric(eMetric);
299     else
300         pPref->SetVScrollMetric(eMetric);
301 
302     SwView* pTmpView = SwModule::GetFirstView();
303     // switch metric at the appropriate rulers
304     while(pTmpView)
305     {
306         if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
307         {
308             if( bHorizontal )
309                 pTmpView->ChangeTabMetric(eMetric);
310             else
311                 pTmpView->ChangeVLinealMetric(eMetric);
312         }
313         pTmpView = SwModule::GetNextView(pTmpView);
314     }
315 }
316 /*-----------------13.11.96 11.57-------------------
317 
318 --------------------------------------------------*/
319 
320 SwNavigationConfig*  SwModule::GetNavigationConfig()
321 {
322 	if(!pNavigationConfig)
323 	{
324 		pNavigationConfig = new SwNavigationConfig;
325 	}
326 	return pNavigationConfig;
327 }
328 
329 /*-----------------05.02.97 08.03-------------------
330 
331 --------------------------------------------------*/
332 
333 SwPrintOptions* 	SwModule::GetPrtOptions(sal_Bool bWeb)
334 {
335 	if(bWeb && !pWebPrtOpt)
336 	{
337 		pWebPrtOpt = new SwPrintOptions(sal_True);
338 	}
339 	else if(!bWeb && !pPrtOpt)
340 	{
341 		pPrtOpt = new SwPrintOptions(sal_False);
342 	}
343 
344 	return bWeb ? pWebPrtOpt : pPrtOpt;
345 }
346 
347 /*-----------------26.06.97 07.52-------------------
348 
349 --------------------------------------------------*/
350 SwChapterNumRules*	SwModule::GetChapterNumRules()
351 {
352 	if(!pChapterNumRules)
353 		pChapterNumRules = new SwChapterNumRules;
354 	return pChapterNumRules;
355 }
356 
357 /*--------------------------------------------------------------------
358 	Beschreibung:
359  --------------------------------------------------------------------*/
360 
361 void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/)
362 {
363     Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
364     Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
365 
366     uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
367                                         rtl::OUString::createFromAscii("_beamer"),
368                                         FrameSearchFlag::CHILDREN);
369     if (xBeamerFrame.is())
370     {   // the beamer has been opened by the SfxViewFrame
371         Reference<XController> xController = xBeamerFrame->getController();
372         Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
373         if (xControllerSelection.is())
374         {
375 
376             ODataAccessDescriptor aSelection;
377             aSelection.setDataSource(rData.sDataSource);
378             aSelection[daCommand]       <<= rData.sCommand;
379             aSelection[daCommandType]   <<= rData.nCommandType;
380             xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
381         }
382         else {
383             DBG_ERROR("no selection supplier in the beamer!");
384         }
385     }
386 }
387 /*--------------------------------------------------------------------
388 	Beschreibung: Redlining
389  --------------------------------------------------------------------*/
390 
391 sal_uInt16 SwModule::GetRedlineAuthor()
392 {
393 	if (!bAuthorInitialised)
394 	{
395         const SvtUserOptions& rOpt = GetUserOptions();
396         if( !(sActAuthor = rOpt.GetFullName()).Len() )
397 			if( !(sActAuthor = rOpt.GetID()).Len() )
398 				sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
399 		bAuthorInitialised = sal_True;
400 	}
401 	return InsertRedlineAuthor( sActAuthor );
402 }
403 
404 /*--------------------------------------------------------------------
405 	Beschreibung:
406  --------------------------------------------------------------------*/
407 
408 const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
409 {
410 	DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
411 	while (!(nPos<pAuthorNames->Count()))
412 	{
413 		InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
414 	};
415 	return *pAuthorNames->GetObject(nPos);
416 }
417 
418 /*--------------------------------------------------------------------
419 	Beschreibung:
420  --------------------------------------------------------------------*/
421 
422 sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
423 {
424 	sal_uInt16 nPos = 0;
425 
426 	while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
427 		nPos++;
428 
429 	if (nPos == pAuthorNames->Count())
430 		pAuthorNames->Insert(new String(rAuthor), nPos);
431 
432 	return nPos;
433 }
434 
435 /*--------------------------------------------------------------------
436 	Beschreibung:
437  --------------------------------------------------------------------*/
438 
439 void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
440 						const AuthorCharAttr &rAttr )
441 {
442 	Color aCol( rAttr.nColor );
443 
444 	if( COL_TRANSPARENT == rAttr.nColor )
445 	{
446 		static const ColorData aColArr[] = {
447 		 COL_AUTHOR1_DARK,		COL_AUTHOR2_DARK,	COL_AUTHOR3_DARK,
448 		 COL_AUTHOR4_DARK,		COL_AUTHOR5_DARK,	COL_AUTHOR6_DARK,
449 		 COL_AUTHOR7_DARK,		COL_AUTHOR8_DARK,	COL_AUTHOR9_DARK };
450 
451 		aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
452 										   sizeof( aColArr[0] )) ] );
453 	}
454 
455 	sal_Bool bBackGr = COL_NONE == rAttr.nColor;
456 
457 	switch (rAttr.nItemId)
458 	{
459 	case SID_ATTR_CHAR_WEIGHT:
460 		{
461 			SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
462 			rSet.Put( aW );
463 			aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
464 			rSet.Put( aW );
465 			aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
466 			rSet.Put( aW );
467 		}
468 		break;
469 
470 	case SID_ATTR_CHAR_POSTURE:
471 		{
472 			SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
473 			rSet.Put( aP );
474 			aP.SetWhich( RES_CHRATR_CJK_POSTURE );
475 			rSet.Put( aP );
476 			aP.SetWhich( RES_CHRATR_CTL_POSTURE );
477 			rSet.Put( aP );
478 		}
479 		break;
480 
481 	case SID_ATTR_CHAR_UNDERLINE:
482 		rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
483 									RES_CHRATR_UNDERLINE));
484 		break;
485 
486 	case SID_ATTR_CHAR_STRIKEOUT:
487 		rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
488 									RES_CHRATR_CROSSEDOUT));
489 		break;
490 
491 	case SID_ATTR_CHAR_CASEMAP:
492 		rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
493 									RES_CHRATR_CASEMAP));
494 		break;
495 
496 	case SID_ATTR_BRUSH:
497 		rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
498 		bBackGr = sal_True;
499 		break;
500 	}
501 
502 	if( !bBackGr )
503         rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
504 }
505 
506 /*--------------------------------------------------------------------
507 	Beschreibung:
508  --------------------------------------------------------------------*/
509 
510 void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
511 {
512 	lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
513 }
514 
515 /*--------------------------------------------------------------------
516 	Beschreibung:
517  --------------------------------------------------------------------*/
518 
519 void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
520 {
521 	lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
522 }
523 
524 /*--------------------------------------------------------------------
525 	Beschreibung: Fuer zukuenftige Erweiterung:
526  --------------------------------------------------------------------*/
527 
528 void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
529 {
530 	lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
531 }
532 
533 /*--------------------------------------------------------------------
534 	Beschreibung:
535  --------------------------------------------------------------------*/
536 
537 sal_uInt16 SwModule::GetRedlineMarkPos()
538 {
539 	return pModuleConfig->GetMarkAlignMode();
540 }
541 
542 /*--------------------------------------------------------------------
543 	Beschreibung:
544  --------------------------------------------------------------------*/
545 
546 sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
547 {
548 	return pModuleConfig->IsInsTblFormatNum(bHTML);
549 }
550 
551 sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
552 {
553 	return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
554 }
555 
556 /*--------------------------------------------------------------------
557 	Beschreibung:
558  --------------------------------------------------------------------*/
559 
560 sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
561 {
562 	return pModuleConfig->IsInsTblAlignNum(bHTML);
563 }
564 
565 /*--------------------------------------------------------------------
566 	Beschreibung:
567  --------------------------------------------------------------------*/
568 
569 const Color &SwModule::GetRedlineMarkColor()
570 {
571 	return pModuleConfig->GetMarkAlignColor();
572 }
573 
574 /*-----------------03.03.98 16:47-------------------
575 
576 --------------------------------------------------*/
577 const SwViewOption*	SwModule::GetViewOption(sal_Bool bWeb)
578 {
579 	return GetUsrPref( bWeb );
580 }
581 
582 // returne den definierten DocStat - WordDelimiter
583 const String& SwModule::GetDocStatWordDelim() const
584 {
585 	return pModuleConfig->GetWordDelimiter();
586 }
587 /* ---------------------------------------------------------------------------
588 
589  ---------------------------------------------------------------------------*/
590 // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
591 sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
592 {
593 	SwMasterUsrPref* pPref;
594 	if(bWeb)
595 	{
596 		if(!pWebUsrPref)
597 			GetUsrPref(sal_True);
598 		pPref = pWebUsrPref;
599 	}
600 	else
601 	{
602 		if(!pUsrPref)
603 			GetUsrPref(sal_False);
604 		pPref = pUsrPref;
605 	}
606     return static_cast< sal_uInt16 >(pPref->GetMetric());
607 }
608 /* ---------------------------------------------------------------------------
609 
610  ---------------------------------------------------------------------------*/
611 // Update-Stati durchreichen
612 sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
613 {
614 	if(!pUsrPref)
615 		GetUsrPref(sal_False);
616     return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
617 }
618 /* ---------------------------------------------------------------------------
619 
620  ---------------------------------------------------------------------------*/
621 SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
622 {
623 	if(!pUsrPref)
624 		GetUsrPref(sal_False);
625     return pUsrPref->GetFldUpdateFlags();
626 }
627 /* -----------------------------28.09.00 14:18--------------------------------
628 
629  ---------------------------------------------------------------------------*/
630 void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
631 {
632 	if(!pUsrPref)
633 		GetUsrPref(sal_False);
634     pUsrPref->SetFldUpdateFlags(eFldFlags);
635 }
636 /* -----------------------------28.09.00 14:18--------------------------------
637 
638  ---------------------------------------------------------------------------*/
639 void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
640 {
641 	if(!pUsrPref)
642 		GetUsrPref(sal_False);
643 	pUsrPref->SetUpdateLinkMode(nNewLinkMode);
644 }
645 /* ---------------------------------------------------------------------------
646 
647  ---------------------------------------------------------------------------*/
648 void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
649 		sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
650 {
651 	sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
652 	sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
653 	if( bOnlineSpelling || bInvalid )
654 	{
655 		TypeId aType = TYPE(SwDocShell);
656 		for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
657 			 pDocSh;
658 			 pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
659 		{
660 			SwDoc* pTmp = pDocSh->GetDoc();
661 			if ( pTmp->GetCurrentViewShell() )	//swmod 071108//swmod 071225
662             {
663 				pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
664                 ViewShell* pViewShell = 0;
665                 pTmp->GetEditShell( &pViewShell );
666                 if ( bSmartTags && pViewShell && pViewShell->GetWin() )
667                     pViewShell->GetWin()->Invalidate();
668             }
669 		}
670 //		pSpell->SetSpellWrongAgain( sal_False );
671 //		pSpell->SetSpellAllAgain( sal_False );
672 	}
673 }
674 
675 void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
676 {
677     if(!pUsrPref)
678         GetUsrPref(sal_False);
679     pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
680 }
681