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 --------------------------------------------------*/
lcl_SetUIPrefs(const SwViewOption * pPref,SwView * pView,ViewShell * pSh)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
GetActiveWrtShell()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
GetActiveView()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
GetFirstView()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
GetNextView(SwView * pView)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
ApplyUsrPref(const SwViewOption & rUsrPref,SwView * pActView,sal_uInt16 nDest)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 delete pViewOpt;
238 }
239 /* -----------------------------28.09.00 12:36--------------------------------
240
241 ---------------------------------------------------------------------------*/
ApplyUserMetric(FieldUnit eMetric,sal_Bool bWeb)242 void SwModule::ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb )
243 {
244 SwMasterUsrPref* pPref;
245 if(bWeb)
246 {
247 if(!pWebUsrPref)
248 GetUsrPref(sal_True);
249 pPref = pWebUsrPref;
250 }
251 else
252 {
253 if(!pUsrPref)
254 GetUsrPref(sal_False);
255 pPref = pUsrPref;
256 }
257 FieldUnit eOldMetric = pPref->GetMetric();
258 if(eOldMetric != eMetric)
259 pPref->SetMetric(eMetric);
260
261 FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
262 FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
263
264 SwView* pTmpView = SwModule::GetFirstView();
265 // fuer alle MDI-Fenster das Lineal umschalten
266 while(pTmpView)
267 {
268 if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
269 {
270 pTmpView->ChangeVLinealMetric(eVScrollMetric);
271 pTmpView->ChangeTabMetric(eHScrollMetric);
272 }
273
274 pTmpView = SwModule::GetNextView(pTmpView);
275 }
276 }
277 /*-- 12.11.2008 14:47:58---------------------------------------------------
278
279 -----------------------------------------------------------------------*/
ApplyRulerMetric(FieldUnit eMetric,sal_Bool bHorizontal,sal_Bool bWeb)280 void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb )
281 {
282 SwMasterUsrPref* pPref;
283 if(bWeb)
284 {
285 if(!pWebUsrPref)
286 GetUsrPref(sal_True);
287 pPref = pWebUsrPref;
288 }
289 else
290 {
291 if(!pUsrPref)
292 GetUsrPref(sal_False);
293 pPref = pUsrPref;
294 }
295 if( bHorizontal )
296 pPref->SetHScrollMetric(eMetric);
297 else
298 pPref->SetVScrollMetric(eMetric);
299
300 SwView* pTmpView = SwModule::GetFirstView();
301 // switch metric at the appropriate rulers
302 while(pTmpView)
303 {
304 if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
305 {
306 if( bHorizontal )
307 pTmpView->ChangeTabMetric(eMetric);
308 else
309 pTmpView->ChangeVLinealMetric(eMetric);
310 }
311 pTmpView = SwModule::GetNextView(pTmpView);
312 }
313 }
314 /*-----------------13.11.96 11.57-------------------
315
316 --------------------------------------------------*/
317
GetNavigationConfig()318 SwNavigationConfig* SwModule::GetNavigationConfig()
319 {
320 if(!pNavigationConfig)
321 {
322 pNavigationConfig = new SwNavigationConfig;
323 }
324 return pNavigationConfig;
325 }
326
327 /*-----------------05.02.97 08.03-------------------
328
329 --------------------------------------------------*/
330
GetPrtOptions(sal_Bool bWeb)331 SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
332 {
333 if(bWeb && !pWebPrtOpt)
334 {
335 pWebPrtOpt = new SwPrintOptions(sal_True);
336 }
337 else if(!bWeb && !pPrtOpt)
338 {
339 pPrtOpt = new SwPrintOptions(sal_False);
340 }
341
342 return bWeb ? pWebPrtOpt : pPrtOpt;
343 }
344
345 /*-----------------26.06.97 07.52-------------------
346
347 --------------------------------------------------*/
GetChapterNumRules()348 SwChapterNumRules* SwModule::GetChapterNumRules()
349 {
350 if(!pChapterNumRules)
351 pChapterNumRules = new SwChapterNumRules;
352 return pChapterNumRules;
353 }
354
355 /*--------------------------------------------------------------------
356 Beschreibung:
357 --------------------------------------------------------------------*/
358
ShowDBObj(SwView & rView,const SwDBData & rData,sal_Bool)359 void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/)
360 {
361 Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
362 Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
363
364 uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
365 rtl::OUString::createFromAscii("_beamer"),
366 FrameSearchFlag::CHILDREN);
367 if (xBeamerFrame.is())
368 { // the beamer has been opened by the SfxViewFrame
369 Reference<XController> xController = xBeamerFrame->getController();
370 Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
371 if (xControllerSelection.is())
372 {
373
374 ODataAccessDescriptor aSelection;
375 aSelection.setDataSource(rData.sDataSource);
376 aSelection[daCommand] <<= rData.sCommand;
377 aSelection[daCommandType] <<= rData.nCommandType;
378 xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
379 }
380 else {
381 DBG_ERROR("no selection supplier in the beamer!");
382 }
383 }
384 }
385 /*--------------------------------------------------------------------
386 Beschreibung: Redlining
387 --------------------------------------------------------------------*/
388
GetRedlineAuthor()389 sal_uInt16 SwModule::GetRedlineAuthor()
390 {
391 if (!bAuthorInitialised)
392 {
393 const SvtUserOptions& rOpt = GetUserOptions();
394 if( !(sActAuthor = rOpt.GetFullName()).Len() )
395 if( !(sActAuthor = rOpt.GetID()).Len() )
396 sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
397 bAuthorInitialised = sal_True;
398 }
399 return InsertRedlineAuthor( sActAuthor );
400 }
401
402 /*--------------------------------------------------------------------
403 Beschreibung:
404 --------------------------------------------------------------------*/
405
GetRedlineAuthor(sal_uInt16 nPos)406 const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
407 {
408 DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
409 while (!(nPos<pAuthorNames->Count()))
410 {
411 InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
412 };
413 return *pAuthorNames->GetObject(nPos);
414 }
415
416 /*--------------------------------------------------------------------
417 Beschreibung:
418 --------------------------------------------------------------------*/
419
InsertRedlineAuthor(const String & rAuthor)420 sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
421 {
422 sal_uInt16 nPos = 0;
423
424 while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
425 nPos++;
426
427 if (nPos == pAuthorNames->Count())
428 pAuthorNames->Insert(new String(rAuthor), nPos);
429
430 return nPos;
431 }
432
433 /*--------------------------------------------------------------------
434 Beschreibung:
435 --------------------------------------------------------------------*/
436
lcl_FillAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet,const AuthorCharAttr & rAttr)437 void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
438 const AuthorCharAttr &rAttr )
439 {
440 Color aCol( rAttr.nColor );
441
442 if( COL_TRANSPARENT == rAttr.nColor )
443 {
444 static const ColorData aColArr[] = {
445 COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
446 COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
447 COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
448
449 aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
450 sizeof( aColArr[0] )) ] );
451 }
452
453 sal_Bool bBackGr = COL_NONE == rAttr.nColor;
454
455 switch (rAttr.nItemId)
456 {
457 case SID_ATTR_CHAR_WEIGHT:
458 {
459 SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
460 rSet.Put( aW );
461 aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
462 rSet.Put( aW );
463 aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
464 rSet.Put( aW );
465 }
466 break;
467
468 case SID_ATTR_CHAR_POSTURE:
469 {
470 SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
471 rSet.Put( aP );
472 aP.SetWhich( RES_CHRATR_CJK_POSTURE );
473 rSet.Put( aP );
474 aP.SetWhich( RES_CHRATR_CTL_POSTURE );
475 rSet.Put( aP );
476 }
477 break;
478
479 case SID_ATTR_CHAR_UNDERLINE:
480 rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
481 RES_CHRATR_UNDERLINE));
482 break;
483
484 case SID_ATTR_CHAR_STRIKEOUT:
485 rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
486 RES_CHRATR_CROSSEDOUT));
487 break;
488
489 case SID_ATTR_CHAR_CASEMAP:
490 rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
491 RES_CHRATR_CASEMAP));
492 break;
493
494 case SID_ATTR_BRUSH:
495 rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
496 bBackGr = sal_True;
497 break;
498 }
499
500 if( !bBackGr )
501 rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
502 }
503
504 /*--------------------------------------------------------------------
505 Beschreibung:
506 --------------------------------------------------------------------*/
507
GetInsertAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)508 void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
509 {
510 lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
511 }
512
513 /*--------------------------------------------------------------------
514 Beschreibung:
515 --------------------------------------------------------------------*/
516
GetDeletedAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)517 void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
518 {
519 lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
520 }
521
522 /*--------------------------------------------------------------------
523 Beschreibung: Fuer zukuenftige Erweiterung:
524 --------------------------------------------------------------------*/
525
GetFormatAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)526 void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
527 {
528 lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
529 }
530
531 /*--------------------------------------------------------------------
532 Beschreibung:
533 --------------------------------------------------------------------*/
534
GetRedlineMarkPos()535 sal_uInt16 SwModule::GetRedlineMarkPos()
536 {
537 return pModuleConfig->GetMarkAlignMode();
538 }
539
540 /*--------------------------------------------------------------------
541 Beschreibung:
542 --------------------------------------------------------------------*/
543
IsInsTblFormatNum(sal_Bool bHTML) const544 sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
545 {
546 return pModuleConfig->IsInsTblFormatNum(bHTML);
547 }
548
IsInsTblChangeNumFormat(sal_Bool bHTML) const549 sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
550 {
551 return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
552 }
553
554 /*--------------------------------------------------------------------
555 Beschreibung:
556 --------------------------------------------------------------------*/
557
IsInsTblAlignNum(sal_Bool bHTML) const558 sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
559 {
560 return pModuleConfig->IsInsTblAlignNum(bHTML);
561 }
562
563 /*--------------------------------------------------------------------
564 Beschreibung:
565 --------------------------------------------------------------------*/
566
GetRedlineMarkColor()567 const Color &SwModule::GetRedlineMarkColor()
568 {
569 return pModuleConfig->GetMarkAlignColor();
570 }
571
572 /*-----------------03.03.98 16:47-------------------
573
574 --------------------------------------------------*/
GetViewOption(sal_Bool bWeb)575 const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
576 {
577 return GetUsrPref( bWeb );
578 }
579
580 // returne den definierten DocStat - WordDelimiter
GetDocStatWordDelim() const581 const String& SwModule::GetDocStatWordDelim() const
582 {
583 return pModuleConfig->GetWordDelimiter();
584 }
585 /* ---------------------------------------------------------------------------
586
587 ---------------------------------------------------------------------------*/
588 // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
GetMetric(sal_Bool bWeb) const589 sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
590 {
591 SwMasterUsrPref* pPref;
592 if(bWeb)
593 {
594 if(!pWebUsrPref)
595 GetUsrPref(sal_True);
596 pPref = pWebUsrPref;
597 }
598 else
599 {
600 if(!pUsrPref)
601 GetUsrPref(sal_False);
602 pPref = pUsrPref;
603 }
604 return static_cast< sal_uInt16 >(pPref->GetMetric());
605 }
606 /* ---------------------------------------------------------------------------
607
608 ---------------------------------------------------------------------------*/
609 // Update-Stati durchreichen
GetLinkUpdMode(sal_Bool) const610 sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
611 {
612 if(!pUsrPref)
613 GetUsrPref(sal_False);
614 return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
615 }
616 /* ---------------------------------------------------------------------------
617
618 ---------------------------------------------------------------------------*/
GetFldUpdateFlags(sal_Bool) const619 SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
620 {
621 if(!pUsrPref)
622 GetUsrPref(sal_False);
623 return pUsrPref->GetFldUpdateFlags();
624 }
625 /* -----------------------------28.09.00 14:18--------------------------------
626
627 ---------------------------------------------------------------------------*/
ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)628 void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
629 {
630 if(!pUsrPref)
631 GetUsrPref(sal_False);
632 pUsrPref->SetFldUpdateFlags(eFldFlags);
633 }
634 /* -----------------------------28.09.00 14:18--------------------------------
635
636 ---------------------------------------------------------------------------*/
ApplyLinkMode(sal_Int32 nNewLinkMode)637 void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
638 {
639 if(!pUsrPref)
640 GetUsrPref(sal_False);
641 pUsrPref->SetUpdateLinkMode(nNewLinkMode);
642 }
643 /* ---------------------------------------------------------------------------
644
645 ---------------------------------------------------------------------------*/
CheckSpellChanges(sal_Bool bOnlineSpelling,sal_Bool bIsSpellWrongAgain,sal_Bool bIsSpellAllAgain,sal_Bool bSmartTags)646 void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
647 sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
648 {
649 sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
650 sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
651 if( bOnlineSpelling || bInvalid )
652 {
653 TypeId aType = TYPE(SwDocShell);
654 for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
655 pDocSh;
656 pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
657 {
658 SwDoc* pTmp = pDocSh->GetDoc();
659 if ( pTmp->GetCurrentViewShell() ) //swmod 071108//swmod 071225
660 {
661 pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
662 ViewShell* pViewShell = 0;
663 pTmp->GetEditShell( &pViewShell );
664 if ( bSmartTags && pViewShell && pViewShell->GetWin() )
665 pViewShell->GetWin()->Invalidate();
666 }
667 }
668 // pSpell->SetSpellWrongAgain( sal_False );
669 // pSpell->SetSpellAllAgain( sal_False );
670 }
671 }
672
ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)673 void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
674 {
675 if(!pUsrPref)
676 GetUsrPref(sal_False);
677 pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
678 }
679