xref: /core/sw/source/ui/fmtui/tmpdlg.cxx (revision cade37fa)
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 <svl/cjkoptions.hxx>
29 #include <vcl/svapp.hxx>
30 #include <numpara.hxx>
31 #include <swmodule.hxx>
32 #include <wrtsh.hxx>
33 #include <view.hxx>
34 #include <wdocsh.hxx>
35 #include <viewopt.hxx>
36 #include <pgfnote.hxx>
37 #include <pggrid.hxx>
38 #include <tmpdlg.hxx>
39 #include <column.hxx>
40 #include <drpcps.hxx>
41 #include <frmpage.hxx>
42 #include <wrap.hxx>
43 #include <swuiccoll.hxx>
44 #include <docstyle.hxx>
45 #include <fmtcol.hxx>
46 #include <macassgn.hxx>
47 #include <poolfmt.hxx>
48 #include <uitool.hxx>
49 #include <shellres.hxx>
50 #include <strings.hrc>
51 
52 #include <cmdid.h>
53 #include <SwStyleNameMapper.hxx>
54 #include <svl/stritem.hxx>
55 #include <svl/slstitm.hxx>
56 #include <svl/eitem.hxx>
57 #include <svl/intitem.hxx>
58 #include <svx/dialogs.hrc>
59 #include <svx/flagsdef.hxx>
60 #include <officecfg/Office/Common.hxx>
61 
62 // the dialog's carrier
SwTemplateDlgController(weld::Window * pParent,SfxStyleSheetBase & rBase,SfxStyleFamily nRegion,const OUString & sPage,SwWrtShell * pActShell,bool bNew)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)
77 {
78     m_nHtmlMode = ::GetHtmlMode(m_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(u"font"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
100             AddTabPage(u"fonteffect"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
101             AddTabPage(u"position"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ));
102             AddTabPage(u"asianlayout"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ));
103             AddTabPage(u"background"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
104             AddTabPage(u"borders"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
105             if(m_nHtmlMode & HTMLMODE_ON || !SvtCJKOptions::IsDoubleLinesEnabled())
106                 RemoveTabPage(u"asianlayout"_ustr);
107         }
108         break;
109         // paragraph styles
110         case SfxStyleFamily::Para:
111         {
112             AddTabPage(u"indents"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH));
113 
114             AddTabPage(u"alignment"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH));
115 
116             AddTabPage(u"textflow"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
117 
118             AddTabPage(u"asiantypo"_ustr,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
119 
120             AddTabPage(u"font"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
121 
122             AddTabPage(u"fonteffect"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
123 
124             AddTabPage(u"position"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
125 
126             AddTabPage(u"asianlayout"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
127 
128             AddTabPage(u"highlighting"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG ));
129 
130             AddTabPage(u"tabs"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
131 
132             AddTabPage(u"outline"_ustr, SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges);
133             AddTabPage(u"dropcaps"_ustr, SwDropCapsPage::Create, SwDropCapsPage::GetRanges );
134 
135             // add Area and Transparence TabPages
136             AddTabPage(u"area"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
137             AddTabPage(u"transparence"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
138 
139             AddTabPage(u"borders"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
140 
141             AddTabPage(u"condition"_ustr, SwCondCollPage::Create,
142                                         SwCondCollPage::GetRanges );
143             if( (!m_bNewStyle && RES_CONDTXTFMTCOLL != static_cast<SwDocStyleSheet&>(rBase).GetCollection()->Which())
144             || m_nHtmlMode & HTMLMODE_ON )
145                 RemoveTabPage(u"condition"_ustr);
146 
147             if(m_nHtmlMode & HTMLMODE_ON)
148             {
149                 if (!officecfg::Office::Common::Filter::HTML::Export::PrintLayout::get())
150                     RemoveTabPage(u"textflow"_ustr);
151                 RemoveTabPage(u"asiantypo"_ustr);
152                 RemoveTabPage(u"tabs"_ustr);
153                 RemoveTabPage(u"outline"_ustr);
154                 RemoveTabPage(u"asianlayout"_ustr);
155                 if(!(m_nHtmlMode & HTMLMODE_FULL_STYLES))
156                 {
157                     RemoveTabPage(u"background"_ustr);
158                     RemoveTabPage(u"dropcaps"_ustr);
159                 }
160             }
161             else
162             {
163                 if(!SvtCJKOptions::IsAsianTypographyEnabled())
164                     RemoveTabPage(u"asiantypo"_ustr);
165                 if(!SvtCJKOptions::IsDoubleLinesEnabled())
166                     RemoveTabPage(u"asianlayout"_ustr);
167             }
168         }
169         break;
170         // page styles
171         case SfxStyleFamily::Page:
172         {
173             // add Area and Transparence TabPages
174             AddTabPage(u"area"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
175             AddTabPage(u"transparence"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
176             AddTabPage(u"header"_ustr,  SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
177             AddTabPage(u"footer"_ustr, SvxFooterPage::Create, SvxFooterPage::GetRanges);
178             AddTabPage(u"page"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PAGE));
179             if (0 == ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell()))
180             {
181                 AddTabPage(u"borders"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
182                 AddTabPage(u"columns"_ustr, SwColumnPage::Create, SwColumnPage::GetRanges );
183                 AddTabPage(u"footnotes"_ustr, SwFootNotePage::Create, SwFootNotePage::GetRanges );
184                 AddTabPage(u"textgrid"_ustr, SwTextGridPage::Create, SwTextGridPage::GetRanges );
185                 if(!SvtCJKOptions::IsAsianTypographyEnabled())
186                     RemoveTabPage(u"textgrid"_ustr);
187             }
188             else
189             {
190                 RemoveTabPage(u"borders"_ustr);
191                 RemoveTabPage(u"columns"_ustr);
192                 RemoveTabPage(u"footnotes"_ustr);
193                 RemoveTabPage(u"textgrid"_ustr);
194             }
195         }
196         break;
197         // numbering styles
198         case SfxStyleFamily::Pseudo:
199         {
200             AddTabPage(u"numbering"_ustr, RID_SVXPAGE_PICK_SINGLE_NUM);
201             AddTabPage(u"bullets"_ustr, RID_SVXPAGE_PICK_BULLET);
202             AddTabPage(u"outline"_ustr, RID_SVXPAGE_PICK_NUM);
203             AddTabPage(u"graphics"_ustr, RID_SVXPAGE_PICK_BMP);
204             AddTabPage(u"customize"_ustr, RID_SVXPAGE_NUM_OPTIONS );
205             AddTabPage(u"position"_ustr, RID_SVXPAGE_NUM_POSITION );
206         }
207         break;
208         case SfxStyleFamily::Frame:
209         {
210             AddTabPage(u"type"_ustr, SwFramePage::Create, SwFramePage::GetRanges);
211             AddTabPage(u"options"_ustr, SwFrameAddPage::Create, SwFrameAddPage::GetRanges);
212             AddTabPage(u"wrap"_ustr, SwWrapTabPage::Create, SwWrapTabPage::GetRanges);
213 
214             // add Area and Transparence TabPages
215             AddTabPage(u"area"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
216             AddTabPage(u"transparence"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
217 
218             AddTabPage(u"borders"_ustr, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
219 
220             AddTabPage(u"columns"_ustr, SwColumnPage::Create, SwColumnPage::GetRanges );
221 
222             AddTabPage(u"macros"_ustr, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
223         }
224         break;
225         default:
226             OSL_ENSURE(false, "wrong family");
227     }
228 
229     if (bNew)
230         SetCurPageId(u"organizer"_ustr);
231     else if (!sPage.isEmpty())
232         SetCurPageId(sPage);
233 }
234 
Ok()235 short SwTemplateDlgController::Ok()
236 {
237     short nRet = SfxTabDialogController::Ok();
238     if( RET_OK == nRet )
239     {
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 ))
247         {
248             if( GetOutputItemSet() )
249                 const_cast<SfxItemSet*>(GetOutputItemSet())->Put( *pExItem );
250             else
251                 nRet = RET_CANCEL;
252         }
253     }
254     else
255     {
256         //JP 09.01.98 Bug #46446#:
257         // that's the Ok-Handler, so OK has to be default!
258         nRet = RET_OK;
259     }
260     return nRet;
261 }
262 
RefreshInputSet()263 void SwTemplateDlgController::RefreshInputSet()
264 {
265     SfxItemSet* pInSet = GetInputSetImpl();
266     pInSet->ClearItem();
267     pInSet->SetParent( &GetStyleSheet().GetItemSet() );
268 }
269 
PageCreated(const OUString & rId,SfxTabPage & rPage)270 void SwTemplateDlgController::PageCreated(const OUString& rId, SfxTabPage &rPage )
271 {
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()));
277 
278     if (rId == "font")
279     {
280         if (SwView* pView = GetActiveView())
281         {
282             SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>(pView->
283                 GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
284 
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);
293         }
294     }
295     else if (rId == "fonteffect")
296     {
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);
302     }
303     else if (rId == "position")
304     {
305         if( SfxStyleFamily::Char == m_nType )
306         {
307             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
308             rPage.PageCreated(aSet);
309         }
310         else if (SfxStyleFamily::Pseudo == m_nType)
311         {
312             if (SwWrtShell* pSh = ::GetActiveWrtShell())
313             {
314                 SwDocShell* pDocShell = pSh->GetView().GetDocShell();
315                 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) !=  nullptr );
316 
317                 aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
318                 rPage.PageCreated(aSet);
319             }
320         }
321     }
322     else if (rId == "columns")
323     {
324         if( m_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 == 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);
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 == (m_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( m_pWrtShell )
352             {
353                 SfxStyleSheetBasePool* pStyleSheetPool = m_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 == (m_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 == (m_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 == m_nType )
393         {
394             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
395         }
396         else if( SfxStyleFamily::Frame == m_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 == m_nType )
405         {
406             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
407         }
408         else if( SfxStyleFamily::Frame == m_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 == m_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 == m_nType)
447         {
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() )
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 = m_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(SwResId(STR_POOLNUMRULE_NOLIST));
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, u"modules/swriter/ui/comboboxfragment.ui"_ustr));
476         std::unique_ptr<weld::ComboBox> xCharFormatLB(xBuilder->weld_combo_box(u"combobox"_ustr));
477         xCharFormatLB->clear();
478         xCharFormatLB->append_text(SwViewShell::GetShellRes()->aStrNone);
479         if (SwWrtShell* pSh = ::GetActiveWrtShell())
480         {
481             SwDocShell* pDocShell = pSh->GetView().GetDocShell();
482             ::FillCharStyleListBox(*xCharFormatLB,  pDocShell);
483 
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));
488 
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);
493         }
494     }
495     else if (rId == "indents")
496     {
497         if( rPage.GetItemSet().GetParent() )
498         {
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);
503         }
504     }
505     else if (rId == "alignment")
506     {
507         aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
508         rPage.PageCreated(aSet);
509     }
510     else if (rId == "asianlayout")
511     {
512         if( SfxStyleFamily::Char == m_nType )
513         {
514             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
515             rPage.PageCreated(aSet);
516         }
517     }
518     else if (rId == "type")
519     {
520         static_cast<SwFramePage&>(rPage).SetNewFrame( true );
521         static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
522     }
523     else if (rId == "options")
524     {
525         static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
526         static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
527     }
528     else if (rId == "wrap")
529     {
530         static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
531     }
532     else if (rId == "macros")
533     {
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);
539     }
540 }
541 
542 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
543