merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / app / swmodul1.cxx
blobedd2ea485b5c3323419cd630f0451f940133c042
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swmodul1.cxx,v $
10 * $Revision: 1.45 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hintids.hxx>
36 #include <sfx2/request.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/childwin.hxx>
39 #include <svtools/useroptions.hxx>
40 #include <cppuhelper/weak.hxx>
41 #include <com/sun/star/frame/FrameSearchFlag.hpp>
42 #include <com/sun/star/view/XSelectionSupplier.hpp>
43 #include <cppuhelper/implbase1.hxx> // helper for implementations
44 #include <svx/dataaccessdescriptor.hxx>
45 #include <svx/wghtitem.hxx>
46 #include <svx/postitem.hxx>
47 #include <svx/udlnitem.hxx>
48 #include <svx/crsditem.hxx>
49 #include <svx/cmapitem.hxx>
50 #include <svx/colritem.hxx>
51 #include <svx/brshitem.hxx>
52 #include <vcl/msgbox.hxx>
53 #include <svtools/cjkoptions.hxx>
54 #include <swmodule.hxx>
55 #include <swtypes.hxx>
56 #include <usrpref.hxx>
57 #include <modcfg.hxx>
58 #include <view.hxx>
59 #include <pview.hxx>
60 #include <wview.hxx>
61 #include <wrtsh.hxx>
62 #include <docsh.hxx>
63 #include <dbmgr.hxx>
64 #include <uinums.hxx>
65 #include <prtopt.hxx> // fuer PrintOptions
66 #include <navicfg.hxx>
67 #include <doc.hxx>
68 #include <cmdid.h>
69 #include <app.hrc>
70 #include "helpid.h"
72 #include <unomid.h>
73 #include <tools/color.hxx>
74 #include "PostItMgr.hxx"
76 using ::rtl::OUString;
77 using namespace ::svx;
78 using namespace ::com::sun::star;
79 using namespace ::com::sun::star::uno;
80 using namespace ::com::sun::star::beans;
81 using namespace ::com::sun::star::frame;
82 using namespace ::com::sun::star::view;
83 using namespace ::com::sun::star::lang;
86 /*-----------------08/28/97 08:41pm-----------------
88 --------------------------------------------------*/
89 void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh )
91 // in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen
92 sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
93 sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
94 sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
96 pSh->SetUIOptions(*pPref);
97 const SwViewOption* pNewPref = pSh->GetViewOptions();
99 // Scrollbars an / aus
100 if(bVScrollChanged)
102 pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
104 if(bHScrollChanged)
106 pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE));
108 //if only the position of the vertical ruler has been changed initiate an update
109 if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
110 pView->InvalidateBorder();
112 // Lineale an / aus
113 if(pNewPref->IsViewVRuler())
114 pView->CreateVLineal();
115 else
116 pView->KillVLineal();
118 // TabWindow an/aus
119 if(pNewPref->IsViewHRuler())
120 pView->CreateTab();
121 else
122 pView->KillTab();
124 pView->GetPostItMgr()->PrepareView(true);
127 /*--------------------------------------------------------------------
128 Beschreibung: Aktuelle SwWrtShell
129 --------------------------------------------------------------------*/
132 SwWrtShell* GetActiveWrtShell()
134 SwView *pActive = ::GetActiveView();
135 if( pActive )
136 return &pActive->GetWrtShell();
137 return 0;
140 /*--------------------------------------------------------------------
141 Beschreibung: Pointer auf die aktuelle Sicht
142 --------------------------------------------------------------------*/
145 SwView* GetActiveView()
147 SfxViewShell* pView = SfxViewShell::Current();
148 return PTR_CAST( SwView, pView );
150 /*--------------------------------------------------------------------
151 Beschreibung: Ueber Views iterieren - static
152 --------------------------------------------------------------------*/
154 SwView* SwModule::GetFirstView()
156 // liefert nur sichtbare SwViews
157 const TypeId aTypeId = TYPE(SwView);
158 SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
159 return pView;
163 SwView* SwModule::GetNextView(SwView* pView)
165 DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben");
166 const TypeId aTypeId = TYPE(SwView);
167 SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, TRUE);
168 return pNView;
171 /*------------------------------------------------------------------------
172 Beschreibung: Neuer Master fuer die Einstellungen wird gesetzt;
173 dieser wirkt sich auf die aktuelle Sicht und alle
174 folgenden aus.
175 ------------------------------------------------------------------------*/
177 void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
178 sal_uInt16 nDest )
180 SwView* pCurrView = pActView;
181 ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
183 SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
184 VIEWOPT_DEST_WEB == nDest ? sal_True :
185 VIEWOPT_DEST_TEXT== nDest ? sal_False :
186 pCurrView && pCurrView->ISA(SwWebView) ));
188 //per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden
189 sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
190 //PreView abfruehstuecken
191 SwPagePreView* pPPView;
192 if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
194 if(!bViewOnly)
195 pPref->SetUIOptions( rUsrPref );
196 pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
197 pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
198 if(!bViewOnly)
200 pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
201 pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
203 return;
206 if(!bViewOnly)
208 pPref->SetUsrPref( rUsrPref );
209 pPref->SetModified();
212 if( !pCurrView )
213 return;
215 // Weitergabe an die CORE
216 const sal_Bool bReadonly = pCurrView->GetDocShell()->IsReadOnly();
217 SwViewOption* pViewOpt;
218 if(!bViewOnly)
219 pViewOpt = new SwViewOption( *pPref );
220 else
221 pViewOpt = new SwViewOption( rUsrPref );
222 pViewOpt->SetReadonly( bReadonly );
223 if( !(*pSh->GetViewOptions() == *pViewOpt) )
225 //Ist evtl. nur eine ViewShell
226 pSh->StartAction();
227 pSh->ApplyViewOptions( *pViewOpt );
228 ((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea());
229 pSh->EndAction();
231 if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
232 pSh->SetReadonlyOption(bReadonly);
234 lcl_SetUIPrefs(pViewOpt, pCurrView, pSh);
236 // zum Schluss wird das Idle-Flag wieder gesetzt
237 // #42510#
238 pPref->SetIdle(sal_True);
240 /* -----------------------------28.09.00 12:36--------------------------------
242 ---------------------------------------------------------------------------*/
243 void SwModule::ApplyUserMetric( FieldUnit eMetric, BOOL bWeb )
245 SwMasterUsrPref* pPref;
246 if(bWeb)
248 if(!pWebUsrPref)
249 GetUsrPref(sal_True);
250 pPref = pWebUsrPref;
252 else
254 if(!pUsrPref)
255 GetUsrPref(sal_False);
256 pPref = pUsrPref;
258 FieldUnit eOldMetric = pPref->GetMetric();
259 if(eOldMetric != eMetric)
260 pPref->SetMetric(eMetric);
262 FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
263 FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
265 SwView* pTmpView = SwModule::GetFirstView();
266 // fuer alle MDI-Fenster das Lineal umschalten
267 while(pTmpView)
269 if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
271 pTmpView->ChangeVLinealMetric(eVScrollMetric);
272 pTmpView->ChangeTabMetric(eHScrollMetric);
275 pTmpView = SwModule::GetNextView(pTmpView);
278 /*-- 12.11.2008 14:47:58---------------------------------------------------
280 -----------------------------------------------------------------------*/
281 void SwModule::ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb )
283 SwMasterUsrPref* pPref;
284 if(bWeb)
286 if(!pWebUsrPref)
287 GetUsrPref(sal_True);
288 pPref = pWebUsrPref;
290 else
292 if(!pUsrPref)
293 GetUsrPref(sal_False);
294 pPref = pUsrPref;
296 if( bHorizontal )
297 pPref->SetHScrollMetric(eMetric);
298 else
299 pPref->SetVScrollMetric(eMetric);
301 SwView* pTmpView = SwModule::GetFirstView();
302 // switch metric at the appropriate rulers
303 while(pTmpView)
305 if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
307 if( bHorizontal )
308 pTmpView->ChangeTabMetric(eMetric);
309 else
310 pTmpView->ChangeVLinealMetric(eMetric);
312 pTmpView = SwModule::GetNextView(pTmpView);
316 /*-------------------------------------------------
317 set the usrpref 's char unit attribute and set ruler
318 's unit as char if the "apply char unit" is checked
319 --------------------------------------------------*/
320 void SwModule::ApplyUserCharUnit(BOOL bApplyChar, BOOL bWeb)
322 SwMasterUsrPref* pPref;
323 if(bWeb)
325 if(!pWebUsrPref)
326 GetUsrPref(sal_True);
327 pPref = pWebUsrPref;
329 else
331 if(!pUsrPref)
332 GetUsrPref(sal_False);
333 pPref = pUsrPref;
335 BOOL bOldApplyCharUnit = pPref->IsApplyCharUnit();
336 BOOL bHasChanged = FALSE;
337 if(bOldApplyCharUnit != bApplyChar)
339 pPref->SetApplyCharUnit(bApplyChar);
340 bHasChanged = TRUE;
343 if( !bHasChanged )
344 return;
346 FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : pPref->GetMetric();
347 FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : pPref->GetMetric();
348 if(bApplyChar)
350 eHScrollMetric = FUNIT_CHAR;
351 eVScrollMetric = FUNIT_LINE;
353 else
355 SvtCJKOptions aCJKOptions;
356 if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FUNIT_CHAR ))
357 eHScrollMetric = FUNIT_INCH;
358 else if ( eHScrollMetric == FUNIT_CHAR )
359 eHScrollMetric = FUNIT_CM;
360 if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FUNIT_LINE ))
361 eVScrollMetric = FUNIT_INCH;
362 else if ( eVScrollMetric == FUNIT_LINE )
363 eVScrollMetric = FUNIT_CM;
365 SwView* pTmpView = SwModule::GetFirstView();
366 // fuer alle MDI-Fenster das Lineal umschalten
367 while(pTmpView)
369 if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
371 pTmpView->ChangeVLinealMetric(eVScrollMetric);
372 pTmpView->ChangeTabMetric(eHScrollMetric);
375 pTmpView = SwModule::GetNextView(pTmpView);
379 /*-----------------13.11.96 11.57-------------------
381 --------------------------------------------------*/
383 SwNavigationConfig* SwModule::GetNavigationConfig()
385 if(!pNavigationConfig)
387 pNavigationConfig = new SwNavigationConfig;
389 return pNavigationConfig;
392 /*-----------------05.02.97 08.03-------------------
394 --------------------------------------------------*/
396 SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
398 if(bWeb && !pWebPrtOpt)
400 pWebPrtOpt = new SwPrintOptions(TRUE);
402 else if(!bWeb && !pPrtOpt)
404 pPrtOpt = new SwPrintOptions(FALSE);
407 return bWeb ? pWebPrtOpt : pPrtOpt;
410 /*-----------------26.06.97 07.52-------------------
412 --------------------------------------------------*/
413 SwChapterNumRules* SwModule::GetChapterNumRules()
415 if(!pChapterNumRules)
416 pChapterNumRules = new SwChapterNumRules;
417 return pChapterNumRules;
420 /*--------------------------------------------------------------------
421 Beschreibung:
422 --------------------------------------------------------------------*/
424 void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/)
426 Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame()->GetFrameInterface();
427 Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
429 uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
430 rtl::OUString::createFromAscii("_beamer"),
431 FrameSearchFlag::CHILDREN);
432 if (xBeamerFrame.is())
433 { // the beamer has been opened by the SfxViewFrame
434 Reference<XController> xController = xBeamerFrame->getController();
435 Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
436 if (xControllerSelection.is())
439 ODataAccessDescriptor aSelection;
440 aSelection.setDataSource(rData.sDataSource);
441 aSelection[daCommand] <<= rData.sCommand;
442 aSelection[daCommandType] <<= rData.nCommandType;
443 xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
445 else {
446 DBG_ERROR("no selection supplier in the beamer!");
450 /*--------------------------------------------------------------------
451 Beschreibung: Redlining
452 --------------------------------------------------------------------*/
454 sal_uInt16 SwModule::GetRedlineAuthor()
456 if (!bAuthorInitialised)
458 const SvtUserOptions& rOpt = GetUserOptions();
459 if( !(sActAuthor = rOpt.GetFullName()).Len() )
460 if( !(sActAuthor = rOpt.GetID()).Len() )
461 sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
462 bAuthorInitialised = sal_True;
464 return InsertRedlineAuthor( sActAuthor );
467 /*--------------------------------------------------------------------
468 Beschreibung:
469 --------------------------------------------------------------------*/
471 const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
473 DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
474 while (!(nPos<pAuthorNames->Count()))
476 InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
478 return *pAuthorNames->GetObject(nPos);
481 /*--------------------------------------------------------------------
482 Beschreibung:
483 --------------------------------------------------------------------*/
485 sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
487 sal_uInt16 nPos = 0;
489 while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
490 nPos++;
492 if (nPos == pAuthorNames->Count())
493 pAuthorNames->Insert(new String(rAuthor), nPos);
495 return nPos;
498 /*--------------------------------------------------------------------
499 Beschreibung:
500 --------------------------------------------------------------------*/
502 void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
503 const AuthorCharAttr &rAttr )
505 Color aCol( rAttr.nColor );
507 if( COL_TRANSPARENT == rAttr.nColor )
509 static const ColorData aColArr[] = {
510 COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
511 COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
512 COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
514 aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
515 sizeof( aColArr[0] )) ] );
518 sal_Bool bBackGr = COL_NONE == rAttr.nColor;
520 switch (rAttr.nItemId)
522 case SID_ATTR_CHAR_WEIGHT:
524 SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
525 rSet.Put( aW );
526 aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
527 rSet.Put( aW );
528 aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
529 rSet.Put( aW );
531 break;
533 case SID_ATTR_CHAR_POSTURE:
535 SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
536 rSet.Put( aP );
537 aP.SetWhich( RES_CHRATR_CJK_POSTURE );
538 rSet.Put( aP );
539 aP.SetWhich( RES_CHRATR_CTL_POSTURE );
540 rSet.Put( aP );
542 break;
544 case SID_ATTR_CHAR_UNDERLINE:
545 rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
546 RES_CHRATR_UNDERLINE));
547 break;
549 case SID_ATTR_CHAR_STRIKEOUT:
550 rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
551 RES_CHRATR_CROSSEDOUT));
552 break;
554 case SID_ATTR_CHAR_CASEMAP:
555 rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
556 RES_CHRATR_CASEMAP));
557 break;
559 case SID_ATTR_BRUSH:
560 rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
561 bBackGr = sal_True;
562 break;
565 if( !bBackGr )
566 rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
569 /*--------------------------------------------------------------------
570 Beschreibung:
571 --------------------------------------------------------------------*/
573 void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
575 lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
578 /*--------------------------------------------------------------------
579 Beschreibung:
580 --------------------------------------------------------------------*/
582 void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
584 lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
587 /*--------------------------------------------------------------------
588 Beschreibung: Fuer zukuenftige Erweiterung:
589 --------------------------------------------------------------------*/
591 void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
593 lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
596 /*--------------------------------------------------------------------
597 Beschreibung:
598 --------------------------------------------------------------------*/
600 sal_uInt16 SwModule::GetRedlineMarkPos()
602 return pModuleConfig->GetMarkAlignMode();
605 /*--------------------------------------------------------------------
606 Beschreibung:
607 --------------------------------------------------------------------*/
609 sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
611 return pModuleConfig->IsInsTblFormatNum(bHTML);
614 sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
616 return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
619 /*--------------------------------------------------------------------
620 Beschreibung:
621 --------------------------------------------------------------------*/
623 sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
625 return pModuleConfig->IsInsTblAlignNum(bHTML);
628 /*--------------------------------------------------------------------
629 Beschreibung:
630 --------------------------------------------------------------------*/
632 const Color &SwModule::GetRedlineMarkColor()
634 return pModuleConfig->GetMarkAlignColor();
637 /*-----------------03.03.98 16:47-------------------
639 --------------------------------------------------*/
640 const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
642 return GetUsrPref( bWeb );
645 // returne den definierten DocStat - WordDelimiter
646 const String& SwModule::GetDocStatWordDelim() const
648 return pModuleConfig->GetWordDelimiter();
650 /* ---------------------------------------------------------------------------
652 ---------------------------------------------------------------------------*/
653 // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
654 sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
656 SwMasterUsrPref* pPref;
657 if(bWeb)
659 if(!pWebUsrPref)
660 GetUsrPref(sal_True);
661 pPref = pWebUsrPref;
663 else
665 if(!pUsrPref)
666 GetUsrPref(sal_False);
667 pPref = pUsrPref;
669 return static_cast< sal_uInt16 >(pPref->GetMetric());
671 /* ---------------------------------------------------------------------------
673 ---------------------------------------------------------------------------*/
674 // Update-Stati durchreichen
675 sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
677 if(!pUsrPref)
678 GetUsrPref(sal_False);
679 return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
681 /* ---------------------------------------------------------------------------
683 ---------------------------------------------------------------------------*/
684 SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
686 if(!pUsrPref)
687 GetUsrPref(sal_False);
688 return pUsrPref->GetFldUpdateFlags();
690 /* -----------------------------28.09.00 14:18--------------------------------
692 ---------------------------------------------------------------------------*/
693 void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
695 if(!pUsrPref)
696 GetUsrPref(sal_False);
697 pUsrPref->SetFldUpdateFlags(eFldFlags);
699 /* -----------------------------28.09.00 14:18--------------------------------
701 ---------------------------------------------------------------------------*/
702 void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
704 if(!pUsrPref)
705 GetUsrPref(sal_False);
706 pUsrPref->SetUpdateLinkMode(nNewLinkMode);
708 /* ---------------------------------------------------------------------------
710 ---------------------------------------------------------------------------*/
711 void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
712 sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
714 sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
715 sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
716 if( bOnlineSpelling || bInvalid )
718 TypeId aType = TYPE(SwDocShell);
719 for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
720 pDocSh;
721 pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
723 SwDoc* pTmp = pDocSh->GetDoc();
724 if ( pTmp->GetRootFrm() )
726 pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
727 ViewShell* pViewShell = 0;
728 pTmp->GetEditShell( &pViewShell );
729 if ( bSmartTags && pViewShell && pViewShell->GetWin() )
730 pViewShell->GetWin()->Invalidate();
733 // pSpell->SetSpellWrongAgain( sal_False );
734 // pSpell->SetSpellAllAgain( sal_False );
738 void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
740 if(!pUsrPref)
741 GetUsrPref(sal_False);
742 pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);