android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / ui / fmtui / tmpdlg.cxx
blob497a8d40e10a4569ba4fe4c8f23369f412e3f8a5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <hintids.hxx>
22 #include <sfx2/viewfrm.hxx>
23 #include <svx/hdft.hxx>
24 #include <editeng/flstitem.hxx>
25 #include <osl/diagnose.h>
26 #include <sfx2/htmlmode.hxx>
27 #include <sfx2/sfxdlg.hxx>
28 #include <svtools/htmlcfg.hxx>
29 #include <svl/cjkoptions.hxx>
30 #include <vcl/svapp.hxx>
31 #include <numpara.hxx>
32 #include <swmodule.hxx>
33 #include <wrtsh.hxx>
34 #include <view.hxx>
35 #include <wdocsh.hxx>
36 #include <viewopt.hxx>
37 #include <pgfnote.hxx>
38 #include <pggrid.hxx>
39 #include <tmpdlg.hxx>
40 #include <column.hxx>
41 #include <drpcps.hxx>
42 #include <frmpage.hxx>
43 #include <wrap.hxx>
44 #include <swuiccoll.hxx>
45 #include <docstyle.hxx>
46 #include <fmtcol.hxx>
47 #include <macassgn.hxx>
48 #include <poolfmt.hxx>
49 #include <uitool.hxx>
50 #include <shellres.hxx>
51 #include <strings.hrc>
53 #include <cmdid.h>
54 #include <SwStyleNameMapper.hxx>
55 #include <svl/stritem.hxx>
56 #include <svl/slstitm.hxx>
57 #include <svl/eitem.hxx>
58 #include <svl/intitem.hxx>
59 #include <svx/dialogs.hrc>
60 #include <svx/flagsdef.hxx>
62 // the dialog's carrier
63 SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
64 SfxStyleSheetBase& rBase,
65 SfxStyleFamily nRegion,
66 const OUString& sPage,
67 SwWrtShell* pActShell,
68 bool bNew)
69 : SfxStyleDialogController(pParent,
70 "modules/swriter/ui/templatedialog" +
71 OUString::number(static_cast<sal_uInt16>(nRegion)) + ".ui",
72 "TemplateDialog" + OUString::number(static_cast<sal_uInt16>(nRegion)),
73 rBase)
74 , m_nType(nRegion)
75 , m_pWrtShell(pActShell)
76 , m_bNewStyle(bNew)
78 m_nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell());
79 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
81 GetStandardButton()->set_label(SwResId(STR_STANDARD_LABEL));
82 GetStandardButton()->set_tooltip_text(SwResId(STR_STANDARD_TOOLTIP));
83 GetStandardButton()->set_accessible_description(SwResId(STR_STANDARD_EXTENDEDTIP));
85 GetApplyButton()->set_label(SwResId(STR_APPLY_LABEL));
86 GetApplyButton()->set_tooltip_text(SwResId(STR_APPLY_TOOLTIP));
87 GetApplyButton()->set_accessible_description(SwResId(STR_APPLY_EXTENDEDTIP));
89 GetResetButton()->set_label(SwResId(STR_RESET_LABEL));
90 GetResetButton()->set_tooltip_text(SwResId(STR_RESET_TOOLTIP));
91 GetResetButton()->set_accessible_description(SwResId(STR_RESET_EXTENDEDTIP));
93 // stitch TabPages together
94 switch( nRegion )
96 // character styles
97 case SfxStyleFamily::Char:
99 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
100 AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
101 AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ));
102 AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ));
103 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
104 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
105 if(m_nHtmlMode & HTMLMODE_ON || !SvtCJKOptions::IsDoubleLinesEnabled())
106 RemoveTabPage("asianlayout");
108 break;
109 // paragraph styles
110 case SfxStyleFamily::Para:
112 AddTabPage("indents", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH));
114 AddTabPage("alignment", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH));
116 AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
118 AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
120 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
122 AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
124 AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
126 AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
128 AddTabPage("highlighting", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
130 AddTabPage("tabs", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
132 AddTabPage("outline", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges);
133 AddTabPage("dropcaps", SwDropCapsPage::Create, SwDropCapsPage::GetRanges );
135 // add Area and Transparence TabPages
136 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
137 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
139 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
141 AddTabPage("condition", SwCondCollPage::Create,
142 SwCondCollPage::GetRanges );
143 if( (!m_bNewStyle && RES_CONDTXTFMTCOLL != static_cast<SwDocStyleSheet&>(rBase).GetCollection()->Which())
144 || m_nHtmlMode & HTMLMODE_ON )
145 RemoveTabPage("condition");
147 if(m_nHtmlMode & HTMLMODE_ON)
149 if (!SvxHtmlOptions::IsPrintLayoutExtension())
150 RemoveTabPage("textflow");
151 RemoveTabPage("asiantypo");
152 RemoveTabPage("tabs");
153 RemoveTabPage("outline");
154 RemoveTabPage("asianlayout");
155 if(!(m_nHtmlMode & HTMLMODE_FULL_STYLES))
157 RemoveTabPage("background");
158 RemoveTabPage("dropcaps");
161 else
163 if(!SvtCJKOptions::IsAsianTypographyEnabled())
164 RemoveTabPage("asiantypo");
165 if(!SvtCJKOptions::IsDoubleLinesEnabled())
166 RemoveTabPage("asianlayout");
169 break;
170 // page styles
171 case SfxStyleFamily::Page:
173 // add Area and Transparence TabPages
174 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
175 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
176 AddTabPage("header", SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
177 AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
178 AddTabPage("page", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PAGE));
179 if (0 == ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell()))
181 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
182 AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
183 AddTabPage("footnotes", SwFootNotePage::Create, SwFootNotePage::GetRanges );
184 AddTabPage("textgrid", SwTextGridPage::Create, SwTextGridPage::GetRanges );
185 if(!SvtCJKOptions::IsAsianTypographyEnabled())
186 RemoveTabPage("textgrid");
188 else
190 RemoveTabPage("borders");
191 RemoveTabPage("columns");
192 RemoveTabPage("footnotes");
193 RemoveTabPage("textgrid");
196 break;
197 // numbering styles
198 case SfxStyleFamily::Pseudo:
200 AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
201 AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
202 AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
203 AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
204 AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
205 AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
207 break;
208 case SfxStyleFamily::Frame:
210 AddTabPage("type", SwFramePage::Create, SwFramePage::GetRanges);
211 AddTabPage("options", SwFrameAddPage::Create, SwFrameAddPage::GetRanges);
212 AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges);
214 // add Area and Transparence TabPages
215 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
216 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
218 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
220 AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
222 AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
224 break;
225 default:
226 OSL_ENSURE(false, "wrong family");
229 if (bNew)
230 SetCurPageId("organizer");
231 else if (!sPage.isEmpty())
232 SetCurPageId(sPage);
235 short SwTemplateDlgController::Ok()
237 short nRet = SfxTabDialogController::Ok();
238 if( RET_OK == nRet )
240 const SfxPoolItem *pOutItem, *pExItem;
241 if( SfxItemState::SET == m_xExampleSet->GetItemState(
242 SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
243 ( !GetOutputItemSet() ||
244 SfxItemState::SET != GetOutputItemSet()->GetItemState(
245 SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
246 *pExItem != *pOutItem ))
248 if( GetOutputItemSet() )
249 const_cast<SfxItemSet*>(GetOutputItemSet())->Put( *pExItem );
250 else
251 nRet = RET_CANCEL;
254 else
256 //JP 09.01.98 Bug #46446#:
257 // that's the Ok-Handler, so OK has to be default!
258 nRet = RET_OK;
260 return nRet;
263 void SwTemplateDlgController::RefreshInputSet()
265 SfxItemSet* pInSet = GetInputSetImpl();
266 pInSet->ClearItem();
267 pInSet->SetParent( &GetStyleSheet().GetItemSet() );
270 void SwTemplateDlgController::PageCreated(const OUString& rId, SfxTabPage &rPage )
272 // set style's and metric's names
273 OUString sNumCharFormat, sBulletCharFormat;
274 SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat);
275 SwStyleNameMapper::FillUIName( RES_POOLCHR_BULLET_LEVEL, sBulletCharFormat);
276 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
278 if (rId == "font")
280 if (SwView* pView = GetActiveView())
282 SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>(pView->
283 GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
285 aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
286 sal_uInt32 nFlags = 0;
287 if(rPage.GetItemSet().GetParent() && 0 == (m_nHtmlMode & HTMLMODE_ON ))
288 nFlags = SVX_RELATIVE_MODE;
289 if( SfxStyleFamily::Char == m_nType )
290 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
291 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
292 rPage.PageCreated(aSet);
295 else if (rId == "fonteffect")
297 sal_uInt32 nFlags = SVX_ENABLE_CHAR_TRANSPARENCY;
298 if( SfxStyleFamily::Char == m_nType )
299 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
300 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
301 rPage.PageCreated(aSet);
303 else if (rId == "position")
305 if( SfxStyleFamily::Char == m_nType )
307 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
308 rPage.PageCreated(aSet);
310 else if (SfxStyleFamily::Pseudo == m_nType)
312 if (SwWrtShell* pSh = ::GetActiveWrtShell())
314 SwDocShell* pDocShell = pSh->GetView().GetDocShell();
315 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) != nullptr );
317 aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
318 rPage.PageCreated(aSet);
322 else if (rId == "columns")
324 if( m_nType == SfxStyleFamily::Frame )
325 static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
326 static_cast<SwColumnPage&>(rPage).SetFormatUsed( true );
328 // do not remove; many other style dialog combinations still use the SfxTabPage
329 // for the SvxBrushItem (see RID_SVXPAGE_BKG)
330 else if (rId == "background" || rId == "highlighting")
332 SvxBackgroundTabFlags nFlagType = SvxBackgroundTabFlags::NONE;
333 if( SfxStyleFamily::Char == m_nType || SfxStyleFamily::Para == m_nType )
334 nFlagType |= SvxBackgroundTabFlags::SHOW_HIGHLIGHTING;
335 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
336 rPage.PageCreated(aSet);
338 else if (rId == "condition")
340 static_cast<SwCondCollPage&>(rPage).SetCollection(
341 static_cast<SwDocStyleSheet&>(GetStyleSheet()).GetCollection() );
343 else if (rId == "page")
345 if(0 == (m_nHtmlMode & HTMLMODE_ON ))
347 std::vector<OUString> aList;
348 OUString aNew;
349 SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
350 aList.push_back( aNew );
351 if( m_pWrtShell )
353 SfxStyleSheetBasePool* pStyleSheetPool = m_pWrtShell->
354 GetView().GetDocShell()->GetStyleSheetPool();
355 SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First(SfxStyleFamily::Para);
356 while(pFirstStyle)
358 aList.push_back( pFirstStyle->GetName() );
359 pFirstStyle = pStyleSheetPool->Next();
362 // set DrawingLayer FillStyles active
363 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
364 aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList));
365 rPage.PageCreated(aSet);
368 else if (rId == "header")
370 if(0 == (m_nHtmlMode & HTMLMODE_ON ))
372 static_cast<SvxHeaderPage&>(rPage).EnableDynamicSpacing();
375 // set DrawingLayer FillStyles active
376 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
377 rPage.PageCreated(aSet);
379 else if (rId == "footer")
381 if(0 == (m_nHtmlMode & HTMLMODE_ON ))
383 static_cast<SvxFooterPage&>(rPage).EnableDynamicSpacing();
386 // set DrawingLayer FillStyles active
387 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
388 rPage.PageCreated(aSet);
390 else if (rId == "border")
392 if( SfxStyleFamily::Para == m_nType )
394 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
396 else if( SfxStyleFamily::Frame == m_nType )
398 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
400 rPage.PageCreated(aSet);
402 else if (rId == "borders")
404 if( SfxStyleFamily::Para == m_nType )
406 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
408 else if( SfxStyleFamily::Frame == m_nType )
410 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
412 rPage.PageCreated(aSet);
414 // inits for Area and Transparency TabPages
415 // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
416 // the color table) need to be added as items (e.g. SvxColorTableItem) to make
417 // these pages find the needed attributes for fill style suggestions.
418 // These are added in SwDocStyleSheet::GetItemSet() for the SfxStyleFamily::Para on
419 // demand, but could also be directly added from the DrawModel.
420 else if (rId == "area")
422 aSet.Put(GetStyleSheet().GetItemSet());
424 // add flag for direct graphic content selection
425 aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
427 rPage.PageCreated(aSet);
429 else if (rId == "transparence")
431 rPage.PageCreated(GetStyleSheet().GetItemSet());
433 else if (rId == "bullets")
435 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
436 rPage.PageCreated(aSet);
438 else if (rId == "outline")
440 if (SfxStyleFamily::Pseudo == m_nType)
442 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
443 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
444 rPage.PageCreated(aSet);
446 else if (SfxStyleFamily::Para == m_nType)
448 // handle if the current paragraph style is assigned to a list level of outline style,
449 SwTextFormatColl* pTmpColl = m_pWrtShell->FindTextFormatCollByName( GetStyleSheet().GetName() );
450 if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
452 static_cast<SwParagraphNumTabPage&>(rPage).DisableOutline() ;
453 static_cast<SwParagraphNumTabPage&>(rPage).DisableNumbering();
454 }//<-end
455 weld::ComboBox& rBox = static_cast<SwParagraphNumTabPage&>(rPage).GetStyleBox();
456 SfxStyleSheetBasePool* pPool = m_pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
457 const SfxStyleSheetBase* pBase = pPool->First(SfxStyleFamily::Pseudo);
458 std::set<OUString> aNames;
459 while(pBase)
461 aNames.insert(pBase->GetName());
462 pBase = pPool->Next();
464 aNames.erase(SwResId(STR_POOLNUMRULE_NOLIST));
465 for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
466 rBox.append_text(*it);
469 else if (rId == "customize")
471 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
472 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
474 // collect character styles
475 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/comboboxfragment.ui"));
476 std::unique_ptr<weld::ComboBox> xCharFormatLB(xBuilder->weld_combo_box("combobox"));
477 xCharFormatLB->clear();
478 xCharFormatLB->append_text(SwViewShell::GetShellRes()->aStrNone);
479 if (SwWrtShell* pSh = ::GetActiveWrtShell())
481 SwDocShell* pDocShell = pSh->GetView().GetDocShell();
482 ::FillCharStyleListBox(*xCharFormatLB, pDocShell);
484 std::vector<OUString> aList;
485 aList.reserve(xCharFormatLB->get_count());
486 for (sal_Int32 j = 0; j < xCharFormatLB->get_count(); j++)
487 aList.push_back(xCharFormatLB->get_text(j));
489 aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
490 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr);
491 aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
492 rPage.PageCreated(aSet);
495 else if (rId == "indents")
497 if( rPage.GetItemSet().GetParent() )
499 constexpr tools::Long constTwips_0_5mm = o3tl::toTwips(5, o3tl::Length::mm10);
500 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, constTwips_0_5mm));
501 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
502 rPage.PageCreated(aSet);
505 else if (rId == "alignment")
507 aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
508 rPage.PageCreated(aSet);
510 else if (rId == "asianlayout")
512 if( SfxStyleFamily::Char == m_nType )
514 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
515 rPage.PageCreated(aSet);
518 else if (rId == "type")
520 static_cast<SwFramePage&>(rPage).SetNewFrame( true );
521 static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
523 else if (rId == "options")
525 static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
526 static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
528 else if (rId == "wrap")
530 static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
532 else if (rId == "macros")
534 SfxAllItemSet aNewSet(*aSet.GetPool());
535 aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
536 if ( m_pWrtShell )
537 rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame().GetFrame().GetFrameInterface() );
538 rPage.PageCreated(aNewSet);
542 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */