1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_cui.hxx" 26 27 #include <com/sun/star/text/HoriOrientation.hpp> 28 #include <com/sun/star/text/VertOrientation.hpp> 29 #include <com/sun/star/text/RelOrientation.hpp> 30 31 #include <numpages.hxx> 32 #include <numpages.hrc> 33 #include <dialmgr.hxx> 34 #include <cuires.hrc> 35 #include <tools/shl.hxx> 36 #include <i18npool/mslangid.hxx> 37 #include <svtools/valueset.hxx> 38 #include <helpid.hrc> 39 #include <editeng/numitem.hxx> 40 #include <svl/eitem.hxx> 41 #include <vcl/svapp.hxx> 42 #include <svx/gallery.hxx> 43 #include <svl/urihelper.hxx> 44 #include <editeng/brshitem.hxx> 45 #include <svl/intitem.hxx> 46 #include <sfx2/objsh.hxx> 47 #include <vcl/graph.hxx> 48 #include <vcl/msgbox.hxx> 49 #include "cuicharmap.hxx" 50 #include <editeng/flstitem.hxx> 51 #include <svx/dlgutil.hxx> 52 #include <svx/xtable.hxx> 53 #include <svx/drawitem.hxx> 54 #include <svx/numvset.hxx> 55 #include <svx/htmlmode.hxx> 56 #include <unotools/pathoptions.hxx> 57 #include <svtools/ctrltool.hxx> 58 #include <editeng/unolingu.hxx> 59 #include <com/sun/star/style/NumberingType.hpp> 60 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 61 #include <com/sun/star/container/XIndexAccess.hpp> 62 #include <com/sun/star/text/XDefaultNumberingProvider.hpp> 63 #include <com/sun/star/text/XNumberingFormatter.hpp> 64 #include <com/sun/star/beans/PropertyValue.hpp> 65 #include <comphelper/processfactory.hxx> 66 #include <com/sun/star/text/XNumberingTypeInfo.hpp> 67 #include <svx/dialmgr.hxx> 68 #include <svx/dialogs.hrc> 69 70 #include <algorithm> 71 #include <vector> 72 #include "sfx2/opengrf.hxx" 73 74 #include <cuires.hrc> //CHINA001 75 #include <sfx2/request.hxx> //CHINA001 76 #include <svl/aeitem.hxx> //add CHINA001 77 #include <svl/stritem.hxx>//add CHINA001 78 #include <svl/slstitm.hxx> //add CHINA001 79 80 using namespace com::sun::star; 81 using namespace com::sun::star::uno; 82 using namespace com::sun::star::beans; 83 using namespace com::sun::star::lang; 84 using namespace com::sun::star::i18n; 85 using namespace com::sun::star::text; 86 using namespace com::sun::star::container; 87 using namespace com::sun::star::style; 88 using rtl::OUString; 89 #define C2U(cChar) OUString::createFromAscii(cChar) 90 91 SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr); 92 93 /*-----------------07.02.97 15.37------------------- 94 95 --------------------------------------------------*/ 96 #define NUM_PAGETYPE_BULLET 0 97 #define NUM_PAGETYPE_SINGLENUM 1 98 #define NUM_PAGETYPE_NUM 2 99 #define NUM_PAGETYPE_BMP 3 100 #define PAGETYPE_USER_START 10 101 102 #define SHOW_NUMBERING 0 103 #define SHOW_BULLET 1 104 #define SHOW_BITMAP 2 105 106 #define MAX_BMP_WIDTH 16 107 #define MAX_BMP_HEIGHT 16 108 109 static sal_Bool bLastRelative = sal_False; 110 static const sal_Char cNumberingType[] = "NumberingType"; 111 static const sal_Char cValue[] = "Value"; 112 static const sal_Char cParentNumbering[] = "ParentNumbering"; 113 static const sal_Char cPrefix[] = "Prefix"; 114 static const sal_Char cSuffix[] = "Suffix"; 115 static const sal_Char cBulletChar[] = "BulletChar"; 116 static const sal_Char cBulletFontName[] = "BulletFontName"; 117 /* -----------------------------31.01.01 10:23-------------------------------- 118 119 ---------------------------------------------------------------------------*/ 120 Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider() 121 { 122 Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 123 Reference < XInterface > xI = xMSF->createInstance( 124 ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 125 Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); 126 DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); 127 128 return xRet; 129 } 130 /* -----------------------------31.01.01 11:40-------------------------------- 131 132 ---------------------------------------------------------------------------*/ 133 SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps) 134 { 135 const PropertyValue* pValues = rLevelProps.getConstArray(); 136 SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl; 137 for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) 138 { 139 if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType))) 140 pValues[j].Value >>= pNew->nNumberType; 141 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix))) 142 pValues[j].Value >>= pNew->sPrefix; 143 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix))) 144 pValues[j].Value >>= pNew->sSuffix; 145 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering))) 146 pValues[j].Value >>= pNew->nParentNumbering; 147 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar))) 148 pValues[j].Value >>= pNew->sBulletChar; 149 else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName))) 150 pValues[j].Value >>= pNew->sBulletFont; 151 } 152 return pNew; 153 } 154 /* -----------------28.10.98 08:32------------------- 155 * 156 * --------------------------------------------------*/ 157 // Die Auswahl an Bullets aus den StarSymbol 158 static const sal_Unicode aBulletTypes[] = 159 { 160 0x2022, 161 0x25cf, 162 0xe00c, 163 0xe00a, 164 0x2794, 165 0x27a2, 166 0x2717, 167 0x2714 168 }; 169 /* -----------------28.10.98 09:42------------------- 170 * 171 * --------------------------------------------------*/ 172 static sal_Char __READONLY_DATA aNumChar[] = 173 { 174 'A', //CHARS_UPPER_LETTER 175 'a', //CHARS_LOWER_LETTER 176 'I', //ROMAN_UPPER 177 'i', //ROMAN_LOWER 178 '1', //ARABIC 179 ' ' 180 }; 181 182 /*-----------------18.03.98 08:35------------------- 183 Ist eins der maskierten Formate gesetzt? 184 --------------------------------------------------*/ 185 sal_Bool lcl_IsNumFmtSet(SvxNumRule* pNum, sal_uInt16 nLevelMask) 186 { 187 sal_Bool bRet = sal_False; 188 sal_uInt16 nMask = 1; 189 for( sal_uInt16 i = 0; i < SVX_MAX_NUM && !bRet; i++ ) 190 { 191 if(nLevelMask & nMask) 192 bRet |= 0 != pNum->Get( i ); 193 nMask <<= 1 ; 194 } 195 return bRet; 196 } 197 /* -----------------28.10.98 08:50------------------- 198 * 199 * --------------------------------------------------*/ 200 201 Font& lcl_GetDefaultBulletFont() 202 { 203 static sal_Bool bInit = 0; 204 static Font aDefBulletFont( UniString::CreateFromAscii( 205 RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ), 206 String(), Size( 0, 14 ) ); 207 if(!bInit) 208 { 209 aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); 210 aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); 211 aDefBulletFont.SetPitch( PITCH_DONTKNOW ); 212 aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); 213 aDefBulletFont.SetTransparent( sal_True ); 214 bInit = sal_True; 215 } 216 return aDefBulletFont; 217 } 218 219 220 /**************************************************************************/ 221 /* */ 222 /* */ 223 /**************************************************************************/ 224 225 226 SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent, 227 const SfxItemSet& rSet) : 228 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ), 229 aValuesFL( this, CUI_RES(FL_VALUES) ), 230 pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )), 231 pActNum(0), 232 pSaveNum(0), 233 nActNumLvl( USHRT_MAX ), 234 bModified(sal_False), 235 bPreset(sal_False), 236 nNumItemId(SID_ATTR_NUMBERING_RULE) 237 { 238 FreeResource(); 239 SetExchangeSupport(); 240 pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl)); 241 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl)); 242 pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM ); 243 244 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); 245 if(xDefNum.is()) 246 { 247 Sequence< Sequence< PropertyValue > > aNumberings; 248 LanguageType eLang = Application::GetSettings().GetLanguage(); 249 Locale aLocale = SvxCreateLocale(eLang); 250 try 251 { 252 aNumberings = 253 xDefNum->getDefaultContinuousNumberingLevels( aLocale ); 254 255 256 sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength(); 257 258 const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); 259 for(sal_Int32 i = 0; i < nLength; i++) 260 { 261 SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]); 262 aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count()); 263 } 264 } 265 catch(Exception&) 266 { 267 } 268 Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY); 269 pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale); 270 } 271 } 272 /*-----------------07.02.97 12.08------------------- 273 274 --------------------------------------------------*/ 275 276 SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage() 277 { 278 delete pActNum; 279 delete pExamplesVS; 280 delete pSaveNum; 281 aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count()); 282 } 283 284 /*-----------------07.02.97 12.13------------------- 285 286 --------------------------------------------------*/ 287 288 SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent, 289 const SfxItemSet& rAttrSet) 290 { 291 return new SvxSingleNumPickTabPage(pParent, rAttrSet); 292 } 293 294 /*-----------------07.02.97 12.09------------------- 295 296 --------------------------------------------------*/ 297 298 299 sal_Bool SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet ) 300 { 301 if( (bPreset || bModified) && pSaveNum) 302 { 303 *pSaveNum = *pActNum; 304 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 305 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); 306 } 307 308 return bModified; 309 } 310 311 /*-----------------08.02.97 16.27------------------- 312 313 --------------------------------------------------*/ 314 315 void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet) 316 { 317 const SfxPoolItem* pItem; 318 bPreset = sal_False; 319 sal_Bool bIsPreset = sal_False; 320 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 321 if(pExampleSet) 322 { 323 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 324 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); 325 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 326 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 327 } 328 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 329 { 330 delete pSaveNum; 331 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 332 } 333 if(*pSaveNum != *pActNum) 334 { 335 *pActNum = *pSaveNum; 336 pExamplesVS->SetNoSelection(); 337 } 338 // ersten Eintrag vorselektieren 339 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) 340 { 341 pExamplesVS->SelectItem(1); 342 NumSelectHdl_Impl(pExamplesVS); 343 bPreset = sal_True; 344 } 345 bPreset |= bIsPreset; 346 347 bModified = sal_False; 348 } 349 350 /*-----------------08.02.97 11.28------------------- 351 352 --------------------------------------------------*/ 353 354 int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) 355 { 356 if(_pSet) 357 FillItemSet(*_pSet); 358 return sal_True; 359 } 360 361 /*-----------------07.02.97 12.09------------------- 362 363 --------------------------------------------------*/ 364 365 366 void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) 367 { 368 const SfxPoolItem* pItem; 369 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); 370 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 371 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 372 if(eState != SFX_ITEM_SET) 373 { 374 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 375 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 376 377 if( eState != SFX_ITEM_SET ) 378 { 379 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 380 eState = SFX_ITEM_SET; 381 } 382 } 383 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 384 delete pSaveNum; 385 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 386 387 if(!pActNum) 388 pActNum = new SvxNumRule(*pSaveNum); 389 else if(*pSaveNum != *pActNum) 390 *pActNum = *pSaveNum; 391 } 392 /*-----------------08.02.97 11.40------------------- 393 394 --------------------------------------------------*/ 395 396 IMPL_LINK(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) 397 { 398 if(pActNum) 399 { 400 bPreset = sal_False; 401 bModified = sal_True; 402 sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1; 403 DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index"); 404 if(aNumSettingsArr.Count() <= nIdx) 405 return 0; 406 SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx); 407 sal_Int16 eNewType = _pSet->nNumberType; 408 const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; 409 const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; 410 411 sal_uInt16 nMask = 1; 412 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 413 { 414 if(nActNumLvl & nMask) 415 { 416 SvxNumberFormat aFmt(pActNum->GetLevel(i)); 417 aFmt.SetNumberingType(eNewType); 418 String aEmptyStr; 419 if(cLocalPrefix == ' ') 420 aFmt.SetPrefix( aEmptyStr ); 421 else 422 aFmt.SetPrefix(_pSet->sPrefix); 423 if(cLocalSuffix == ' ') 424 aFmt.SetSuffix( aEmptyStr ); 425 else 426 aFmt.SetSuffix(_pSet->sSuffix); 427 aFmt.SetCharFmtName(sNumCharFmtName); 428 // #62069# // #92724# 429 aFmt.SetBulletRelSize(100); 430 pActNum->SetLevel(i, aFmt); 431 } 432 nMask <<= 1 ; 433 } 434 } 435 return 0; 436 } 437 438 /*-----------------06.06.97 11.15------------------- 439 440 --------------------------------------------------*/ 441 IMPL_LINK(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) 442 { 443 NumSelectHdl_Impl(pExamplesVS); 444 OKButton& rOk = GetTabDialog()->GetOKButton(); 445 rOk.GetClickHdl().Call(&rOk); 446 return 0; 447 } 448 449 /**************************************************************************/ 450 /* */ 451 /* */ 452 /**************************************************************************/ 453 454 455 SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent, 456 const SfxItemSet& rSet) : 457 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BULLET ), rSet ), 458 aValuesFL( this, CUI_RES(FL_VALUES) ), 459 pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_BULLET )), 460 pActNum(0), 461 pSaveNum(0), 462 nActNumLvl( USHRT_MAX ), 463 bModified(sal_False), 464 bPreset(sal_False), 465 nNumItemId(SID_ATTR_NUMBERING_RULE) 466 { 467 FreeResource(); 468 SetExchangeSupport(); 469 pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl)); 470 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl)); 471 pExamplesVS->SetHelpId(HID_VALUESET_BULLET ); 472 473 } 474 /*-----------------07.02.97 12.10------------------- 475 476 --------------------------------------------------*/ 477 478 479 SvxBulletPickTabPage::~SvxBulletPickTabPage() 480 { 481 delete pActNum; 482 delete pExamplesVS; 483 delete pSaveNum; 484 } 485 /*-----------------07.02.97 12.10------------------- 486 487 --------------------------------------------------*/ 488 489 490 SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent, 491 const SfxItemSet& rAttrSet) 492 { 493 return new SvxBulletPickTabPage(pParent, rAttrSet); 494 } 495 496 /*-----------------07.02.97 12.10------------------- 497 498 --------------------------------------------------*/ 499 500 501 sal_Bool SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet ) 502 { 503 if( (bPreset || bModified) && pActNum) 504 { 505 *pSaveNum = *pActNum; 506 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 507 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); 508 } 509 return bModified; 510 } 511 /*-----------------08.02.97 16.28------------------- 512 513 --------------------------------------------------*/ 514 515 void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet) 516 { 517 const SfxPoolItem* pItem; 518 bPreset = sal_False; 519 sal_Bool bIsPreset = sal_False; 520 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 521 if(pExampleSet) 522 { 523 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 524 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); 525 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 526 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 527 } 528 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 529 { 530 delete pSaveNum; 531 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 532 } 533 if(*pSaveNum != *pActNum) 534 { 535 *pActNum = *pSaveNum; 536 pExamplesVS->SetNoSelection(); 537 } 538 // ersten Eintrag vorselektieren 539 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) 540 { 541 pExamplesVS->SelectItem(1); 542 NumSelectHdl_Impl(pExamplesVS); 543 bPreset = sal_True; 544 } 545 bPreset |= bIsPreset; 546 bModified = sal_False; 547 } 548 /*-----------------08.02.97 11.28------------------- 549 550 --------------------------------------------------*/ 551 552 int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) 553 { 554 if(_pSet) 555 FillItemSet(*_pSet); 556 return sal_True; 557 } 558 559 /*-----------------07.02.97 12.11------------------- 560 561 --------------------------------------------------*/ 562 563 564 void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) 565 { 566 const SfxPoolItem* pItem; 567 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 568 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 569 if(eState != SFX_ITEM_SET) 570 { 571 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 572 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 573 574 if( eState != SFX_ITEM_SET ) 575 { 576 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 577 eState = SFX_ITEM_SET; 578 } 579 580 } 581 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 582 delete pSaveNum; 583 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 584 585 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); 586 587 if(!pActNum) 588 pActNum = new SvxNumRule(*pSaveNum); 589 else if(*pSaveNum != *pActNum) 590 *pActNum = *pSaveNum; 591 } 592 /*-----------------08.02.97 11.58------------------- 593 594 --------------------------------------------------*/ 595 596 IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) 597 { 598 if(pActNum) 599 { 600 bPreset = sal_False; 601 bModified = sal_True; 602 sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1]; 603 Font& rActBulletFont = lcl_GetDefaultBulletFont(); 604 605 sal_uInt16 nMask = 1; 606 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 607 { 608 if(nActNumLvl & nMask) 609 { 610 SvxNumberFormat aFmt(pActNum->GetLevel(i)); 611 aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 612 // #i93908# clear suffix for bullet lists 613 aFmt.SetPrefix(::rtl::OUString()); 614 aFmt.SetSuffix(::rtl::OUString()); 615 aFmt.SetBulletFont(&rActBulletFont); 616 aFmt.SetBulletChar(cChar ); 617 aFmt.SetCharFmtName(sBulletCharFmtName); 618 // #62069# // #92724# 619 aFmt.SetBulletRelSize(45); 620 pActNum->SetLevel(i, aFmt); 621 } 622 nMask <<= 1; 623 } 624 } 625 626 return 0; 627 } 628 629 /*-----------------06.06.97 11.16------------------- 630 631 --------------------------------------------------*/ 632 IMPL_LINK(SvxBulletPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) 633 { 634 NumSelectHdl_Impl(pExamplesVS); 635 OKButton& rOk = GetTabDialog()->GetOKButton(); 636 rOk.GetClickHdl().Call(&rOk); 637 return 0; 638 } 639 640 //Add CHINA001 641 void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet) 642 { 643 644 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); 645 646 if (pBulletCharFmt) 647 SetCharFmtName( pBulletCharFmt->GetValue()); 648 649 650 } 651 //end of add CHINA001 652 /**************************************************************************/ 653 /* */ 654 /* */ 655 /**************************************************************************/ 656 657 658 SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent, 659 const SfxItemSet& rSet) : 660 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_NUM ), rSet ), 661 aValuesFL( this, CUI_RES(FL_VALUES) ), 662 pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_NUM )), 663 pActNum(0), 664 pSaveNum(0), 665 nActNumLvl( USHRT_MAX ), 666 nNumItemId(SID_ATTR_NUMBERING_RULE), 667 bModified(sal_False), 668 bPreset(sal_False) 669 { 670 671 FreeResource(); 672 673 SetExchangeSupport(); 674 675 pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl)); 676 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl)); 677 pExamplesVS->SetHelpId(HID_VALUESET_NUM ); 678 679 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); 680 if(xDefNum.is()) 681 { 682 Sequence<Reference<XIndexAccess> > aOutlineAccess; 683 LanguageType eLang = Application::GetSettings().GetLanguage(); 684 Locale aLocale = SvxCreateLocale(eLang); 685 try 686 { 687 aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); 688 689 for(sal_Int32 nItem = 0; 690 nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT; 691 nItem++ ) 692 { 693 SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ]; 694 695 Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; 696 for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) 697 { 698 Any aValueAny = xLevel->getByIndex(nLevel); 699 Sequence<PropertyValue> aLevelProps; 700 aValueAny >>= aLevelProps; 701 SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps); 702 rItemArr.Insert( pNew, rItemArr.Count() ); 703 } 704 } 705 } 706 catch(Exception&) 707 { 708 } 709 Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY); 710 pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale); 711 } 712 } 713 /*-----------------07.02.97 12.12------------------- 714 715 --------------------------------------------------*/ 716 717 718 SvxNumPickTabPage::~SvxNumPickTabPage() 719 { 720 delete pActNum; 721 delete pExamplesVS; 722 delete pSaveNum; 723 } 724 725 /*-----------------07.02.97 12.12------------------- 726 727 --------------------------------------------------*/ 728 729 730 SfxTabPage* SvxNumPickTabPage::Create( Window* pParent, 731 const SfxItemSet& rAttrSet) 732 { 733 return new SvxNumPickTabPage(pParent, rAttrSet); 734 } 735 736 /*-----------------07.02.97 12.12------------------- 737 738 --------------------------------------------------*/ 739 740 741 sal_Bool SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet ) 742 { 743 if( (bPreset || bModified) && pActNum) 744 { 745 *pSaveNum = *pActNum; 746 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 747 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); 748 } 749 return bModified; 750 } 751 /*-----------------08.02.97 16.28------------------- 752 753 --------------------------------------------------*/ 754 755 void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet) 756 { 757 const SfxPoolItem* pItem; 758 bPreset = sal_False; 759 sal_Bool bIsPreset = sal_False; 760 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 761 if(pExampleSet) 762 { 763 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 764 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); 765 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 766 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 767 } 768 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 769 { 770 delete pSaveNum; 771 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 772 } 773 if(*pSaveNum != *pActNum) 774 { 775 *pActNum = *pSaveNum; 776 pExamplesVS->SetNoSelection(); 777 } 778 // ersten Eintrag vorselektieren 779 if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) 780 { 781 pExamplesVS->SelectItem(1); 782 NumSelectHdl_Impl(pExamplesVS); 783 bPreset = sal_True; 784 } 785 bPreset |= bIsPreset; 786 bModified = sal_False; 787 } 788 789 /* -----------------08.02.97 11.29------------------- 790 791 --------------------------------------------------*/ 792 793 int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) 794 { 795 if(_pSet) 796 FillItemSet(*_pSet); 797 return sal_True; 798 } 799 800 /*-----------------07.02.97 12.12------------------- 801 802 --------------------------------------------------*/ 803 804 void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) 805 { 806 const SfxPoolItem* pItem; 807 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 808 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 809 if(eState != SFX_ITEM_SET) 810 { 811 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 812 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 813 814 if( eState != SFX_ITEM_SET ) 815 { 816 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 817 eState = SFX_ITEM_SET; 818 } 819 820 } 821 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 822 delete pSaveNum; 823 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 824 825 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); 826 if(!pActNum) 827 pActNum = new SvxNumRule(*pSaveNum); 828 else if(*pSaveNum != *pActNum) 829 *pActNum = *pSaveNum; 830 831 } 832 833 /*-----------------08.02.97 11.58------------------- 834 Hier werden alle Ebenen veraendert, 835 --------------------------------------------------*/ 836 837 IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) 838 { 839 if(pActNum) 840 { 841 bPreset = sal_False; 842 bModified = sal_True; 843 844 const FontList* pList = 0; 845 846 SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1]; 847 848 Font& rActBulletFont = lcl_GetDefaultBulletFont(); 849 SvxNumSettings_ImplPtr pLevelSettings = 0; 850 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 851 { 852 if(rItemArr.Count() > i) 853 pLevelSettings = rItemArr[i]; 854 if(!pLevelSettings) 855 break; 856 SvxNumberFormat aFmt(pActNum->GetLevel(i)); 857 aFmt.SetNumberingType( pLevelSettings->nNumberType ); 858 sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; 859 if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) 860 { 861 // #i93908# clear suffix for bullet lists 862 aFmt.SetPrefix(::rtl::OUString()); 863 aFmt.SetSuffix(::rtl::OUString()); 864 if( pLevelSettings->sBulletFont.getLength() && 865 pLevelSettings->sBulletFont.compareTo( 866 rActBulletFont.GetName())) 867 { 868 //search for the font 869 if(!pList) 870 { 871 SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); 872 const SvxFontListItem* pFontListItem = 873 (const SvxFontListItem* )pCurDocShell 874 ->GetItem( SID_ATTR_CHAR_FONTLIST ); 875 pList = pFontListItem ? pFontListItem->GetFontList() : 0; 876 } 877 if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) 878 { 879 FontInfo aInfo = pList->Get( 880 pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); 881 Font aFont(aInfo); 882 aFmt.SetBulletFont(&aFont); 883 } 884 else 885 { 886 //if it cannot be found then create a new one 887 Font aCreateFont( pLevelSettings->sBulletFont, 888 String(), Size( 0, 14 ) ); 889 aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); 890 aCreateFont.SetFamily( FAMILY_DONTKNOW ); 891 aCreateFont.SetPitch( PITCH_DONTKNOW ); 892 aCreateFont.SetWeight( WEIGHT_DONTKNOW ); 893 aCreateFont.SetTransparent( sal_True ); 894 aFmt.SetBulletFont( &aCreateFont ); 895 } 896 } 897 else 898 aFmt.SetBulletFont( &rActBulletFont ); 899 900 aFmt.SetBulletChar( pLevelSettings->sBulletChar.getLength() 901 ? pLevelSettings->sBulletChar.getStr()[0] 902 : 0 ); 903 aFmt.SetCharFmtName( sBulletCharFmtName ); 904 // #62069# // #92724# 905 aFmt.SetBulletRelSize(45); 906 } 907 else 908 { 909 aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0)); 910 aFmt.SetCharFmtName(sNumCharFmtName); 911 // #62069# // #92724# 912 aFmt.SetBulletRelSize(100); 913 // #i93908# 914 aFmt.SetPrefix(pLevelSettings->sPrefix); 915 aFmt.SetSuffix(pLevelSettings->sSuffix); 916 } 917 pActNum->SetLevel(i, aFmt); 918 } 919 } 920 return 0; 921 } 922 923 /*-----------------06.06.97 11.16------------------- 924 925 --------------------------------------------------*/ 926 IMPL_LINK(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) 927 { 928 NumSelectHdl_Impl(pExamplesVS); 929 OKButton& rOk = GetTabDialog()->GetOKButton(); 930 rOk.GetClickHdl().Call(&rOk); 931 return 0; 932 } 933 934 //add CHINA001 begin 935 void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet) 936 { 937 SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); 938 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); 939 940 941 if (pNumCharFmt &&pBulletCharFmt) 942 SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); 943 } 944 //end of CHINA001 945 946 /**************************************************************************/ 947 /* */ 948 /* */ 949 /**************************************************************************/ 950 951 SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent, 952 const SfxItemSet& rSet) : 953 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BMP ), rSet ), 954 aValuesFL( this, CUI_RES(FL_VALUES) ), 955 pExamplesVS( new SvxBmpNumValueSet(this, CUI_RES(VS_VALUES)/*, aGrfNames*/ )), 956 aErrorText( this, CUI_RES(FT_ERROR)), 957 aLinkedCB( this, CUI_RES(CB_LINKED)), 958 pActNum(0), 959 pSaveNum(0), 960 nActNumLvl( USHRT_MAX ), 961 nNumItemId(SID_ATTR_NUMBERING_RULE), 962 bModified(sal_False), 963 bPreset(sal_False) 964 { 965 FreeResource(); 966 SetExchangeSupport(); 967 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); 968 pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl)); 969 pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl)); 970 aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl)); 971 972 // Grafiknamen ermitteln 973 974 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 975 pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP ); 976 for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) 977 { 978 pExamplesVS->InsertItem( i + 1, i); 979 String* pGrfNm = (String*) aGrfNames.GetObject(i); 980 INetURLObject aObj(*pGrfNm); 981 if(aObj.GetProtocol() == INET_PROT_FILE) 982 *pGrfNm = aObj.PathToFileName(); 983 pExamplesVS->SetItemText( i + 1, *pGrfNm ); 984 } 985 if(!aGrfNames.Count()) 986 { 987 aErrorText.Show(); 988 } 989 else 990 { 991 pExamplesVS->Show(); 992 pExamplesVS->Format(); 993 } 994 995 pExamplesVS->SetAccessibleRelationMemberOf( &aValuesFL ); 996 } 997 998 /*-----------------12.02.97 07.46------------------- 999 1000 --------------------------------------------------*/ 1001 1002 SvxBitmapPickTabPage::~SvxBitmapPickTabPage() 1003 { 1004 String* pStr = (String*)aGrfNames.First(); 1005 while( pStr ) 1006 { 1007 delete pStr; 1008 pStr = (String*)aGrfNames.Next(); 1009 } 1010 delete pExamplesVS; 1011 delete pActNum; 1012 delete pSaveNum; 1013 } 1014 1015 /*-----------------12.02.97 07.46------------------- 1016 1017 --------------------------------------------------*/ 1018 1019 SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent, 1020 const SfxItemSet& rAttrSet) 1021 { 1022 return new SvxBitmapPickTabPage(pParent, rAttrSet); 1023 } 1024 1025 /*-----------------12.02.97 07.46------------------- 1026 1027 --------------------------------------------------*/ 1028 1029 void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) 1030 { 1031 const SfxPoolItem* pItem; 1032 bPreset = sal_False; 1033 sal_Bool bIsPreset = sal_False; 1034 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); 1035 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 1036 if(pExampleSet) 1037 { 1038 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 1039 bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); 1040 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 1041 nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 1042 } 1043 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 1044 { 1045 delete pSaveNum; 1046 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 1047 } 1048 if(*pSaveNum != *pActNum) 1049 { 1050 *pActNum = *pSaveNum; 1051 pExamplesVS->SetNoSelection(); 1052 } 1053 // ersten Eintrag vorselektieren 1054 if(aGrfNames.Count() && 1055 (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))) 1056 { 1057 pExamplesVS->SelectItem(1); 1058 NumSelectHdl_Impl(pExamplesVS); 1059 bPreset = sal_True; 1060 } 1061 bPreset |= bIsPreset; 1062 bModified = sal_False; 1063 } 1064 /*-----------------12.02.97 07.46------------------- 1065 1066 --------------------------------------------------*/ 1067 1068 int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet) 1069 { 1070 if(_pSet) 1071 FillItemSet(*_pSet); 1072 return sal_True; 1073 } 1074 /*-----------------12.02.97 07.46------------------- 1075 1076 --------------------------------------------------*/ 1077 1078 sal_Bool SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) 1079 { 1080 if ( !aGrfNames.Count() ) 1081 { 1082 // das ist im SfxItemSet leider nicht zulaessig #52134# 1083 // rSet.DisableItem(SID_ATTR_NUMBERING_RULE); 1084 return sal_False; 1085 } 1086 if( (bPreset || bModified) && pActNum) 1087 { 1088 *pSaveNum = *pActNum; 1089 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 1090 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); 1091 } 1092 1093 return bModified; 1094 } 1095 /*-----------------12.02.97 07.46------------------- 1096 1097 --------------------------------------------------*/ 1098 1099 void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) 1100 { 1101 const SfxPoolItem* pItem; 1102 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 1103 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 1104 if(eState != SFX_ITEM_SET) 1105 { 1106 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 1107 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 1108 1109 if( eState != SFX_ITEM_SET ) 1110 { 1111 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 1112 eState = SFX_ITEM_SET; 1113 } 1114 1115 } 1116 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 1117 delete pSaveNum; 1118 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 1119 1120 if(!pActNum) 1121 pActNum = new SvxNumRule(*pSaveNum); 1122 else if(*pSaveNum != *pActNum) 1123 *pActNum = *pSaveNum; 1124 if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) 1125 { 1126 aLinkedCB.Check(sal_False); 1127 aLinkedCB.Enable(sal_False); 1128 } 1129 else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) 1130 { 1131 aLinkedCB.Check(sal_True); 1132 aLinkedCB.Enable(sal_False); 1133 } 1134 } 1135 1136 /*-----------------12.02.97 07.53------------------- 1137 1138 --------------------------------------------------*/ 1139 1140 IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) 1141 { 1142 if(pActNum) 1143 { 1144 bPreset = sal_False; 1145 bModified = sal_True; 1146 sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1; 1147 1148 String* pGrfName = 0; 1149 if(aGrfNames.Count() > nIdx) 1150 pGrfName = (String*)aGrfNames.GetObject(nIdx); 1151 1152 sal_uInt16 nMask = 1; 1153 String aEmptyStr; 1154 sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 1155 if(aLinkedCB.IsChecked()) 1156 nSetNumberingType |= LINK_TOKEN; 1157 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 1158 { 1159 if(nActNumLvl & nMask) 1160 { 1161 SvxNumberFormat aFmt(pActNum->GetLevel(i)); 1162 aFmt.SetNumberingType(nSetNumberingType); 1163 aFmt.SetPrefix( aEmptyStr ); 1164 aFmt.SetSuffix( aEmptyStr ); 1165 aFmt.SetCharFmtName( sNumCharFmtName ); 1166 1167 Graphic aGraphic; 1168 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic)) 1169 { 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 ); 1175 } 1176 else if(pGrfName) 1177 aFmt.SetGraphic( *pGrfName ); 1178 pActNum->SetLevel(i, aFmt); 1179 } 1180 nMask <<= 1 ; 1181 } 1182 } 1183 1184 return 0; 1185 } 1186 1187 /*-----------------06.06.97 11.17------------------- 1188 1189 --------------------------------------------------*/ 1190 IMPL_LINK(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) 1191 { 1192 NumSelectHdl_Impl(pExamplesVS); 1193 OKButton& rOk = GetTabDialog()->GetOKButton(); 1194 rOk.GetClickHdl().Call(&rOk); 1195 return 0; 1196 } 1197 /* -----------------03.11.99 13:46------------------- 1198 1199 --------------------------------------------------*/ 1200 IMPL_LINK(SvxBitmapPickTabPage, LinkBmpHdl_Impl, CheckBox*, EMPTYARG ) 1201 { 1202 if(!pExamplesVS->IsNoSelection()) 1203 { 1204 NumSelectHdl_Impl(pExamplesVS); 1205 } 1206 return 0; 1207 } 1208 /*-----------------13.02.97 09.40------------------- 1209 1210 --------------------------------------------------*/ 1211 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( sal_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 sal_uInt16 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 = sal_True; 1256 //CHINA001 } 1257 //CHINA001 else 1258 //CHINA001 { 1259 //CHINA001 Point aPos(aBLPos.X() + 5, 0); 1260 //CHINA001 for( sal_uInt16 i = 0; i < 3; i++ ) 1261 //CHINA001 { 1262 //CHINA001 sal_uInt16 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 = sal_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, CUI_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ), 1291 1292 aFormatFL( this, CUI_RES(FL_FORMAT )), 1293 aLevelFT( this, CUI_RES(FT_LEVEL )), 1294 aLevelLB( this, CUI_RES(LB_LEVEL )), 1295 aFmtFT( this, CUI_RES(FT_FMT )), 1296 aFmtLB( this, CUI_RES(LB_FMT )), 1297 aPrefixFT( this, CUI_RES(FT_PREFIX )), 1298 aPrefixED( this, CUI_RES(ED_PREFIX )), 1299 aSuffixFT( this, CUI_RES(FT_SUFFIX )), 1300 aSuffixED( this, CUI_RES(ED_SUFFIX )), 1301 aCharFmtFT( this, CUI_RES(FT_CHARFMT )), 1302 aCharFmtLB( this, CUI_RES(LB_CHARFMT )), 1303 aBulColorFT( this, CUI_RES(FT_BUL_COLOR)), 1304 aBulColLB( this, CUI_RES(LB_BUL_COLOR)), 1305 aBulRelSizeFT( this, CUI_RES(FT_BUL_REL_SIZE)), 1306 aBulRelSizeMF( this, CUI_RES(MF_BUL_REL_SIZE)), 1307 aAllLevelFT( this, CUI_RES(FT_ALL_LEVEL)), 1308 aAllLevelNF( this, CUI_RES(NF_ALL_LEVEL)), 1309 aStartFT( this, CUI_RES(FT_START )), 1310 aStartED( this, CUI_RES(ED_START )), 1311 aBulletPB( this, CUI_RES(PB_BULLET )), 1312 aAlignFT( this, CUI_RES(FT_ALIGN )), 1313 aAlignLB( this, CUI_RES(LB_ALIGN )), 1314 aBitmapFT( this, CUI_RES(FT_BITMAP )), 1315 aBitmapMB( this, CUI_RES(MB_BITMAP )), 1316 aSizeFT( this, CUI_RES(FT_SIZE )), 1317 aWidthMF( this, CUI_RES(MF_WIDTH )), 1318 aMultFT( this, CUI_RES(FT_MULT )), 1319 aHeightMF( this, CUI_RES(MF_HEIGHT )), 1320 aRatioCB( this, CUI_RES(CB_RATIO )), 1321 aOrientFT( this, CUI_RES(FT_ORIENT )), 1322 aOrientLB( this, CUI_RES(LB_ORIENT )), 1323 aSameLevelFL( this, CUI_RES(FL_SAME_LEVEL)), 1324 aSameLevelCB( this, CUI_RES(CB_SAME_LEVEL)), 1325 pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))), 1326 pActNum(0), 1327 pSaveNum(0), 1328 bLastWidthModified(sal_False), 1329 bModified(sal_False), 1330 bPreset(sal_False), 1331 bAutomaticCharStyles(sal_True), 1332 bHTMLMode(sal_False), 1333 bMenuButtonInitialized(sal_False), 1334 sBullet(CUI_RES(STR_BULLET)), 1335 nBullet(0xff), 1336 nActNumLvl(USHRT_MAX), 1337 nNumItemId(SID_ATTR_NUMBERING_RULE) 1338 { 1339 sStartWith = aStartFT.GetText(); 1340 pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); 1341 SetExchangeSupport(); 1342 aActBulletFont = lcl_GetDefaultBulletFont(); 1343 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); 1362 1363 aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl)); 1364 PopupMenu* pPopup = new PopupMenu; 1365 aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); 1366 1367 pPopup->InsertItem( NUM_NO_GRAPHIC, String(CUI_RES(ST_POPUP_EMPTY_ENTRY)) ); 1368 pPopup->EnableItem( NUM_NO_GRAPHIC, sal_False ); 1369 1370 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); 1371 1372 aBitmapMB.SetAccessibleRelationLabeledBy( &aBitmapFT ); 1373 1374 FreeResource(); 1375 1376 //get advanced numbering types from the component 1377 Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); 1378 Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY); 1379 1380 // Extended numbering schemes present in the resource but not offered by 1381 // the i18n framework per configuration must be removed from the listbox. 1382 // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that. 1383 const sal_uInt16 nDontRemove = 0xffff; 1384 ::std::vector< sal_uInt16> aRemove( aFmtLB.GetEntryCount(), nDontRemove); 1385 for (size_t i=0; i<aRemove.size(); ++i) 1386 { 1387 sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData( 1388 sal::static_int_cast< sal_uInt16 >(i)); 1389 if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && 1390 nEntryData != (SVX_NUM_BITMAP | 0x80)) 1391 aRemove[i] = nEntryData; 1392 } 1393 if(xInfo.is()) 1394 { 1395 Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( ); 1396 const sal_Int16* pTypes = aTypes.getConstArray(); 1397 for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) 1398 { 1399 sal_Int16 nCurrent = pTypes[nType]; 1400 if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N) 1401 { 1402 sal_Bool bInsert = sal_True; 1403 for(sal_uInt16 nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++) 1404 { 1405 sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(nEntry); 1406 if(nEntryData == (sal_uInt16) nCurrent) 1407 { 1408 bInsert = sal_False; 1409 aRemove[nEntry] = nDontRemove; 1410 break; 1411 } 1412 } 1413 if(bInsert) 1414 { 1415 OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); 1416 sal_uInt16 nPos = aFmtLB.InsertEntry(aIdent); 1417 aFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent); 1418 } 1419 } 1420 } 1421 } 1422 for (size_t i=0; i<aRemove.size(); ++i) 1423 { 1424 if (aRemove[i] != nDontRemove) 1425 { 1426 sal_uInt16 nPos = aFmtLB.GetEntryPos( (void*)(sal_uLong)aRemove[i]); 1427 aFmtLB.RemoveEntry( nPos); 1428 } 1429 } 1430 1431 aBulletPB.SetAccessibleRelationMemberOf(&aFormatFL); 1432 aBulletPB.SetAccessibleRelationLabeledBy(&aStartFT); 1433 aBulletPB.SetAccessibleName(aStartFT.GetText()); 1434 } 1435 1436 /*-----------------01.12.97 16:30------------------- 1437 1438 --------------------------------------------------*/ 1439 SvxNumOptionsTabPage::~SvxNumOptionsTabPage() 1440 { 1441 delete aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); 1442 String* pStr = (String*)aGrfNames.First(); 1443 while( pStr ) 1444 { 1445 delete pStr; 1446 pStr = (String*)aGrfNames.Next(); 1447 } 1448 delete pActNum; 1449 delete pPreviewWIN; 1450 delete pSaveNum; 1451 } 1452 1453 /*-----------------03.12.97 07:52------------------- 1454 1455 --------------------------------------------------*/ 1456 void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric) 1457 { 1458 if(eMetric == FUNIT_MM) 1459 { 1460 aWidthMF .SetDecimalDigits(1); 1461 aHeightMF .SetDecimalDigits(1); 1462 } 1463 aWidthMF .SetUnit( eMetric ); 1464 aHeightMF .SetUnit( eMetric ); 1465 } 1466 1467 /*-----------------01.12.97 16:30------------------- 1468 1469 --------------------------------------------------*/ 1470 SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent, 1471 const SfxItemSet& rAttrSet) 1472 { 1473 return new SvxNumOptionsTabPage(pParent, rAttrSet); 1474 }; 1475 /*-----------------01.12.97 16:29------------------- 1476 1477 --------------------------------------------------*/ 1478 void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet) 1479 { 1480 const SfxPoolItem* pItem; 1481 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 1482 sal_uInt16 nTmpNumLvl = USHRT_MAX; 1483 if(pExampleSet) 1484 { 1485 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 1486 bPreset = ((const SfxBoolItem*)pItem)->GetValue(); 1487 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 1488 nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 1489 } 1490 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 1491 { 1492 delete pSaveNum; 1493 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 1494 } 1495 // 1496 bModified = (!pActNum->Get( 0 ) || bPreset); 1497 if(*pActNum != *pSaveNum || 1498 nActNumLvl != nTmpNumLvl) 1499 { 1500 nActNumLvl = nTmpNumLvl; 1501 sal_uInt16 nMask = 1; 1502 aLevelLB.SetUpdateMode(sal_False); 1503 aLevelLB.SetNoSelection(); 1504 aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); 1505 if(nActNumLvl != USHRT_MAX) 1506 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 1507 { 1508 if(nActNumLvl & nMask) 1509 aLevelLB.SelectEntryPos( i, sal_True); 1510 nMask <<= 1 ; 1511 } 1512 aLevelLB.SetUpdateMode(sal_True); 1513 *pActNum = *pSaveNum; 1514 InitControls(); 1515 } 1516 1517 } 1518 /*-----------------01.12.97 16:29------------------- 1519 1520 --------------------------------------------------*/ 1521 int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet) 1522 { 1523 if(_pSet) 1524 FillItemSet(*_pSet); 1525 return sal_True; 1526 } 1527 /*-----------------01.12.97 16:29------------------- 1528 1529 --------------------------------------------------*/ 1530 sal_Bool SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) 1531 { 1532 rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); 1533 if(bModified && pActNum) 1534 { 1535 *pSaveNum = *pActNum; 1536 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 1537 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False)); 1538 } 1539 return bModified; 1540 }; 1541 /*-----------------01.12.97 16:29------------------- 1542 1543 --------------------------------------------------*/ 1544 void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) 1545 { 1546 const SfxPoolItem* pItem; 1547 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 1548 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 1549 if(eState != SFX_ITEM_SET) 1550 { 1551 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 1552 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 1553 1554 if( eState != SFX_ITEM_SET ) 1555 { 1556 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 1557 eState = SFX_ITEM_SET; 1558 } 1559 1560 } 1561 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 1562 delete pSaveNum; 1563 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 1564 1565 // Ebenen einfuegen 1566 if(!aLevelLB.GetEntryCount()) 1567 { 1568 for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++) 1569 aLevelLB.InsertEntry( UniString::CreateFromInt32(i)); 1570 if(pSaveNum->GetLevelCount() > 1) 1571 { 1572 String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ) ) ); 1573 sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() ); 1574 aLevelLB.InsertEntry(sEntry); 1575 aLevelLB.SelectEntry(sEntry); 1576 } 1577 else 1578 aLevelLB.SelectEntryPos(0); 1579 } 1580 else 1581 aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); 1582 1583 // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); 1584 sal_uInt16 nMask = 1; 1585 aLevelLB.SetUpdateMode(sal_False); 1586 aLevelLB.SetNoSelection(); 1587 if(nActNumLvl == USHRT_MAX) 1588 { 1589 aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True); 1590 } 1591 else 1592 for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++) 1593 { 1594 if(nActNumLvl & nMask) 1595 aLevelLB.SelectEntryPos( i, sal_True); 1596 nMask <<= 1 ; 1597 } 1598 aLevelLB.SetUpdateMode(sal_True); 1599 1600 if(!pActNum) 1601 pActNum = new SvxNumRule(*pSaveNum); 1602 else if(*pSaveNum != *pActNum) 1603 *pActNum = *pSaveNum; 1604 pPreviewWIN->SetNumRule(pActNum); 1605 aSameLevelCB.Check(pActNum->IsContinuousNumbering()); 1606 1607 //ColorListBox bei Bedarf fuellen 1608 if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) 1609 { 1610 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 1611 DBG_ASSERT( pDocSh, "DocShell not found!" ); 1612 XColorTable* pColorTable = NULL; 1613 FASTBOOL bKillTable = sal_False; 1614 if ( pDocSh ) 1615 { 1616 pItem = pDocSh->GetItem( SID_COLOR_TABLE ); 1617 if ( pItem ) 1618 pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 1619 } 1620 1621 if ( !pColorTable ) 1622 { 1623 pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 1624 bKillTable = sal_True; 1625 } 1626 1627 aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); 1628 1629 for ( long i = 0; i < pColorTable->Count(); i++ ) 1630 { 1631 XColorEntry* pEntry = pColorTable->GetColor(i); 1632 aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 1633 } 1634 1635 if ( bKillTable ) 1636 delete pColorTable; 1637 } 1638 1639 SfxObjectShell* pShell; 1640 if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False, &pItem ) 1641 || ( 0 != ( pShell = SfxObjectShell::Current()) && 1642 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) 1643 { 1644 sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); 1645 bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON); 1646 } 1647 1648 sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); 1649 aCharFmtFT.Show(bCharFmt); 1650 aCharFmtLB.Show(bCharFmt); 1651 1652 sal_Bool bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS); 1653 1654 sal_Bool bAllLevel = bContinuous && !bHTMLMode; 1655 aAllLevelFT.Show(bAllLevel); 1656 aAllLevelNF.Show(bAllLevel); 1657 1658 aSameLevelFL.Show(bContinuous); 1659 aSameLevelCB.Show(bContinuous); 1660 //wieder Missbrauch: im Draw gibt es die Numerierung nur bis zum Bitmap 1661 // without SVX_NUM_NUMBER_NONE 1662 //remove types that are unsupported by Draw/Impress 1663 if(!bContinuous) 1664 { 1665 sal_uInt16 nFmtCount = aFmtLB.GetEntryCount(); 1666 for(sal_uInt16 i = nFmtCount; i; i--) 1667 { 1668 sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1); 1669 if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/ 1670 ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData)) 1671 aFmtLB.RemoveEntry(i - 1); 1672 } 1673 } 1674 //one must be enabled 1675 if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) 1676 { 1677 long nData = SVX_NUM_BITMAP|LINK_TOKEN; 1678 sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData); 1679 if(LISTBOX_ENTRY_NOTFOUND != nPos) 1680 aFmtLB.RemoveEntry(nPos); 1681 } 1682 else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) 1683 { 1684 long nData = SVX_NUM_BITMAP; 1685 sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData); 1686 if(LISTBOX_ENTRY_NOTFOUND != nPos) 1687 aFmtLB.RemoveEntry(nPos); 1688 } 1689 if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT)) 1690 { 1691 aAlignFT.Show(); 1692 aAlignLB.Show(); 1693 Size aSz(aFormatFL.GetSizePixel()); 1694 aSz.Height() = aLevelFT.GetSizePixel().Height(); 1695 aFormatFL.SetSizePixel(aSz); 1696 aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); 1697 } 1698 1699 //MegaHack: Aufgrund eines nicht fixbaren 'designfehlers' im Impress 1700 //Alle arten der numerischen Aufzaehlungen loeschen 1701 if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS)) 1702 { 1703 sal_uInt16 nFmtCount = aFmtLB.GetEntryCount(); 1704 for(sal_uInt16 i = nFmtCount; i; i--) 1705 { 1706 sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1); 1707 if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE) 1708 aFmtLB.RemoveEntry(i - 1); 1709 } 1710 } 1711 1712 InitControls(); 1713 bModified = sal_False; 1714 1715 } 1716 /*-----------------02.12.97 13:47------------------- 1717 1718 --------------------------------------------------*/ 1719 void SvxNumOptionsTabPage::InitControls() 1720 { 1721 sal_Bool bShowBullet = sal_True; 1722 sal_Bool bShowBitmap = sal_True; 1723 sal_Bool bSameType = sal_True; 1724 sal_Bool bSameStart = sal_True; 1725 sal_Bool bSamePrefix = sal_True; 1726 sal_Bool bSameSuffix = sal_True; 1727 sal_Bool bAllLevel = sal_True; 1728 sal_Bool bSameCharFmt = sal_True; 1729 sal_Bool bSameVOrient = sal_True; 1730 sal_Bool bSameSize = sal_True; 1731 sal_Bool bSameBulColor = sal_True; 1732 sal_Bool bSameBulRelSize= sal_True; 1733 sal_Bool bSameAdjust = sal_True; 1734 1735 const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; 1736 String sFirstCharFmt; 1737 sal_Int16 eFirstOrient = text::VertOrientation::NONE; 1738 Size aFirstSize(0,0); 1739 sal_uInt16 nMask = 1; 1740 sal_uInt16 nLvl = USHRT_MAX; 1741 sal_uInt16 nHighestLevel = 0; 1742 String aEmptyStr; 1743 1744 sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); 1745 sal_Bool bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); 1746 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 1747 { 1748 if(nActNumLvl & nMask) 1749 { 1750 aNumFmtArr[i] = &pActNum->GetLevel(i); 1751 bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; 1752 bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP; 1753 if(USHRT_MAX == nLvl) 1754 { 1755 nLvl = i; 1756 sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName(); 1757 eFirstOrient = aNumFmtArr[i]->GetVertOrient(); 1758 if(bShowBitmap) 1759 aFirstSize = aNumFmtArr[i]->GetGraphicSize(); 1760 } 1761 if( i > nLvl) 1762 { 1763 bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType(); 1764 bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart(); 1765 1766 bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix(); 1767 bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix(); 1768 bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels(); 1769 bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName(); 1770 bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient(); 1771 if(bShowBitmap && bSameSize) 1772 bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize; 1773 bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor(); 1774 bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize(); 1775 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); 1776 } 1777 nHighestLevel = i; 1778 } 1779 else 1780 aNumFmtArr[i] = 0; 1781 1782 nMask <<= 1 ; 1783 1784 } 1785 SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0); 1786 CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType()); 1787 if(bShowBitmap) 1788 { 1789 if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE) 1790 aOrientLB.SetNoSelection(); 1791 else 1792 aOrientLB.SelectEntryPos( 1793 sal::static_int_cast< sal_uInt16 >(eFirstOrient - 1)); 1794 // kein text::VertOrientation::NONE 1795 1796 if(bSameSize) 1797 { 1798 SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit); 1799 SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit); 1800 } 1801 else 1802 { 1803 aHeightMF.SetText(aEmptyStr); 1804 aWidthMF.SetText(aEmptyStr); 1805 } 1806 } 1807 1808 if(bSameType) 1809 { 1810 sal_uInt16 nLBData = (sal_uInt16) aNumFmtArr[nLvl]->GetNumberingType(); 1811 aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) )); 1812 } 1813 else 1814 aFmtLB.SetNoSelection(); 1815 1816 aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked()); 1817 aAllLevelNF.SetMax(nHighestLevel + 1); 1818 if(bAllLevel) 1819 { 1820 aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels()); 1821 } 1822 else 1823 { 1824 aAllLevelNF.SetText(aEmptyStr); 1825 } 1826 if(bSameAdjust) 1827 { 1828 sal_uInt16 nPos = 1; // zentriert 1829 if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) 1830 nPos = 0; 1831 else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) 1832 nPos = 2; 1833 aAlignLB.SelectEntryPos(nPos); 1834 } 1835 else 1836 { 1837 aAlignLB.SetNoSelection(); 1838 } 1839 1840 if(bBullRelSize) 1841 { 1842 if(bSameBulRelSize) 1843 aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize()); 1844 else 1845 aBulRelSizeMF.SetText(aEmptyStr); 1846 } 1847 if(bBullColor) 1848 { 1849 if(bSameBulColor) 1850 aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor()); 1851 else 1852 aBulColLB.SetNoSelection(); 1853 } 1854 switch(nBullet) 1855 { 1856 case SHOW_NUMBERING: 1857 if(bSameStart) 1858 { 1859 aStartED.SetValue(aNumFmtArr[nLvl]->GetStart()); 1860 } 1861 else 1862 aStartED.SetText(aEmptyStr); 1863 break; 1864 case SHOW_BULLET: 1865 { 1866 // const Font* pFnt = aNumFmtArr[Lvl]->GetBulletFont(); 1867 // if(pFnt) 1868 // ChgTxtFont(aBulletFT, *pFnt); 1869 // aBulletFT.SetText(String((char)aNumFmtArr[nLvl]->GetBulletChar())); 1870 } 1871 break; 1872 case SHOW_BITMAP: 1873 break; 1874 } 1875 1876 if(bSamePrefix) 1877 aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix()); 1878 else 1879 aPrefixED.SetText(aEmptyStr); 1880 if(bSameSuffix) 1881 aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix()); 1882 else 1883 aSuffixED.SetText(aEmptyStr); 1884 1885 if(bSameCharFmt) 1886 { 1887 if(sFirstCharFmt.Len()) 1888 aCharFmtLB.SelectEntry(sFirstCharFmt); 1889 else 1890 aCharFmtLB.SelectEntryPos( 0 ); 1891 } 1892 else 1893 aCharFmtLB.SetNoSelection(); 1894 1895 pPreviewWIN->SetLevel(nActNumLvl); 1896 pPreviewWIN->Invalidate(); 1897 } 1898 1899 /*-----------------02.12.97 14:01------------------- 1900 0 - Nummer; 1 - Bullet; 2 - Bitmap 1901 --------------------------------------------------*/ 1902 1903 void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType, sal_Bool ) 1904 { 1905 if(nBullet == nType) 1906 return; 1907 nBullet = nType; 1908 sal_Bool bBitmap = sal_False; 1909 sal_Bool bBullet = sal_False; 1910 sal_Bool bEnableBitmap = sal_False; 1911 if(nType == SHOW_NUMBERING) 1912 { 1913 // Label umschalten, alten Text merken 1914 aStartFT.SetText(sStartWith); 1915 1916 } 1917 else if(nType == SHOW_BULLET) 1918 { 1919 // Label umschalten, alten Text merken 1920 aStartFT.SetText(sBullet); 1921 bBullet = sal_True; 1922 } 1923 else 1924 { 1925 bBitmap = sal_True; 1926 bEnableBitmap = sal_True; 1927 } 1928 sal_Bool bNumeric = !(bBitmap||bBullet); 1929 aPrefixFT.Show(bNumeric); 1930 aPrefixED.Show(bNumeric); 1931 aSuffixFT.Show(bNumeric); 1932 aSuffixED.Show(bNumeric); 1933 1934 sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); 1935 aCharFmtFT.Show(!bBitmap && bCharFmt); 1936 aCharFmtLB.Show(!bBitmap && bCharFmt); 1937 1938 // das ist eigentlich Missbrauch, da fuer die vollst. Numerierung kein 1939 // eigenes Flag existiert 1940 sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); 1941 sal_Bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode; 1942 aAllLevelFT.Show(bAllLevel); 1943 aAllLevelNF.Show(bAllLevel); 1944 1945 aStartFT.Show(!bBitmap); 1946 aStartED.Show(!(bBullet||bBitmap)); 1947 1948 aBulletPB.Show(bBullet); 1949 sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); 1950 aBulColorFT.Show( !bBitmap && bBullColor ); 1951 aBulColLB.Show( !bBitmap && bBullColor ); 1952 sal_Bool bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); 1953 aBulRelSizeFT.Show( !bBitmap && bBullResSize ); 1954 aBulRelSizeMF.Show( !bBitmap && bBullResSize ); 1955 1956 aBitmapFT .Show(bBitmap); 1957 aBitmapMB .Show(bBitmap); 1958 1959 aSizeFT .Show(bBitmap); 1960 aWidthMF .Show(bBitmap); 1961 aMultFT .Show(bBitmap); 1962 aHeightMF .Show(bBitmap); 1963 aRatioCB .Show(bBitmap); 1964 1965 aOrientFT .Show(bBitmap && bAllLevelFeature); 1966 aOrientLB .Show(bBitmap && bAllLevelFeature); 1967 1968 aSizeFT .Enable(bEnableBitmap); 1969 aWidthMF .Enable(bEnableBitmap); 1970 aMultFT .Enable(bEnableBitmap); 1971 aHeightMF .Enable(bEnableBitmap); 1972 aRatioCB .Enable(bEnableBitmap); 1973 aOrientFT .Enable(bEnableBitmap); 1974 aOrientLB .Enable(bEnableBitmap); 1975 1976 } 1977 /*-----------------02.12.97 13:51------------------- 1978 1979 --------------------------------------------------*/ 1980 IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox ) 1981 { 1982 sal_uInt16 nSaveNumLvl = nActNumLvl; 1983 nActNumLvl = 0; 1984 if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && 1985 (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) 1986 { 1987 nActNumLvl = 0xFFFF; 1988 pBox->SetUpdateMode(sal_False); 1989 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 1990 pBox->SelectEntryPos( i, sal_False ); 1991 pBox->SetUpdateMode(sal_True); 1992 } 1993 else if(pBox->GetSelectEntryCount()) 1994 { 1995 sal_uInt16 nMask = 1; 1996 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 1997 { 1998 if(pBox->IsEntryPosSelected( i )) 1999 nActNumLvl |= nMask; 2000 nMask <<= 1; 2001 } 2002 pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False ); 2003 } 2004 else 2005 { 2006 nActNumLvl = nSaveNumLvl; 2007 sal_uInt16 nMask = 1; 2008 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 2009 { 2010 if(nActNumLvl & nMask) 2011 { 2012 pBox->SelectEntryPos(i); 2013 break; 2014 } 2015 nMask <<=1; 2016 } 2017 } 2018 InitControls(); 2019 return 0; 2020 } 2021 /* -----------------------------05.04.2002 15:30------------------------------ 2022 2023 ---------------------------------------------------------------------------*/ 2024 IMPL_LINK( SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer*, EMPTYARG ) 2025 { 2026 pPreviewWIN->Invalidate(); 2027 return 0; 2028 } 2029 /*-----------------03.12.97 12:01------------------- 2030 2031 --------------------------------------------------*/ 2032 IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox ) 2033 { 2034 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2035 { 2036 sal_uInt16 nMask = 1; 2037 for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++) 2038 { 2039 if(nActNumLvl & nMask) 2040 { 2041 SvxNumberFormat aNumFmt(pActNum->GetLevel(e)); 2042 aNumFmt.SetIncludeUpperLevels((sal_uInt8) std::min(pBox->GetValue(), sal_Int64(e + 1)) ); 2043 pActNum->SetLevel(e, aNumFmt); 2044 } 2045 nMask <<= 1; 2046 } 2047 } 2048 SetModified(); 2049 return 0; 2050 } 2051 2052 /*-----------------02.12.97 08:56------------------- 2053 2054 --------------------------------------------------*/ 2055 IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox ) 2056 { 2057 String sSelectStyle; 2058 sal_Int16 eOldType; 2059 sal_Bool bShowOrient = sal_False; 2060 sal_Bool bBmp = sal_False; 2061 String aEmptyStr; 2062 sal_uInt16 nMask = 1; 2063 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2064 { 2065 if(nActNumLvl & nMask) 2066 { 2067 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2068 eOldType = aNumFmt.GetNumberingType(); 2069 // PAGEDESC gibt es nicht 2070 sal_uInt16 nNumType = (sal_uInt16)(sal_uLong)pBox->GetEntryData(pBox->GetSelectEntryPos()); 2071 aNumFmt.SetNumberingType((sal_Int16)nNumType); 2072 sal_uInt16 nNumberingType = aNumFmt.GetNumberingType(); 2073 if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN))) 2074 { 2075 bBmp |= 0 != aNumFmt.GetBrush(); 2076 aNumFmt.SetIncludeUpperLevels( sal_False ); 2077 aNumFmt.SetSuffix( aEmptyStr ); 2078 aNumFmt.SetPrefix( aEmptyStr ); 2079 if(!bBmp) 2080 aNumFmt.SetGraphic(aEmptyStr); 2081 pActNum->SetLevel(i, aNumFmt); 2082 SwitchNumberType(SHOW_BITMAP, bBmp ); 2083 bShowOrient = sal_True; 2084 } 2085 else if( SVX_NUM_CHAR_SPECIAL == nNumberingType ) 2086 { 2087 aNumFmt.SetIncludeUpperLevels( sal_False ); 2088 aNumFmt.SetSuffix( aEmptyStr ); 2089 aNumFmt.SetPrefix( aEmptyStr ); 2090 if( !aNumFmt.GetBulletFont() ) 2091 aNumFmt.SetBulletFont(&aActBulletFont); 2092 if( !aNumFmt.GetBulletChar() ) 2093 aNumFmt.SetBulletChar( SVX_DEF_BULLET ); 2094 pActNum->SetLevel(i, aNumFmt); 2095 SwitchNumberType(SHOW_BULLET); 2096 //ChgTxtFont(aBulletFT, *aNumFmt.GetBulletFont()); 2097 //aBulletFT.SetText( aNumFmt.GetBulletChar() ); 2098 // Zuweisung der Zeichenvorlage automatisch 2099 if(bAutomaticCharStyles) 2100 { 2101 sSelectStyle = sBulletCharFmtName; 2102 } 2103 } 2104 else 2105 { 2106 aNumFmt.SetPrefix( aPrefixED.GetText() ); 2107 aNumFmt.SetSuffix( aSuffixED.GetText() ); 2108 // aNumFmt.SetBulletFont(0); 2109 SwitchNumberType(SHOW_NUMBERING); 2110 pActNum->SetLevel(i, aNumFmt); 2111 CheckForStartValue_Impl(nNumberingType); 2112 2113 // Zuweisung der Zeichenvorlage automatisch 2114 if(bAutomaticCharStyles) 2115 { 2116 sSelectStyle = sNumCharFmtName; 2117 } 2118 } 2119 } 2120 nMask <<= 1; 2121 } 2122 sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); 2123 if(bShowOrient && bAllLevelFeature) 2124 { 2125 aOrientFT.Show(); 2126 aOrientLB.Show(); 2127 } 2128 else 2129 { 2130 aOrientFT.Hide(); 2131 aOrientLB.Hide(); 2132 } 2133 SetModified(); 2134 if(sSelectStyle.Len()) 2135 { 2136 aCharFmtLB.SelectEntry(sSelectStyle); 2137 CharFmtHdl_Impl(&aCharFmtLB); 2138 // bAutomaticCharStyles wird im CharFmtHdl_Impl zurueckgesetzt 2139 bAutomaticCharStyles = sal_True; 2140 } 2141 return 0; 2142 } 2143 /* -----------------06.11.2002 14:27----------------- 2144 * 2145 * --------------------------------------------------*/ 2146 void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) 2147 { 2148 sal_Bool bIsNull = aStartED.GetValue() == 0; 2149 sal_Bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC || 2150 SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType || 2151 SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType; 2152 aStartED.SetMin(bNoZeroAllowed ? 1 : 0); 2153 if(bIsNull && bNoZeroAllowed) 2154 aStartED.GetModifyHdl().Call(&aStartED); 2155 } 2156 /*-----------------03.12.97 16:43------------------- 2157 2158 --------------------------------------------------*/ 2159 IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox ) 2160 { 2161 sal_uInt16 nPos = pBox->GetSelectEntryPos(); 2162 nPos ++; // kein VERT_NONE 2163 2164 sal_uInt16 nMask = 1; 2165 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2166 { 2167 if(nActNumLvl & nMask) 2168 { 2169 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2170 if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) 2171 { 2172 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); 2173 const Size& rSize = aNumFmt.GetGraphicSize(); 2174 sal_Int16 eOrient = (sal_Int16)nPos; 2175 aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient ); 2176 pActNum->SetLevel(i, aNumFmt); 2177 } 2178 } 2179 nMask <<= 1; 2180 } 2181 SetModified(sal_False); 2182 return 0; 2183 2184 } 2185 2186 /*-----------------06.12.97 12:00------------------- 2187 2188 --------------------------------------------------*/ 2189 IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox ) 2190 { 2191 sal_Bool bSet = pBox->IsChecked(); 2192 pActNum->SetContinuousNumbering(bSet); 2193 sal_Bool bRepaint = sal_False; 2194 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2195 { 2196 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2197 if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE) 2198 { 2199 bRepaint = sal_True; 2200 break; 2201 } 2202 } 2203 SetModified(bRepaint); 2204 InitControls(); 2205 return 0; 2206 } 2207 /* -----------------16.11.98 14:20------------------- 2208 * 2209 * --------------------------------------------------*/ 2210 IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox ) 2211 { 2212 Color nSetColor = pBox->GetSelectEntryColor(); 2213 2214 sal_uInt16 nMask = 1; 2215 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2216 { 2217 if(nActNumLvl & nMask) 2218 { 2219 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2220 aNumFmt.SetBulletColor(nSetColor); 2221 pActNum->SetLevel(i, aNumFmt); 2222 } 2223 nMask <<= 1; 2224 } 2225 SetModified(); 2226 return 0; 2227 } 2228 /* -----------------16.11.98 14:20------------------- 2229 * 2230 * --------------------------------------------------*/ 2231 IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField) 2232 { 2233 sal_uInt16 nRelSize = (sal_uInt16)pField->GetValue(); 2234 2235 sal_uInt16 nMask = 1; 2236 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2237 { 2238 if(nActNumLvl & nMask) 2239 { 2240 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2241 aNumFmt.SetBulletRelSize(nRelSize); 2242 pActNum->SetLevel(i, aNumFmt); 2243 } 2244 nMask <<= 1; 2245 } 2246 SetModified(); 2247 return 0; 2248 } 2249 2250 /*-----------------02.12.97 10:50------------------- 2251 2252 --------------------------------------------------*/ 2253 IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton ) 2254 { 2255 sal_uInt16 nItemId = pButton->GetCurItemId(); 2256 String aGrfName; 2257 Size aSize; 2258 sal_Bool bSucc(sal_False); 2259 SvxOpenGraphicDialog aGrfDlg( CUI_RES(RID_STR_EDIT_GRAPHIC) ); 2260 2261 if(MN_GALLERY_ENTRY <= nItemId ) 2262 { 2263 aGrfName = *((String*)aGrfNames.GetObject( nItemId - MN_GALLERY_ENTRY)); 2264 Graphic aGraphic; 2265 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - MN_GALLERY_ENTRY, &aGraphic)) 2266 { 2267 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 2268 bSucc = sal_True; 2269 } 2270 } 2271 else 2272 { 2273 aGrfDlg.EnableLink( sal_False ); 2274 aGrfDlg.AsLink( sal_False ); 2275 if ( !aGrfDlg.Execute() ) 2276 { 2277 // ausgewaehlten Filter merken 2278 aGrfName = aGrfDlg.GetPath(); 2279 2280 Graphic aGraphic; 2281 if( !aGrfDlg.GetGraphic(aGraphic) ) 2282 { 2283 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 2284 bSucc = sal_True; 2285 } 2286 } 2287 } 2288 if(bSucc) 2289 { 2290 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit); 2291 2292 sal_uInt16 nMask = 1; 2293 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2294 { 2295 if(nActNumLvl & nMask) 2296 { 2297 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2298 aNumFmt.SetCharFmtName(sNumCharFmtName); 2299 aNumFmt.SetGraphic(aGrfName); 2300 2301 // Size schon mal fuer spaeteren Groessenabgleich setzen 2302 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); 2303 // initiate asynchronous loading 2304 sal_Int16 eOrient = aNumFmt.GetVertOrient(); 2305 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); 2306 aInitSize[i] = aNumFmt.GetGraphicSize(); 2307 2308 pActNum->SetLevel(i, aNumFmt); 2309 } 2310 nMask <<= 1; 2311 } 2312 aRatioCB .Enable(); 2313 aSizeFT .Enable(); 2314 aMultFT.Enable(); 2315 aWidthMF .Enable(); 2316 aHeightMF.Enable(); 2317 SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit); 2318 SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit); 2319 aOrientFT.Enable(); 2320 aOrientLB.Enable(); 2321 SetModified(); 2322 //needed due to asynchronous loading of graphics in the SvxBrushItem 2323 aInvalidateTimer.Start(); 2324 } 2325 return 0; 2326 } 2327 /* -----------------27.07.99 12:20------------------- 2328 2329 --------------------------------------------------*/ 2330 IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG ) 2331 { 2332 if(!bMenuButtonInitialized) 2333 { 2334 bMenuButtonInitialized = sal_True; 2335 EnterWait(); 2336 PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); 2337 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 2338 if(aGrfNames.Count()) 2339 { 2340 pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC )); 2341 String aEmptyStr; 2342 GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS); 2343 2344 for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) 2345 { 2346 Graphic aGraphic; 2347 String sGrfName = *(const String*)aGrfNames.GetObject(i); 2348 INetURLObject aObj(sGrfName); 2349 if(aObj.GetProtocol() == INET_PROT_FILE) 2350 sGrfName = aObj.PathToFileName(); 2351 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic)) 2352 { 2353 Bitmap aBitmap(aGraphic.GetBitmap()); 2354 Size aSize(aBitmap.GetSizePixel()); 2355 if(aSize.Width() > MAX_BMP_WIDTH || 2356 aSize.Height() > MAX_BMP_HEIGHT) 2357 { 2358 sal_Bool bWidth = aSize.Width() > aSize.Height(); 2359 double nScale = bWidth ? 2360 (double)MAX_BMP_WIDTH / (double)aSize.Width(): 2361 (double)MAX_BMP_HEIGHT / (double)aSize.Height(); 2362 aBitmap.Scale(nScale, nScale); 2363 } 2364 Image aImage(aBitmap); 2365 2366 pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage ); 2367 } 2368 else 2369 { 2370 Image aImage; 2371 pPopup->InsertItem( 2372 MN_GALLERY_ENTRY + i, sGrfName, aImage ); 2373 } 2374 } 2375 GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS); 2376 } 2377 LeaveWait(); 2378 } 2379 return 0; 2380 } 2381 2382 /*-----------------02.12.97 10:58------------------- 2383 2384 --------------------------------------------------*/ 2385 IMPL_LINK( SvxNumOptionsTabPage, BulletHdl_Impl, Button *, EMPTYARG ) 2386 { 2387 SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True ); 2388 2389 sal_uInt16 nMask = 1; 2390 const Font* pFmtFont = 0; 2391 sal_Bool bSameBullet = sal_True; 2392 sal_Unicode cBullet = 0; 2393 sal_Bool bFirst = sal_True; 2394 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2395 { 2396 if(nActNumLvl & nMask) 2397 { 2398 const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i); 2399 if(bFirst) 2400 { 2401 cBullet = rCurFmt.GetBulletChar(); 2402 } 2403 else if(rCurFmt.GetBulletChar() != cBullet ) 2404 { 2405 bSameBullet = sal_False; 2406 break; 2407 } 2408 if(!pFmtFont) 2409 pFmtFont = rCurFmt.GetBulletFont(); 2410 bFirst = sal_False; 2411 } 2412 nMask <<= 1; 2413 2414 } 2415 2416 if(pFmtFont) 2417 pMap->SetCharFont(*pFmtFont); 2418 else 2419 pMap->SetCharFont(aActBulletFont); 2420 if(bSameBullet) 2421 pMap->SetChar( cBullet ); 2422 if(pMap->Execute() == RET_OK) 2423 { 2424 // Font Numrules umstellen 2425 aActBulletFont = pMap->GetCharFont(); 2426 2427 sal_uInt16 _nMask = 1; 2428 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2429 { 2430 if(nActNumLvl & _nMask) 2431 { 2432 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2433 aNumFmt.SetBulletFont(&aActBulletFont); ; 2434 aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() ); 2435 pActNum->SetLevel(i, aNumFmt); 2436 } 2437 _nMask <<= 1; 2438 } 2439 2440 SetModified(); 2441 } 2442 delete pMap; 2443 return 0; 2444 } 2445 2446 /*-----------------03.03.97 15:21------------------- 2447 2448 --------------------------------------------------*/ 2449 2450 IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField) 2451 { 2452 sal_Bool bWidth = pField == &aWidthMF; 2453 bLastWidthModified = bWidth; 2454 sal_Bool bRatio = aRatioCB.IsChecked(); 2455 long nWidthVal = static_cast<long>(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM))); 2456 long nHeightVal = static_cast<long>(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM))); 2457 nWidthVal = OutputDevice::LogicToLogic( nWidthVal , 2458 MAP_100TH_MM, (MapUnit)eCoreUnit ); 2459 nHeightVal = OutputDevice::LogicToLogic( nHeightVal, 2460 MAP_100TH_MM, (MapUnit)eCoreUnit); 2461 double fSizeRatio; 2462 2463 sal_Bool bRepaint = sal_False; 2464 sal_uInt16 nMask = 1; 2465 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2466 { 2467 if(nActNumLvl & nMask) 2468 { 2469 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2470 if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) 2471 { 2472 Size aSize(aNumFmt.GetGraphicSize() ); 2473 Size aSaveSize(aSize); 2474 2475 if (aInitSize[i].Height()) 2476 fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height(); 2477 else 2478 fSizeRatio = (double)1; 2479 2480 if(bWidth) 2481 { 2482 long nDelta = nWidthVal - aInitSize[i].Width(); 2483 aSize.Width() = nWidthVal; 2484 if (bRatio) 2485 { 2486 aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio); 2487 aHeightMF.SetUserValue(aHeightMF.Normalize( 2488 OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )), 2489 FUNIT_100TH_MM); 2490 } 2491 } 2492 else 2493 { 2494 long nDelta = nHeightVal - aInitSize[i].Height(); 2495 aSize.Height() = nHeightVal; 2496 if (bRatio) 2497 { 2498 aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio); 2499 aWidthMF.SetUserValue(aWidthMF.Normalize( 2500 OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )), 2501 FUNIT_100TH_MM); 2502 } 2503 } 2504 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); 2505 sal_Int16 eOrient = aNumFmt.GetVertOrient(); 2506 if(aSize != aSaveSize) 2507 bRepaint = sal_True; 2508 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); 2509 pActNum->SetLevel(i, aNumFmt); 2510 } 2511 } 2512 nMask <<= 1; 2513 } 2514 SetModified(bRepaint); 2515 return 0; 2516 } 2517 2518 /*------------------------------------------------------------------------ 2519 Beschreibung: 2520 ------------------------------------------------------------------------*/ 2521 2522 IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox ) 2523 { 2524 if (pBox->IsChecked()) 2525 { 2526 if (bLastWidthModified) 2527 SizeHdl_Impl(&aWidthMF); 2528 else 2529 SizeHdl_Impl(&aHeightMF); 2530 } 2531 return 0; 2532 } 2533 2534 /*-----------------02.12.97 16:07------------------- 2535 2536 --------------------------------------------------*/ 2537 IMPL_LINK( SvxNumOptionsTabPage, CharFmtHdl_Impl, ListBox *, EMPTYARG ) 2538 { 2539 bAutomaticCharStyles = sal_False; 2540 sal_uInt16 nEntryPos = aCharFmtLB.GetSelectEntryPos(); 2541 String sEntry = aCharFmtLB.GetSelectEntry(); 2542 sal_uInt16 nMask = 1; 2543 String aEmptyStr; 2544 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2545 { 2546 if(nActNumLvl & nMask) 2547 { 2548 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2549 if( 0 == nEntryPos ) 2550 aNumFmt.SetCharFmtName(aEmptyStr); 2551 else 2552 { 2553 if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) 2554 aNumFmt.SetCharFmtName(sEntry); 2555 } 2556 pActNum->SetLevel(i, aNumFmt); 2557 } 2558 nMask <<= 1; 2559 } 2560 SetModified(sal_False); 2561 return 0; 2562 2563 }; 2564 2565 /*-----------------03.12.97 11:01------------------- 2566 2567 --------------------------------------------------*/ 2568 IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit ) 2569 { 2570 sal_Bool bPrefix = pEdit == &aPrefixED; 2571 sal_Bool bSuffix = pEdit == &aSuffixED; 2572 sal_Bool bStart = pEdit == &aStartED; 2573 sal_uInt16 nMask = 1; 2574 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 2575 { 2576 if(nActNumLvl & nMask) 2577 { 2578 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 2579 if(bPrefix) 2580 aNumFmt.SetPrefix( aPrefixED.GetText() ); 2581 else if(bSuffix) 2582 aNumFmt.SetSuffix( aSuffixED.GetText() ); 2583 else if(bStart) 2584 aNumFmt.SetStart( (sal_uInt16)aStartED.GetValue() ); 2585 else //align 2586 { 2587 sal_uInt16 nPos = aAlignLB.GetSelectEntryPos(); 2588 SvxAdjust eAdjust = SVX_ADJUST_CENTER; 2589 if(nPos == 0) 2590 eAdjust = SVX_ADJUST_LEFT; 2591 else if(nPos == 2) 2592 eAdjust = SVX_ADJUST_RIGHT; 2593 aNumFmt.SetNumAdjust( eAdjust ); 2594 } 2595 pActNum->SetLevel(i, aNumFmt); 2596 } 2597 nMask <<= 1; 2598 } 2599 SetModified(); 2600 2601 return 0; 2602 } 2603 2604 /*-----------------09.12.97 11:49------------------- 2605 2606 --------------------------------------------------*/ 2607 sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, sal_uInt16 nXStart, 2608 sal_uInt16 nYStart, sal_uInt16 nDivision) 2609 { 2610 const SvxBrushItem* pBrushItem = rFmt.GetBrush(); 2611 sal_uInt16 nRet = 0; 2612 if(pBrushItem) 2613 { 2614 const Graphic* pGrf = pBrushItem->GetGraphic(); 2615 if(pGrf) 2616 { 2617 Size aGSize( rFmt.GetGraphicSize() ); 2618 aGSize.Width() /= nDivision; 2619 nRet = (sal_uInt16)aGSize.Width(); 2620 aGSize.Height() /= nDivision; 2621 pGrf->Draw( pVDev, Point(nXStart,nYStart), 2622 pVDev->PixelToLogic( aGSize ) ); 2623 } 2624 } 2625 return nRet; 2626 2627 } 2628 2629 /*-----------------09.12.97 11:54------------------- 2630 2631 --------------------------------------------------*/ 2632 sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev, 2633 const SvxNumberFormat& rFmt, sal_uInt16 nXStart, 2634 sal_uInt16 nYStart, const Size& rSize) 2635 { 2636 Font aTmpFont(pVDev->GetFont()); 2637 2638 //per Uno kann es sein, dass kein Font gesetzt ist! 2639 Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont); 2640 Size aTmpSize(rSize); 2641 aTmpSize.Width() *= rFmt.GetBulletRelSize(); 2642 aTmpSize.Width() /= 100 ; 2643 aTmpSize.Height() *= rFmt.GetBulletRelSize(); 2644 aTmpSize.Height() /= 100 ; 2645 // bei einer Hoehe von Null wird in Ursprungshoehe gezeichnet 2646 if(!aTmpSize.Height()) 2647 aTmpSize.Height() = 1; 2648 aFont.SetSize(aTmpSize); 2649 aFont.SetTransparent(sal_True); 2650 Color aBulletColor = rFmt.GetBulletColor(); 2651 if(aBulletColor.GetColor() == COL_AUTO) 2652 aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK); 2653 else if(aBulletColor == pVDev->GetFillColor()) 2654 aBulletColor.Invert(); 2655 aFont.SetColor(aBulletColor); 2656 pVDev->SetFont( aFont ); 2657 String aText(sal_Unicode(rFmt.GetBulletChar())); 2658 long nY = nYStart; 2659 nY -= ((aTmpSize.Height() - rSize.Height())/ 2); 2660 pVDev->DrawText( Point(nXStart, nY), aText ); 2661 sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText); 2662 2663 pVDev->SetFont(aTmpFont); 2664 return nRet; 2665 } 2666 /*-----------------02.12.97 10:34------------------- 2667 Vorschau der Numerierung painten 2668 --------------------------------------------------*/ 2669 void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ ) 2670 { 2671 Size aSize(PixelToLogic(GetOutputSizePixel())); 2672 Rectangle aRect(Point(0,0), aSize); 2673 2674 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 2675 const Color aBackColor = rStyleSettings.GetFieldColor(); 2676 const Color aTextColor = rStyleSettings.GetFieldTextColor(); 2677 2678 VirtualDevice* pVDev = new VirtualDevice(*this); 2679 pVDev->EnableRTL( IsRTLEnabled() ); 2680 pVDev->SetMapMode(GetMapMode()); 2681 pVDev->SetOutputSize( aSize ); 2682 2683 Color aLineColor(COL_LIGHTGRAY); 2684 if(aLineColor == aBackColor) 2685 aLineColor.Invert(); 2686 pVDev->SetLineColor(aLineColor); 2687 pVDev->SetFillColor( aBackColor ); 2688 pVDev->DrawRect(aRect); 2689 2690 if(pActNum) 2691 { 2692 sal_uInt16 nWidthRelation; 2693 if(nPageWidth) 2694 { 2695 nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width()); 2696 if(bPosition) 2697 nWidthRelation = nWidthRelation * 2 / 3; 2698 else 2699 nWidthRelation = nWidthRelation / 4; 2700 } 2701 else 2702 nWidthRelation = 30; // Kapiteldialog 2703 2704 //Hoehe pro Ebene 2705 sal_uInt16 nXStep = sal::static_int_cast< sal_uInt16 >(aSize.Width() / (3 * pActNum->GetLevelCount())); 2706 if(pActNum->GetLevelCount() < 10) 2707 nXStep /= 2; 2708 sal_uInt16 nYStart = 4; 2709 // fuer ein einziges Level darf nicht die gesamte Hoehe benutzt werden 2710 sal_uInt16 nYStep = sal::static_int_cast< sal_uInt16 >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5)); 2711 aStdFont = OutputDevice::GetDefaultFont( 2712 DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE); 2713 aStdFont.SetColor(aTextColor); 2714 aStdFont.SetFillColor(aBackColor); 2715 2716 // 2717 sal_uInt16 nFontHeight = nYStep * 6 / 10; 2718 if(bPosition) 2719 nFontHeight = nYStep * 15 / 10; 2720 aStdFont.SetSize(Size( 0, nFontHeight )); 2721 2722 SvxNodeNum aNum( (sal_uInt8)0 ); 2723 sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart(); 2724 2725 if(bPosition) 2726 { 2727 sal_uInt16 nLineHeight = nFontHeight * 8 / 7; 2728 sal_uInt8 nStart = 0; 2729 while( !(nActLevel & (1<<nStart)) ) 2730 { 2731 nStart++; 2732 } 2733 if(nStart) 2734 nStart--; 2735 sal_uInt8 nEnd = std::min( (sal_uInt8)(nStart + 3), (sal_uInt8)pActNum->GetLevelCount() ); 2736 for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel ) 2737 { 2738 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); 2739 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); 2740 2741 // --> OD 2008-01-16 #newlistlevelattrs# 2742 sal_uInt16 nXStart( 0 ); 2743 short nTextOffset( 0 ); 2744 sal_uInt16 nNumberXPos( 0 ); 2745 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 2746 { 2747 nXStart = rFmt.GetAbsLSpace() / nWidthRelation; 2748 nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation; 2749 nNumberXPos = nXStart; 2750 sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation; 2751 2752 if(nFirstLineOffset <= nNumberXPos) 2753 nNumberXPos = nNumberXPos - nFirstLineOffset; 2754 else 2755 nNumberXPos = 0; 2756 //im draw ist das zulaeesig 2757 if(nTextOffset < 0) 2758 nNumberXPos = nNumberXPos + nTextOffset; 2759 } 2760 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 2761 { 2762 const long nTmpNumberXPos( ( rFmt.GetIndentAt() + 2763 rFmt.GetFirstLineIndent() ) / 2764 nWidthRelation ); 2765 if ( nTmpNumberXPos < 0 ) 2766 { 2767 nNumberXPos = 0; 2768 } 2769 else 2770 { 2771 nNumberXPos = static_cast<sal_uInt16>( nTmpNumberXPos ); 2772 } 2773 } 2774 // <-- 2775 2776 sal_uInt16 nBulletWidth = 0; 2777 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN))) 2778 { 2779 nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt, 2780 nNumberXPos, 2781 nYStart, nWidthRelation) : 0; 2782 } 2783 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) 2784 { 2785 nBulletWidth = rFmt.IsShowSymbol() ? 2786 lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0; 2787 } 2788 else 2789 { 2790 pVDev->SetFont(aStdFont); 2791 aNum.SetLevel( nLevel ); 2792 if(pActNum->IsContinuousNumbering()) 2793 aNum.GetLevelVal()[nLevel] = nPreNum; 2794 String aText(pActNum->MakeNumString( aNum )); 2795 Font aSaveFont = pVDev->GetFont(); 2796 Font aColorFont(aSaveFont); 2797 Color aTmpBulletColor = rFmt.GetBulletColor(); 2798 if(aTmpBulletColor.GetColor() == COL_AUTO) 2799 aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); 2800 else if(aTmpBulletColor == aBackColor) 2801 aTmpBulletColor.Invert(); 2802 aColorFont.SetColor(aTmpBulletColor); 2803 pVDev->SetFont(aColorFont); 2804 pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); 2805 pVDev->SetFont(aSaveFont); 2806 nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText); 2807 nPreNum++; 2808 } 2809 // --> OD 2008-01-16 #newlistlevelattrs# 2810 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT && 2811 rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE ) 2812 { 2813 pVDev->SetFont(aStdFont); 2814 String aText(' '); 2815 pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); 2816 nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText); 2817 } 2818 2819 // --> OD 2008-01-16 #newlistlevelattrs# 2820 sal_uInt16 nTextXPos( 0 ); 2821 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 2822 { 2823 nTextXPos = nXStart; 2824 if(nTextOffset < 0) 2825 nTextXPos = nTextXPos + nTextOffset; 2826 if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos ) 2827 nTextXPos = nNumberXPos + nBulletWidth + nTextOffset; 2828 } 2829 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 2830 { 2831 switch ( rFmt.GetLabelFollowedBy() ) 2832 { 2833 case SvxNumberFormat::LISTTAB: 2834 { 2835 nTextXPos = static_cast<sal_uInt16>( 2836 rFmt.GetListtabPos() / nWidthRelation ); 2837 if ( nTextXPos < nNumberXPos + nBulletWidth ) 2838 { 2839 nTextXPos = nNumberXPos + nBulletWidth; 2840 } 2841 } 2842 break; 2843 case SvxNumberFormat::SPACE: 2844 case SvxNumberFormat::NOTHING: 2845 { 2846 nTextXPos = nNumberXPos + nBulletWidth; 2847 } 2848 break; 2849 } 2850 2851 nXStart = static_cast<sal_uInt16>( rFmt.GetIndentAt() / nWidthRelation ); 2852 } 2853 // <-- 2854 2855 Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2)); 2856 pVDev->SetFillColor( aBackColor ); 2857 pVDev->DrawRect( aRect1 ); 2858 2859 Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2)); 2860 pVDev->DrawRect( aRect2 ); 2861 nYStart += 2 * nLineHeight; 2862 } 2863 } 2864 else 2865 { 2866 //#i5153# painting gray or black rectangles as 'normal' numbering text 2867 String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") ); 2868 long nWidth = pVDev->GetTextWidth(sMsg); 2869 long nTextHeight = pVDev->GetTextHeight(); 2870 long nRectHeight = nTextHeight * 2 / 3; 2871 long nTopOffset = nTextHeight - nRectHeight; 2872 Color aBlackColor(COL_BLACK); 2873 if(aBlackColor == aBackColor) 2874 aBlackColor.Invert(); 2875 2876 for( sal_uInt8 nLevel = 0; nLevel < pActNum->GetLevelCount(); 2877 ++nLevel, nYStart = nYStart + nYStep ) 2878 { 2879 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); 2880 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); 2881 // --> OD 2008-01-31 #newlistlevelattrs# 2882 sal_uInt16 nXStart( 0 ); 2883 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 2884 { 2885 nXStart = rFmt.GetAbsLSpace() / nWidthRelation; 2886 } 2887 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 2888 { 2889 const long nTmpXStart( ( rFmt.GetIndentAt() + 2890 rFmt.GetFirstLineIndent() ) / 2891 nWidthRelation ); 2892 if ( nTmpXStart < 0 ) 2893 { 2894 nXStart = 0; 2895 } 2896 else 2897 { 2898 nXStart = static_cast<sal_uInt16>(nTmpXStart); 2899 } 2900 } 2901 nXStart /= 2; 2902 nXStart += 2; 2903 // <-- 2904 sal_uInt16 nTextOffset = 2 * nXStep; 2905 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) ) 2906 { 2907 if(rFmt.IsShowSymbol()) 2908 { 2909 nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation); 2910 nTextOffset = nTextOffset + nXStep; 2911 } 2912 } 2913 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) 2914 { 2915 if(rFmt.IsShowSymbol()) 2916 { 2917 nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize()); 2918 nTextOffset = nTextOffset + nXStep; 2919 } 2920 } 2921 else 2922 { 2923 Font aColorFont(aStdFont); 2924 Color aTmpBulletColor = rFmt.GetBulletColor(); 2925 if(aTmpBulletColor.GetColor() == COL_AUTO) 2926 aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); 2927 else if(aTmpBulletColor == aBackColor) 2928 aTmpBulletColor.Invert(); 2929 aColorFont.SetColor(aTmpBulletColor); 2930 pVDev->SetFont(aColorFont); 2931 aNum.SetLevel( nLevel ); 2932 if(pActNum->IsContinuousNumbering()) 2933 aNum.GetLevelVal()[nLevel] = nPreNum; 2934 String aText(pActNum->MakeNumString( aNum )); 2935 pVDev->DrawText( Point(nXStart, nYStart), aText ); 2936 pVDev->SetFont(aStdFont); 2937 nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText); 2938 nTextOffset = nTextOffset + nXStep; 2939 nPreNum++; 2940 } 2941 if(pOutlineNames) 2942 { 2943 //#i5153# outline numberings still use the style names as text 2944 pVDev->SetFont(aStdFont); 2945 sMsg = pOutlineNames[nLevel]; 2946 pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg ); 2947 } 2948 else 2949 { 2950 //#i5153# the selected rectangle(s) should be black 2951 if( 0 != (nActLevel & (1<<nLevel))) 2952 { 2953 pVDev->SetFillColor( aBlackColor ); 2954 pVDev->SetLineColor( aBlackColor ); 2955 } 2956 else 2957 { 2958 //#i5153# unselected levels are gray 2959 pVDev->SetFillColor( aLineColor ); 2960 pVDev->SetLineColor( aLineColor ); 2961 } 2962 Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight)); 2963 pVDev->DrawRect(aRect1); 2964 } 2965 } 2966 } 2967 } 2968 DrawOutDev( Point(0,0), aSize, 2969 Point(0,0), aSize, 2970 *pVDev ); 2971 delete pVDev; 2972 2973 } 2974 2975 /*-----------------03.12.97 10:02------------------- 2976 2977 --------------------------------------------------*/ 2978 SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent, 2979 const SfxItemSet& rSet) : 2980 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUM_POSITION ), rSet ), 2981 aPositionFL( this, CUI_RES(FL_POSITION )), 2982 aLevelFT( this, CUI_RES(FT_LEVEL )), 2983 aLevelLB( this, CUI_RES(LB_LEVEL )), 2984 aDistBorderFT( this, CUI_RES(FT_BORDERDIST )), 2985 aDistBorderMF( this, CUI_RES(MF_BORDERDIST )), 2986 aRelativeCB( this, CUI_RES(CB_RELATIVE )), 2987 aIndentFT( this, CUI_RES(FT_INDENT )), 2988 aIndentMF( this, CUI_RES(MF_INDENT )), 2989 aDistNumFT( this, CUI_RES(FT_NUMDIST )), 2990 aDistNumMF( this, CUI_RES(MF_NUMDIST )), 2991 aAlignFT( this, CUI_RES(FT_ALIGN )), 2992 aAlignLB( this, CUI_RES(LB_ALIGN )), 2993 // --> OD 2008-01-10 #newlistlevelattrs# 2994 aLabelFollowedByFT( this, CUI_RES(FT_LABEL_FOLLOWED_BY) ), 2995 aLabelFollowedByLB( this, CUI_RES(LB_LABEL_FOLLOWED_BY) ), 2996 aListtabFT( this, CUI_RES(FT_LISTTAB) ), 2997 aListtabMF( this, CUI_RES(MF_LISTTAB) ), 2998 aAlign2FT( this, CUI_RES(FT_ALIGN_2) ), 2999 aAlign2LB( this, CUI_RES(LB_ALIGN_2) ), 3000 aAlignedAtFT( this, CUI_RES(FT_ALIGNED_AT) ), 3001 aAlignedAtMF( this, CUI_RES(MF_ALIGNED_AT) ), 3002 aIndentAtFT( this, CUI_RES(FT_INDENT_AT) ), 3003 aIndentAtMF( this, CUI_RES(MF_INDENT_AT) ), 3004 // <-- 3005 aStandardPB( this, CUI_RES(PB_STANDARD )), 3006 pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))), 3007 pActNum(0), 3008 pSaveNum(0), 3009 nActNumLvl( USHRT_MAX ), 3010 nNumItemId(SID_ATTR_NUMBERING_RULE), 3011 bModified(false), 3012 bPreset(false), 3013 bInInintControl(sal_False), 3014 // --> OD 2008-01-11 #newlistlevelattrs# 3015 bLabelAlignmentPosAndSpaceModeActive( false ) 3016 // <-- 3017 { 3018 FreeResource(); 3019 SetExchangeSupport(); 3020 pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); 3021 3022 aRelativeCB.Check(); 3023 aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); 3024 // --> OD 2008-01-10 #newlistlevelattrs# 3025 aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); 3026 for ( sal_uInt16 i = 0; i < aAlignLB.GetEntryCount(); ++i ) 3027 { 3028 aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) ); 3029 } 3030 aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() ); 3031 aAlign2FT.SetText( aAlignFT.GetText() ); 3032 // <-- 3033 3034 Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl); 3035 3036 aDistBorderMF.SetUpHdl(aLk); 3037 aDistBorderMF.SetDownHdl(aLk); 3038 aDistBorderMF.SetLoseFocusHdl(aLk); 3039 3040 aDistNumMF.SetUpHdl(aLk); 3041 aDistNumMF.SetDownHdl(aLk); 3042 aDistNumMF.SetLoseFocusHdl(aLk); 3043 3044 aIndentMF.SetUpHdl(aLk); 3045 aIndentMF.SetDownHdl(aLk); 3046 aIndentMF.SetLoseFocusHdl(aLk); 3047 3048 // --> OD 2008-01-10 #newlistlevelattrs# 3049 aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() ); 3050 aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) ); 3051 3052 aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl); 3053 aListtabMF.SetUpHdl(aLk); 3054 aListtabMF.SetDownHdl(aLk); 3055 aListtabMF.SetLoseFocusHdl(aLk); 3056 3057 aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl); 3058 aAlignedAtMF.SetUpHdl(aLk); 3059 aAlignedAtMF.SetDownHdl(aLk); 3060 aAlignedAtMF.SetLoseFocusHdl(aLk); 3061 3062 aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl); 3063 aIndentAtMF.SetUpHdl(aLk); 3064 aIndentAtMF.SetDownHdl(aLk); 3065 aIndentAtMF.SetLoseFocusHdl(aLk); 3066 // <-- 3067 3068 aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl)); 3069 aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl)); 3070 aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl)); 3071 3072 3073 aRelativeCB.Check(bLastRelative); 3074 pPreviewWIN->SetPositionMode(); 3075 eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); 3076 3077 //HACK("der Wert sollte mal sinnvol gesetzt werden") 3078 long nWidth = 10000; 3079 nWidth = OutputDevice::LogicToLogic( nWidth, 3080 (MapUnit)eCoreUnit, MAP_100TH_MM ); 3081 3082 aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_100TH_MM ); 3083 aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_100TH_MM ); 3084 aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_100TH_MM ); 3085 // --> OD 2008-02-18 #newlistlevelattrs# 3086 aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_100TH_MM ); 3087 aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_100TH_MM ); 3088 aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_100TH_MM ); 3089 // <-- 3090 long nLast2 = nWidth /2; 3091 aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_100TH_MM ); 3092 aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_100TH_MM ); 3093 aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_100TH_MM ); 3094 // --> OD 2008-02-18 #newlistlevelattrs# 3095 aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_100TH_MM ); 3096 aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_100TH_MM ); 3097 aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_100TH_MM ); 3098 // <-- 3099 3100 #if OSL_DEBUG_LEVEL > 1 3101 pDebugFixedText = new FixedText(this, 0); 3102 pDebugFixedText->Show(); 3103 Size aSize(200, 20); 3104 Point aPos(250,0); 3105 3106 pDebugFixedText->SetPosSizePixel(aPos, aSize); 3107 pDebugFixedText->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Das ist ein Debug-Text" ) ) ); 3108 #endif 3109 3110 aStandardPB.SetAccessibleRelationMemberOf(&aPositionFL); 3111 } 3112 /*-----------------03.12.97 10:02------------------- 3113 3114 --------------------------------------------------*/ 3115 SvxNumPositionTabPage::~SvxNumPositionTabPage() 3116 { 3117 delete pActNum; 3118 delete pPreviewWIN; 3119 delete pSaveNum; 3120 #if OSL_DEBUG_LEVEL > 1 3121 delete pDebugFixedText; 3122 #endif 3123 } 3124 /*-------------------------------------------------------*/ 3125 3126 #if OSL_DEBUG_LEVEL > 1 3127 void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt) 3128 { 3129 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 3130 3131 sal_Char const sHash[] = " # "; 3132 if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 3133 { 3134 String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) ); 3135 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); 3136 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) ); 3137 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); 3138 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) ); 3139 rFixed.SetText(sDebugText); 3140 } 3141 else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 3142 { 3143 String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) ); 3144 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); 3145 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) ); 3146 sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); 3147 sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) ); 3148 rFixed.SetText(sDebugText); 3149 } 3150 3151 } 3152 #endif 3153 3154 /*-----------------03.12.97 10:06------------------- 3155 3156 --------------------------------------------------*/ 3157 void SvxNumPositionTabPage::InitControls() 3158 { 3159 bInInintControl = sal_True; 3160 // --> OD 2008-01-11 #newlistlevelattrs# 3161 const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && 3162 aRelativeCB.IsEnabled() && aRelativeCB.IsChecked(); 3163 // <-- 3164 const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && 3165 USHRT_MAX != nActNumLvl; 3166 3167 aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive && 3168 ( bSingleSelection || bRelative ) ); 3169 aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive && 3170 ( bSingleSelection || bRelative ) ); 3171 3172 bool bSetDistEmpty = false; 3173 bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; 3174 bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive; 3175 bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive; 3176 bool bSameAdjust = true; 3177 3178 // --> OD 2008-01-11 #newlistlevelattrs# 3179 bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive; 3180 bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive; 3181 bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive; 3182 bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive; 3183 // <-- 3184 3185 const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; 3186 sal_uInt16 nMask = 1; 3187 sal_uInt16 nLvl = USHRT_MAX; 3188 long nFirstBorderText = 0; 3189 long nFirstBorderTextRelative = -1; 3190 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3191 { 3192 aNumFmtArr[i] = &pActNum->GetLevel(i); 3193 if(nActNumLvl & nMask) 3194 { 3195 if(USHRT_MAX == nLvl) 3196 { 3197 nLvl = i; 3198 if ( !bLabelAlignmentPosAndSpaceModeActive ) 3199 { 3200 nFirstBorderText = nLvl > 0 ? 3201 aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset() - 3202 aNumFmtArr[nLvl - 1]->GetAbsLSpace() + aNumFmtArr[nLvl - 1]->GetFirstLineOffset(): 3203 aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset(); 3204 } 3205 } 3206 3207 if( i > nLvl) 3208 { 3209 // --> OD 2008-01-11 #newlistlevelattrs# 3210 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); 3211 if ( !bLabelAlignmentPosAndSpaceModeActive ) 3212 { 3213 if(bRelative) 3214 { 3215 if(nFirstBorderTextRelative == -1) 3216 nFirstBorderTextRelative = 3217 (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - 3218 aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); 3219 else 3220 bSameDistBorderNum &= nFirstBorderTextRelative == 3221 (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - 3222 aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); 3223 } 3224 else 3225 bSameDistBorderNum &= 3226 aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() == 3227 aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset(); 3228 3229 bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance(); 3230 bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset(); 3231 } 3232 else 3233 { 3234 bSameLabelFollowedBy &= 3235 aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy(); 3236 bSameListtab &= 3237 aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos(); 3238 bSameAlignAt &= 3239 ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() ) 3240 == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) ); 3241 bSameIndentAt &= 3242 aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt(); 3243 } 3244 // <-- 3245 } 3246 } 3247 nMask <<= 1; 3248 3249 } 3250 if(bSameDistBorderNum) 3251 { 3252 long nDistBorderNum; 3253 if(bRelative) 3254 { 3255 nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); 3256 if(nLvl) 3257 nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); 3258 } 3259 else 3260 { 3261 nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); 3262 } 3263 SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit); 3264 } 3265 else 3266 bSetDistEmpty = true; 3267 3268 #if OSL_DEBUG_LEVEL > 1 3269 lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]); 3270 #endif 3271 3272 const String aEmptyStr; 3273 if(bSameDist) 3274 SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit); 3275 else 3276 aDistNumMF.SetText(aEmptyStr); 3277 if(bSameIndent) 3278 SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit); 3279 else 3280 aIndentMF.SetText(aEmptyStr); 3281 3282 if(bSameAdjust) 3283 { 3284 sal_uInt16 nPos = 1; // zentriert 3285 if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) 3286 nPos = 0; 3287 else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) 3288 nPos = 2; 3289 aAlignLB.SelectEntryPos(nPos); 3290 // --> OD 2008-01-11 #newlistlevelattrs# 3291 aAlign2LB.SelectEntryPos( nPos ); 3292 // <-- 3293 } 3294 else 3295 { 3296 aAlignLB.SetNoSelection(); 3297 // --> OD 2008-01-11 #newlistlevelattrs# 3298 aAlign2LB.SetNoSelection(); 3299 // <-- 3300 } 3301 3302 // --> OD 2008-01-11 #newlistlevelattrs# 3303 if ( bSameLabelFollowedBy ) 3304 { 3305 sal_uInt16 nPos = 0; // LISTTAB 3306 if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE ) 3307 { 3308 nPos = 1; 3309 } 3310 else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING ) 3311 { 3312 nPos = 2; 3313 } 3314 aLabelFollowedByLB.SelectEntryPos( nPos ); 3315 } 3316 else 3317 { 3318 aLabelFollowedByLB.SetNoSelection(); 3319 } 3320 3321 if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB ) 3322 { 3323 aListtabFT.Enable( true ); 3324 aListtabMF.Enable( true ); 3325 if ( bSameListtab ) 3326 { 3327 SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit ); 3328 } 3329 else 3330 { 3331 aListtabMF.SetText(aEmptyStr); 3332 } 3333 } 3334 else 3335 { 3336 aListtabFT.Enable( false ); 3337 aListtabMF.Enable( false ); 3338 aListtabMF.SetText(aEmptyStr); 3339 } 3340 3341 if ( bSameAlignAt ) 3342 { 3343 SetMetricValue( aAlignedAtMF, 3344 aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(), 3345 eCoreUnit ); 3346 } 3347 else 3348 { 3349 aAlignedAtMF.SetText(aEmptyStr); 3350 } 3351 3352 if ( bSameIndentAt ) 3353 { 3354 SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit ); 3355 } 3356 else 3357 { 3358 aIndentAtMF.SetText(aEmptyStr); 3359 } 3360 // <-- 3361 3362 if ( bSetDistEmpty ) 3363 aDistBorderMF.SetText(aEmptyStr); 3364 3365 bInInintControl = sal_False; 3366 } 3367 3368 /*-----------------03.12.97 10:02------------------- 3369 3370 --------------------------------------------------*/ 3371 void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet) 3372 { 3373 const SfxPoolItem* pItem; 3374 sal_uInt16 nTmpNumLvl = USHRT_MAX; 3375 const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); 3376 if(pExampleSet) 3377 { 3378 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) 3379 bPreset = ((const SfxBoolItem*)pItem)->GetValue(); 3380 if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) 3381 nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); 3382 } 3383 // 3384 if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) 3385 { 3386 delete pSaveNum; 3387 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 3388 } 3389 bModified = (!pActNum->Get( 0 ) || bPreset); 3390 if(*pSaveNum != *pActNum || 3391 nActNumLvl != nTmpNumLvl ) 3392 { 3393 *pActNum = *pSaveNum; 3394 nActNumLvl = nTmpNumLvl; 3395 sal_uInt16 nMask = 1; 3396 aLevelLB.SetUpdateMode(sal_False); 3397 aLevelLB.SetNoSelection(); 3398 aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); 3399 if(nActNumLvl != USHRT_MAX) 3400 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3401 { 3402 if(nActNumLvl & nMask) 3403 aLevelLB.SelectEntryPos( i, sal_True); 3404 nMask <<= 1 ; 3405 } 3406 aRelativeCB.Enable(nActNumLvl != 1); 3407 aLevelLB.SetUpdateMode(sal_True); 3408 3409 // --> OD 2008-01-11 #newlistlevelattrs# 3410 InitPosAndSpaceMode(); 3411 ShowControlsDependingOnPosAndSpaceMode(); 3412 // <-- 3413 3414 InitControls(); 3415 } 3416 pPreviewWIN->SetLevel(nActNumLvl); 3417 pPreviewWIN->Invalidate(); 3418 } 3419 3420 /*-----------------03.12.97 10:02------------------- 3421 3422 --------------------------------------------------*/ 3423 int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) 3424 { 3425 if(_pSet) 3426 FillItemSet(*_pSet); 3427 return sal_True; 3428 } 3429 3430 /*-----------------03.12.97 10:02------------------- 3431 3432 --------------------------------------------------*/ 3433 sal_Bool SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) 3434 { 3435 rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); 3436 3437 if(bModified && pActNum) 3438 { 3439 *pSaveNum = *pActNum; 3440 rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); 3441 rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False)); 3442 } 3443 return bModified; 3444 } 3445 3446 /*-----------------03.12.97 10:02------------------- 3447 3448 --------------------------------------------------*/ 3449 void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) 3450 { 3451 const SfxPoolItem* pItem; 3452 //im Draw gibt es das Item als WhichId, im Writer nur als SlotId 3453 SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 3454 if(eState != SFX_ITEM_SET) 3455 { 3456 nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); 3457 eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); 3458 3459 if( eState != SFX_ITEM_SET ) 3460 { 3461 pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); 3462 eState = SFX_ITEM_SET; 3463 } 3464 3465 } 3466 DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); 3467 delete pSaveNum; 3468 pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); 3469 3470 // Ebenen einfuegen 3471 if(!aLevelLB.GetEntryCount()) 3472 { 3473 for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++) 3474 aLevelLB.InsertEntry(UniString::CreateFromInt32(i)); 3475 if(pSaveNum->GetLevelCount() > 1) 3476 { 3477 String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - ") ) ); 3478 sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) ); 3479 aLevelLB.InsertEntry(sEntry); 3480 aLevelLB.SelectEntry(sEntry); 3481 } 3482 else 3483 aLevelLB.SelectEntryPos(0); 3484 } 3485 else 3486 aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); 3487 sal_uInt16 nMask = 1; 3488 aLevelLB.SetUpdateMode(sal_False); 3489 aLevelLB.SetNoSelection(); 3490 if(nActNumLvl == USHRT_MAX) 3491 { 3492 aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True); 3493 } 3494 else 3495 for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++) 3496 { 3497 if(nActNumLvl & nMask) 3498 aLevelLB.SelectEntryPos( i, sal_True); 3499 nMask <<= 1; 3500 } 3501 aLevelLB.SetUpdateMode(sal_True); 3502 3503 if(!pActNum) 3504 pActNum = new SvxNumRule(*pSaveNum); 3505 else if(*pSaveNum != *pActNum) 3506 *pActNum = *pSaveNum; 3507 pPreviewWIN->SetNumRule(pActNum); 3508 3509 // --> OD 2008-01-11 #newlistlevelattrs# 3510 InitPosAndSpaceMode(); 3511 ShowControlsDependingOnPosAndSpaceMode(); 3512 // const sal_Bool bDraw = pActNum->IsFeatureSupported(NUM_CONTINUOUS); 3513 // aDistNumFT.Show(bDraw); 3514 // aDistNumMF.Show(bDraw); 3515 // <-- 3516 3517 InitControls(); 3518 bModified = sal_False; 3519 } 3520 3521 // --> OD 2008-01-11 #newlistlevelattrs# 3522 void SvxNumPositionTabPage::InitPosAndSpaceMode() 3523 { 3524 if ( pActNum == 0 ) 3525 { 3526 DBG_ASSERT( false, 3527 "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" ); 3528 return; 3529 } 3530 3531 SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode = 3532 SvxNumberFormat::LABEL_ALIGNMENT; 3533 sal_uInt16 nMask = 1; 3534 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) 3535 { 3536 if(nActNumLvl & nMask) 3537 { 3538 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); 3539 ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode(); 3540 if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) 3541 { 3542 break; 3543 } 3544 } 3545 nMask <<= 1; 3546 } 3547 3548 bLabelAlignmentPosAndSpaceModeActive = 3549 ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT; 3550 } 3551 3552 void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() 3553 { 3554 aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3555 aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3556 aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3557 aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3558 aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3559 aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive && 3560 pActNum->IsFeatureSupported(NUM_CONTINUOUS) ); 3561 aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive && 3562 pActNum->IsFeatureSupported(NUM_CONTINUOUS)); 3563 aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3564 aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive ); 3565 3566 aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive ); 3567 aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive ); 3568 aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive ); 3569 aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive ); 3570 aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive ); 3571 aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive ); 3572 aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); 3573 aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); 3574 aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); 3575 aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); 3576 } 3577 // <-- 3578 3579 /*-----------------03.12.97 10:02------------------- 3580 3581 --------------------------------------------------*/ 3582 SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent, 3583 const SfxItemSet& rAttrSet) 3584 { 3585 return new SvxNumPositionTabPage(pParent, rAttrSet); 3586 } 3587 3588 /*-----------------04.12.97 12:51------------------- 3589 3590 --------------------------------------------------*/ 3591 void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric) 3592 { 3593 if(eMetric == FUNIT_MM) 3594 { 3595 aDistBorderMF .SetDecimalDigits(1); 3596 aDistNumMF .SetDecimalDigits(1); 3597 aIndentMF .SetDecimalDigits(1); 3598 // --> OD 2008-02-18 #newlistlevelattrs# 3599 aListtabMF.SetDecimalDigits(1); 3600 aAlignedAtMF.SetDecimalDigits(1); 3601 aIndentAtMF.SetDecimalDigits(1); 3602 // <-- 3603 } 3604 aDistBorderMF .SetUnit( eMetric ); 3605 aDistNumMF .SetUnit( eMetric ); 3606 aIndentMF .SetUnit( eMetric ); 3607 // --> OD 2008-02-18 #newlistlevelattrs# 3608 aListtabMF.SetUnit( eMetric ); 3609 aAlignedAtMF.SetUnit( eMetric ); 3610 aIndentAtMF.SetUnit( eMetric ); 3611 // <-- 3612 } 3613 3614 /*-----------------03.12.97 11:06------------------- 3615 3616 --------------------------------------------------*/ 3617 IMPL_LINK( SvxNumPositionTabPage, EditModifyHdl_Impl, Edit *, EMPTYARG ) 3618 { 3619 sal_uInt16 nMask = 1; 3620 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3621 { 3622 if(nActNumLvl & nMask) 3623 { 3624 SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); 3625 3626 // --> OD 2008-01-11 #newlistlevelattrs# 3627 const sal_uInt16 nPos = aAlignLB.IsVisible() 3628 ? aAlignLB.GetSelectEntryPos() 3629 : aAlign2LB.GetSelectEntryPos(); 3630 // <-- 3631 SvxAdjust eAdjust = SVX_ADJUST_CENTER; 3632 if(nPos == 0) 3633 eAdjust = SVX_ADJUST_LEFT; 3634 else if(nPos == 2) 3635 eAdjust = SVX_ADJUST_RIGHT; 3636 aNumFmt.SetNumAdjust( eAdjust ); 3637 pActNum->SetLevel(i, aNumFmt); 3638 } 3639 nMask <<= 1; 3640 } 3641 SetModified(); 3642 return 0; 3643 } 3644 /*-----------------03.12.97 11:11------------------- 3645 3646 --------------------------------------------------*/ 3647 IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox ) 3648 { 3649 sal_uInt16 nSaveNumLvl = nActNumLvl; 3650 nActNumLvl = 0; 3651 if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && 3652 (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) 3653 { 3654 nActNumLvl = 0xFFFF; 3655 pBox->SetUpdateMode(sal_False); 3656 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 3657 pBox->SelectEntryPos( i, sal_False ); 3658 pBox->SetUpdateMode(sal_True); 3659 } 3660 else if(pBox->GetSelectEntryCount()) 3661 { 3662 sal_uInt16 nMask = 1; 3663 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 3664 { 3665 if(pBox->IsEntryPosSelected( i )) 3666 nActNumLvl |= nMask; 3667 nMask <<= 1; 3668 } 3669 pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False ); 3670 } 3671 else 3672 { 3673 nActNumLvl = nSaveNumLvl; 3674 sal_uInt16 nMask = 1; 3675 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) 3676 { 3677 if(nActNumLvl & nMask) 3678 { 3679 pBox->SelectEntryPos(i); 3680 break; 3681 } 3682 nMask <<=1; 3683 } 3684 } 3685 aRelativeCB.Enable(nActNumLvl != 1); 3686 SetModified(); 3687 // --> OD 2008-01-15 #newlistlevelattrs# 3688 InitPosAndSpaceMode(); 3689 ShowControlsDependingOnPosAndSpaceMode(); 3690 // <-- 3691 InitControls(); 3692 return 0; 3693 } 3694 /*-----------------03.12.97 12:24------------------- 3695 3696 --------------------------------------------------*/ 3697 IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) 3698 { 3699 if(bInInintControl) 3700 return 0; 3701 long nValue = GetCoreValue(*pFld, eCoreUnit); 3702 sal_uInt16 nMask = 1; 3703 #if OSL_DEBUG_LEVEL > 1 3704 sal_Bool bFirst = sal_True; 3705 #endif 3706 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3707 { 3708 if(nActNumLvl & nMask) 3709 { 3710 SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); 3711 if(pFld == &aDistBorderMF) 3712 { 3713 3714 if(aRelativeCB.IsChecked()) 3715 { 3716 if(0 == i) 3717 { 3718 long nTmp = aNumFmt.GetFirstLineOffset(); 3719 aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp)); 3720 } 3721 else 3722 { 3723 long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() + 3724 pActNum->GetLevel( i - 1 ).GetFirstLineOffset() - 3725 pActNum->GetLevel( i ).GetFirstLineOffset(); 3726 3727 aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp)); 3728 } 3729 } 3730 else 3731 { 3732 aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); 3733 } 3734 } 3735 else if(pFld == &aDistNumMF) 3736 { 3737 aNumFmt.SetCharTextDistance( (short)nValue ); 3738 } 3739 else if(pFld == &aIndentMF) 3740 { 3741 //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden 3742 long nDiff = nValue + aNumFmt.GetFirstLineOffset(); 3743 long nAbsLSpace = aNumFmt.GetAbsLSpace(); 3744 aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff)); 3745 aNumFmt.SetFirstLineOffset( -(short)nValue ); 3746 } 3747 3748 #if OSL_DEBUG_LEVEL > 1 3749 if(bFirst) 3750 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); 3751 bFirst = sal_False; 3752 #endif 3753 pActNum->SetLevel( i, aNumFmt ); 3754 } 3755 nMask <<= 1; 3756 } 3757 3758 SetModified(); 3759 if(!aDistBorderMF.IsEnabled()) 3760 { 3761 String aEmptyStr; 3762 aDistBorderMF.SetText(aEmptyStr); 3763 } 3764 3765 return 0; 3766 } 3767 3768 /*-----------------04.12.97 12:35------------------- 3769 3770 --------------------------------------------------*/ 3771 IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox ) 3772 { 3773 sal_Bool bOn = pBox->IsChecked(); 3774 sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl; 3775 sal_Bool bSetValue = sal_False; 3776 long nValue = 0; 3777 if(bOn || bSingleSelection) 3778 { 3779 sal_uInt16 nMask = 1; 3780 sal_Bool bFirst = sal_True; 3781 bSetValue = sal_True; 3782 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3783 { 3784 if(nActNumLvl & nMask) 3785 { 3786 const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i); 3787 if(bFirst) 3788 { 3789 nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset(); 3790 if(bOn && i) 3791 nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); 3792 } 3793 else 3794 bSetValue = nValue == 3795 (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) - 3796 (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); 3797 bFirst = sal_False; 3798 } 3799 nMask <<= 1; 3800 } 3801 3802 } 3803 String aEmptyStr; 3804 if(bSetValue) 3805 SetMetricValue(aDistBorderMF, nValue, eCoreUnit); 3806 else 3807 aDistBorderMF.SetText(aEmptyStr); 3808 aDistBorderMF.Enable(bOn || bSingleSelection); 3809 aDistBorderFT.Enable(bOn || bSingleSelection); 3810 bLastRelative = bOn; 3811 return 0; 3812 } 3813 3814 // --> OD 2008-01-14 #newlistlevelattrs# 3815 IMPL_LINK( SvxNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG ) 3816 { 3817 // determine value to be set at the chosen list levels 3818 SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy = 3819 SvxNumberFormat::LISTTAB; 3820 { 3821 const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos(); 3822 if ( nPos == 1 ) 3823 { 3824 eLabelFollowedBy = SvxNumberFormat::SPACE; 3825 } 3826 else if ( nPos == 2 ) 3827 { 3828 eLabelFollowedBy = SvxNumberFormat::NOTHING; 3829 } 3830 } 3831 3832 // set value at the chosen list levels 3833 bool bSameListtabPos = true; 3834 sal_uInt16 nFirstLvl = USHRT_MAX; 3835 sal_uInt16 nMask = 1; 3836 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) 3837 { 3838 if ( nActNumLvl & nMask ) 3839 { 3840 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); 3841 aNumFmt.SetLabelFollowedBy( eLabelFollowedBy ); 3842 pActNum->SetLevel( i, aNumFmt ); 3843 3844 if ( nFirstLvl == USHRT_MAX ) 3845 { 3846 nFirstLvl = i; 3847 } 3848 else 3849 { 3850 bSameListtabPos &= aNumFmt.GetListtabPos() == 3851 pActNum->GetLevel( nFirstLvl ).GetListtabPos(); 3852 } 3853 } 3854 nMask <<= 1; 3855 } 3856 3857 // enable/disable metric field for list tab stop position depending on 3858 // selected item following the list label. 3859 aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); 3860 aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); 3861 if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB ) 3862 { 3863 SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit ); 3864 } 3865 else 3866 { 3867 aListtabMF.SetText( String() ); 3868 } 3869 3870 SetModified(); 3871 3872 return 0; 3873 } 3874 // <-- 3875 3876 // --> OD 2008-01-14 #newlistlevelattrs# 3877 IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) 3878 { 3879 // determine value to be set at the chosen list levels 3880 const long nValue = GetCoreValue( *pFld, eCoreUnit ); 3881 3882 // set value at the chosen list levels 3883 sal_uInt16 nMask = 1; 3884 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) 3885 { 3886 if ( nActNumLvl & nMask ) 3887 { 3888 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); 3889 aNumFmt.SetListtabPos( nValue ); 3890 pActNum->SetLevel( i, aNumFmt ); 3891 #if OSL_DEBUG_LEVEL > 1 3892 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); 3893 #endif 3894 } 3895 nMask <<= 1; 3896 } 3897 3898 SetModified(); 3899 3900 return 0; 3901 } 3902 // <-- 3903 3904 // --> OD 2008-01-14 #newlistlevelattrs# 3905 IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) 3906 { 3907 // determine value to be set at the chosen list levels 3908 const long nValue = GetCoreValue( *pFld, eCoreUnit ); 3909 3910 // set value at the chosen list levels 3911 sal_uInt16 nMask = 1; 3912 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) 3913 { 3914 if ( nActNumLvl & nMask ) 3915 { 3916 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); 3917 const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt(); 3918 aNumFmt.SetFirstLineIndent( nFirstLineIndent ); 3919 pActNum->SetLevel( i, aNumFmt ); 3920 #if OSL_DEBUG_LEVEL > 1 3921 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); 3922 #endif 3923 } 3924 nMask <<= 1; 3925 } 3926 3927 SetModified(); 3928 3929 return 0; 3930 } 3931 // <-- 3932 3933 // --> OD 2008-01-14 #newlistlevelattrs# 3934 IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) 3935 { 3936 // determine value to be set at the chosen list levels 3937 const long nValue = GetCoreValue( *pFld, eCoreUnit ); 3938 3939 // set value at the chosen list levels 3940 sal_uInt16 nMask = 1; 3941 for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) 3942 { 3943 if ( nActNumLvl & nMask ) 3944 { 3945 SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); 3946 const long nAlignedAt = aNumFmt.GetIndentAt() + 3947 aNumFmt.GetFirstLineIndent(); 3948 aNumFmt.SetIndentAt( nValue ); 3949 const long nNewFirstLineIndent = nAlignedAt - nValue; 3950 aNumFmt.SetFirstLineIndent( nNewFirstLineIndent ); 3951 pActNum->SetLevel( i, aNumFmt ); 3952 #if OSL_DEBUG_LEVEL > 1 3953 lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); 3954 #endif 3955 } 3956 nMask <<= 1; 3957 } 3958 3959 SetModified(); 3960 3961 return 0; 3962 } 3963 // <-- 3964 /*-----------------05.12.97 15:33------------------- 3965 3966 --------------------------------------------------*/ 3967 IMPL_LINK( SvxNumPositionTabPage, StandardHdl_Impl, PushButton *, EMPTYARG ) 3968 { 3969 sal_uInt16 nMask = 1; 3970 // --> OD 2008-02-11 #newlistlevelattrs# 3971 SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(), 3972 pActNum->GetLevelCount(), 3973 pActNum->IsContinuousNumbering(), 3974 SVX_RULETYPE_NUMBERING, 3975 pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() ); 3976 // <-- 3977 for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) 3978 { 3979 if(nActNumLvl & nMask) 3980 { 3981 SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); 3982 SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i )); 3983 // --> OD 2008-02-05 #newlistlevelattrs# 3984 aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() ); 3985 if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 3986 { 3987 aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() ); 3988 aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() ); 3989 aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() ); 3990 } 3991 else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 3992 { 3993 aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() ); 3994 aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() ); 3995 aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() ); 3996 aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() ); 3997 aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() ); 3998 } 3999 // <-- 4000 4001 pActNum->SetLevel( i, aNumFmt ); 4002 } 4003 nMask <<= 1; 4004 } 4005 4006 InitControls(); 4007 SetModified(); 4008 return 0; 4009 } 4010 4011 void SvxNumPositionTabPage::SetModified(sal_Bool bRepaint) 4012 { 4013 bModified = sal_True; 4014 if(bRepaint) 4015 { 4016 pPreviewWIN->SetLevel(nActNumLvl); 4017 pPreviewWIN->Invalidate(); 4018 } 4019 } 4020 4021 void SvxNumOptionsTabPage::SetModified(sal_Bool bRepaint) 4022 { 4023 bModified = sal_True; 4024 if(bRepaint) 4025 { 4026 pPreviewWIN->SetLevel(nActNumLvl); 4027 pPreviewWIN->Invalidate(); 4028 } 4029 } 4030 4031 //Add CHINA001 4032 void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet) 4033 { 4034 SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False); 4035 SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); 4036 SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); 4037 SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); 4038 4039 if (pNumCharFmt &&pBulletCharFmt) 4040 SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); 4041 4042 if (pListItem) 4043 { 4044 ListBox& myCharFmtLB = GetCharFmtListBox(); 4045 const List *pList = (pListItem)->GetList(); 4046 sal_uInt32 nCount = pList->Count();; 4047 for(sal_uInt32 i = 0; i < nCount; i++) 4048 { 4049 myCharFmtLB.InsertEntry(*(const String*)(pList->GetObject(i)) ); 4050 4051 } 4052 } 4053 if (pMetricItem) 4054 SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue())); 4055 } 4056 4057 //end of add CHINA001 4058 4059 //add CHINA001 begin 4060 4061 void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet) 4062 { 4063 SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); 4064 4065 if (pMetricItem) 4066 SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue())); 4067 } 4068