summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2013-05-29 08:10:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-30 14:28:48 +0100
commit0ff751efaa49a5b3d22d324a43527bfd21e5a17c (patch)
tree3bd7a230b3cb974dd85749edaf88a4002d57d112
parent20824c118f21c1aad2672630f1c2ed7eecf5d2dd (diff)
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
-rw-r--r--editeng/source/outliner/outleeng.cxx2
-rw-r--r--editeng/source/outliner/outlin2.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx88
-rw-r--r--editeng/source/outliner/outlvw.cxx446
-rw-r--r--include/editeng/outliner.hxx64
-rw-r--r--sd/source/core/drawdoc4.cxx10
-rw-r--r--sd/source/ui/func/fuolbull.cxx358
-rw-r--r--sd/source/ui/inc/View.hxx27
-rw-r--r--sd/source/ui/inc/fuolbull.hxx4
-rw-r--r--sd/source/ui/view/drtxtob1.cxx2
-rw-r--r--sd/source/ui/view/sdview.cxx51
-rw-r--r--svx/source/sidebar/paragraph/ParaPropertyPanel.cxx91
12 files changed, 530 insertions, 615 deletions
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index 858b22b6c72a..6418310ea914 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -69,7 +69,7 @@ Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara )
Rectangle aBulletArea = Rectangle( Point(), Point() );
if ( nPara < pOwner->pParaList->GetParagraphCount() )
{
- if ( pOwner->ImplHasBullet( nPara ) )
+ if ( pOwner->ImplHasNumberFormat( nPara ) )
aBulletArea = pOwner->ImpCalcBulletArea( nPara, sal_False, sal_False );
}
return aBulletArea;
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index b3fe7dbd647b..a5251a1c5d46 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -520,7 +520,7 @@ sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bo
{
Point aDocPos = GetDocPos( rPaperPos );
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 );
if ( aBulArea.IsInside( rPaperPos ) )
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 43e0b69b34c2..db6915d29cce 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -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;
- sal_uInt32 nParaCount = (sal_uInt32)(pParaList->GetParagraphCount());
- for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++)
+ if ( nParaStart > nParaEnd
+ || nParaEnd >= pParaList->GetParagraphCount() )
{
- 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;
}
- }
- sal_uInt16 nBulletsCount = 0;
- sal_uInt16 nNumberingCount = 0;
- if (bHasBulletsNumbering)
- {
- // At least have one paragraph that having bullets or numbering.
- for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++)
+ const SvxNumberFormat* pFmt = GetNumberFormat(nPara);
+ if (!pFmt)
{
- Paragraph* pPara = pParaList->GetParagraph(nPara);
- if (!pPara)
- {
- continue;
- }
- const SvxNumberFormat* pFmt = GetNumberFormat(nPara);
- if (!pFmt)
- {
- // At least, exists one paragraph that has no Bullets/Numbering.
- break;
- }
- else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL))
- {
- // Having Bullets in this paragraph.
- nBulletsCount++;
- }
- else
- {
- // Having Numbering in this paragraph.
- nNumberingCount++;
- }
+ // At least, exists one paragraph that has no Bullets/Numbering.
+ break;
}
+ else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL))
+ {
+ // Having Bullets in this paragraph.
+ nBulletsCount++;
+ }
+ else
+ {
+ // Having Numbering in this paragraph.
+ nNumberingCount++;
+ }
+ }
+
+ const sal_Int32 nParaCount = nParaEnd - nParaStart + 1;
+ if ( nBulletsCount == nParaCount )
+ {
+ return 0;
+ }
+ else if ( nNumberingCount == nParaCount )
+ {
+ return 1;
}
- sal_Int32 nValue = (nBulletsCount == nParaCount) ? 0 : 2;
- nValue = (nNumberingCount == nParaCount) ? 1 : nValue;
- return nValue;
+ 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
@@ -944,7 +954,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
bDrawBullet = rBulletState.GetValue() ? true : false;
}
- if ( ImplHasBullet( nPara ) && bDrawBullet)
+ if ( ImplHasNumberFormat( nPara ) && bDrawBullet)
{
sal_Bool bVertical = IsVertical();
@@ -1467,7 +1477,7 @@ sal_Bool Outliner::HasChildren( Paragraph* pParagraph ) const
return pParaList->HasChildren( pParagraph );
}
-sal_Bool Outliner::ImplHasBullet( sal_Int32 nPara ) const
+bool Outliner::ImplHasNumberFormat( sal_Int32 nPara ) const
{
return GetNumberFormat(nPara) != 0;
}
@@ -1711,7 +1721,7 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
EBulletInfo aInfo;
aInfo.nParagraph = nPara;
- aInfo.bVisible = ImplHasBullet( nPara );
+ aInfo.bVisible = ImplHasNumberFormat( nPara );
const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0;
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 38ec5e63101c..c1b8fa8bd255 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/i18n/WordType.hpp>
#include <svl/intitem.hxx>
+#include <svl/itempool.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/editdata.hxx>
@@ -169,7 +170,7 @@ sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin )
bKeyProcessed = sal_True;
}
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) );
bKeyProcessed = sal_True;
@@ -886,7 +887,8 @@ void OutlinerView::ToggleBullets()
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
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++ )
{
@@ -895,25 +897,52 @@ void OutlinerView::ToggleBullets()
if( pPara )
{
- if( nDepth == -2 )
- nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
+ if( nNewDepth == -2 )
+ {
+ 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 );
- if(rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
+ if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET )
{
SfxItemSet aAttrs(rAttrs);
aAttrs.ClearItem( EE_PARA_BULLETSTATE );
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 );
sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
@@ -924,204 +953,46 @@ void OutlinerView::ToggleBullets()
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() );
aSel.Adjust();
- const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
- pOwner->pEditEngine->SetUpdateMode( sal_False );
-
- sal_Int16 nDepth = -2;
- sal_Bool bRet = sal_False;
-
- //Modified by xuezhiy for bullet enhancement
- bool bBulletOn = sal_True;
-
- if( bBulletOnOff )
+ bool bToggleOn = true;
+ if ( bToggle )
{
- bool bHasBullet = sal_False;
- for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+ bToggleOn = false;
+ const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
+ if ( nBulletNumberingStatus != 0 && bHandleBullets )
{
- bHasBullet = pOwner->ImplHasBullet(nPara);
- if(bHasBullet)
- break;
+ // not all paragraphs have bullets and method called to toggle bullets --> bullets on
+ bToggleOn = true;
}
-
- if( bHasBullet )
+ else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
{
- bBulletOn = sal_False;
-
- 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;
- }
- }
- }
- }
+ // not all paragraphs have numbering and method called to toggle numberings --> numberings on
+ bToggleOn = true;
}
-
}
- if (bForceBulletOnOff) {
- bBulletOn = bBulletOnOff;
+ if ( bToggleOn )
+ {
+ // apply bullets/numbering for selected paragraphs
+ ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
}
- for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+ else
{
- Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
-
- if( pPara )
- {
- bRet = sal_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 );
-
- }
+ // switch off bullets/numbering for selected paragraphs
+ SwitchOffBulletsNumbering( true );
}
- // --> OD 2009-03-10 #i100014#
- // 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;
+ return;
}
+
void OutlinerView::EnableBullets()
{
pOwner->UndoActionStart( OLUNDO_DEPTH );
@@ -1135,7 +1006,7 @@ void OutlinerView::EnableBullets()
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; 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) )
{
@@ -1154,127 +1025,192 @@ void OutlinerView::EnableBullets()
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)
{
- return sal_False;
+ return;
}
- sal_Bool bReturn = sal_False;
pOwner->UndoActionStart(OLUNDO_DEPTH);
const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
pOwner->pEditEngine->SetUpdateMode(sal_False);
- sal_Int16 nDepth = -2;
- sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount());
- for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ 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;
+ }
+
+ for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
{
Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
- DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?");
+ DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
if (pPara)
{
- bReturn = sal_True;
- nDepth = pOwner->GetDepth(nPara);
- if (bToggleOn && nDepth == -1)
- {
- // Off ==>> On
- nDepth = 0;
- }
- else if (!bToggleOn && nDepth == 0)
+ const sal_Int16 nDepth = pOwner->GetDepth(nPara);
+ if ( nDepth == -1 )
{
- // On ==>> Off
- nDepth = -1;
+ pOwner->SetDepth( pPara, 0 );
}
- pOwner->SetDepth(pPara, nDepth);
const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
SfxItemSet aAttrs(rAttrs);
- aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn));
+ aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true));
- // Change bullet types.
- if (bToggleOn && pNumRule)
+ // apply new numbering rule
+ if ( pNewNumRule )
{
- sal_Bool bSetBulletType = sal_False;
- if (!bBulletOnOffMode)
+ bool bApplyNumRule = false;
+ if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
{
- // Not bullet on/off button.
- bSetBulletType = sal_True;
+ bApplyNumRule = true;
}
else
{
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
if (!pFmt)
{
- // Has no bullet.
- bSetBulletType = sal_True;
+ bApplyNumRule = true;
}
else
{
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.
- 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.
- bSetBulletType = sal_True;
+ bApplyNumRule = true;
}
}
}
- // Get old bullet space.
- 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.
- pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
- }
-
- const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
- if (pNumBulletItem)
+ if ( bApplyNumRule )
{
- sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
- nLevelCnt = std::min(nLevelCnt, pNumRule->GetLevelCount());
+ SvxNumRule aNewRule(*pNewNumRule);
- for (sal_uInt16 nLevel = 0; nLevel < nLevelCnt; nLevel++)
+ // Get old bullet space.
{
- const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
- const SvxNumberFormat* pNewFmt = pNumRule->Get(nLevel);
- if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
+ const SfxPoolItem* pPoolItem=NULL;
+ SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
+ if (eState != SFX_ITEM_SET)
{
- SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
- pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
- pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
- aNewRule.SetLevel(nLevel, pNewFmtClone);
- delete pNewFmtClone;
+ // 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);
+ 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);
+ }
}
pOwner->SetParaAttribs(nPara, aAttrs);
}
}
- pOwner->ImplCheckParagraphs(0, nParaCount);
- pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0));
- pOwner->pEditEngine->SetUpdateMode(bUpdate);
- pOwner->UndoActionEnd(OLUNDO_DEPTH);
+ const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
+ pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
+ pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
- 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 )
{
RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 8b4b92e32550..c9c0b0bc1a23 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -329,12 +329,44 @@ public:
const SvxFieldItem* GetFieldUnderMousePointer() const;
const SvxFieldItem* GetFieldAtSelection() const;
- /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
- or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
+ /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
+ or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
*/
- 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 ToggleBullets();
+
+ 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
paragraphs that already have numbering enabled.
*/
@@ -608,7 +640,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
DECL_LINK( EditEngineNotifyHdl, EENotify* );
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 );
sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt );
void ImplCalcBulletText( sal_Int32 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
@@ -989,7 +1021,25 @@ public:
virtual sal_Bool IsParaIsNumberingRestart( sal_Int32 nPara );
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
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 52dc47109979..040413c20f5b 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -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);
- aNumberFormat.SetLSpace( 0 );
- aNumberFormat.SetAbsLSpace( 0 );
- aNumberFormat.SetFirstLineOffset( 0 );
- aNumRule.SetLevel( 0, aNumberFormat );
+ //aNumberFormat.SetLSpace( 0 );
+ //aNumberFormat.SetAbsLSpace( 0 );
+ //aNumberFormat.SetFirstLineOffset( 0 );
+ //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;
aNumberFormat.SetLSpace(nLSpace);
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index c029edabac7a..5bbf4e24c226 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -61,13 +61,10 @@ FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWi
void FuOutlineBullet::DoExecute( SfxRequest& rReq )
{
- sal_uInt16 nSId = rReq.GetSlot();
- if (nSId == FN_SVX_SET_BULLET){
- SetCurrentBullet(rReq);
- return;
- }
- else if (nSId == FN_SVX_SET_NUMBER){
- SetCurrentNumbering(rReq);
+ const sal_uInt16 nSId = rReq.GetSlot();
+ if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
+ {
+ SetCurrentBulletsNumbering(rReq);
return;
}
@@ -137,32 +134,44 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq )
*/
}
-void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq)
+void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
{
if (!mpDoc || !mpView)
return;
- SfxItemSet aEditAttr( mpDoc->GetPool() );
- mpView->GetAttributes( aEditAttr );
+ const sal_uInt16 nSId = rReq.GetSlot();
+ if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
+ {
+ // unexpected SfxRequest
+ return;
+ }
- SfxItemSet aNewAttr( mpViewShell->GetPool(),
- EE_ITEMS_START, EE_ITEMS_END );
- aNewAttr.Put( aEditAttr, sal_False );
+ SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSId, sal_False );
+ if ( !pItem )
+ {
+ rReq.Done();
+ return;
+ }
- SfxItemSet aSetAttr( mpViewShell->GetPool(),
- EE_ITEMS_START, EE_ITEMS_END );
+ SfxItemSet aNewAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END );
+ {
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+ aNewAttr.Put( aEditAttr, sal_False );
+ }
+ const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
//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 )
+ const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+ if ( bInMasterView )
{
SdrObject* pObj = mpView->GetTextEditObject();
if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
{
- sal_uInt16 nLevel = mpView->GetSelectionLevel();
+ const sal_uInt16 nLevel = mpView->GetSelectionLevel();
if( nLevel != 0xFFFF )
{
-
+ //save the itemset value
SfxItemSet aStoreSet( aNewAttr );
aNewAttr.ClearItem();
//extend range
@@ -173,204 +182,52 @@ void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq)
}
}
}
- //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();
+ bool bToggle = false;
+ bool bSwitchOff = false;
+ if( nIdx == (sal_uInt16)0xFFFF )
{
- 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
+ nIdx = 1;
+ bToggle = true;
}
- delete pNumRule;
- rReq.Done();
-}
-
-void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
-{
- if (!mpDoc || !mpView)
- return;
-
- SfxItemSet aEditAttr( mpDoc->GetPool() );
- mpView->GetAttributes( aEditAttr );
-
- SfxItemSet aNewAttr( mpViewShell->GetPool(),
- EE_ITEMS_START, EE_ITEMS_END );
- aNewAttr.Put( aEditAttr, sal_False );
-
- //Add for Sym2_3151, should add new attributes in an empty item set, then use this item set as parameter in SetAttributes()
- 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 )
+ else if (nIdx == DEFAULT_NONE)
{
- SdrObject* pObj = mpView->GetTextEditObject();
- if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
- {
- sal_uInt16 nLevel = mpView->GetSelectionLevel();
- 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
- 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 ) );
- }
- }
+ bSwitchOff = true;
}
- //End of add
+ nIdx--;
- 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)
+ const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
+ SvxNumRule* pNumRule = NULL;
+ if ( pTmpItem )
+ {
pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
- SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , 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 2.
- bool bBulletSwitch = false;
- sal_Bool isRemoveNum =false;
- if( nIdx == (sal_uInt16)0xFFFF )
+ // get numbering rule corresponding to <nIdx> and apply the needed number formats to <pNumRule>
+ NBOTypeMgrBase* pNumRuleMgr =
+ NBOutlineTypeMgrFact::CreateInstance(
+ nSId == FN_SVX_SET_BULLET ? eNBOType::MIXBULLETS : eNBOType::NUMBERING );
+ if ( pNumRuleMgr )
{
- nIdx = 1;
- bBulletSwitch = true;
- }
- if (nIdx == DEFAULT_NONE)
- {
- bBulletSwitch = false;
- isRemoveNum = true;
- }
-
- nIdx--;
- //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.8.7
+ sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
+ const SfxPoolItem* pNumLevelItem = NULL;
+ if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pNumLevelItem))
+ nActNumLvl = ((const SfxUInt16Item*)pNumLevelItem)->GetValue();
- NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
- if ( pBullets )
- {
- //Sym3_2508, set unit attribute to NB Manager
- pBullets->SetItems(&aNewAttr);
+ pNumRuleMgr->SetItems(&aNewAttr);
SvxNumRule aTmpRule( *pNumRule );
- //Sym3_3423 Always apply the "." if wants a default numbering rule
- if (bBulletSwitch==true && nIdx==0) //want to reset bullet
+ if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
{
- pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true);
+ // for toggling bullets get default numbering rule
+ pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
}
- else {
- pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl);
+ else
+ {
+ pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl );
}
+
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
{
@@ -381,59 +238,66 @@ void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq)
}
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) ) );
- }
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+ boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard;
+ {
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)
+ ->GetViewByWindow(mpViewShell->GetActiveWindow());
- SdrOutliner* pOwner = mpView->GetTextEditOutliner();
- bool bMasterView = false;
+ aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+ }
+ }
- DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell);
+ 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 ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE )
- bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
+ if ( bOutlinerUndoEnabled )
+ {
+ pOwner->UndoActionStart( OLUNDO_ATTR );
+ }
+ else if ( bModelUndoEnabled )
+ {
+ pSdrModel->BegUndo();
+ }
- 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();
- }
- }
+ if ( pOLV )
+ {
+ if ( bSwitchOff )
+ {
+ pOLV->SwitchOffBulletsNumbering( true );
}
- //End
+ 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;
rReq.Done();
}
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 6fc9dd178e09..03e2de29b655 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -194,8 +194,31 @@ public:
virtual void CheckPossibilities();
virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
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 SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx
index 995cda6b9e86..96977b96a2eb 100644
--- a/sd/source/ui/inc/fuolbull.hxx
+++ b/sd/source/ui/inc/fuolbull.hxx
@@ -44,8 +44,6 @@ public:
static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
virtual void DoExecute( SfxRequest& rReq );
- void SetCurrentBullet(SfxRequest& rReq);
- void SetCurrentNumbering(SfxRequest& rReq);
private:
FuOutlineBullet (
@@ -55,6 +53,8 @@ private:
SdDrawDocument* pDoc,
SfxRequest& rReq);
+ void SetCurrentBulletsNumbering(SfxRequest& rReq);
+
const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
};
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 20fcad0af901..572fbed1b854 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -318,7 +318,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
case FN_NUM_BULLET_ON:
if( pOLV )
pOLV->ToggleBullets();
- break;
+ break;
case SID_GROW_FONT_SIZE:
case SID_SHRINK_FONT_SIZE:
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index ae233e96d612..bf342e0ea476 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -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 (!bBulletOnOffMode)
@@ -1294,23 +1296,29 @@ sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet)
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();
Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
if (!pSdrModel || !pWindow)
return;
- sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled();
- sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet);
- if ( bForceBulletOnOff ) {
- bToggleOn = bBulletOnOffMode;
- }
- SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel);
+ const bool bUndoEnabled = pSdrModel->IsUndoEnabled();
+ SdrUndoGroup* pUndoGroup = bUndoEnabled ? new SdrUndoGroup(*pSdrModel) : 0;
+
+ const bool bToggleOn =
+ bSwitchOff
+ ? false
+ : ShouldToggleOn( bToggle, bHandleBullets );
+
SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
- sal_uInt32 nMarkCount = GetMarkedObjectCount();
+ const sal_uInt32 nMarkCount = GetMarkedObjectCount();
for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; 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));
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();
pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
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));
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();
pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
pOutliner->Clear();
}
}
- if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled)
+ if ( bUndoEnabled && pUndoGroup->GetActionCount() > 0 )
{
pSdrModel->BegUndo();
pSdrModel->AddUndo(pUndoGroup);
pSdrModel->EndUndo();
}
- else
- {
- delete pUndoGroup;
- }
+
delete pOutliner;
delete pOutlinerView;
}
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 7eff61779c86..9bf443b6af46 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -1018,52 +1018,71 @@ void ParaPropertyPanel::NotifyItemUpdate(
{
(void)bIsEnabled;
- if( nSID == SID_ATTR_METRIC )
+ switch (nSID)
{
- m_eMetricUnit = GetCurrentUnit(eState,pState);
- if( m_eMetricUnit!=m_last_eMetricUnit )
+ case SID_ATTR_METRIC:
{
- SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit );
- SetFieldUnit( *maRightIndent.get(), m_eMetricUnit );
- SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit );
- SetFieldUnit( *maTopDist.get(), m_eMetricUnit );
- SetFieldUnit( *maBottomDist.get(), m_eMetricUnit );
+ m_eMetricUnit = GetCurrentUnit(eState,pState);
+ if( m_eMetricUnit!=m_last_eMetricUnit )
+ {
+ SetFieldUnit( *maLeftIndent.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 );
+ break;
- if( nSID == SID_ATTR_PARA_LINESPACE )
+ case SID_ATTR_PARA_LINESPACE:
StateChangedLnSPImpl( nSID, eState, pState );
+ break;
- if( nSID == SID_ATTR_PARA_ULSPACE)
+ case SID_ATTR_PARA_ULSPACE:
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 );
+ break;
- if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT)
+ case SID_OUTLINE_LEFT:
+ case SID_OUTLINE_RIGHT:
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 );
- // Add toggle state for numbering and bullet icons
- if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON)
+ break;
+
+ case FN_NUM_NUMBERING_ON:
+ case FN_NUM_BULLET_ON:
StateChangeBulletNumImpl( nSID, eState, pState );
+ break;
- //Get the num rule index data of the current selection
- if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX)
+ case FN_BUL_NUM_RULE_INDEX:
+ case FN_NUM_NUM_RULE_INDEX:
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);
- }
- else if (nSID == SID_BACKGROUND_COLOR)
- {
+ break;
+
+ case SID_BACKGROUND_COLOR:
ParaBKGStateChanged(nSID, eState, pState);
+ break;
}
}
@@ -1400,25 +1419,19 @@ void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState
{
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)
{
- const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
- sal_Bool aBool = (sal_Bool)pItem->GetValue();
- if (aBool) {
- maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK);
- } else {
- maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK);
- }
+ maTBxNumBullet->SetItemState(
+ IID_NUMBER,
+ aBool ? STATE_CHECK : STATE_NOCHECK );
}
else if (nSID==FN_NUM_BULLET_ON)
{
- const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
- sal_Bool aBool = (sal_Bool)pItem->GetValue();
- if (aBool) {
- maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK);
- } else {
- maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK);
- }
+ maTBxNumBullet->SetItemState(
+ IID_BULLET,
+ aBool ? STATE_CHECK : STATE_NOCHECK );
}
}
}