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