xref: /AOO41X/main/sw/source/ui/misc/num.cxx (revision 205b6fc7eb968a51d581e2797e3bbc3374c52590)
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 --------------------------------------------------*/
SwNumPositionTabPage(Window * pParent,const SfxItemSet & rSet)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 --------------------------------------------------*/
~SwNumPositionTabPage()207 SwNumPositionTabPage::~SwNumPositionTabPage()
208 {
209     delete pActNum;
210 }
211 /*-----------------03.12.97 10:06-------------------
212 
213 --------------------------------------------------*/
InitControls()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 (MAXLEVEL <= nLvl)
316     {
317         OSL_ENSURE(false, "cannot happen.");
318         return;
319     }
320     if(bSameDistBorderNum)
321     {
322         long nDistBorderNum;
323         if(bRelative)
324         {
325             nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
326             if(nLvl)
327                 nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
328         }
329         else
330         {
331             nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
332         }
333         aDistBorderMF.SetValue(aDistBorderMF.Normalize(nDistBorderNum),FUNIT_TWIP);
334     }
335     else
336         bSetDistEmpty = sal_True;
337 
338     if(bSameDist)
339         aDistNumMF   .SetValue(aDistNumMF.Normalize(aNumFmtArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP);
340     else
341         aDistNumMF.SetText(aEmptyStr);
342     if(bSameIndent)
343         aIndentMF.SetValue(aIndentMF.Normalize(-aNumFmtArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP);
344     else
345         aIndentMF.SetText(aEmptyStr);
346 
347     if(bSameAdjust)
348     {
349         sal_uInt16 nPos = 1; // zentriert
350         if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
351             nPos = 0;
352         else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
353             nPos = 2;
354         aAlignLB.SelectEntryPos(nPos);
355         // --> OD 2008-02-01 #newlistlevelattrs#
356         aAlign2LB.SelectEntryPos( nPos );
357         // <--
358     }
359     else
360     {
361         aAlignLB.SetNoSelection();
362         // --> OD 2008-02-01 #newlistlevelattrs#
363         aAlign2LB.SetNoSelection();
364         // <--
365     }
366 
367     // --> OD 2008-02-01 #newlistlevelattrs#
368     if ( bSameLabelFollowedBy )
369     {
370         sal_uInt16 nPos = 0; // LISTTAB
371         if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
372         {
373             nPos = 1;
374         }
375         else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
376         {
377             nPos = 2;
378         }
379         aLabelFollowedByLB.SelectEntryPos( nPos );
380     }
381     else
382     {
383         aLabelFollowedByLB.SetNoSelection();
384     }
385 
386     if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
387     {
388         aListtabFT.Enable( true );
389         aListtabMF.Enable( true );
390         if ( bSameListtab )
391         {
392             aListtabMF.SetValue(aListtabMF.Normalize(aNumFmtArr[nLvl]->GetListtabPos()),FUNIT_TWIP);
393         }
394         else
395         {
396             aListtabMF.SetText(aEmptyStr);
397         }
398     }
399     else
400     {
401         aListtabFT.Enable( false );
402         aListtabMF.Enable( false );
403         aListtabMF.SetText(aEmptyStr);
404     }
405 
406     if ( bSameAlignAt )
407     {
408         aAlignedAtMF.SetValue(
409             aAlignedAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt() +
410                                     aNumFmtArr[nLvl]->GetFirstLineIndent()),
411             FUNIT_TWIP );
412     }
413     else
414     {
415         aAlignedAtMF.SetText(aEmptyStr);
416     }
417 
418     if ( bSameIndentAt )
419     {
420         aIndentAtMF.SetValue(
421             aIndentAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt()), FUNIT_TWIP );
422     }
423     else
424     {
425         aIndentAtMF.SetText(aEmptyStr);
426     }
427     // <--
428 
429     if(sal_True == bSetDistEmpty)
430         aDistBorderMF.SetText(aEmptyStr);
431 
432     bInInintControl = sal_False;
433 }
434 
435 /*-----------------03.12.97 10:02-------------------
436 
437 --------------------------------------------------*/
ActivatePage(const SfxItemSet &)438 void SwNumPositionTabPage::ActivatePage(const SfxItemSet& )
439 {
440     const SfxPoolItem* pItem;
441     sal_uInt16 nTmpNumLvl =
442         pOutlineDlg ? pOutlineDlg->GetActNumLevel() : 0;
443     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
444     if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, sal_False, &pItem))
445     {
446         bPreset = ((const SfxBoolItem*)pItem)->GetValue();
447     }
448     //
449     bModified = (!pActNum->GetNumFmt( 0 ) || bPreset);
450     if(*pActNum != *pSaveNum ||
451         nActNumLvl != nTmpNumLvl )
452     {
453         *pActNum = *pSaveNum;
454         nActNumLvl = nTmpNumLvl;
455         sal_uInt16 nMask = 1;
456         aLevelLB.SetUpdateMode(sal_False);
457         aLevelLB.SetNoSelection();
458         aLevelLB.SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX);
459         if(nActNumLvl != USHRT_MAX)
460             for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
461             {
462                 if(nActNumLvl & nMask)
463                     aLevelLB.SelectEntryPos( i, sal_True);
464                 nMask <<= 1 ;
465             }
466         aLevelLB.SetUpdateMode(sal_True);
467 
468         // --> OD 2008-02-01 #newlistlevelattrs#
469         InitPosAndSpaceMode();
470         ShowControlsDependingOnPosAndSpaceMode();
471         // <--
472 
473         InitControls();
474     }
475     aRelativeCB.Enable(1 != nActNumLvl);
476     aPreviewWIN.Invalidate();
477 }
478 
479 /*-----------------03.12.97 10:02-------------------
480 
481 --------------------------------------------------*/
DeactivatePage(SfxItemSet * _pSet)482 int  SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
483 {
484     SwOutlineTabDialog::SetActNumLevel(nActNumLvl);
485     if(_pSet)
486         FillItemSet(*_pSet);
487     return sal_True;
488 
489 }
490 
491 /*-----------------03.12.97 10:02-------------------
492 
493 --------------------------------------------------*/
FillItemSet(SfxItemSet & rSet)494 sal_Bool SwNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
495 {
496     if(pOutlineDlg)
497         *pOutlineDlg->GetNumRule() = *pActNum;
498     else if(bModified && pActNum)
499     {
500         *pSaveNum = *pActNum;
501         rSet.Put(SwUINumRuleItem( *pSaveNum ));
502         rSet.Put(SfxBoolItem(FN_PARAM_NUM_PRESET, sal_False));
503     }
504     return bModified;
505 }
506 
507 /*-----------------03.12.97 10:02-------------------
508 
509 --------------------------------------------------*/
Reset(const SfxItemSet & rSet)510 void SwNumPositionTabPage::Reset( const SfxItemSet& rSet )
511 {
512     const SfxPoolItem* pItem;
513     if(pOutlineDlg)
514     {
515         pSaveNum = pOutlineDlg->GetNumRule();
516         aLevelLB.EnableMultiSelection(sal_False);
517     }
518     else if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_ACT_NUMBER, sal_False, &pItem))
519         pSaveNum = ((SwUINumRuleItem*)pItem)->GetNumRule();
520 
521     nActNumLvl = SwOutlineTabDialog::GetActNumLevel();
522     sal_uInt16 nMask = 1;
523     aLevelLB.SetUpdateMode(sal_False);
524     aLevelLB.SetNoSelection();
525     if(nActNumLvl == USHRT_MAX)
526     {
527         aLevelLB.SelectEntryPos( MAXLEVEL, sal_True);
528     }
529     else
530         for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
531         {
532             if(nActNumLvl & nMask)
533                 aLevelLB.SelectEntryPos( i, sal_True);
534             nMask <<= 1;
535         }
536     aLevelLB.SetUpdateMode(sal_True);
537 
538     if(!pActNum)
539         pActNum = new  SwNumRule(*pSaveNum);
540     else if(*pSaveNum != *pActNum)
541         *pActNum = *pSaveNum;
542     aPreviewWIN.SetNumRule(pActNum);
543     // --> OD 2008-02-01 #newlistlevelattrs#
544     InitPosAndSpaceMode();
545     ShowControlsDependingOnPosAndSpaceMode();
546     // <--
547     InitControls();
548     bModified = sal_False;
549 }
550 
551 // --> OD 2008-01-11 #newlistlevelattrs#
InitPosAndSpaceMode()552 void SwNumPositionTabPage::InitPosAndSpaceMode()
553 {
554     if ( pActNum == 0 )
555     {
556         DBG_ASSERT( false,
557                 "<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
558         return;
559     }
560 
561     SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
562                                             SvxNumberFormat::LABEL_ALIGNMENT;
563     sal_uInt16 nMask = 1;
564     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
565     {
566         if(nActNumLvl & nMask)
567         {
568             SvxNumberFormat aNumFmt( pActNum->Get(i) );
569             ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
570             if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
571             {
572                 break;
573             }
574         }
575         nMask <<= 1;
576     }
577 
578     bLabelAlignmentPosAndSpaceModeActive =
579                     ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
580 }
581 
ShowControlsDependingOnPosAndSpaceMode()582 void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
583 {
584     aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
585     aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
586     aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
587     aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
588     aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
589     aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
590     aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
591     aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
592     aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive );
593 
594     aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive );
595     aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive );
596     aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive );
597     aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive );
598     aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive );
599     aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive );
600     aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
601     aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
602     aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
603     aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
604 }
605 // <--
606 
607 /*-----------------03.12.97 10:02-------------------
608 
609 --------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rAttrSet)610 SfxTabPage* SwNumPositionTabPage::Create( Window* pParent,
611                                 const SfxItemSet& rAttrSet)
612 {
613     return new SwNumPositionTabPage(pParent, rAttrSet);
614 }
615 
616 /*-----------------04.12.97 12:51-------------------
617 
618 --------------------------------------------------*/
SetWrtShell(SwWrtShell * pSh)619 void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
620 {
621     pWrtSh = pSh;
622 
623     // --> OD 2008-02-01 #newlistlevelattrs#
624     const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width();
625 
626     aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_TWIP );
627     aDistNumMF   .SetMax(aDistNumMF   .Normalize( nWidth ), FUNIT_TWIP );
628     aIndentMF    .SetMax(aIndentMF    .Normalize( nWidth ), FUNIT_TWIP );
629     // --> OD 2008-02-18 #newlistlevelattrs#
630     aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_TWIP );
631     aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_TWIP );
632     aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_TWIP );
633     // <--
634     const SwTwips nLast2 = nWidth /2;
635     aDistBorderMF.SetLast( aDistBorderMF.Normalize(   nLast2 ), FUNIT_TWIP );
636     aDistNumMF   .SetLast( aDistNumMF     .Normalize( nLast2 ), FUNIT_TWIP );
637     aIndentMF    .SetLast( aIndentMF      .Normalize( nLast2 ), FUNIT_TWIP );
638     // --> OD 2008-02-18 #newlistlevelattrs#
639     aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_TWIP );
640     aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_TWIP );
641     aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_TWIP );
642     // <--
643     // <--
644 
645     const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE);
646     aPreviewWIN.SetPageWidth(rPrtRect.Width());
647     FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView()));
648     if(eMetric == FUNIT_MM)
649     {
650         aDistBorderMF .SetDecimalDigits(1);
651         aDistNumMF    .SetDecimalDigits(1);
652         aIndentMF     .SetDecimalDigits(1);
653         // --> OD 2008-02-18 #newlistlevelattrs#
654         aListtabMF.SetDecimalDigits(1);
655         aAlignedAtMF.SetDecimalDigits(1);
656         aIndentAtMF.SetDecimalDigits(1);
657         // <--
658     }
659     aDistBorderMF .SetUnit( eMetric );
660     aDistNumMF    .SetUnit( eMetric );
661     aIndentMF     .SetUnit( eMetric );
662     // --> OD 2008-02-18 #newlistlevelattrs#
663     aListtabMF.SetUnit( eMetric );
664     aAlignedAtMF.SetUnit( eMetric );
665     aIndentAtMF.SetUnit( eMetric );
666     // <--
667 }
668 
669 /*-----------------03.12.97 11:06-------------------
670 
671 --------------------------------------------------*/
IMPL_LINK(SwNumPositionTabPage,EditModifyHdl,Edit *,EMPTYARG)672 IMPL_LINK( SwNumPositionTabPage, EditModifyHdl, Edit *, EMPTYARG )
673 {
674     sal_uInt16 nMask = 1;
675     for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
676     {
677         if(nActNumLvl & nMask)
678         {
679             SwNumFmt aNumFmt(pActNum->Get(i));
680 
681             // --> OD 2008-02-01 #newlistlevelattrs#
682             const sal_uInt16 nPos = aAlignLB.IsVisible()
683                                 ? aAlignLB.GetSelectEntryPos()
684                                 : aAlign2LB.GetSelectEntryPos();
685             // <--
686             SvxAdjust eAdjust = SVX_ADJUST_CENTER;
687             if(nPos == 0)
688                 eAdjust = SVX_ADJUST_LEFT;
689             else if(nPos == 2)
690                 eAdjust = SVX_ADJUST_RIGHT;
691             aNumFmt.SetNumAdjust( eAdjust );
692             pActNum->Set(i, aNumFmt);
693         }
694         nMask <<= 1;
695     }
696     SetModified();
697     return 0;
698 }
699 /*-----------------03.12.97 11:11-------------------
700 
701 --------------------------------------------------*/
IMPL_LINK(SwNumPositionTabPage,LevelHdl,ListBox *,pBox)702 IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox *, pBox )
703 {
704     sal_uInt16 nSaveNumLvl = nActNumLvl;
705     nActNumLvl = 0;
706     if(pBox->IsEntryPosSelected( MAXLEVEL ) &&
707             (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
708     {
709         nActNumLvl = 0xFFFF;
710         pBox->SetUpdateMode(sal_False);
711         for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
712             pBox->SelectEntryPos( i, sal_False );
713         pBox->SetUpdateMode(sal_True);
714     }
715     else if(pBox->GetSelectEntryCount())
716     {
717         sal_uInt16 nMask = 1;
718         for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
719         {
720             if(pBox->IsEntryPosSelected( i ))
721                 nActNumLvl |= nMask;
722             nMask <<= 1;
723         }
724         pBox->SelectEntryPos( MAXLEVEL, sal_False );
725     }
726     else
727     {
728         nActNumLvl = nSaveNumLvl;
729         sal_uInt16 nMask = 1;
730         for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
731         {
732             if(nActNumLvl & nMask)
733             {
734                 pBox->SelectEntryPos(i);
735                 break;
736             }
737             nMask <<=1;
738         }
739     }
740     aRelativeCB.Enable(1 != nActNumLvl);
741     SetModified();
742     // --> OD 2008-02-01 #newlistlevelattrs#
743     InitPosAndSpaceMode();
744     ShowControlsDependingOnPosAndSpaceMode();
745     // <--
746     InitControls();
747     return 0;
748 }
749 /*-----------------03.12.97 12:24-------------------
750 
751 --------------------------------------------------*/
IMPL_LINK(SwNumPositionTabPage,DistanceHdl,MetricField *,pFld)752 IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
753 {
754     if(bInInintControl)
755         return 0;
756     long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
757     sal_uInt16 nMask = 1;
758     for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
759     {
760         if(nActNumLvl & nMask)
761         {
762             SwNumFmt aNumFmt( pActNum->Get( i ) );
763             if(pFld == &aDistBorderMF)
764             {
765 
766                 if(aRelativeCB.IsChecked() && aRelativeCB.IsEnabled())
767                 {
768                     if(0 == i)
769                     {
770                         long nTmp = aNumFmt.GetFirstLineOffset();
771                         aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
772                     }
773                     else
774                     {
775                         long nTmp = pActNum->Get( i - 1 ).GetAbsLSpace() +
776                                     pActNum->Get( i - 1 ).GetFirstLineOffset() -
777                                     pActNum->Get( i ).GetFirstLineOffset();
778 
779                         aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
780                     }
781                 }
782                 else
783                 {
784                     aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
785                 }
786             }
787             else if(pFld == &aDistNumMF)
788             {
789                 aNumFmt.SetCharTextDistance( (short)nValue );
790             }
791             else if(pFld == &aIndentMF)
792             {
793                 //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden
794                 long nDiff = nValue + aNumFmt.GetFirstLineOffset();
795                 long nAbsLSpace = aNumFmt.GetAbsLSpace();
796                 aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
797                 aNumFmt.SetFirstLineOffset( -(short)nValue );
798             }
799 
800             pActNum->Set( i, aNumFmt );
801         }
802         nMask <<= 1;
803     }
804 
805     SetModified();
806     if(!aDistBorderMF.IsEnabled())
807         aDistBorderMF.SetText(aEmptyStr);
808 
809     return 0;
810 }
811 
812 /*-----------------04.12.97 12:35-------------------
813 
814 --------------------------------------------------*/
IMPL_LINK(SwNumPositionTabPage,RelativeHdl,CheckBox *,pBox)815 IMPL_LINK( SwNumPositionTabPage, RelativeHdl, CheckBox *, pBox )
816 {
817     sal_Bool bOn = pBox->IsChecked();
818     sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
819     sal_Bool bSetValue = sal_False;
820     long nValue = 0;
821     if(bOn || bSingleSelection)
822     {
823         sal_uInt16 nMask = 1;
824         sal_Bool bFirst = sal_True;
825         bSetValue = sal_True;
826         for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
827         {
828             if(nActNumLvl & nMask)
829             {
830                 const SwNumFmt &rNumFmt = pActNum->Get(i);
831                 if(bFirst)
832                 {
833                     nValue = rNumFmt.GetAbsLSpace();
834                     if(bOn && i)
835                         nValue -= pActNum->Get(i - 1).GetAbsLSpace();
836                 }
837                 else
838                     bSetValue = nValue == rNumFmt.GetAbsLSpace() - pActNum->Get(i - 1).GetAbsLSpace();
839                 bFirst = sal_False;
840             }
841             nMask <<= 1;
842         }
843 
844     }
845     if(bSetValue)
846         aDistBorderMF.SetValue(aDistBorderMF.Normalize(nValue), FUNIT_TWIP);
847     else
848         aDistBorderMF.SetText(aEmptyStr);
849     aDistBorderMF.Enable(bOn || bSingleSelection||0 != pOutlineDlg);
850     bLastRelative = bOn;
851     return 0;
852 }
853 
854 // --> OD 2008-02-01 #newlistlevelattrs#
IMPL_LINK(SwNumPositionTabPage,LabelFollowedByHdl_Impl,ListBox *,EMPTYARG)855 IMPL_LINK( SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG )
856 {
857     // determine value to be set at the chosen list levels
858     SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy =
859                                                     SvxNumberFormat::LISTTAB;
860     {
861         const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos();
862         if ( nPos == 1 )
863         {
864             eLabelFollowedBy = SvxNumberFormat::SPACE;
865         }
866         else if ( nPos == 2 )
867         {
868             eLabelFollowedBy = SvxNumberFormat::NOTHING;
869         }
870     }
871 
872     // set value at the chosen list levels
873     bool bSameListtabPos = true;
874     sal_uInt16 nFirstLvl = USHRT_MAX;
875     sal_uInt16 nMask = 1;
876     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
877     {
878         if ( nActNumLvl & nMask )
879         {
880             SwNumFmt aNumFmt( pActNum->Get(i) );
881             aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
882             pActNum->Set( i, aNumFmt );
883 
884             if ( nFirstLvl == USHRT_MAX )
885             {
886                 nFirstLvl = i;
887             }
888             else
889             {
890                 bSameListtabPos &= aNumFmt.GetListtabPos() ==
891                         pActNum->Get( nFirstLvl ).GetListtabPos();
892             }
893         }
894         nMask <<= 1;
895     }
896 
897     // enable/disable metric field for list tab stop position depending on
898     // selected item following the list label.
899     aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
900     aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
901     if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
902     {
903         aListtabMF.SetValue(
904             aListtabMF.Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ),
905             FUNIT_TWIP );
906     }
907     else
908     {
909         aListtabMF.SetText( String() );
910     }
911 
912     SetModified();
913 
914     return 0;
915 }
916 // <--
917 
918 // --> OD 2008-02-01 #newlistlevelattrs#
IMPL_LINK(SwNumPositionTabPage,ListtabPosHdl_Impl,MetricField *,pFld)919 IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
920 {
921     // determine value to be set at the chosen list levels
922     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
923 
924     // set value at the chosen list levels
925     sal_uInt16 nMask = 1;
926     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
927     {
928         if ( nActNumLvl & nMask )
929         {
930             SwNumFmt aNumFmt( pActNum->Get(i) );
931             aNumFmt.SetListtabPos( nValue );
932             pActNum->Set( i, aNumFmt );
933         }
934         nMask <<= 1;
935     }
936 
937     SetModified();
938 
939     return 0;
940 }
941 // <--
942 
943 // --> OD 2008-02-01 #newlistlevelattrs#
IMPL_LINK(SwNumPositionTabPage,AlignAtHdl_Impl,MetricField *,pFld)944 IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
945 {
946     // determine value to be set at the chosen list levels
947     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
948 
949     // set value at the chosen list levels
950     sal_uInt16 nMask = 1;
951     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
952     {
953         if ( nActNumLvl & nMask )
954         {
955             SwNumFmt aNumFmt( pActNum->Get(i) );
956             const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
957             aNumFmt.SetFirstLineIndent( nFirstLineIndent );
958             pActNum->Set( i, aNumFmt );
959         }
960         nMask <<= 1;
961     }
962 
963     SetModified();
964 
965     return 0;
966 }
967 // <--
968 
969 // --> OD 2008-02-01 #newlistlevelattrs#
IMPL_LINK(SwNumPositionTabPage,IndentAtHdl_Impl,MetricField *,pFld)970 IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
971 {
972     // determine value to be set at the chosen list levels
973     const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
974 
975     // set value at the chosen list levels
976     sal_uInt16 nMask = 1;
977     for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
978     {
979         if ( nActNumLvl & nMask )
980         {
981             SwNumFmt aNumFmt( pActNum->Get(i) );
982             const long nAlignedAt = aNumFmt.GetIndentAt() +
983                                     aNumFmt.GetFirstLineIndent();
984             aNumFmt.SetIndentAt( nValue );
985             const long nNewFirstLineIndent = nAlignedAt - nValue;
986             aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
987             pActNum->Set( i, aNumFmt );
988         }
989         nMask <<= 1;
990     }
991 
992     SetModified();
993 
994     return 0;
995 }
996 // <--
997 
998 /*-----------------05.12.97 15:33-------------------
999 
1000 --------------------------------------------------*/
IMPL_LINK(SwNumPositionTabPage,StandardHdl,PushButton *,EMPTYARG)1001 IMPL_LINK( SwNumPositionTabPage, StandardHdl, PushButton *, EMPTYARG )
1002 {
1003     sal_uInt16 nMask = 1;
1004     for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
1005     {
1006         if(nActNumLvl & nMask)
1007         {
1008             SwNumFmt aNumFmt( pActNum->Get( i ) );
1009             // --> OD 2008-02-11 #newlistlevelattrs#
1010             SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
1011                                    aNumFmt.GetPositionAndSpaceMode(),
1012                                    pOutlineDlg ? OUTLINE_RULE : NUM_RULE );
1013             // <--
1014             SwNumFmt aTempFmt(aTmpNumRule.Get( i ));
1015             // --> OD 2008-02-05 #newlistlevelattrs#
1016             aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
1017             if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1018             {
1019                 aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace());
1020                 aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
1021                 aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
1022             }
1023             else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1024             {
1025                 aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
1026                 aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
1027                 aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
1028                 aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
1029                 aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
1030             }
1031             // <--
1032 
1033             pActNum->Set( i, aNumFmt );
1034         }
1035         nMask <<= 1;
1036     }
1037 
1038     InitControls();
1039     SetModified();
1040     return 0;
1041 }
1042 
1043 #if OSL_DEBUG_LEVEL > 1
SetModified(sal_Bool bRepaint)1044 void SwNumPositionTabPage::SetModified(sal_Bool bRepaint)
1045 {
1046     bModified = sal_True;
1047     if(bRepaint)
1048     {
1049         aPreviewWIN.SetLevel(nActNumLvl);
1050         aPreviewWIN.Invalidate();
1051     }
1052 }
1053 
1054 #endif
1055 
1056 /**************************************************************************/
1057 /*                                                                        */
1058 /*                                                                        */
1059 /**************************************************************************/
1060 
1061 
SwSvxNumBulletTabDialog(Window * pParent,const SfxItemSet * pSwItemSet,SwWrtShell & rSh)1062 SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
1063                     const SfxItemSet* pSwItemSet, SwWrtShell & rSh) :
1064     SfxTabDialog(pParent, SW_RES(DLG_SVXTEST_NUM_BULLET), pSwItemSet, sal_False, &aEmptyStr),
1065     rWrtSh(rSh),
1066     sRemoveText(SW_RES(ST_RESET)),
1067     nRetOptionsDialog(USHRT_MAX)
1068 {
1069     FreeResource();
1070     GetUserButton()->SetText(sRemoveText);
1071     GetUserButton()->SetHelpId(HID_NUM_RESET);
1072     GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
1073     if(!rWrtSh.GetCurNumRule())
1074         GetUserButton()->Enable(sal_False);
1075     AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
1076     AddTabPage( RID_SVXPAGE_PICK_BULLET );
1077     AddTabPage( RID_SVXPAGE_PICK_NUM );
1078     AddTabPage( RID_SVXPAGE_PICK_BMP );
1079     AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
1080     AddTabPage( RID_SVXPAGE_NUM_POSITION );
1081 
1082 }
1083 /*-----------------07.02.97 12.08-------------------
1084 
1085 --------------------------------------------------*/
1086 
~SwSvxNumBulletTabDialog()1087 SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog()
1088 {
1089 }
1090 
1091 /*-----------------07.02.97 14.48-------------------
1092 
1093 --------------------------------------------------*/
1094 
PageCreated(sal_uInt16 nPageId,SfxTabPage & rPage)1095 void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
1096 {
1097     //Namen der Vorlagen und Metric setzen
1098     String sNumCharFmt, sBulletCharFmt;
1099     SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt );
1100     SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt );
1101 
1102     switch ( nPageId )
1103     {
1104     case RID_SVXPAGE_PICK_NUM:
1105         {
1106             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1107             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
1108             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1109             rPage.PageCreated(aSet);
1110         }
1111         break;
1112     case RID_SVXPAGE_PICK_BULLET :
1113         {
1114             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1115             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1116             rPage.PageCreated(aSet);
1117         }
1118         break;
1119 
1120     case RID_SVXPAGE_NUM_OPTIONS:
1121         {
1122             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1123             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
1124             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
1125             // Zeichenvorlagen sammeln
1126             ListBox rCharFmtLB(this);
1127             rCharFmtLB.Clear();
1128             rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
1129             SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
1130             ::FillCharStyleListBox(rCharFmtLB,  pDocShell);
1131             List aList;
1132             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
1133             {
1134 
1135                  aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
1136             }
1137             aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
1138 
1139             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
1140             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
1141             rPage.PageCreated(aSet);
1142             for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
1143                     delete (XubString*)aList.Remove(i);
1144             aList.Clear();
1145         }
1146         break;
1147     case RID_SVXPAGE_NUM_POSITION:
1148         {
1149             SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
1150             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
1151             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1152             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) );
1153             rPage.PageCreated(aSet);
1154 //          ((SvxNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
1155         }
1156         break;
1157     }
1158 }
1159 /*-----------------17.02.97 16.52-------------------
1160 
1161 --------------------------------------------------*/
Ok()1162 short  SwSvxNumBulletTabDialog::Ok()
1163 {
1164     short nRet = SfxTabDialog::Ok();
1165     pExampleSet->ClearItem(SID_PARAM_NUM_PRESET);
1166     return nRet;
1167 }
1168 /* -----------------02.12.98 08:35-------------------
1169  *
1170  * --------------------------------------------------*/
IMPL_LINK(SwSvxNumBulletTabDialog,RemoveNumberingHdl,PushButton *,EMPTYARG)1171 IMPL_LINK(SwSvxNumBulletTabDialog, RemoveNumberingHdl, PushButton*, EMPTYARG)
1172 {
1173     EndDialog(RET_USER);
1174     return 0;
1175 }
1176 
1177 
1178