Resolves: #i122096# apply default bullet numbering rule on toggle on...

if the current numbering rule is not a bullet numbering rule.

- improve application default bullet numbering rule by add corresponding
  spacing to the first list level
- refactoring of code introduced for paragraph property panel to handle toggle
  and set of bullets and numbering

(cherry picked from commit 8c142809c7e16853d5634487cc9ed4e53caa3f91)

Conflicts:
	editeng/inc/editeng/outliner.hxx
	editeng/source/outliner/outlin2.cxx
	editeng/source/outliner/outliner.cxx
	editeng/source/outliner/outlvw.cxx
	sd/source/ui/func/fuolbull.cxx

Change-Id: If2807b2b81f8ade1e5b3282aa636cc2c0d8ea76a
This commit is contained in:
Oliver-Rainer Wittmann
2013-05-29 08:10:49 +00:00
committed by Caolán McNamara
parent 20824c118f
commit 0ff751efaa
12 changed files with 539 additions and 624 deletions

View File

@@ -69,7 +69,7 @@ Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara )
Rectangle aBulletArea = Rectangle( Point(), Point() ); Rectangle aBulletArea = Rectangle( Point(), Point() );
if ( nPara < pOwner->pParaList->GetParagraphCount() ) if ( nPara < pOwner->pParaList->GetParagraphCount() )
{ {
if ( pOwner->ImplHasBullet( nPara ) ) if ( pOwner->ImplHasNumberFormat( nPara ) )
aBulletArea = pOwner->ImpCalcBulletArea( nPara, sal_False, sal_False ); aBulletArea = pOwner->ImpCalcBulletArea( nPara, sal_False, sal_False );
} }
return aBulletArea; return aBulletArea;

View File

@@ -520,7 +520,7 @@ sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bo
{ {
Point aDocPos = GetDocPos( rPaperPos ); Point aDocPos = GetDocPos( rPaperPos );
sal_Int32 nPara = pEditEngine->FindParagraph( aDocPos.Y() ); sal_Int32 nPara = pEditEngine->FindParagraph( aDocPos.Y() );
if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasBullet( nPara ) ) if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasNumberFormat( nPara ) )
{ {
Rectangle aBulArea = ImpCalcBulletArea( nPara, sal_True, sal_True ); Rectangle aBulArea = ImpCalcBulletArea( nPara, sal_True, sal_True );
if ( aBulArea.IsInside( rPaperPos ) ) if ( aBulArea.IsInside( rPaperPos ) )

View File

@@ -336,50 +336,60 @@ void Outliner::SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumbe
} }
} }
sal_Int32 Outliner::GetBulletsNumberingStatus() sal_Int32 Outliner::GetBulletsNumberingStatus(
const sal_Int32 nParaStart,
const sal_Int32 nParaEnd ) const
{ {
sal_Bool bHasBulletsNumbering = FALSE; if ( nParaStart > nParaEnd
sal_uInt32 nParaCount = (sal_uInt32)(pParaList->GetParagraphCount()); || nParaEnd >= pParaList->GetParagraphCount() )
for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++)
{ {
if ((bHasBulletsNumbering = ImplHasBullet(nPara))) DBG_ASSERT( false,"<Outliner::GetBulletsNumberingStatus> - unexpected parameter values" );
return 2;
}
sal_Int32 nBulletsCount = 0;
sal_Int32 nNumberingCount = 0;
for (sal_Int32 nPara = nParaStart; nPara <= nParaEnd; ++nPara)
{
if ( !pParaList->GetParagraph(nPara) )
{ {
break; break;
} }
} const SvxNumberFormat* pFmt = GetNumberFormat(nPara);
sal_uInt16 nBulletsCount = 0; if (!pFmt)
sal_uInt16 nNumberingCount = 0;
if (bHasBulletsNumbering)
{
// At least have one paragraph that having bullets or numbering.
for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++)
{ {
Paragraph* pPara = pParaList->GetParagraph(nPara); // At least, exists one paragraph that has no Bullets/Numbering.
if (!pPara) break;
{ }
continue; else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL))
} {
const SvxNumberFormat* pFmt = GetNumberFormat(nPara); // Having Bullets in this paragraph.
if (!pFmt) nBulletsCount++;
{ }
// At least, exists one paragraph that has no Bullets/Numbering. else
break; {
} // Having Numbering in this paragraph.
else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL)) nNumberingCount++;
{
// Having Bullets in this paragraph.
nBulletsCount++;
}
else
{
// Having Numbering in this paragraph.
nNumberingCount++;
}
} }
} }
sal_Int32 nValue = (nBulletsCount == nParaCount) ? 0 : 2;
nValue = (nNumberingCount == nParaCount) ? 1 : nValue; const sal_Int32 nParaCount = nParaEnd - nParaStart + 1;
return nValue; if ( nBulletsCount == nParaCount )
{
return 0;
}
else if ( nNumberingCount == nParaCount )
{
return 1;
}
return 2;
}
sal_Int32 Outliner::GetBulletsNumberingStatus() const
{
return pParaList->GetParagraphCount() > 0
? GetBulletsNumberingStatus( 0, pParaList->GetParagraphCount()-1 )
: 2;
} }
OutlinerParaObject* Outliner::CreateParaObject( sal_Int32 nStartPara, sal_Int32 nCount ) const OutlinerParaObject* Outliner::CreateParaObject( sal_Int32 nStartPara, sal_Int32 nCount ) const
@@ -944,7 +954,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
bDrawBullet = rBulletState.GetValue() ? true : false; bDrawBullet = rBulletState.GetValue() ? true : false;
} }
if ( ImplHasBullet( nPara ) && bDrawBullet) if ( ImplHasNumberFormat( nPara ) && bDrawBullet)
{ {
sal_Bool bVertical = IsVertical(); sal_Bool bVertical = IsVertical();
@@ -1467,7 +1477,7 @@ sal_Bool Outliner::HasChildren( Paragraph* pParagraph ) const
return pParaList->HasChildren( pParagraph ); return pParaList->HasChildren( pParagraph );
} }
sal_Bool Outliner::ImplHasBullet( sal_Int32 nPara ) const bool Outliner::ImplHasNumberFormat( sal_Int32 nPara ) const
{ {
return GetNumberFormat(nPara) != 0; return GetNumberFormat(nPara) != 0;
} }
@@ -1711,7 +1721,7 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
EBulletInfo aInfo; EBulletInfo aInfo;
aInfo.nParagraph = nPara; aInfo.nParagraph = nPara;
aInfo.bVisible = ImplHasBullet( nPara ); aInfo.bVisible = ImplHasNumberFormat( nPara );
const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0; aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0;

