summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-06-10 15:15:56 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-06-10 16:10:27 +0300
commit71b35212265bb93b10ca35ab964a36e6b6cc552b (patch)
tree6ed3630f19cab1fa9c547c214c88f74e421112ff /sw
parentada6281a5bd74d0ff6ae578d57f39f65b7c25103 (diff)
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
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/textsh1.cxx2
-rw-r--r--sw/source/uibase/shells/txtnum.cxx61
2 files changed, 27 insertions, 36 deletions
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 36bb996a55ee..61398c80b9d1 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 30bf893c550f..c61382cb92cc 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 );
}
}
}