[Libreoffice-commits] core.git: 2 commits - include/svx sd/source svx/source sw/source

Maxim Monastirsky momonasmon at gmail.com
Wed Jun 10 06:13:39 PDT 2015


 include/svx/nbdtmg.hxx              |    1 
 sd/source/ui/func/fuolbull.cxx      |   16 +--------
 sd/source/ui/inc/View.hxx           |    3 -
 sd/source/ui/view/drviewsf.cxx      |    3 -
 sd/source/ui/view/sdview.cxx        |    7 +---
 svx/source/sidebar/nbdtmg.cxx       |    2 -
 sw/source/uibase/shells/textsh1.cxx |    2 -
 sw/source/uibase/shells/txtnum.cxx  |   61 +++++++++++++++---------------------
 8 files changed, 33 insertions(+), 62 deletions(-)

New commits:
commit 172a96e5246c7847313838464c671dccfd564ab8
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Jun 10 15:21:43 2015 +0300

    bSwitchOff is always false now
    
    Change-Id: Ic79c0f1cf2816da60962f67c57efb75685d984f1

diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index bbee427..c4befa0 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -265,7 +265,7 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
     }
     else
     {
-        mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule, false );
+        mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule );
     }
     if ( bInMasterView )
     {
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 14a0ab0..d7945c4 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -244,8 +244,7 @@ public:
     void ChangeMarkedObjectsBulletsNumbering(
         const bool bToggle,
         const bool bHandleBullets,
-        const SvxNumRule* pNumRule,
-        const bool bSwitchOff);
+        const SvxNumRule* pNumRule);
 
     void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
     void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 291accf..b424cf7 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -1326,8 +1326,7 @@ bool View::ShouldToggleOn(
 void View::ChangeMarkedObjectsBulletsNumbering(
     const bool bToggle,
     const bool bHandleBullets,
-    const SvxNumRule* pNumRule,
-    const bool bSwitchOff )
+    const SvxNumRule* pNumRule )
 {
     SdrModel* pSdrModel = GetModel();
     vcl::Window* pWindow = dynamic_cast< vcl::Window* >(GetFirstOutputDevice());
@@ -1337,9 +1336,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
     const bool bUndoEnabled = pSdrModel->IsUndoEnabled();
     SdrUndoGroup* pUndoGroup = bUndoEnabled ? new SdrUndoGroup(*pSdrModel) : 0;
 
-    const bool bToggleOn =
-        !bSwitchOff
-        && ShouldToggleOn( bToggle, bHandleBullets );
+    const bool bToggleOn = ShouldToggleOn( bToggle, bHandleBullets );
 
     boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel));
     boost::scoped_ptr<OutlinerView> pOutlinerView(new OutlinerView(pOutliner.get(), pWindow));
commit 71b35212265bb93b10ca35ab964a36e6b6cc552b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Jun 10 15:15:56 2015 +0300

    tdf#88290 Adapt the numbering popup to more than 8 items
    
    The items count of NumberingTypeMgr is limited by 8, but
    some languages have more items, so remove that limitation.
    
    Also fix the behavior of the 10th item. The old sidebar
    popup had a "None" item, whose id was 10 (defined by
    DEFAULT_NONE from include/svx/nbdtmg.hxx), and that causes
    now the 10th item to behave as on/off toggle. Since we
    don't have a "None" item anymore, get rid of that behavior
    completely.
    
    Change-Id: I5546ca637f9951cc093a7bbf8fda11dc35341d4e

diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
index 7695e5c..d400a87 100644
--- a/include/svx/nbdtmg.hxx
+++ b/include/svx/nbdtmg.hxx
@@ -27,7 +27,6 @@
 namespace svx { namespace sidebar {
 
 #define DEFAULT_BULLET_TYPES                            8
-#define DEFAULT_NONE                                    10
 #define DEFAULT_NUM_VALUSET_COUNT                       8
 #define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION          0x10
 
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 2ee2ddb..bbee427 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -182,17 +182,12 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
 
     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;
@@ -266,18 +261,11 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
 
     if ( pOLV )
     {
-        if ( bSwitchOff )
-        {
-            pOLV->SwitchOffBulletsNumbering( true );
-        }
-        else
-        {
-            pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule );
-        }
+        pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule );
     }
     else
     {
-        mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule, bSwitchOff );
+        mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule, false );
     }
     if ( bInMasterView )
     {
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index a5183c1..f92c0f0 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -577,9 +577,6 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
                 boost::scoped_ptr<SvxNumRule> pNumRule;
                 const SfxPoolItem* pTmpItem=NULL;
                 sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
-
-                rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
-                rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
                 sal_uInt16 nActNumLvl = mpDrawView->GetSelectionLevel();
                 pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
 
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 6fc1fd7..69384f1 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -1302,7 +1302,7 @@ void NumberingTypeMgr::Init()
     {
         aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale );
 
-        sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength();
+        sal_Int32 nLength = aNumberings.getLength();
 
         const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
         for(sal_Int32 i = 0; i < nLength; i++)
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 36bb996..61398c8 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1794,8 +1794,6 @@ void SwTextShell::GetState( SfxItemSet &rSet )
         {
             SwNumRule* pCurRule = const_cast<SwNumRule*>(GetShell().GetNumRuleAtCurrCrsrPos());
             sal_uInt16  nActNumLvl = USHRT_MAX;
-            rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
-            rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
             if( pCurRule )
             {
                 nActNumLvl = GetShell().GetNumLevel();
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index 30bf893..c61382c 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -251,45 +251,38 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
             if ( pItem != NULL )
             {
                 const sal_uInt16 nChoosenItemIdx = pItem->GetValue();
-                if ( nChoosenItemIdx == DEFAULT_NONE )
+                svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr =
+                    nSlot == FN_SVX_SET_NUMBER
+                        ? svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::NUMBERING )
+                        : svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::BULLETS );
+                if ( pNBOTypeMgr != NULL )
                 {
-                    GetShell().DelNumRules();
-                }
-                else
-                {
-                    svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr =
-                        nSlot == FN_SVX_SET_NUMBER
-                            ? svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::NUMBERING )
-                            : svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::BULLETS );
-                    if ( pNBOTypeMgr != NULL )
+                    const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
+                    sal_uInt16 nActNumLvl = USHRT_MAX;
+                    if ( pNumRuleAtCurrentSelection != NULL )
                     {
-                        const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
-                        sal_uInt16 nActNumLvl = USHRT_MAX;
-                        if ( pNumRuleAtCurrentSelection != NULL )
+                        const sal_uInt16 nLevel = GetShell().GetNumLevel();
+                        if ( nLevel < MAXLEVEL )
                         {
-                            const sal_uInt16 nLevel = GetShell().GetNumLevel();
-                            if ( nLevel < MAXLEVEL )
-                            {
-                                nActNumLvl = 1 << nLevel;
-                            }
+                            nActNumLvl = 1 << nLevel;
                         }
-                        SwNumRule aNewNumRule(
-                            pNumRuleAtCurrentSelection != NULL ? pNumRuleAtCurrentSelection->GetName() : GetShell().GetUniqueNumRuleName(),
-                            numfunc::GetDefaultPositionAndSpaceMode() );
-                        SvxNumRule aNewSvxNumRule = pNumRuleAtCurrentSelection != NULL
-                                                        ? pNumRuleAtCurrentSelection->MakeSvxNumRule()
-                                                        : aNewNumRule.MakeSvxNumRule();
-                        // set unit attribute to NB Manager
-                        SfxItemSet aSet( GetPool(), SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 );
-                        aSet.Put( SvxNumBulletItem( aNewSvxNumRule ) );
-                        pNBOTypeMgr->SetItems( &aSet );
-                        pNBOTypeMgr->ApplyNumRule( aNewSvxNumRule, nChoosenItemIdx - 1, nActNumLvl );
-
-                        aNewNumRule.SetSvxRule( aNewSvxNumRule, GetShell().GetDoc() );
-                        aNewNumRule.SetAutoRule( true );
-                        const bool bCreateNewList = ( pNumRuleAtCurrentSelection == NULL );
-                        GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
                     }
+                    SwNumRule aNewNumRule(
+                        pNumRuleAtCurrentSelection != NULL ? pNumRuleAtCurrentSelection->GetName() : GetShell().GetUniqueNumRuleName(),
+                        numfunc::GetDefaultPositionAndSpaceMode() );
+                    SvxNumRule aNewSvxNumRule = pNumRuleAtCurrentSelection != NULL
+                                                    ? pNumRuleAtCurrentSelection->MakeSvxNumRule()
+                                                    : aNewNumRule.MakeSvxNumRule();
+                    // set unit attribute to NB Manager
+                    SfxItemSet aSet( GetPool(), SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 );
+                    aSet.Put( SvxNumBulletItem( aNewSvxNumRule ) );
+                    pNBOTypeMgr->SetItems( &aSet );
+                    pNBOTypeMgr->ApplyNumRule( aNewSvxNumRule, nChoosenItemIdx - 1, nActNumLvl );
+
+                    aNewNumRule.SetSvxRule( aNewSvxNumRule, GetShell().GetDoc() );
+                    aNewNumRule.SetAutoRule( true );
+                    const bool bCreateNewList = ( pNumRuleAtCurrentSelection == NULL );
+                    GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
                 }
             }
         }


More information about the Libreoffice-commits mailing list