View File

@@ -20,6 +20,7 @@
#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/i18n/WordType.hpp>
#include <svl/intitem.hxx> #include <svl/intitem.hxx>
#include <svl/itempool.hxx>
#include <editeng/editeng.hxx> #include <editeng/editeng.hxx>
#include <editeng/editview.hxx> #include <editeng/editview.hxx>
#include <editeng/editdata.hxx> #include <editeng/editdata.hxx>
@@ -169,7 +170,7 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin )
bKeyProcessed = sal_True; bKeyProcessed = sal_True;
} }
else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) && else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) &&
!bSelection && !aSel.nEndPos && pOwner->ImplHasBullet( aSel.nEndPara ) ) !bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) )
{ {
Indent( aKeyCode.IsShift() ? (-1) : (+1) ); Indent( aKeyCode.IsShift() ? (-1) : (+1) );
bKeyProcessed = sal_True; bKeyProcessed = sal_True;
@@ -886,7 +887,8 @@ void OutlinerView::ToggleBullets()
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
pOwner->pEditEngine->SetUpdateMode( sal_False ); pOwner->pEditEngine->SetUpdateMode( sal_False );
sal_Int16 nDepth = -2; sal_Int16 nNewDepth = -2;
const SvxNumRule* pDefaultBulletNumRule = 0;
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
{ {
@@ -895,25 +897,52 @@ void OutlinerView::ToggleBullets()
if( pPara ) if( pPara )
{ {
if( nDepth == -2 ) if( nNewDepth == -2 )
nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1; {
nNewDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
if ( nNewDepth == 0 )
{
// determine default numbering rule for bullets
const ESelection aSelection(nPara, 0);
const SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
const SfxPoolItem& rPoolItem = aTmpSet.GetPool()->GetDefaultItem( EE_PARA_NUMBULLET );
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(&rPoolItem);
pDefaultBulletNumRule = pNumBulletItem ? pNumBulletItem->GetNumRule() : 0;
}
}
pOwner->SetDepth( pPara, nDepth ); pOwner->SetDepth( pPara, nNewDepth );
if( nDepth == -1 ) if( nNewDepth == -1 )
{ {
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
if(rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET) if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET )
{ {
SfxItemSet aAttrs(rAttrs); SfxItemSet aAttrs(rAttrs);
aAttrs.ClearItem( EE_PARA_BULLETSTATE ); aAttrs.ClearItem( EE_PARA_BULLETSTATE );
pOwner->SetParaAttribs( nPara, aAttrs ); pOwner->SetParaAttribs( nPara, aAttrs );
} }
} }
else
{
if ( pDefaultBulletNumRule )
{
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat( nPara );
if ( !pFmt
|| ( pFmt->GetNumberingType() != SVX_NUM_BITMAP
&& pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) )
{
SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) );
SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
aAttrs.Put( SvxNumBulletItem( aNewNumRule ), EE_PARA_NUMBULLET );
pOwner->SetParaAttribs( nPara, aAttrs );
}
}
}
} }
} }
sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount(); const sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount; sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
@@ -924,204 +953,46 @@ void OutlinerView::ToggleBullets()
pOwner->UndoActionEnd( OLUNDO_DEPTH ); pOwner->UndoActionEnd( OLUNDO_DEPTH );
} }
sal_Bool OutlinerView::ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff)
{
pOwner->UndoActionStart( OLUNDO_DEPTH );
void OutlinerView::ToggleBulletsNumbering(
const bool bToggle,
const bool bHandleBullets,
const SvxNumRule* pNumRule )
{
ESelection aSel( pEditView->GetSelection() ); ESelection aSel( pEditView->GetSelection() );
aSel.Adjust(); aSel.Adjust();
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); bool bToggleOn = true;
pOwner->pEditEngine->SetUpdateMode( sal_False ); if ( bToggle )
sal_Int16 nDepth = -2;
sal_Bool bRet = sal_False;
//Modified by xuezhiy for bullet enhancement
bool bBulletOn = sal_True;
if( bBulletOnOff )
{ {
bool bHasBullet = sal_False; bToggleOn = false;
for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
if ( nBulletNumberingStatus != 0 && bHandleBullets )
{ {
bHasBullet = pOwner->ImplHasBullet(nPara); // not all paragraphs have bullets and method called to toggle bullets --> bullets on
if(bHasBullet) bToggleOn = true;
break;
} }
else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
if( bHasBullet )
{ {
bBulletOn = sal_False; // not all paragraphs have numbering and method called to toggle numberings --> numberings on
bToggleOn = true;
for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
{
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
if( pPara )
{
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
if( !pFmt )
{
// Has no Bullet paragraph
bBulletOn = sal_True;
break;
}
else if( ( pFmt->GetNumberingType() == SVX_NUM_BITMAP ) || ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL ) )
{
// Normal ==>> Numbering
if( !bNormalBullet )
{
bBulletOn = sal_True;
break;
}
}
else
{
// Numbering ==>> Normal
if( bNormalBullet )
{
bBulletOn = sal_True;
break;
}
}
}
}
} }
} }
if (bForceBulletOnOff) { if ( bToggleOn )
bBulletOn = bBulletOnOff;
}
for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
{ {
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); // apply bullets/numbering for selected paragraphs
DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
}
if( pPara ) else
{ {
bRet = sal_True; // switch off bullets/numbering for selected paragraphs
SwitchOffBulletsNumbering( true );
nDepth = pOwner->GetDepth(nPara);
if( bBulletOn && nDepth == -1 )
{
// Off ==>> On
nDepth = 0;
}
else if( !bBulletOn && nDepth == 0 )
{
// On ==>> Off
nDepth = -1;
}
pOwner->SetDepth( pPara, nDepth );
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
// bool bBulletState = ((const SfxBoolItem&) rAttrs.Get( EE_PARA_BULLETSTATE ) ).GetValue();
SfxItemSet aAttrs(rAttrs);
aAttrs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, bBulletOn ) );
// Change bullet types
if( bBulletOn && pNumRule)
{
bool bSetBulletType = false;
if( !bBulletOnOff )
{
// Not bullet on/off button
bSetBulletType = true;
}
else
{
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
if( !pFmt )
{
// Has no bullet
bSetBulletType = true;
}
else
{
sal_Int16 nNumType = pFmt->GetNumberingType();
if( bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL )
{
// Set to Normal bullet, old bullet type is Numbering bullet
bSetBulletType = true;
}
else if( !bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL) )
{
// Set to Numbering bullet, old bullet type is Normal bullet
bSetBulletType = true;
}
}
}
// Get old bullet space
SvxNumRule aNewRule( *pNumRule );
const SfxPoolItem* pPoolItem=NULL;
SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
if (eState != SFX_ITEM_SET)
{
// Use default value when has not contain bullet item
ESelection aSelection(nPara, 0);
SfxItemSet aTmpSet( pOwner->pEditEngine->GetAttribs( aSelection ) );
pPoolItem = aTmpSet.GetItem( EE_PARA_NUMBULLET );
}
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >( pPoolItem );
//const SvxNumBulletItem& rNumBullet = (const SvxNumBulletItem&) rAttrs.Get( EE_PARA_NUMBULLET );
if( pNumBulletItem )
{
sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
nLevelCnt = std::min( nLevelCnt, pNumRule->GetLevelCount() );
for( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
{
const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get( nLevel );
const SvxNumberFormat* pNewFmt = pNumRule->Get( nLevel );
if( pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset()
|| pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace() ) )
{
SvxNumberFormat* pNewFmtClone = new SvxNumberFormat( *pNewFmt );
pNewFmtClone->SetFirstLineOffset( pOldFmt->GetFirstLineOffset() );
pNewFmtClone->SetAbsLSpace( pOldFmt->GetAbsLSpace() );
aNewRule.SetLevel( nLevel, pNewFmtClone );
delete pNewFmtClone;
}
}
}
// Don't set bullet attribute to paragraph in Master view
// Because it will be set into style sheet
if( bSetBulletType && !bMasterView )
aAttrs.Put(SvxNumBulletItem( aNewRule ), EE_PARA_NUMBULLET);
}
pOwner->SetParaAttribs( nPara, aAttrs );
}
} }
// --> OD 2009-03-10 #i100014# return;
// It is not a good idea to substract 1 from a count and cast the result
// to sal_uInt16 without check, if the count is 0.
sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
// <--
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
pOwner->pEditEngine->SetUpdateMode( bUpdate );
pOwner->UndoActionEnd( OLUNDO_DEPTH );
return bRet;
} }
void OutlinerView::EnableBullets() void OutlinerView::EnableBullets()
{ {
pOwner->UndoActionStart( OLUNDO_DEPTH ); pOwner->UndoActionStart( OLUNDO_DEPTH );
@@ -1135,7 +1006,7 @@ void OutlinerView::EnableBullets()
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
{ {
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
if( pPara && (pOwner->GetDepth(nPara) == -1) ) if( pPara && (pOwner->GetDepth(nPara) == -1) )
{ {
@@ -1154,127 +1025,192 @@ void OutlinerView::EnableBullets()
pOwner->UndoActionEnd( OLUNDO_DEPTH ); pOwner->UndoActionEnd( OLUNDO_DEPTH );
} }
sal_Bool OutlinerView::ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule)
void OutlinerView::ApplyBulletsNumbering(
const bool bHandleBullets,
const SvxNumRule* pNewNumRule,
const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
const bool bAtSelection )
{ {
if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList) if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
{ {
return sal_False; return;
} }
sal_Bool bReturn = sal_False;
pOwner->UndoActionStart(OLUNDO_DEPTH); pOwner->UndoActionStart(OLUNDO_DEPTH);
const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
pOwner->pEditEngine->SetUpdateMode(sal_False); pOwner->pEditEngine->SetUpdateMode(sal_False);
sal_Int16 nDepth = -2; sal_Int32 nStartPara = 0;
sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount()); sal_Int32 nEndPara = 0;
for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) if ( bAtSelection )
{
ESelection aSel( pEditView->GetSelection() );
aSel.Adjust();
nStartPara = aSel.nStartPara;
nEndPara = aSel.nEndPara;
}
else
{
nStartPara = 0;
nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
}
for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
{ {
Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?"); DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
if (pPara) if (pPara)
{ {
bReturn = sal_True; const sal_Int16 nDepth = pOwner->GetDepth(nPara);
nDepth = pOwner->GetDepth(nPara); if ( nDepth == -1 )
if (bToggleOn && nDepth == -1)
{ {
// Off ==>> On pOwner->SetDepth( pPara, 0 );
nDepth = 0;
} }
else if (!bToggleOn && nDepth == 0)
{
// On ==>> Off
nDepth = -1;
}
pOwner->SetDepth(pPara, nDepth);
const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara); const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
SfxItemSet aAttrs(rAttrs); SfxItemSet aAttrs(rAttrs);
aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn)); aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true));
// Change bullet types. // apply new numbering rule
if (bToggleOn && pNumRule) if ( pNewNumRule )
{ {
sal_Bool bSetBulletType = sal_False; bool bApplyNumRule = false;
if (!bBulletOnOffMode) if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
{ {
// Not bullet on/off button. bApplyNumRule = true;
bSetBulletType = sal_True;
} }
else else
{ {
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
if (!pFmt) if (!pFmt)
{ {
// Has no bullet. bApplyNumRule = true;
bSetBulletType = sal_True;
} }
else else
{ {
sal_Int16 nNumType = pFmt->GetNumberingType(); sal_Int16 nNumType = pFmt->GetNumberingType();
if (bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL) if ( bHandleBullets
&& nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
{ {
// Set to Normal bullet, old bullet type is Numbering bullet. // Set to Normal bullet, old bullet type is Numbering bullet.
bSetBulletType = sal_True; bApplyNumRule = true;
} }
else if (!bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL)) else if ( !bHandleBullets
&& (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
{ {
// Set to Numbering bullet, old bullet type is Normal bullet. // Set to Numbering bullet, old bullet type is Normal bullet.
bSetBulletType = sal_True; bApplyNumRule = true;
} }
} }
} }
// Get old bullet space. if ( bApplyNumRule )
SvxNumRule aNewRule(*pNumRule);
const SfxPoolItem* pPoolItem=NULL;
SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
ESelection aSelection(nPara, 0);
SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
if (eState != SFX_ITEM_SET)
{ {
// Use default value when has not contain bullet item. SvxNumRule aNewRule(*pNewNumRule);
pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
}
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem); // Get old bullet space.
if (pNumBulletItem)
{
sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
nLevelCnt = std::min(nLevelCnt, pNumRule->GetLevelCount());
for (sal_uInt16 nLevel = 0; nLevel < nLevelCnt; nLevel++)
{ {
const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel); const SfxPoolItem* pPoolItem=NULL;
const SvxNumberFormat* pNewFmt = pNumRule->Get(nLevel); SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace())) if (eState != SFX_ITEM_SET)
{ {
SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt); // Use default value when has not contain bullet item.
pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset()); ESelection aSelection(nPara, 0);
pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace()); SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
aNewRule.SetLevel(nLevel, pNewFmtClone); pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
delete pNewFmtClone; }
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
if (pNumBulletItem)
{
const sal_uInt16 nLevelCnt = std::min(pNumBulletItem->GetNumRule()->GetLevelCount(), aNewRule.GetLevelCount());
for ( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
{
const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
const SvxNumberFormat* pNewFmt = aNewRule.Get(nLevel);
if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
{
SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
aNewRule.SetLevel(nLevel, pNewFmtClone);
delete pNewFmtClone;
}
}
} }
} }
}
// Don't set bullet attribute to paragraph in Master view, because it will be set into style sheet.
if (bSetBulletType && !bMasterView)
aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET); aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
}
} }
pOwner->SetParaAttribs(nPara, aAttrs); pOwner->SetParaAttribs(nPara, aAttrs);
} }
} }
pOwner->ImplCheckParagraphs(0, nParaCount); const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0)); pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
pOwner->pEditEngine->SetUpdateMode(bUpdate); pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
pOwner->UndoActionEnd(OLUNDO_DEPTH);
return bReturn; pOwner->pEditEngine->SetUpdateMode( bUpdate );
pOwner->UndoActionEnd( OLUNDO_DEPTH );
return;
} }
void OutlinerView::SwitchOffBulletsNumbering(
const bool bAtSelection )
{
sal_Int32 nStartPara = 0;
sal_Int32 nEndPara = 0;
if ( bAtSelection )
{
ESelection aSel( pEditView->GetSelection() );
aSel.Adjust();
nStartPara = aSel.nStartPara;
nEndPara = aSel.nEndPara;
}
else
{
nStartPara = 0;
nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
}
pOwner->UndoActionStart( OLUNDO_DEPTH );
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
pOwner->pEditEngine->SetUpdateMode( sal_False );
for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
{
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
if( pPara )
{
pOwner->SetDepth( pPara, -1 );
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
{
SfxItemSet aAttrs(rAttrs);
aAttrs.ClearItem( EE_PARA_BULLETSTATE );
pOwner->SetParaAttribs( nPara, aAttrs );
}
}
}
const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
pOwner->pEditEngine->SetUpdateMode( bUpdate );
pOwner->UndoActionEnd( OLUNDO_DEPTH );
}
void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
{ {
RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ ); RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );

