You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2013/05/29 10:10:49 UTC

svn commit: r1487394 - in /openoffice/trunk/main: editeng/inc/editeng/ editeng/source/outliner/ sd/source/core/ sd/source/ui/func/ sd/source/ui/inc/ sd/source/ui/view/ svx/source/sidebar/paragraph/

Author: orw
Date: Wed May 29 08:10:49 2013
New Revision: 1487394

URL: http://svn.apache.org/r1487394
Log:
122096: - <OutlinerView::ToggleBullets()> - apply default bullet numbering rule on toggle on, if the current numbering r
ule 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

Modified:
    openoffice/trunk/main/editeng/inc/editeng/outliner.hxx
    openoffice/trunk/main/editeng/source/outliner/outleeng.cxx
    openoffice/trunk/main/editeng/source/outliner/outlin2.cxx
    openoffice/trunk/main/editeng/source/outliner/outliner.cxx
    openoffice/trunk/main/editeng/source/outliner/outlvw.cxx
    openoffice/trunk/main/sd/source/core/drawdoc4.cxx
    openoffice/trunk/main/sd/source/ui/func/fuolbull.cxx
    openoffice/trunk/main/sd/source/ui/inc/View.hxx
    openoffice/trunk/main/sd/source/ui/inc/fuolbull.hxx
    openoffice/trunk/main/sd/source/ui/view/drtxtob1.cxx
    openoffice/trunk/main/sd/source/ui/view/sdview.cxx
    openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx

Modified: openoffice/trunk/main/editeng/inc/editeng/outliner.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/inc/editeng/outliner.hxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/inc/editeng/outliner.hxx (original)
+++ openoffice/trunk/main/editeng/inc/editeng/outliner.hxx Wed May 29 08:10:49 2013
@@ -368,15 +368,47 @@ public:
 	const SvxFieldItem*	GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) 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
-	*/
-	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);
-	/** enables numbering for the selected paragraphs that are not enabled and ignore all selected
-		paragraphs that already have numbering enabled.
-	*/
+    /** 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();
+
+    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.
+    */
     void        EnableBullets();
 
 	sal_Bool        IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
@@ -648,15 +680,16 @@ class EDITENG_DLLPUBLIC Outliner : publi
 	DECL_LINK( 				BeginPasteOrDropHdl, PasteOrDropInfos* );
 	DECL_LINK( 				EndPasteOrDropHdl, PasteOrDropInfos* );
 	DECL_LINK( 				EditEngineNotifyHdl, EENotify* );
-	void 					ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
-	sal_Bool					ImplHasBullet( sal_uInt16 nPara ) const;
-	Size 					ImplGetBulletSize( sal_uInt16 nPara );
-    sal_uInt16              ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
-    void					ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds );
-	String					ImplGetBulletText( sal_uInt16 nPara );
-	void 					ImplCheckNumBulletItem( sal_uInt16 nPara );
-	void 					ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
-	void 					ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
+
+    void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
+    bool ImplHasNumberFormat( sal_uInt16 nPara ) const;
+    Size ImplGetBulletSize( sal_uInt16 nPara );
+    sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
+    void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds );
+    String ImplGetBulletText( sal_uInt16 nPara );
+    void ImplCheckNumBulletItem( sal_uInt16 nPara );
+    void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
+    void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
 
     void                    ImplBlockInsertionCallbacks( sal_Bool b );
 
@@ -1051,7 +1084,25 @@ public:
     virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
     virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
 
-    sal_Int16 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_Int16 GetBulletsNumberingStatus(
+        const sal_uInt16 nParaStart,
+        const sal_uInt16 nParaEnd ) const;
+
+    // convenient method to determine the bullets/numbering status for all paragraphs
+    sal_Int16 GetBulletsNumberingStatus() const;
 };
 
 #endif

Modified: openoffice/trunk/main/editeng/source/outliner/outleeng.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/source/outliner/outleeng.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/source/outliner/outleeng.cxx (original)
+++ openoffice/trunk/main/editeng/source/outliner/outleeng.cxx Wed May 29 08:10:49 2013
@@ -76,7 +76,7 @@ Rectangle OutlinerEditEng::GetBulletArea
 	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;

Modified: openoffice/trunk/main/editeng/source/outliner/outlin2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/source/outliner/outlin2.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/source/outliner/outlin2.cxx (original)
+++ openoffice/trunk/main/editeng/source/outliner/outlin2.cxx Wed May 29 08:10:49 2013
@@ -599,7 +599,7 @@ sal_Bool Outliner::IsTextPos( const Poin
 	{
 		Point aDocPos = GetDocPos( rPaperPos );
 		sal_uInt16 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 ) )

Modified: openoffice/trunk/main/editeng/source/outliner/outliner.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/source/outliner/outliner.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/source/outliner/outliner.cxx (original)
+++ openoffice/trunk/main/editeng/source/outliner/outliner.cxx Wed May 29 08:10:49 2013
@@ -370,51 +370,60 @@ void Outliner::SetParaIsNumberingRestart
     }
 }
 
-sal_Int16 Outliner::GetBulletsNumberingStatus()
+sal_Int16 Outliner::GetBulletsNumberingStatus(
+    const sal_uInt16 nParaStart,
+    const sal_uInt16 nParaEnd ) const
 {
-	sal_Bool bHasBulletsNumbering = FALSE;
-	sal_uInt16 nParaCount = (sal_uInt16)(pParaList->GetParagraphCount());
-	for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
-	{
-		if ((bHasBulletsNumbering = ImplHasBullet(nPara)))
-		{
-			break;
-		}
-	}
-	sal_uInt16 nBulletsCount = 0;
-	sal_uInt16 nNumberingCount = 0;
-	if (bHasBulletsNumbering)
-	{
-		// At least have one paragraph that having bullets or numbering.
-		for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
-		{
-			Paragraph* pPara = pParaList->GetParagraph(nPara);
-			// const SfxItemSet& rAttrs = GetParaAttribs(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++;
-			}
-		}
-	}
-	sal_Int16 nValue = (nBulletsCount == nParaCount) ? 0 : 2;
-	nValue = (nNumberingCount == nParaCount) ? 1 : nValue;
-	return nValue;
+    if ( nParaStart > nParaEnd
+         || nParaEnd >= pParaList->GetParagraphCount() )
+    {
+        DBG_ASSERT( false,"<Outliner::GetBulletsNumberingStatus> - unexpected parameter values" );
+        return 2;
+    }
+
+    sal_uInt16 nBulletsCount = 0;
+    sal_uInt16 nNumberingCount = 0;
+    for (sal_uInt16 nPara = nParaStart; nPara <= nParaEnd; nPara++)
+    {
+        if ( !pParaList->GetParagraph(nPara) )
+        {
+            break;
+        }
+        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++;
+        }
+    }
+
+    const sal_uInt16 nParaCount = nParaEnd - nParaStart + 1;
+    if ( nBulletsCount == nParaCount )
+    {
+        return 0;
+    }
+    else if ( nNumberingCount == nParaCount )
+    {
+        return 1;
+    }
+    return 2;
+}
+
+sal_Int16 Outliner::GetBulletsNumberingStatus() const
+{
+    return pParaList->GetParagraphCount() > 0
+           ? GetBulletsNumberingStatus( 0, pParaList->GetParagraphCount()-1 )
+           : 2;
 }
 
 OutlinerParaObject* Outliner::CreateParaObject( sal_uInt16 nStartPara, sal_uInt16 nCount ) const
@@ -1006,7 +1015,7 @@ void Outliner::PaintBullet( sal_uInt16 n
         bDrawBullet = rBulletState.GetValue() ? true : false;
     }
 
