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