Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <cmdid.h>
21 :
22 : #include <com/sun/star/i18n/ScriptType.hpp>
23 :
24 : #include <hintids.hxx>
25 : #include <vcl/msgbox.hxx>
26 : #include <svl/eitem.hxx>
27 : #include <sfx2/request.hxx>
28 : #include <sfx2/app.hxx>
29 : #include <sfx2/printer.hxx>
30 : #include <sfx2/htmlmode.hxx>
31 : #include <sfx2/bindings.hxx>
32 : #include <editeng/brushitem.hxx>
33 : #include <editeng/tstpitem.hxx>
34 : #include <svx/optgrid.hxx>
35 : #include <svx/svxdlg.hxx>
36 : #include <svx/dialogs.hrc>
37 : #include <i18nlangtag/mslangid.hxx>
38 : #include <i18nlangtag/languagetag.hxx>
39 : #include <fontcfg.hxx>
40 : #include <optload.hxx>
41 : #include <optcomp.hxx>
42 : #include <edtwin.hxx>
43 : #include <swmodule.hxx>
44 : #include <view.hxx>
45 : #include <doc.hxx>
46 : #include <wrtsh.hxx>
47 : #include <IDocumentDeviceAccess.hxx>
48 : #include <IDocumentSettingAccess.hxx>
49 : #include <uitool.hxx>
50 : #include <initui.hxx>
51 : #include <fldbas.hxx>
52 : #include <wview.hxx>
53 : #include <cfgitems.hxx>
54 : #include <prtopt.hxx>
55 : #include <pview.hxx>
56 : #include <usrpref.hxx>
57 : #include <modcfg.hxx>
58 : #include <glosdoc.hxx>
59 : #include <uiitems.hxx>
60 : #include <editeng/langitem.hxx>
61 : #include <unotools/lingucfg.hxx>
62 : #include <editeng/unolingu.hxx>
63 : #include <globals.hrc>
64 : #include <globals.h>
65 : #include <svl/slstitm.hxx>
66 : #include "swabstdlg.hxx"
67 : #include <swwrtshitem.hxx>
68 :
69 : #include <unomid.h>
70 :
71 : using namespace ::com::sun::star::uno;
72 : using namespace ::com::sun::star::lang;
73 :
74 0 : SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
75 : {
76 0 : bool bTextDialog = (nId == SID_SW_EDITOPTIONS);
77 :
78 : // the options for the Web- and Textdialog are put together here
79 0 : SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
80 0 : SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
81 : // no MakeUsrPref, because only options from textdoks can be used here
82 0 : SwView* pAppView = GetView();
83 0 : if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
84 0 : pAppView = 0;
85 0 : if(pAppView)
86 : {
87 : // if Text then no WebView and vice versa
88 0 : bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
89 0 : if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
90 : {
91 0 : aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
92 : }
93 : else
94 0 : pAppView = 0; // with View, there's nothing to win here
95 : }
96 :
97 : // Options/Edit
98 0 : SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
99 : SID_PRINTPREVIEW, SID_PRINTPREVIEW,
100 : SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
101 : FN_PARAM_PRINTER, FN_PARAM_STDFONTS,
102 : FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
103 : FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
104 : SID_ATTR_METRIC, SID_ATTR_METRIC,
105 : SID_ATTR_APPLYCHARUNIT, SID_ATTR_APPLYCHARUNIT,
106 : SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
107 : RES_BACKGROUND, RES_BACKGROUND,
108 : SID_HTML_MODE, SID_HTML_MODE,
109 : FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
110 : FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
111 : FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
112 : SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
113 : SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
114 : SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
115 : #if OSL_DEBUG_LEVEL > 1
116 : FN_PARAM_SWTEST, FN_PARAM_SWTEST,
117 : #endif
118 0 : 0);
119 :
120 0 : pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
121 0 : pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
122 0 : if( bTextDialog )
123 : {
124 0 : pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
125 0 : pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
126 : }
127 :
128 0 : if( pAppView )
129 : {
130 0 : SwWrtShell& rWrtShell = pAppView->GetWrtShell();
131 :
132 0 : SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
133 0 : if( pPrt )
134 0 : pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
135 0 : pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
136 :
137 : pRet->Put((const SvxLanguageItem&)
138 0 : rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
139 :
140 : pRet->Put((const SvxLanguageItem&)
141 0 : rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
142 :
143 : pRet->Put((const SvxLanguageItem&)
144 0 : rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
145 : }
146 : else
147 : {
148 0 : SvtLinguConfig aLinguCfg;
149 0 : com::sun::star::lang::Locale aLocale;
150 : LanguageType nLang;
151 :
152 : using namespace ::com::sun::star::i18n::ScriptType;
153 :
154 0 : Any aLang = aLinguCfg.GetProperty(OUString("DefaultLocale"));
155 0 : aLang >>= aLocale;
156 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), LATIN);
157 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
158 :
159 0 : aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CJK"));
160 0 : aLang >>= aLocale;
161 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), ASIAN);
162 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
163 :
164 0 : aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CTL"));
165 0 : aLang >>= aLocale;
166 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), COMPLEX);
167 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
168 : }
169 0 : if(bTextDialog)
170 0 : pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
171 0 : if( PTR_CAST( SwPagePreview, SfxViewShell::Current())!=0)
172 : {
173 0 : SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, true));
174 0 : pRet->Put(aBool);
175 : }
176 :
177 0 : FieldUnit eUnit = pPref->GetHScrollMetric();
178 0 : if(pAppView)
179 0 : pAppView->GetHRulerMetric(eUnit);
180 0 : pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
181 :
182 0 : eUnit = pPref->GetVScrollMetric();
183 0 : if(pAppView)
184 0 : pAppView->GetVRulerMetric(eUnit);
185 0 : pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
186 0 : pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
187 0 : pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
188 0 : if(bTextDialog)
189 : {
190 0 : if(pAppView)
191 : {
192 : const SvxTabStopItem& rDefTabs =
193 0 : (const SvxTabStopItem&)pAppView->GetWrtShell().
194 0 : GetDefault(RES_PARATR_TABSTOP);
195 0 : pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)::GetTabDist(rDefTabs)));
196 : }
197 : else
198 0 : pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
199 : }
200 :
201 : // Options for GridTabPage
202 0 : SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
203 :
204 0 : aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
205 0 : aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
206 0 : aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
207 :
208 0 : const Size& rSnapSize = aViewOpt.GetSnapSize();
209 0 : aGridItem.SetFldDrawX( (sal_uInt16) (rSnapSize.Width() ));
210 0 : aGridItem.SetFldDrawY( (sal_uInt16) (rSnapSize.Height()));
211 :
212 0 : aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
213 0 : aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
214 :
215 0 : pRet->Put(aGridItem);
216 :
217 : // Options for PrintTabPage
218 : const SwPrintData* pOpt = pAppView ?
219 0 : &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
220 0 : 0;
221 :
222 0 : if(!pOpt)
223 0 : pOpt = GetPrtOptions(!bTextDialog);
224 :
225 0 : SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
226 0 : pRet->Put(aAddPrinterItem);
227 :
228 : // Options for Web background
229 0 : if(!bTextDialog)
230 : {
231 0 : pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
232 : }
233 :
234 0 : if(!bTextDialog)
235 0 : pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
236 0 : return pRet;
237 : }
238 :
239 0 : void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
240 : {
241 0 : bool bTextDialog = nId == SID_SW_EDITOPTIONS;
242 0 : SwView* pAppView = GetView();
243 0 : if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
244 0 : pAppView = 0;
245 0 : if(pAppView)
246 : {
247 : // the text dialog mustn't apply data to the web view and vice versa
248 0 : bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
249 0 : if(bWebView == bTextDialog)
250 0 : pAppView = 0;
251 : }
252 :
253 0 : SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
254 0 : SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
255 :
256 : const SfxPoolItem* pItem;
257 0 : SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
258 0 : : NULL;
259 :
260 : // Interpret the page Documentview
261 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_DOCDISP, false, &pItem ))
262 : {
263 0 : const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
264 :
265 0 : if(!aViewOpt.IsViewMetaChars())
266 : {
267 0 : if( (!aViewOpt.IsTab( true ) && pDocDispItem->bTab) ||
268 0 : (!aViewOpt.IsBlank( true ) && pDocDispItem->bSpace) ||
269 0 : (!aViewOpt.IsParagraph( true ) && pDocDispItem->bParagraphEnd) ||
270 0 : (!aViewOpt.IsLineBreak( true ) && pDocDispItem->bManualBreak) )
271 : {
272 0 : aViewOpt.SetViewMetaChars(true);
273 0 : if(pBindings)
274 0 : pBindings->Invalidate(FN_VIEW_META_CHARS);
275 : }
276 :
277 : }
278 0 : pDocDispItem->FillViewOptions( aViewOpt );
279 0 : if(pBindings)
280 : {
281 0 : pBindings->Invalidate(FN_VIEW_GRAPHIC);
282 0 : pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
283 : }
284 : }
285 :
286 : // Elements - interpret Item
287 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ELEM, false, &pItem ) )
288 : {
289 0 : const SwElemItem* pElemItem = (const SwElemItem*)pItem;
290 0 : pElemItem->FillViewOptions( aViewOpt );
291 :
292 : }
293 :
294 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_METRIC, false, &pItem ) )
295 : {
296 0 : SfxGetpApp()->SetOptions(rSet);
297 0 : PutItem(*pItem);
298 0 : const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
299 0 : ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
300 : }
301 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
302 0 : false, &pItem ) )
303 : {
304 0 : SfxGetpApp()->SetOptions(rSet);
305 0 : const SfxBoolItem* pCharItem = (const SfxBoolItem*)pItem;
306 0 : ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
307 : }
308 :
309 0 : if( SfxItemState::SET == rSet.GetItemState(FN_HSCROLL_METRIC, false, &pItem ) )
310 : {
311 0 : const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
312 0 : FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
313 0 : pPref->SetHScrollMetric(eUnit);
314 0 : if(pAppView)
315 0 : pAppView->ChangeTabMetric(eUnit);
316 : }
317 :
318 0 : if( SfxItemState::SET == rSet.GetItemState(FN_VSCROLL_METRIC, false, &pItem ) )
319 : {
320 0 : const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
321 0 : FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
322 0 : pPref->SetVScrollMetric(eUnit);
323 0 : if(pAppView)
324 0 : pAppView->ChangeVRulerMetric(eUnit);
325 : }
326 :
327 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem ) )
328 : {
329 0 : sal_uInt16 nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
330 0 : pPref->SetDefTab(nTabDist);
331 0 : if(pAppView)
332 : {
333 0 : SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
334 0 : MakeDefTabs( nTabDist, aDefTabs );
335 0 : pAppView->GetWrtShell().SetDefault( aDefTabs );
336 : }
337 : }
338 :
339 : // Background only in WebDialog
340 0 : if(SfxItemState::SET == rSet.GetItemState(RES_BACKGROUND))
341 : {
342 : const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
343 0 : RES_BACKGROUND);
344 0 : aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
345 : }
346 :
347 : // Interpret page Grid Settings
348 0 : if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, false, &pItem ))
349 : {
350 0 : const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
351 :
352 0 : aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
353 0 : aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
354 0 : if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
355 0 : aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
356 0 : Size aSize = Size( pGridItem->GetFldDrawX() ,
357 0 : pGridItem->GetFldDrawY() );
358 0 : if( aViewOpt.GetSnapSize() != aSize )
359 0 : aViewOpt.SetSnapSize( aSize );
360 0 : short nDiv = (short)pGridItem->GetFldDivisionX() ;
361 0 : if( aViewOpt.GetDivisionX() != nDiv )
362 0 : aViewOpt.SetDivisionX( nDiv );
363 0 : nDiv = (short)pGridItem->GetFldDivisionY();
364 0 : if( aViewOpt.GetDivisionY() != nDiv )
365 0 : aViewOpt.SetDivisionY( nDiv );
366 :
367 0 : if(pBindings)
368 : {
369 0 : pBindings->Invalidate(SID_GRID_VISIBLE);
370 0 : pBindings->Invalidate(SID_GRID_USE);
371 : }
372 : }
373 :
374 : // Interpret Writer Printer Options
375 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, false, &pItem ))
376 : {
377 0 : SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
378 0 : if (pOpt)
379 : {
380 0 : const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
381 0 : *pOpt = *pAddPrinterAttr;
382 :
383 0 : if(pAppView)
384 0 : pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
385 : }
386 :
387 : }
388 :
389 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
390 : {
391 0 : ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
392 0 : if(pBindings)
393 0 : pBindings->Invalidate(FN_SHADOWCURSOR);
394 : }
395 :
396 0 : if( pAppView )
397 : {
398 0 : SwWrtShell &rWrtSh = pAppView->GetWrtShell();
399 0 : const bool bAlignFormulas = rWrtSh.GetDoc()->getIDocumentSettingAccess().get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
400 0 : pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
401 :
402 : // don't align formulas in documents that are currently loading
403 0 : if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
404 0 : rWrtSh.AlignAllFormulasToBaseline();
405 : }
406 :
407 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, false, &pItem ))
408 : {
409 0 : aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
410 : }
411 :
412 : // set elements for the current view and shell
413 0 : ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
414 0 : }
415 :
416 0 : SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
417 : {
418 0 : SfxTabPage* pRet = NULL;
419 0 : SfxAllItemSet aSet(*(rSet.GetPool()));
420 0 : switch( nId )
421 : {
422 : case RID_SW_TP_CONTENT_OPT:
423 : case RID_SW_TP_HTML_CONTENT_OPT:
424 : {
425 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
426 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
427 0 : pRet = (*fnCreatePage)( pParent, &rSet );
428 0 : break;
429 : }
430 : case RID_SW_TP_HTML_OPTGRID_PAGE:
431 : case RID_SVXPAGE_GRID:
432 0 : pRet = SvxGridTabPage::Create(pParent, rSet);
433 0 : break;
434 :
435 : case RID_SW_TP_STD_FONT:
436 : case RID_SW_TP_STD_FONT_CJK:
437 : case RID_SW_TP_STD_FONT_CTL:
438 : {
439 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
440 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
441 0 : pRet = (*fnCreatePage)( pParent, &rSet );
442 0 : if(RID_SW_TP_STD_FONT != nId)
443 : {
444 0 : aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
445 0 : pRet->PageCreated(aSet);
446 : }
447 : }
448 0 : break;
449 : case RID_SW_TP_HTML_OPTPRINT_PAGE:
450 : case RID_SW_TP_OPTPRINT_PAGE:
451 : {
452 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
453 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
454 0 : pRet = (*fnCreatePage)( pParent, &rSet );
455 0 : aSet.Put (SfxBoolItem(SID_FAX_LIST, true));
456 0 : pRet->PageCreated(aSet);
457 : }
458 0 : break;
459 : case RID_SW_TP_HTML_OPTTABLE_PAGE:
460 : case RID_SW_TP_OPTTABLE_PAGE:
461 : {
462 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
463 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
464 0 : pRet = (*fnCreatePage)( pParent, &rSet );
465 0 : SwView* pCurrView = GetView();
466 0 : if(pCurrView)
467 : {
468 : // if text then not WebView and vice versa
469 0 : bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
470 0 : if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
471 0 : (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
472 : {
473 0 : aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
474 0 : pRet->PageCreated(aSet);
475 : }
476 : }
477 : }
478 0 : break;
479 : case RID_SW_TP_OPTSHDWCRSR:
480 : case RID_SW_TP_HTML_OPTSHDWCRSR:
481 : case RID_SW_TP_REDLINE_OPT:
482 : case RID_SW_TP_COMPARISON_OPT:
483 : case RID_SW_TP_OPTLOAD_PAGE:
484 : case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
485 : case RID_SW_TP_MAILCONFIG:
486 : {
487 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
488 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
489 0 : pRet = (*fnCreatePage)( pParent, &rSet );
490 0 : if (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR)
491 : {
492 0 : SwView* pCurrView = GetView();
493 0 : if(pCurrView)
494 : {
495 0 : aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
496 0 : pRet->PageCreated(aSet);
497 : }
498 : }
499 : }
500 0 : break;
501 : case RID_SW_TP_OPTTEST_PAGE:
502 : {
503 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
504 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
505 0 : pRet = (*fnCreatePage)( pParent, &rSet );
506 0 : break;
507 : }
508 : case RID_SW_TP_BACKGROUND:
509 : {
510 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
511 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
512 0 : pRet = (*fnCreatePage)( pParent, &rSet );
513 0 : break;
514 : }
515 : case RID_SW_TP_OPTCAPTION_PAGE:
516 : {
517 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
518 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
519 0 : pRet = (*fnCreatePage)( pParent, &rSet );
520 : }
521 0 : break;
522 : }
523 :
524 0 : if(!pRet)
525 : SAL_WARN( "sw", "SwModule::CreateTabPage(): Unknown tabpage id " << nId );
526 0 : return pRet;
527 270 : }
528 :
529 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|