View File

@@ -329,12 +329,44 @@ public:
const SvxFieldItem* GetFieldUnderMousePointer() const; const SvxFieldItem* GetFieldUnderMousePointer() const;
const SvxFieldItem* GetFieldAtSelection() const; const SvxFieldItem* GetFieldAtSelection() const;
/** enables numbering for the selected paragraphs if the numbering of the first paragraph is off /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
or disables numbering for the selected paragraphs if the numbering of the first paragraph is on or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
*/ */
void ToggleBullets(); void ToggleBullets();
sal_Bool ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false);
sal_Bool ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL); void ToggleBulletsNumbering(
const bool bToggle,
const bool bHandleBullets,
const SvxNumRule* pNumRule = NULL );
/** apply bullets/numbering for paragraphs
@param boolean bHandleBullets
true: handle bullets
false: handle numbering
@param pNewNumRule
numbering rule which needs to be applied. can be 0.
@param boolean bAtSelection
true: apply bullets/numbering at selected paragraphs
false: apply bullets/numbering at all paragraphs
*/
void ApplyBulletsNumbering(
const bool bHandleBullets,
const SvxNumRule* pNewNumRule,
const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
const bool bAtSelection = false );
/** switch off bullets/numbering for paragraphs
@param boolean bAtSelection
true: switch off bullets/numbering at selected paragraphs
false: switch off bullets/numbering at all paragraphs
*/
void SwitchOffBulletsNumbering(
const bool bAtSelection = false );
/** enables numbering for the selected paragraphs that are not enabled and ignore all selected /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
paragraphs that already have numbering enabled. paragraphs that already have numbering enabled.
*/ */
@@ -608,7 +640,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* ); DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
DECL_LINK( EditEngineNotifyHdl, EENotify* ); DECL_LINK( EditEngineNotifyHdl, EENotify* );
void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd ); void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd );
sal_Bool ImplHasBullet( sal_Int32 nPara ) const; bool ImplHasNumberFormat( sal_Int32 nPara ) const;
Size ImplGetBulletSize( sal_Int32 nPara ); Size ImplGetBulletSize( sal_Int32 nPara );
sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt ); sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt );
void ImplCalcBulletText( sal_Int32 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren ); void ImplCalcBulletText( sal_Int32 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
@@ -989,7 +1021,25 @@ public:
virtual sal_Bool IsParaIsNumberingRestart( sal_Int32 nPara ); virtual sal_Bool IsParaIsNumberingRestart( sal_Int32 nPara );
virtual void SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumberingRestart ); virtual void SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumberingRestart );
sal_Int32 GetBulletsNumberingStatus(); /** determine the bullets/numbering status of the given paragraphs
@param nParaStart
index of paragraph at which the check starts
@param nParaEnd
index of paragraph at which the check ends
@returns
0 : all paragraphs have bullets
1 : all paragraphs have numbering
2 : otherwise
*/
sal_Int32 GetBulletsNumberingStatus(
const sal_Int32 nParaStart,
const sal_Int32 nParaEnd ) const;
// convenient method to determine the bullets/numbering status for all paragraphs
sal_Int32 GetBulletsNumberingStatus() const;
}; };
#endif #endif

