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