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 <hintids.hxx>
21 
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>
52 
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>
61 
62 // the dialog's carrier
SwTemplateDlgController(weld::Window * pParent,SfxStyleSheetBase & rBase,SfxStyleFamily nRegion,const OString & sPage,SwWrtShell * pActShell,bool bNew)63 SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
64                                                  SfxStyleSheetBase& rBase,
65                                                  SfxStyleFamily nRegion,
66                                                  const OString& 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" + OString::number(static_cast<sal_uInt16>(nRegion)),
73                                rBase)
74     , nType(nRegion)
75     , pWrtShell(pActShell)
76     , bNewStyle(bNew)
77 {
78     nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
79     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
80 
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));
84 
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));
88 
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));
92 
93     // stitch TabPages together
94     switch( nRegion )
95     {
96         // character styles
97         case SfxStyleFamily::Char:
98         {
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             SvtCJKOptions aCJKOptions;
106             if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
107                 RemoveTabPage("asianlayout");
108         }
109         break;
110         // paragraph styles
111         case SfxStyleFamily::Para:
112         {
113             AddTabPage("indents", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH));
114 
115             AddTabPage("alignment", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH));
116 
117             AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
118 
119             AddTabPage("asiantypo",  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
120 
121             AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
122 
123             AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
124 
125             AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
126 
127             AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
128 
129             AddTabPage("highlighting", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
130 
131             AddTabPage("tabs", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
132 
133             AddTabPage("outline", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges);
134             AddTabPage("dropcaps", SwDropCapsPage::Create, SwDropCapsPage::GetRanges );
135 
136             // add Area and Transparence TabPages
137             AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
138             AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
139 
140             AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
141 
142             AddTabPage("condition", SwCondCollPage::Create,
143                                         SwCondCollPage::GetRanges );
144             if( (!bNewStyle && RES_CONDTXTFMTCOLL != static_cast<SwDocStyleSheet&>(rBase).GetCollection()->Which())
145             || nHtmlMode & HTMLMODE_ON )
146                 RemoveTabPage("condition");
147 
148             SvtCJKOptions aCJKOptions;
149             if(nHtmlMode & HTMLMODE_ON)
150             {
151                 SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
152                 if (!rHtmlOpt.IsPrintLayoutExtension())
153                     RemoveTabPage("textflow");
154                 RemoveTabPage("asiantypo");
155                 RemoveTabPage("tabs");
156                 RemoveTabPage("outline");
157                 RemoveTabPage("asianlayout");
158                 if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
159                 {
160                     RemoveTabPage("background");
161                     RemoveTabPage("dropcaps");
162                 }
163             }
164             else
165             {
166                 if(!aCJKOptions.IsAsianTypographyEnabled())
167                     RemoveTabPage("asiantypo");
168                 if(!aCJKOptions.IsDoubleLinesEnabled())
169                     RemoveTabPage("asianlayout");
170             }
171         }
172         break;
173         // page styles
174         case SfxStyleFamily::Page:
175         {
176             // add Area and Transparence TabPages
177             AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
178             AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
179             AddTabPage("header",  SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
180             AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
181             AddTabPage("page", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PAGE));
182             if (0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
183             {
184                 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
185                 AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
186                 AddTabPage("footnotes", SwFootNotePage::Create, SwFootNotePage::GetRanges );
187                 AddTabPage("textgrid", SwTextGridPage::Create, SwTextGridPage::GetRanges );
188                 SvtCJKOptions aCJKOptions;
189                 if(!aCJKOptions.IsAsianTypographyEnabled())
190                     RemoveTabPage("textgrid");
191             }
192             else
193             {
194                 RemoveTabPage("borders");
195                 RemoveTabPage("columns");
196                 RemoveTabPage("footnotes");
197                 RemoveTabPage("textgrid");
198             }
199         }
200         break;
201         // numbering styles
202         case SfxStyleFamily::Pseudo:
203         {
204             AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
205             AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
206             AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
207             AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
208             AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
209             AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
210         }
211         break;
212         case SfxStyleFamily::Frame:
213         {
214             AddTabPage("type", SwFramePage::Create, SwFramePage::GetRanges);
215             AddTabPage("options", SwFrameAddPage::Create, SwFrameAddPage::GetRanges);
216             AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges);
217 
218             // add Area and Transparence TabPages
219             AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
220             AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
221 
222             AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
223 
224             AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
225 
226             AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
227         }
228         break;
229         default:
230             OSL_ENSURE(false, "wrong family");
231     }
232 
233     if (bNew)
234         SetCurPageId("organizer");
235     else if (!sPage.isEmpty())
236         SetCurPageId(sPage);
237 }
238 
Ok()239 short SwTemplateDlgController::Ok()
240 {
241     short nRet = SfxTabDialogController::Ok();
242     if( RET_OK == nRet )
243     {
244         const SfxPoolItem *pOutItem, *pExItem;
245         if( SfxItemState::SET == m_xExampleSet->GetItemState(
246             SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
247             ( !GetOutputItemSet() ||
248             SfxItemState::SET != GetOutputItemSet()->GetItemState(
249             SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
250             *pExItem != *pOutItem ))
251         {
252             if( GetOutputItemSet() )
253                 const_cast<SfxItemSet*>(GetOutputItemSet())->Put( *pExItem );
254             else
255                 nRet = RET_CANCEL;
256         }
257     }
258     else
259     {
260         //JP 09.01.98 Bug #46446#:
261         // that's the Ok-Handler, so OK has to be default!
262         nRet = RET_OK;
263     }
264     return nRet;
265 }
266 
RefreshInputSet()267 void SwTemplateDlgController::RefreshInputSet()
268 {
269     SfxItemSet* pInSet = GetInputSetImpl();
270     pInSet->ClearItem();
271     pInSet->SetParent( &GetStyleSheet().GetItemSet() );
272 }
273 
PageCreated(const OString & rId,SfxTabPage & rPage)274 void SwTemplateDlgController::PageCreated(const OString& rId, SfxTabPage &rPage )
275 {
276     // set style's and metric's names
277     OUString sNumCharFormat, sBulletCharFormat;
278     SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat);
279     SwStyleNameMapper::FillUIName( RES_POOLCHR_BULLET_LEVEL, sBulletCharFormat);
280     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
281 
282     if (rId == "font")
283     {
284         OSL_ENSURE(::GetActiveView(), "no active view");
285 
286         SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>(::GetActiveView()->
287             GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
288 
289         aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
290         sal_uInt32 nFlags = 0;
291         if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
292             nFlags = SVX_RELATIVE_MODE;
293         if( SfxStyleFamily::Char == nType )
294             nFlags = nFlags|SVX_PREVIEW_CHARACTER;
295         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
296         rPage.PageCreated(aSet);
297     }
298     else if (rId == "fonteffect")
299     {
300         sal_uInt32 nFlags = SVX_ENABLE_CHAR_TRANSPARENCY;
301         if( SfxStyleFamily::Char == nType )
302             nFlags = nFlags|SVX_PREVIEW_CHARACTER;
303         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
304         rPage.PageCreated(aSet);
305     }
306     else if (rId == "position")
307     {
308         if( SfxStyleFamily::Char == nType )
309         {
310             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
311             rPage.PageCreated(aSet);
312         }
313         else if (SfxStyleFamily::Pseudo == nType)
314         {
315             SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
316             FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) !=  nullptr );
317 
318             aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
319             rPage.PageCreated(aSet);
320         }
321     }
322     else if (rId == "columns")
323     {
324         if( nType == SfxStyleFamily::Frame )
325             static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
326         static_cast<SwColumnPage&>(rPage).SetFormatUsed( true );
327     }
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")
331     {
332         SvxBackgroundTabFlags nFlagType = SvxBackgroundTabFlags::NONE;
333         if( SfxStyleFamily::Char == nType || SfxStyleFamily::Para == nType )
334             nFlagType |= SvxBackgroundTabFlags::SHOW_HIGHLIGHTING;
335         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
336         rPage.PageCreated(aSet);
337     }
338     else if (rId == "condition")
339     {
340         static_cast<SwCondCollPage&>(rPage).SetCollection(
341             static_cast<SwDocStyleSheet&>(GetStyleSheet()).GetCollection() );
342     }
343     else if (rId == "page")
344     {
345         if(0 == (nHtmlMode & HTMLMODE_ON ))
346         {
347             std::vector<OUString> aList;
348             OUString aNew;
349             SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
350             aList.push_back( aNew );
351             if( pWrtShell )
352             {
353                 SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
354                             GetView().GetDocShell()->GetStyleSheetPool();
355                 SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First(SfxStyleFamily::Para);
356                 while(pFirstStyle)
357                 {
358                     aList.push_back( pFirstStyle->GetName() );
359                     pFirstStyle = pStyleSheetPool->Next();
360                 }
361             }
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);
366         }
367     }
368     else if (rId == "header")
369     {
370         if(0 == (nHtmlMode & HTMLMODE_ON ))
371         {
372             static_cast<SvxHeaderPage&>(rPage).EnableDynamicSpacing();
373         }
374 
375         // set DrawingLayer FillStyles active
376         aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
377         rPage.PageCreated(aSet);
378     }
379     else if (rId == "footer")
380     {
381         if(0 == (nHtmlMode & HTMLMODE_ON ))
382         {
383             static_cast<SvxFooterPage&>(rPage).EnableDynamicSpacing();
384         }
385 
386         // set DrawingLayer FillStyles active
387         aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
388         rPage.PageCreated(aSet);
389     }
390     else if (rId == "border")
391     {
392         if( SfxStyleFamily::Para == nType )
393         {
394             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
395         }
396         else if( SfxStyleFamily::Frame == nType )
397         {
398             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
399         }
400         rPage.PageCreated(aSet);
401     }
402     else if (rId == "borders")
403     {
404         if( SfxStyleFamily::Para == nType )
405         {
406             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
407         }
408         else if( SfxStyleFamily::Frame == nType )
409         {
410             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
411         }
412         rPage.PageCreated(aSet);
413     }
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")
421     {
422         aSet.Put(GetStyleSheet().GetItemSet());
423 
424         // add flag for direct graphic content selection
425         aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
426 
427         rPage.PageCreated(aSet);
428     }
429     else if (rId == "transparence")
430     {
431         rPage.PageCreated(GetStyleSheet().GetItemSet());
432     }
433     else if (rId == "bullets")
434     {
435         aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
436         rPage.PageCreated(aSet);
437     }
438     else if (rId == "outline")
439     {
440         if (SfxStyleFamily::Pseudo == nType)
441         {
442             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
443             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
444             rPage.PageCreated(aSet);
445         }
446         else if (SfxStyleFamily::Para == nType)
447         {
448             //  handle if the current paragraph style is assigned to a list level of outline style,
449             SwTextFormatColl* pTmpColl = pWrtShell->FindTextFormatCollByName( GetStyleSheet().GetName() );
450             if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
451             {
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 = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
457             const SfxStyleSheetBase* pBase = pPool->First(SfxStyleFamily::Pseudo);
458             std::set<OUString> aNames;
459             while(pBase)
460             {
461                 aNames.insert(pBase->GetName());
462                 pBase = pPool->Next();
463             }
464             aNames.erase("No List");
465             for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
466                 rBox.append_text(*it);
467         }
468     }
469     else if (rId == "customize")
470     {
471         aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
472         aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
473 
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         SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
480         ::FillCharStyleListBox(*xCharFormatLB,  pDocShell);
481 
482         std::vector<OUString> aList;
483         aList.reserve(xCharFormatLB->get_count());
484         for (sal_Int32 j = 0; j < xCharFormatLB->get_count(); j++)
485             aList.push_back(xCharFormatLB->get_text(j));
486 
487         aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
488         FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) !=  nullptr);
489         aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
490         rPage.PageCreated(aSet);
491     }
492     else if (rId == "indents")
493     {
494         if( rPage.GetItemSet().GetParent() )
495         {
496             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
497             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
498             rPage.PageCreated(aSet);
499         }
500     }
501     else if (rId == "alignment")
502     {
503         aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
504         rPage.PageCreated(aSet);
505     }
506     else if (rId == "asianlayout")
507     {
508         if( SfxStyleFamily::Char == nType )
509         {
510             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
511             rPage.PageCreated(aSet);
512         }
513     }
514     else if (rId == "type")
515     {
516         static_cast<SwFramePage&>(rPage).SetNewFrame( true );
517         static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
518     }
519     else if (rId == "options")
520     {
521         static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
522         static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
523     }
524     else if (rId == "wrap")
525     {
526         static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
527     }
528     else if (rId == "macros")
529     {
530         SfxAllItemSet aNewSet(*aSet.GetPool());
531         aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
532         if ( pWrtShell )
533             rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
534         rPage.PageCreated(aNewSet);
535     }
536 }
537 
538 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
539