View File

@@ -1225,12 +1225,12 @@ void SdDrawDocument::SetTextDefaults() const
SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM, sal_False); SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM, sal_False);
aNumberFormat.SetLSpace( 0 ); //aNumberFormat.SetLSpace( 0 );
aNumberFormat.SetAbsLSpace( 0 ); //aNumberFormat.SetAbsLSpace( 0 );
aNumberFormat.SetFirstLineOffset( 0 ); //aNumberFormat.SetFirstLineOffset( 0 );
aNumRule.SetLevel( 0, aNumberFormat ); //aNumRule.SetLevel( 0, aNumberFormat );
for( sal_uInt16 i = 1; i < aNumRule.GetLevelCount(); i++ ) for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ )
{ {
const short nLSpace = (i + 1) * 600; const short nLSpace = (i + 1) * 600;
aNumberFormat.SetLSpace(nLSpace); aNumberFormat.SetLSpace(nLSpace);

View File

@@ -61,13 +61,10 @@ FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWi
void FuOutlineBullet::DoExecute( SfxRequest& rReq ) void FuOutlineBullet::DoExecute( SfxRequest& rReq )
{ {
sal_uInt16 nSId = rReq.GetSlot(); const sal_uInt16 nSId = rReq.GetSlot();
if (nSId == FN_SVX_SET_BULLET){ if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
SetCurrentBullet(rReq); {
return; SetCurrentBulletsNumbering(rReq);
}
else if (nSId == FN_SVX_SET_NUMBER){
SetCurrentNumbering(rReq);
return; return;
} }
@@ -137,178 +134,43 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq )
*/ */
} }
void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq) void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
{ {
if (!mpDoc || !mpView) if (!mpDoc || !mpView)
return; return;
SfxItemSet aEditAttr( mpDoc->GetPool() ); const sal_uInt16 nSId = rReq.GetSlot();
mpView->GetAttributes( aEditAttr ); if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
SfxItemSet aNewAttr( mpViewShell->GetPool(),
EE_ITEMS_START, EE_ITEMS_END );
aNewAttr.Put( aEditAttr, sal_False );
SfxItemSet aSetAttr( mpViewShell->GetPool(),
EE_ITEMS_START, EE_ITEMS_END );
//Init bullet level in "Customize" tab page in bullet dialog in master page view
if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell)
&& ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE )
{ {
SdrObject* pObj = mpView->GetTextEditObject(); // unexpected SfxRequest
if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
{
sal_uInt16 nLevel = mpView->GetSelectionLevel();
if( nLevel != 0xFFFF )
{
SfxItemSet aStoreSet( aNewAttr );
aNewAttr.ClearItem();
//extend range
aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
aNewAttr.Put( aStoreSet );
//put current level user selected
aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
}
}
}
//End of add
sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
SvxNumRule* pNumRule = NULL;
const SfxPoolItem* pTmpItem=NULL;
sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
if (pTmpItem)
pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False );
if (pItem && pNumRule)
{
sal_uInt16 nIdx = pItem->GetValue();
// If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
// And the bullet default status is 1.
bool bBulletSwitch = false;
sal_Bool isRemoveNum =false;
if( nIdx == (sal_uInt16)0xFFFF )
{
nIdx = 1;
bBulletSwitch = true;
}
if (nIdx == DEFAULT_NONE)
{
bBulletSwitch = false;
isRemoveNum = true;
}
nIdx--;
NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
if ( pNumbering )
{
//Sym3_2508, set unit attribute to NB Manager
pNumbering->SetItems(&aNewAttr);
SvxNumRule aTmpRule( *pNumRule );
pNumbering->ApplyNumRule(aTmpRule,nIdx,nActNumLvl);
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
{
if(nActNumLvl & nMask)
{
SvxNumberFormat aFmt(aTmpRule.GetLevel(i));
pNumRule->SetLevel(i, aFmt);
}
nMask <<= 1 ;
}
aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId);
OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
if (mpView->ISA(OutlineView))
{
pOLV = static_cast<OutlineView*>(mpView)
->GetViewByWindow(mpViewShell->GetActiveWindow());
aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
}
SdrOutliner* pOwner = mpView->GetTextEditOutliner();
bool bMasterView = false;
DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell);
if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE )
bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
if( bMasterView )
{
pOwner->UndoActionStart( OLUNDO_ATTR );
pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule,isRemoveNum);
mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151
pOwner->UndoActionEnd( OLUNDO_ATTR );
}
else if( pOLV )
pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule ,isRemoveNum);
else
{
sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
SdrModel* pSdrModel = mpView->GetModel();
sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False;
if (bInMasterView && bModelUndoEnabled)
{
pSdrModel->BegUndo();
}
mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_False, bInMasterView, pNumRule,isRemoveNum);
if (bInMasterView)
{
mpView->SetAttributes(aSetAttr);
}
if (bInMasterView && bModelUndoEnabled)
{
pSdrModel->EndUndo();
}
}
}
//End
}
delete pNumRule;
rReq.Done();
}
void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
{
if (!mpDoc || !mpView)
return; return;
}
SfxItemSet aEditAttr( mpDoc->GetPool() ); SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSId, sal_False );
mpView->GetAttributes( aEditAttr ); if ( !pItem )
{
rReq.Done();
return;
}
SfxItemSet aNewAttr( mpViewShell->GetPool(), SfxItemSet aNewAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END );
EE_ITEMS_START, EE_ITEMS_END ); {
aNewAttr.Put( aEditAttr, sal_False ); SfxItemSet aEditAttr( mpDoc->GetPool() );
mpView->GetAttributes( aEditAttr );
//Add for Sym2_3151, should add new attributes in an empty item set, then use this item set as parameter in SetAttributes() aNewAttr.Put( aEditAttr, sal_False );
SfxItemSet aSetAttr( mpViewShell->GetPool(), }
EE_ITEMS_START, EE_ITEMS_END );
const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
//Init bullet level in "Customize" tab page in bullet dialog in master page view //Init bullet level in "Customize" tab page in bullet dialog in master page view
if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
&& ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE ) if ( bInMasterView )
{ {
SdrObject* pObj = mpView->GetTextEditObject(); SdrObject* pObj = mpView->GetTextEditObject();
if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
{ {
sal_uInt16 nLevel = mpView->GetSelectionLevel(); const sal_uInt16 nLevel = mpView->GetSelectionLevel();
if( nLevel != 0xFFFF ) if( nLevel != 0xFFFF )
{ {
//aNewAttr.MergeRange( SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL );
//aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
//save the itemset value //save the itemset value
SfxItemSet aStoreSet( aNewAttr ); SfxItemSet aStoreSet( aNewAttr );
aNewAttr.ClearItem(); aNewAttr.ClearItem();
@@ -320,57 +182,52 @@ void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
} }
} }
} }
//End of add
sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; sal_uInt16 nIdx = pItem->GetValue();
SvxNumRule* pNumRule = NULL; bool bToggle = false;
const SfxPoolItem* pTmpItem=NULL; bool bSwitchOff = false;
if( nIdx == (sal_uInt16)0xFFFF )
{
// If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
nIdx = 1;
bToggle = true;
}
else if (nIdx == DEFAULT_NONE)
{
bSwitchOff = true;
}
nIdx--;
sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE; sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) SvxNumRule* pNumRule = NULL;
nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); if ( pTmpItem )
{
pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
if (pTmpItem)
pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); // get numbering rule corresponding to <nIdx> and apply the needed number formats to <pNumRule>
if (pItem && pNumRule) NBOTypeMgrBase* pNumRuleMgr =
{ NBOutlineTypeMgrFact::CreateInstance(
sal_uInt16 nIdx = pItem->GetValue(); nSId == FN_SVX_SET_BULLET ? eNBOType::MIXBULLETS : eNBOType::NUMBERING );
// If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off if ( pNumRuleMgr )
// And the bullet default status is 2.
bool bBulletSwitch = false;
sal_Bool isRemoveNum =false;
if( nIdx == (sal_uInt16)0xFFFF )
{ {
nIdx = 1; sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
bBulletSwitch = true; const SfxPoolItem* pNumLevelItem = NULL;
} if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pNumLevelItem))
if (nIdx == DEFAULT_NONE) nActNumLvl = ((const SfxUInt16Item*)pNumLevelItem)->GetValue();
{
bBulletSwitch = false;
isRemoveNum = true;
}
nIdx--; pNumRuleMgr->SetItems(&aNewAttr);
//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.8.7
NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
if ( pBullets )
{
//Sym3_2508, set unit attribute to NB Manager
pBullets->SetItems(&aNewAttr);
SvxNumRule aTmpRule( *pNumRule ); SvxNumRule aTmpRule( *pNumRule );
//Sym3_3423 Always apply the "." if wants a default numbering rule if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
if (bBulletSwitch==true && nIdx==0) //want to reset bullet
{ {
pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true); // for toggling bullets get default numbering rule
pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
} }
else { else
pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl); {
pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl );
} }
sal_uInt16 nMask = 1; sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
{ {
@@ -381,59 +238,66 @@ void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
} }
nMask <<= 1; nMask <<= 1;
} }
aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId);
OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
if (mpView->ISA(OutlineView))
{
pOLV = static_cast<OutlineView*>(mpView)
->GetViewByWindow(mpViewShell->GetActiveWindow());
aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
}
SdrOutliner* pOwner = mpView->GetTextEditOutliner();
bool bMasterView = false;
DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell);
if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE )
bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
if( bMasterView )
{
pOwner->UndoActionStart( OLUNDO_ATTR );
pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum );
mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151
pOwner->UndoActionEnd( OLUNDO_ATTR );
}
else if( pOLV )
pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum );
else
{
sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
SdrModel* pSdrModel = mpView->GetModel();
sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False;
if (bInMasterView && bModelUndoEnabled)
{
pSdrModel->BegUndo();
}
mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_True, bInMasterView, pNumRule, isRemoveNum );
if (bInMasterView)
{
mpView->SetAttributes(aSetAttr);
}
if (bInMasterView && bModelUndoEnabled)
{
pSdrModel->EndUndo();
}
}
} }
//End
} }
OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
{
if (mpView->ISA(OutlineView))
{
pOLV = static_cast<OutlineView*>(mpView)
->GetViewByWindow(mpViewShell->GetActiveWindow());
aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
}
}
SdrOutliner* pOwner = bInMasterView ? mpView->GetTextEditOutliner() : 0;
const bool bOutlinerUndoEnabled = pOwner && !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
SdrModel* pSdrModel = bInMasterView ? mpView->GetModel() : 0;
const bool bModelUndoEnabled = pSdrModel && pSdrModel->IsUndoEnabled();
if ( bOutlinerUndoEnabled )
{
pOwner->UndoActionStart( OLUNDO_ATTR );
}
else if ( bModelUndoEnabled )
{
pSdrModel->BegUndo();
}
if ( pOLV )
{
if ( bSwitchOff )
{
pOLV->SwitchOffBulletsNumbering( true );
}
else
{
pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule );
}
}
else
{
mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule, bSwitchOff );
}
if ( bInMasterView )
{
SfxItemSet aSetAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END );
aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId);
mpView->SetAttributes(aSetAttr);
}
if( bOutlinerUndoEnabled )
{
pOwner->UndoActionEnd( OLUNDO_ATTR );
}
else if ( bModelUndoEnabled )
{
pSdrModel->EndUndo();
}
delete pNumRule; delete pNumRule;
rReq.Done(); rReq.Done();
} }

