outliner.cxx (ed1e7921) | outliner.cxx (af89ca6e) |
---|---|
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 --- 356 unchanged lines hidden (view full) --- 365 // It is not a good idea to substract 1 from a count and cast the result 366 // to sal_uInt16 without check, if the count is 0. 367 ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); 368 // <-- 369 pEditEngine->SetModified(); 370 } 371} 372 | 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 --- 356 unchanged lines hidden (view full) --- 365 // It is not a good idea to substract 1 from a count and cast the result 366 // to sal_uInt16 without check, if the count is 0. 367 ImplCheckParagraphs( nPara, (sal_uInt16) (pParaList->GetParagraphCount()) ); 368 // <-- 369 pEditEngine->SetModified(); 370 } 371} 372 |
373sal_Int16 Outliner::GetBulletsNumberingStatus() | 373sal_Int16 Outliner::GetBulletsNumberingStatus( 374 const sal_uInt16 nParaStart, 375 const sal_uInt16 nParaEnd ) const |
374{ | 376{ |
375 sal_Bool bHasBulletsNumbering = FALSE; 376 sal_uInt16 nParaCount = (sal_uInt16)(pParaList->GetParagraphCount()); 377 for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) 378 { 379 if ((bHasBulletsNumbering = ImplHasBullet(nPara))) 380 { 381 break; 382 } 383 } 384 sal_uInt16 nBulletsCount = 0; 385 sal_uInt16 nNumberingCount = 0; 386 if (bHasBulletsNumbering) 387 { 388 // At least have one paragraph that having bullets or numbering. 389 for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) 390 { 391 Paragraph* pPara = pParaList->GetParagraph(nPara); 392 // const SfxItemSet& rAttrs = GetParaAttribs(nPara); 393 if (!pPara) 394 { 395 continue; 396 } 397 const SvxNumberFormat* pFmt = GetNumberFormat(nPara); 398 if (!pFmt) 399 { 400 // At least, exists one paragraph that has no Bullets/Numbering. 401 break; 402 } 403 else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL)) 404 { 405 // Having Bullets in this paragraph. 406 nBulletsCount++; 407 } 408 else 409 { 410 // Having Numbering in this paragraph. 411 nNumberingCount++; 412 } 413 } 414 } 415 sal_Int16 nValue = (nBulletsCount == nParaCount) ? 0 : 2; 416 nValue = (nNumberingCount == nParaCount) ? 1 : nValue; 417 return nValue; | 377 if ( nParaStart > nParaEnd 378 || nParaEnd >= pParaList->GetParagraphCount() ) 379 { 380 DBG_ASSERT( false,"<Outliner::GetBulletsNumberingStatus> - unexpected parameter values" ); 381 return 2; 382 } 383 384 sal_uInt16 nBulletsCount = 0; 385 sal_uInt16 nNumberingCount = 0; 386 for (sal_uInt16 nPara = nParaStart; nPara <= nParaEnd; nPara++) 387 { 388 if ( !pParaList->GetParagraph(nPara) ) 389 { 390 break; 391 } 392 const SvxNumberFormat* pFmt = GetNumberFormat(nPara); 393 if (!pFmt) 394 { 395 // At least, exists one paragraph that has no Bullets/Numbering. 396 break; 397 } 398 else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL)) 399 { 400 // Having Bullets in this paragraph. 401 nBulletsCount++; 402 } 403 else 404 { 405 // Having Numbering in this paragraph. 406 nNumberingCount++; 407 } 408 } 409 410 const sal_uInt16 nParaCount = nParaEnd - nParaStart + 1; 411 if ( nBulletsCount == nParaCount ) 412 { 413 return 0; 414 } 415 else if ( nNumberingCount == nParaCount ) 416 { 417 return 1; 418 } 419 return 2; |
418} 419 | 420} 421 |
422sal_Int16 Outliner::GetBulletsNumberingStatus() const 423{ 424 return pParaList->GetParagraphCount() > 0 425 ? GetBulletsNumberingStatus( 0, pParaList->GetParagraphCount()-1 ) 426 : 2; 427} 428 |
|
420OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const 421{ 422 DBG_CHKTHIS(Outliner,0); 423 424 if ( sal::static_int_cast< sal_uLong >( nStartPara + nCount ) > 425 pParaList->GetParagraphCount() ) 426 nCount = sal::static_int_cast< sal_uInt16 >( 427 pParaList->GetParagraphCount() - nStartPara ); --- 573 unchanged lines hidden (view full) --- 1001 1002 bool bDrawBullet = false; 1003 if (pEditEngine) 1004 { 1005 const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ); 1006 bDrawBullet = rBulletState.GetValue() ? true : false; 1007 } 1008 | 429OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const 430{ 431 DBG_CHKTHIS(Outliner,0); 432 433 if ( sal::static_int_cast< sal_uLong >( nStartPara + nCount ) > 434 pParaList->GetParagraphCount() ) 435 nCount = sal::static_int_cast< sal_uInt16 >( 436 pParaList->GetParagraphCount() - nStartPara ); --- 573 unchanged lines hidden (view full) --- 1010 1011 bool bDrawBullet = false; 1012 if (pEditEngine) 1013 { 1014 const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ); 1015 bDrawBullet = rBulletState.GetValue() ? true : false; 1016 } 1017 |
1009 if ( ImplHasBullet( nPara ) && bDrawBullet) | 1018 if ( ImplHasNumberFormat( nPara ) && bDrawBullet) |
1010 { 1011 sal_Bool bVertical = IsVertical(); 1012 1013 sal_Bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara ); 1014 1015 Rectangle aBulletArea( ImpCalcBulletArea( nPara, sal_True, sal_False ) ); 1016 1017 Paragraph* pPara = pParaList->GetParagraph( nPara ); --- 484 unchanged lines hidden (view full) --- 1502} 1503 1504sal_Bool Outliner::HasChilds( Paragraph* pParagraph ) const 1505{ 1506 DBG_CHKTHIS(Outliner,0); 1507 return pParaList->HasChilds( pParagraph ); 1508} 1509 | 1019 { 1020 sal_Bool bVertical = IsVertical(); 1021 1022 sal_Bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara ); 1023 1024 Rectangle aBulletArea( ImpCalcBulletArea( nPara, sal_True, sal_False ) ); 1025 1026 Paragraph* pPara = pParaList->GetParagraph( nPara ); --- 484 unchanged lines hidden (view full) --- 1511} 1512 1513sal_Bool Outliner::HasChilds( Paragraph* pParagraph ) const 1514{ 1515 DBG_CHKTHIS(Outliner,0); 1516 return pParaList->HasChilds( pParagraph ); 1517} 1518 |
1510sal_Bool Outliner::ImplHasBullet( sal_uInt16 nPara ) const | 1519bool Outliner::ImplHasNumberFormat( sal_uInt16 nPara ) const |
1511{ 1512 return GetNumberFormat(nPara) != 0; 1513} 1514 1515const SvxNumberFormat* Outliner::GetNumberFormat( sal_uInt16 nPara ) const 1516{ 1517 const SvxNumberFormat* pFmt = NULL; 1518 --- 232 unchanged lines hidden (view full) --- 1751 aExpandHdl.Call( this ); 1752} 1753 1754EBulletInfo Outliner::GetBulletInfo( sal_uInt16 nPara ) 1755{ 1756 EBulletInfo aInfo; 1757 1758 aInfo.nParagraph = nPara; | 1520{ 1521 return GetNumberFormat(nPara) != 0; 1522} 1523 1524const SvxNumberFormat* Outliner::GetNumberFormat( sal_uInt16 nPara ) const 1525{ 1526 const SvxNumberFormat* pFmt = NULL; 1527 --- 232 unchanged lines hidden (view full) --- 1760 aExpandHdl.Call( this ); 1761} 1762 1763EBulletInfo Outliner::GetBulletInfo( sal_uInt16 nPara ) 1764{ 1765 EBulletInfo aInfo; 1766 1767 aInfo.nParagraph = nPara; |
1759 aInfo.bVisible = ImplHasBullet( nPara ); | 1768 aInfo.bVisible = ImplHasNumberFormat( nPara ) ? sal_True : sal_False; |
1760 1761 const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); 1762 aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0; 1763 1764 if( pFmt ) 1765 { 1766 if( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) 1767 { --- 471 unchanged lines hidden --- | 1769 1770 const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); 1771 aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0; 1772 1773 if( pFmt ) 1774 { 1775 if( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) 1776 { --- 471 unchanged lines hidden --- |