1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <hintids.hxx> 29cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen 30cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #include <sfx2/request.hxx> 33cdf0e10cSrcweir #include <svl/eitem.hxx> 34cdf0e10cSrcweir #include <svl/stritem.hxx> 35cdf0e10cSrcweir #include <editeng/numitem.hxx> 36cdf0e10cSrcweir #include <editeng/brshitem.hxx> 37cdf0e10cSrcweir #include <numrule.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include "cmdid.h" 40cdf0e10cSrcweir #include "wrtsh.hxx" 41cdf0e10cSrcweir #include "view.hxx" 42cdf0e10cSrcweir #include "viewopt.hxx" 43cdf0e10cSrcweir #include "wdocsh.hxx" 44cdf0e10cSrcweir #include "textsh.hxx" 45cdf0e10cSrcweir #include "uiitems.hxx" 46cdf0e10cSrcweir #include "swabstdlg.hxx" 47cdf0e10cSrcweir #include <globals.hrc> 48cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 49*766ce4d0SZheng Fan #include <svx/nbdtmg.hxx> 50*766ce4d0SZheng Fan #include <svx/nbdtmgfact.hxx> 51*766ce4d0SZheng Fan 52*766ce4d0SZheng Fan using namespace svx::sidebar; 53cdf0e10cSrcweir 54cdf0e10cSrcweir void SwTextShell::ExecEnterNum(SfxRequest &rReq) 55cdf0e10cSrcweir { 56cdf0e10cSrcweir //wg. Aufzeichnung schon vor dem evtl. Shellwechsel 57cdf0e10cSrcweir switch(rReq.GetSlot()) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir case FN_NUM_NUMBERING_ON: 60cdf0e10cSrcweir { 61cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); 62cdf0e10cSrcweir sal_Bool bMode = !GetShell().HasNumber(); // #i29560# 63cdf0e10cSrcweir if ( pItem ) 64cdf0e10cSrcweir bMode = pItem->GetValue(); 65cdf0e10cSrcweir else 66cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir if ( bMode != (GetShell().HasNumber()) ) // #i29560# 69cdf0e10cSrcweir { 70cdf0e10cSrcweir rReq.Done(); 71cdf0e10cSrcweir if( bMode ) 72cdf0e10cSrcweir GetShell().NumOn(); 73cdf0e10cSrcweir else 74cdf0e10cSrcweir GetShell().NumOrBulletOff(); // #i29560# 75cdf0e10cSrcweir } 76cdf0e10cSrcweir } 77cdf0e10cSrcweir break; 78cdf0e10cSrcweir case FN_NUM_BULLET_ON: 79cdf0e10cSrcweir { 80cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); 81cdf0e10cSrcweir sal_Bool bMode = !GetShell().HasBullet(); // #i29560# 82cdf0e10cSrcweir if ( pItem ) 83cdf0e10cSrcweir bMode = pItem->GetValue(); 84cdf0e10cSrcweir else 85cdf0e10cSrcweir rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir if ( bMode != (GetShell().HasBullet()) ) // #i29560# 88cdf0e10cSrcweir { 89cdf0e10cSrcweir rReq.Done(); 90cdf0e10cSrcweir if( bMode ) 91cdf0e10cSrcweir GetShell().BulletOn(); 92cdf0e10cSrcweir else 93cdf0e10cSrcweir GetShell().NumOrBulletOff(); // #i29560# 94cdf0e10cSrcweir } 95cdf0e10cSrcweir } 96cdf0e10cSrcweir break; 97cdf0e10cSrcweir case FN_NUMBER_BULLETS: 98*766ce4d0SZheng Fan case SID_OUTLINE_BULLET: 99cdf0e10cSrcweir { 100cdf0e10cSrcweir // --> OD 2008-02-29 #refactorlists# 101cdf0e10cSrcweir // // per default sal_True, damit die Schleife im Dialog richtig arbeitet! 102cdf0e10cSrcweir // sal_Bool bHasChild = sal_True; 103cdf0e10cSrcweir // <-- 104cdf0e10cSrcweir SfxItemSet aSet(GetPool(), 105cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 106cdf0e10cSrcweir SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 107cdf0e10cSrcweir 0 ); 108cdf0e10cSrcweir SwDocShell* pDocSh = GetView().GetDocShell(); 109cdf0e10cSrcweir sal_Bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh); 110cdf0e10cSrcweir const SwNumRule* pCurRule = GetShell().GetCurNumRule(); 111cdf0e10cSrcweir if( pCurRule ) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir SvxNumRule aRule = pCurRule->MakeSvxNumRule(); 114cdf0e10cSrcweir 115cdf0e10cSrcweir //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN) 116cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir SvxNumberFormat aFmt(aRule.GetLevel(i)); 119cdf0e10cSrcweir if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir const SvxBrushItem* pBrush = aFmt.GetBrush(); 122cdf0e10cSrcweir const String* pLinkStr; 123cdf0e10cSrcweir if(pBrush && 124cdf0e10cSrcweir 0 != (pLinkStr = pBrush->GetGraphicLink()) && 125cdf0e10cSrcweir pLinkStr->Len()) 126cdf0e10cSrcweir aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN)); 127cdf0e10cSrcweir aRule.SetLevel(i, aFmt, aRule.Get(i) != 0); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir } 130cdf0e10cSrcweir if(bHtml) 131cdf0e10cSrcweir aRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False); 132cdf0e10cSrcweir 133cdf0e10cSrcweir aSet.Put(SvxNumBulletItem(aRule)); 134cdf0e10cSrcweir // --> OD 2008-02-29 #refactorlists# - removed <bHasChild> 135cdf0e10cSrcweir ASSERT( GetShell().GetNumLevel() < MAXLEVEL, 136cdf0e10cSrcweir "<SwTextShell::ExecEnterNum()> - numbered node without valid list level. Serious defect -> please inform OD." ); 137cdf0e10cSrcweir sal_uInt16 nLevel = GetShell().GetNumLevel(); 138cdf0e10cSrcweir // <-- 139cdf0e10cSrcweir if( nLevel < MAXLEVEL ) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir nLevel = 1<<nLevel; 142cdf0e10cSrcweir aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel )); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir } 145cdf0e10cSrcweir else 146cdf0e10cSrcweir { 147cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 148cdf0e10cSrcweir SwNumRule aRule( GetShell().GetUniqueNumRuleName(), 149cdf0e10cSrcweir // --> OD 2008-06-06 #i89178# 150cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() ); 151cdf0e10cSrcweir // <-- 152cdf0e10cSrcweir // <-- 153cdf0e10cSrcweir SvxNumRule aSvxRule = aRule.MakeSvxNumRule(); 154cdf0e10cSrcweir const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir if( bHtml || bRightToLeft ) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) ); 161cdf0e10cSrcweir if ( n && bHtml ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir // 1/2" fuer HTML 164cdf0e10cSrcweir aFmt.SetLSpace(720); 165cdf0e10cSrcweir aFmt.SetAbsLSpace(n * 720); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir // --> FME 2005-01-21 #i38904# Default alignment for 168cdf0e10cSrcweir // numbering/bullet should be rtl in rtl paragraph: 169cdf0e10cSrcweir if ( bRightToLeft ) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); 172cdf0e10cSrcweir } 173cdf0e10cSrcweir // <-- 174cdf0e10cSrcweir aSvxRule.SetLevel( n, aFmt, sal_False ); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir aSet.Put(SvxNumBulletItem(aSvxRule)); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,sal_False )); 182cdf0e10cSrcweir 183cdf0e10cSrcweir // vor dem Dialog wird der HtmlMode an der DocShell versenkt 184cdf0e10cSrcweir pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh))); 185cdf0e10cSrcweir 186cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 187cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 188cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET, 189cdf0e10cSrcweir GetView().GetWindow(), &aSet, GetShell()); 190cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 191cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute(); 192cdf0e10cSrcweir const SfxPoolItem* pItem; 193cdf0e10cSrcweir if( RET_OK == nRet ) 194cdf0e10cSrcweir { 195cdf0e10cSrcweir if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem )) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir rReq.AppendItem(*pItem); 198cdf0e10cSrcweir rReq.Done(); 199cdf0e10cSrcweir SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule(); 200cdf0e10cSrcweir pSetRule->UnLinkGraphics(); 201cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 202cdf0e10cSrcweir SwNumRule aSetRule( pCurRule 203cdf0e10cSrcweir ? pCurRule->GetName() 204cdf0e10cSrcweir : GetShell().GetUniqueNumRuleName(), 205cdf0e10cSrcweir // --> OD 2008-06-06 #i89178# 206cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() ); 207cdf0e10cSrcweir // <-- 208cdf0e10cSrcweir // <-- 209cdf0e10cSrcweir aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc()); 210cdf0e10cSrcweir aSetRule.SetAutoRule( sal_True ); 211cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 212cdf0e10cSrcweir // No start of new list, if an existing list style is edited. 213cdf0e10cSrcweir // Otherwise start a new list. 214cdf0e10cSrcweir const bool bCreateList = (pCurRule == 0); 215cdf0e10cSrcweir GetShell().SetCurNumRule( aSetRule, bCreateList ); 216cdf0e10cSrcweir // <-- 217cdf0e10cSrcweir } 218cdf0e10cSrcweir // wenn der Dialog mit OK verlassen wurde, aber nichts ausgewaehlt 219cdf0e10cSrcweir // wurde dann muss die Numerierung zumindest eingeschaltet werden, 220cdf0e10cSrcweir // wenn sie das noch nicht ist 221cdf0e10cSrcweir else if( !pCurRule && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem )) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir rReq.AppendItem( *pItem ); 224cdf0e10cSrcweir rReq.Done(); 225cdf0e10cSrcweir SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule(); 226cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 227cdf0e10cSrcweir SwNumRule aSetRule( GetShell().GetUniqueNumRuleName(), 228cdf0e10cSrcweir // --> OD 2008-06-06 #i89178# 229cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() ); 230cdf0e10cSrcweir // <-- 231cdf0e10cSrcweir // <-- 232cdf0e10cSrcweir aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc()); 233cdf0e10cSrcweir aSetRule.SetAutoRule( sal_True ); 234cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 235cdf0e10cSrcweir // start new list 236cdf0e10cSrcweir GetShell().SetCurNumRule( aSetRule, true ); 237cdf0e10cSrcweir // <-- 238cdf0e10cSrcweir } 239cdf0e10cSrcweir } 240cdf0e10cSrcweir else if(RET_USER == nRet) 241cdf0e10cSrcweir GetShell().DelNumRules(); 242cdf0e10cSrcweir 243cdf0e10cSrcweir delete pDlg; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir break; 246cdf0e10cSrcweir default: 247cdf0e10cSrcweir ASSERT(sal_False, falscher Dispatcher); 248cdf0e10cSrcweir return; 249cdf0e10cSrcweir } 250cdf0e10cSrcweir } 251cdf0e10cSrcweir 252*766ce4d0SZheng Fan void SwTextShell::ExecSetNumber(SfxRequest &rReq) 253*766ce4d0SZheng Fan { 254*766ce4d0SZheng Fan SwNumRule aRule( GetShell().GetUniqueNumRuleName(), 255*766ce4d0SZheng Fan // --> OD 2008-06-06 #i89178# 256*766ce4d0SZheng Fan numfunc::GetDefaultPositionAndSpaceMode() ); 257*766ce4d0SZheng Fan // <-- 258cdf0e10cSrcweir 259*766ce4d0SZheng Fan SvxNumRule aSvxRule = aRule.MakeSvxNumRule(); 260*766ce4d0SZheng Fan const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 ); 261*766ce4d0SZheng Fan 262*766ce4d0SZheng Fan if( bRightToLeft ) 263*766ce4d0SZheng Fan { 264*766ce4d0SZheng Fan for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) 265*766ce4d0SZheng Fan { 266*766ce4d0SZheng Fan SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) ); 267*766ce4d0SZheng Fan /* if ( n && bHtml ) 268*766ce4d0SZheng Fan { 269*766ce4d0SZheng Fan // 1/2" fuer HTML 270*766ce4d0SZheng Fan aFmt.SetLSpace(720); 271*766ce4d0SZheng Fan aFmt.SetAbsLSpace(n * 720); 272*766ce4d0SZheng Fan }*/ 273*766ce4d0SZheng Fan // --> FME 2005-01-21 #i38904# Default alignment for 274*766ce4d0SZheng Fan // numbering/bullet should be rtl in rtl paragraph: 275*766ce4d0SZheng Fan if ( bRightToLeft ) 276*766ce4d0SZheng Fan { 277*766ce4d0SZheng Fan aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); 278*766ce4d0SZheng Fan } 279*766ce4d0SZheng Fan // <-- 280*766ce4d0SZheng Fan aSvxRule.SetLevel( n, aFmt, sal_False ); 281*766ce4d0SZheng Fan } 282*766ce4d0SZheng Fan aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False); 283*766ce4d0SZheng Fan } 284*766ce4d0SZheng Fan 285*766ce4d0SZheng Fan const SwNumRule* pCurRule = GetShell().GetCurNumRule(); 286*766ce4d0SZheng Fan sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; 287*766ce4d0SZheng Fan if( pCurRule ) 288*766ce4d0SZheng Fan { 289*766ce4d0SZheng Fan sal_uInt16 nLevel = GetShell().GetNumLevel(); 290*766ce4d0SZheng Fan if( nLevel < MAXLEVEL ) 291*766ce4d0SZheng Fan { 292*766ce4d0SZheng Fan nActNumLvl = 1<<nLevel; 293*766ce4d0SZheng Fan } 294*766ce4d0SZheng Fan 295*766ce4d0SZheng Fan aSvxRule = pCurRule->MakeSvxNumRule(); 296*766ce4d0SZheng Fan 297*766ce4d0SZheng Fan //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN) 298*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) 299*766ce4d0SZheng Fan { 300*766ce4d0SZheng Fan SvxNumberFormat aFmt(aSvxRule.GetLevel(i)); 301*766ce4d0SZheng Fan if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) 302*766ce4d0SZheng Fan { 303*766ce4d0SZheng Fan const SvxBrushItem* pBrush = aFmt.GetBrush(); 304*766ce4d0SZheng Fan const String* pLinkStr; 305*766ce4d0SZheng Fan if(pBrush && 306*766ce4d0SZheng Fan 0 != (pLinkStr = pBrush->GetGraphicLink()) && 307*766ce4d0SZheng Fan pLinkStr->Len()) 308*766ce4d0SZheng Fan aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN)); 309*766ce4d0SZheng Fan aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0); 310*766ce4d0SZheng Fan } 311*766ce4d0SZheng Fan } 312*766ce4d0SZheng Fan } 313*766ce4d0SZheng Fan 314*766ce4d0SZheng Fan 315*766ce4d0SZheng Fan switch(rReq.GetSlot()) 316*766ce4d0SZheng Fan { 317*766ce4d0SZheng Fan case FN_SVX_SET_NUMBER: 318*766ce4d0SZheng Fan { 319*766ce4d0SZheng Fan SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False ); 320*766ce4d0SZheng Fan if (pItem) 321*766ce4d0SZheng Fan { 322*766ce4d0SZheng Fan sal_uInt16 nIdx = pItem->GetValue(); 323*766ce4d0SZheng Fan if (nIdx==DEFAULT_NONE) { 324*766ce4d0SZheng Fan GetShell().DelNumRules(); 325*766ce4d0SZheng Fan break; 326*766ce4d0SZheng Fan } 327*766ce4d0SZheng Fan --nIdx; 328*766ce4d0SZheng Fan 329*766ce4d0SZheng Fan NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); 330*766ce4d0SZheng Fan if ( pNumbering ) 331*766ce4d0SZheng Fan { 332*766ce4d0SZheng Fan SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), 333*766ce4d0SZheng Fan numfunc::GetDefaultPositionAndSpaceMode() ); 334*766ce4d0SZheng Fan 335*766ce4d0SZheng Fan SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); 336*766ce4d0SZheng Fan //Sym3_2508, set unit attribute to NB Manager 337*766ce4d0SZheng Fan SfxItemSet aSet(GetPool(), 338*766ce4d0SZheng Fan SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 339*766ce4d0SZheng Fan 0 ); 340*766ce4d0SZheng Fan aSet.Put(SvxNumBulletItem(aTempRule)); 341*766ce4d0SZheng Fan pNumbering->SetItems(&aSet); 342*766ce4d0SZheng Fan pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl); 343*766ce4d0SZheng Fan 344*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 345*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) 346*766ce4d0SZheng Fan { 347*766ce4d0SZheng Fan if(nActNumLvl & nMask) 348*766ce4d0SZheng Fan { 349*766ce4d0SZheng Fan SvxNumberFormat aFmt(aTempRule.GetLevel(i)); 350*766ce4d0SZheng Fan aSvxRule.SetLevel(i, aFmt); 351*766ce4d0SZheng Fan } 352*766ce4d0SZheng Fan nMask <<= 1 ; 353*766ce4d0SZheng Fan } 354*766ce4d0SZheng Fan 355*766ce4d0SZheng Fan aSvxRule.UnLinkGraphics(); 356*766ce4d0SZheng Fan SwNumRule aSetRule( pCurRule 357*766ce4d0SZheng Fan ? pCurRule->GetName() 358*766ce4d0SZheng Fan : GetShell().GetUniqueNumRuleName(), 359*766ce4d0SZheng Fan numfunc::GetDefaultPositionAndSpaceMode() ); 360*766ce4d0SZheng Fan aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); 361*766ce4d0SZheng Fan 362*766ce4d0SZheng Fan aSetRule.SetAutoRule( sal_True ); 363*766ce4d0SZheng Fan const bool bCreateList = (pCurRule == 0); 364*766ce4d0SZheng Fan GetShell().SetCurNumRule( aSetRule, bCreateList ); 365*766ce4d0SZheng Fan } 366*766ce4d0SZheng Fan //End 367*766ce4d0SZheng Fan } 368*766ce4d0SZheng Fan break; 369*766ce4d0SZheng Fan } 370*766ce4d0SZheng Fan case FN_SVX_SET_BULLET: 371*766ce4d0SZheng Fan { 372*766ce4d0SZheng Fan SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); 373*766ce4d0SZheng Fan if (pItem) 374*766ce4d0SZheng Fan { 375*766ce4d0SZheng Fan sal_uInt16 nIdx = pItem->GetValue(); 376*766ce4d0SZheng Fan if (nIdx==DEFAULT_NONE) { 377*766ce4d0SZheng Fan GetShell().DelNumRules(); 378*766ce4d0SZheng Fan break; 379*766ce4d0SZheng Fan } 380*766ce4d0SZheng Fan nIdx--; 381*766ce4d0SZheng Fan 382*766ce4d0SZheng Fan NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); 383*766ce4d0SZheng Fan if ( pBullets ) 384*766ce4d0SZheng Fan { 385*766ce4d0SZheng Fan SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), 386*766ce4d0SZheng Fan numfunc::GetDefaultPositionAndSpaceMode() ); 387*766ce4d0SZheng Fan 388*766ce4d0SZheng Fan SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); 389*766ce4d0SZheng Fan //Sym3_2508, set unit attribute to NB Manager 390*766ce4d0SZheng Fan SfxItemSet aSet(GetPool(), 391*766ce4d0SZheng Fan SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 392*766ce4d0SZheng Fan 0 ); 393*766ce4d0SZheng Fan aSet.Put(SvxNumBulletItem(aTempRule)); 394*766ce4d0SZheng Fan pBullets->SetItems(&aSet); 395*766ce4d0SZheng Fan 396*766ce4d0SZheng Fan //SvxNumRule aTempRule( 0, 10, false ); 397*766ce4d0SZheng Fan pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl); 398*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 399*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) 400*766ce4d0SZheng Fan { 401*766ce4d0SZheng Fan if(nActNumLvl & nMask) 402*766ce4d0SZheng Fan { 403*766ce4d0SZheng Fan SvxNumberFormat aFmt(aTempRule.GetLevel(i)); 404*766ce4d0SZheng Fan aSvxRule.SetLevel(i, aFmt); 405*766ce4d0SZheng Fan } 406*766ce4d0SZheng Fan nMask <<= 1; 407*766ce4d0SZheng Fan } 408*766ce4d0SZheng Fan aSvxRule.UnLinkGraphics(); 409*766ce4d0SZheng Fan 410*766ce4d0SZheng Fan SwNumRule aSetRule( pCurRule 411*766ce4d0SZheng Fan ? pCurRule->GetName() 412*766ce4d0SZheng Fan : GetShell().GetUniqueNumRuleName(), 413*766ce4d0SZheng Fan numfunc::GetDefaultPositionAndSpaceMode() ); 414*766ce4d0SZheng Fan 415*766ce4d0SZheng Fan aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); 416*766ce4d0SZheng Fan 417*766ce4d0SZheng Fan aSetRule.SetAutoRule( sal_True ); 418*766ce4d0SZheng Fan const bool bCreateList = (pCurRule == 0); 419*766ce4d0SZheng Fan GetShell().SetCurNumRule( aSetRule, bCreateList ); 420*766ce4d0SZheng Fan } 421*766ce4d0SZheng Fan //End 422*766ce4d0SZheng Fan } 423*766ce4d0SZheng Fan 424*766ce4d0SZheng Fan } 425*766ce4d0SZheng Fan break; 426*766ce4d0SZheng Fan } 427*766ce4d0SZheng Fan } 428