View File

@@ -194,8 +194,31 @@ public:
virtual void CheckPossibilities(); virtual void CheckPossibilities();
virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark); virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
using SdrMarkView::MarkPoints; using SdrMarkView::MarkPoints;
sal_Bool ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet);
void ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false); bool ShouldToggleOn(
const bool bBulletOnOffMode,
const bool bNormalBullet);
/** change the bullets/numbering of the marked objects
@param bToggle
true: just toggle the current bullets/numbering on --> off resp. off --> on
@param bHandleBullets
true: handle bullets
false: handle numbering
@param pNumRule
numbering rule which needs to be applied. can be 0.
@param bSwitchOff
true: switch off bullets/numbering
*/
void ChangeMarkedObjectsBulletsNumbering(
const bool bToggle,
const bool bHandleBullets,
const SvxNumRule* pNumRule,
const bool bSwitchOff);
void SetPossibilitiesDirty() { bPossibilitiesDirty = true; } void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; } void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }

View File

@@ -44,8 +44,6 @@ public:
static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
virtual void DoExecute( SfxRequest& rReq ); virtual void DoExecute( SfxRequest& rReq );
void SetCurrentBullet(SfxRequest& rReq);
void SetCurrentNumbering(SfxRequest& rReq);
private: private:
FuOutlineBullet ( FuOutlineBullet (
@@ -55,6 +53,8 @@ private:
SdDrawDocument* pDoc, SdDrawDocument* pDoc,
SfxRequest& rReq); SfxRequest& rReq);
void SetCurrentBulletsNumbering(SfxRequest& rReq);
const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId); const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
}; };

