update dev300-m58
[ooovba.git] / sw / source / ui / misc / outline.cxx
blob8b24c0b2d8b293c38d745e4465e16e92f85f6004
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: outline.cxx,v $
10 * $Revision: 1.41 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
35 #endif
36 #include <hintids.hxx>
37 #include <tools/shl.hxx>
38 #ifndef _MENU_HXX //autogen
39 #include <vcl/menu.hxx>
40 #endif
41 #ifndef _MSGBOX_HXX //autogen
42 #include <vcl/msgbox.hxx>
43 #endif
44 #include <sfx2/tabdlg.hxx>
45 #include <svx/brshitem.hxx>
46 #include <unotools/configmgr.hxx>
47 #include <SwStyleNameMapper.hxx>
49 #ifndef _NUM_HXX //autogen
50 #define USE_NUMTABPAGES
51 #include <num.hxx>
52 #endif
53 #ifndef _VIEW_HXX
54 #include <view.hxx>
55 #endif
56 #ifndef _DOCSH_HXX
57 #include <docsh.hxx>
58 #endif
59 #include <uitool.hxx>
60 #include <errhdl.hxx>
61 #include <wrtsh.hxx>
62 #include <swmodule.hxx>
63 #include <fmtcol.hxx>
64 #include <outline.hxx>
65 #include <uinums.hxx>
66 #include <poolfmt.hxx>
67 #include <shellres.hxx>
68 #include <svtools/style.hxx>
69 #include <charfmt.hxx>
70 #include <docstyle.hxx>
71 #include <viewopt.hxx>
72 #include <svtools/ctrlbox.hxx>
73 #ifndef _HELPID_H
74 #include <helpid.h>
75 #endif
76 #ifndef _GLOBALS_HRC
77 #include <globals.hrc> // fuer Vorlagenname 'keins'
78 #endif
79 #ifndef _MISC_HRC
80 #include <misc.hrc>
81 #endif
82 #ifndef _OUTLINE_HRC
83 #include <outline.hrc>
84 #endif
85 #include <paratr.hxx>
87 #include <unomid.h>
89 #include <IDocumentOutlineNodes.hxx>
90 // --> OD 2008-04-14 #outlinelevel#
91 #include <app.hrc>
92 // <--
94 using namespace ::com::sun::star;
96 /* -----------------------------31.01.01 10:23--------------------------------
98 ---------------------------------------------------------------------------*/
100 DBG_NAME(outlinehdl)
102 /*---------------------------------------------------------------------
104 ---------------------------------------------------------------------*/
106 class SwNumNamesDlg: public ModalDialog
108 Edit aFormEdit;
109 ListBox aFormBox;
110 FixedLine aFormFL;
111 OKButton aOKBtn;
112 CancelButton aCancelBtn;
113 HelpButton aHelpBtn;
115 DECL_LINK( ModifyHdl, Edit * );
116 DECL_LINK( SelectHdl, ListBox * );
117 DECL_LINK( DoubleClickHdl, ListBox * );
119 public:
120 SwNumNamesDlg(Window *pParent);
121 ~SwNumNamesDlg();
122 void SetUserNames(const String *pList[]);
123 String GetName() const { return aFormEdit.GetText(); }
124 USHORT GetCurEntryPos() const { return aFormBox.GetSelectEntryPos(); }
127 /*------------------------------------------------------------------------
128 Beschreibung: selektierten Eintrag merken
129 ------------------------------------------------------------------------*/
132 IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox )
134 aFormEdit.SetText(pBox->GetSelectEntry());
135 aFormEdit.SetSelection(Selection(0, SELECTION_MAX));
136 return 0;
138 IMPL_LINK_INLINE_END( SwNumNamesDlg, SelectHdl, ListBox *, pBox )
140 /*------------------------------------------------------------------------
141 Beschreibung: Setzen der vom Benutzer vergebenen Namen
142 Parameter: Liste der vom Benutzer vergebenen Namen;
143 nicht vom Benutzer benannte Positionen sind 0.
144 ------------------------------------------------------------------------*/
147 void SwNumNamesDlg::SetUserNames(const String *pList[])
149 USHORT nSelect = 0;
150 for(USHORT i = 0; i < SwBaseNumRules::nMaxRules; ++i)
152 if(pList[i])
154 aFormBox.RemoveEntry(i);
155 aFormBox.InsertEntry(*pList[i], i);
156 if(i == nSelect && nSelect < SwBaseNumRules::nMaxRules)
157 nSelect++;
160 aFormBox.SelectEntryPos(nSelect);
161 SelectHdl(&aFormBox);
163 /*------------------------------------------------------------------------
164 Beschreibung: OK-Button freischalten, wenn Text im Edit steht.
165 ------------------------------------------------------------------------*/
168 IMPL_LINK_INLINE_START( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
170 aOKBtn.Enable(0 != pBox->GetText().Len());
171 return 0;
173 IMPL_LINK_INLINE_END( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
174 /*------------------------------------------------------------------------
175 Beschreibung: DoubleClickHdl
176 ------------------------------------------------------------------------*/
179 IMPL_LINK_INLINE_START( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG )
181 EndDialog(RET_OK);
182 return 0;
184 IMPL_LINK_INLINE_END( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG )
186 /*--------------------------------------------------
188 --------------------------------------------------*/
190 SwNumNamesDlg::SwNumNamesDlg(Window *pParent)
191 : ModalDialog(pParent, SW_RES(DLG_NUM_NAMES)),
192 aFormEdit(this, SW_RES(ED_FORM)),
193 aFormBox(this, SW_RES(LB_FORM)),
194 aFormFL(this, SW_RES(FL_FORM)),
195 aOKBtn(this, SW_RES(BT_OK)),
196 aCancelBtn(this, SW_RES(BT_CANCEL)),
197 aHelpBtn(this, SW_RES(BT_HELP))
199 FreeResource();
200 aFormEdit.SetModifyHdl(LINK(this, SwNumNamesDlg, ModifyHdl));
201 aFormBox.SetSelectHdl(LINK(this, SwNumNamesDlg, SelectHdl));
202 aFormBox.SetDoubleClickHdl(LINK(this, SwNumNamesDlg, DoubleClickHdl));
203 SelectHdl(&aFormBox);
206 /*--------------------------------------------------
208 --------------------------------------------------*/
210 __EXPORT SwNumNamesDlg::~SwNumNamesDlg() {}
213 /* -----------------08.07.98 08:46-------------------
215 * --------------------------------------------------*/
216 USHORT lcl_BitToLevel(USHORT nActLevel)
218 USHORT nTmp = nActLevel;
219 USHORT nTmpLevel = 0;
220 while( 0 != (nTmp >>= 1) )
221 nTmpLevel++;
222 return nTmpLevel;
225 /* -----------------07.07.98 14:13-------------------
227 * --------------------------------------------------*/
228 USHORT SwOutlineTabDialog::nNumLevel = 1;
229 SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent,
230 const SfxItemSet* pSwItemSet,
231 SwWrtShell &rSh) :
232 //der UserString wird danach richtig gesetzt
233 SfxTabDialog(pParent, SW_RES(DLG_TAB_OUTLINE), pSwItemSet, FALSE, &aEmptyStr),
234 aNullStr(C2S("____")),
235 aFormMenu(SW_RES(MN_FORM)),
236 rWrtSh(rSh),
237 pChapterNumRules(SW_MOD()->GetChapterNumRules()),
238 bModified(rWrtSh.IsModified())
240 // --> OD 2008-04-14 #outlinelevel#
241 SetText( SW_RES( STR_OUTLINE_NUMBERING ) );
242 // <--
243 PushButton* pUserButton = GetUserButton();
244 pUserButton->SetText(SW_RES(ST_FORM));
245 pUserButton->SetHelpId(HID_OUTLINE_FORM);
246 pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl));
248 FreeResource();
249 pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
250 GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl));
252 AddTabPage(TP_NUM_POSITION , &SwNumPositionTabPage::Create, 0);
253 AddTabPage(TP_OUTLINE_NUM , &SwOutlineSettingsTabPage::Create, 0);
255 String sHeadline;
256 USHORT i;
258 for( i = 0; i < MAXLEVEL; ++i )
260 // wurde die Vorlage noch nicht angelegt, dann ist sie noch an dieserPosition
261 if( !rWrtSh.GetParaStyle( sHeadline =
262 SwStyleNameMapper::GetUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
263 sHeadline )) )
264 aCollNames[i] = sHeadline;
267 // Erfragen der Gliederungsebenen der Textvorlagen
268 const USHORT nCount = rWrtSh.GetTxtFmtCollCount();
269 for(i = 0; i < nCount; ++i )
271 SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i);
272 if(!rTxtColl.IsDefault())
274 //BYTE nOutLevel = rTxtColl.GetOutlineLevel(); //<-#outline level, removed out by zhaojianwei
275 //if(nOutLevel != NO_NUMBERING)
276 //->added by zhaojianwei
277 if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
279 int nOutLevel = rTxtColl.GetAssignedOutlineStyleLevel();
280 aCollNames[ nOutLevel ] = rTxtColl.GetName();
282 //<-end
287 /* -----------------07.07.98 14:13-------------------
289 * --------------------------------------------------*/
290 SwOutlineTabDialog::~SwOutlineTabDialog()
292 delete pNumRule;
295 /* -----------------07.07.98 14:13-------------------
297 * --------------------------------------------------*/
298 void SwOutlineTabDialog::PageCreated(USHORT nPageId, SfxTabPage& rPage)
300 switch ( nPageId )
302 case TP_NUM_POSITION:
303 ((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
304 ((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this);
305 break;
306 case TP_OUTLINE_NUM:
307 ((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh);
308 break;
311 /* -----------------07.07.98 14:19-------------------
313 * --------------------------------------------------*/
314 IMPL_LINK( SwOutlineTabDialog, CancelHdl, Button *, EMPTYARG )
316 if (!bModified)
317 rWrtSh.ResetModified();
318 EndDialog(RET_CANCEL);
319 return 0;
321 /* -----------------08.07.98 12:14-------------------
323 * --------------------------------------------------*/
324 IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn )
326 //PopupMenu auffuellen
327 for( USHORT i = 0; i < SwChapterNumRules::nMaxRules; ++i )
329 const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
330 if( pRules )
331 aFormMenu.SetItemText(i + MN_FORMBASE, pRules->GetName());
333 aFormMenu.SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl));
334 aFormMenu.Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN);
335 return 0;
338 /* -----------------08.07.98 12:14-------------------
340 * --------------------------------------------------*/
341 IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu )
343 BYTE nLevelNo = 0;
344 switch(pMenu->GetCurItemId())
346 case MN_FORM1: nLevelNo = 1; break;
347 case MN_FORM2: nLevelNo = 2; break;
348 case MN_FORM3: nLevelNo = 3; break;
349 case MN_FORM4: nLevelNo = 4; break;
350 case MN_FORM5: nLevelNo = 5; break;
351 case MN_FORM6: nLevelNo = 6; break;
352 case MN_FORM7: nLevelNo = 7; break;
353 case MN_FORM8: nLevelNo = 8; break;
354 case MN_FORM9: nLevelNo = 9; break;
356 case MN_SAVE:
358 SwNumNamesDlg *pDlg = new SwNumNamesDlg(this);
359 const String *aStrArr[SwChapterNumRules::nMaxRules];
360 for(USHORT i = 0; i < SwChapterNumRules::nMaxRules; ++i)
362 const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
363 if(pRules)
364 aStrArr[i] = &pRules->GetName();
365 else
366 aStrArr[i] = 0;
368 pDlg->SetUserNames(aStrArr);
369 if(RET_OK == pDlg->Execute())
371 const String aName(pDlg->GetName());
372 pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
373 *pNumRule, aName ), pDlg->GetCurEntryPos() );
374 pMenu->SetItemText(
375 pDlg->GetCurEntryPos() + MN_FORMBASE, aName);
377 delete pDlg;
378 return 0;
383 if( nLevelNo-- )
385 const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
386 if( pRules )
388 pRules->MakeNumRule( rWrtSh, *pNumRule );
389 pNumRule->SetRuleType( OUTLINE_RULE );
391 else
392 *pNumRule = *rWrtSh.GetOutlineNumRule();
395 USHORT nPageId = GetCurPageId();
396 SfxTabPage* pPage = GetTabPage( nPageId );
397 pPage->Reset(*GetOutputItemSet());
399 return 0;
401 /* -----------------07.07.98 14:19-------------------
403 * --------------------------------------------------*/
404 USHORT SwOutlineTabDialog::GetLevel(const String &rFmtName) const
406 for(USHORT i = 0; i < MAXLEVEL; ++i)
408 if(aCollNames[i] == rFmtName)
409 return i;
411 return MAXLEVEL;//NO_NUMBERING; //#outline level,zhaojianwei
414 /* -----------------07.07.98 16:30-------------------
416 * --------------------------------------------------*/
417 short SwOutlineTabDialog::Ok()
419 SfxTabDialog::Ok();
420 // bei allen erzeugten Vorlagen die Ebenen setzen, muss
421 // geschehen, um evtl. aufgehobene Zuordnungen
422 // auch wieder zu loeschen
424 // --> OD 2006-12-11 #130443#
425 // encapsulate changes into a action to avoid effects on the current cursor
426 // position during the changes.
427 rWrtSh.StartAction();
428 // <--
430 const SwNumRule * pOutlineRule = rWrtSh.GetOutlineNumRule();
432 USHORT i, nCount = rWrtSh.GetTxtFmtCollCount();
433 for( i = 0; i < nCount; ++i )
435 SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i);
436 if( !rTxtColl.IsDefault() )
438 //rTxtColl.SetOutlineLevel( (BYTE)GetLevel(rTxtColl.GetName()));//#outline level,removed by zhaojianwei
440 const SfxPoolItem & rItem =
441 rTxtColl.GetFmtAttr(RES_PARATR_NUMRULE, FALSE);
443 //if ((BYTE)GetLevel(rTxtColl.GetName()) == NO_NUMBERING) //#outline level,removed by zhaojianwei
445 // if (static_cast<const SwNumRuleItem &>(rItem).GetValue() ==
446 // pOutlineRule->GetName())
447 // {
448 // rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE);
449 // }
451 //else
453 // if (static_cast<const SwNumRuleItem &>(rItem).GetValue() !=
454 // pOutlineRule->GetName())
455 // {
456 // SwNumRuleItem aItem(pOutlineRule->GetName());
457 // rTxtColl.SetFmtAttr(aItem);
458 // }
460 if ((BYTE)GetLevel(rTxtColl.GetName()) == MAXLEVEL) //add by zhaojianwei
462 if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
464 rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
466 if (static_cast<const SwNumRuleItem &>(rItem).GetValue() ==
467 pOutlineRule->GetName())
469 rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE);
472 else
474 rTxtColl.AssignToListLevelOfOutlineStyle(GetLevel(rTxtColl.GetName()));
476 if (static_cast<const SwNumRuleItem &>(rItem).GetValue() !=
477 pOutlineRule->GetName())
479 SwNumRuleItem aItem(pOutlineRule->GetName());
480 rTxtColl.SetFmtAttr(aItem);
482 } //<-end,zhaojianwei
486 for(i = 0; i < MAXLEVEL; ++i )
488 String sHeadline;
489 ::SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
490 sHeadline );
491 SwTxtFmtColl* pColl = rWrtSh.FindTxtFmtCollByName( sHeadline );
492 if( !pColl )
494 //if( !aCollNames[i].Len() ) //#outline level,removed by zhaojianwei
496 // SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool(
497 // static_cast< USHORT >(RES_POOLCOLL_HEADLINE1 + i) );
498 // pTxtColl->SetOutlineLevel( NO_NUMBERING );
499 // pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE);
501 //else if(aCollNames[i] != sHeadline)
503 // SwTxtFmtColl* pTxtColl = rWrtSh.GetParaStyle(
504 // aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
505 // if(pTxtColl)
506 // {
507 // pTxtColl->SetOutlineLevel( static_cast< BYTE >(i) );
509 // SwNumRuleItem aItem(pOutlineRule->GetName());
510 // pTxtColl->SetFmtAttr(aItem);
511 // }
513 if(aCollNames[i] != sHeadline)//->added by zhaojianwei
515 SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool(
516 static_cast< USHORT >(RES_POOLCOLL_HEADLINE1 + i) );
517 pTxtColl->DeleteAssignmentToListLevelOfOutlineStyle();
518 pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE);
520 if( aCollNames[i].Len() )
522 pTxtColl = rWrtSh.GetParaStyle(
523 aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
524 if(pTxtColl)
526 pTxtColl->AssignToListLevelOfOutlineStyle(i);
527 SwNumRuleItem aItem(pOutlineRule->GetName());
528 pTxtColl->SetFmtAttr(aItem);
531 }//<--end,zhaojianwei
535 rWrtSh.SetOutlineNumRule( *pNumRule);
537 // --> OD 2006-12-11 #130443#
538 rWrtSh.EndAction();
539 // <--
541 return RET_OK;
544 /* -----------------07.07.98 14:19-------------------
546 * --------------------------------------------------*/
547 SwOutlineSettingsTabPage::SwOutlineSettingsTabPage(Window* pParent, const SfxItemSet& rSet) :
548 SfxTabPage(pParent, SW_RES(TP_OUTLINE_NUM), rSet),
549 aLevelLB( this, SW_RES(LB_LEVEL )),
550 aLevelFL( this, SW_RES(FL_LEVEL )),
551 aCollLbl(this, SW_RES(FT_COLL)),
552 aCollBox(this, SW_RES(LB_COLL)),
553 aNumberLbl(this, SW_RES(FT_NUMBER)),
554 aNumberBox(this, SW_RES(LB_NUMBER), INSERT_NUM_TYPE_NO_NUMBERING|INSERT_NUM_EXTENDED_TYPES),
555 aCharFmtFT(this, SW_RES(FT_CHARFMT)),
556 aCharFmtLB(this, SW_RES(LB_CHARFMT)),
557 aAllLevelFT( this, SW_RES(FT_ALL_LEVEL)),
558 aAllLevelNF( this, SW_RES(NF_ALL_LEVEL)),
559 aDelim(this, SW_RES(FT_DELIM)),
560 aPrefixFT(this, SW_RES(FT_PREFIX)),
561 aPrefixED(this, SW_RES(ED_PREFIX)),
562 aSuffixFT(this, SW_RES(FT_SUFFIX)),
563 aSuffixED(this, SW_RES(ED_SUFFIX)),
564 aStartLbl(this, SW_RES(FT_START)),
565 aStartEdit(this, SW_RES(ED_START)),
566 aNumberFL(this, SW_RES(FL_NUMBER)),
567 aPreviewWIN( this, SW_RES(WIN_PREVIEW )),
569 aNoFmtName(SW_RES(ST_NO_COLL)),
570 pSh(0),
571 pCollNames(0),
572 nActLevel(1)
574 FreeResource();
575 SetExchangeSupport();
577 aCollBox.InsertEntry(aNoFmtName);
578 aLevelLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, LevelHdl));
579 aAllLevelNF.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, ToggleComplete));
580 aCollBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CollSelect));
581 aCollBox.SetGetFocusHdl(LINK(this, SwOutlineSettingsTabPage, CollSelectGetFocus));
582 aNumberBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, NumberSelect));
583 aPrefixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
584 aSuffixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
585 aStartEdit.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, StartModified));
586 aCharFmtLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CharFmtHdl));
589 /* -----------------07.07.98 14:19-------------------
591 * --------------------------------------------------*/
592 void SwOutlineSettingsTabPage::Update()
594 // falls eine Vorlage fuer diese Ebene bereits selektiert wurde,
595 // diese in der ListBox auswaehlean
596 aCollBox.Enable(USHRT_MAX != nActLevel);
597 if(USHRT_MAX == nActLevel)
599 BOOL bSamePrefix = TRUE;
600 BOOL bSameSuffix = TRUE;
601 BOOL bSameType = TRUE;
602 BOOL bSameComplete = TRUE;
603 BOOL bSameStart = TRUE;
604 BOOL bSameCharFmt = TRUE;
606 const SwNumFmt* aNumFmtArr[MAXLEVEL];
607 const SwCharFmt* pFirstFmt = 0;
609 for(USHORT i = 0; i < MAXLEVEL; i++)
612 aNumFmtArr[ i ] = &pNumRule->Get(i);
613 if(i == 0)
614 pFirstFmt = aNumFmtArr[i]->GetCharFmt();
615 else
617 bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[0]->GetNumberingType();
618 bSameStart &= aNumFmtArr[i]->GetStart() == aNumFmtArr[0]->GetStart();
619 bSamePrefix &= aNumFmtArr[i]->GetPrefix() == aNumFmtArr[0]->GetPrefix();
620 bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix();
621 bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels();
622 const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt();
623 bSameCharFmt &= !pFirstFmt && !pFmt
624 || pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName();
627 CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType());
628 if(bSameType)
629 aNumberBox.SelectNumberingType( aNumFmtArr[0]->GetNumberingType() );
630 else
631 aNumberBox.SetNoSelection();
632 if(bSameStart)
633 aStartEdit.SetValue(aNumFmtArr[0]->GetStart());
634 else
635 aStartEdit.SetText(aEmptyStr);
636 if(bSamePrefix)
637 aPrefixED.SetText(aNumFmtArr[0]->GetPrefix());
638 else
639 aPrefixED.SetText(aEmptyStr);
640 if(bSameSuffix)
641 aSuffixED.SetText(aNumFmtArr[0]->GetSuffix());
642 else
643 aSuffixED.SetText(aEmptyStr);
645 if(bSameCharFmt)
647 if(pFirstFmt)
648 aCharFmtLB.SelectEntry(pFirstFmt->GetName());
649 else
650 aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone );
652 else
653 aCharFmtLB.SetNoSelection();
655 aAllLevelFT.Enable(TRUE);
656 aAllLevelNF.Enable(TRUE);
657 aAllLevelNF.SetMax(MAXLEVEL);
658 if(bSameComplete)
660 aAllLevelNF.SetValue(aNumFmtArr[0]->GetIncludeUpperLevels());
662 else
664 aAllLevelNF.SetText(aEmptyStr);
667 else
669 USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
670 String aColl(pCollNames[nTmpLevel]);
671 if(aColl.Len())
672 aCollBox.SelectEntry(aColl);
673 else
674 aCollBox.SelectEntry(aNoFmtName);
675 const SwNumFmt &rFmt = pNumRule->Get(nTmpLevel);
677 aNumberBox.SelectNumberingType( rFmt.GetNumberingType() );
678 aPrefixED.SetText(rFmt.GetPrefix());
679 aSuffixED.SetText(rFmt.GetSuffix());
680 const SwCharFmt* pFmt = rFmt.GetCharFmt();
681 if(pFmt)
682 aCharFmtLB.SelectEntry(pFmt->GetName());
683 else
684 aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone );
686 if(nTmpLevel)
688 aAllLevelFT.Enable(TRUE);
689 aAllLevelNF.Enable(TRUE);
690 aAllLevelNF.SetMax(nTmpLevel + 1);
691 aAllLevelNF.SetValue(rFmt.GetIncludeUpperLevels());
693 else
695 aAllLevelNF.SetText(aEmptyStr);
696 aAllLevelNF.Enable(FALSE);
697 aAllLevelFT.Enable(FALSE);
699 CheckForStartValue_Impl(rFmt.GetNumberingType());
700 aStartEdit.SetValue( rFmt.GetStart() );
702 SetModified();
705 /* -----------------07.07.98 14:19-------------------
707 * --------------------------------------------------*/
708 IMPL_LINK( SwOutlineSettingsTabPage, LevelHdl, ListBox *, pBox )
710 nActLevel = 0;
711 if(pBox->IsEntryPosSelected( MAXLEVEL ))
713 nActLevel = 0xFFFF;
715 else
717 USHORT nMask = 1;
718 for( USHORT i = 0; i < MAXLEVEL; i++ )
720 if(pBox->IsEntryPosSelected( i ))
721 nActLevel |= nMask;
722 nMask <<= 1;
725 Update();
726 return 0;
728 /* -----------------07.07.98 14:19-------------------
730 * --------------------------------------------------*/
731 IMPL_LINK( SwOutlineSettingsTabPage, ToggleComplete, NumericField *, pFld )
733 USHORT nMask = 1;
734 for(USHORT i = 0; i < MAXLEVEL; i++)
736 if(nActLevel & nMask)
738 SwNumFmt aNumFmt(pNumRule->Get(i));
739 aNumFmt.SetIncludeUpperLevels( Min( (BYTE)pFld->GetValue(),
740 (BYTE)(i + 1)) );
741 pNumRule->Set(i, aNumFmt);
743 nMask <<= 1;
745 SetModified();
746 return 0;
748 /* -----------------07.07.98 14:19-------------------
750 * --------------------------------------------------*/
751 IMPL_LINK( SwOutlineSettingsTabPage, CollSelect, ListBox *, pBox )
753 BYTE i;
755 const String aCollName(pBox->GetSelectEntry());
756 //0xFFFF darf hier nicht sein (disable)
757 USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
758 String sOldName( pCollNames[nTmpLevel] );
760 for( i = 0; i < MAXLEVEL; ++i)
761 pCollNames[i] = aSaveCollNames[i];
763 if(aCollName == aNoFmtName)
764 pCollNames[nTmpLevel] = aEmptyStr;
765 else
767 pCollNames[nTmpLevel] = aCollName;
768 // wird die Vorlage bereits verwendet ?
769 for( i = 0; i < MAXLEVEL; ++i)
770 if(i != nTmpLevel && pCollNames[i] == aCollName )
771 pCollNames[i] = aEmptyStr;
774 // search the oldname and put it into the current entries
775 if( sOldName.Len() )
776 for( i = 0; i < MAXLEVEL; ++i)
777 if( aSaveCollNames[ i ] == sOldName && i != nTmpLevel &&
778 !pCollNames[ i ].Len() )
780 BYTE n;
781 for( n = 0; n < MAXLEVEL; ++n )
782 if( pCollNames[ n ] == sOldName )
783 break;
785 if( MAXLEVEL == n )
786 // it was a outline leveld name and the current entries is zero.
787 pCollNames[ i ] = sOldName;
790 SetModified();
791 return 0;
794 IMPL_LINK( SwOutlineSettingsTabPage, CollSelectGetFocus, ListBox *, EMPTYARG )
796 for( BYTE i = 0; i < MAXLEVEL; ++i)
797 aSaveCollNames[i] = pCollNames[i];
798 return 0;
801 /* -----------------07.07.98 14:19-------------------
803 * --------------------------------------------------*/
804 IMPL_LINK( SwOutlineSettingsTabPage, NumberSelect, SwNumberingTypeListBox *, pBox )
806 USHORT nMask = 1;
807 sal_Int16 nNumberType = pBox->GetSelectedNumberingType();//(sal_Int16)(ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos());
808 for(USHORT i = 0; i < MAXLEVEL; i++)
810 if(nActLevel & nMask)
812 SwNumFmt aNumFmt(pNumRule->Get(i));
813 aNumFmt.SetNumberingType(nNumberType);
814 pNumRule->Set(i, aNumFmt);
815 CheckForStartValue_Impl(nNumberType);
817 nMask <<= 1;
819 SetModified();
820 return 0;
822 /* -----------------07.07.98 14:19-------------------
824 * --------------------------------------------------*/
825 IMPL_LINK( SwOutlineSettingsTabPage, DelimModify, Edit *, EMPTYARG )
827 USHORT nMask = 1;
828 for(USHORT i = 0; i < MAXLEVEL; i++)
830 if(nActLevel & nMask)
832 SwNumFmt aNumFmt(pNumRule->Get(i));
833 aNumFmt.SetPrefix( aPrefixED.GetText() );
834 aNumFmt.SetSuffix( aSuffixED.GetText() );
835 pNumRule->Set(i, aNumFmt);
837 nMask <<= 1;
839 SetModified();
840 return 0;
842 /* -----------------07.07.98 14:19-------------------
844 * --------------------------------------------------*/
845 IMPL_LINK( SwOutlineSettingsTabPage, StartModified, NumericField *, pFld )
847 USHORT nMask = 1;
848 for(USHORT i = 0; i < MAXLEVEL; i++)
850 if(nActLevel & nMask)
852 SwNumFmt aNumFmt(pNumRule->Get(i));
853 aNumFmt.SetStart( (USHORT)pFld->GetValue() );
854 pNumRule->Set(i, aNumFmt);
856 nMask <<= 1;
858 SetModified();
859 return 0;
861 /* -----------------21.09.98 12:21-------------------
863 * --------------------------------------------------*/
864 IMPL_LINK( SwOutlineSettingsTabPage, CharFmtHdl, ListBox *, EMPTYARG )
866 // bAutomaticCharStyles = FALSE;
867 String sEntry = aCharFmtLB.GetSelectEntry();
868 USHORT nMask = 1;
869 BOOL bFormatNone = sEntry == ViewShell::GetShellRes()->aStrNone;
870 SwCharFmt* pFmt = 0;
871 if(!bFormatNone)
873 USHORT nChCount = pSh->GetCharFmtCount();
874 for(USHORT i = 0; i < nChCount; i++)
876 SwCharFmt& rChFmt = pSh->GetCharFmt(i);
877 if(rChFmt.GetName() == sEntry)
879 pFmt = &rChFmt;
880 break;
883 if(!pFmt)
885 SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
886 SfxStyleSheetBase* pBase;
887 pBase = pPool->Find(sEntry, SFX_STYLE_FAMILY_CHAR);
888 if(!pBase)
889 pBase = &pPool->Make(sEntry, SFX_STYLE_FAMILY_PAGE);
890 pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
895 for(USHORT i = 0; i < MAXLEVEL; i++)
897 if(nActLevel & nMask)
899 SwNumFmt aNumFmt(pNumRule->Get(i));
900 if(bFormatNone)
901 aNumFmt.SetCharFmt(0);
902 else
903 aNumFmt.SetCharFmt(pFmt);
904 pNumRule->Set(i, aNumFmt);
906 nMask <<= 1;
908 return RET_OK;
910 /* -----------------07.07.98 14:19-------------------
912 * --------------------------------------------------*/
913 SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage()
916 /* -----------------07.07.98 16:27-------------------
918 * --------------------------------------------------*/
919 void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell)
921 pSh = pShell;
922 // Erfragen der NumRules dieses Dokumentes
923 pNumRule = ((SwOutlineTabDialog*)GetTabDialog())->GetNumRule();
924 pCollNames = ((SwOutlineTabDialog*)GetTabDialog())->GetCollNames();
926 //pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
928 aPreviewWIN.SetNumRule(pNumRule);
929 aPreviewWIN.SetOutlineNames(pCollNames);
930 // Startwert setzen - nActLevel muss hier 1 sein
931 USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
932 const SwNumFmt& rNumFmt = pNumRule->Get( nTmpLevel );
933 aStartEdit.SetValue( rNumFmt.GetStart() );
935 // Poolformate fuer Ueberschriften anlegen
936 String sStr;
937 USHORT i;
938 for( i = 0; i < MAXLEVEL; ++i )
940 aCollBox.InsertEntry( SwStyleNameMapper::GetUIName(
941 static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), aEmptyStr ));
942 aLevelLB.InsertEntry( String::CreateFromInt32(i + 1) );
944 sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ));
945 sStr += String::CreateFromInt32(MAXLEVEL);
946 aLevelLB.InsertEntry( sStr );
948 // Erfragen der Gliederungsebenen der Textvorlagen
949 const USHORT nCount = pSh->GetTxtFmtCollCount();
950 for( i = 0; i < nCount; ++i )
952 SwTxtFmtColl &rTxtColl = pSh->GetTxtFmtColl(i);
953 if(!rTxtColl.IsDefault())
955 sStr = rTxtColl.GetName();
956 if(LISTBOX_ENTRY_NOTFOUND == aCollBox.GetEntryPos( sStr ))
957 aCollBox.InsertEntry( sStr );
961 aNumberBox.SelectNumberingType(rNumFmt.GetNumberingType());
962 USHORT nOutlinePos = pSh->GetOutlinePos(MAXLEVEL);
963 USHORT nTmp = 0;
964 if(nOutlinePos != USHRT_MAX)
966 nTmp = static_cast<USHORT>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos));
968 aLevelLB.SelectEntryPos(nTmp-1);//nTmp);//#outline level,zhaojianwei
970 // Zeichenvorlagen sammeln
971 aCharFmtLB.Clear();
972 aCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
974 // Zeichenvorlagen
975 ::FillCharStyleListBox(aCharFmtLB,
976 pSh->GetView().GetDocShell());
977 Update();
979 /* -----------------07.07.98 14:19-------------------
981 * --------------------------------------------------*/
982 void SwOutlineSettingsTabPage::ActivatePage(const SfxItemSet& )
984 nActLevel = SwOutlineTabDialog::GetActNumLevel();
985 if(nActLevel != USHRT_MAX)
986 aLevelLB.SelectEntryPos(lcl_BitToLevel(nActLevel));
987 else
988 aLevelLB.SelectEntryPos(MAXLEVEL);
989 LevelHdl(&aLevelLB);
991 /* -----------------07.07.98 14:19-------------------
993 * --------------------------------------------------*/
994 int SwOutlineSettingsTabPage::DeactivatePage(SfxItemSet*)
996 SwOutlineTabDialog::SetActNumLevel(nActLevel);
997 return LEAVE_PAGE;
999 /* -----------------07.07.98 14:19-------------------
1001 * --------------------------------------------------*/
1002 BOOL SwOutlineSettingsTabPage::FillItemSet( SfxItemSet& )
1004 return TRUE;
1006 /* -----------------07.07.98 14:19-------------------
1008 * --------------------------------------------------*/
1009 void SwOutlineSettingsTabPage::Reset( const SfxItemSet& rSet )
1011 ActivatePage(rSet);
1013 /* -----------------07.07.98 14:19-------------------
1015 * --------------------------------------------------*/
1016 SfxTabPage* SwOutlineSettingsTabPage::Create( Window* pParent,
1017 const SfxItemSet& rAttrSet)
1019 return new SwOutlineSettingsTabPage(pParent, rAttrSet);
1021 /* -----------------07.11.2002 15:13-----------------
1023 * --------------------------------------------------*/
1024 void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
1026 BOOL bIsNull = aStartEdit.GetValue() == 0;
1027 BOOL bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
1028 SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
1029 SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
1030 aStartEdit.SetMin(bNoZeroAllowed ? 1 : 0);
1031 if(bIsNull && bNoZeroAllowed)
1032 aStartEdit.GetModifyHdl().Call(&aStartEdit);
1034 /*-----------------09.12.97 11:54-------------------
1036 --------------------------------------------------*/
1037 USHORT lcl_DrawBullet(VirtualDevice* pVDev,
1038 const SwNumFmt& rFmt, USHORT nXStart,
1039 USHORT nYStart, const Size& rSize)
1041 Font aTmpFont(pVDev->GetFont());
1043 Font aFont(*rFmt.GetBulletFont());
1044 aFont.SetSize(rSize);
1045 aFont.SetTransparent(TRUE);
1046 pVDev->SetFont( aFont );
1047 String aText(rFmt.GetBulletChar());
1048 pVDev->DrawText( Point(nXStart, nYStart), aText );
1049 USHORT nRet = (USHORT)pVDev->GetTextWidth(aText);
1051 pVDev->SetFont(aTmpFont);
1052 return nRet;
1054 /*-----------------09.12.97 11:49-------------------
1056 --------------------------------------------------*/
1057 USHORT lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, USHORT nXStart,
1058 USHORT nYStart, USHORT nDivision)
1060 const SvxBrushItem* pBrushItem = rFmt.GetBrush();
1061 USHORT nRet = 0;
1062 if(pBrushItem)
1064 const Graphic* pGrf = pBrushItem->GetGraphic();
1065 if(pGrf)
1067 Size aGSize( rFmt.GetGraphicSize());
1068 aGSize.Width() /= nDivision;
1069 nRet = (USHORT)aGSize.Width();
1070 aGSize.Height() /= nDivision;
1071 pGrf->Draw( pVDev, Point(nXStart,nYStart),
1072 pVDev->PixelToLogic( aGSize ) );
1075 return nRet;
1078 /*-----------------02.12.97 10:34-------------------
1079 Vorschau der Numerierung painten
1080 --------------------------------------------------*/
1081 void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
1083 Size aSize(PixelToLogic(GetOutputSizePixel()));
1084 Rectangle aRect(Point(0,0), aSize);
1086 VirtualDevice* pVDev = new VirtualDevice(*this);
1087 pVDev->SetMapMode(GetMapMode());
1088 pVDev->SetOutputSize( aSize );
1090 // #101524# OJ
1091 pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() );
1092 pVDev->SetLineColor( GetSettings().GetStyleSettings().GetButtonTextColor() );
1093 pVDev->DrawRect(aRect);
1095 if(pActNum)
1097 USHORT nWidthRelation;
1098 if(nPageWidth)
1100 nWidthRelation = USHORT (nPageWidth / aSize.Width());
1101 if(bPosition)
1102 nWidthRelation = nWidthRelation * 2 / 3;
1103 else
1104 nWidthRelation = nWidthRelation / 4;
1106 else
1107 nWidthRelation = 30; // Kapiteldialog
1109 //Hoehe pro Ebene
1110 USHORT nXStep = USHORT(aSize.Width() / (3 * MAXLEVEL));
1111 if(MAXLEVEL < 10)
1112 nXStep /= 2;
1113 USHORT nYStart = 4;
1114 USHORT nYStep = USHORT((aSize.Height() - 6)/ MAXLEVEL);
1115 aStdFont = OutputDevice::GetDefaultFont(
1116 DEFAULTFONT_UI_SANS, (LanguageType)GetAppLanguage(),
1117 DEFAULTFONT_FLAGS_ONLYONE, this );
1118 // #101524# OJ
1119 aStdFont.SetColor( SwViewOption::GetFontColor() );
1122 USHORT nFontHeight = nYStep * 6 / 10;
1123 if(bPosition)
1124 nFontHeight = nYStep * 15 / 10;
1125 aStdFont.SetSize(Size( 0, nFontHeight ));
1127 USHORT nPreNum = pActNum->Get(0).GetStart();
1129 if(bPosition)
1131 USHORT nLineHeight = nFontHeight * 8 / 7;
1132 BYTE nStart = 0;
1133 while( !(nActLevel & (1<<nStart)) )
1135 nStart++;
1137 if(nStart) // damit moeglichs Vorgaenger und Nachfolger gezeigt werden
1138 nStart--;
1140 SwNumberTree::tNumberVector aNumVector;
1141 BYTE nEnd = Min( (BYTE)(nStart + 3), MAXLEVEL );
1142 for( BYTE nLevel = nStart; nLevel < nEnd; ++nLevel )
1144 const SwNumFmt &rFmt = pActNum->Get(nLevel);
1145 aNumVector.push_back(rFmt.GetStart());
1147 // --> OD 2008-02-01 #newlistlevelattrs#
1148 USHORT nXStart( 0 );
1149 short nTextOffset( 0 );
1150 USHORT nNumberXPos( 0 );
1151 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1153 nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
1154 nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
1155 nNumberXPos = nXStart;
1156 USHORT nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
1158 if(nFirstLineOffset <= nNumberXPos)
1159 nNumberXPos = nNumberXPos - nFirstLineOffset;
1160 else
1161 nNumberXPos = 0;
1163 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1165 const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
1166 rFmt.GetFirstLineIndent() ) /
1167 nWidthRelation );
1168 if ( nTmpNumberXPos < 0 )
1170 nNumberXPos = 0;
1172 else
1174 nNumberXPos = static_cast<USHORT>(nTmpNumberXPos);
1177 // <--
1179 USHORT nBulletWidth = 0;
1180 if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
1182 nBulletWidth = lcl_DrawGraphic(pVDev, rFmt,
1183 nNumberXPos,
1184 nYStart, nWidthRelation);
1186 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
1188 nBulletWidth = lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize());
1190 else
1192 pVDev->SetFont(aStdFont);
1193 if(pActNum->IsContinusNum())
1194 aNumVector[nLevel] = nPreNum;
1195 // --> OD 2005-11-17 #128041#
1196 String aText(pActNum->MakeNumString( aNumVector ));
1197 // <--
1198 pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
1199 nBulletWidth = (USHORT)pVDev->GetTextWidth(aText);
1200 nPreNum++;
1202 // --> OD 2008-02-01 #newlistlevelattrs#
1203 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
1204 rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
1206 pVDev->SetFont(aStdFont);
1207 String aText(' ');
1208 pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
1209 nBulletWidth = nBulletWidth + (USHORT)pVDev->GetTextWidth(aText);
1211 // <--
1213 // --> OD 2008-02-01 #newlistlevelattrs#
1214 USHORT nTextXPos( 0 );
1215 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1217 nTextXPos = nXStart;
1218 if(nTextOffset < 0)
1219 nTextXPos = nTextXPos + nTextOffset;
1220 if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos )
1221 nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
1223 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1225 switch ( rFmt.GetLabelFollowedBy() )
1227 case SvxNumberFormat::LISTTAB:
1229 nTextXPos = static_cast<USHORT>(
1230 rFmt.GetListtabPos() / nWidthRelation );
1231 if ( nTextXPos < nNumberXPos + nBulletWidth )
1233 nTextXPos = nNumberXPos + nBulletWidth;
1236 break;
1237 case SvxNumberFormat::SPACE:
1238 case SvxNumberFormat::NOTHING:
1240 nTextXPos = nNumberXPos + nBulletWidth;
1242 break;
1245 nXStart = static_cast<USHORT>( rFmt.GetIndentAt() / nWidthRelation );
1247 // <--
1250 Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
1251 pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); // Color( COL_BLACK ) );
1252 pVDev->DrawRect( aRect1 );
1254 Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
1255 pVDev->DrawRect( aRect2 );
1256 nYStart += 2 * nLineHeight;
1259 else
1261 SwNumberTree::tNumberVector aNumVector;
1262 USHORT nLineHeight = nFontHeight * 3 / 2;
1263 for( BYTE nLevel = 0; nLevel < MAXLEVEL;
1264 ++nLevel, nYStart = nYStart + nYStep )
1266 const SwNumFmt &rFmt = pActNum->Get(nLevel);
1267 aNumVector.push_back(rFmt.GetStart());
1268 // --> OD 2008-02-01 #newlistlevelattrs#
1269 USHORT nXStart( 0 );
1270 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1272 nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
1274 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1276 const long nTmpXStart( ( rFmt.GetIndentAt() +
1277 rFmt.GetFirstLineIndent() ) /
1278 nWidthRelation );
1279 if ( nTmpXStart < 0 )
1281 nXStart = 0;
1283 else
1285 nXStart = static_cast<USHORT>(nTmpXStart);
1288 nXStart /= 2;
1289 nXStart += 2;
1290 // <--
1291 USHORT nTextOffset = 2 * nXStep;
1292 if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
1294 lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
1295 nTextOffset = nLineHeight + nXStep;
1297 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
1299 nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
1300 nTextOffset = nTextOffset + nXStep;
1302 else
1304 pVDev->SetFont(aStdFont);
1305 if(pActNum->IsContinusNum())
1306 aNumVector[nLevel] = nPreNum;
1307 // --> OD 2005-11-17 #128041#
1308 String aText(pActNum->MakeNumString( aNumVector ));
1309 // <--
1310 pVDev->DrawText( Point(nXStart, nYStart), aText );
1311 nTextOffset = (USHORT)pVDev->GetTextWidth(aText);
1312 nTextOffset = nTextOffset + nXStep;
1313 nPreNum++;
1315 pVDev->SetFont(aStdFont);
1317 // Changed as per BugID 79541 Branding/Configuration
1318 uno::Any MyAny = ::utl::ConfigManager::GetConfigManager()->
1319 GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
1320 ::rtl::OUString aProductName;
1322 MyAny >>= aProductName;
1323 String sMsg(C2S("%PRODUCTNAME"));
1324 sMsg.SearchAndReplaceAscii( "%PRODUCTNAME" , aProductName );
1326 if(pOutlineNames)
1327 sMsg = pOutlineNames[nLevel];
1328 pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
1332 DrawOutDev( Point(0,0), aSize,
1333 Point(0,0), aSize,
1334 *pVDev );
1335 delete pVDev;
1339 /*-----------------02.12.97 10:34-------------------
1341 --------------------------------------------------*/
1342 NumberingPreview::~NumberingPreview()