merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / app / appopt.cxx
blob1f178d4915fd97424c5111296d2d8e28f4f1f686
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appopt.cxx,v $
10 * $Revision: 1.36 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <hintids.hxx>
34 #ifndef _CMDID_H
35 #include <cmdid.h> // Funktion-Ids
36 #endif
38 #include <com/sun/star/i18n/ScriptType.hpp>
40 #define _SVSTDARR_STRINGSDTOR
41 #include <svtools/svstdarr.hxx>
43 #ifndef _MSGBOX_HXX //autogen
44 #include <vcl/msgbox.hxx>
45 #endif
46 #include <svtools/eitem.hxx>
47 #include <sfx2/request.hxx>
48 #include <sfx2/app.hxx>
49 #include <sfx2/printer.hxx>
50 #include <svx/htmlmode.hxx>
51 #include <sfx2/bindings.hxx>
52 #include <svx/brshitem.hxx>
53 #ifndef _SVX_TSTPITEM_HXX //autogen
54 #include <svx/tstpitem.hxx>
55 #endif
56 #include <svx/optgrid.hxx>
57 #include <svx/svxdlg.hxx>
58 #include <svx/dialogs.hrc>
59 #include <i18npool/mslangid.hxx>
60 #include <fontcfg.hxx>
61 #include <optload.hxx>
62 #include <optcomp.hxx>
63 #include <edtwin.hxx>
64 #include <swmodule.hxx>
65 #ifndef _VIEW_HXX
66 #include <view.hxx>
67 #endif
68 #include <wrtsh.hxx>
69 #ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
70 #include <IDocumentDeviceAccess.hxx>
71 #endif
72 #include <uitool.hxx>
73 #include <initui.hxx> // fuer ::GetGlossaries()
74 #include <fldbas.hxx> //fuer UpdateFields
75 #ifndef _WVIEW_HXX
76 #include <wview.hxx>
77 #endif
78 #include <cfgitems.hxx>
79 #include <prtopt.hxx>
80 #ifndef _PVIEW_HXX
81 #include <pview.hxx>
82 #endif
83 #include <usrpref.hxx>
84 #ifndef _MODCFG_HXX
85 #include <modcfg.hxx>
86 #endif
87 #include <glosdoc.hxx>
88 #include <uiitems.hxx>
89 #include <svx/langitem.hxx>
90 #include <svtools/lingucfg.hxx>
91 #include <svx/unolingu.hxx>
93 #ifndef _GLOBALS_HRC
94 #include <globals.hrc>
95 #endif
96 #include <globals.h> // globale Konstanten z.B.
97 #include <svtools/slstitm.hxx>
98 #include "swabstdlg.hxx"
99 #include <swwrtshitem.hxx>
101 #include <unomid.h>
103 using namespace ::com::sun::star::uno;
104 using namespace ::com::sun::star::lang;
106 /* -----------------12.02.99 12:28-------------------
108 * --------------------------------------------------*/
110 SfxItemSet* SwModule::CreateItemSet( USHORT nId )
112 BOOL bTextDialog = (nId == SID_SW_EDITOPTIONS) ? TRUE : FALSE;
114 // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
115 SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
116 SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
117 //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
118 SwView* pAppView = GetView();
119 if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
120 pAppView = 0;
121 if(pAppView)
123 // wenn Text dann nicht WebView und umgekehrt
124 BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
125 if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
127 aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
129 else
130 pAppView = 0; // mit View kann hier nichts gewonnen werden
133 /********************************************************************/
134 /* */
135 /* Optionen/Bearbeiten */
136 /* */
137 /********************************************************************/
138 SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
139 SID_PRINTPREVIEW, SID_PRINTPREVIEW,
140 SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
141 FN_PARAM_PRINTER, FN_PARAM_STDFONTS,
142 FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
143 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
144 SID_ATTR_METRIC, SID_ATTR_METRIC,
145 SID_ATTR_APPLYCHARUNIT, SID_ATTR_APPLYCHARUNIT,
146 SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
147 RES_BACKGROUND, RES_BACKGROUND,
148 SID_HTML_MODE, SID_HTML_MODE,
149 FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
150 FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
151 FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
152 SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
153 SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
154 SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
155 #ifndef PRODUCT
156 FN_PARAM_SWTEST, FN_PARAM_SWTEST,
157 #endif
160 pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
161 pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
162 if( bTextDialog )
164 pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
165 pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
168 if( pAppView )
170 SwWrtShell& rWrtShell = pAppView->GetWrtShell();
172 SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
173 if( pPrt )
174 pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
175 pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
177 pRet->Put((const SvxLanguageItem&)
178 rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
180 pRet->Put((const SvxLanguageItem&)
181 rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
183 pRet->Put((const SvxLanguageItem&)
184 rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
186 else
188 /* Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
189 * SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
190 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
191 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
192 0 );
194 pPrt = new SfxPrinter(pSet);
195 pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
197 SvtLinguConfig aLinguCfg;
198 Locale aLocale;
199 LanguageType nLang;
201 using namespace ::com::sun::star::i18n::ScriptType;
203 Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
204 aLang >>= aLocale;
205 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
206 pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
208 aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
209 aLang >>= aLocale;
210 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
211 pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
213 aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
214 aLang >>= aLocale;
215 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
216 pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
218 if(bTextDialog)
219 pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
220 if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
222 SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, TRUE));
223 pRet->Put(aBool);
226 FieldUnit eUnit = pPref->GetHScrollMetric();
227 if(pAppView)
228 pAppView->GetHLinealMetric(eUnit);
229 pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< UINT16 >(eUnit)));
231 eUnit = pPref->GetVScrollMetric();
232 if(pAppView)
233 pAppView->GetVLinealMetric(eUnit);
234 pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< UINT16 >(eUnit) ));
235 pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(pPref->GetMetric()) ));
236 pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
237 if(bTextDialog)
239 if(pAppView)
241 const SvxTabStopItem& rDefTabs =
242 (const SvxTabStopItem&)pAppView->GetWrtShell().
243 GetDefault(RES_PARATR_TABSTOP);
244 pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (USHORT)::GetTabDist(rDefTabs)));
246 else
247 pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (UINT16)pPref->GetDefTab()));
250 /*-----------------01.02.97 11.13-------------------
251 Optionen fuer GridTabPage
252 --------------------------------------------------*/
254 SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
256 aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
257 aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
258 aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
260 const Size& rSnapSize = aViewOpt.GetSnapSize();
261 aGridItem.SetFldDrawX( (USHORT) (rSnapSize.Width() ));
262 aGridItem.SetFldDrawY( (USHORT) (rSnapSize.Height()));
264 aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
265 aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
267 pRet->Put(aGridItem);
269 /*-----------------01.02.97 13.02-------------------
270 Optionen fuer PrintTabPage
271 --------------------------------------------------*/
272 SwPrintData* pOpt = pAppView ?
273 pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
276 if(!pOpt)
277 pOpt = GetPrtOptions(!bTextDialog);
279 SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
280 pRet->Put(aAddPrinterItem);
282 /*-----------------01.02.97 13.12-------------------
283 Optionen fuer Web-Hintergrund
284 --------------------------------------------------*/
285 if(!bTextDialog)
287 pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
290 #ifndef PRODUCT
291 /*-----------------01.02.97 13.02-------------------
292 Test-Optionen
293 --------------------------------------------------*/
294 SwTestItem aTestItem(FN_PARAM_SWTEST);
295 aTestItem.bTest1 = aViewOpt.IsTest1();
296 aTestItem.bTest2 = aViewOpt.IsTest2();
297 aTestItem.bTest3 = aViewOpt.IsTest3();
298 aTestItem.bTest4 = aViewOpt.IsTest4();
299 aTestItem.bTest5 = aViewOpt.IsTest5();
300 aTestItem.bTest6 = aViewOpt.IsTest6();
301 aTestItem.bTest7 = aViewOpt.IsTest7();
302 aTestItem.bTest8 = aViewOpt.IsTest8();
303 aTestItem.bTest9 = SwViewOption::IsTest9();
304 aTestItem.bTest10 = aViewOpt.IsTest10();
305 pRet->Put(aTestItem);
306 #endif
307 /*-----------------01.02.97 13.04-------------------
309 --------------------------------------------------*/
310 if(!bTextDialog)
311 pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
312 // delete pPrt;
313 return pRet;
315 /* -----------------12.02.99 12:28-------------------
317 * --------------------------------------------------*/
318 void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet )
320 BOOL bTextDialog = nId == SID_SW_EDITOPTIONS;
321 SwView* pAppView = GetView();
322 if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
323 pAppView = 0;
324 if(pAppView)
326 // the text dialog mustn't apply data to the web view and vice versa
327 BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
328 if( (bWebView == bTextDialog))
329 pAppView = 0; //
332 SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
333 SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
335 const SfxPoolItem* pItem;
336 SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
337 : NULL;
339 /*---------------------------------------------------------------------
340 Seite Dokumentansicht auswerten
341 -----------------------------------------------------------------------*/
342 if( SFX_ITEM_SET == rSet.GetItemState(
343 FN_PARAM_DOCDISP, FALSE, &pItem ))
345 const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
347 if(!aViewOpt.IsViewMetaChars())
349 if( (!aViewOpt.IsTab( TRUE ) && pDocDispItem->bTab) ||
350 (!aViewOpt.IsBlank( TRUE ) && pDocDispItem->bSpace) ||
351 (!aViewOpt.IsParagraph( TRUE ) && pDocDispItem->bParagraphEnd) ||
352 (!aViewOpt.IsLineBreak( TRUE ) && pDocDispItem->bManualBreak) )
354 aViewOpt.SetViewMetaChars(TRUE);
355 if(pBindings)
356 pBindings->Invalidate(FN_VIEW_META_CHARS);
360 pDocDispItem->FillViewOptions( aViewOpt );
361 if(pBindings)
363 pBindings->Invalidate(FN_VIEW_GRAPHIC);
364 pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
368 /*---------------------------------------------------------------------
369 Elemente - Item auswerten
370 -----------------------------------------------------------------------*/
372 if( SFX_ITEM_SET == rSet.GetItemState(
373 FN_PARAM_ELEM, FALSE, &pItem ) )
375 const SwElemItem* pElemItem = (const SwElemItem*)pItem;
376 pElemItem->FillViewOptions( aViewOpt );
380 if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC,
381 FALSE, &pItem ) )
383 SFX_APP()->SetOptions(rSet);
384 const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
385 ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
388 if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
389 FALSE, &pItem ) )
391 SFX_APP()->SetOptions(rSet);
392 const SfxBoolItem* pCharItem = (const SfxBoolItem*)pItem;
393 ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
396 if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC,
397 FALSE, &pItem ) )
399 const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
400 FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
401 pPref->SetHScrollMetric(eUnit);
402 if(pAppView)
403 pAppView->ChangeTabMetric(eUnit);
406 if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC,
407 FALSE, &pItem ) )
409 const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
410 FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
411 pPref->SetVScrollMetric(eUnit);
412 if(pAppView)
413 pAppView->ChangeVLinealMetric(eUnit);
416 if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP,
417 FALSE, &pItem ) )
419 USHORT nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
420 pPref->SetDefTab(nTabDist);
421 if(pAppView)
423 SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
424 MakeDefTabs( nTabDist, aDefTabs );
425 pAppView->GetWrtShell().SetDefault( aDefTabs );
430 /*-----------------01.02.97 11.36-------------------
431 Hintergrund nur im WebDialog
432 --------------------------------------------------*/
433 if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
435 const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
436 RES_BACKGROUND);
437 aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
440 /*--------------------------------------------------------------------
441 Seite Rastereinstellungen auswerten
442 ----------------------------------------------------------------------*/
444 if( SFX_ITEM_SET == rSet.GetItemState(
445 SID_ATTR_GRID_OPTIONS, FALSE, &pItem ))
447 const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
449 aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
450 aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
451 if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
452 aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
453 Size aSize = Size( pGridItem->GetFldDrawX() ,
454 pGridItem->GetFldDrawY() );
455 if( aViewOpt.GetSnapSize() != aSize )
456 aViewOpt.SetSnapSize( aSize );
457 short nDiv = (short)pGridItem->GetFldDivisionX() ;
458 if( aViewOpt.GetDivisionX() != nDiv )
459 aViewOpt.SetDivisionX( nDiv );
460 nDiv = (short)pGridItem->GetFldDivisionY();
461 if( aViewOpt.GetDivisionY() != nDiv )
462 aViewOpt.SetDivisionY( nDiv );
464 if(pBindings)
466 pBindings->Invalidate(SID_GRID_VISIBLE);
467 pBindings->Invalidate(SID_GRID_USE);
471 //--------------------------------------------------------------------------
472 // Writer Drucker Zusatzeinstellungen auswerten
473 //----------------------------------------------------------------------------
475 if( SFX_ITEM_SET == rSet.GetItemState(
476 FN_PARAM_ADDPRINTER, FALSE, &pItem ))
478 SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
479 if (pOpt)
481 const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
482 *pOpt = *pAddPrinterAttr;
484 if(pAppView)
485 pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
490 if( SFX_ITEM_SET == rSet.GetItemState(
491 FN_PARAM_SHADOWCURSOR, FALSE, &pItem ))
493 ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
494 if(pBindings)
495 pBindings->Invalidate(FN_SHADOWCURSOR);
498 if( SFX_ITEM_SET == rSet.GetItemState(
499 FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem ))
501 aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
505 #ifndef PRODUCT
506 /*--------------------------------------------------------------------------
507 Writer Testseite auswerten
508 ----------------------------------------------------------------------------*/
510 if( SFX_ITEM_SET == rSet.GetItemState(
511 FN_PARAM_SWTEST, FALSE, &pItem ))
513 const SwTestItem* pTestItem = (const SwTestItem*)pItem;
514 aViewOpt.SetTest1((BOOL)pTestItem->bTest1);
515 aViewOpt.SetTest2((BOOL)pTestItem->bTest2);
516 aViewOpt.SetTest3((BOOL)pTestItem->bTest3);
517 aViewOpt.SetTest4((BOOL)pTestItem->bTest4);
518 aViewOpt.SetTest5((BOOL)pTestItem->bTest5);
519 aViewOpt.SetTest6((BOOL)pTestItem->bTest6);
520 aViewOpt.SetTest7((BOOL)pTestItem->bTest7);
521 aViewOpt.SetTest8((BOOL)pTestItem->bTest8);
522 SwViewOption::SetTest9((BOOL)pTestItem->bTest9);
523 aViewOpt.SetTest10((BOOL)pTestItem->bTest10);
525 #endif
526 // dann an der akt. View und Shell die entsp. Elemente setzen
527 ApplyUsrPref( aViewOpt, pAppView,
528 bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
530 /* -----------------12.02.99 12:28-------------------
532 * --------------------------------------------------*/
533 SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemSet& rSet )
535 SfxTabPage* pRet = NULL;
536 SfxAllItemSet aSet(*(rSet.GetPool()));
537 switch( nId )
539 case RID_SW_TP_CONTENT_OPT:
540 case RID_SW_TP_HTML_CONTENT_OPT:
542 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
543 if ( pFact )
545 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
546 if ( fnCreatePage )
547 pRet = (*fnCreatePage)( pParent, rSet );
549 break;
551 case RID_SW_TP_HTML_OPTGRID_PAGE:
552 case RID_SVXPAGE_GRID:
553 pRet = SvxGridTabPage::Create(pParent, rSet);
554 break;
556 case RID_SW_TP_STD_FONT:
557 case RID_SW_TP_STD_FONT_CJK:
558 case RID_SW_TP_STD_FONT_CTL:
560 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
561 if ( pFact )
563 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
564 if ( fnCreatePage )
565 pRet = (*fnCreatePage)( pParent, rSet );
567 if(RID_SW_TP_STD_FONT != nId)
569 aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
570 pRet->PageCreated(aSet);
573 break;
574 case RID_SW_TP_HTML_OPTPRINT_PAGE:
575 case RID_SW_TP_OPTPRINT_PAGE:
577 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
578 if ( pFact )
580 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
581 if ( fnCreatePage )
582 pRet = (*fnCreatePage)( pParent, rSet );
584 aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
585 pRet->PageCreated(aSet);
587 break;
588 case RID_SW_TP_HTML_OPTTABLE_PAGE:
589 case RID_SW_TP_OPTTABLE_PAGE:
591 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
592 if ( pFact )
594 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
595 if ( fnCreatePage )
596 pRet = (*fnCreatePage)( pParent, rSet );
598 SwView* pCurrView = GetView();
599 if(pCurrView)
601 // wenn Text dann nicht WebView und umgekehrt
602 BOOL bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
603 if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
604 (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
606 aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
607 pRet->PageCreated(aSet);
611 break;
612 case RID_SW_TP_OPTSHDWCRSR:
613 case RID_SW_TP_HTML_OPTSHDWCRSR:
614 case RID_SW_TP_REDLINE_OPT:
615 case RID_SW_TP_OPTLOAD_PAGE:
616 case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
617 case RID_SW_TP_MAILCONFIG:
619 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
620 if ( pFact )
622 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
623 if ( fnCreatePage )
624 pRet = (*fnCreatePage)( pParent, rSet );
627 break;
628 #ifndef PRODUCT
629 case RID_SW_TP_OPTTEST_PAGE:
631 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
632 if ( pFact )
634 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
635 if ( fnCreatePage )
636 pRet = (*fnCreatePage)( pParent, rSet );
638 break;
640 #endif
641 case RID_SW_TP_BACKGROUND:
643 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
644 if ( pFact )
646 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
647 if ( fnCreatePage )
648 pRet = (*fnCreatePage)( pParent, rSet );
650 break;
652 case TP_OPTCAPTION_PAGE:
653 case RID_SW_TP_OPTCAPTION_PAGE:
655 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
656 if ( pFact )
658 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
659 if ( fnCreatePage )
660 pRet = (*fnCreatePage)( pParent, rSet );
663 break;
666 DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
667 return pRet;