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