-    if ( ImplHasBullet( nPara ) && bDrawBullet)
+    if ( ImplHasNumberFormat( nPara ) && bDrawBullet)
 	{
 		sal_Bool bVertical = IsVertical();
 
@@ -1507,7 +1516,7 @@ sal_Bool Outliner::HasChilds( Paragraph*
 	return pParaList->HasChilds( pParagraph );
 }
 
-sal_Bool Outliner::ImplHasBullet( sal_uInt16 nPara ) const
+bool Outliner::ImplHasNumberFormat( sal_uInt16 nPara ) const
 {
     return GetNumberFormat(nPara) != 0;
 }
@@ -1756,7 +1765,7 @@ EBulletInfo Outliner::GetBulletInfo( sal
     EBulletInfo aInfo;
 
     aInfo.nParagraph = nPara;
-    aInfo.bVisible = ImplHasBullet( nPara );
+    aInfo.bVisible = ImplHasNumberFormat( nPara ) ? sal_True : sal_False;
 
     const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
     aInfo.nType = pFmt ? pFmt->GetNumberingType() : 0;

Modified: openoffice/trunk/main/editeng/source/outliner/outlvw.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/editeng/source/outliner/outlvw.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/editeng/source/outliner/outlvw.cxx (original)
+++ openoffice/trunk/main/editeng/source/outliner/outlvw.cxx Wed May 29 08:10:49 2013
@@ -188,7 +188,7 @@ sal_Bool OutlinerView::PostKeyEvent( con
 						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;
@@ -1185,408 +1185,334 @@ sal_uInt16 OutlinerView::ImpCalcSelected
 
 void OutlinerView::ToggleBullets()
 {
-	pOwner->UndoActionStart( OLUNDO_DEPTH );
+    pOwner->UndoActionStart( OLUNDO_DEPTH );
 
-	ESelection aSel( pEditView->GetSelection() );
-	aSel.Adjust();
+    ESelection aSel( pEditView->GetSelection() );
+    aSel.Adjust();
 
-	const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
-	pOwner->pEditEngine->SetUpdateMode( sal_False );
+    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_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
-	{
-		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
-		DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
+    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 )
-		{
-			if( nDepth == -2 )
-				nDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
+        if( pPara )
+        {
+            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)
+                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 );
                 }
             }
-		}
-	}
+            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 );
+                    }
+                }
+            }
+        }
+    }
 
-    // --> 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());
-    // <--
+    const 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->pEditEngine->SetUpdateMode( bUpdate );
 
-	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 );
-
-	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 bHasBullet = sal_False;
-		for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
-		{
-			bHasBullet = pOwner->ImplHasBullet(nPara);
-			if(bHasBullet)
-				break;
-		}
-
-		if( bHasBullet )
-		{			
-			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?");
-
-				// const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
-				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) {
-		bBulletOn = bBulletOnOff;
-	}
-	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 )	
-		{			
-			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;
-						}
-					}
-				}
+void OutlinerView::ToggleBulletsNumbering(
+    const bool bToggle,
+    const bool bHandleBullets,
+    const SvxNumRule* pNumRule )
+{
+    ESelection aSel( pEditView->GetSelection() );
+    aSel.Adjust();
 
-				// Get old bullet space
-				SvxNumRule aNewRule( *pNumRule );
+    bool bToggleOn = true;
+    if ( bToggle )
+    {
+        bToggleOn = false;
+        const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
+        if ( nBulletNumberingStatus != 0 && bHandleBullets )
+        {
+            // not all paragraphs have bullets and method called to toggle bullets --> bullets on
+            bToggleOn = true;
+        }
+        else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
+        {
+            // not all paragraphs have numbering and method called to toggle numberings --> numberings on
+            bToggleOn = true;
+        }
+    }
+    if ( bToggleOn )
+    {
+        // apply bullets/numbering for selected paragraphs
+        ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
+    }
+    else
+    {
+        // switch off bullets/numbering for selected paragraphs
+        SwitchOffBulletsNumbering( true );
+    }
 
-				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 );
-				}
+    return;
+}
 
-				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 = 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 );
+void OutlinerView::EnableBullets()
+{
+    pOwner->UndoActionStart( OLUNDO_DEPTH );
 
-						if( pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() 
-							|| pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace() ) )
-						{						
-							SvxNumberFormat* pNewFmtClone = new SvxNumberFormat( *pNewFmt );
-							pNewFmtClone->SetFirstLineOffset( pOldFmt->GetFirstLineOffset() );
-							pNewFmtClone->SetAbsLSpace( pOldFmt->GetAbsLSpace() );
+    ESelection aSel( pEditView->GetSelection() );
+    aSel.Adjust();
 
-							aNewRule.SetLevel( nLevel, pNewFmtClone );
-							delete pNewFmtClone;
-						}
-					}
-				}
+    const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
+    pOwner->pEditEngine->SetUpdateMode( sal_False );
 
-				// 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);
-			}
+    for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
+    {
+        Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
+        DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
 
-			pOwner->SetParaAttribs( nPara, aAttrs );
-			
-		}
-	}
+        if( pPara && (pOwner->GetDepth(nPara) == -1) )
+        {
+            pOwner->SetDepth( pPara, 0 );
+        }
+    }
 
