update dev300-m58
[ooovba.git] / sw / source / ui / fmtui / tmpdlg.cxx
blob026a59ade1bca9eda23c6ab6b1c73bccfd85ed4b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tmpdlg.cxx,v $
10 * $Revision: 1.25 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
36 #endif
39 #include <hintids.hxx>
41 #ifndef _SVSTDARR_STRINGSSORTDTOR
42 #define _SVSTDARR_STRINGSSORTDTOR
43 #include <svtools/svstdarr.hxx>
44 #endif
45 #include <vcl/msgbox.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <svx/hdft2.hxx>
48 #include <svx/flstitem.hxx>
49 #include <svx/htmlmode.hxx>
50 #include <svx/htmlcfg.hxx>
51 #include <svtools/cjkoptions.hxx>
52 #include <numpara.hxx>
53 #include <fmtclds.hxx>
54 #include <swtypes.hxx>
55 #include <swmodule.hxx>
56 #include <errhdl.hxx> // fuer Create-Methoden
57 #include <wrtsh.hxx>
58 #ifndef _VIEW_HXX
59 #include <view.hxx>
60 #endif
61 #include <wdocsh.hxx>
62 #include <viewopt.hxx>
63 #include <pgfnote.hxx>
64 #ifndef _PGFGRID_HXX
65 #include <pggrid.hxx>
66 #endif
67 #ifndef _TMPDLG_HXX
68 #include <tmpdlg.hxx> // der Dialog
69 #endif
70 #include <column.hxx> // Spalten
71 #include <drpcps.hxx> // Initialen
72 #include <frmpage.hxx> // Rahmen
73 #include <wrap.hxx> // Rahmen
74 #include <frmmgr.hxx> // Rahmen
75 #include <ccoll.hxx> // CondColl
76 #include <swuiccoll.hxx>
77 #include <docstyle.hxx> //
78 #include <fmtcol.hxx> //
79 #include <macassgn.hxx> //
80 #include <poolfmt.hxx>
81 #include <uitool.hxx>
82 #include <shellres.hxx>
84 #ifndef _CMDID_H
85 #include <cmdid.h>
86 #endif
87 #ifndef _HELPID_H
88 #include <helpid.h>
89 #endif
90 #ifndef _GLOBALS_HRC
91 #include <globals.hrc>
92 #endif
93 #ifndef _FMTUI_HRC
94 #include <fmtui.hrc>
95 #endif
96 #include <SwStyleNameMapper.hxx>
97 #include <svx/svxids.hrc>
98 #include <svtools/stritem.hxx>
99 #include <svtools/aeitem.hxx>
100 #include <svtools/slstitm.hxx>
101 #include <svtools/eitem.hxx>
102 #include <svtools/intitem.hxx>
103 #include <svx/svxdlg.hxx>
104 #include <svx/dialogs.hrc>
105 #include <svx/flagsdef.hxx>
107 extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
109 /*--------------------------------------------------------------------
110 Beschreibung: Der Traeger des Dialoges
111 --------------------------------------------------------------------*/
113 SwTemplateDlg::SwTemplateDlg(Window* pParent,
114 SfxStyleSheetBase& rBase,
115 USHORT nRegion,
116 BOOL bColumn,
117 SwWrtShell* pActShell,
118 BOOL bNew ) :
119 SfxStyleDialog( pParent,
120 SW_RES(DLG_TEMPLATE_BASE + nRegion),
121 rBase,
122 FALSE,
123 0 ),
124 nType( nRegion ),
125 pWrtShell(pActShell),
126 bNewStyle(bNew)
128 FreeResource();
130 nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
131 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
132 DBG_ASSERT(pFact, "Dialogdiet fail!");
133 // TabPages zusammenfieseln
134 switch( nRegion )
136 // Zeichenvorlagen
137 case SFX_STYLE_FAMILY_CHAR:
139 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
140 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) , "GetTabPageRangesFunc fail!");
141 AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
143 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
144 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) , "GetTabPageRangesFunc fail!");
145 AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
147 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
148 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
149 AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
151 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
152 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
153 AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
155 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
156 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) , "GetTabPageRangesFunc fail!");
157 AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
159 SvtCJKOptions aCJKOptions;
160 if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
161 RemoveTabPage(TP_CHAR_TWOLN);
163 break;
164 // Absatzvorlagen
165 case SFX_STYLE_FAMILY_PARA:
167 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
168 DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
169 AddTabPage( TP_PARA_STD, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
171 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
172 DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
173 AddTabPage( TP_PARA_ALIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
175 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
176 DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
177 AddTabPage( TP_PARA_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
179 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
180 DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
181 AddTabPage( TP_PARA_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
183 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
184 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
185 AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
187 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
188 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
189 AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
191 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
192 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
193 AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
195 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
196 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
197 AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
200 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
201 DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
202 AddTabPage( TP_TABULATOR, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
205 AddTabPage(TP_NUMPARA, SwParagraphNumTabPage::Create,
206 SwParagraphNumTabPage::GetRanges);
207 AddTabPage(TP_DROPCAPS, SwDropCapsPage::Create,
208 SwDropCapsPage::GetRanges );
209 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
210 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
211 AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
212 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
213 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
214 AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
216 AddTabPage( TP_CONDCOLL, SwCondCollPage::Create,
217 SwCondCollPage::GetRanges );
218 if( (!bNewStyle && RES_CONDTXTFMTCOLL != ((SwDocStyleSheet&)rBase).GetCollection()->Which())
219 || nHtmlMode & HTMLMODE_ON )
220 RemoveTabPage(TP_CONDCOLL);
222 SvtCJKOptions aCJKOptions;
223 if(nHtmlMode & HTMLMODE_ON)
225 SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
226 if (!pHtmlOpt->IsPrintLayoutExtension())
227 RemoveTabPage(TP_PARA_EXT);
228 RemoveTabPage(TP_PARA_ASIAN);
229 RemoveTabPage(TP_TABULATOR);
230 RemoveTabPage(TP_NUMPARA);
231 RemoveTabPage(TP_CHAR_TWOLN);
232 if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
234 RemoveTabPage(TP_BACKGROUND);
235 RemoveTabPage(TP_DROPCAPS);
237 if(!(nHtmlMode & HTMLMODE_PARA_BORDER))
238 RemoveTabPage(TP_BORDER);
240 else
242 if(!aCJKOptions.IsAsianTypographyEnabled())
243 RemoveTabPage(TP_PARA_ASIAN);
244 if(!aCJKOptions.IsDoubleLinesEnabled())
245 RemoveTabPage(TP_CHAR_TWOLN);
248 break;
249 // Rahmenvorlagen
250 case SFX_STYLE_FAMILY_FRAME:
252 AddTabPage(TP_FRM_STD, SwFrmPage::Create,
253 SwFrmPage::GetRanges );
254 AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create,
255 SwFrmAddPage::GetRanges );
256 AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create,
257 SwWrapTabPage::GetRanges );
258 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
259 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
260 AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
261 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
262 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
263 AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
265 AddTabPage(TP_COLUMN, SwColumnPage::Create,
266 SwColumnPage::GetRanges );
268 AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
270 // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
271 /* SwFmtFrmSize aSize( (const SwFmtFrmSize&)rBase.
272 GetItemSet().Get(RES_FRM_SIZE));
273 if( !aSize.GetWidth() )
275 aSize.SetWidth( DFLT_WIDTH );
276 aSize.SetHeight( DFLT_HEIGHT );
277 rBase.GetItemSet().Put( aSize );
279 break;
281 // Seitenvorlagen
282 case SFX_STYLE_FAMILY_PAGE:
284 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
285 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
286 AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
287 AddTabPage(TP_HEADER_PAGE, String(SW_RES(STR_PAGE_HEADER)),
288 SvxHeaderPage::Create,
289 SvxHeaderPage::GetRanges );
290 AddTabPage(TP_FOOTER_PAGE, String(SW_RES(STR_PAGE_FOOTER)),
291 SvxFooterPage::Create,
292 SvxFooterPage::GetRanges );
293 if(bColumn)
294 SetCurPageId(TP_COLUMN);
296 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
297 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
298 AddTabPage(TP_PAGE_STD, String(SW_RES(STR_PAGE_STD)),
299 pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
300 pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ),
301 FALSE,
302 1 ); // nach der Verwalten-Page
303 if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
305 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
306 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
307 AddTabPage(TP_BORDER, String(SW_RES(STR_PAGE_BORDER)),
308 pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
309 AddTabPage(TP_COLUMN, String(SW_RES(STR_PAGE_COLUMN)),
310 SwColumnPage::Create,
311 SwColumnPage::GetRanges );
312 AddTabPage(TP_FOOTNOTE_PAGE, String(SW_RES(STR_PAGE_FOOTNOTE)),
313 SwFootNotePage::Create,
314 SwFootNotePage::GetRanges );
315 AddTabPage(TP_TEXTGRID_PAGE, String(SW_RES(STR_PAGE_TEXTGRID)),
316 SwTextGridPage::Create,
317 SwTextGridPage::GetRanges );
318 SvtCJKOptions aCJKOptions;
319 if(!aCJKOptions.IsAsianTypographyEnabled())
320 RemoveTabPage(TP_TEXTGRID_PAGE);
325 break;
326 // Numerierungsvorlagen
327 case SFX_STYLE_FAMILY_PSEUDO:
329 AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
330 AddTabPage( RID_SVXPAGE_PICK_BULLET );
331 AddTabPage( RID_SVXPAGE_PICK_NUM );
332 AddTabPage( RID_SVXPAGE_PICK_BMP);
333 AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
334 AddTabPage( RID_SVXPAGE_NUM_POSITION );
337 /* const SfxPoolItem* pItem;
338 if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState(
339 FN_PARAM_ACT_NUMBER, FALSE, &pItem ))
341 // pActNum = (ActNumberFormat*)((const SwPtrItem*)pItem)->GetValue();
345 break;
347 default:
348 ASSERT(!this, "Falsche Familie");
353 /*--------------------------------------------------------------------
354 Beschreibung:
355 --------------------------------------------------------------------*/
357 SwTemplateDlg::~SwTemplateDlg()
361 /*--------------------------------------------------------------------
362 Beschreibung:
363 --------------------------------------------------------------------*/
365 short SwTemplateDlg::Ok()
367 short nRet = SfxTabDialog::Ok();
368 if( RET_OK == nRet )
370 const SfxPoolItem *pOutItem, *pExItem;
371 if( SFX_ITEM_SET == pExampleSet->GetItemState(
372 SID_ATTR_NUMBERING_RULE, FALSE, &pExItem ) &&
373 ( !GetOutputItemSet() ||
374 SFX_ITEM_SET != GetOutputItemSet()->GetItemState(
375 SID_ATTR_NUMBERING_RULE, FALSE, &pOutItem ) ||
376 *pExItem != *pOutItem ))
378 if( GetOutputItemSet() )
379 ((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
380 else
381 nRet = RET_CANCEL;
384 else
385 //JP 09.01.98 Bug #46446#:
386 // das ist der Ok - Handler also muss auf OK defaultet werden!
387 nRet = RET_OK;
388 return nRet;
391 /*--------------------------------------------------------------------
392 Beschreibung:
393 --------------------------------------------------------------------*/
395 const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
397 SfxItemSet* pInSet = GetInputSetImpl();
398 pInSet->ClearItem();
399 pInSet->SetParent( &GetStyleSheet().GetItemSet() );
400 return pInSet;
403 /*--------------------------------------------------------------------
404 Beschreibung:
405 --------------------------------------------------------------------*/
407 void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
409 //Namen der Vorlagen und Metric setzen
410 String sNumCharFmt, sBulletCharFmt;
411 SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
412 SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
413 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
415 switch( nId )
417 case TP_CHAR_STD:
419 ASSERT(::GetActiveView(), "keine View aktiv");
421 SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
422 GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
424 aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
425 UINT32 nFlags = 0;
426 if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
427 nFlags = SVX_RELATIVE_MODE;
428 if( SFX_STYLE_FAMILY_CHAR == nType )
429 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
430 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
431 rPage.PageCreated(aSet);
433 break;
435 case TP_CHAR_EXT:
437 UINT32 nFlags = SVX_ENABLE_FLASH;
438 if( SFX_STYLE_FAMILY_CHAR == nType )
439 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
440 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
441 rPage.PageCreated(aSet);
443 break;
445 case TP_CHAR_POS:
446 if( SFX_STYLE_FAMILY_CHAR == nType )
448 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
449 rPage.PageCreated(aSet);
451 break;
453 case TP_CHAR_TWOLN:
454 if( SFX_STYLE_FAMILY_CHAR == nType )
456 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
457 rPage.PageCreated(aSet);
459 break;
461 case TP_PARA_STD:
463 if( rPage.GetItemSet().GetParent() )
465 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
466 aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
467 rPage.PageCreated(aSet);
471 break;
472 case TP_NUMPARA:
474 //-->#outlinelevel added by zhaojianwei
475 // handle if the current paragraph style is assigned to a list level of outline style,
476 SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
477 if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
479 ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
480 ((SwParagraphNumTabPage&)rPage).DisableNumbering();
481 }//<-end
482 ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
483 SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
484 pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
485 const SfxStyleSheetBase* pBase = pPool->First();
486 SvStringsSortDtor aNames;
487 while(pBase)
489 aNames.Insert(new String(pBase->GetName()));
490 pBase = pPool->Next();
492 for(USHORT i = 0; i < aNames.Count(); i++)
493 rBox.InsertEntry(*aNames.GetObject(i));
495 break;
496 case TP_PARA_ALIGN:
498 aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,TRUE));
499 rPage.PageCreated(aSet);
501 break;
503 case TP_FRM_STD:
504 ((SwFrmPage&)rPage).SetNewFrame( TRUE );
505 ((SwFrmPage&)rPage).SetFormatUsed( TRUE );
506 break;
508 case TP_FRM_ADD:
509 ((SwFrmAddPage&)rPage).SetFormatUsed(TRUE);
510 ((SwFrmAddPage&)rPage).SetNewFrame(TRUE);
511 break;
513 case TP_FRM_WRAP:
514 ((SwWrapTabPage&)rPage).SetFormatUsed( TRUE, FALSE );
515 break;
517 case TP_COLUMN:
518 if( nType == SFX_STYLE_FAMILY_FRAME )
519 ((SwColumnPage&)rPage).SetFrmMode(TRUE);
520 ((SwColumnPage&)rPage).SetFormatUsed( TRUE );
521 break;
523 case TP_BACKGROUND:
525 sal_Int32 nFlagType = 0;
526 if( SFX_STYLE_FAMILY_PARA == nType )
527 nFlagType |= SVX_SHOW_PARACTL;
528 if( SFX_STYLE_FAMILY_CHAR != nType )
529 nFlagType |= SVX_SHOW_SELECTOR;
530 if( SFX_STYLE_FAMILY_FRAME == nType )
531 nFlagType |= SVX_ENABLE_TRANSPARENCY;
532 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
533 rPage.PageCreated(aSet);
535 break;
536 case TP_CONDCOLL:
537 ((SwCondCollPage&)rPage).SetCollection(
538 ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
539 break;
541 case TP_PAGE_STD:
542 if(0 == (nHtmlMode & HTMLMODE_ON ))
544 List aList;
545 String* pNew = new String;
546 SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
547 aList.Insert( pNew, (ULONG)0 );
548 if( pWrtShell )
550 SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
551 GetView().GetDocShell()->GetStyleSheetPool();
552 pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
553 SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
554 while(pFirstStyle)
556 aList.Insert( new String(pFirstStyle->GetName()),
557 aList.Count());
558 pFirstStyle = pStyleSheetPool->Next();
561 aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
562 rPage.PageCreated(aSet);
563 for( USHORT i = (USHORT)aList.Count(); i; --i )
564 delete (String*)aList.Remove(i);
566 break;
568 case TP_MACRO_ASSIGN:
570 SfxAllItemSet aNewSet(*aSet.GetPool());
571 aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
572 if ( pWrtShell )
573 rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() );
574 rPage.PageCreated(aNewSet);
575 break;
578 case RID_SVXPAGE_PICK_NUM:
580 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
581 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
582 rPage.PageCreated(aSet);
584 break;
585 case RID_SVXPAGE_NUM_OPTIONS:
588 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
589 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
590 // Zeichenvorlagen sammeln
591 ListBox rCharFmtLB(this);
592 rCharFmtLB.Clear();
593 rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
594 SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
595 ::FillCharStyleListBox(rCharFmtLB, pDocShell);
596 List aList;
597 for(USHORT j = 0; j < rCharFmtLB.GetEntryCount(); j++)
600 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
602 aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
603 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
604 aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric)));
605 rPage.PageCreated(aSet);
606 for( USHORT i = (USHORT)aList.Count(); i; --i )
607 delete (XubString*)aList.Remove(i);
608 aList.Clear();
610 break;
611 case RID_SVXPAGE_NUM_POSITION:
613 SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
614 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
616 aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric)));
617 rPage.PageCreated(aSet);
619 break;
620 case RID_SVXPAGE_PICK_BULLET :
622 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
623 rPage.PageCreated(aSet);
625 break;
626 case TP_HEADER_PAGE:
627 if(0 == (nHtmlMode & HTMLMODE_ON ))
628 ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
629 break;
630 case TP_FOOTER_PAGE:
631 if(0 == (nHtmlMode & HTMLMODE_ON ))
632 ((SvxFooterPage&)rPage).EnableDynamicSpacing();
633 break;
634 case TP_BORDER :
635 if( SFX_STYLE_FAMILY_PARA == nType )
637 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
639 else if( SFX_STYLE_FAMILY_FRAME == nType )
641 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
643 rPage.PageCreated(aSet);
645 break;