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