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