-    // --> 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 );
+    pOwner->pEditEngine->SetUpdateMode( bUpdate );
 
-	return bRet;
+    pOwner->UndoActionEnd( OLUNDO_DEPTH );
 }
 
-void OutlinerView::EnableBullets()
+
+void OutlinerView::ApplyBulletsNumbering(
+    const bool bHandleBullets,
+    const SvxNumRule* pNewNumRule,
+    const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
+    const bool bAtSelection )
 {
-	pOwner->UndoActionStart( OLUNDO_DEPTH );
+    if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
+    {
+        return;
+    }
 
-	ESelection aSel( pEditView->GetSelection() );
-	aSel.Adjust();
+    pOwner->UndoActionStart(OLUNDO_DEPTH);
+    const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
+    pOwner->pEditEngine->SetUpdateMode(sal_False);
+
+    sal_uInt16 nStartPara = 0;
+    sal_uInt16 nEndPara = 0;
+    if ( bAtSelection )
+    {
+        ESelection aSel( pEditView->GetSelection() );
+        aSel.Adjust();
+        nStartPara = aSel.nStartPara;
+        nEndPara = aSel.nEndPara;
+    }
+    else
+    {
+        nStartPara = 0;
+        nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
+    }
 
-	const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
-	pOwner->pEditEngine->SetUpdateMode( sal_False );
+    for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++)
+    {
+        Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+        DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
 
-	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 sal_Int16 nDepth = pOwner->GetDepth(nPara);
+            if ( nDepth == -1 )
+            {
+                pOwner->SetDepth( pPara, 0 );
+            }
 
-		if( pPara && (pOwner->GetDepth(nPara) == -1) )
-		{
-			pOwner->SetDepth( pPara, 0 );
-		}
-	}
+            const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
+            SfxItemSet aAttrs(rAttrs);
+            aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, 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 ) );
+            // apply new numbering rule
+            if ( pNewNumRule )
+            {
+                bool bApplyNumRule = false;
+                if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
+                {
+                    bApplyNumRule = true;
+                }
+                else
+                {
+                    const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
+                    if (!pFmt)
+                    {
+                        bApplyNumRule = true;
+                    }
+                    else
+                    {
+                        sal_Int16 nNumType = pFmt->GetNumberingType();
+                        if ( bHandleBullets
+                             && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
+                        {
+                            // Set to Normal bullet, old bullet type is Numbering bullet.
+                            bApplyNumRule = true;
+                        }
+                        else if ( !bHandleBullets
+                                  && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
+                        {
+                            // Set to Numbering bullet, old bullet type is Normal bullet.
+                            bApplyNumRule = true;
+                        }
+                    }
+                }
 
-	pOwner->pEditEngine->SetUpdateMode( bUpdate );
+                if ( bApplyNumRule )
+                {
+                    SvxNumRule aNewRule(*pNewNumRule);
 
-	pOwner->UndoActionEnd( OLUNDO_DEPTH );
-}
+                    // Get old bullet space.
+                    {
+                        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);
+                        if (pNumBulletItem)
+                        {
+                            const sal_uInt16 nLevelCnt = 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;
+                                }
+                            }
+                        }
+                    }
 
-sal_Bool OutlinerView::ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule)
-{
-	if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
-	{
-		return sal_False;
-	}
+                    aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
+                }
+            }
+            pOwner->SetParaAttribs(nPara, aAttrs);
+        }
+    }
 
-	sal_Bool bReturn = sal_False;
-	pOwner->UndoActionStart(OLUNDO_DEPTH);
-	const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
-	pOwner->pEditEngine->SetUpdateMode(sal_False);
+    const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
+    pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
+    pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
 
-	sal_Int16 nDepth = -2;
-	sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount());
-	for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
-	{
-		Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
-		DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?");
+    pOwner->pEditEngine->SetUpdateMode( bUpdate );
 
-		if (pPara)
-		{
-			bReturn = sal_True;
-			nDepth = pOwner->GetDepth(nPara);
-			if (bToggleOn && nDepth == -1)
-			{
-				// Off ==>> On
-				nDepth = 0;
-			}
-			else if (!bToggleOn && nDepth == 0)
-			{
-				// On ==>> Off
-				nDepth = -1;
-			}
-			pOwner->SetDepth(pPara, nDepth);
+    pOwner->UndoActionEnd( OLUNDO_DEPTH );
 
-			const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
-			SfxItemSet aAttrs(rAttrs);
-			aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn));
+    return;
+}
 
