xref: /trunk/main/sw/source/ui/misc/num.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 #ifdef SW_DLLIMPLEMENTATION
27 #undef SW_DLLIMPLEMENTATION
28 #endif
29 
30 
31 
32 #define USE_NUMTABPAGES
33 #define _NUM_CXX
34 #include <hintids.hxx>
35 
36 #ifndef _MSGBOX_HXX //autogen
37 #include <vcl/msgbox.hxx>
38 #endif
39 #include <tools/urlobj.hxx>
40 #include <sfx2/app.hxx>
41 #include <sfx2/imgmgr.hxx>
42 #include <svx/gallery.hxx>
43 #include <editeng/brshitem.hxx>
44 #include <editeng/lrspitem.hxx>
45 #include <editeng/numitem.hxx>
46 #include <swvset.hxx>
47 #include <swmodule.hxx>
48 #include <wrtsh.hxx>
49 #ifndef _DOCSH_HXX
50 #include <docsh.hxx>
51 #endif
52 #ifndef _WVIEW_HXX
53 #include <wview.hxx>
54 #endif
55 #include <uitool.hxx>
56 #ifndef _WDOCSH_HXX
57 #include <wdocsh.hxx>
58 #endif
59 #include <uiitems.hxx>
60 #include <docstyle.hxx>
61 #include <charfmt.hxx>
62 #include <uinums.hxx>
63 #include <poolfmt.hxx>
64 #include <shellres.hxx>
65 #include <outline.hxx>
66 #include <num.hxx>
67 #include <viewopt.hxx>
68 #include <frmmgr.hxx>
69 
70 #ifndef _MISC_HRC
71 #include <misc.hrc>
72 #endif
73 #ifndef _FRMUI_HRC
74 #include <frmui.hrc>
75 #endif
76 #ifndef _NUM_HRC
77 #include <num.hrc>
78 #endif
79 #ifndef _GLOBALS_HRC
80 #include <globals.hrc>
81 #endif
82 #ifndef _HELPID_H
83 #include <helpid.h>
84 #endif
85 #include <SwStyleNameMapper.hxx>
86 #include <svx/svxids.hrc>
87 #include <svx/dialogs.hrc>
88 #include <svl/stritem.hxx>
89 #include <svl/aeitem.hxx>
90 #include <svl/slstitm.hxx>
91 
92 static sal_Bool bLastRelative = sal_False;
93 
94 /*-----------------03.12.97 10:02-------------------
95 
96 --------------------------------------------------*/
97 SwNumPositionTabPage::SwNumPositionTabPage(Window* pParent,
98 							   const SfxItemSet& rSet) :
99 	SfxTabPage( pParent, SW_RES( TP_NUM_POSITION ), rSet ),
100     aLevelFL(       this, SW_RES(FL_LEVEL    )),
101     aLevelLB(       this, SW_RES(LB_LEVEL   )),
102     aPositionFL(    this, SW_RES(FL_POSITION )),
103 
104     aDistBorderFT(  this, SW_RES(FT_BORDERDIST  )),
105     aDistBorderMF(  this, SW_RES(MF_BORDERDIST  )),
106     aRelativeCB(    this, SW_RES(CB_RELATIVE     )),
107     aIndentFT(      this, SW_RES(FT_INDENT       )),
108     aIndentMF(      this, SW_RES(MF_INDENT       )),
109     aDistNumFT(     this, SW_RES(FT_NUMDIST     )),
110     aDistNumMF(     this, SW_RES(MF_NUMDIST     )),
111     aAlignFT(       this, SW_RES(FT_ALIGN    )),
112     aAlignLB(       this, SW_RES(LB_ALIGN    )),
113     // --> OD 2008-02-01 #newlistlevelattrs#
114     aLabelFollowedByFT( this, SW_RES(FT_LABEL_FOLLOWED_BY) ),
115     aLabelFollowedByLB( this, SW_RES(LB_LABEL_FOLLOWED_BY) ),
116     aListtabFT( this, SW_RES(FT_LISTTAB) ),
117     aListtabMF( this, SW_RES(MF_LISTTAB) ),
118     aAlign2FT( this, SW_RES(FT_ALIGN_2) ),
119     aAlign2LB( this, SW_RES(LB_ALIGN_2) ),
120     aAlignedAtFT( this, SW_RES(FT_ALIGNED_AT) ),
121     aAlignedAtMF( this, SW_RES(MF_ALIGNED_AT) ),
122     aIndentAtFT( this, SW_RES(FT_INDENT_AT) ),
123     aIndentAtMF( this, SW_RES(MF_INDENT_AT) ),
124     // <--
125     aStandardPB(    this, SW_RES(PB_STANDARD        )),
126 
127     aPreviewWIN(    this, SW_RES(WIN_PREVIEW     )),
128 
129     pActNum(0),
130     pSaveNum(0),
131     pWrtSh(0),
132 	pOutlineDlg(0),
133     bPreset( sal_False ),
134     bInInintControl(sal_False),
135     // --> OD 2008-02-01 #newlistlevelattrs#
136     bLabelAlignmentPosAndSpaceModeActive( false )
137     // <--
138 {
139 	FreeResource();
140 	SetExchangeSupport();
141 	aPreviewWIN.SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
142 
143 	aStandardPB.SetAccessibleRelationMemberOf(&aPositionFL);
144 
145 
146 	aRelativeCB.Check();
147 	aAlignLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
148     // --> OD 2008-02-01 #newlistlevelattrs#
149     aAlign2LB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
150     for ( sal_uInt16 i = 0; i < aAlignLB.GetEntryCount(); ++i )
151     {
152         aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) );
153     }
154     aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() );
155     aAlign2FT.SetText( aAlignFT.GetText() );
156     // <--
157 
158 	Link aLk = LINK(this, SwNumPositionTabPage, DistanceHdl);
159 	aDistBorderMF.SetUpHdl(aLk);
160 	aDistNumMF.SetUpHdl(aLk);
161 	aIndentMF.SetUpHdl(aLk);
162 	aDistBorderMF.SetDownHdl(aLk);
163 	aDistNumMF.SetDownHdl(aLk);
164 	aIndentMF.SetDownHdl(aLk);
165 	aDistBorderMF.SetLoseFocusHdl(aLk);
166 	aDistNumMF.SetLoseFocusHdl(aLk);
167 	aIndentMF.SetLoseFocusHdl(aLk);
168 
169     // --> OD 2008-02-01 #newlistlevelattrs#
170     aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() );
171     aLabelFollowedByLB.SetSelectHdl( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) );
172 
173     aLk = LINK(this, SwNumPositionTabPage, ListtabPosHdl_Impl);
174     aListtabMF.SetUpHdl(aLk);
175     aListtabMF.SetDownHdl(aLk);
176     aListtabMF.SetLoseFocusHdl(aLk);
177 
178     aLk = LINK(this, SwNumPositionTabPage, AlignAtHdl_Impl);
179     aAlignedAtMF.SetUpHdl(aLk);
180     aAlignedAtMF.SetDownHdl(aLk);
181     aAlignedAtMF.SetLoseFocusHdl(aLk);
182 
183     aLk = LINK(this, SwNumPositionTabPage, IndentAtHdl_Impl);
184     aIndentAtMF.SetUpHdl(aLk);
185     aIndentAtMF.SetDownHdl(aLk);
186     aIndentAtMF.SetLoseFocusHdl(aLk);
187     // <--
188 
189 	aLevelLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, LevelHdl));
190 	aRelativeCB.SetClickHdl(LINK(this, SwNumPositionTabPage, RelativeHdl));
191 	aStandardPB.SetClickHdl(LINK(this, SwNumPositionTabPage, StandardHdl));
192 
193 	// Ebenen einfuegen
194 	for(sal_uInt16 i = 1; i <= MAXLEVEL; i++)
195 		aLevelLB.InsertEntry(String::CreateFromInt32(i));
196 	String sEntry(String::CreateFromAscii("1 - "));
197 	sEntry += String::CreateFromInt32(MAXLEVEL);
198 	aLevelLB.InsertEntry(sEntry);
199 	aLevelLB.SelectEntry(sEntry);
200 
201 	aRelativeCB.Check(bLastRelative);
202 	aPreviewWIN.SetPositionMode();
203 }
204 /*-----------------03.12.97 10:02-------------------
205 
206 --------------------------------------------------*/
207 SwNumPositionTabPage::~SwNumPositionTabPage()
208 {
209 	delete pActNum;
210 }
211 /*-----------------03.12.97 10:06-------------------
212 
213 --------------------------------------------------*/
214 void SwNumPositionTabPage::InitControls()
215 {
216 	bInInintControl	= sal_True;
217     // --> OD 2008-02-01 #newlistlevelattrs#
218     const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
219                            aRelativeCB.IsEnabled() && aRelativeCB.IsChecked();
220     const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 &&
221                                   USHRT_MAX != nActNumLvl;
222 
223     aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
224                           ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
225     aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
226                           ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
227     // <--
228 
229     bool bSetDistEmpty = false;
230     bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
231     bool bSameDist      = !bLabelAlignmentPosAndSpaceModeActive;
232     bool bSameIndent    = !bLabelAlignmentPosAndSpaceModeActive;
233     bool bSameAdjust    = true;
234 
235     // --> OD 2008-02-01 #newlistlevelattrs#
236     bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
237     bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
238     bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
239     bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
240     // <--
241 
242 	const SwNumFmt* aNumFmtArr[MAXLEVEL];
243 	const SwFmtVertOrient* pFirstOrient = 0;
244 	sal_uInt16 nMask = 1;
245 	sal_uInt16 nLvl = USHRT_MAX;
246 	long nFirstBorderText = 0;
247 	long nFirstBorderTextRelative = -1;
248 	for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
249 	{
250 		aNumFmtArr[i] = &pActNum->Get(i);
251 		if(nActNumLvl & nMask)
252 		{
253 			if(USHRT_MAX == nLvl)
254 			{
255 				nLvl = i;
256                 // --> OD 2008-02-01 #newlistlevelattrs#
257                 if ( !bLabelAlignmentPosAndSpaceModeActive )
258                 {
259                     pFirstOrient = aNumFmtArr[nLvl]->GetGraphicOrientation();
260                     nFirstBorderText = nLvl > 0 ?
261                         aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset() -
262                         aNumFmtArr[nLvl - 1]->GetAbsLSpace() + aNumFmtArr[nLvl - 1]->GetFirstLineOffset():
263                             aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset();
264                 }
265                 // <--
266 			}
267 
268 			if( i > nLvl)
269 			{
270                 // --> OD 2008-02-01 #newlistlevelattrs#
271                 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
272                 if ( !bLabelAlignmentPosAndSpaceModeActive )
273                 {
274                     if(bRelative)
275                     {
276                         if(nFirstBorderTextRelative == -1)
277                             nFirstBorderTextRelative =
278                             (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
279                             aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
280                         else
281                             bSameDistBorderNum &= nFirstBorderTextRelative ==
282                             (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
283                             aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
284 
285                     }
286                     else
287                     {
288                         bSameDistBorderNum &=
289                         aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
290                         aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
291                     }
292 
293                     bSameDist       &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
294                     bSameIndent     &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
295                 }
296                 else
297                 {
298                     bSameLabelFollowedBy &=
299                         aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
300                     bSameListtab &=
301                         aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
302                     bSameAlignAt &=
303                         ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
304                             == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
305                     bSameIndentAt &=
306                         aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
307                 }
308                 // <--
309 
310 			}
311 		}
312 		nMask <<= 1;
313 
314 	}
315 	if(bSameDistBorderNum)
316 	{
317 		long nDistBorderNum;
318 		if(bRelative)
319 		{
320 			nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
321 			if(nLvl)
322 				nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
323 		}
324 		else
325 		{
326 			nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
327 		}
328 		aDistBorderMF.SetValue(aDistBorderMF.Normalize(nDistBorderNum),FUNIT_TWIP);
329 	}
330 	else
331 		bSetDistEmpty = sal_True;
332 
333 	if(bSameDist)
334 		aDistNumMF	 .SetValue(aDistNumMF.Normalize(aNumFmtArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP);
335 	else
336 		aDistNumMF.SetText(aEmptyStr);
337 	if(bSameIndent)
338 		aIndentMF.SetValue(aIndentMF.Normalize(-aNumFmtArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP);
339 	else
340 		aIndentMF.SetText(aEmptyStr);
341 
342 	if(bSameAdjust)
343 	{
344 		sal_uInt16 nPos = 1; // zentriert
345 		if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
346 			nPos = 0;
347 		else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
348 			nPos = 2;
349 		aAlignLB.SelectEntryPos(nPos);
350         // --> OD 2008-02-01 #newlistlevelattrs#
351         aAlign2LB.SelectEntryPos( nPos );
352         // <--
353 	}
354 	else
355 	{
356 		aAlignLB.SetNoSelection();
357         // --> OD 2008-02-01 #newlistlevelattrs#
358         aAlign2LB.SetNoSelection();
359         // <--
360 	}
361 
362     // --> OD 2008-02-01 #newlistlevelattrs#
363     if ( bSameLabelFollowedBy )
364     {
365         sal_uInt16 nPos = 0; // LISTTAB
366         if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
367         {
368             nPos = 1;
369         }
370         else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
371         {
372             nPos = 2;
373         }
374         aLabelFollowedByLB.SelectEntryPos( nPos );
375     }
376     else
377     {
378         aLabelFollowedByLB.SetNoSelection();
379     }
380 
381     if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
382     {
383         aListtabFT.Enable( true );
384         aListtabMF.Enable( true );
385         if ( bSameListtab )
386         {
387             aListtabMF.SetValue(aListtabMF.Normalize(aNumFmtArr[nLvl]->GetListtabPos()),FUNIT_TWIP);
388         }
389         else
390         {
391             aListtabMF.SetText(aEmptyStr);
392         }
393     }
394     else
395     {
396         aListtabFT.Enable( false );
397         aListtabMF.Enable( false );
398         aListtabMF.SetText(aEmptyStr);
399     }
400 
401     if ( bSameAlignAt )
402     {
403         aAlignedAtMF.SetValue(
404             aAlignedAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt() +
405                                     aNumFmtArr[nLvl]->GetFirstLineIndent()),
406             FUNIT_TWIP );
407     }
408     else
409     {
410         aAlignedAtMF.SetText(aEmptyStr);
411     }
412 
413     if ( bSameIndentAt )
414     {
415         aIndentAtMF.SetValue(
416             aIndentAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt()), FUNIT_TWIP );
417     }
418     else
419     {
420         aIndentAtMF.SetText(aEmptyStr);
421     }
422     // <--
423 
424 	if(sal_True == bSetDistEmpty)
425 		aDistBorderMF.SetText(aEmptyStr);
426 
427 	bInInintControl	= sal_False;
428 }
429 
430 /*-----------------03.12.97 10:02-------------------
431 
432 --------------------------------------------------*/
433 void SwNumPositionTabPage::ActivatePage(const SfxItemSet& )
434 {
435 	const SfxPoolItem* pItem;
436 	sal_uInt16 nTmpNumLvl =
437 		pOutlineDlg ? pOutlineDlg->GetActNumLevel() : 0;
438 	const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
439 	if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, sal_False, &pItem))
440 	{
441 		bPreset = ((const SfxBoolItem*)pItem)->GetValue();
442 	}
443 	//
444 	bModified = (!pActNum->GetNumFmt( 0 ) || bPreset);
445 	if(*pActNum != *pSaveNum ||
446 		nActNumLvl != nTmpNumLvl )
447 	{
448 		*pActNum = *pSaveNum;
449 		nActNumLvl = nTmpNumLvl;
450 		sal_uInt16 nMask = 1;
451 		aLevelLB.SetUpdateMode(sal_False);
452 		aLevelLB.SetNoSelection();
453 		aLevelLB.SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX);
454 		if(nActNumLvl != USHRT_MAX)
455 			for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
456 			{
457 				if(nActNumLvl & nMask)
458 					aLevelLB.SelectEntryPos( i, sal_True);
459 				nMask <<= 1 ;
460 			}
461 		aLevelLB.SetUpdateMode(sal_True);
462 
463         // --> OD 2008-02-01 #newlistlevelattrs#
464         InitPosAndSpaceMode();
465         ShowControlsDependingOnPosAndSpaceMode();
466         // <--
467 
468         InitControls();
469 	}
470 	aRelativeCB.Enable(1 != nActNumLvl);
471 	aPreviewWIN.Invalidate();
472 }
473 
474 /*-----------------03.12.97 10:02-------------------
475 
476 --------------------------------------------------*/
477 int  SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
478 {
479     SwOutlineTabDialog::SetActNumLevel(nActNumLvl);
480     if(_pSet)
481         FillItemSet(*_pSet);
482 	return sal_True;
483 
484 }
485 
486 /*-----------------03.12.97 10:02-------------------
487 
488 --------------------------------------------------*/
489 sal_Bool SwNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
490 {
491 	if(pOutlineDlg)
492 		*pOutlineDlg->GetNumRule() = *pActNum;
493 	else if(bModified && pActNum)
494 	{
495 		*pSaveNum = *pActNum;
496 		rSet.Put(SwUINumRuleItem( *pSaveNum ));
497 		rSet.Put(SfxBoolItem(FN_PARAM_NUM_PRESET, sal_False));
498 	}
499 	return bModified;
500 }
501 
502 /*-----------------03.12.97 10:02-------------------
503 
504 --------------------------------------------------*/
505 void SwNumPositionTabPage::Reset( const SfxItemSet& rSet )
506 {
507 	const SfxPoolItem* pItem;
508 	if(pOutlineDlg)
509 	{
510 		pSaveNum = pOutlineDlg->GetNumRule();
511 		aLevelLB.EnableMultiSelection(sal_False);
512 	}
513 	else if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_ACT_NUMBER, sal_False, &pItem))
514 		pSaveNum = ((SwUINumRuleItem*)pItem)->GetNumRule();
515 
516     nActNumLvl = SwOutlineTabDialog::GetActNumLevel();
517 	sal_uInt16 nMask = 1;
518 	aLevelLB.SetUpdateMode(sal_False);
519 	aLevelLB.SetNoSelection();
520 	if(nActNumLvl == USHRT_MAX)
521 	{
522 		aLevelLB.SelectEntryPos( MAXLEVEL, sal_True);
523 	}
524 	else
525 		for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
526 		{
527 			if(nActNumLvl & nMask)
528 				aLevelLB.SelectEntryPos( i, sal_True);
529 			nMask <<= 1;
530 		}
531 	aLevelLB.SetUpdateMode(sal_True);
532 
533 	if(!pActNum)
534 		pActNum = new  SwNumRule(*pSaveNum);
535 	else if(*pSaveNum != *pActNum)
536 		*pActNum = *pSaveNum;
537 	aPreviewWIN.SetNumRule(pActNum);
538     // --> OD 2008-02-01 #newlistlevelattrs#
539     InitPosAndSpaceMode();
540     ShowControlsDependingOnPosAndSpaceMode();
541     // <--
542 	InitControls();
543 	bModified = sal_False;
544 }
545 
546 // --> OD 2008-01-11 #newlistlevelattrs#
547 void SwNumPositionTabPage::InitPosAndSpaceMode()
548 {
549     if ( pActNum == 0 )
550     {
551         DBG_ASSERT( false,
552                 "<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
553         return;
554     }
555 
556     SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
557                                             SvxNumberFormat::LABEL_ALIGNMENT;
558     sal_uInt16 nMask = 1;
559     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
560     {
561         if(nActNumLvl & nMask)
562         {
563             SvxNumberFormat aNumFmt( pActNum->Get(i) );
564             ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
565             if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
566             {
567                 break;
568             }
569         }
570         nMask <<= 1;
571     }
572 
573     bLabelAlignmentPosAndSpaceModeActive =
574                     ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
575 }
576 
577 void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
578 {
579     aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
580     aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
581     aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
582     aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
583     aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
584     aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
585     aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
586     aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
587     aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive );
588 
589     aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive );
590     aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive );
591     aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive );
592     aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive );
593     aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive );
594     aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive );
595     aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
596     aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
597     aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
598     aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
599 }
600 // <--
601 
602 /*-----------------03.12.97 10:02-------------------
603 
604 --------------------------------------------------*/
605 SfxTabPage*	SwNumPositionTabPage::Create( Window* pParent,
606 								const SfxItemSet& rAttrSet)
607 {
608 	return new SwNumPositionTabPage(pParent, rAttrSet);
609 }
610 
611 /*-----------------04.12.97 12:51-------------------
612 
613 --------------------------------------------------*/
614 void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
615 {
616 	pWrtSh = pSh;
617 
618     // --> OD 2008-02-01 #newlistlevelattrs#
619     const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width();
620 
621     aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_TWIP );
622     aDistNumMF   .SetMax(aDistNumMF   .Normalize( nWidth ), FUNIT_TWIP );
623     aIndentMF    .SetMax(aIndentMF    .Normalize( nWidth ), FUNIT_TWIP );
624     // --> OD 2008-02-18 #newlistlevelattrs#
625     aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_TWIP );
626     aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_TWIP );
627     aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_TWIP );
628     // <--
629     const SwTwips nLast2 = nWidth /2;
630     aDistBorderMF.SetLast( aDistBorderMF.Normalize(   nLast2 ), FUNIT_TWIP );
631     aDistNumMF   .SetLast( aDistNumMF     .Normalize( nLast2 ), FUNIT_TWIP );
632     aIndentMF    .SetLast( aIndentMF      .Normalize( nLast2 ), FUNIT_TWIP );
633     // --> OD 2008-02-18 #newlistlevelattrs#
634     aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_TWIP );
635     aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_TWIP );
636     aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_TWIP );
637     // <--
638     // <--
639 
640     const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE);
641 	aPreviewWIN.SetPageWidth(rPrtRect.Width());
642 	FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView()));
643 	if(eMetric == FUNIT_MM)
644 	{
645 		aDistBorderMF .SetDecimalDigits(1);
646 		aDistNumMF	  .SetDecimalDigits(1);
647 		aIndentMF	  .SetDecimalDigits(1);
648         // --> OD 2008-02-18 #newlistlevelattrs#
649         aListtabMF.SetDecimalDigits(1);
650         aAlignedAtMF.SetDecimalDigits(1);
651         aIndentAtMF.SetDecimalDigits(1);
652         // <--
653 	}
654 	aDistBorderMF .SetUnit( eMetric );
655 	aDistNumMF	  .SetUnit( eMetric );
656 	aIndentMF	  .SetUnit( eMetric );
657     // --> OD 2008-02-18 #newlistlevelattrs#
658     aListtabMF.SetUnit( eMetric );
659     aAlignedAtMF.SetUnit( eMetric );
660     aIndentAtMF.SetUnit( eMetric );
661     // <--
662 }
663 
664 /*-----------------03.12.97 11:06-------------------
665 
666 --------------------------------------------------*/
667 IMPL_LINK( SwNumPositionTabPage, EditModifyHdl, Edit *, EMPTYARG )
668 {
669 	sal_uInt16 nMask = 1;
670 	for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
671 	{
672 		if(nActNumLvl & nMask)
673 		{
674 			SwNumFmt aNumFmt(pActNum->Get(i));
675 
676             // --> OD 2008-02-01 #newlistlevelattrs#
677             const sal_uInt16 nPos = aAlignLB.IsVisible()
678                                 ? aAlignLB.GetSelectEntryPos()
679                                 : aAlign2LB.GetSelectEntryPos();
680             // <--
681 			SvxAdjust eAdjust = SVX_ADJUST_CENTER;
682 			if(nPos == 0)
683 				eAdjust = SVX_ADJUST_LEFT;
684 			else if(nPos == 2)
685 				eAdjust = SVX_ADJUST_RIGHT;
686 			aNumFmt.SetNumAdjust( eAdjust );
687 			pActNum->Set(i, aNumFmt);
688 		}
689 		nMask <<= 1;
690 	}
691 	SetModified();
692 	return 0;
693 }
694 /*-----------------03.12.97 11:11-------------------
695 
696 --------------------------------------------------*/
697 IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox *, pBox )
698 {
699 	sal_uInt16 nSaveNumLvl = nActNumLvl;
700 	nActNumLvl = 0;
701 	if(pBox->IsEntryPosSelected( MAXLEVEL ) &&
702 			(pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
703 	{
704 		nActNumLvl = 0xFFFF;
705 		pBox->SetUpdateMode(sal_False);
706 		for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
707 			pBox->SelectEntryPos( i, sal_False );
708 		pBox->SetUpdateMode(sal_True);
709 	}
710 	else if(pBox->GetSelectEntryCount())
711 	{
712 		sal_uInt16 nMask = 1;
713 		for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
714 		{
715 			if(pBox->IsEntryPosSelected( i ))
716 				nActNumLvl |= nMask;
717 			nMask <<= 1;
718 		}
719 		pBox->SelectEntryPos( MAXLEVEL, sal_False );
720 	}
721 	else
722 	{
723 		nActNumLvl = nSaveNumLvl;
724 		sal_uInt16 nMask = 1;
725 		for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
726 		{
727 			if(nActNumLvl & nMask)
728 			{
729 				pBox->SelectEntryPos(i);
730 				break;
731 			}
732 			nMask <<=1;
733 		}
734 	}
735 	aRelativeCB.Enable(1 != nActNumLvl);
736 	SetModified();
737     // --> OD 2008-02-01 #newlistlevelattrs#
738     InitPosAndSpaceMode();
739     ShowControlsDependingOnPosAndSpaceMode();
740     // <--
741 	InitControls();
742 	return 0;
743 }
744 /*-----------------03.12.97 12:24-------------------
745 
746 --------------------------------------------------*/
747 IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
748 {
749 	if(bInInintControl)
750 		return 0;
751     long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
752 	sal_uInt16 nMask = 1;
753 	for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
754 	{
755 		if(nActNumLvl & nMask)
756 		{
757 			SwNumFmt aNumFmt( pActNum->Get( i ) );
758 			if(pFld == &aDistBorderMF)
759 			{
760 
761 				if(aRelativeCB.IsChecked() && aRelativeCB.IsEnabled())
762 				{
763 					if(0 == i)
764 					{
765 						long nTmp = aNumFmt.GetFirstLineOffset();
766 						aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
767 					}
768 					else
769 					{
770 						long nTmp = pActNum->Get( i - 1 ).GetAbsLSpace() +
771 									pActNum->Get( i - 1 ).GetFirstLineOffset() -
772 									pActNum->Get( i ).GetFirstLineOffset();
773 
774 						aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
775 					}
776 				}
777 				else
778 				{
779 					aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
780 				}
781 			}
782 			else if(pFld == &aDistNumMF)
783 			{
784 				aNumFmt.SetCharTextDistance( (short)nValue );
785 			}
786 			else if(pFld == &aIndentMF)
787 			{
788 				//jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden
789 				long nDiff = nValue + aNumFmt.GetFirstLineOffset();
790 				long nAbsLSpace = aNumFmt.GetAbsLSpace();
791 				aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
792 				aNumFmt.SetFirstLineOffset( -(short)nValue );
793 			}
794 
795 			pActNum->Set( i, aNumFmt );
796 		}
797 		nMask <<= 1;
798 	}
799 
800 	SetModified();
801 	if(!aDistBorderMF.IsEnabled())
802 		aDistBorderMF.SetText(aEmptyStr);
803 
804 	return 0;
805 }
806 
807 /*-----------------04.12.97 12:35-------------------
808 
809 --------------------------------------------------*/
810 IMPL_LINK( SwNumPositionTabPage, RelativeHdl, CheckBox *, pBox )
811 {
812 	sal_Bool bOn = pBox->IsChecked();
813 	sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
814 	sal_Bool bSetValue = sal_False;
815 	long nValue = 0;
816 	if(bOn || bSingleSelection)
817 	{
818 		sal_uInt16 nMask = 1;
819 		sal_Bool bFirst = sal_True;
820 		bSetValue = sal_True;
821 		for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
822 		{
823 			if(nActNumLvl & nMask)
824 			{
825 				const SwNumFmt &rNumFmt = pActNum->Get(i);
826 				if(bFirst)
827 				{
828 					nValue = rNumFmt.GetAbsLSpace();
829 					if(bOn && i)
830 						nValue -= pActNum->Get(i - 1).GetAbsLSpace();
831 				}
832 				else
833 					bSetValue = nValue == rNumFmt.GetAbsLSpace() - pActNum->Get(i - 1).GetAbsLSpace();
834 				bFirst = sal_False;
835 			}
836 			nMask <<= 1;
837 		}
838 
839 	}
840 	if(bSetValue)
841 		aDistBorderMF.SetValue(aDistBorderMF.Normalize(nValue),	FUNIT_TWIP);
842 	else
843 		aDistBorderMF.SetText(aEmptyStr);
844 	aDistBorderMF.Enable(bOn || bSingleSelection||0 != pOutlineDlg);
845 	bLastRelative = bOn;
846 	return 0;
847 }
848 
849 // --> OD 2008-02-01 #newlistlevelattrs#
850 IMPL_LINK( SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG )
851 {
852     // determine value to be set at the chosen list levels
853     SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy =
854                                                     SvxNumberFormat::LISTTAB;
855     {
856         const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos();
857         if ( nPos == 1 )
858         {
859             eLabelFollowedBy = SvxNumberFormat::SPACE;
860         }
861         else if ( nPos == 2 )
862         {
863             eLabelFollowedBy = SvxNumberFormat::NOTHING;
864         }
865     }
866 
867     // set value at the chosen list levels
868     bool bSameListtabPos = true;
869     sal_uInt16 nFirstLvl = USHRT_MAX;
870     sal_uInt16 nMask = 1;
871     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
872     {
873         if ( nActNumLvl & nMask )
874         {
875             SwNumFmt aNumFmt( pActNum->Get(i) );
876             aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
877             pActNum->Set( i, aNumFmt );
878 
879             if ( nFirstLvl == USHRT_MAX )
880             {
881                 nFirstLvl = i;
882             }
883             else
884             {
885                 bSameListtabPos &= aNumFmt.GetListtabPos() ==
886                         pActNum->Get( nFirstLvl ).GetListtabPos();
887             }
888         }
889         nMask <<= 1;
890     }
891 
892     // enable/disable metric field for list tab stop position depending on
893     // selected item following the list label.
894     aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
895     aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
896     if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
897     {
898         aListtabMF.SetValue(
899             aListtabMF.Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ),
900             FUNIT_TWIP );
901     }
902     else
903     {
904         aListtabMF.SetText( String() );
905     }
906 
907     SetModified();
908 
909     return 0;
910 }
911 // <--
912 
913 // --> OD 2008-02-01 #newlistlevelattrs#
914 IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
915 {
916     // determine value to be set at the chosen list levels
917     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
918 
919     // set value at the chosen list levels
920     sal_uInt16 nMask = 1;
921     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
922     {
923         if ( nActNumLvl & nMask )
924         {
925             SwNumFmt aNumFmt( pActNum->Get(i) );
926             aNumFmt.SetListtabPos( nValue );
927             pActNum->Set( i, aNumFmt );
928         }
929         nMask <<= 1;
930     }
931 
932     SetModified();
933 
934     return 0;
935 }
936 // <--
937 
938 // --> OD 2008-02-01 #newlistlevelattrs#
939 IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
940 {
941     // determine value to be set at the chosen list levels
942     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
943 
944     // set value at the chosen list levels
945     sal_uInt16 nMask = 1;
946     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
947     {
948         if ( nActNumLvl & nMask )
949         {
950             SwNumFmt aNumFmt( pActNum->Get(i) );
951             const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
952             aNumFmt.SetFirstLineIndent( nFirstLineIndent );
953             pActNum->Set( i, aNumFmt );
954         }
955         nMask <<= 1;
956     }
957 
958     SetModified();
959 
960     return 0;
961 }
962 // <--
963 
964 // --> OD 2008-02-01 #newlistlevelattrs#
965 IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
966 {
967     // determine value to be set at the chosen list levels
968     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
969 
970     // set value at the chosen list levels
971     sal_uInt16 nMask = 1;
972     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
973     {
974         if ( nActNumLvl & nMask )
975         {
976             SwNumFmt aNumFmt( pActNum->Get(i) );
977             const long nAlignedAt = aNumFmt.GetIndentAt() +
978                                     aNumFmt.GetFirstLineIndent();
979             aNumFmt.SetIndentAt( nValue );
980             const long nNewFirstLineIndent = nAlignedAt - nValue;
981             aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
982             pActNum->Set( i, aNumFmt );
983         }
984         nMask <<= 1;
985     }
986 
987     SetModified();
988 
989     return 0;
990 }
991 // <--
992 
993 /*-----------------05.12.97 15:33-------------------
994 
995 --------------------------------------------------*/
996 IMPL_LINK( SwNumPositionTabPage, StandardHdl, PushButton *, EMPTYARG )
997 {
998 	sal_uInt16 nMask = 1;
999 	for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1000 	{
1001 		if(nActNumLvl & nMask)
1002 		{
1003 			SwNumFmt aNumFmt( pActNum->Get( i ) );
1004             // --> OD 2008-02-11 #newlistlevelattrs#
1005             SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
1006                                    aNumFmt.GetPositionAndSpaceMode(),
1007                                    pOutlineDlg ? OUTLINE_RULE : NUM_RULE );
1008             // <--
1009 			SwNumFmt aTempFmt(aTmpNumRule.Get( i ));
1010             // --> OD 2008-02-05 #newlistlevelattrs#
1011             aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
1012             if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1013             {
1014                 aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace());
1015                 aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
1016                 aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
1017             }
1018             else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1019             {
1020                 aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
1021                 aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
1022                 aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
1023                 aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
1024                 aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
1025             }
1026             // <--
1027 
1028 			pActNum->Set( i, aNumFmt );
1029 		}
1030 		nMask <<= 1;
1031 	}
1032 
1033 	InitControls();
1034 	SetModified();
1035 	return 0;
1036 }
1037 
1038 #if OSL_DEBUG_LEVEL > 1
1039 void SwNumPositionTabPage::SetModified(sal_Bool bRepaint)
1040 {
1041 	bModified = sal_True;
1042 	if(bRepaint)
1043 	{
1044 		aPreviewWIN.SetLevel(nActNumLvl);
1045 		aPreviewWIN.Invalidate();
1046 	}
1047 }
1048 
1049 #endif
1050 
1051 /**************************************************************************/
1052 /*                                                                        */
1053 /*                                                                        */
1054 /**************************************************************************/
1055 
1056 
1057 SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
1058 					const SfxItemSet* pSwItemSet, SwWrtShell & rSh) :
1059 	SfxTabDialog(pParent, SW_RES(DLG_SVXTEST_NUM_BULLET), pSwItemSet, sal_False, &aEmptyStr),
1060 	rWrtSh(rSh),
1061     sRemoveText(SW_RES(ST_RESET)),
1062     nRetOptionsDialog(USHRT_MAX)
1063 {
1064 	FreeResource();
1065 	GetUserButton()->SetText(sRemoveText);
1066 	GetUserButton()->SetHelpId(HID_NUM_RESET);
1067 	GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
1068 	if(!rWrtSh.GetCurNumRule())
1069 		GetUserButton()->Enable(sal_False);
1070     AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
1071     AddTabPage( RID_SVXPAGE_PICK_BULLET );
1072     AddTabPage( RID_SVXPAGE_PICK_NUM );
1073     AddTabPage( RID_SVXPAGE_PICK_BMP );
1074     AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
1075     AddTabPage( RID_SVXPAGE_NUM_POSITION );
1076 
1077 }
1078 /*-----------------07.02.97 12.08-------------------
1079 
1080 --------------------------------------------------*/
1081 
1082 SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog()
1083 {
1084 }
1085 
1086 /*-----------------07.02.97 14.48-------------------
1087 
1088 --------------------------------------------------*/
1089 
1090 void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
1091 {
1092 	//Namen der Vorlagen und Metric setzen
1093 	String sNumCharFmt, sBulletCharFmt;
1094 	SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt );
1095 	SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt );
1096 
1097 	switch ( nPageId )
1098 	{
1099 	case RID_SVXPAGE_PICK_NUM:
1100 		{
1101             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1102             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
1103             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1104             rPage.PageCreated(aSet);
1105 		}
1106 		break;
1107 	case RID_SVXPAGE_PICK_BULLET :
1108 		{
1109             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1110             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1111             rPage.PageCreated(aSet);
1112 		}
1113 		break;
1114 
1115 	case RID_SVXPAGE_NUM_OPTIONS:
1116 		{
1117             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1118             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
1119             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1120 			// Zeichenvorlagen sammeln
1121             ListBox rCharFmtLB(this);
1122 			rCharFmtLB.Clear();
1123 			rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
1124 			SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
1125 			::FillCharStyleListBox(rCharFmtLB,	pDocShell);
1126 			List aList;
1127 			for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
1128 			{
1129 
1130 				 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
1131 			}
1132 			aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
1133 
1134 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
1135             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
1136             rPage.PageCreated(aSet);
1137 			for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
1138 					delete (XubString*)aList.Remove(i);
1139 			aList.Clear();
1140 		}
1141 		break;
1142 	case RID_SVXPAGE_NUM_POSITION:
1143 		{
1144 			SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
1145 			FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
1146             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1147             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) );
1148             rPage.PageCreated(aSet);
1149 // 			((SvxNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
1150 		}
1151 		break;
1152 	}
1153 }
1154 /*-----------------17.02.97 16.52-------------------
1155 
1156 --------------------------------------------------*/
1157 short  SwSvxNumBulletTabDialog::Ok()
1158 {
1159 	short nRet = SfxTabDialog::Ok();
1160 	pExampleSet->ClearItem(SID_PARAM_NUM_PRESET);
1161 	return nRet;
1162 }
1163 /* -----------------02.12.98 08:35-------------------
1164  *
1165  * --------------------------------------------------*/
1166 IMPL_LINK(SwSvxNumBulletTabDialog, RemoveNumberingHdl, PushButton*, EMPTYARG)
1167 {
1168 	EndDialog(RET_USER);
1169 	return 0;
1170 }
1171 
1172 
1173