update dev300-m58
[ooovba.git] / svx / source / cui / numpages.cxx
bloba9ba8c61cb9878135d6fad959eefcdfc04df5f0c
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: numpages.cxx,v $
10 * $Revision: 1.64 $
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_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 #include <com/sun/star/text/HoriOrientation.hpp>
39 #include <com/sun/star/text/VertOrientation.hpp>
40 #include <com/sun/star/text/RelOrientation.hpp>
42 #include <numpages.hxx>
43 #include <numpages.hrc>
44 #include <svx/dialmgr.hxx>
45 #ifndef _SVX_DIALOGS_HRC
46 #include <svx/dialogs.hrc>
47 #endif
48 #include <tools/shl.hxx>
49 #include <i18npool/mslangid.hxx>
50 #include <svtools/valueset.hxx>
51 #ifndef _SVX_HELPID_HRC
52 #include <helpid.hrc>
53 #endif
54 #include <svx/numitem.hxx>
55 #include <svtools/eitem.hxx>
56 #include <vcl/svapp.hxx>
57 #include <gallery.hxx>
58 #include <svtools/urihelper.hxx>
59 #include <svx/brshitem.hxx>
60 #include <svtools/intitem.hxx>
61 #include <sfx2/objsh.hxx>
62 #include <vcl/graph.hxx>
63 #include <vcl/msgbox.hxx>
64 #include "cuicharmap.hxx"
65 #include <flstitem.hxx>
66 #include <dlgutil.hxx>
67 #include <svx/xtable.hxx>
68 #include <drawitem.hxx>
69 #include <numvset.hxx>
70 #include <htmlmode.hxx>
71 #include <svtools/pathoptions.hxx>
72 #include <svtools/ctrltool.hxx>
73 #include <unolingu.hxx>
74 #include <com/sun/star/style/NumberingType.hpp>
75 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
76 #include <com/sun/star/container/XIndexAccess.hpp>
77 #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
78 #include <com/sun/star/text/XNumberingFormatter.hpp>
79 #include <com/sun/star/beans/PropertyValue.hpp>
80 #include <comphelper/processfactory.hxx>
81 #include <com/sun/star/text/XNumberingTypeInfo.hpp>
83 #include <algorithm>
84 #include <vector>
85 #include "opengrf.hxx"
87 #include <svx/dialogs.hrc> //CHINA001
88 #include <sfx2/request.hxx> //CHINA001
89 #include <svtools/aeitem.hxx> //add CHINA001
90 #include <svtools/stritem.hxx>//add CHINA001
91 #include <svtools/slstitm.hxx> //add CHINA001
93 using namespace com::sun::star;
94 using namespace com::sun::star::uno;
95 using namespace com::sun::star::beans;
96 using namespace com::sun::star::lang;
97 using namespace com::sun::star::i18n;
98 using namespace com::sun::star::text;
99 using namespace com::sun::star::container;
100 using namespace com::sun::star::style;
101 using rtl::OUString;
102 #define C2U(cChar) OUString::createFromAscii(cChar)
104 SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr);
106 /*-----------------07.02.97 15.37-------------------
108 --------------------------------------------------*/
109 #define NUM_PAGETYPE_BULLET 0
110 #define NUM_PAGETYPE_SINGLENUM 1
111 #define NUM_PAGETYPE_NUM 2
112 #define NUM_PAGETYPE_BMP 3
113 #define PAGETYPE_USER_START 10
115 #define SHOW_NUMBERING 0
116 #define SHOW_BULLET 1
117 #define SHOW_BITMAP 2
119 #define MAX_BMP_WIDTH 16
120 #define MAX_BMP_HEIGHT 16
122 static BOOL bLastRelative = FALSE;
123 static const sal_Char cNumberingType[] = "NumberingType";
124 static const sal_Char cValue[] = "Value";
125 static const sal_Char cParentNumbering[] = "ParentNumbering";
126 static const sal_Char cPrefix[] = "Prefix";
127 static const sal_Char cSuffix[] = "Suffix";
128 static const sal_Char cBulletChar[] = "BulletChar";
129 static const sal_Char cBulletFontName[] = "BulletFontName";
130 /* -----------------------------31.01.01 10:23--------------------------------
132 ---------------------------------------------------------------------------*/
133 Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
135 Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
136 Reference < XInterface > xI = xMSF->createInstance(
137 ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
138 Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY);
139 DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
141 return xRet;
143 /* -----------------------------31.01.01 11:40--------------------------------
145 ---------------------------------------------------------------------------*/
146 SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
148 const PropertyValue* pValues = rLevelProps.getConstArray();
149 SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl;
150 for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
152 if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType)))
153 pValues[j].Value >>= pNew->nNumberType;
154 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix)))
155 pValues[j].Value >>= pNew->sPrefix;
156 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix)))
157 pValues[j].Value >>= pNew->sSuffix;
158 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering)))
159 pValues[j].Value >>= pNew->nParentNumbering;
160 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar)))
161 pValues[j].Value >>= pNew->sBulletChar;
162 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName)))
163 pValues[j].Value >>= pNew->sBulletFont;
165 return pNew;
167 /* -----------------28.10.98 08:32-------------------
169 * --------------------------------------------------*/
170 // Die Auswahl an Bullets aus den StarSymbol
171 static const sal_Unicode aBulletTypes[] =
173 0x2022,
174 0x25cf,
175 0xe00c,
176 0xe00a,
177 0x2794,
178 0x27a2,
179 0x2717,
180 0x2714
182 /* -----------------28.10.98 09:42-------------------
184 * --------------------------------------------------*/
185 static sal_Char __READONLY_DATA aNumChar[] =
187 'A', //CHARS_UPPER_LETTER
188 'a', //CHARS_LOWER_LETTER
189 'I', //ROMAN_UPPER
190 'i', //ROMAN_LOWER
191 '1', //ARABIC
195 /*-----------------18.03.98 08:35-------------------
196 Ist eins der maskierten Formate gesetzt?
197 --------------------------------------------------*/
198 BOOL lcl_IsNumFmtSet(SvxNumRule* pNum, USHORT nLevelMask)
200 BOOL bRet = FALSE;
201 USHORT nMask = 1;
202 for( USHORT i = 0; i < SVX_MAX_NUM && !bRet; i++ )
204 if(nLevelMask & nMask)
205 bRet |= 0 != pNum->Get( i );
206 nMask <<= 1 ;
208 return bRet;
210 /* -----------------28.10.98 08:50-------------------
212 * --------------------------------------------------*/
214 Font& lcl_GetDefaultBulletFont()
216 static BOOL bInit = 0;
217 static Font aDefBulletFont( UniString::CreateFromAscii(
218 RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),
219 String(), Size( 0, 14 ) );
220 if(!bInit)
222 aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
223 aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
224 aDefBulletFont.SetPitch( PITCH_DONTKNOW );
225 aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
226 aDefBulletFont.SetTransparent( TRUE );
227 bInit = TRUE;
229 return aDefBulletFont;
233 /**************************************************************************/
234 /* */
235 /* */
236 /**************************************************************************/
239 SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
240 const SfxItemSet& rSet) :
241 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ),
242 aValuesFL( this, SVX_RES(FL_VALUES) ),
243 pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )),
244 pActNum(0),
245 pSaveNum(0),
246 nActNumLvl( USHRT_MAX ),
247 bModified(FALSE),
248 bPreset(FALSE),
249 nNumItemId(SID_ATTR_NUMBERING_RULE)
251 FreeResource();
252 SetExchangeSupport();
253 pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
254 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
255 pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM );
257 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
258 if(xDefNum.is())
260 Sequence< Sequence< PropertyValue > > aNumberings;
261 LanguageType eLang = Application::GetSettings().GetLanguage();
262 Locale aLocale = SvxCreateLocale(eLang);
265 aNumberings =
266 xDefNum->getDefaultContinuousNumberingLevels( aLocale );
269 sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength();
271 const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
272 for(sal_Int32 i = 0; i < nLength; i++)
274 SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
275 aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count());
278 catch(Exception&)
281 Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
282 pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale);
285 /*-----------------07.02.97 12.08-------------------
287 --------------------------------------------------*/
289 SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
291 delete pActNum;
292 delete pExamplesVS;
293 delete pSaveNum;
294 aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count());
297 /*-----------------07.02.97 12.13-------------------
299 --------------------------------------------------*/
301 SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent,
302 const SfxItemSet& rAttrSet)
304 return new SvxSingleNumPickTabPage(pParent, rAttrSet);
307 /*-----------------07.02.97 12.09-------------------
309 --------------------------------------------------*/
312 BOOL SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet )
314 if(bPreset || bModified && pSaveNum)
316 *pSaveNum = *pActNum;
317 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
318 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
321 return bModified;
324 /*-----------------08.02.97 16.27-------------------
326 --------------------------------------------------*/
328 void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
330 const SfxPoolItem* pItem;
331 bPreset = FALSE;
332 BOOL bIsPreset = FALSE;
333 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
334 if(pExampleSet)
336 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
337 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
338 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
339 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
341 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
343 delete pSaveNum;
344 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
346 if(*pSaveNum != *pActNum)
348 *pActNum = *pSaveNum;
349 pExamplesVS->SetNoSelection();
351 // ersten Eintrag vorselektieren
352 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
354 pExamplesVS->SelectItem(1);
355 NumSelectHdl_Impl(pExamplesVS);
356 bPreset = TRUE;
358 bPreset |= bIsPreset;
360 bModified = FALSE;
363 /*-----------------08.02.97 11.28-------------------
365 --------------------------------------------------*/
367 int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
369 if(_pSet)
370 FillItemSet(*_pSet);
371 return TRUE;
374 /*-----------------07.02.97 12.09-------------------
376 --------------------------------------------------*/
379 void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet )
381 const SfxPoolItem* pItem;
382 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
383 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
384 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
385 if(eState != SFX_ITEM_SET)
387 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
388 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
390 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
391 delete pSaveNum;
392 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
394 if(!pActNum)
395 pActNum = new SvxNumRule(*pSaveNum);
396 else if(*pSaveNum != *pActNum)
397 *pActNum = *pSaveNum;
399 /*-----------------08.02.97 11.40-------------------
401 --------------------------------------------------*/
403 IMPL_LINK(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
405 if(pActNum)
407 bPreset = FALSE;
408 bModified = TRUE;
409 USHORT nIdx = pExamplesVS->GetSelectItemId() - 1;
410 DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index");
411 if(aNumSettingsArr.Count() <= nIdx)
412 return 0;
413 SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx);
414 sal_Int16 eNewType = _pSet->nNumberType;
415 const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0;
416 const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0;
418 USHORT nMask = 1;
419 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
421 if(nActNumLvl & nMask)
423 SvxNumberFormat aFmt(pActNum->GetLevel(i));
424 aFmt.SetNumberingType(eNewType);
425 String aEmptyStr;
426 if(cLocalPrefix == ' ')
427 aFmt.SetPrefix( aEmptyStr );
428 else
429 aFmt.SetPrefix(_pSet->sPrefix);
430 if(cLocalSuffix == ' ')
431 aFmt.SetSuffix( aEmptyStr );
432 else
433 aFmt.SetSuffix(_pSet->sSuffix);
434 aFmt.SetCharFmtName(sNumCharFmtName);
435 // #62069# // #92724#
436 aFmt.SetBulletRelSize(100);
437 pActNum->SetLevel(i, aFmt);
439 nMask <<= 1 ;
442 return 0;
445 /*-----------------06.06.97 11.15-------------------
447 --------------------------------------------------*/
448 IMPL_LINK(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
450 NumSelectHdl_Impl(pExamplesVS);
451 OKButton& rOk = GetTabDialog()->GetOKButton();
452 rOk.GetClickHdl().Call(&rOk);
453 return 0;
456 /**************************************************************************/
457 /* */
458 /* */
459 /**************************************************************************/
462 SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent,
463 const SfxItemSet& rSet) :
464 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BULLET ), rSet ),
465 aValuesFL( this, SVX_RES(FL_VALUES) ),
466 pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_BULLET )),
467 pActNum(0),
468 pSaveNum(0),
469 nActNumLvl( USHRT_MAX ),
470 bModified(FALSE),
471 bPreset(FALSE),
472 nNumItemId(SID_ATTR_NUMBERING_RULE)
474 FreeResource();
475 SetExchangeSupport();
476 pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
477 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
478 pExamplesVS->SetHelpId(HID_VALUESET_BULLET );
481 /*-----------------07.02.97 12.10-------------------
483 --------------------------------------------------*/
486 SvxBulletPickTabPage::~SvxBulletPickTabPage()
488 delete pActNum;
489 delete pExamplesVS;
490 delete pSaveNum;
492 /*-----------------07.02.97 12.10-------------------
494 --------------------------------------------------*/
497 SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent,
498 const SfxItemSet& rAttrSet)
500 return new SvxBulletPickTabPage(pParent, rAttrSet);
503 /*-----------------07.02.97 12.10-------------------
505 --------------------------------------------------*/
508 BOOL SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet )
510 if(bPreset || bModified && pActNum)
512 *pSaveNum = *pActNum;
513 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
514 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
516 return bModified;
518 /*-----------------08.02.97 16.28-------------------
520 --------------------------------------------------*/
522 void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
524 const SfxPoolItem* pItem;
525 bPreset = FALSE;
526 BOOL bIsPreset = FALSE;
527 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
528 if(pExampleSet)
530 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
531 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
532 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
533 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
535 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
537 delete pSaveNum;
538 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
540 if(*pSaveNum != *pActNum)
542 *pActNum = *pSaveNum;
543 pExamplesVS->SetNoSelection();
545 // ersten Eintrag vorselektieren
546 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
548 pExamplesVS->SelectItem(1);
549 NumSelectHdl_Impl(pExamplesVS);
550 bPreset = TRUE;
552 bPreset |= bIsPreset;
553 bModified = FALSE;
555 /*-----------------08.02.97 11.28-------------------
557 --------------------------------------------------*/
559 int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet)
561 if(_pSet)
562 FillItemSet(*_pSet);
563 return TRUE;
566 /*-----------------07.02.97 12.11-------------------
568 --------------------------------------------------*/
571 void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet )
573 const SfxPoolItem* pItem;
574 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
575 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
576 if(eState != SFX_ITEM_SET)
578 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
579 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
581 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
582 delete pSaveNum;
583 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
585 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
587 if(!pActNum)
588 pActNum = new SvxNumRule(*pSaveNum);
589 else if(*pSaveNum != *pActNum)
590 *pActNum = *pSaveNum;
592 /*-----------------08.02.97 11.58-------------------
594 --------------------------------------------------*/
596 IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
598 if(pActNum)
600 bPreset = FALSE;
601 bModified = TRUE;
602 sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1];
603 Font& rActBulletFont = lcl_GetDefaultBulletFont();
605 USHORT nMask = 1;
606 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
608 if(nActNumLvl & nMask)
610 SvxNumberFormat aFmt(pActNum->GetLevel(i));
611 aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
612 aFmt.SetBulletFont(&rActBulletFont);
613 aFmt.SetBulletChar(cChar );
614 aFmt.SetCharFmtName(sBulletCharFmtName);
615 // #62069# // #92724#
616 aFmt.SetBulletRelSize(45);
617 pActNum->SetLevel(i, aFmt);
619 nMask <<= 1;
623 return 0;
626 /*-----------------06.06.97 11.16-------------------
628 --------------------------------------------------*/
629 IMPL_LINK(SvxBulletPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
631 NumSelectHdl_Impl(pExamplesVS);
632 OKButton& rOk = GetTabDialog()->GetOKButton();
633 rOk.GetClickHdl().Call(&rOk);
634 return 0;
637 //Add CHINA001
638 void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet)
641 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
643 if (pBulletCharFmt)
644 SetCharFmtName( pBulletCharFmt->GetValue());
648 //end of add CHINA001
649 /**************************************************************************/
650 /* */
651 /* */
652 /**************************************************************************/
655 SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
656 const SfxItemSet& rSet) :
657 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_NUM ), rSet ),
658 aValuesFL( this, SVX_RES(FL_VALUES) ),
659 pExamplesVS( new SvxNumValueSet(this, SVX_RES(VS_VALUES), NUM_PAGETYPE_NUM )),
660 pActNum(0),
661 pSaveNum(0),
662 nActNumLvl( USHRT_MAX ),
663 nNumItemId(SID_ATTR_NUMBERING_RULE),
664 bModified(FALSE),
665 bPreset(FALSE)
668 FreeResource();
670 SetExchangeSupport();
672 pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
673 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
674 pExamplesVS->SetHelpId(HID_VALUESET_NUM );
676 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
677 if(xDefNum.is())
679 Sequence<Reference<XIndexAccess> > aOutlineAccess;
680 LanguageType eLang = Application::GetSettings().GetLanguage();
681 Locale aLocale = SvxCreateLocale(eLang);
684 aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );
686 for(sal_Int32 nItem = 0;
687 nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
688 nItem++ )
690 SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
692 Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
693 for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
695 Any aValueAny = xLevel->getByIndex(nLevel);
696 Sequence<PropertyValue> aLevelProps;
697 aValueAny >>= aLevelProps;
698 SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps);
699 rItemArr.Insert( pNew, rItemArr.Count() );
703 catch(Exception&)
706 Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
707 pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale);
710 /*-----------------07.02.97 12.12-------------------
712 --------------------------------------------------*/
715 SvxNumPickTabPage::~SvxNumPickTabPage()
717 delete pActNum;
718 delete pExamplesVS;
719 delete pSaveNum;
722 /*-----------------07.02.97 12.12-------------------
724 --------------------------------------------------*/
727 SfxTabPage* SvxNumPickTabPage::Create( Window* pParent,
728 const SfxItemSet& rAttrSet)
730 return new SvxNumPickTabPage(pParent, rAttrSet);
733 /*-----------------07.02.97 12.12-------------------
735 --------------------------------------------------*/
738 BOOL SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet )
740 if(bPreset || bModified && pActNum)
742 *pSaveNum = *pActNum;
743 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
744 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
746 return bModified;
748 /*-----------------08.02.97 16.28-------------------
750 --------------------------------------------------*/
752 void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
754 const SfxPoolItem* pItem;
755 bPreset = FALSE;
756 BOOL bIsPreset = FALSE;
757 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
758 if(pExampleSet)
760 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
761 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
762 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
763 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
765 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
767 delete pSaveNum;
768 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
770 if(*pSaveNum != *pActNum)
772 *pActNum = *pSaveNum;
773 pExamplesVS->SetNoSelection();
775 // ersten Eintrag vorselektieren
776 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
778 pExamplesVS->SelectItem(1);
779 NumSelectHdl_Impl(pExamplesVS);
780 bPreset = TRUE;
782 bPreset |= bIsPreset;
783 bModified = FALSE;
786 /* -----------------08.02.97 11.29-------------------
788 --------------------------------------------------*/
790 int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
792 if(_pSet)
793 FillItemSet(*_pSet);
794 return TRUE;
797 /*-----------------07.02.97 12.12-------------------
799 --------------------------------------------------*/
801 void SvxNumPickTabPage::Reset( const SfxItemSet& rSet )
803 const SfxPoolItem* pItem;
804 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
805 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
806 if(eState != SFX_ITEM_SET)
808 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
809 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
811 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
812 delete pSaveNum;
813 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
815 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
816 if(!pActNum)
817 pActNum = new SvxNumRule(*pSaveNum);
818 else if(*pSaveNum != *pActNum)
819 *pActNum = *pSaveNum;
823 /*-----------------08.02.97 11.58-------------------
824 Hier werden alle Ebenen veraendert,
825 --------------------------------------------------*/
827 IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
829 if(pActNum)
831 bPreset = FALSE;
832 bModified = TRUE;
834 const FontList* pList = 0;
836 SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1];
838 Font& rActBulletFont = lcl_GetDefaultBulletFont();
839 SvxNumSettings_ImplPtr pLevelSettings = 0;
840 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
842 if(rItemArr.Count() > i)
843 pLevelSettings = rItemArr[i];
844 if(!pLevelSettings)
845 break;
846 SvxNumberFormat aFmt(pActNum->GetLevel(i));
847 aFmt.SetNumberingType( pLevelSettings->nNumberType );
848 USHORT nUpperLevelOrChar = (USHORT)pLevelSettings->nParentNumbering;
849 if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
851 if( pLevelSettings->sBulletFont.getLength() &&
852 pLevelSettings->sBulletFont.compareTo(
853 rActBulletFont.GetName()))
855 //search for the font
856 if(!pList)
858 SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
859 const SvxFontListItem* pFontListItem =
860 (const SvxFontListItem* )pCurDocShell
861 ->GetItem( SID_ATTR_CHAR_FONTLIST );
862 pList = pFontListItem ? pFontListItem->GetFontList() : 0;
864 if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
866 FontInfo aInfo = pList->Get(
867 pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
868 Font aFont(aInfo);
869 aFmt.SetBulletFont(&aFont);
871 else
873 //if it cannot be found then create a new one
874 Font aCreateFont( pLevelSettings->sBulletFont,
875 String(), Size( 0, 14 ) );
876 aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
877 aCreateFont.SetFamily( FAMILY_DONTKNOW );
878 aCreateFont.SetPitch( PITCH_DONTKNOW );
879 aCreateFont.SetWeight( WEIGHT_DONTKNOW );
880 aCreateFont.SetTransparent( TRUE );
881 aFmt.SetBulletFont( &aCreateFont );
884 else
885 aFmt.SetBulletFont( &rActBulletFont );
887 aFmt.SetBulletChar( pLevelSettings->sBulletChar.getLength()
888 ? pLevelSettings->sBulletChar.getStr()[0]
889 : 0 );
890 aFmt.SetCharFmtName( sBulletCharFmtName );
891 // #62069# // #92724#
892 aFmt.SetBulletRelSize(45);
894 else
896 aFmt.SetIncludeUpperLevels(sal::static_int_cast< BYTE >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
897 aFmt.SetCharFmtName(sNumCharFmtName);
898 // #62069# // #92724#
899 aFmt.SetBulletRelSize(100);
901 aFmt.SetPrefix(pLevelSettings->sPrefix);
902 aFmt.SetSuffix(pLevelSettings->sSuffix);
903 pActNum->SetLevel(i, aFmt);
906 return 0;
909 /*-----------------06.06.97 11.16-------------------
911 --------------------------------------------------*/
912 IMPL_LINK(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
914 NumSelectHdl_Impl(pExamplesVS);
915 OKButton& rOk = GetTabDialog()->GetOKButton();
916 rOk.GetClickHdl().Call(&rOk);
917 return 0;
920 //add CHINA001 begin
921 void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet)
923 SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
924 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
927 if (pNumCharFmt &&pBulletCharFmt)
928 SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
930 //end of CHINA001
931 /*-----------------07.02.97 15.59-------------------
933 --------------------------------------------------*/
934 void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType,
935 const OUString& rBulletChar, const OUString& rText, const OUString& rFontName,
936 Point& rLeft, Font& rRuleFont, const Font& rTextFont)
939 if(NumberingType::CHAR_SPECIAL == nNumberingType )
941 rRuleFont.SetStyleName(rFontName);
942 pVDev->SetFont(rRuleFont);
943 pVDev->DrawText(rLeft, rBulletChar);
944 rLeft.X() += pVDev->GetTextWidth(rBulletChar);
946 else
948 pVDev->SetFont(rTextFont);
949 pVDev->DrawText(rLeft, rText);
950 rLeft.X() += pVDev->GetTextWidth(rText);
954 /**************************************************************************/
955 /* */
956 /* */
957 /**************************************************************************/
959 SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
960 const SfxItemSet& rSet) :
961 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_PICK_BMP ), rSet ),
962 aValuesFL( this, SVX_RES(FL_VALUES) ),
963 pExamplesVS( new SvxBmpNumValueSet(this, SVX_RES(VS_VALUES)/*, aGrfNames*/ )),
964 aErrorText( this, SVX_RES(FT_ERROR)),
965 aLinkedCB( this, SVX_RES(CB_LINKED)),
966 pActNum(0),
967 pSaveNum(0),
968 nActNumLvl( USHRT_MAX ),
969 nNumItemId(SID_ATTR_NUMBERING_RULE),
970 bModified(FALSE),
971 bPreset(FALSE)
973 FreeResource();
974 SetExchangeSupport();
975 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
976 pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
977 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
978 aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl));
980 // Grafiknamen ermitteln
982 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
983 pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP );
984 for(USHORT i = 0; i < aGrfNames.Count(); i++)
986 pExamplesVS->InsertItem( i + 1, i);
987 String* pGrfNm = (String*) aGrfNames.GetObject(i);
988 INetURLObject aObj(*pGrfNm);
989 if(aObj.GetProtocol() == INET_PROT_FILE)
990 *pGrfNm = aObj.PathToFileName();
991 pExamplesVS->SetItemText( i + 1, *pGrfNm );
993 if(!aGrfNames.Count())
995 aErrorText.Show();
997 else
999 pExamplesVS->Show();
1000 pExamplesVS->Format();
1005 /*-----------------12.02.97 07.46-------------------
1007 --------------------------------------------------*/
1009 SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
1011 String* pStr = (String*)aGrfNames.First();
1012 while( pStr )
1014 delete pStr;
1015 pStr = (String*)aGrfNames.Next();
1017 delete pExamplesVS;
1018 delete pActNum;
1019 delete pSaveNum;
1022 /*-----------------12.02.97 07.46-------------------
1024 --------------------------------------------------*/
1026 SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent,
1027 const SfxItemSet& rAttrSet)
1029 return new SvxBitmapPickTabPage(pParent, rAttrSet);
1032 /*-----------------12.02.97 07.46-------------------
1034 --------------------------------------------------*/
1036 void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
1038 const SfxPoolItem* pItem;
1039 bPreset = FALSE;
1040 BOOL bIsPreset = FALSE;
1041 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
1042 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
1043 if(pExampleSet)
1045 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
1046 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
1047 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
1048 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
1050 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
1052 delete pSaveNum;
1053 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1055 if(*pSaveNum != *pActNum)
1057 *pActNum = *pSaveNum;
1058 pExamplesVS->SetNoSelection();
1060 // ersten Eintrag vorselektieren
1061 if(aGrfNames.Count() &&
1062 (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)))
1064 pExamplesVS->SelectItem(1);
1065 NumSelectHdl_Impl(pExamplesVS);
1066 bPreset = TRUE;
1068 bPreset |= bIsPreset;
1069 bModified = FALSE;
1071 /*-----------------12.02.97 07.46-------------------
1073 --------------------------------------------------*/
1075 int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet)
1077 if(_pSet)
1078 FillItemSet(*_pSet);
1079 return TRUE;
1081 /*-----------------12.02.97 07.46-------------------
1083 --------------------------------------------------*/
1085 BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet )
1087 if ( !aGrfNames.Count() )
1089 // das ist im SfxItemSet leider nicht zulaessig #52134#
1090 // rSet.DisableItem(SID_ATTR_NUMBERING_RULE);
1091 return FALSE;
1093 if(bPreset || bModified && pActNum)
1095 *pSaveNum = *pActNum;
1096 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
1097 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
1100 return bModified;
1102 /*-----------------12.02.97 07.46-------------------
1104 --------------------------------------------------*/
1106 void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet )
1108 const SfxPoolItem* pItem;
1109 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
1110 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
1111 if(eState != SFX_ITEM_SET)
1113 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
1114 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
1116 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
1117 delete pSaveNum;
1118 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1120 if(!pActNum)
1121 pActNum = new SvxNumRule(*pSaveNum);
1122 else if(*pSaveNum != *pActNum)
1123 *pActNum = *pSaveNum;
1124 if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
1126 aLinkedCB.Check(FALSE);
1127 aLinkedCB.Enable(FALSE);
1129 else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
1131 aLinkedCB.Check(TRUE);
1132 aLinkedCB.Enable(FALSE);
1136 /*-----------------12.02.97 07.53-------------------
1138 --------------------------------------------------*/
1140 IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
1142 if(pActNum)
1144 bPreset = FALSE;
1145 bModified = TRUE;
1146 USHORT nIdx = pExamplesVS->GetSelectItemId() - 1;
1148 String* pGrfName = 0;
1149 if(aGrfNames.Count() > nIdx)
1150 pGrfName = (String*)aGrfNames.GetObject(nIdx);
1152 USHORT nMask = 1;
1153 String aEmptyStr;
1154 USHORT nSetNumberingType = SVX_NUM_BITMAP;
1155 if(aLinkedCB.IsChecked())
1156 nSetNumberingType |= LINK_TOKEN;
1157 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
1159 if(nActNumLvl & nMask)
1161 SvxNumberFormat aFmt(pActNum->GetLevel(i));
1162 aFmt.SetNumberingType(nSetNumberingType);
1163 aFmt.SetPrefix( aEmptyStr );
1164 aFmt.SetSuffix( aEmptyStr );
1165 aFmt.SetCharFmtName( sNumCharFmtName );
1167 Graphic aGraphic;
1168 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic))
1170 Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
1171 sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
1172 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
1173 SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
1174 aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
1176 else if(pGrfName)
1177 aFmt.SetGraphic( *pGrfName );
1178 pActNum->SetLevel(i, aFmt);
1180 nMask <<= 1 ;
1184 return 0;
1187 /*-----------------06.06.97 11.17-------------------
1189 --------------------------------------------------*/
1190 IMPL_LINK(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG)
1192 NumSelectHdl_Impl(pExamplesVS);
1193 OKButton& rOk = GetTabDialog()->GetOKButton();
1194 rOk.GetClickHdl().Call(&rOk);
1195 return 0;
1197 /* -----------------03.11.99 13:46-------------------
1199 --------------------------------------------------*/
1200 IMPL_LINK(SvxBitmapPickTabPage, LinkBmpHdl_Impl, CheckBox*, EMPTYARG )
1202 if(!pExamplesVS->IsNoSelection())
1204 NumSelectHdl_Impl(pExamplesVS);
1206 return 0;
1208 /*-----------------13.02.97 09.40-------------------
1210 --------------------------------------------------*/
1212 //CHINA001 SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/ ) :
1213 //CHINA001
1214 //CHINA001 SvxNumValueSet( pParent, rResId, NUM_PAGETYPE_BMP ),
1215 //CHINA001 // rStrList ( rStrNames ),
1216 //CHINA001 bGrfNotFound( FALSE )
1217 //CHINA001
1218 //CHINA001 {
1219 //CHINA001 GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
1220 //CHINA001 SetStyle( GetStyle() | WB_VSCROLL );
1221 //CHINA001 SetLineCount( 3 );
1222 //CHINA001 aFormatTimer.SetTimeout(300);
1223 //CHINA001 aFormatTimer.SetTimeoutHdl(LINK(this, SvxBmpNumValueSet, FormatHdl_Impl));
1224 //CHINA001 }
1225 //CHINA001
1226 //CHINA001 /*-----------------13.02.97 09.41-------------------
1227 //CHINA001
1228 //CHINA001 --------------------------------------------------*/
1229 //CHINA001
1230 //CHINA001 SvxBmpNumValueSet::~SvxBmpNumValueSet()
1231 //CHINA001 {
1232 //CHINA001 GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
1233 //CHINA001 aFormatTimer.Stop();
1234 //CHINA001 }
1235 //CHINA001 /*-----------------13.02.97 09.41-------------------
1236 //CHINA001
1237 //CHINA001 --------------------------------------------------*/
1238 //CHINA001
1239 //CHINA001 void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
1240 //CHINA001 {
1241 //CHINA001 SvxNumValueSet::UserDraw(rUDEvt);
1242 //CHINA001
1243 //CHINA001 Rectangle aRect = rUDEvt.GetRect();
1244 //CHINA001 OutputDevice* pDev = rUDEvt.GetDevice();
1245 //CHINA001 USHORT nItemId = rUDEvt.GetItemId();
1246 //CHINA001 Point aBLPos = aRect.TopLeft();
1247 //CHINA001
1248 //CHINA001 int nRectHeight = aRect.GetHeight();
1249 //CHINA001 Size aSize(nRectHeight/8, nRectHeight/8);
1250 //CHINA001
1251 //CHINA001 Graphic aGraphic;
1252 //CHINA001 if(!GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - 1,
1253 //CHINA001 &aGraphic, NULL))
1254 //CHINA001 {
1255 //CHINA001 bGrfNotFound = TRUE;
1256 //CHINA001 }
1257 //CHINA001 else
1258 //CHINA001 {
1259 //CHINA001 Point aPos(aBLPos.X() + 5, 0);
1260 //CHINA001 for( USHORT i = 0; i < 3; i++ )
1261 //CHINA001 {
1262 //CHINA001 USHORT nY = 11 + i * 33;
1263 //CHINA001 aPos.Y() = aBLPos.Y() + nRectHeight * nY / 100;
1264 //CHINA001 aGraphic.Draw( pDev, aPos, aSize );
1265 //CHINA001 }
1266 //CHINA001 }
1267 //CHINA001 }
1268 //CHINA001
1269 //CHINA001 /*-----------------14.02.97 07.34-------------------
1270 //CHINA001
1271 //CHINA001 --------------------------------------------------*/
1272 //CHINA001
1273 //CHINA001 IMPL_LINK(SvxBmpNumValueSet, FormatHdl_Impl, Timer*, EMPTYARG)
1274 //CHINA001 {
1275 //CHINA001 // nur, wenn eine Grafik nicht da war, muss formatiert werden
1276 //CHINA001 if(bGrfNotFound)
1277 //CHINA001 {
1278 //CHINA001 bGrfNotFound = FALSE;
1279 //CHINA001 Format();
1280 //CHINA001 }
1281 //CHINA001 Invalidate();
1282 //CHINA001 return 0;
1283 //CHINA001 }
1284 /*-----------------01.12.97 16:15-------------------
1285 Tabpage Numerierungsoptionen
1286 --------------------------------------------------*/
1287 #define NUM_NO_GRAPHIC 1000
1288 SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent,
1289 const SfxItemSet& rSet) :
1290 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ),
1292 aFormatFL( this, SVX_RES(FL_FORMAT )),
1293 aLevelFT( this, SVX_RES(FT_LEVEL )),
1294 aLevelLB( this, SVX_RES(LB_LEVEL )),
1295 aFmtFT( this, SVX_RES(FT_FMT )),
1296 aFmtLB( this, SVX_RES(LB_FMT )),
1297 aPrefixFT( this, SVX_RES(FT_PREFIX )),
1298 aPrefixED( this, SVX_RES(ED_PREFIX )),
1299 aSuffixFT( this, SVX_RES(FT_SUFFIX )),
1300 aSuffixED( this, SVX_RES(ED_SUFFIX )),
1301 aCharFmtFT( this, SVX_RES(FT_CHARFMT )),
1302 aCharFmtLB( this, SVX_RES(LB_CHARFMT )),
1303 aBulColorFT( this, SVX_RES(FT_BUL_COLOR)),
1304 aBulColLB( this, SVX_RES(LB_BUL_COLOR)),
1305 aBulRelSizeFT( this, SVX_RES(FT_BUL_REL_SIZE)),
1306 aBulRelSizeMF( this, SVX_RES(MF_BUL_REL_SIZE)),
1307 aAllLevelFT( this, SVX_RES(FT_ALL_LEVEL)),
1308 aAllLevelNF( this, SVX_RES(NF_ALL_LEVEL)),
1309 aStartFT( this, SVX_RES(FT_START )),
1310 aStartED( this, SVX_RES(ED_START )),
1311 aBulletPB( this, SVX_RES(PB_BULLET )),
1312 aAlignFT( this, SVX_RES(FT_ALIGN )),
1313 aAlignLB( this, SVX_RES(LB_ALIGN )),
1314 aBitmapFT( this, SVX_RES(FT_BITMAP )),
1315 aBitmapMB( this, SVX_RES(MB_BITMAP )),
1316 aSizeFT( this, SVX_RES(FT_SIZE )),
1317 aWidthMF( this, SVX_RES(MF_WIDTH )),
1318 aMultFT( this, SVX_RES(FT_MULT )),
1319 aHeightMF( this, SVX_RES(MF_HEIGHT )),
1320 aRatioCB( this, SVX_RES(CB_RATIO )),
1321 aOrientFT( this, SVX_RES(FT_ORIENT )),
1322 aOrientLB( this, SVX_RES(LB_ORIENT )),
1323 aSameLevelFL( this, SVX_RES(FL_SAME_LEVEL)),
1324 aSameLevelCB( this, SVX_RES(CB_SAME_LEVEL)),
1325 pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))),
1326 pActNum(0),
1327 pSaveNum(0),
1328 bLastWidthModified(FALSE),
1329 bModified(FALSE),
1330 bPreset(FALSE),
1331 bAutomaticCharStyles(TRUE),
1332 bHTMLMode(FALSE),
1333 bMenuButtonInitialized(FALSE),
1334 sBullet(SVX_RES(STR_BULLET)),
1335 nBullet(0xff),
1336 nActNumLvl(USHRT_MAX),
1337 nNumItemId(SID_ATTR_NUMBERING_RULE)
1339 sStartWith = aStartFT.GetText();
1340 pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
1341 SetExchangeSupport();
1342 aActBulletFont = lcl_GetDefaultBulletFont();
1344 aBulletPB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
1345 aFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
1346 aBitmapMB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
1347 aLevelLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
1348 aCharFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
1349 aWidthMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1350 aHeightMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1351 aRatioCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
1352 aStartED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1353 aPrefixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1354 aSuffixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1355 aAllLevelNF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
1356 aOrientLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
1357 aSameLevelCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
1358 aBulRelSizeMF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
1359 aBulColLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
1360 aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
1361 aInvalidateTimer.SetTimeout(50);
1363 aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
1364 PopupMenu* pPopup = new PopupMenu;
1365 aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1367 pPopup->InsertItem( NUM_NO_GRAPHIC, String(SVX_RES(ST_POPUP_EMPTY_ENTRY)) );
1368 pPopup->EnableItem( NUM_NO_GRAPHIC, FALSE );
1370 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
1372 FreeResource();
1374 //get advanced numbering types from the component
1375 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
1376 Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY);
1378 // Extended numbering schemes present in the resource but not offered by
1379 // the i18n framework per configuration must be removed from the listbox.
1380 // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that.
1381 const USHORT nDontRemove = 0xffff;
1382 ::std::vector< USHORT> aRemove( aFmtLB.GetEntryCount(), nDontRemove);
1383 for (size_t i=0; i<aRemove.size(); ++i)
1385 USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(
1386 sal::static_int_cast< USHORT >(i));
1387 if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N &&
1388 nEntryData != (SVX_NUM_BITMAP | 0x80))
1389 aRemove[i] = nEntryData;
1391 if(xInfo.is())
1393 Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( );
1394 const sal_Int16* pTypes = aTypes.getConstArray();
1395 for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
1397 sal_Int16 nCurrent = pTypes[nType];
1398 if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
1400 sal_Bool bInsert = sal_True;
1401 for(USHORT nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++)
1403 USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(nEntry);
1404 if(nEntryData == (USHORT) nCurrent)
1406 bInsert = sal_False;
1407 aRemove[nEntry] = nDontRemove;
1408 break;
1411 if(bInsert)
1413 OUString aIdent = xInfo->getNumberingIdentifier( nCurrent );
1414 USHORT nPos = aFmtLB.InsertEntry(aIdent);
1415 aFmtLB.SetEntryData(nPos,(void*)(ULONG)nCurrent);
1420 for (size_t i=0; i<aRemove.size(); ++i)
1422 if (aRemove[i] != nDontRemove)
1424 USHORT nPos = aFmtLB.GetEntryPos( (void*)(ULONG)aRemove[i]);
1425 aFmtLB.RemoveEntry( nPos);
1430 /*-----------------01.12.97 16:30-------------------
1432 --------------------------------------------------*/
1433 SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
1435 delete aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1436 String* pStr = (String*)aGrfNames.First();
1437 while( pStr )
1439 delete pStr;
1440 pStr = (String*)aGrfNames.Next();
1442 delete pActNum;
1443 delete pPreviewWIN;
1444 delete pSaveNum;
1447 /*-----------------03.12.97 07:52-------------------
1449 --------------------------------------------------*/
1450 void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
1452 if(eMetric == FUNIT_MM)
1454 aWidthMF .SetDecimalDigits(1);
1455 aHeightMF .SetDecimalDigits(1);
1457 aWidthMF .SetUnit( eMetric );
1458 aHeightMF .SetUnit( eMetric );
1461 /*-----------------01.12.97 16:30-------------------
1463 --------------------------------------------------*/
1464 SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent,
1465 const SfxItemSet& rAttrSet)
1467 return new SvxNumOptionsTabPage(pParent, rAttrSet);
1469 /*-----------------01.12.97 16:29-------------------
1471 --------------------------------------------------*/
1472 void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
1474 const SfxPoolItem* pItem;
1475 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
1476 UINT16 nTmpNumLvl = USHRT_MAX;
1477 if(pExampleSet)
1479 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
1480 bPreset = ((const SfxBoolItem*)pItem)->GetValue();
1481 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
1482 nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
1484 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
1486 delete pSaveNum;
1487 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1490 bModified = (!pActNum->Get( 0 ) || bPreset);
1491 if(*pActNum != *pSaveNum ||
1492 nActNumLvl != nTmpNumLvl)
1494 nActNumLvl = nTmpNumLvl;
1495 USHORT nMask = 1;
1496 aLevelLB.SetUpdateMode(FALSE);
1497 aLevelLB.SetNoSelection();
1498 aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
1499 if(nActNumLvl != USHRT_MAX)
1500 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
1502 if(nActNumLvl & nMask)
1503 aLevelLB.SelectEntryPos( i, TRUE);
1504 nMask <<= 1 ;
1506 aLevelLB.SetUpdateMode(TRUE);
1507 *pActNum = *pSaveNum;
1508 InitControls();
1512 /*-----------------01.12.97 16:29-------------------
1514 --------------------------------------------------*/
1515 int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet)
1517 if(_pSet)
1518 FillItemSet(*_pSet);
1519 return TRUE;
1521 /*-----------------01.12.97 16:29-------------------
1523 --------------------------------------------------*/
1524 BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet )
1526 rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
1527 if(bModified && pActNum)
1529 *pSaveNum = *pActNum;
1530 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
1531 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE));
1533 return bModified;
1535 /*-----------------01.12.97 16:29-------------------
1537 --------------------------------------------------*/
1538 void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet )
1540 const SfxPoolItem* pItem;
1541 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
1542 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
1543 if(eState != SFX_ITEM_SET)
1545 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
1546 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
1548 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
1549 delete pSaveNum;
1550 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1552 // Ebenen einfuegen
1553 if(!aLevelLB.GetEntryCount())
1555 for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++)
1556 aLevelLB.InsertEntry( UniString::CreateFromInt32(i));
1557 if(pSaveNum->GetLevelCount() > 1)
1559 String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ) ) );
1560 sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() );
1561 aLevelLB.InsertEntry(sEntry);
1562 aLevelLB.SelectEntry(sEntry);
1564 else
1565 aLevelLB.SelectEntryPos(0);
1567 else
1568 aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
1570 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel();
1571 USHORT nMask = 1;
1572 aLevelLB.SetUpdateMode(FALSE);
1573 aLevelLB.SetNoSelection();
1574 if(nActNumLvl == USHRT_MAX)
1576 aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE);
1578 else
1579 for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++)
1581 if(nActNumLvl & nMask)
1582 aLevelLB.SelectEntryPos( i, TRUE);
1583 nMask <<= 1 ;
1585 aLevelLB.SetUpdateMode(TRUE);
1587 if(!pActNum)
1588 pActNum = new SvxNumRule(*pSaveNum);
1589 else if(*pSaveNum != *pActNum)
1590 *pActNum = *pSaveNum;
1591 pPreviewWIN->SetNumRule(pActNum);
1592 aSameLevelCB.Check(pActNum->IsContinuousNumbering());
1594 //ColorListBox bei Bedarf fuellen
1595 if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) )
1597 SfxObjectShell* pDocSh = SfxObjectShell::Current();
1598 DBG_ASSERT( pDocSh, "DocShell not found!" );
1599 XColorTable* pColorTable = NULL;
1600 FASTBOOL bKillTable = FALSE;
1601 if ( pDocSh )
1603 pItem = pDocSh->GetItem( SID_COLOR_TABLE );
1604 if ( pItem )
1605 pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
1608 if ( !pColorTable )
1610 pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
1611 bKillTable = TRUE;
1614 aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC ));
1616 for ( long i = 0; i < pColorTable->Count(); i++ )
1618 XColorEntry* pEntry = pColorTable->GetColor(i);
1619 aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1622 if ( bKillTable )
1623 delete pColorTable;
1626 SfxObjectShell* pShell;
1627 if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE, &pItem )
1628 || ( 0 != ( pShell = SfxObjectShell::Current()) &&
1629 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
1631 USHORT nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
1632 bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
1635 BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
1636 aCharFmtFT.Show(bCharFmt);
1637 aCharFmtLB.Show(bCharFmt);
1639 BOOL bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
1641 BOOL bAllLevel = bContinuous && !bHTMLMode;
1642 aAllLevelFT.Show(bAllLevel);
1643 aAllLevelNF.Show(bAllLevel);
1645 aSameLevelFL.Show(bContinuous);
1646 aSameLevelCB.Show(bContinuous);
1647 //wieder Missbrauch: im Draw gibt es die Numerierung nur bis zum Bitmap
1648 // without SVX_NUM_NUMBER_NONE
1649 //remove types that are unsupported by Draw/Impress
1650 if(!bContinuous)
1652 USHORT nFmtCount = aFmtLB.GetEntryCount();
1653 for(USHORT i = nFmtCount; i; i--)
1655 USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1);
1656 if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
1657 ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData))
1658 aFmtLB.RemoveEntry(i - 1);
1661 //one must be enabled
1662 if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
1664 long nData = SVX_NUM_BITMAP|LINK_TOKEN;
1665 USHORT nPos = aFmtLB.GetEntryPos((void*)nData);
1666 if(LISTBOX_ENTRY_NOTFOUND != nPos)
1667 aFmtLB.RemoveEntry(nPos);
1669 else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
1671 long nData = SVX_NUM_BITMAP;
1672 USHORT nPos = aFmtLB.GetEntryPos((void*)nData);
1673 if(LISTBOX_ENTRY_NOTFOUND != nPos)
1674 aFmtLB.RemoveEntry(nPos);
1676 if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT))
1678 aAlignFT.Show();
1679 aAlignLB.Show();
1680 Size aSz(aFormatFL.GetSizePixel());
1681 aSz.Height() = aLevelFT.GetSizePixel().Height();
1682 aFormatFL.SetSizePixel(aSz);
1683 aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1686 //MegaHack: Aufgrund eines nicht fixbaren 'designfehlers' im Impress
1687 //Alle arten der numerischen Aufzaehlungen loeschen
1688 if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS))
1690 USHORT nFmtCount = aFmtLB.GetEntryCount();
1691 for(USHORT i = nFmtCount; i; i--)
1693 USHORT nEntryData = (USHORT)(ULONG)aFmtLB.GetEntryData(i - 1);
1694 if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE)
1695 aFmtLB.RemoveEntry(i - 1);
1699 InitControls();
1700 bModified = FALSE;
1703 /*-----------------02.12.97 13:47-------------------
1705 --------------------------------------------------*/
1706 void SvxNumOptionsTabPage::InitControls()
1708 BOOL bShowBullet = TRUE;
1709 BOOL bShowBitmap = TRUE;
1710 BOOL bSameType = TRUE;
1711 BOOL bSameStart = TRUE;
1712 BOOL bSamePrefix = TRUE;
1713 BOOL bSameSuffix = TRUE;
1714 BOOL bAllLevel = TRUE;
1715 BOOL bSameCharFmt = TRUE;
1716 BOOL bSameVOrient = TRUE;
1717 BOOL bSameSize = TRUE;
1718 BOOL bSameBulColor = TRUE;
1719 BOOL bSameBulRelSize= TRUE;
1720 BOOL bSameAdjust = TRUE;
1722 const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
1723 String sFirstCharFmt;
1724 sal_Int16 eFirstOrient = text::VertOrientation::NONE;
1725 Size aFirstSize(0,0);
1726 USHORT nMask = 1;
1727 USHORT nLvl = USHRT_MAX;
1728 USHORT nHighestLevel = 0;
1729 String aEmptyStr;
1731 BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
1732 BOOL bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
1733 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
1735 if(nActNumLvl & nMask)
1737 aNumFmtArr[i] = &pActNum->GetLevel(i);
1738 bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
1739 bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
1740 if(USHRT_MAX == nLvl)
1742 nLvl = i;
1743 sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName();
1744 eFirstOrient = aNumFmtArr[i]->GetVertOrient();
1745 if(bShowBitmap)
1746 aFirstSize = aNumFmtArr[i]->GetGraphicSize();
1748 if( i > nLvl)
1750 bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
1751 bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();
1753 bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
1754 bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
1755 bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
1756 bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName();
1757 bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
1758 if(bShowBitmap && bSameSize)
1759 bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
1760 bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
1761 bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
1762 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
1764 nHighestLevel = i;
1766 else
1767 aNumFmtArr[i] = 0;
1769 nMask <<= 1 ;
1772 SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
1773 CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType());
1774 if(bShowBitmap)
1776 if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
1777 aOrientLB.SetNoSelection();
1778 else
1779 aOrientLB.SelectEntryPos(
1780 sal::static_int_cast< USHORT >(eFirstOrient - 1));
1781 // kein text::VertOrientation::NONE
1783 if(bSameSize)
1785 SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit);
1786 SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit);
1788 else
1790 aHeightMF.SetText(aEmptyStr);
1791 aWidthMF.SetText(aEmptyStr);
1795 if(bSameType)
1797 USHORT nLBData = (USHORT) aNumFmtArr[nLvl]->GetNumberingType();
1798 aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) ));
1800 else
1801 aFmtLB.SetNoSelection();
1803 aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked());
1804 aAllLevelNF.SetMax(nHighestLevel + 1);
1805 if(bAllLevel)
1807 aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels());
1809 else
1811 aAllLevelNF.SetText(aEmptyStr);
1813 if(bSameAdjust)
1815 USHORT nPos = 1; // zentriert
1816 if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
1817 nPos = 0;
1818 else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
1819 nPos = 2;
1820 aAlignLB.SelectEntryPos(nPos);
1822 else
1824 aAlignLB.SetNoSelection();
1827 if(bBullRelSize)
1829 if(bSameBulRelSize)
1830 aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize());
1831 else
1832 aBulRelSizeMF.SetText(aEmptyStr);
1834 if(bBullColor)
1836 if(bSameBulColor)
1837 aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
1838 else
1839 aBulColLB.SetNoSelection();
1841 switch(nBullet)
1843 case SHOW_NUMBERING:
1844 if(bSameStart)
1846 aStartED.SetValue(aNumFmtArr[nLvl]->GetStart());
1848 else
1849 aStartED.SetText(aEmptyStr);
1850 break;
1851 case SHOW_BULLET:
1853 // const Font* pFnt = aNumFmtArr[Lvl]->GetBulletFont();
1854 // if(pFnt)
1855 // ChgTxtFont(aBulletFT, *pFnt);
1856 // aBulletFT.SetText(String((char)aNumFmtArr[nLvl]->GetBulletChar()));
1858 break;
1859 case SHOW_BITMAP:
1860 break;
1863 if(bSamePrefix)
1864 aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix());
1865 else
1866 aPrefixED.SetText(aEmptyStr);
1867 if(bSameSuffix)
1868 aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix());
1869 else
1870 aSuffixED.SetText(aEmptyStr);
1872 if(bSameCharFmt)
1874 if(sFirstCharFmt.Len())
1875 aCharFmtLB.SelectEntry(sFirstCharFmt);
1876 else
1877 aCharFmtLB.SelectEntryPos( 0 );
1879 else
1880 aCharFmtLB.SetNoSelection();
1882 pPreviewWIN->SetLevel(nActNumLvl);
1883 pPreviewWIN->Invalidate();
1886 /*-----------------02.12.97 14:01-------------------
1887 0 - Nummer; 1 - Bullet; 2 - Bitmap
1888 --------------------------------------------------*/
1890 void SvxNumOptionsTabPage::SwitchNumberType( BYTE nType, BOOL )
1892 if(nBullet == nType)
1893 return;
1894 nBullet = nType;
1895 BOOL bBitmap = FALSE;
1896 BOOL bBullet = FALSE;
1897 BOOL bEnableBitmap = FALSE;
1898 if(nType == SHOW_NUMBERING)
1900 // Label umschalten, alten Text merken
1901 aStartFT.SetText(sStartWith);
1904 else if(nType == SHOW_BULLET)
1906 // Label umschalten, alten Text merken
1907 aStartFT.SetText(sBullet);
1908 bBullet = TRUE;
1910 else
1912 bBitmap = TRUE;
1913 bEnableBitmap = TRUE;
1915 BOOL bNumeric = !(bBitmap||bBullet);
1916 aPrefixFT.Show(bNumeric);
1917 aPrefixED.Show(bNumeric);
1918 aSuffixFT.Show(bNumeric);
1919 aSuffixED.Show(bNumeric);
1921 BOOL bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
1922 aCharFmtFT.Show(!bBitmap && bCharFmt);
1923 aCharFmtLB.Show(!bBitmap && bCharFmt);
1925 // das ist eigentlich Missbrauch, da fuer die vollst. Numerierung kein
1926 // eigenes Flag existiert
1927 BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
1928 BOOL bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
1929 aAllLevelFT.Show(bAllLevel);
1930 aAllLevelNF.Show(bAllLevel);
1932 aStartFT.Show(!bBitmap);
1933 aStartED.Show(!(bBullet||bBitmap));
1935 aBulletPB.Show(bBullet);
1936 BOOL bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
1937 aBulColorFT.Show( !bBitmap && bBullColor );
1938 aBulColLB.Show( !bBitmap && bBullColor );
1939 BOOL bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
1940 aBulRelSizeFT.Show( !bBitmap && bBullResSize );
1941 aBulRelSizeMF.Show( !bBitmap && bBullResSize );
1943 aBitmapFT .Show(bBitmap);
1944 aBitmapMB .Show(bBitmap);
1946 aSizeFT .Show(bBitmap);
1947 aWidthMF .Show(bBitmap);
1948 aMultFT .Show(bBitmap);
1949 aHeightMF .Show(bBitmap);
1950 aRatioCB .Show(bBitmap);
1952 aOrientFT .Show(bBitmap && bAllLevelFeature);
1953 aOrientLB .Show(bBitmap && bAllLevelFeature);
1955 aSizeFT .Enable(bEnableBitmap);
1956 aWidthMF .Enable(bEnableBitmap);
1957 aMultFT .Enable(bEnableBitmap);
1958 aHeightMF .Enable(bEnableBitmap);
1959 aRatioCB .Enable(bEnableBitmap);
1960 aOrientFT .Enable(bEnableBitmap);
1961 aOrientLB .Enable(bEnableBitmap);
1964 /*-----------------02.12.97 13:51-------------------
1966 --------------------------------------------------*/
1967 IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox )
1969 USHORT nSaveNumLvl = nActNumLvl;
1970 nActNumLvl = 0;
1971 if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
1972 (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
1974 nActNumLvl = 0xFFFF;
1975 pBox->SetUpdateMode(FALSE);
1976 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
1977 pBox->SelectEntryPos( i, FALSE );
1978 pBox->SetUpdateMode(TRUE);
1980 else if(pBox->GetSelectEntryCount())
1982 USHORT nMask = 1;
1983 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
1985 if(pBox->IsEntryPosSelected( i ))
1986 nActNumLvl |= nMask;
1987 nMask <<= 1;
1989 pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE );
1991 else
1993 nActNumLvl = nSaveNumLvl;
1994 USHORT nMask = 1;
1995 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
1997 if(nActNumLvl & nMask)
1999 pBox->SelectEntryPos(i);
2000 break;
2002 nMask <<=1;
2005 InitControls();
2006 return 0;
2008 /* -----------------------------05.04.2002 15:30------------------------------
2010 ---------------------------------------------------------------------------*/
2011 IMPL_LINK( SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer*, EMPTYARG )
2013 pPreviewWIN->Invalidate();
2014 return 0;
2016 /*-----------------03.12.97 12:01-------------------
2018 --------------------------------------------------*/
2019 IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox )
2021 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2023 USHORT nMask = 1;
2024 for(USHORT e = 0; e < pActNum->GetLevelCount(); e++)
2026 if(nActNumLvl & nMask)
2028 SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
2029 aNumFmt.SetIncludeUpperLevels((BYTE) std::min(pBox->GetValue(), sal_Int64(e + 1)) );
2030 pActNum->SetLevel(e, aNumFmt);
2032 nMask <<= 1;
2035 SetModified();
2036 return 0;
2039 /*-----------------02.12.97 08:56-------------------
2041 --------------------------------------------------*/
2042 IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox )
2044 String sSelectStyle;
2045 sal_Int16 eOldType;
2046 BOOL bShowOrient = FALSE;
2047 BOOL bBmp = FALSE;
2048 String aEmptyStr;
2049 USHORT nMask = 1;
2050 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2052 if(nActNumLvl & nMask)
2054 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2055 eOldType = aNumFmt.GetNumberingType();
2056 // PAGEDESC gibt es nicht
2057 USHORT nNumType = (USHORT)(ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos());
2058 aNumFmt.SetNumberingType((sal_Int16)nNumType);
2059 sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
2060 if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
2062 bBmp |= 0 != aNumFmt.GetBrush();
2063 aNumFmt.SetIncludeUpperLevels( FALSE );
2064 aNumFmt.SetSuffix( aEmptyStr );
2065 aNumFmt.SetPrefix( aEmptyStr );
2066 if(!bBmp)
2067 aNumFmt.SetGraphic(aEmptyStr);
2068 pActNum->SetLevel(i, aNumFmt);
2069 SwitchNumberType(SHOW_BITMAP, bBmp );
2070 bShowOrient = TRUE;
2072 else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
2074 aNumFmt.SetIncludeUpperLevels( FALSE );
2075 aNumFmt.SetSuffix( aEmptyStr );
2076 aNumFmt.SetPrefix( aEmptyStr );
2077 if( !aNumFmt.GetBulletFont() )
2078 aNumFmt.SetBulletFont(&aActBulletFont);
2079 if( !aNumFmt.GetBulletChar() )
2080 aNumFmt.SetBulletChar( SVX_DEF_BULLET );
2081 pActNum->SetLevel(i, aNumFmt);
2082 SwitchNumberType(SHOW_BULLET);
2083 //ChgTxtFont(aBulletFT, *aNumFmt.GetBulletFont());
2084 //aBulletFT.SetText( aNumFmt.GetBulletChar() );
2085 // Zuweisung der Zeichenvorlage automatisch
2086 if(bAutomaticCharStyles)
2088 sSelectStyle = sBulletCharFmtName;
2091 else
2093 aNumFmt.SetPrefix( aPrefixED.GetText() );
2094 aNumFmt.SetSuffix( aSuffixED.GetText() );
2095 // aNumFmt.SetBulletFont(0);
2096 SwitchNumberType(SHOW_NUMBERING);
2097 pActNum->SetLevel(i, aNumFmt);
2098 CheckForStartValue_Impl(nNumberingType);
2100 // Zuweisung der Zeichenvorlage automatisch
2101 if(bAutomaticCharStyles)
2103 sSelectStyle = sNumCharFmtName;
2107 nMask <<= 1;
2109 BOOL bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
2110 if(bShowOrient && bAllLevelFeature)
2112 aOrientFT.Show();
2113 aOrientLB.Show();
2115 else
2117 aOrientFT.Hide();
2118 aOrientLB.Hide();
2120 SetModified();
2121 if(sSelectStyle.Len())
2123 aCharFmtLB.SelectEntry(sSelectStyle);
2124 CharFmtHdl_Impl(&aCharFmtLB);
2125 // bAutomaticCharStyles wird im CharFmtHdl_Impl zurueckgesetzt
2126 bAutomaticCharStyles = TRUE;
2128 return 0;
2130 /* -----------------06.11.2002 14:27-----------------
2132 * --------------------------------------------------*/
2133 void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
2135 BOOL bIsNull = aStartED.GetValue() == 0;
2136 BOOL bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
2137 SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
2138 SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
2139 aStartED.SetMin(bNoZeroAllowed ? 1 : 0);
2140 if(bIsNull && bNoZeroAllowed)
2141 aStartED.GetModifyHdl().Call(&aStartED);
2143 /*-----------------03.12.97 16:43-------------------
2145 --------------------------------------------------*/
2146 IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox )
2148 USHORT nPos = pBox->GetSelectEntryPos();
2149 nPos ++; // kein VERT_NONE
2151 USHORT nMask = 1;
2152 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2154 if(nActNumLvl & nMask)
2156 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2157 if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2159 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
2160 const Size& rSize = aNumFmt.GetGraphicSize();
2161 sal_Int16 eOrient = (sal_Int16)nPos;
2162 aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
2163 pActNum->SetLevel(i, aNumFmt);
2166 nMask <<= 1;
2168 SetModified(FALSE);
2169 return 0;
2173 /*-----------------06.12.97 12:00-------------------
2175 --------------------------------------------------*/
2176 IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox )
2178 BOOL bSet = pBox->IsChecked();
2179 pActNum->SetContinuousNumbering(bSet);
2180 BOOL bRepaint = FALSE;
2181 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2183 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2184 if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
2186 bRepaint = TRUE;
2187 break;
2190 SetModified(bRepaint);
2191 InitControls();
2192 return 0;
2194 /* -----------------16.11.98 14:20-------------------
2196 * --------------------------------------------------*/
2197 IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox )
2199 Color nSetColor = pBox->GetSelectEntryColor();
2201 USHORT nMask = 1;
2202 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2204 if(nActNumLvl & nMask)
2206 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2207 aNumFmt.SetBulletColor(nSetColor);
2208 pActNum->SetLevel(i, aNumFmt);
2210 nMask <<= 1;
2212 SetModified();
2213 return 0;
2215 /* -----------------16.11.98 14:20-------------------
2217 * --------------------------------------------------*/
2218 IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField)
2220 USHORT nRelSize = (USHORT)pField->GetValue();
2222 USHORT nMask = 1;
2223 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2225 if(nActNumLvl & nMask)
2227 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2228 aNumFmt.SetBulletRelSize(nRelSize);
2229 pActNum->SetLevel(i, aNumFmt);
2231 nMask <<= 1;
2233 SetModified();
2234 return 0;
2237 /*-----------------02.12.97 10:50-------------------
2239 --------------------------------------------------*/
2240 IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
2242 USHORT nItemId = pButton->GetCurItemId();
2243 String aGrfName;
2244 Size aSize;
2245 sal_Bool bSucc(sal_False);
2246 SvxOpenGraphicDialog aGrfDlg( SVX_RES(RID_STR_EDIT_GRAPHIC) );
2247 // aGrfDlg.SetDialogHelpId( HID_NUMBERINGOPT_SEL_GRF_FROM_FILE );
2249 if(MN_GALLERY_ENTRY <= nItemId )
2251 aGrfName = *((String*)aGrfNames.GetObject( nItemId - MN_GALLERY_ENTRY));
2252 Graphic aGraphic;
2253 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - MN_GALLERY_ENTRY, &aGraphic))
2255 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
2256 bSucc = sal_True;
2259 else
2261 aGrfDlg.EnableLink( sal_False );
2262 aGrfDlg.AsLink( sal_False );
2263 if ( !aGrfDlg.Execute() )
2265 // ausgewaehlten Filter merken
2266 aGrfName = aGrfDlg.GetPath();
2268 Graphic aGraphic;
2269 if( !aGrfDlg.GetGraphic(aGraphic) )
2271 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
2272 bSucc = sal_True;
2276 if(bSucc)
2278 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
2280 USHORT nMask = 1;
2281 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2283 if(nActNumLvl & nMask)
2285 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2286 aNumFmt.SetCharFmtName(sNumCharFmtName);
2287 aNumFmt.SetGraphic(aGrfName);
2289 // Size schon mal fuer spaeteren Groessenabgleich setzen
2290 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
2291 // initiate asynchronous loading
2292 sal_Int16 eOrient = aNumFmt.GetVertOrient();
2293 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
2294 aInitSize[i] = aNumFmt.GetGraphicSize();
2296 pActNum->SetLevel(i, aNumFmt);
2298 nMask <<= 1;
2300 aRatioCB .Enable();
2301 aSizeFT .Enable();
2302 aMultFT.Enable();
2303 aWidthMF .Enable();
2304 aHeightMF.Enable();
2305 SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit);
2306 SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit);
2307 aOrientFT.Enable();
2308 aOrientLB.Enable();
2309 SetModified();
2310 //needed due to asynchronous loading of graphics in the SvxBrushItem
2311 aInvalidateTimer.Start();
2313 return 0;
2315 /* -----------------27.07.99 12:20-------------------
2317 --------------------------------------------------*/
2318 IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG )
2320 if(!bMenuButtonInitialized)
2322 bMenuButtonInitialized = TRUE;
2323 EnterWait();
2324 PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
2325 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
2326 if(aGrfNames.Count())
2328 pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC ));
2329 String aEmptyStr;
2330 GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
2332 for(USHORT i = 0; i < aGrfNames.Count(); i++)
2334 Graphic aGraphic;
2335 String sGrfName = *(const String*)aGrfNames.GetObject(i);
2336 INetURLObject aObj(sGrfName);
2337 if(aObj.GetProtocol() == INET_PROT_FILE)
2338 sGrfName = aObj.PathToFileName();
2339 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
2341 Bitmap aBitmap(aGraphic.GetBitmap());
2342 Size aSize(aBitmap.GetSizePixel());
2343 if(aSize.Width() > MAX_BMP_WIDTH ||
2344 aSize.Height() > MAX_BMP_HEIGHT)
2346 BOOL bWidth = aSize.Width() > aSize.Height();
2347 double nScale = bWidth ?
2348 (double)MAX_BMP_WIDTH / (double)aSize.Width():
2349 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
2350 aBitmap.Scale(nScale, nScale);
2352 Image aImage(aBitmap);
2354 pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage );
2356 else
2358 Image aImage;
2359 pPopup->InsertItem(
2360 MN_GALLERY_ENTRY + i, sGrfName, aImage );
2363 GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
2365 LeaveWait();
2367 return 0;
2370 /*-----------------02.12.97 10:58-------------------
2372 --------------------------------------------------*/
2373 IMPL_LINK( SvxNumOptionsTabPage, BulletHdl_Impl, Button *, EMPTYARG )
2375 SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE );
2377 USHORT nMask = 1;
2378 const Font* pFmtFont = 0;
2379 BOOL bSameBullet = TRUE;
2380 sal_Unicode cBullet = 0;
2381 BOOL bFirst = TRUE;
2382 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2384 if(nActNumLvl & nMask)
2386 const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
2387 if(bFirst)
2389 cBullet = rCurFmt.GetBulletChar();
2391 else if(rCurFmt.GetBulletChar() != cBullet )
2393 bSameBullet = FALSE;
2394 break;
2396 if(!pFmtFont)
2397 pFmtFont = rCurFmt.GetBulletFont();
2398 bFirst = FALSE;
2400 nMask <<= 1;
2404 if(pFmtFont)
2405 pMap->SetCharFont(*pFmtFont);
2406 else
2407 pMap->SetCharFont(aActBulletFont);
2408 if(bSameBullet)
2409 pMap->SetChar( cBullet );
2410 if(pMap->Execute() == RET_OK)
2412 // Font Numrules umstellen
2413 aActBulletFont = pMap->GetCharFont();
2415 USHORT _nMask = 1;
2416 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2418 if(nActNumLvl & _nMask)
2420 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2421 aNumFmt.SetBulletFont(&aActBulletFont); ;
2422 aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() );
2423 pActNum->SetLevel(i, aNumFmt);
2425 _nMask <<= 1;
2428 SetModified();
2430 delete pMap;
2431 return 0;
2434 /*-----------------03.03.97 15:21-------------------
2436 --------------------------------------------------*/
2438 IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField)
2440 BOOL bWidth = pField == &aWidthMF;
2441 bLastWidthModified = bWidth;
2442 BOOL bRatio = aRatioCB.IsChecked();
2443 long nWidthVal = static_cast<long>(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM)));
2444 long nHeightVal = static_cast<long>(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM)));
2445 nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
2446 MAP_100TH_MM, (MapUnit)eCoreUnit );
2447 nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
2448 MAP_100TH_MM, (MapUnit)eCoreUnit);
2449 double fSizeRatio;
2451 BOOL bRepaint = FALSE;
2452 USHORT nMask = 1;
2453 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2455 if(nActNumLvl & nMask)
2457 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2458 if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2460 Size aSize(aNumFmt.GetGraphicSize() );
2461 Size aSaveSize(aSize);
2463 if (aInitSize[i].Height())
2464 fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height();
2465 else
2466 fSizeRatio = (double)1;
2468 if(bWidth)
2470 long nDelta = nWidthVal - aInitSize[i].Width();
2471 aSize.Width() = nWidthVal;
2472 if (bRatio)
2474 aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio);
2475 aHeightMF.SetUserValue(aHeightMF.Normalize(
2476 OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
2477 FUNIT_100TH_MM);
2480 else
2482 long nDelta = nHeightVal - aInitSize[i].Height();
2483 aSize.Height() = nHeightVal;
2484 if (bRatio)
2486 aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio);
2487 aWidthMF.SetUserValue(aWidthMF.Normalize(
2488 OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
2489 FUNIT_100TH_MM);
2492 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
2493 sal_Int16 eOrient = aNumFmt.GetVertOrient();
2494 if(aSize != aSaveSize)
2495 bRepaint = TRUE;
2496 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
2497 pActNum->SetLevel(i, aNumFmt);
2500 nMask <<= 1;
2502 SetModified(bRepaint);
2503 return 0;
2506 /*------------------------------------------------------------------------
2507 Beschreibung:
2508 ------------------------------------------------------------------------*/
2510 IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox )
2512 if (pBox->IsChecked())
2514 if (bLastWidthModified)
2515 SizeHdl_Impl(&aWidthMF);
2516 else
2517 SizeHdl_Impl(&aHeightMF);
2519 return 0;
2522 /*-----------------02.12.97 16:07-------------------
2524 --------------------------------------------------*/
2525 IMPL_LINK( SvxNumOptionsTabPage, CharFmtHdl_Impl, ListBox *, EMPTYARG )
2527 bAutomaticCharStyles = FALSE;
2528 USHORT nEntryPos = aCharFmtLB.GetSelectEntryPos();
2529 String sEntry = aCharFmtLB.GetSelectEntry();
2530 USHORT nMask = 1;
2531 String aEmptyStr;
2532 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2534 if(nActNumLvl & nMask)
2536 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2537 if( 0 == nEntryPos )
2538 aNumFmt.SetCharFmtName(aEmptyStr);
2539 else
2541 if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2542 aNumFmt.SetCharFmtName(sEntry);
2544 pActNum->SetLevel(i, aNumFmt);
2546 nMask <<= 1;
2548 SetModified(FALSE);
2549 return 0;
2553 /*-----------------03.12.97 11:01-------------------
2555 --------------------------------------------------*/
2556 IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit )
2558 BOOL bPrefix = pEdit == &aPrefixED;
2559 BOOL bSuffix = pEdit == &aSuffixED;
2560 BOOL bStart = pEdit == &aStartED;
2561 USHORT nMask = 1;
2562 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
2564 if(nActNumLvl & nMask)
2566 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2567 if(bPrefix)
2568 aNumFmt.SetPrefix( aPrefixED.GetText() );
2569 else if(bSuffix)
2570 aNumFmt.SetSuffix( aSuffixED.GetText() );
2571 else if(bStart)
2572 aNumFmt.SetStart( (USHORT)aStartED.GetValue() );
2573 else //align
2575 USHORT nPos = aAlignLB.GetSelectEntryPos();
2576 SvxAdjust eAdjust = SVX_ADJUST_CENTER;
2577 if(nPos == 0)
2578 eAdjust = SVX_ADJUST_LEFT;
2579 else if(nPos == 2)
2580 eAdjust = SVX_ADJUST_RIGHT;
2581 aNumFmt.SetNumAdjust( eAdjust );
2583 pActNum->SetLevel(i, aNumFmt);
2585 nMask <<= 1;
2587 SetModified();
2589 return 0;
2592 /*-----------------09.12.97 11:49-------------------
2594 --------------------------------------------------*/
2595 USHORT lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, USHORT nXStart,
2596 USHORT nYStart, USHORT nDivision)
2598 const SvxBrushItem* pBrushItem = rFmt.GetBrush();
2599 USHORT nRet = 0;
2600 if(pBrushItem)
2602 const Graphic* pGrf = pBrushItem->GetGraphic();
2603 if(pGrf)
2605 Size aGSize( rFmt.GetGraphicSize() );
2606 aGSize.Width() /= nDivision;
2607 nRet = (USHORT)aGSize.Width();
2608 aGSize.Height() /= nDivision;
2609 pGrf->Draw( pVDev, Point(nXStart,nYStart),
2610 pVDev->PixelToLogic( aGSize ) );
2613 return nRet;
2617 /*-----------------09.12.97 11:54-------------------
2619 --------------------------------------------------*/
2620 USHORT lcl_DrawBullet(VirtualDevice* pVDev,
2621 const SvxNumberFormat& rFmt, USHORT nXStart,
2622 USHORT nYStart, const Size& rSize)
2624 Font aTmpFont(pVDev->GetFont());
2626 //per Uno kann es sein, dass kein Font gesetzt ist!
2627 Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
2628 Size aTmpSize(rSize);
2629 aTmpSize.Width() *= rFmt.GetBulletRelSize();
2630 aTmpSize.Width() /= 100 ;
2631 aTmpSize.Height() *= rFmt.GetBulletRelSize();
2632 aTmpSize.Height() /= 100 ;
2633 // bei einer Hoehe von Null wird in Ursprungshoehe gezeichnet
2634 if(!aTmpSize.Height())
2635 aTmpSize.Height() = 1;
2636 aFont.SetSize(aTmpSize);
2637 aFont.SetTransparent(TRUE);
2638 Color aBulletColor = rFmt.GetBulletColor();
2639 if(aBulletColor.GetColor() == COL_AUTO)
2640 aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK);
2641 else if(aBulletColor == pVDev->GetFillColor())
2642 aBulletColor.Invert();
2643 aFont.SetColor(aBulletColor);
2644 pVDev->SetFont( aFont );
2645 String aText(sal_Unicode(rFmt.GetBulletChar()));
2646 long nY = nYStart;
2647 nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
2648 pVDev->DrawText( Point(nXStart, nY), aText );
2649 USHORT nRet = (USHORT)pVDev->GetTextWidth(aText);
2651 pVDev->SetFont(aTmpFont);
2652 return nRet;
2654 /*-----------------02.12.97 10:34-------------------
2655 Vorschau der Numerierung painten
2656 --------------------------------------------------*/
2657 void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
2659 Size aSize(PixelToLogic(GetOutputSizePixel()));
2660 Rectangle aRect(Point(0,0), aSize);
2662 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2663 const Color aBackColor = rStyleSettings.GetFieldColor();
2664 const Color aTextColor = rStyleSettings.GetFieldTextColor();
2666 VirtualDevice* pVDev = new VirtualDevice(*this);
2667 pVDev->EnableRTL( IsRTLEnabled() );
2668 pVDev->SetMapMode(GetMapMode());
2669 pVDev->SetOutputSize( aSize );
2671 Color aLineColor(COL_LIGHTGRAY);
2672 if(aLineColor == aBackColor)
2673 aLineColor.Invert();
2674 pVDev->SetLineColor(aLineColor);
2675 pVDev->SetFillColor( aBackColor );
2676 pVDev->DrawRect(aRect);
2678 if(pActNum)
2680 USHORT nWidthRelation;
2681 if(nPageWidth)
2683 nWidthRelation = USHORT (nPageWidth / aSize.Width());
2684 if(bPosition)
2685 nWidthRelation = nWidthRelation * 2 / 3;
2686 else
2687 nWidthRelation = nWidthRelation / 4;
2689 else
2690 nWidthRelation = 30; // Kapiteldialog
2692 //Hoehe pro Ebene
2693 USHORT nXStep = sal::static_int_cast< USHORT >(aSize.Width() / (3 * pActNum->GetLevelCount()));
2694 if(pActNum->GetLevelCount() < 10)
2695 nXStep /= 2;
2696 USHORT nYStart = 4;
2697 // fuer ein einziges Level darf nicht die gesamte Hoehe benutzt werden
2698 USHORT nYStep = sal::static_int_cast< USHORT >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5));
2699 aStdFont = OutputDevice::GetDefaultFont(
2700 DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE);
2701 aStdFont.SetColor(aTextColor);
2702 aStdFont.SetFillColor(aBackColor);
2705 USHORT nFontHeight = nYStep * 6 / 10;
2706 if(bPosition)
2707 nFontHeight = nYStep * 15 / 10;
2708 aStdFont.SetSize(Size( 0, nFontHeight ));
2710 SvxNodeNum aNum( (BYTE)0 );
2711 USHORT nPreNum = pActNum->GetLevel(0).GetStart();
2713 if(bPosition)
2715 USHORT nLineHeight = nFontHeight * 8 / 7;
2716 BYTE nStart = 0;
2717 while( !(nActLevel & (1<<nStart)) )
2719 nStart++;
2721 if(nStart)
2722 nStart--;
2723 BYTE nEnd = std::min( (BYTE)(nStart + 3), (BYTE)pActNum->GetLevelCount() );
2724 for( BYTE nLevel = nStart; nLevel < nEnd; ++nLevel )
2726 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2727 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
2729 // --> OD 2008-01-16 #newlistlevelattrs#
2730 USHORT nXStart( 0 );
2731 short nTextOffset( 0 );
2732 USHORT nNumberXPos( 0 );
2733 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2735 nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2736 nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
2737 nNumberXPos = nXStart;
2738 USHORT nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
2740 if(nFirstLineOffset <= nNumberXPos)
2741 nNumberXPos = nNumberXPos - nFirstLineOffset;
2742 else
2743 nNumberXPos = 0;
2744 //im draw ist das zulaeesig
2745 if(nTextOffset < 0)
2746 nNumberXPos = nNumberXPos + nTextOffset;
2748 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2750 const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
2751 rFmt.GetFirstLineIndent() ) /
2752 nWidthRelation );
2753 if ( nTmpNumberXPos < 0 )
2755 nNumberXPos = 0;
2757 else
2759 nNumberXPos = static_cast<USHORT>( nTmpNumberXPos );
2762 // <--
2764 USHORT nBulletWidth = 0;
2765 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
2767 nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt,
2768 nNumberXPos,
2769 nYStart, nWidthRelation) : 0;
2771 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2773 nBulletWidth = rFmt.IsShowSymbol() ?
2774 lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
2776 else
2778 pVDev->SetFont(aStdFont);
2779 aNum.SetLevel( nLevel );
2780 if(pActNum->IsContinuousNumbering())
2781 aNum.GetLevelVal()[nLevel] = nPreNum;
2782 String aText(pActNum->MakeNumString( aNum ));
2783 Font aSaveFont = pVDev->GetFont();
2784 Font aColorFont(aSaveFont);
2785 Color aTmpBulletColor = rFmt.GetBulletColor();
2786 if(aTmpBulletColor.GetColor() == COL_AUTO)
2787 aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
2788 else if(aTmpBulletColor == aBackColor)
2789 aTmpBulletColor.Invert();
2790 aColorFont.SetColor(aTmpBulletColor);
2791 pVDev->SetFont(aColorFont);
2792 pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
2793 pVDev->SetFont(aSaveFont);
2794 nBulletWidth = (USHORT)pVDev->GetTextWidth(aText);
2795 nPreNum++;
2797 // --> OD 2008-01-16 #newlistlevelattrs#
2798 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
2799 rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
2801 pVDev->SetFont(aStdFont);
2802 String aText(' ');
2803 pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
2804 nBulletWidth = nBulletWidth + (USHORT)pVDev->GetTextWidth(aText);
2807 // --> OD 2008-01-16 #newlistlevelattrs#
2808 USHORT nTextXPos( 0 );
2809 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2811 nTextXPos = nXStart;
2812 if(nTextOffset < 0)
2813 nTextXPos = nTextXPos + nTextOffset;
2814 if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos )
2815 nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
2817 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2819 switch ( rFmt.GetLabelFollowedBy() )
2821 case SvxNumberFormat::LISTTAB:
2823 nTextXPos = static_cast<USHORT>(
2824 rFmt.GetListtabPos() / nWidthRelation );
2825 if ( nTextXPos < nNumberXPos + nBulletWidth )
2827 nTextXPos = nNumberXPos + nBulletWidth;
2830 break;
2831 case SvxNumberFormat::SPACE:
2832 case SvxNumberFormat::NOTHING:
2834 nTextXPos = nNumberXPos + nBulletWidth;
2836 break;
2839 nXStart = static_cast<USHORT>( rFmt.GetIndentAt() / nWidthRelation );
2841 // <--
2843 Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
2844 pVDev->SetFillColor( aBackColor );
2845 pVDev->DrawRect( aRect1 );
2847 Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
2848 pVDev->DrawRect( aRect2 );
2849 nYStart += 2 * nLineHeight;
2852 else
2854 //#i5153# painting gray or black rectangles as 'normal' numbering text
2855 String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") );
2856 long nWidth = pVDev->GetTextWidth(sMsg);
2857 long nTextHeight = pVDev->GetTextHeight();
2858 long nRectHeight = nTextHeight * 2 / 3;
2859 long nTopOffset = nTextHeight - nRectHeight;
2860 Color aBlackColor(COL_BLACK);
2861 if(aBlackColor == aBackColor)
2862 aBlackColor.Invert();
2864 for( BYTE nLevel = 0; nLevel < pActNum->GetLevelCount();
2865 ++nLevel, nYStart = nYStart + nYStep )
2867 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2868 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
2869 // --> OD 2008-01-31 #newlistlevelattrs#
2870 USHORT nXStart( 0 );
2871 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2873 nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2875 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2877 const long nTmpXStart( ( rFmt.GetIndentAt() +
2878 rFmt.GetFirstLineIndent() ) /
2879 nWidthRelation );
2880 if ( nTmpXStart < 0 )
2882 nXStart = 0;
2884 else
2886 nXStart = static_cast<USHORT>(nTmpXStart);
2889 nXStart /= 2;
2890 nXStart += 2;
2891 // <--
2892 USHORT nTextOffset = 2 * nXStep;
2893 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) )
2895 if(rFmt.IsShowSymbol())
2897 nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
2898 nTextOffset = nTextOffset + nXStep;
2901 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2903 if(rFmt.IsShowSymbol())
2905 nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
2906 nTextOffset = nTextOffset + nXStep;
2909 else
2911 Font aColorFont(aStdFont);
2912 Color aTmpBulletColor = rFmt.GetBulletColor();
2913 if(aTmpBulletColor.GetColor() == COL_AUTO)
2914 aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
2915 else if(aTmpBulletColor == aBackColor)
2916 aTmpBulletColor.Invert();
2917 aColorFont.SetColor(aTmpBulletColor);
2918 pVDev->SetFont(aColorFont);
2919 aNum.SetLevel( nLevel );
2920 if(pActNum->IsContinuousNumbering())
2921 aNum.GetLevelVal()[nLevel] = nPreNum;
2922 String aText(pActNum->MakeNumString( aNum ));
2923 pVDev->DrawText( Point(nXStart, nYStart), aText );
2924 pVDev->SetFont(aStdFont);
2925 nTextOffset = (USHORT)pVDev->GetTextWidth(aText);
2926 nTextOffset = nTextOffset + nXStep;
2927 nPreNum++;
2929 if(pOutlineNames)
2931 //#i5153# outline numberings still use the style names as text
2932 pVDev->SetFont(aStdFont);
2933 sMsg = pOutlineNames[nLevel];
2934 pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
2936 else
2938 //#i5153# the selected rectangle(s) should be black
2939 if( 0 != (nActLevel & (1<<nLevel)))
2941 pVDev->SetFillColor( aBlackColor );
2942 pVDev->SetLineColor( aBlackColor );
2944 else
2946 //#i5153# unselected levels are gray
2947 pVDev->SetFillColor( aLineColor );
2948 pVDev->SetLineColor( aLineColor );
2950 Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
2951 pVDev->DrawRect(aRect1);
2956 DrawOutDev( Point(0,0), aSize,
2957 Point(0,0), aSize,
2958 *pVDev );
2959 delete pVDev;
2963 /*-----------------03.12.97 10:02-------------------
2965 --------------------------------------------------*/
2966 SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent,
2967 const SfxItemSet& rSet) :
2968 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_NUM_POSITION ), rSet ),
2969 aPositionFL( this, SVX_RES(FL_POSITION )),
2970 aLevelFT( this, SVX_RES(FT_LEVEL )),
2971 aLevelLB( this, SVX_RES(LB_LEVEL )),
2972 aDistBorderFT( this, SVX_RES(FT_BORDERDIST )),
2973 aDistBorderMF( this, SVX_RES(MF_BORDERDIST )),
2974 aRelativeCB( this, SVX_RES(CB_RELATIVE )),
2975 aIndentFT( this, SVX_RES(FT_INDENT )),
2976 aIndentMF( this, SVX_RES(MF_INDENT )),
2977 aDistNumFT( this, SVX_RES(FT_NUMDIST )),
2978 aDistNumMF( this, SVX_RES(MF_NUMDIST )),
2979 aAlignFT( this, SVX_RES(FT_ALIGN )),
2980 aAlignLB( this, SVX_RES(LB_ALIGN )),
2981 // --> OD 2008-01-10 #newlistlevelattrs#
2982 aLabelFollowedByFT( this, SVX_RES(FT_LABEL_FOLLOWED_BY) ),
2983 aLabelFollowedByLB( this, SVX_RES(LB_LABEL_FOLLOWED_BY) ),
2984 aListtabFT( this, SVX_RES(FT_LISTTAB) ),
2985 aListtabMF( this, SVX_RES(MF_LISTTAB) ),
2986 aAlign2FT( this, SVX_RES(FT_ALIGN_2) ),
2987 aAlign2LB( this, SVX_RES(LB_ALIGN_2) ),
2988 aAlignedAtFT( this, SVX_RES(FT_ALIGNED_AT) ),
2989 aAlignedAtMF( this, SVX_RES(MF_ALIGNED_AT) ),
2990 aIndentAtFT( this, SVX_RES(FT_INDENT_AT) ),
2991 aIndentAtMF( this, SVX_RES(MF_INDENT_AT) ),
2992 // <--
2993 aStandardPB( this, SVX_RES(PB_STANDARD )),
2994 pPreviewWIN( new SvxNumberingPreview(this, SVX_RES(WIN_PREVIEW ))),
2995 pActNum(0),
2996 pSaveNum(0),
2997 nActNumLvl( USHRT_MAX ),
2998 nNumItemId(SID_ATTR_NUMBERING_RULE),
2999 bModified(false),
3000 bPreset(false),
3001 bInInintControl(FALSE),
3002 // --> OD 2008-01-11 #newlistlevelattrs#
3003 bLabelAlignmentPosAndSpaceModeActive( false )
3004 // <--
3006 FreeResource();
3007 SetExchangeSupport();
3008 pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
3010 aRelativeCB.Check();
3011 aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
3012 // --> OD 2008-01-10 #newlistlevelattrs#
3013 aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
3014 for ( USHORT i = 0; i < aAlignLB.GetEntryCount(); ++i )
3016 aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) );
3018 aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() );
3019 aAlign2FT.SetText( aAlignFT.GetText() );
3020 // <--
3022 Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl);
3024 aDistBorderMF.SetUpHdl(aLk);
3025 aDistBorderMF.SetDownHdl(aLk);
3026 aDistBorderMF.SetLoseFocusHdl(aLk);
3028 aDistNumMF.SetUpHdl(aLk);
3029 aDistNumMF.SetDownHdl(aLk);
3030 aDistNumMF.SetLoseFocusHdl(aLk);
3032 aIndentMF.SetUpHdl(aLk);
3033 aIndentMF.SetDownHdl(aLk);
3034 aIndentMF.SetLoseFocusHdl(aLk);
3036 // --> OD 2008-01-10 #newlistlevelattrs#
3037 aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() );
3038 aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) );
3040 aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl);
3041 aListtabMF.SetUpHdl(aLk);
3042 aListtabMF.SetDownHdl(aLk);
3043 aListtabMF.SetLoseFocusHdl(aLk);
3045 aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl);
3046 aAlignedAtMF.SetUpHdl(aLk);
3047 aAlignedAtMF.SetDownHdl(aLk);
3048 aAlignedAtMF.SetLoseFocusHdl(aLk);
3050 aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl);
3051 aIndentAtMF.SetUpHdl(aLk);
3052 aIndentAtMF.SetDownHdl(aLk);
3053 aIndentAtMF.SetLoseFocusHdl(aLk);
3054 // <--
3056 aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl));
3057 aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl));
3058 aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl));
3061 aRelativeCB.Check(bLastRelative);
3062 pPreviewWIN->SetPositionMode();
3063 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
3065 //HACK("der Wert sollte mal sinnvol gesetzt werden")
3066 long nWidth = 10000;
3067 nWidth = OutputDevice::LogicToLogic( nWidth,
3068 (MapUnit)eCoreUnit, MAP_100TH_MM );
3070 aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_100TH_MM );
3071 aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_100TH_MM );
3072 aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_100TH_MM );
3073 // --> OD 2008-02-18 #newlistlevelattrs#
3074 aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_100TH_MM );
3075 aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_100TH_MM );
3076 aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_100TH_MM );
3077 // <--
3078 long nLast2 = nWidth /2;
3079 aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_100TH_MM );
3080 aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_100TH_MM );
3081 aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_100TH_MM );
3082 // --> OD 2008-02-18 #newlistlevelattrs#
3083 aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_100TH_MM );
3084 aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_100TH_MM );
3085 aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_100TH_MM );
3086 // <--
3088 #if OSL_DEBUG_LEVEL > 1
3089 pDebugFixedText = new FixedText(this, 0);
3090 pDebugFixedText->Show();
3091 Size aSize(200, 20);
3092 Point aPos(250,0);
3094 pDebugFixedText->SetPosSizePixel(aPos, aSize);
3095 pDebugFixedText->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Das ist ein Debug-Text" ) ) );
3096 #endif
3098 /*-----------------03.12.97 10:02-------------------
3100 --------------------------------------------------*/
3101 SvxNumPositionTabPage::~SvxNumPositionTabPage()
3103 delete pActNum;
3104 delete pPreviewWIN;
3105 delete pSaveNum;
3106 #if OSL_DEBUG_LEVEL > 1
3107 delete pDebugFixedText;
3108 #endif
3110 /*-------------------------------------------------------*/
3112 #if OSL_DEBUG_LEVEL > 1
3113 void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt)
3115 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
3117 sal_Char const sHash[] = " # ";
3118 if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
3120 String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
3121 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
3122 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) );
3123 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
3124 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) );
3125 rFixed.SetText(sDebugText);
3127 else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
3129 String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) );
3130 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
3131 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) );
3132 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
3133 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) );
3134 rFixed.SetText(sDebugText);
3138 #endif
3140 /*-----------------03.12.97 10:06-------------------
3142 --------------------------------------------------*/
3143 void SvxNumPositionTabPage::InitControls()
3145 bInInintControl = TRUE;
3146 // --> OD 2008-01-11 #newlistlevelattrs#
3147 const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
3148 aRelativeCB.IsEnabled() && aRelativeCB.IsChecked();
3149 // <--
3150 const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 &&
3151 USHRT_MAX != nActNumLvl;
3153 aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
3154 ( bSingleSelection || bRelative ) );
3155 aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
3156 ( bSingleSelection || bRelative ) );
3158 bool bSetDistEmpty = false;
3159 bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
3160 bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
3161 bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
3162 bool bSameAdjust = true;
3164 // --> OD 2008-01-11 #newlistlevelattrs#
3165 bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
3166 bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
3167 bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
3168 bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
3169 // <--
3171 const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
3172 USHORT nMask = 1;
3173 USHORT nLvl = USHRT_MAX;
3174 long nFirstBorderText = 0;
3175 long nFirstBorderTextRelative = -1;
3176 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3178 aNumFmtArr[i] = &pActNum->GetLevel(i);
3179 if(nActNumLvl & nMask)
3181 if(USHRT_MAX == nLvl)
3183 nLvl = i;
3184 if ( !bLabelAlignmentPosAndSpaceModeActive )
3186 nFirstBorderText = nLvl > 0 ?
3187 aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset() -
3188 aNumFmtArr[nLvl - 1]->GetAbsLSpace() + aNumFmtArr[nLvl - 1]->GetFirstLineOffset():
3189 aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset();
3193 if( i > nLvl)
3195 // --> OD 2008-01-11 #newlistlevelattrs#
3196 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
3197 if ( !bLabelAlignmentPosAndSpaceModeActive )
3199 if(bRelative)
3201 if(nFirstBorderTextRelative == -1)
3202 nFirstBorderTextRelative =
3203 (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
3204 aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
3205 else
3206 bSameDistBorderNum &= nFirstBorderTextRelative ==
3207 (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
3208 aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
3210 else
3211 bSameDistBorderNum &=
3212 aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
3213 aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
3215 bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
3216 bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
3218 else
3220 bSameLabelFollowedBy &=
3221 aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
3222 bSameListtab &=
3223 aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
3224 bSameAlignAt &=
3225 ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
3226 == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
3227 bSameIndentAt &=
3228 aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
3230 // <--
3233 nMask <<= 1;
3236 if(bSameDistBorderNum)
3238 long nDistBorderNum;
3239 if(bRelative)
3241 nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
3242 if(nLvl)
3243 nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
3245 else
3247 nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
3249 SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit);
3251 else
3252 bSetDistEmpty = true;
3254 #if OSL_DEBUG_LEVEL > 1
3255 lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]);
3256 #endif
3258 const String aEmptyStr;
3259 if(bSameDist)
3260 SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit);
3261 else
3262 aDistNumMF.SetText(aEmptyStr);
3263 if(bSameIndent)
3264 SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
3265 else
3266 aIndentMF.SetText(aEmptyStr);
3268 if(bSameAdjust)
3270 USHORT nPos = 1; // zentriert
3271 if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
3272 nPos = 0;
3273 else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
3274 nPos = 2;
3275 aAlignLB.SelectEntryPos(nPos);
3276 // --> OD 2008-01-11 #newlistlevelattrs#
3277 aAlign2LB.SelectEntryPos( nPos );
3278 // <--
3280 else
3282 aAlignLB.SetNoSelection();
3283 // --> OD 2008-01-11 #newlistlevelattrs#
3284 aAlign2LB.SetNoSelection();
3285 // <--
3288 // --> OD 2008-01-11 #newlistlevelattrs#
3289 if ( bSameLabelFollowedBy )
3291 USHORT nPos = 0; // LISTTAB
3292 if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
3294 nPos = 1;
3296 else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
3298 nPos = 2;
3300 aLabelFollowedByLB.SelectEntryPos( nPos );
3302 else
3304 aLabelFollowedByLB.SetNoSelection();
3307 if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
3309 aListtabFT.Enable( true );
3310 aListtabMF.Enable( true );
3311 if ( bSameListtab )
3313 SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit );
3315 else
3317 aListtabMF.SetText(aEmptyStr);
3320 else
3322 aListtabFT.Enable( false );
3323 aListtabMF.Enable( false );
3324 aListtabMF.SetText(aEmptyStr);
3327 if ( bSameAlignAt )
3329 SetMetricValue( aAlignedAtMF,
3330 aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(),
3331 eCoreUnit );
3333 else
3335 aAlignedAtMF.SetText(aEmptyStr);
3338 if ( bSameIndentAt )
3340 SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit );
3342 else
3344 aIndentAtMF.SetText(aEmptyStr);
3346 // <--
3348 if ( bSetDistEmpty )
3349 aDistBorderMF.SetText(aEmptyStr);
3351 bInInintControl = FALSE;
3354 /*-----------------03.12.97 10:02-------------------
3356 --------------------------------------------------*/
3357 void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
3359 const SfxPoolItem* pItem;
3360 UINT16 nTmpNumLvl = USHRT_MAX;
3361 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
3362 if(pExampleSet)
3364 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, FALSE, &pItem))
3365 bPreset = ((const SfxBoolItem*)pItem)->GetValue();
3366 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, FALSE, &pItem))
3367 nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
3370 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, FALSE, &pItem))
3372 delete pSaveNum;
3373 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
3375 bModified = (!pActNum->Get( 0 ) || bPreset);
3376 if(*pSaveNum != *pActNum ||
3377 nActNumLvl != nTmpNumLvl )
3379 *pActNum = *pSaveNum;
3380 nActNumLvl = nTmpNumLvl;
3381 USHORT nMask = 1;
3382 aLevelLB.SetUpdateMode(FALSE);
3383 aLevelLB.SetNoSelection();
3384 aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
3385 if(nActNumLvl != USHRT_MAX)
3386 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3388 if(nActNumLvl & nMask)
3389 aLevelLB.SelectEntryPos( i, TRUE);
3390 nMask <<= 1 ;
3392 aRelativeCB.Enable(nActNumLvl != 1);
3393 aLevelLB.SetUpdateMode(TRUE);
3395 // --> OD 2008-01-11 #newlistlevelattrs#
3396 InitPosAndSpaceMode();
3397 ShowControlsDependingOnPosAndSpaceMode();
3398 // <--
3400 InitControls();
3402 pPreviewWIN->SetLevel(nActNumLvl);
3403 pPreviewWIN->Invalidate();
3406 /*-----------------03.12.97 10:02-------------------
3408 --------------------------------------------------*/
3409 int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
3411 if(_pSet)
3412 FillItemSet(*_pSet);
3413 return TRUE;
3416 /*-----------------03.12.97 10:02-------------------
3418 --------------------------------------------------*/
3419 BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
3421 rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
3423 if(bModified && pActNum)
3425 *pSaveNum = *pActNum;
3426 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
3427 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, FALSE));
3429 return bModified;
3432 /*-----------------03.12.97 10:02-------------------
3434 --------------------------------------------------*/
3435 void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet )
3437 const SfxPoolItem* pItem;
3438 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId
3439 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem);
3440 if(eState != SFX_ITEM_SET)
3442 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
3443 eState = rSet.GetItemState(nNumItemId, FALSE, &pItem);
3445 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
3446 delete pSaveNum;
3447 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
3449 // Ebenen einfuegen
3450 if(!aLevelLB.GetEntryCount())
3452 for(USHORT i = 1; i <= pSaveNum->GetLevelCount(); i++)
3453 aLevelLB.InsertEntry(UniString::CreateFromInt32(i));
3454 if(pSaveNum->GetLevelCount() > 1)
3456 String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - ") ) );
3457 sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) );
3458 aLevelLB.InsertEntry(sEntry);
3459 aLevelLB.SelectEntry(sEntry);
3461 else
3462 aLevelLB.SelectEntryPos(0);
3464 else
3465 aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
3466 USHORT nMask = 1;
3467 aLevelLB.SetUpdateMode(FALSE);
3468 aLevelLB.SetNoSelection();
3469 if(nActNumLvl == USHRT_MAX)
3471 aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), TRUE);
3473 else
3474 for(USHORT i = 0; i < pSaveNum->GetLevelCount(); i++)
3476 if(nActNumLvl & nMask)
3477 aLevelLB.SelectEntryPos( i, TRUE);
3478 nMask <<= 1;
3480 aLevelLB.SetUpdateMode(TRUE);
3482 if(!pActNum)
3483 pActNum = new SvxNumRule(*pSaveNum);
3484 else if(*pSaveNum != *pActNum)
3485 *pActNum = *pSaveNum;
3486 pPreviewWIN->SetNumRule(pActNum);
3488 // --> OD 2008-01-11 #newlistlevelattrs#
3489 InitPosAndSpaceMode();
3490 ShowControlsDependingOnPosAndSpaceMode();
3491 // const BOOL bDraw = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
3492 // aDistNumFT.Show(bDraw);
3493 // aDistNumMF.Show(bDraw);
3494 // <--
3496 InitControls();
3497 bModified = FALSE;
3500 // --> OD 2008-01-11 #newlistlevelattrs#
3501 void SvxNumPositionTabPage::InitPosAndSpaceMode()
3503 if ( pActNum == 0 )
3505 DBG_ASSERT( false,
3506 "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
3507 return;
3510 SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
3511 SvxNumberFormat::LABEL_ALIGNMENT;
3512 USHORT nMask = 1;
3513 for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
3515 if(nActNumLvl & nMask)
3517 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3518 ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
3519 if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
3521 break;
3524 nMask <<= 1;
3527 bLabelAlignmentPosAndSpaceModeActive =
3528 ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
3531 void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
3533 aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3534 aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
3535 aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
3536 aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3537 aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
3538 aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive &&
3539 pActNum->IsFeatureSupported(NUM_CONTINUOUS) );
3540 aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive &&
3541 pActNum->IsFeatureSupported(NUM_CONTINUOUS));
3542 aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3543 aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive );
3545 aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3546 aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive );
3547 aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3548 aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3549 aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive );
3550 aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive );
3551 aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3552 aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3553 aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3554 aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3556 // <--
3558 /*-----------------03.12.97 10:02-------------------
3560 --------------------------------------------------*/
3561 SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent,
3562 const SfxItemSet& rAttrSet)
3564 return new SvxNumPositionTabPage(pParent, rAttrSet);
3567 /*-----------------04.12.97 12:51-------------------
3569 --------------------------------------------------*/
3570 void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric)
3572 if(eMetric == FUNIT_MM)
3574 aDistBorderMF .SetDecimalDigits(1);
3575 aDistNumMF .SetDecimalDigits(1);
3576 aIndentMF .SetDecimalDigits(1);
3577 // --> OD 2008-02-18 #newlistlevelattrs#
3578 aListtabMF.SetDecimalDigits(1);
3579 aAlignedAtMF.SetDecimalDigits(1);
3580 aIndentAtMF.SetDecimalDigits(1);
3581 // <--
3583 aDistBorderMF .SetUnit( eMetric );
3584 aDistNumMF .SetUnit( eMetric );
3585 aIndentMF .SetUnit( eMetric );
3586 // --> OD 2008-02-18 #newlistlevelattrs#
3587 aListtabMF.SetUnit( eMetric );
3588 aAlignedAtMF.SetUnit( eMetric );
3589 aIndentAtMF.SetUnit( eMetric );
3590 // <--
3593 /*-----------------03.12.97 11:06-------------------
3595 --------------------------------------------------*/
3596 IMPL_LINK( SvxNumPositionTabPage, EditModifyHdl_Impl, Edit *, EMPTYARG )
3598 USHORT nMask = 1;
3599 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3601 if(nActNumLvl & nMask)
3603 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
3605 // --> OD 2008-01-11 #newlistlevelattrs#
3606 const USHORT nPos = aAlignLB.IsVisible()
3607 ? aAlignLB.GetSelectEntryPos()
3608 : aAlign2LB.GetSelectEntryPos();
3609 // <--
3610 SvxAdjust eAdjust = SVX_ADJUST_CENTER;
3611 if(nPos == 0)
3612 eAdjust = SVX_ADJUST_LEFT;
3613 else if(nPos == 2)
3614 eAdjust = SVX_ADJUST_RIGHT;
3615 aNumFmt.SetNumAdjust( eAdjust );
3616 pActNum->SetLevel(i, aNumFmt);
3618 nMask <<= 1;
3620 SetModified();
3621 return 0;
3623 /*-----------------03.12.97 11:11-------------------
3625 --------------------------------------------------*/
3626 IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox )
3628 USHORT nSaveNumLvl = nActNumLvl;
3629 nActNumLvl = 0;
3630 if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
3631 (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
3633 nActNumLvl = 0xFFFF;
3634 pBox->SetUpdateMode(FALSE);
3635 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
3636 pBox->SelectEntryPos( i, FALSE );
3637 pBox->SetUpdateMode(TRUE);
3639 else if(pBox->GetSelectEntryCount())
3641 USHORT nMask = 1;
3642 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
3644 if(pBox->IsEntryPosSelected( i ))
3645 nActNumLvl |= nMask;
3646 nMask <<= 1;
3648 pBox->SelectEntryPos( pActNum->GetLevelCount(), FALSE );
3650 else
3652 nActNumLvl = nSaveNumLvl;
3653 USHORT nMask = 1;
3654 for( USHORT i = 0; i < pActNum->GetLevelCount(); i++ )
3656 if(nActNumLvl & nMask)
3658 pBox->SelectEntryPos(i);
3659 break;
3661 nMask <<=1;
3664 aRelativeCB.Enable(nActNumLvl != 1);
3665 SetModified();
3666 // --> OD 2008-01-15 #newlistlevelattrs#
3667 InitPosAndSpaceMode();
3668 ShowControlsDependingOnPosAndSpaceMode();
3669 // <--
3670 InitControls();
3671 return 0;
3673 /*-----------------03.12.97 12:24-------------------
3675 --------------------------------------------------*/
3676 IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld )
3678 if(bInInintControl)
3679 return 0;
3680 long nValue = GetCoreValue(*pFld, eCoreUnit);
3681 USHORT nMask = 1;
3682 #if OSL_DEBUG_LEVEL > 1
3683 BOOL bFirst = TRUE;
3684 #endif
3685 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3687 if(nActNumLvl & nMask)
3689 SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3690 if(pFld == &aDistBorderMF)
3693 if(aRelativeCB.IsChecked())
3695 if(0 == i)
3697 long nTmp = aNumFmt.GetFirstLineOffset();
3698 aNumFmt.SetAbsLSpace( USHORT(nValue - nTmp));
3700 else
3702 long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
3703 pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
3704 pActNum->GetLevel( i ).GetFirstLineOffset();
3706 aNumFmt.SetAbsLSpace( USHORT(nValue + nTmp));
3709 else
3711 aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
3714 else if(pFld == &aDistNumMF)
3716 aNumFmt.SetCharTextDistance( (short)nValue );
3718 else if(pFld == &aIndentMF)
3720 //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden
3721 long nDiff = nValue + aNumFmt.GetFirstLineOffset();
3722 long nAbsLSpace = aNumFmt.GetAbsLSpace();
3723 aNumFmt.SetAbsLSpace(USHORT(nAbsLSpace + nDiff));
3724 aNumFmt.SetFirstLineOffset( -(short)nValue );
3727 #if OSL_DEBUG_LEVEL > 1
3728 if(bFirst)
3729 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3730 bFirst = FALSE;
3731 #endif
3732 pActNum->SetLevel( i, aNumFmt );
3734 nMask <<= 1;
3737 SetModified();
3738 if(!aDistBorderMF.IsEnabled())
3740 String aEmptyStr;
3741 aDistBorderMF.SetText(aEmptyStr);
3744 return 0;
3747 /*-----------------04.12.97 12:35-------------------
3749 --------------------------------------------------*/
3750 IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox )
3752 BOOL bOn = pBox->IsChecked();
3753 BOOL bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
3754 BOOL bSetValue = FALSE;
3755 long nValue = 0;
3756 if(bOn || bSingleSelection)
3758 USHORT nMask = 1;
3759 BOOL bFirst = TRUE;
3760 bSetValue = TRUE;
3761 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3763 if(nActNumLvl & nMask)
3765 const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i);
3766 if(bFirst)
3768 nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
3769 if(bOn && i)
3770 nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
3772 else
3773 bSetValue = nValue ==
3774 (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) -
3775 (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
3776 bFirst = FALSE;
3778 nMask <<= 1;
3782 String aEmptyStr;
3783 if(bSetValue)
3784 SetMetricValue(aDistBorderMF, nValue, eCoreUnit);
3785 else
3786 aDistBorderMF.SetText(aEmptyStr);
3787 aDistBorderMF.Enable(bOn || bSingleSelection);
3788 aDistBorderFT.Enable(bOn || bSingleSelection);
3789 bLastRelative = bOn;
3790 return 0;
3793 // --> OD 2008-01-14 #newlistlevelattrs#
3794 IMPL_LINK( SvxNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG )
3796 // determine value to be set at the chosen list levels
3797 SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy =
3798 SvxNumberFormat::LISTTAB;
3800 const USHORT nPos = aLabelFollowedByLB.GetSelectEntryPos();
3801 if ( nPos == 1 )
3803 eLabelFollowedBy = SvxNumberFormat::SPACE;
3805 else if ( nPos == 2 )
3807 eLabelFollowedBy = SvxNumberFormat::NOTHING;
3811 // set value at the chosen list levels
3812 bool bSameListtabPos = true;
3813 USHORT nFirstLvl = USHRT_MAX;
3814 USHORT nMask = 1;
3815 for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
3817 if ( nActNumLvl & nMask )
3819 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3820 aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
3821 pActNum->SetLevel( i, aNumFmt );
3823 if ( nFirstLvl == USHRT_MAX )
3825 nFirstLvl = i;
3827 else
3829 bSameListtabPos &= aNumFmt.GetListtabPos() ==
3830 pActNum->GetLevel( nFirstLvl ).GetListtabPos();
3833 nMask <<= 1;
3836 // enable/disable metric field for list tab stop position depending on
3837 // selected item following the list label.
3838 aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3839 aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3840 if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
3842 SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit );
3844 else
3846 aListtabMF.SetText( String() );
3849 SetModified();
3851 return 0;
3853 // <--
3855 // --> OD 2008-01-14 #newlistlevelattrs#
3856 IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
3858 // determine value to be set at the chosen list levels
3859 const long nValue = GetCoreValue( *pFld, eCoreUnit );
3861 // set value at the chosen list levels
3862 USHORT nMask = 1;
3863 for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
3865 if ( nActNumLvl & nMask )
3867 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3868 aNumFmt.SetListtabPos( nValue );
3869 pActNum->SetLevel( i, aNumFmt );
3870 #if OSL_DEBUG_LEVEL > 1
3871 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3872 #endif
3874 nMask <<= 1;
3877 SetModified();
3879 return 0;
3881 // <--
3883 // --> OD 2008-01-14 #newlistlevelattrs#
3884 IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
3886 // determine value to be set at the chosen list levels
3887 const long nValue = GetCoreValue( *pFld, eCoreUnit );
3889 // set value at the chosen list levels
3890 USHORT nMask = 1;
3891 for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
3893 if ( nActNumLvl & nMask )
3895 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3896 const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
3897 aNumFmt.SetFirstLineIndent( nFirstLineIndent );
3898 pActNum->SetLevel( i, aNumFmt );
3899 #if OSL_DEBUG_LEVEL > 1
3900 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3901 #endif
3903 nMask <<= 1;
3906 SetModified();
3908 return 0;
3910 // <--
3912 // --> OD 2008-01-14 #newlistlevelattrs#
3913 IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
3915 // determine value to be set at the chosen list levels
3916 const long nValue = GetCoreValue( *pFld, eCoreUnit );
3918 // set value at the chosen list levels
3919 USHORT nMask = 1;
3920 for( USHORT i = 0; i < pActNum->GetLevelCount(); ++i )
3922 if ( nActNumLvl & nMask )
3924 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3925 const long nAlignedAt = aNumFmt.GetIndentAt() +
3926 aNumFmt.GetFirstLineIndent();
3927 aNumFmt.SetIndentAt( nValue );
3928 const long nNewFirstLineIndent = nAlignedAt - nValue;
3929 aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
3930 pActNum->SetLevel( i, aNumFmt );
3931 #if OSL_DEBUG_LEVEL > 1
3932 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3933 #endif
3935 nMask <<= 1;
3938 SetModified();
3940 return 0;
3942 // <--
3943 /*-----------------05.12.97 15:33-------------------
3945 --------------------------------------------------*/
3946 IMPL_LINK( SvxNumPositionTabPage, StandardHdl_Impl, PushButton *, EMPTYARG )
3948 USHORT nMask = 1;
3949 // --> OD 2008-02-11 #newlistlevelattrs#
3950 SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(),
3951 pActNum->GetLevelCount(),
3952 pActNum->IsContinuousNumbering(),
3953 SVX_RULETYPE_NUMBERING,
3954 pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() );
3955 // <--
3956 for(USHORT i = 0; i < pActNum->GetLevelCount(); i++)
3958 if(nActNumLvl & nMask)
3960 SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3961 SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i ));
3962 // --> OD 2008-02-05 #newlistlevelattrs#
3963 aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
3964 if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
3966 aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() );
3967 aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
3968 aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
3970 else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
3972 aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
3973 aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
3974 aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
3975 aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
3976 aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
3978 // <--
3980 pActNum->SetLevel( i, aNumFmt );
3982 nMask <<= 1;
3985 InitControls();
3986 SetModified();
3987 return 0;
3990 void SvxNumPositionTabPage::SetModified(BOOL bRepaint)
3992 bModified = TRUE;
3993 if(bRepaint)
3995 pPreviewWIN->SetLevel(nActNumLvl);
3996 pPreviewWIN->Invalidate();
4000 void SvxNumOptionsTabPage::SetModified(BOOL bRepaint)
4002 bModified = TRUE;
4003 if(bRepaint)
4005 pPreviewWIN->SetLevel(nActNumLvl);
4006 pPreviewWIN->Invalidate();
4010 //Add CHINA001
4011 void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
4013 SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False);
4014 SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
4015 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
4016 SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
4018 if (pNumCharFmt &&pBulletCharFmt)
4019 SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
4021 if (pListItem)
4023 ListBox& myCharFmtLB = GetCharFmtListBox();
4024 const List *pList = (pListItem)->GetList();
4025 sal_uInt32 nCount = pList->Count();;
4026 for(sal_uInt32 i = 0; i < nCount; i++)
4028 myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) );
4032 if (pMetricItem)
4033 SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
4036 //end of add CHINA001
4038 //add CHINA001 begin
4040 void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet)
4042 SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
4044 if (pMetricItem)
4045 SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));