xref: /aoo4110/main/sw/source/ui/fmtui/tmpdlg.cxx (revision b1cdbd2c)
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 
SwTemplateDlg(Window * pParent,SfxStyleSheetBase & rBase,sal_uInt16 nRegion,const sal_uInt16 nSlot,SwWrtShell * pActShell,sal_Bool bNew)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             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 		break;
264 		}
265 		// Seitenvorlagen
266 		case SFX_STYLE_FAMILY_PAGE:
267 		{
268             DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
269             DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
270             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
271             AddTabPage(TP_HEADER_PAGE,		String(SW_RES(STR_PAGE_HEADER)),
272                                             SvxHeaderPage::Create,
273                                             SvxHeaderPage::GetRanges );
274             AddTabPage(TP_FOOTER_PAGE,		String(SW_RES(STR_PAGE_FOOTER)),
275                                             SvxFooterPage::Create,
276                                             SvxFooterPage::GetRanges );
277             if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG )
278             {
279                 SetCurPageId(TP_COLUMN);
280             }
281             else if ( nSlot == FN_FORMAT_PAGE_SETTING_DLG )
282             {
283                 SetCurPageId(TP_PAGE_STD);
284             }
285 
286             DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
287             DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
288             AddTabPage(TP_PAGE_STD,			String(SW_RES(STR_PAGE_STD)),
289                                             pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
290                                             pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ),
291                                             sal_False,
292                                             1 ); // nach der Verwalten-Page
293             if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
294             {
295                 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
296                 DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
297                 AddTabPage(TP_BORDER, 			String(SW_RES(STR_PAGE_BORDER)),
298                                 pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
299                 AddTabPage(TP_COLUMN,			String(SW_RES(STR_PAGE_COLUMN)),
300                                                 SwColumnPage::Create,
301                                                 SwColumnPage::GetRanges );
302                 AddTabPage(TP_FOOTNOTE_PAGE,	String(SW_RES(STR_PAGE_FOOTNOTE)),
303                                                 SwFootNotePage::Create,
304                                                 SwFootNotePage::GetRanges );
305                 AddTabPage(TP_TEXTGRID_PAGE,    String(SW_RES(STR_PAGE_TEXTGRID)),
306                                                 SwTextGridPage::Create,
307                                                 SwTextGridPage::GetRanges );
308                 SvtCJKOptions aCJKOptions;
309                 if(!aCJKOptions.IsAsianTypographyEnabled())
310                     RemoveTabPage(TP_TEXTGRID_PAGE);
311             }
312 
313 
314         }
315         break;
316         // Numerierungsvorlagen
317 		case SFX_STYLE_FAMILY_PSEUDO:
318 		{
319             AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
320             AddTabPage( RID_SVXPAGE_PICK_BULLET );
321             AddTabPage( RID_SVXPAGE_PICK_NUM );
322             AddTabPage( RID_SVXPAGE_PICK_BMP);
323             AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
324             AddTabPage( RID_SVXPAGE_NUM_POSITION );
325 
326 
327 /*			const SfxPoolItem* pItem;
328 			if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState(
329 				FN_PARAM_ACT_NUMBER, sal_False, &pItem ))
330 			{
331 //				pActNum = (ActNumberFormat*)((const SwPtrItem*)pItem)->GetValue();
332 			}
333 */
334 		}
335 		break;
336 
337 		default:
338 			ASSERT(!this, "Falsche Familie");
339 
340 	}
341 }
342 
343 /*--------------------------------------------------------------------
344 	Beschreibung:
345  --------------------------------------------------------------------*/
346 
~SwTemplateDlg()347 SwTemplateDlg::~SwTemplateDlg()
348 {
349 }
350 
351 /*--------------------------------------------------------------------
352 	Beschreibung:
353  --------------------------------------------------------------------*/
354 
Ok()355 short SwTemplateDlg::Ok()
356 {
357 	short nRet = SfxTabDialog::Ok();
358 	if( RET_OK == nRet )
359 	{
360 		const SfxPoolItem *pOutItem, *pExItem;
361 		if( SFX_ITEM_SET == pExampleSet->GetItemState(
362 			SID_ATTR_NUMBERING_RULE, sal_False, &pExItem ) &&
363 			( !GetOutputItemSet() ||
364 			SFX_ITEM_SET != GetOutputItemSet()->GetItemState(
365 			SID_ATTR_NUMBERING_RULE, sal_False, &pOutItem ) ||
366 			*pExItem != *pOutItem ))
367 		{
368 			if( GetOutputItemSet() )
369 				((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
370 			else
371 				nRet = RET_CANCEL;
372 		}
373 	}
374 	else
375 		//JP 09.01.98 Bug #46446#:
376 		// das ist der Ok - Handler also muss auf OK defaultet werden!
377 		nRet = RET_OK;
378 	return nRet;
379 }
380 
381 /*--------------------------------------------------------------------
382 	Beschreibung:
383  --------------------------------------------------------------------*/
384 
GetRefreshedSet()385 const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
386 {
387 	SfxItemSet* pInSet = GetInputSetImpl();
388 	pInSet->ClearItem();
389 	pInSet->SetParent( &GetStyleSheet().GetItemSet() );
390 	return pInSet;
391 }
392 
393 /*--------------------------------------------------------------------
394 	Beschreibung:
395  --------------------------------------------------------------------*/
396 
PageCreated(sal_uInt16 nId,SfxTabPage & rPage)397 void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
398 {
399 	//Namen der Vorlagen und Metric setzen
400 	String sNumCharFmt, sBulletCharFmt;
401 	SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
402 	SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
403     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
404 
405 	switch( nId )
406 	{
407 		case TP_CHAR_STD:
408 			{
409 				ASSERT(::GetActiveView(), "keine View aktiv");
410 
411 				SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
412 					GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
413 
414 				aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
415 				sal_uInt32 nFlags = 0;
416 				if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
417 					nFlags = SVX_RELATIVE_MODE;
418                 if( SFX_STYLE_FAMILY_CHAR == nType )
419 					nFlags = nFlags|SVX_PREVIEW_CHARACTER;
420 				aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
421 				rPage.PageCreated(aSet);
422             }
423 			break;
424 
425 		case TP_CHAR_EXT:
426 			{
427 			sal_uInt32 nFlags = SVX_ENABLE_FLASH;
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);
432 			}
433 			break;
434 
435         case TP_CHAR_POS:
436             if( SFX_STYLE_FAMILY_CHAR == nType )
437 			{
438 				aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
439 				rPage.PageCreated(aSet);
440 			}
441         break;
442 
443         case TP_CHAR_TWOLN:
444             if( SFX_STYLE_FAMILY_CHAR == nType )
445 			{
446 				aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
447 				rPage.PageCreated(aSet);
448 			}
449         break;
450 
451         case TP_PARA_STD:
452 			{
453 				if( rPage.GetItemSet().GetParent() )
454 				{
455                     aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
456 					aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
457                     rPage.PageCreated(aSet);
458 				}
459 
460 			}
461 			break;
462 		case TP_NUMPARA:
463 			{
464 				//-->#outlinelevel added by zhaojianwei
465 				//  handle if the current paragraph style is assigned to a list level of outline style,
466 				SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
467 				if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
468 				{
469 					((SwParagraphNumTabPage&)rPage).DisableOutline() ;
470 					((SwParagraphNumTabPage&)rPage).DisableNumbering();
471 				}//<-end
472 				ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
473 				SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
474 				pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
475 				const SfxStyleSheetBase* pBase = pPool->First();
476                 SvStringsSortDtor aNames;
477 				while(pBase)
478 				{
479 					aNames.Insert(new String(pBase->GetName()));
480 					pBase = pPool->Next();
481 				}
482 				for(sal_uInt16 i = 0; i < aNames.Count(); i++)
483 					rBox.InsertEntry(*aNames.GetObject(i));
484 		}
485 		break;
486 		case TP_PARA_ALIGN:
487 			{
488 				aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
489                 rPage.PageCreated(aSet);
490 			}
491 			break;
492 
493 		case TP_FRM_STD:
494 			((SwFrmPage&)rPage).SetNewFrame( sal_True );
495 			((SwFrmPage&)rPage).SetFormatUsed( sal_True );
496 			break;
497 
498 		case TP_FRM_ADD:
499 			((SwFrmAddPage&)rPage).SetFormatUsed(sal_True);
500 			((SwFrmAddPage&)rPage).SetNewFrame(sal_True);
501 			break;
502 
503 		case TP_FRM_WRAP:
504 			((SwWrapTabPage&)rPage).SetFormatUsed( sal_True, sal_False );
505 			break;
506 
507 		case TP_COLUMN:
508 			if( nType == SFX_STYLE_FAMILY_FRAME )
509 				((SwColumnPage&)rPage).SetFrmMode(sal_True);
510 			((SwColumnPage&)rPage).SetFormatUsed( sal_True );
511 			break;
512 
513 		case TP_BACKGROUND:
514         {
515             sal_Int32 nFlagType = 0;
516             if( SFX_STYLE_FAMILY_PARA == nType )
517                 nFlagType |= SVX_SHOW_PARACTL;
518 			if( SFX_STYLE_FAMILY_CHAR != nType )
519                 nFlagType |= SVX_SHOW_SELECTOR;
520             if( SFX_STYLE_FAMILY_FRAME == nType )
521                 nFlagType |= SVX_ENABLE_TRANSPARENCY;
522             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
523             rPage.PageCreated(aSet);
524         }
525         break;
526 		case TP_CONDCOLL:
527 			((SwCondCollPage&)rPage).SetCollection(
528 				((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
529 			break;
530 
531 		case TP_PAGE_STD:
532 			if(0 == (nHtmlMode & HTMLMODE_ON ))
533 			{
534 				List aList;
535 				String* pNew = new String;
536 				SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
537 				aList.Insert( pNew, (sal_uLong)0 );
538 				if( pWrtShell )
539 				{
540 					SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
541 								GetView().GetDocShell()->GetStyleSheetPool();
542 					pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
543                     SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
544                     while(pFirstStyle)
545 					{
546                         aList.Insert( new String(pFirstStyle->GetName()),
547 										aList.Count());
548                         pFirstStyle = pStyleSheetPool->Next();
549 					}
550 				}
551                 aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
552                 rPage.PageCreated(aSet);
553 				for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
554 					delete (String*)aList.Remove(i);
555 			}
556 			break;
557 
558 		case TP_MACRO_ASSIGN:
559 		{
560 			SfxAllItemSet aNewSet(*aSet.GetPool());
561 			aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
562             if ( pWrtShell )
563                 rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
564 			rPage.PageCreated(aNewSet);
565 			break;
566 		}
567 
568 		case RID_SVXPAGE_PICK_NUM:
569 			{
570                 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
571                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
572                 rPage.PageCreated(aSet);
573 			}
574 		break;
575 		case RID_SVXPAGE_NUM_OPTIONS:
576 		{
577 
578             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
579             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
580 			// Zeichenvorlagen sammeln
581             ListBox rCharFmtLB(this);
582 			rCharFmtLB.Clear();
583 			rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
584 			SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
585 			::FillCharStyleListBox(rCharFmtLB,	pDocShell);
586 			List aList;
587             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
588 			{
589 
590 				 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
591 			}
592 			aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
593 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
594             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
595             rPage.PageCreated(aSet);
596 			for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
597 					delete (XubString*)aList.Remove(i);
598 			aList.Clear();
599 		}
600 		break;
601 		case RID_SVXPAGE_NUM_POSITION:
602 		{
603 			SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
604 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
605 
606             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
607             rPage.PageCreated(aSet);
608 		}
609 		break;
610 		case  RID_SVXPAGE_PICK_BULLET :
611 			{
612                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
613                 rPage.PageCreated(aSet);
614 			}
615 		break;
616         case  TP_HEADER_PAGE:
617             if(0 == (nHtmlMode & HTMLMODE_ON ))
618                 ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
619         break;
620         case  TP_FOOTER_PAGE:
621             if(0 == (nHtmlMode & HTMLMODE_ON ))
622                 ((SvxFooterPage&)rPage).EnableDynamicSpacing();
623         break;
624         case TP_BORDER :
625             if( SFX_STYLE_FAMILY_PARA == nType )
626 			{
627 				aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
628 			}
629             else if( SFX_STYLE_FAMILY_FRAME == nType )
630 			{
631 				aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
632 			}
633 			rPage.PageCreated(aSet);
634 
635         break;
636 	}
637 }
638 
639 
640 
641