xref: /aoo42x/main/sw/source/ui/fmtui/tmpdlg.cxx (revision b164f441)
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 							 const sal_uInt16 nSlot,
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 
254             //UUUU remove?
255             //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
256 
257             //UUUU add Area and Transparence TabPages
258             AddTabPage(RID_SVXPAGE_AREA);
259             AddTabPage(RID_SVXPAGE_TRANSPARENCE);
260 
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 ) );
264 
265 			AddTabPage(TP_COLUMN, 		SwColumnPage::Create,
266 										SwColumnPage::GetRanges );
267 
268 			AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
269 
270 		break;
271 		}
272 		// Seitenvorlagen
273 		case SFX_STYLE_FAMILY_PAGE:
274 		{
275             DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
276             DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
277             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
278             AddTabPage(TP_HEADER_PAGE,		String(SW_RES(STR_PAGE_HEADER)),
279                                             SvxHeaderPage::Create,
280                                             SvxHeaderPage::GetRanges );
281             AddTabPage(TP_FOOTER_PAGE,		String(SW_RES(STR_PAGE_FOOTER)),
282                                             SvxFooterPage::Create,
283                                             SvxFooterPage::GetRanges );
284             if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG )
285             {
286                 SetCurPageId(TP_COLUMN);
287             }
288             else if ( nSlot == FN_FORMAT_PAGE_SETTING_DLG )
289             {
290                 SetCurPageId(TP_PAGE_STD);
291             }
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         //UUUU do not remove; many other style dialog combinations still use the SfxTabPage
521         // for the SvxBrushItem (see RID_SVXPAGE_BACKGROUND)
522 		case TP_BACKGROUND:
523         {
524             sal_Int32 nFlagType = 0;
525             if( SFX_STYLE_FAMILY_PARA == nType )
526                 nFlagType |= SVX_SHOW_PARACTL;
527 			if( SFX_STYLE_FAMILY_CHAR != nType )
528                 nFlagType |= SVX_SHOW_SELECTOR;
529             if( SFX_STYLE_FAMILY_FRAME == nType )
530                 nFlagType |= SVX_ENABLE_TRANSPARENCY;
531             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
532             rPage.PageCreated(aSet);
533         }
534         break;
535 		case TP_CONDCOLL:
536 			((SwCondCollPage&)rPage).SetCollection(
537 				((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
538 			break;
539 
540 		case TP_PAGE_STD:
541 			if(0 == (nHtmlMode & HTMLMODE_ON ))
542 			{
543 				List aList;
544 				String* pNew = new String;
545 				SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
546 				aList.Insert( pNew, (sal_uLong)0 );
547 				if( pWrtShell )
548 				{
549 					SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
550 								GetView().GetDocShell()->GetStyleSheetPool();
551 					pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
552                     SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
553                     while(pFirstStyle)
554 					{
555                         aList.Insert( new String(pFirstStyle->GetName()),
556 										aList.Count());
557                         pFirstStyle = pStyleSheetPool->Next();
558 					}
559 				}
560                 aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
561                 rPage.PageCreated(aSet);
562 				for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
563 					delete (String*)aList.Remove(i);
564 			}
565 			break;
566 
567 		case TP_MACRO_ASSIGN:
568 		{
569 			SfxAllItemSet aNewSet(*aSet.GetPool());
570 			aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
571             if ( pWrtShell )
572                 rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
573 			rPage.PageCreated(aNewSet);
574 			break;
575 		}
576 
577 		case RID_SVXPAGE_PICK_NUM:
578 			{
579                 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
580                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
581                 rPage.PageCreated(aSet);
582 			}
583 		break;
584 		case RID_SVXPAGE_NUM_OPTIONS:
585 		{
586 
587             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
588             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
589 			// Zeichenvorlagen sammeln
590             ListBox rCharFmtLB(this);
591 			rCharFmtLB.Clear();
592 			rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
593 			SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
594 			::FillCharStyleListBox(rCharFmtLB,	pDocShell);
595 			List aList;
596             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
597 			{
598 
599 				 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
600 			}
601 			aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
602 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
603             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
604             rPage.PageCreated(aSet);
605 			for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
606 					delete (XubString*)aList.Remove(i);
607 			aList.Clear();
608 		}
609 		break;
610 		case RID_SVXPAGE_NUM_POSITION:
611 		{
612 			SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
613 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
614 
615             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
616             rPage.PageCreated(aSet);
617 		}
618 		break;
619 		case  RID_SVXPAGE_PICK_BULLET :
620 			{
621                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
622                 rPage.PageCreated(aSet);
623 			}
624 		break;
625         case  TP_HEADER_PAGE:
626             if(0 == (nHtmlMode & HTMLMODE_ON ))
627                 ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
628         break;
629         case  TP_FOOTER_PAGE:
630             if(0 == (nHtmlMode & HTMLMODE_ON ))
631                 ((SvxFooterPage&)rPage).EnableDynamicSpacing();
632         break;
633         case TP_BORDER :
634             if( SFX_STYLE_FAMILY_PARA == nType )
635 			{
636 				aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
637 			}
638             else if( SFX_STYLE_FAMILY_FRAME == nType )
639 			{
640 				aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
641 			}
642 			rPage.PageCreated(aSet);
643 
644         break;
645 
646         //UUUU inits for Area and Transparency TabPages
647         // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
648         // the color table) need to be added as items (e.g. SvxColorTableItem) to make
649         // these pages find the needed attributes for fill style suggestions.
650         // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
651         // demand, but could also be directly added from the DrawModel.
652         case RID_SVXPAGE_AREA:
653         {
654             SfxItemSet aNew(*aSet.GetPool(),
655                 SID_COLOR_TABLE, SID_BITMAP_LIST,
656                 SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);
657 
658             aNew.Put(GetStyleSheet().GetItemSet());
659 
660             // add flag for direct graphic content selection
661             aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
662 
663             rPage.PageCreated(aNew);
664         }
665         break;
666 
667         case RID_SVXPAGE_TRANSPARENCE:
668         {
669             rPage.PageCreated(GetStyleSheet().GetItemSet());
670         }
671         break;
672 	}
673 }
674 
675 // eof
676