View File

@@ -318,7 +318,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
case FN_NUM_BULLET_ON: case FN_NUM_BULLET_ON:
if( pOLV ) if( pOLV )
pOLV->ToggleBullets(); pOLV->ToggleBullets();
break; break;
case SID_GROW_FONT_SIZE: case SID_GROW_FONT_SIZE:
case SID_SHRINK_FONT_SIZE: case SID_SHRINK_FONT_SIZE:

View File

@@ -1230,7 +1230,9 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
} }
} }
sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet) bool View::ShouldToggleOn(
const bool bBulletOnOffMode,
const bool bNormalBullet)
{ {
// If setting bullets/numbering by the dialog, always should toggle on. // If setting bullets/numbering by the dialog, always should toggle on.
if (!bBulletOnOffMode) if (!bBulletOnOffMode)
@@ -1294,23 +1296,29 @@ sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet)
return bToggleOn; return bToggleOn;
} }
void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) void View::ChangeMarkedObjectsBulletsNumbering(
const bool bToggle,
const bool bHandleBullets,
const SvxNumRule* pNumRule,
const bool bSwitchOff )
{ {
SdrModel* pSdrModel = GetModel(); SdrModel* pSdrModel = GetModel();
Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice()); Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
if (!pSdrModel || !pWindow) if (!pSdrModel || !pWindow)
return; return;
sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled(); const bool bUndoEnabled = pSdrModel->IsUndoEnabled();
sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet); SdrUndoGroup* pUndoGroup = bUndoEnabled ? new SdrUndoGroup(*pSdrModel) : 0;
if ( bForceBulletOnOff ) {
bToggleOn = bBulletOnOffMode; const bool bToggleOn =
} bSwitchOff
SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel); ? false
: ShouldToggleOn( bToggle, bHandleBullets );
SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow); OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
sal_uInt32 nMarkCount = GetMarkedObjectCount(); const sal_uInt32 nMarkCount = GetMarkedObjectCount();
for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
{ {
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
@@ -1348,7 +1356,14 @@ void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNorma
SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nCellIndex)); SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nCellIndex));
pUndoGroup->AddAction(pTxtUndo); pUndoGroup->AddAction(pTxtUndo);
} }
pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); if ( !bToggleOn )
{
pOutlinerView->SwitchOffBulletsNumbering();
}
else
{
pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
}
sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
pOutliner->Clear(); pOutliner->Clear();
@@ -1372,23 +1387,27 @@ void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNorma
SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0)); SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0));
pUndoGroup->AddAction(pTxtUndo); pUndoGroup->AddAction(pTxtUndo);
} }
pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); if ( !bToggleOn )
{
pOutlinerView->SwitchOffBulletsNumbering();
}
else
{
pOutlinerView->ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle );
}
sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
pOutliner->Clear(); pOutliner->Clear();
} }
} }
if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled) if ( bUndoEnabled && pUndoGroup->GetActionCount() > 0 )
{ {
pSdrModel->BegUndo(); pSdrModel->BegUndo();
pSdrModel->AddUndo(pUndoGroup); pSdrModel->AddUndo(pUndoGroup);
pSdrModel->EndUndo(); pSdrModel->EndUndo();
} }
else
{
delete pUndoGroup;
}
delete pOutliner; delete pOutliner;
delete pOutlinerView; delete pOutlinerView;
} }

