xref: /trunk/main/sw/source/ui/app/appopt.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 #define _SVSTDARR_STRINGSDTOR
32 #include <svl/svstdarr.hxx>
33 
34 #include <com/sun/star/i18n/ScriptType.hpp>
35 
36 #include <hintids.hxx>
37 #include <cmdid.h>          // Funktion-Ids
38 #include <vcl/msgbox.hxx>
39 #include <svl/eitem.hxx>
40 #include <sfx2/request.hxx>
41 #include <sfx2/app.hxx>
42 #include <sfx2/printer.hxx>
43 #include <svx/htmlmode.hxx>
44 #include <sfx2/bindings.hxx>
45 #include <editeng/brshitem.hxx>
46 #include <editeng/tstpitem.hxx>
47 #include <svx/optgrid.hxx>
48 #include <svx/svxdlg.hxx>
49 #include <svx/dialogs.hrc>
50 #include <i18npool/mslangid.hxx>
51 #include <fontcfg.hxx>
52 #include <optload.hxx>
53 #include <optcomp.hxx>
54 #include <edtwin.hxx>
55 #include <swmodule.hxx>
56 #include <view.hxx>
57 #include <doc.hxx>
58 #include <wrtsh.hxx>
59 #include <IDocumentDeviceAccess.hxx>
60 #include <uitool.hxx>
61 #include <initui.hxx>                   // fuer ::GetGlossaries()
62 #include <fldbas.hxx>      //fuer UpdateFields
63 #include <wview.hxx>
64 #include <cfgitems.hxx>
65 #include <prtopt.hxx>
66 #include <pview.hxx>
67 #include <usrpref.hxx>
68 #include <modcfg.hxx>
69 #include <glosdoc.hxx>
70 #include <uiitems.hxx>
71 #include <editeng/langitem.hxx>
72 #include <unotools/lingucfg.hxx>
73 #include <editeng/unolingu.hxx>
74 #include <globals.hrc>
75 #include <globals.h>        // globale Konstanten z.B.
76 #include <svl/slstitm.hxx>
77 #include "swabstdlg.hxx"
78 #include <swwrtshitem.hxx>
79 
80 #include <unomid.h>
81 
82 using namespace ::com::sun::star::uno;
83 using namespace ::com::sun::star::lang;
84 
85 /* -----------------12.02.99 12:28-------------------
86  *
87  * --------------------------------------------------*/
88 
89 SfxItemSet*  SwModule::CreateItemSet( sal_uInt16 nId )
90 {
91     sal_Bool bTextDialog = (nId == SID_SW_EDITOPTIONS) ? sal_True : sal_False;
92 
93     // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
94         SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
95         SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
96         //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
97         SwView* pAppView = GetView();
98         if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
99             pAppView = 0;
100         if(pAppView)
101         {
102         // wenn Text dann nicht WebView und umgekehrt
103             sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
104             if( (bWebView &&  !bTextDialog) ||(!bWebView &&  bTextDialog))
105             {
106                 aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
107             }
108             else
109                 pAppView = 0; // mit View kann hier nichts gewonnen werden
110         }
111 
112     /********************************************************************/
113     /*                                                                  */
114     /* Optionen/Bearbeiten                                              */
115     /*                                                                  */
116     /********************************************************************/
117     SfxItemSet* pRet = new SfxItemSet (GetPool(),   FN_PARAM_DOCDISP,       FN_PARAM_ELEM,
118                                     SID_PRINTPREVIEW,       SID_PRINTPREVIEW,
119                                     SID_ATTR_GRID_OPTIONS,  SID_ATTR_GRID_OPTIONS,
120                                     FN_PARAM_PRINTER,       FN_PARAM_STDFONTS,
121                                     FN_PARAM_WRTSHELL,      FN_PARAM_WRTSHELL,
122                                     FN_PARAM_ADDPRINTER,    FN_PARAM_ADDPRINTER,
123                                     SID_ATTR_METRIC,        SID_ATTR_METRIC,
124                                     SID_ATTR_DEFTABSTOP,    SID_ATTR_DEFTABSTOP,
125                                     RES_BACKGROUND,         RES_BACKGROUND,
126                                     SID_HTML_MODE,          SID_HTML_MODE,
127                                     FN_PARAM_SHADOWCURSOR,  FN_PARAM_SHADOWCURSOR,
128                                     FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
129                                     FN_HSCROLL_METRIC,      FN_VSCROLL_METRIC,
130                                     SID_ATTR_LANGUAGE,      SID_ATTR_LANGUAGE,
131                                     SID_ATTR_CHAR_CJK_LANGUAGE,   SID_ATTR_CHAR_CJK_LANGUAGE,
132                                     SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
133 #ifdef DBG_UTIL
134                                     FN_PARAM_SWTEST,        FN_PARAM_SWTEST,
135 #endif
136                                     0);
137 
138     pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
139     pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
140     if( bTextDialog )
141     {
142         pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
143         pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
144     }
145 
146     if( pAppView )
147     {
148         SwWrtShell& rWrtShell = pAppView->GetWrtShell();
149 
150         SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
151         if( pPrt )
152             pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
153         pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
154 
155         pRet->Put((const SvxLanguageItem&)
156             rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
157 
158         pRet->Put((const SvxLanguageItem&)
159             rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
160 
161         pRet->Put((const SvxLanguageItem&)
162             rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
163     }
164     else
165     {
166 /*      Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
167  *      SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
168                     SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
169                     SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
170                     0 );
171 
172         pPrt = new SfxPrinter(pSet);
173         pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
174 
175         SvtLinguConfig aLinguCfg;
176         Locale aLocale;
177         LanguageType nLang;
178 
179         using namespace ::com::sun::star::i18n::ScriptType;
180 
181         Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
182         aLang >>= aLocale;
183         nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
184         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
185 
186         aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
187         aLang >>= aLocale;
188         nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
189         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
190 
191         aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
192         aLang >>= aLocale;
193         nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
194         pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
195     }
196     if(bTextDialog)
197         pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
198     if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
199     {
200         SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, sal_True));
201         pRet->Put(aBool);
202     }
203 
204     FieldUnit eUnit = pPref->GetHScrollMetric();
205     if(pAppView)
206         pAppView->GetHLinealMetric(eUnit);
207     pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
208 
209     eUnit = pPref->GetVScrollMetric();
210     if(pAppView)
211         pAppView->GetVLinealMetric(eUnit);
212     pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
213     pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
214     if(bTextDialog)
215     {
216         if(pAppView)
217         {
218             const SvxTabStopItem& rDefTabs =
219                     (const SvxTabStopItem&)pAppView->GetWrtShell().
220                                         GetDefault(RES_PARATR_TABSTOP);
221                 pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)::GetTabDist(rDefTabs)));
222         }
223         else
224             pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
225     }
226 
227     /*-----------------01.02.97 11.13-------------------
228     Optionen fuer GridTabPage
229     --------------------------------------------------*/
230 
231     SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
232 
233     aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
234     aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
235     aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
236 
237     const Size& rSnapSize = aViewOpt.GetSnapSize();
238     aGridItem.SetFldDrawX( (sal_uInt16) (rSnapSize.Width() ));
239     aGridItem.SetFldDrawY( (sal_uInt16) (rSnapSize.Height()));
240 
241     aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
242     aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
243 
244     pRet->Put(aGridItem);
245 
246     /*-----------------01.02.97 13.02-------------------
247         Optionen fuer PrintTabPage
248     --------------------------------------------------*/
249     const SwPrintData* pOpt = pAppView ?
250                         &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
251                         0;
252 
253     if(!pOpt)
254         pOpt = GetPrtOptions(!bTextDialog);
255 
256     SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
257     pRet->Put(aAddPrinterItem);
258 
259     /*-----------------01.02.97 13.12-------------------
260         Optionen fuer Web-Hintergrund
261     --------------------------------------------------*/
262     if(!bTextDialog)
263     {
264         pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
265     }
266 
267 #ifdef DBG_UTIL
268     /*-----------------01.02.97 13.02-------------------
269         Test-Optionen
270     --------------------------------------------------*/
271         SwTestItem aTestItem(FN_PARAM_SWTEST);
272         aTestItem.bTest1 = aViewOpt.IsTest1();
273         aTestItem.bTest2 = aViewOpt.IsTest2();
274         aTestItem.bTest3 = aViewOpt.IsTest3();
275         aTestItem.bTest4 =  aViewOpt.IsTest4();
276         aTestItem.bTest5 = aViewOpt.IsTest5();
277         aTestItem.bTest6 = aViewOpt.IsTest6();
278         aTestItem.bTest7 = aViewOpt.IsTest7();
279         aTestItem.bTest8 = aViewOpt.IsTest8();
280         aTestItem.bTest9 = SwViewOption::IsTest9();
281         aTestItem.bTest10 = aViewOpt.IsTest10();
282         pRet->Put(aTestItem);
283 #endif
284     /*-----------------01.02.97 13.04-------------------
285 
286     --------------------------------------------------*/
287     if(!bTextDialog)
288         pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
289 //  delete pPrt;
290     return pRet;
291 }
292 /* -----------------12.02.99 12:28-------------------
293  *
294  * --------------------------------------------------*/
295 void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
296 {
297     sal_Bool bTextDialog = nId == SID_SW_EDITOPTIONS;
298     SwView* pAppView = GetView();
299     if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
300         pAppView = 0;
301     if(pAppView)
302     {
303         // the text dialog mustn't apply data to the web view and vice versa
304         sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
305         if( (bWebView == bTextDialog))
306             pAppView = 0; //
307     }
308 
309     SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
310     SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
311 
312     const SfxPoolItem* pItem;
313     SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
314                                  : NULL;
315 
316     /*---------------------------------------------------------------------
317             Seite Dokumentansicht auswerten
318     -----------------------------------------------------------------------*/
319     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, &pItem ))
320     {
321         const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
322 
323         if(!aViewOpt.IsViewMetaChars())
324         {
325             if(     (!aViewOpt.IsTab( sal_True ) &&  pDocDispItem->bTab) ||
326                     (!aViewOpt.IsBlank( sal_True ) && pDocDispItem->bSpace) ||
327                     (!aViewOpt.IsParagraph( sal_True ) && pDocDispItem->bParagraphEnd) ||
328                     (!aViewOpt.IsLineBreak( sal_True ) && pDocDispItem->bManualBreak) )
329             {
330                 aViewOpt.SetViewMetaChars(sal_True);
331                 if(pBindings)
332                     pBindings->Invalidate(FN_VIEW_META_CHARS);
333             }
334 
335         }
336         pDocDispItem->FillViewOptions( aViewOpt );
337         if(pBindings)
338         {
339             pBindings->Invalidate(FN_VIEW_GRAPHIC);
340             pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
341         }
342     }
343 
344     /*---------------------------------------------------------------------
345                 Elemente - Item auswerten
346     -----------------------------------------------------------------------*/
347 
348     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, sal_False, &pItem ) )
349     {
350         const SwElemItem* pElemItem = (const SwElemItem*)pItem;
351         pElemItem->FillViewOptions( aViewOpt );
352 
353     }
354 
355     if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, sal_False, &pItem ) )
356     {
357         SFX_APP()->SetOptions(rSet);
358         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
359         ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
360     }
361     if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, sal_False, &pItem ) )
362     {
363         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
364         FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
365         pPref->SetHScrollMetric(eUnit);
366         if(pAppView)
367             pAppView->ChangeTabMetric(eUnit);
368     }
369 
370     if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, sal_False, &pItem ) )
371     {
372         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
373         FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
374         pPref->SetVScrollMetric(eUnit);
375         if(pAppView)
376             pAppView->ChangeVLinealMetric(eUnit);
377     }
378 
379     if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem ) )
380     {
381         sal_uInt16 nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
382         pPref->SetDefTab(nTabDist);
383         if(pAppView)
384         {
385             SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
386             MakeDefTabs( nTabDist, aDefTabs );
387             pAppView->GetWrtShell().SetDefault( aDefTabs );
388         }
389     }
390 
391 
392     /*-----------------01.02.97 11.36-------------------
393         Hintergrund nur im WebDialog
394     --------------------------------------------------*/
395     if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
396     {
397         const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
398                                 RES_BACKGROUND);
399         aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
400     }
401 
402     /*--------------------------------------------------------------------
403             Seite Rastereinstellungen auswerten
404     ----------------------------------------------------------------------*/
405 
406     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, sal_False, &pItem ))
407     {
408         const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
409 
410         aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
411         aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
412         if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
413             aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
414         Size aSize = Size( pGridItem->GetFldDrawX()  ,
415                             pGridItem->GetFldDrawY()  );
416         if( aViewOpt.GetSnapSize() != aSize )
417             aViewOpt.SetSnapSize( aSize );
418         short nDiv = (short)pGridItem->GetFldDivisionX() ;
419         if( aViewOpt.GetDivisionX() != nDiv  )
420             aViewOpt.SetDivisionX( nDiv );
421         nDiv = (short)pGridItem->GetFldDivisionY();
422         if( aViewOpt.GetDivisionY() != nDiv  )
423             aViewOpt.SetDivisionY( nDiv  );
424 
425         if(pBindings)
426         {
427             pBindings->Invalidate(SID_GRID_VISIBLE);
428             pBindings->Invalidate(SID_GRID_USE);
429         }
430     }
431 
432     //--------------------------------------------------------------------------
433     //      Writer Drucker Zusatzeinstellungen auswerten
434     //----------------------------------------------------------------------------
435 
436     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, sal_False, &pItem ))
437     {
438         SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
439         if (pOpt)
440         {
441             const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
442             *pOpt = *pAddPrinterAttr;
443 
444             if(pAppView)
445                 pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
446         }
447 
448     }
449 
450     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
451     {
452         ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
453         if(pBindings)
454             pBindings->Invalidate(FN_SHADOWCURSOR);
455     }
456 
457     if( pAppView )
458     {
459         SwWrtShell &rWrtSh = pAppView->GetWrtShell();
460         const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
461         pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
462 
463         // don't align formulas in documents that are currently loading
464         if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
465             rWrtSh.AlignAllFormulasToBaseline();
466     }
467 
468     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
469     {
470         aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
471     }
472 
473 
474 #ifdef DBG_UTIL
475     /*--------------------------------------------------------------------------
476                 Writer Testseite auswerten
477     ----------------------------------------------------------------------------*/
478 
479             if( SFX_ITEM_SET == rSet.GetItemState(
480                         FN_PARAM_SWTEST, sal_False, &pItem ))
481             {
482                 const SwTestItem* pTestItem = (const SwTestItem*)pItem;
483                 aViewOpt.SetTest1((sal_Bool)pTestItem->bTest1);
484                 aViewOpt.SetTest2((sal_Bool)pTestItem->bTest2);
485                 aViewOpt.SetTest3((sal_Bool)pTestItem->bTest3);
486                 aViewOpt.SetTest4((sal_Bool)pTestItem->bTest4);
487                 aViewOpt.SetTest5((sal_Bool)pTestItem->bTest5);
488                 aViewOpt.SetTest6((sal_Bool)pTestItem->bTest6);
489                 aViewOpt.SetTest7((sal_Bool)pTestItem->bTest7);
490                 aViewOpt.SetTest8((sal_Bool)pTestItem->bTest8);
491                 SwViewOption::SetTest9((sal_Bool)pTestItem->bTest9);
492                 aViewOpt.SetTest10((sal_Bool)pTestItem->bTest10);
493             }
494 #endif
495         // dann an der akt. View und Shell die entsp. Elemente setzen
496     ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
497 }
498 /* -----------------12.02.99 12:28-------------------
499  *
500  * --------------------------------------------------*/
501 SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
502 {
503     SfxTabPage* pRet = NULL;
504     SfxAllItemSet aSet(*(rSet.GetPool()));
505     switch( nId )
506     {
507         case RID_SW_TP_CONTENT_OPT:
508         case RID_SW_TP_HTML_CONTENT_OPT:
509         {
510             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
511             if ( pFact )
512             {
513                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
514                 if ( fnCreatePage )
515                     pRet = (*fnCreatePage)( pParent, rSet );
516             }
517             break;
518         }
519         case RID_SW_TP_HTML_OPTGRID_PAGE:
520         case RID_SVXPAGE_GRID:
521             pRet = SvxGridTabPage::Create(pParent, rSet);
522         break;
523 
524         case RID_SW_TP_STD_FONT:
525         case RID_SW_TP_STD_FONT_CJK:
526         case RID_SW_TP_STD_FONT_CTL:
527         {
528             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
529             if ( pFact )
530             {
531                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
532                 if ( fnCreatePage )
533                     pRet = (*fnCreatePage)( pParent, rSet );
534             }
535             if(RID_SW_TP_STD_FONT != nId)
536             {
537                 aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
538                 pRet->PageCreated(aSet);
539             }
540         }
541         break;
542         case RID_SW_TP_HTML_OPTPRINT_PAGE:
543         case RID_SW_TP_OPTPRINT_PAGE:
544         {
545             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
546             if ( pFact )
547             {
548                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
549                 if ( fnCreatePage )
550                     pRet = (*fnCreatePage)( pParent, rSet );
551             }
552             aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
553             pRet->PageCreated(aSet);
554         }
555         break;
556         case RID_SW_TP_HTML_OPTTABLE_PAGE:
557         case RID_SW_TP_OPTTABLE_PAGE:
558         {
559             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
560             if ( pFact )
561             {
562                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
563                 if ( fnCreatePage )
564                     pRet = (*fnCreatePage)( pParent, rSet );
565             }
566             SwView* pCurrView = GetView();
567             if(pCurrView)
568             {
569                 // wenn Text dann nicht WebView und umgekehrt
570                 sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
571                 if( (bWebView &&  RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
572                     (!bWebView &&  RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
573                 {
574                     aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
575                     pRet->PageCreated(aSet);
576                 }
577             }
578         }
579         break;
580         case RID_SW_TP_OPTSHDWCRSR:
581         case RID_SW_TP_HTML_OPTSHDWCRSR:
582         case RID_SW_TP_REDLINE_OPT:
583         case RID_SW_TP_OPTLOAD_PAGE:
584         case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
585         case RID_SW_TP_MAILCONFIG:
586         {
587             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
588             if ( pFact )
589             {
590                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
591                 if ( fnCreatePage )
592                     pRet = (*fnCreatePage)( pParent, rSet );
593             }
594             if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR))
595             {
596                 SwView* pCurrView = GetView();
597                 if(pCurrView)
598                 {
599                     aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
600                     pRet->PageCreated(aSet);
601                 }
602             }
603         }
604         break;
605 #ifdef DBG_UTIL
606         case  RID_SW_TP_OPTTEST_PAGE:
607         {
608             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
609             if ( pFact )
610             {
611                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
612                 if ( fnCreatePage )
613                     pRet = (*fnCreatePage)( pParent, rSet );
614             }
615             break;
616         }
617 #endif
618         case  RID_SW_TP_BACKGROUND:
619         {
620             SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
621             if ( pFact )
622             {
623                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
624                 if ( fnCreatePage )
625                     pRet = (*fnCreatePage)( pParent, rSet );
626             }
627             break;
628         }
629         case TP_OPTCAPTION_PAGE:
630         case RID_SW_TP_OPTCAPTION_PAGE:
631         {
632             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
633             if ( pFact )
634             {
635                 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
636                 if ( fnCreatePage )
637                     pRet = (*fnCreatePage)( pParent, rSet );
638             }
639         }
640         break;
641     }
642 
643     DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
644     return pRet;
645 }
646 
647