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_PARAM_IGNORE_PROTECTED, FN_PARAM_IGNORE_PROTECTED,
112 : FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
113 : SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
114 : SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
115 : SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
116 : #if OSL_DEBUG_LEVEL > 1
117 : FN_PARAM_SWTEST, FN_PARAM_SWTEST,
118 : #endif
119 0 : 0);
120 :
121 0 : pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
122 0 : pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
123 0 : if( bTextDialog )
124 : {
125 0 : pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
126 0 : pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
127 0 : pRet->Put(SfxBoolItem(FN_PARAM_IGNORE_PROTECTED, aViewOpt.IsIgnoreProtectedArea()));
128 : }
129 :
130 0 : if( pAppView )
131 : {
132 0 : SwWrtShell& rWrtShell = pAppView->GetWrtShell();
133 :
134 0 : SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
135 0 : if( pPrt )
136 0 : pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
137 0 : pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
138 :
139 : pRet->Put(static_cast<const SvxLanguageItem&>(
140 0 : rWrtShell.GetDefault(RES_CHRATR_LANGUAGE)), SID_ATTR_LANGUAGE);
141 :
142 : pRet->Put(static_cast<const SvxLanguageItem&>(
143 0 : rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE)), SID_ATTR_CHAR_CJK_LANGUAGE);
144 :
145 : pRet->Put(static_cast<const SvxLanguageItem&>(
146 0 : rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE)), SID_ATTR_CHAR_CTL_LANGUAGE);
147 : }
148 : else
149 : {
150 0 : SvtLinguConfig aLinguCfg;
151 0 : com::sun::star::lang::Locale aLocale;
152 : LanguageType nLang;
153 :
154 : using namespace ::com::sun::star::i18n::ScriptType;
155 :
156 0 : Any aLang = aLinguCfg.GetProperty(OUString("DefaultLocale"));
157 0 : aLang >>= aLocale;
158 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), LATIN);
159 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
160 :
161 0 : aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CJK"));
162 0 : aLang >>= aLocale;
163 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), ASIAN);
164 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
165 :
166 0 : aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CTL"));
167 0 : aLang >>= aLocale;
168 0 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), COMPLEX);
169 0 : pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
170 : }
171 0 : if(bTextDialog)
172 0 : pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
173 0 : if( PTR_CAST( SwPagePreview, SfxViewShell::Current())!=0)
174 : {
175 0 : SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, true));
176 0 : pRet->Put(aBool);
177 : }
178 :
179 0 : FieldUnit eUnit = pPref->GetHScrollMetric();
180 0 : if(pAppView)
181 0 : pAppView->GetHRulerMetric(eUnit);
182 0 : pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
183 :
184 0 : eUnit = pPref->GetVScrollMetric();
185 0 : if(pAppView)
186 0 : pAppView->GetVRulerMetric(eUnit);
187 0 : pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
188 0 : pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
189 0 : pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
190 0 : if(bTextDialog)
191 : {
192 0 : if(pAppView)
193 : {
194 : const SvxTabStopItem& rDefTabs =
195 0 : static_cast<const SvxTabStopItem&>(pAppView->GetWrtShell().
196 0 : GetDefault(RES_PARATR_TABSTOP));
197 0 : pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)::GetTabDist(rDefTabs)));
198 : }
199 : else
200 0 : pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
201 : }
202 :
203 : // Options for GridTabPage
204 0 : SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
205 :
206 0 : aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
207 0 : aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
208 0 : aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
209 :
210 0 : const Size& rSnapSize = aViewOpt.GetSnapSize();
211 0 : aGridItem.SetFieldDrawX( (sal_uInt16) (rSnapSize.Width() ));
212 0 : aGridItem.SetFieldDrawY( (sal_uInt16) (rSnapSize.Height()));
213 :
214 0 : aGridItem.SetFieldDivisionX( aViewOpt.GetDivisionX());
215 0 : aGridItem.SetFieldDivisionY( aViewOpt.GetDivisionY());
216 :
217 0 : pRet->Put(aGridItem);
218 :
219 : // Options for PrintTabPage
220 : const SwPrintData* pOpt = pAppView ?
221 0 : &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
222 0 : 0;
223 :
224 0 : if(!pOpt)
225 0 : pOpt = GetPrtOptions(!bTextDialog);
226 :
227 0 : SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
228 0 : pRet->Put(aAddPrinterItem);
229 :
230 : // Options for Web background
231 0 : if(!bTextDialog)
232 : {
233 0 : pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
234 : }
235 :
236 0 : if(!bTextDialog)
237 0 : pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
238 0 : return pRet;
239 : }
240 :
241 0 : void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
242 : {
243 0 : bool bTextDialog = nId == SID_SW_EDITOPTIONS;
244 0 : SwView* pAppView = GetView();
245 0 : if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
246 0 : pAppView = 0;
247 0 : if(pAppView)
248 : {
249 : // the text dialog mustn't apply data to the web view and vice versa
250 0 : bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
251 0 : if(bWebView == bTextDialog)
252 0 : pAppView = 0;
253 : }
254 :
255 0 : SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
256 0 : SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
257 :
258 : const SfxPoolItem* pItem;
259 0 : SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
260 0 : : NULL;
261 :
262 : // Interpret the page Documentview
263 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_DOCDISP, false, &pItem ))
264 : {
265 0 : const SwDocDisplayItem* pDocDispItem = static_cast<const SwDocDisplayItem*>(pItem);
266 :
267 0 : if(!aViewOpt.IsViewMetaChars())
268 : {
269 0 : if( (!aViewOpt.IsTab( true ) && pDocDispItem->bTab) ||
270 0 : (!aViewOpt.IsBlank( true ) && pDocDispItem->bSpace) ||
271 0 : (!aViewOpt.IsParagraph( true ) && pDocDispItem->bParagraphEnd) ||
272 0 : (!aViewOpt.IsLineBreak( true ) && pDocDispItem->bManualBreak) )
273 : {
274 0 : aViewOpt.SetViewMetaChars(true);
275 0 : if(pBindings)
276 0 : pBindings->Invalidate(FN_VIEW_META_CHARS);
277 : }
278 :
279 : }
280 0 : pDocDispItem->FillViewOptions( aViewOpt );
281 0 : if(pBindings)
282 : {
283 0 : pBindings->Invalidate(FN_VIEW_GRAPHIC);
284 0 : pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
285 : }
286 : }
287 :
288 : // Elements - interpret Item
289 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ELEM, false, &pItem ) )
290 : {
291 0 : const SwElemItem* pElemItem = static_cast<const SwElemItem*>(pItem);
292 0 : pElemItem->FillViewOptions( aViewOpt );
293 :
294 : }
295 :
296 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_METRIC, false, &pItem ) )
297 : {
298 0 : SfxGetpApp()->SetOptions(rSet);
299 0 : PutItem(*pItem);
300 0 : const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem);
301 0 : ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
302 : }
303 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
304 0 : false, &pItem ) )
305 : {
306 0 : SfxGetpApp()->SetOptions(rSet);
307 0 : const SfxBoolItem* pCharItem = static_cast<const SfxBoolItem*>(pItem);
308 0 : ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
309 : }
310 :
311 0 : if( SfxItemState::SET == rSet.GetItemState(FN_HSCROLL_METRIC, false, &pItem ) )
312 : {
313 0 : const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem);
314 0 : FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
315 0 : pPref->SetHScrollMetric(eUnit);
316 0 : if(pAppView)
317 0 : pAppView->ChangeTabMetric(eUnit);
318 : }
319 :
320 0 : if( SfxItemState::SET == rSet.GetItemState(FN_VSCROLL_METRIC, false, &pItem ) )
321 : {
322 0 : const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem);
323 0 : FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
324 0 : pPref->SetVScrollMetric(eUnit);
325 0 : if(pAppView)
326 0 : pAppView->ChangeVRulerMetric(eUnit);
327 : }
328 :
329 0 : if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem ) )
330 : {
331 0 : sal_uInt16 nTabDist = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
332 0 : pPref->SetDefTab(nTabDist);
333 0 : if(pAppView)
334 : {
335 0 : SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
336 0 : MakeDefTabs( nTabDist, aDefTabs );
337 0 : pAppView->GetWrtShell().SetDefault( aDefTabs );
338 : }
339 : }
340 :
341 : // Background only in WebDialog
342 0 : if(SfxItemState::SET == rSet.GetItemState(RES_BACKGROUND))
343 : {
344 : const SvxBrushItem& rBrushItem = static_cast<const SvxBrushItem&>(rSet.Get(
345 0 : RES_BACKGROUND));
346 0 : aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
347 : }
348 :
349 : // Interpret page Grid Settings
350 0 : if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, false, &pItem ))
351 : {
352 0 : const SvxGridItem* pGridItem = static_cast<const SvxGridItem*>(pItem);
353 :
354 0 : aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
355 0 : aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
356 0 : if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
357 0 : aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
358 0 : Size aSize = Size( pGridItem->GetFieldDrawX() ,
359 0 : pGridItem->GetFieldDrawY() );
360 0 : if( aViewOpt.GetSnapSize() != aSize )
361 0 : aViewOpt.SetSnapSize( aSize );
362 0 : short nDiv = (short)pGridItem->GetFieldDivisionX() ;
363 0 : if( aViewOpt.GetDivisionX() != nDiv )
364 0 : aViewOpt.SetDivisionX( nDiv );
365 0 : nDiv = (short)pGridItem->GetFieldDivisionY();
366 0 : if( aViewOpt.GetDivisionY() != nDiv )
367 0 : aViewOpt.SetDivisionY( nDiv );
368 :
369 0 : if(pBindings)
370 : {
371 0 : pBindings->Invalidate(SID_GRID_VISIBLE);
372 0 : pBindings->Invalidate(SID_GRID_USE);
373 : }
374 : }
375 :
376 : // Interpret Writer Printer Options
377 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, false, &pItem ))
378 : {
379 0 : SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
380 0 : if (pOpt)
381 : {
382 0 : const SwAddPrinterItem* pAddPrinterAttr = static_cast<const SwAddPrinterItem*>(pItem);
383 0 : *pOpt = *pAddPrinterAttr;
384 :
385 0 : if(pAppView)
386 0 : pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
387 : }
388 :
389 : }
390 :
391 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
392 : {
393 0 : static_cast<const SwShadowCursorItem*>(pItem)->FillViewOptions( aViewOpt );
394 0 : if(pBindings)
395 0 : pBindings->Invalidate(FN_SHADOWCURSOR);
396 : }
397 :
398 0 : if( pAppView )
399 : {
400 0 : SwWrtShell &rWrtSh = pAppView->GetWrtShell();
401 0 : const bool bAlignFormulas = rWrtSh.GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
402 0 : pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
403 :
404 : // don't align formulas in documents that are currently loading
405 0 : if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
406 0 : rWrtSh.AlignAllFormulasToBaseline();
407 : }
408 :
409 0 : if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, false, &pItem ))
410 : {
411 0 : aViewOpt.SetCursorInProtectedArea(static_cast<const SfxBoolItem*>(pItem)->GetValue());
412 : }
413 :
414 0 : if (rSet.GetItemState(FN_PARAM_IGNORE_PROTECTED, false, &pItem) == SfxItemState::SET)
415 0 : aViewOpt.SetIgnoreProtectedArea(static_cast<const SfxBoolItem*>(pItem)->GetValue());
416 :
417 : // set elements for the current view and shell
418 0 : ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
419 0 : }
420 :
421 0 : VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
422 : {
423 0 : VclPtr<SfxTabPage> pRet;
424 0 : SfxAllItemSet aSet(*(rSet.GetPool()));
425 0 : switch( nId )
426 : {
427 : case RID_SW_TP_CONTENT_OPT:
428 : case RID_SW_TP_HTML_CONTENT_OPT:
429 : {
430 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
431 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
432 0 : pRet = (*fnCreatePage)( pParent, &rSet );
433 0 : break;
434 : }
435 : case RID_SW_TP_HTML_OPTGRID_PAGE:
436 : case RID_SVXPAGE_GRID:
437 0 : pRet = SvxGridTabPage::Create(pParent, rSet);
438 0 : break;
439 :
440 : case RID_SW_TP_STD_FONT:
441 : case RID_SW_TP_STD_FONT_CJK:
442 : case RID_SW_TP_STD_FONT_CTL:
443 : {
444 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
445 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
446 0 : pRet = (*fnCreatePage)( pParent, &rSet );
447 0 : if(RID_SW_TP_STD_FONT != nId)
448 : {
449 0 : aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
450 0 : pRet->PageCreated(aSet);
451 : }
452 : }
453 0 : break;
454 : case RID_SW_TP_HTML_OPTPRINT_PAGE:
455 : case RID_SW_TP_OPTPRINT_PAGE:
456 : {
457 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
458 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
459 0 : pRet = (*fnCreatePage)( pParent, &rSet );
460 0 : aSet.Put (SfxBoolItem(SID_FAX_LIST, true));
461 0 : pRet->PageCreated(aSet);
462 : }
463 0 : break;
464 : case RID_SW_TP_HTML_OPTTABLE_PAGE:
465 : case RID_SW_TP_OPTTABLE_PAGE:
466 : {
467 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
468 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
469 0 : pRet = (*fnCreatePage)( pParent, &rSet );
470 0 : SwView* pCurrView = GetView();
471 0 : if(pCurrView)
472 : {
473 : // if text then not WebView and vice versa
474 0 : bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
475 0 : if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
476 0 : (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
477 : {
478 0 : aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
479 0 : pRet->PageCreated(aSet);
480 : }
481 : }
482 : }
483 0 : break;
484 : case RID_SW_TP_OPTSHDWCRSR:
485 : case RID_SW_TP_HTML_OPTSHDWCRSR:
486 : case RID_SW_TP_REDLINE_OPT:
487 : case RID_SW_TP_COMPARISON_OPT:
488 : case RID_SW_TP_OPTLOAD_PAGE:
489 : case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
490 : case RID_SW_TP_MAILCONFIG:
491 : {
492 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
493 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
494 0 : pRet = (*fnCreatePage)( pParent, &rSet );
495 0 : if (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR)
496 : {
497 0 : SwView* pCurrView = GetView();
498 0 : if(pCurrView)
499 : {
500 0 : aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
501 0 : pRet->PageCreated(aSet);
502 : }
503 : }
504 : }
505 0 : break;
506 : case RID_SW_TP_OPTTEST_PAGE:
507 : {
508 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
509 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
510 0 : pRet = (*fnCreatePage)( pParent, &rSet );
511 0 : break;
512 : }
513 : case RID_SW_TP_BACKGROUND:
514 : {
515 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
516 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
517 0 : pRet = (*fnCreatePage)( pParent, &rSet );
518 0 : break;
519 : }
520 : case RID_SW_TP_OPTCAPTION_PAGE:
521 : {
522 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
523 0 : ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
524 0 : pRet = (*fnCreatePage)( pParent, &rSet );
525 : }
526 0 : break;
527 : }
528 :
529 0 : if(!pRet)
530 : SAL_WARN( "sw", "SwModule::CreateTabPage(): Unknown tabpage id " << nId );
531 0 : return pRet;
532 177 : }
533 :
534 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|