View File

@@ -1018,52 +1018,71 @@ void ParaPropertyPanel::NotifyItemUpdate(
{ {
(void)bIsEnabled; (void)bIsEnabled;
if( nSID == SID_ATTR_METRIC ) switch (nSID)
{ {
m_eMetricUnit = GetCurrentUnit(eState,pState); case SID_ATTR_METRIC:
if( m_eMetricUnit!=m_last_eMetricUnit )
{ {
SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit ); m_eMetricUnit = GetCurrentUnit(eState,pState);
SetFieldUnit( *maRightIndent.get(), m_eMetricUnit ); if( m_eMetricUnit!=m_last_eMetricUnit )
SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit ); {
SetFieldUnit( *maTopDist.get(), m_eMetricUnit ); SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit );
SetFieldUnit( *maBottomDist.get(), m_eMetricUnit ); SetFieldUnit( *maRightIndent.get(), m_eMetricUnit );
SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit );
SetFieldUnit( *maTopDist.get(), m_eMetricUnit );
SetFieldUnit( *maBottomDist.get(), m_eMetricUnit );
}
m_last_eMetricUnit = m_eMetricUnit;
} }
m_last_eMetricUnit = m_eMetricUnit; break;
}
if( nSID == SID_ATTR_PARA_LRSPACE ) case SID_ATTR_PARA_LRSPACE:
StateChangedIndentImpl( nSID, eState, pState ); StateChangedIndentImpl( nSID, eState, pState );
break;
if( nSID == SID_ATTR_PARA_LINESPACE ) case SID_ATTR_PARA_LINESPACE:
StateChangedLnSPImpl( nSID, eState, pState ); StateChangedLnSPImpl( nSID, eState, pState );
break;
if( nSID == SID_ATTR_PARA_ULSPACE) case SID_ATTR_PARA_ULSPACE:
StateChangedULImpl( nSID, eState, pState ); StateChangedULImpl( nSID, eState, pState );
break;
if (nSID==SID_ATTR_PARA_ADJUST_LEFT || nSID==SID_ATTR_PARA_ADJUST_CENTER || nSID==SID_ATTR_PARA_ADJUST_RIGHT || nSID==SID_ATTR_PARA_ADJUST_BLOCK) case SID_ATTR_PARA_ADJUST_LEFT:
case SID_ATTR_PARA_ADJUST_CENTER:
case SID_ATTR_PARA_ADJUST_RIGHT:
case SID_ATTR_PARA_ADJUST_BLOCK:
StateChangedAlignmentImpl( nSID, eState, pState ); StateChangedAlignmentImpl( nSID, eState, pState );
break;
if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT) case SID_OUTLINE_LEFT:
case SID_OUTLINE_RIGHT:
StateChangeOutLineImpl( nSID, eState, pState ); StateChangeOutLineImpl( nSID, eState, pState );
break;
if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT) case SID_INC_INDENT:
case SID_DEC_INDENT:
StateChangeIncDecImpl( nSID, eState, pState ); StateChangeIncDecImpl( nSID, eState, pState );
// Add toggle state for numbering and bullet icons break;
if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON)
case FN_NUM_NUMBERING_ON:
case FN_NUM_BULLET_ON:
StateChangeBulletNumImpl( nSID, eState, pState ); StateChangeBulletNumImpl( nSID, eState, pState );
break;
//Get the num rule index data of the current selection case FN_BUL_NUM_RULE_INDEX:
if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) case FN_NUM_NUM_RULE_INDEX:
StateChangeBulletNumRuleImpl( nSID, eState, pState ); StateChangeBulletNumRuleImpl( nSID, eState, pState );
break;
if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) case SID_TABLE_VERT_NONE:
{ case SID_TABLE_VERT_CENTER:
case SID_TABLE_VERT_BOTTOM:
VertStateChanged( nSID, eState, pState); VertStateChanged( nSID, eState, pState);
} break;
else if (nSID == SID_BACKGROUND_COLOR)
{ case SID_BACKGROUND_COLOR:
ParaBKGStateChanged(nSID, eState, pState); ParaBKGStateChanged(nSID, eState, pState);
break;
} }
} }
@@ -1400,25 +1419,19 @@ void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState
{ {
if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) ) if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) )
{ {
const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
const sal_Bool aBool = (sal_Bool)pItem->GetValue();
if (nSID==FN_NUM_NUMBERING_ON) if (nSID==FN_NUM_NUMBERING_ON)
{ {
const SfxBoolItem* pItem= (const SfxBoolItem*)pState; maTBxNumBullet->SetItemState(
sal_Bool aBool = (sal_Bool)pItem->GetValue(); IID_NUMBER,
if (aBool) { aBool ? STATE_CHECK : STATE_NOCHECK );
maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK);
} else {
maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK);
}
} }
else if (nSID==FN_NUM_BULLET_ON) else if (nSID==FN_NUM_BULLET_ON)
{ {
const SfxBoolItem* pItem= (const SfxBoolItem*)pState; maTBxNumBullet->SetItemState(
sal_Bool aBool = (sal_Bool)pItem->GetValue(); IID_BULLET,
if (aBool) { aBool ? STATE_CHECK : STATE_NOCHECK );
maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK);
} else {
maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK);
}
} }
} }
} }