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 <sal/log.hxx>
23 #include <sfx2/viewfrm.hxx>
24 #include <svx/hdft.hxx>
25 #include <editeng/flstitem.hxx>
26 #include <sfx2/htmlmode.hxx>
27 #include <svtools/htmlcfg.hxx>
28 #include <svl/cjkoptions.hxx>
29 #include <vcl/svapp.hxx>
30 #include <numpara.hxx>
31 #include <fmtclds.hxx>
32 #include <swtypes.hxx>
33 #include <swmodule.hxx>
34 #include <wrtsh.hxx>
35 #include <view.hxx>
36 #include <wdocsh.hxx>
37 #include <viewopt.hxx>
38 #include <pgfnote.hxx>
39 #include <pggrid.hxx>
40 #include <tmpdlg.hxx>
41 #include <column.hxx>
42 #include <drpcps.hxx>
43 #include <frmpage.hxx>
44 #include <wrap.hxx>
45 #include <frmmgr.hxx>
46 #include <ccoll.hxx>
47 #include <swuiccoll.hxx>
48 #include <docstyle.hxx>
49 #include <fmtcol.hxx>
50 #include <macassgn.hxx>
51 #include <poolfmt.hxx>
52 #include <uitool.hxx>
53 #include <shellres.hxx>
54 #include <swabstdlg.hxx>
55
56 #include <cmdid.h>
57 #include <globals.hrc>
58 #include <SwStyleNameMapper.hxx>
59 #include <svx/svxids.hrc>
60 #include <svl/stritem.hxx>
61 #include <svl/aeitem.hxx>
62 #include <svl/slstitm.hxx>
63 #include <svl/eitem.hxx>
64 #include <svl/intitem.hxx>
65 #include <svx/svxdlg.hxx>
66 #include <svx/dialogs.hrc>
67 #include <svx/flagsdef.hxx>
68
69 // the dialog's carrier
SwTemplateDlgController(weld::Window * pParent,SfxStyleSheetBase & rBase,SfxStyleFamily nRegion,const OString & sPage,SwWrtShell * pActShell,bool bNew)70 SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent,
71 SfxStyleSheetBase& rBase,
72 SfxStyleFamily nRegion,
73 const OString& sPage,
74 SwWrtShell* pActShell,
75 bool bNew)
76 : SfxStyleDialogController(pParent,
77 "modules/swriter/ui/templatedialog" +
78 OUString::number(static_cast<sal_uInt16>(nRegion)) + ".ui",
79 "TemplateDialog" + OString::number(static_cast<sal_uInt16>(nRegion)),
80 rBase)
81 , nType(nRegion)
82 , pWrtShell(pActShell)
83 , bNewStyle(bNew)
84 {
85 nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
86 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
87 // stitch TabPages together
88 switch( nRegion )
89 {
90 // character styles
91 case SfxStyleFamily::Char:
92 {
93 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
94 AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
95 AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ));
96 AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ));
97 AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ));
98 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
99 SvtCJKOptions aCJKOptions;
100 if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
101 RemoveTabPage("asianlayout");
102 }
103 break;
104 // paragraph styles
105 case SfxStyleFamily::Para:
106 {
107 AddTabPage("indents", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH));
108
109 AddTabPage("alignment", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH));
110
111 AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
112
113 AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
114
115 AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
116
117 AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
118
119 AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
120
121 AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
122
123 AddTabPage("highlighting", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ));
124
125 AddTabPage("tabs", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
126
127 AddTabPage("outline", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges);
128 AddTabPage("dropcaps", SwDropCapsPage::Create, SwDropCapsPage::GetRanges );
129
130 // add Area and Transparence TabPages
131 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
132 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
133
134 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
135
136 AddTabPage("condition", SwCondCollPage::Create,
137 SwCondCollPage::GetRanges );
138 if( (!bNewStyle && RES_CONDTXTFMTCOLL != static_cast<SwDocStyleSheet&>(rBase).GetCollection()->Which())
139 || nHtmlMode & HTMLMODE_ON )
140 RemoveTabPage("condition");
141
142 SvtCJKOptions aCJKOptions;
143 if(nHtmlMode & HTMLMODE_ON)
144 {
145 SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
146 if (!rHtmlOpt.IsPrintLayoutExtension())
147 RemoveTabPage("textflow");
148 RemoveTabPage("asiantypo");
149 RemoveTabPage("tabs");
150 RemoveTabPage("outline");
151 RemoveTabPage("asianlayout");
152 if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
153 {
154 RemoveTabPage("background");
155 RemoveTabPage("dropcaps");
156 }
157 }
158 else
159 {
160 if(!aCJKOptions.IsAsianTypographyEnabled())
161 RemoveTabPage("asiantypo");
162 if(!aCJKOptions.IsDoubleLinesEnabled())
163 RemoveTabPage("asianlayout");
164 }
165 }
166 break;
167 // page styles
168 case SfxStyleFamily::Page:
169 {
170 // add Area and Transparence TabPages
171 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
172 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
173 AddTabPage("header", SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
174 AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
175 AddTabPage("page", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PAGE));
176 if (0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
177 {
178 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
179 AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
180 AddTabPage("footnotes", SwFootNotePage::Create, SwFootNotePage::GetRanges );
181 AddTabPage("textgrid", SwTextGridPage::Create, SwTextGridPage::GetRanges );
182 SvtCJKOptions aCJKOptions;
183 if(!aCJKOptions.IsAsianTypographyEnabled())
184 RemoveTabPage("textgrid");
185 }
186 else
187 {
188 RemoveTabPage("borders");
189 RemoveTabPage("columns");
190 RemoveTabPage("footnotes");
191 RemoveTabPage("textgrid");
192 }
193 }
194 break;
195 // numbering styles
196 case SfxStyleFamily::Pseudo:
197 {
198 AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
199 AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
200 AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
201 AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
202 AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
203 AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
204 }
205 break;
206 case SfxStyleFamily::Frame:
207 {
208 AddTabPage("type", SwFramePage::Create, SwFramePage::GetRanges);
209 AddTabPage("options", SwFrameAddPage::Create, SwFrameAddPage::GetRanges);
210 AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges);
211
212 // add Area and Transparence TabPages
213 AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
214 AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
215
216 AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
217
218 AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
219
220 AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
221 }
222 break;
223 default:
224 OSL_ENSURE(false, "wrong family");
225 }
226
227 if (bNew)
228 SetCurPageId("organizer");
229 else if (!sPage.isEmpty())
230 SetCurPageId(sPage);
231 }
232
Ok()233 short SwTemplateDlgController::Ok()
234 {
235 short nRet = SfxTabDialogController::Ok();
236 if( RET_OK == nRet )
237 {
238 const SfxPoolItem *pOutItem, *pExItem;
239 if( SfxItemState::SET == m_xExampleSet->GetItemState(
240 SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
241 ( !GetOutputItemSet() ||
242 SfxItemState::SET != GetOutputItemSet()->GetItemState(
243 SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
244 *pExItem != *pOutItem ))
245 {
246 if( GetOutputItemSet() )
247 const_cast<SfxItemSet*>(GetOutputItemSet())->Put( *pExItem );
248 else
249 nRet = RET_CANCEL;
250 }
251 }
252 else
253 {
254 //JP 09.01.98 Bug #46446#:
255 // that's the Ok-Handler, so OK has to be default!
256 nRet = RET_OK;
257 }
258 return nRet;
259 }
260
RefreshInputSet()261 void SwTemplateDlgController::RefreshInputSet()
262 {
263 SfxItemSet* pInSet = GetInputSetImpl();
264 pInSet->ClearItem();
265 pInSet->SetParent( &GetStyleSheet().GetItemSet() );
266 }
267
PageCreated(const OString & rId,SfxTabPage & rPage)268 void SwTemplateDlgController::PageCreated(const OString& rId, SfxTabPage &rPage )
269 {
270 // set style's and metric's names
271 OUString sNumCharFormat, sBulletCharFormat;
272 SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFormat);
273 SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFormat);
274 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
275
276 if (rId == "font")
277 {
278 OSL_ENSURE(::GetActiveView(), "no active view");
279
280 SvxFontListItem aFontListItem( *static_cast<const SvxFontListItem*>(::GetActiveView()->
281 GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
282
283 aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
284 sal_uInt32 nFlags = 0;
285 if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
286 nFlags = SVX_RELATIVE_MODE;
287 if( SfxStyleFamily::Char == nType )
288 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
289 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
290 rPage.PageCreated(aSet);
291 }
292 else if (rId == "fonteffect")
293 {
294 sal_uInt32 nFlags = SVX_ENABLE_FLASH;
295 if( SfxStyleFamily::Char == nType )
296 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
297 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
298 rPage.PageCreated(aSet);
299 }
300 else if (rId == "position")
301 {
302 if( SfxStyleFamily::Char == nType )
303 {
304 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
305 rPage.PageCreated(aSet);
306 }
307 else if (SfxStyleFamily::Pseudo == nType)
308 {
309 SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
310 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebDocShell*>( pDocShell) != nullptr );
311
312 aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
313 rPage.PageCreated(aSet);
314 }
315 }
316 else if (rId == "columns")
317 {
318 if( nType == SfxStyleFamily::Frame )
319 static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
320 static_cast<SwColumnPage&>(rPage).SetFormatUsed( true );
321 }
322 // do not remove; many other style dialog combinations still use the SfxTabPage
323 // for the SvxBrushItem (see RID_SVXPAGE_BACKGROUND)
324 else if (rId == "background" || rId == "highlighting")
325 {
326 SvxBackgroundTabFlags nFlagType = SvxBackgroundTabFlags::NONE;
327 if( SfxStyleFamily::Char == nType || SfxStyleFamily::Para == nType )
328 nFlagType |= SvxBackgroundTabFlags::SHOW_HIGHLIGHTING;
329 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
330 rPage.PageCreated(aSet);
331 }
332 else if (rId == "condition")
333 {
334 static_cast<SwCondCollPage&>(rPage).SetCollection(
335 static_cast<SwDocStyleSheet&>(GetStyleSheet()).GetCollection(), bNewStyle );
336 }
337 else if (rId == "page")
338 {
339 if(0 == (nHtmlMode & HTMLMODE_ON ))
340 {
341 std::vector<OUString> aList;
342 OUString aNew;
343 SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
344 aList.push_back( aNew );
345 if( pWrtShell )
346 {
347 SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
348 GetView().GetDocShell()->GetStyleSheetPool();
349 pStyleSheetPool->SetSearchMask(SfxStyleFamily::Para);
350 SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
351 while(pFirstStyle)
352 {
353 aList.push_back( pFirstStyle->GetName() );
354 pFirstStyle = pStyleSheetPool->Next();
355 }
356 }
357 // set DrawingLayer FillStyles active
358 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
359 aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList));
360 rPage.PageCreated(aSet);
361 }
362 }
363 else if (rId == "header")
364 {
365 if(0 == (nHtmlMode & HTMLMODE_ON ))
366 {
367 static_cast<SvxHeaderPage&>(rPage).EnableDynamicSpacing();
368 }
369
370 // set DrawingLayer FillStyles active
371 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
372 rPage.PageCreated(aSet);
373 }
374 else if (rId == "footer")
375 {
376 if(0 == (nHtmlMode & HTMLMODE_ON ))
377 {
378 static_cast<SvxFooterPage&>(rPage).EnableDynamicSpacing();
379 }
380
381 // set DrawingLayer FillStyles active
382 aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
383 rPage.PageCreated(aSet);
384 }
385 else if (rId == "border")
386 {
387 if( SfxStyleFamily::Para == nType )
388 {
389 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
390 }
391 else if( SfxStyleFamily::Frame == nType )
392 {
393 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
394 }
395 rPage.PageCreated(aSet);
396 }
397 else if (rId == "borders")
398 {
399 if( SfxStyleFamily::Para == nType )
400 {
401 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::PARA)));
402 }
403 else if( SfxStyleFamily::Frame == nType )
404 {
405 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
406 }
407 rPage.PageCreated(aSet);
408 }
409 // inits for Area and Transparency TabPages
410 // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
411 // the color table) need to be added as items (e.g. SvxColorTableItem) to make
412 // these pages find the needed attributes for fill style suggestions.
413 // These are added in SwDocStyleSheet::GetItemSet() for the SfxStyleFamily::Para on
414 // demand, but could also be directly added from the DrawModel.
415 else if (rId == "area")
416 {
417 aSet.Put(GetStyleSheet().GetItemSet());
418
419 // add flag for direct graphic content selection
420 aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
421
422 rPage.PageCreated(aSet);
423 }
424 else if (rId == "transparence")
425 {
426 rPage.PageCreated(GetStyleSheet().GetItemSet());
427 }
428 else if (rId == "bullets")
429 {
430 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
431 rPage.PageCreated(aSet);
432 }
433 else if (rId == "outline")
434 {
435 if (SfxStyleFamily::Pseudo == nType)
436 {
437 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
438 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
439 rPage.PageCreated(aSet);
440 }
441 else if (SfxStyleFamily::Para == nType)
442 {
443 // handle if the current paragraph style is assigned to a list level of outline style,
444 SwTextFormatColl* pTmpColl = pWrtShell->FindTextFormatCollByName( GetStyleSheet().GetName() );
445 if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
446 {
447 static_cast<SwParagraphNumTabPage&>(rPage).DisableOutline() ;
448 static_cast<SwParagraphNumTabPage&>(rPage).DisableNumbering();
449 }//<-end
450 weld::ComboBox& rBox = static_cast<SwParagraphNumTabPage&>(rPage).GetStyleBox();
451 SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
452 pPool->SetSearchMask(SfxStyleFamily::Pseudo);
453 const SfxStyleSheetBase* pBase = pPool->First();
454 std::set<OUString> aNames;
455 while(pBase)
456 {
457 aNames.insert(pBase->GetName());
458 pBase = pPool->Next();
459 }
460 for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
461 rBox.append_text(*it);
462 }
463 }
464 else if (rId == "customize")
465 {
466 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFormat));
467 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFormat));
468
469 // collect character styles
470 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/comboboxfragment.ui"));
471 std::unique_ptr<weld::ComboBox> xCharFormatLB(xBuilder->weld_combo_box("combobox"));
472 xCharFormatLB->clear();
473 xCharFormatLB->append_text(SwViewShell::GetShellRes()->aStrNone);
474 SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
475 ::FillCharStyleListBox(*xCharFormatLB, pDocShell);
476
477 std::vector<OUString> aList;
478 aList.reserve(xCharFormatLB->get_count());
479 for (sal_Int32 j = 0; j < xCharFormatLB->get_count(); j++)
480 aList.push_back(xCharFormatLB->get_text(j));
481
482 aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
483 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr);
484 aSet.Put ( SfxUInt16Item(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
485 rPage.PageCreated(aSet);
486 }
487 else if (rId == "indents")
488 {
489 if( rPage.GetItemSet().GetParent() )
490 {
491 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
492 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
493 rPage.PageCreated(aSet);
494 }
495 }
496 else if (rId == "alignment")
497 {
498 aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
499 rPage.PageCreated(aSet);
500 }
501 else if (rId == "asianlayout")
502 {
503 if( SfxStyleFamily::Char == nType )
504 {
505 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
506 rPage.PageCreated(aSet);
507 }
508 }
509 else if (rId == "type")
510 {
511 static_cast<SwFramePage&>(rPage).SetNewFrame( true );
512 static_cast<SwFramePage&>(rPage).SetFormatUsed( true );
513 }
514 else if (rId == "options")
515 {
516 static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(true);
517 static_cast<SwFrameAddPage&>(rPage).SetNewFrame(true);
518 }
519 else if (rId == "wrap")
520 {
521 static_cast<SwWrapTabPage&>(rPage).SetFormatUsed( true, false );
522 }
523 else if (rId == "macros")
524 {
525 SfxAllItemSet aNewSet(*aSet.GetPool());
526 aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
527 if ( pWrtShell )
528 rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
529 rPage.PageCreated(aNewSet);
530 }
531 }
532
533 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
534