-			// Change bullet types.
-			if (bToggleOn && pNumRule)
-			{
-				sal_Bool bSetBulletType = sal_False;
-				if (!bBulletOnOffMode)
-				{
-					// Not bullet on/off button.
-					bSetBulletType = sal_True;
-				}
-				else
-				{
-					const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
-					if (!pFmt)
-					{
-						// Has no bullet.
-						bSetBulletType = sal_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 = sal_True;
-						}
-						else if (!bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
-						{
-							// Set to Numbering bullet, old bullet type is Normal bullet.
-							bSetBulletType = sal_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);
-				}
+void OutlinerView::SwitchOffBulletsNumbering(
+    const bool bAtSelection )
+{
+    sal_uInt16 nStartPara = 0;
+    sal_uInt16 nEndPara = 0;
+    if ( bAtSelection )
+    {
+        ESelection aSel( pEditView->GetSelection() );
+        aSel.Adjust();
+        nStartPara = aSel.nStartPara;
+        nEndPara = aSel.nEndPara;
+    }
+    else
+    {
+        nStartPara = 0;
+        nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
+    }
 
-				const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
-				if (pNumBulletItem)
-				{
-					sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount();
-					nLevelCnt = Min(nLevelCnt, pNumRule->GetLevelCount());
+    pOwner->UndoActionStart( OLUNDO_DEPTH );
+    const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
+    pOwner->pEditEngine->SetUpdateMode( sal_False );
 
-					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;
-						}
-					}
-				}
+    for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; ++nPara )
+    {
+        Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
+        DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
 
-				// 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);
-		}
-	}
+        if( pPara )
+        {
+            pOwner->SetDepth( pPara, -1 );
 
-	pOwner->ImplCheckParagraphs(0, nParaCount);
-	pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0));
-	pOwner->pEditEngine->SetUpdateMode(bUpdate);
-	pOwner->UndoActionEnd(OLUNDO_DEPTH);
+            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 ) );
 
-	return bReturn;
+    pOwner->pEditEngine->SetUpdateMode( bUpdate );
+    pOwner->UndoActionEnd( OLUNDO_DEPTH );
 }
 
+
 void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
 {
     RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );

Modified: openoffice/trunk/main/sd/source/core/drawdoc4.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/core/drawdoc4.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/core/drawdoc4.cxx (original)
+++ openoffice/trunk/main/sd/source/core/drawdoc4.cxx Wed May 29 08:10:49 2013
@@ -1370,12 +1370,12 @@ void SdDrawDocument::SetTextDefaults() c
 
 	SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10, 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);

Modified: openoffice/trunk/main/sd/source/ui/func/fuolbull.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/func/fuolbull.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/func/fuolbull.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/func/fuolbull.cxx Wed May 29 08:10:49 2013
@@ -76,16 +76,13 @@ FunctionReference FuOutlineBullet::Creat
 
 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);
-		return;
-	}
-	
+    const sal_uInt16 nSId = rReq.GetSlot();
+    if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
+    {
+        SetCurrentBulletsNumbering(rReq);
+        return;
+    }
+
 	const SfxItemSet* pArgs = rReq.GetArgs();
 
 	if( !pArgs )
@@ -153,305 +150,172 @@ void FuOutlineBullet::DoExecute( SfxRequ
 */
 }
 
-void FuOutlineBullet::SetCurrentNumbering(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 );
-
-	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();
-		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();
-
-	       	 std::auto_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)
+void FuOutlineBullet::SetCurrentBulletsNumbering(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 )
-	{
-		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 ) );
-			}
-		}
-	}
-	//End of add
+    if (!mpDoc || !mpView)
+        return;
 
-	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);
+    const sal_uInt16 nSId = rReq.GetSlot();
+    if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
+    {
+        // unexpected SfxRequest
+        return;
+    }
+
+    SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSId, sal_False );
+    if ( !pItem )
+    {
+        rReq.Done();
+        return;
+    }
+
+    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
+    const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+    if ( bInMasterView )
+    {
+        SdrObject* pObj = mpView->GetTextEditObject();
+        if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
+        {
+            const sal_uInt16 nLevel = mpView->GetSelectionLevel();
+            if( nLevel != 0xFFFF )
+            {
+                //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 ) );
+            }
+        }
+    }
+
+    sal_uInt16 nIdx = pItem->GetValue();
+    bool bToggle = false;
+    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;
+    const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
+    SvxNumRule* pNumRule = NULL;
+    if ( pTmpItem )
+    {
+        pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
+
+        // 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 )
+        {
+            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();
+
+            pNumRuleMgr->SetItems(&aNewAttr);
+            SvxNumRule aTmpRule( *pNumRule );
+            if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
+            {
+                // for toggling bullets get default numbering rule
+                pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
+            }
+            else
+            {
+                pNumRuleMgr->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;
+            }
+        }
+    }
+
+    OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+    std::auto_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();
+    }
 
-	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 )
-		{
-			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
-		
-		NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
-		if ( pBullets )
-		{
-			//Sym3_2508, set unit attribute to NB Manager
-			pBullets->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
-			{
-				pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true);
-			}
-			else {
-				pBullets->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();
-
-	        	std::auto_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
-	}
-	delete pNumRule;
-	rReq.Done();
+    delete pNumRule;
+    rReq.Done();
 }
 
 const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)

Modified: openoffice/trunk/main/sd/source/ui/inc/View.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/inc/View.hxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/inc/View.hxx (original)
+++ openoffice/trunk/main/sd/source/ui/inc/View.hxx Wed May 29 08:10:49 2013
@@ -191,8 +191,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; }

Modified: openoffice/trunk/main/sd/source/ui/inc/fuolbull.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/inc/fuolbull.hxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/inc/fuolbull.hxx (original)
+++ openoffice/trunk/main/sd/source/ui/inc/fuolbull.hxx Wed May 29 08:10:49 2013
@@ -47,22 +47,22 @@ class FuOutlineBullet 
     : public FuPoor
 {
 public:
-	TYPEINFO();
+    TYPEINFO();
 
-	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);
+    static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+    virtual void DoExecute( SfxRequest& rReq );
 
 private:
-	FuOutlineBullet (
+    FuOutlineBullet (
         ViewShell* pViewShell, 
         ::sd::Window* pWin, 
         ::sd::View* pView,
         SdDrawDocument* pDoc, 
         SfxRequest& rReq);
 
-	const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
+    void SetCurrentBulletsNumbering(SfxRequest& rReq);
+
+    const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
 };
 
 

Modified: openoffice/trunk/main/sd/source/ui/view/drtxtob1.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drtxtob1.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drtxtob1.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drtxtob1.cxx Wed May 29 08:10:49 2013
@@ -328,10 +328,10 @@ void TextObjectBar::Execute( SfxRequest 
 		}
 		break;
 
-		case FN_NUM_BULLET_ON:
+        case FN_NUM_BULLET_ON:
             if( pOLV ) 
-			    pOLV->ToggleBullets();
-		break;
+                pOLV->ToggleBullets();
+            break;
 
         case SID_GROW_FONT_SIZE:
         case SID_SHRINK_FONT_SIZE:

Modified: openoffice/trunk/main/sd/source/ui/view/sdview.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/sdview.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/sdview.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/sdview.cxx Wed May 29 08:10:49 2013
@@ -1336,7 +1336,9 @@ void View::OnEndPasteOrDrop( PasteOrDrop
 	}
 }
 
-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)
@@ -1400,23 +1402,29 @@ sal_Bool View::ShouldToggleOn(sal_Bool b
 	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);
-	SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
-	OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
+    SdrModel* pSdrModel = GetModel();
+    Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
+    if (!pSdrModel || !pWindow)
+        return;
+
+    const bool bUndoEnabled = pSdrModel->IsUndoEnabled();
+    SdrUndoGroup* pUndoGroup = bUndoEnabled ? new SdrUndoGroup(*pSdrModel) : 0;
+
+    const bool bToggleOn =
+        bSwitchOff
+        ? false
+        : ShouldToggleOn( bToggle, bHandleBullets );
 
-	sal_uInt32 nMarkCount = GetMarkedObjectCount();
+    SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
+    OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
+
+    const sal_uInt32 nMarkCount = GetMarkedObjectCount();
 	for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
 	{
 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
@@ -1454,7 +1462,14 @@ void View::ToggleMarkedObjectsBullets(sa
 						SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nIndex));
 						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();
@@ -1478,25 +1493,29 @@ void View::ToggleMarkedObjectsBullets(sa
 				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)
-	{
-		pSdrModel->BegUndo();
-		pSdrModel->AddUndo(pUndoGroup);
-		pSdrModel->EndUndo();
-	}
-	else
-	{
-		delete pUndoGroup;
-	}
-	delete pOutliner;
-	delete pOutlinerView;
+    if ( bUndoEnabled && pUndoGroup->GetActionCount() > 0 )
+    {
+        pSdrModel->BegUndo();
+        pSdrModel->AddUndo(pUndoGroup);
+        pSdrModel->EndUndo();
+    }
+
+    delete pOutliner;
+    delete pOutlinerView;
 }
 
 } // end of namespace sd

Modified: openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx?rev=1487394&r1=1487393&r2=1487394&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx Wed May 29 08:10:49 2013
@@ -1034,54 +1034,73 @@ void ParaPropertyPanel::NotifyItemUpdate
     const bool bIsEnabled)
 {
     (void)bIsEnabled;
-    
-	if( nSID == SID_ATTR_METRIC )
-	{
-		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;
-	}
 
-	if( nSID == SID_ATTR_PARA_LRSPACE )
-		StateChangedIndentImpl( nSID, eState, pState );		
+    switch (nSID)
+    {
+    case SID_ATTR_METRIC:
+        {
+            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;
+        }
+        break;
 
-	if( nSID == SID_ATTR_PARA_LINESPACE )	
-		StateChangedLnSPImpl( nSID, eState, pState );	
+    case SID_ATTR_PARA_LRSPACE:
+        StateChangedIndentImpl( nSID, eState, pState );
+        break;
 
-	if( nSID == SID_ATTR_PARA_ULSPACE)
-		StateChangedULImpl( nSID, eState, pState );
+    case SID_ATTR_PARA_LINESPACE:
+        StateChangedLnSPImpl( 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)
-		StateChangedAlignmentImpl( nSID, eState, pState );
-
-	if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT)
-		StateChangeOutLineImpl( nSID, eState, pState );
-
-	if (nSID==SID_INC_INDENT || nSID==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) 
-		StateChangeBulletNumImpl( nSID, eState, pState );
-
-	//Get the num rule index data of the current selection
-	if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) 
-		StateChangeBulletNumRuleImpl( nSID, eState, pState );
-	
-	if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM))
-	{
-		VertStateChanged( nSID, eState, pState);
-	}
-	else if (nSID == SID_BACKGROUND_COLOR)
-	{
-		ParaBKGStateChanged(nSID, eState, pState);
-	}
+    case SID_ATTR_PARA_ULSPACE:
+        StateChangedULImpl( nSID, eState, pState );
+        break;
+
+    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;
+
+    case SID_OUTLINE_LEFT:
+    case SID_OUTLINE_RIGHT:
+        StateChangeOutLineImpl( nSID, eState, pState );
+        break;
+
+    case SID_INC_INDENT:
+    case SID_DEC_INDENT:
+        StateChangeIncDecImpl( nSID, eState, pState );
+        break;
+
+    case FN_NUM_NUMBERING_ON:
+    case FN_NUM_BULLET_ON:
+        StateChangeBulletNumImpl( nSID, eState, pState );
+        break;
+
+    case FN_BUL_NUM_RULE_INDEX:
+    case FN_NUM_NUM_RULE_INDEX:
+        StateChangeBulletNumRuleImpl( nSID, eState, pState );
+        break;
+
+    case SID_TABLE_VERT_NONE:
+    case SID_TABLE_VERT_CENTER:
+    case SID_TABLE_VERT_BOTTOM:
+        VertStateChanged( nSID, eState, pState);
+        break;
+
+    case SID_BACKGROUND_COLOR:
+        ParaBKGStateChanged(nSID, eState, pState);
+        break;
+    }
 }
 
 
@@ -1417,25 +1436,19 @@ void ParaPropertyPanel::StateChangeBulle
 {
     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 );
         }
     }
 }