xref: /trunk/main/sw/source/ui/shells/txtnum.cxx (revision 34760e49)
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
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
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.
19efeef26fSAndrew Rist  *
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 #include <vcl/msgbox.hxx>
30cdf0e10cSrcweir #include <sfx2/request.hxx>
31cdf0e10cSrcweir #include <svl/eitem.hxx>
32cdf0e10cSrcweir #include <svl/stritem.hxx>
33cdf0e10cSrcweir #include <editeng/numitem.hxx>
34cdf0e10cSrcweir #include <editeng/brshitem.hxx>
35cdf0e10cSrcweir #include <numrule.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "cmdid.h"
38cdf0e10cSrcweir #include "wrtsh.hxx"
39cdf0e10cSrcweir #include "view.hxx"
40cdf0e10cSrcweir #include "viewopt.hxx"
41cdf0e10cSrcweir #include "wdocsh.hxx"
42cdf0e10cSrcweir #include "textsh.hxx"
43cdf0e10cSrcweir #include "uiitems.hxx"
44cdf0e10cSrcweir #include "swabstdlg.hxx"
45cdf0e10cSrcweir #include <globals.hrc>
46cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
47766ce4d0SZheng Fan #include <svx/nbdtmg.hxx>
48766ce4d0SZheng Fan #include <svx/nbdtmgfact.hxx>
491ff378efSZheng Fan #include <sfx2/viewfrm.hxx>
501ff378efSZheng Fan #include <sfx2/bindings.hxx>
51cdf0e10cSrcweir 
ExecEnterNum(SfxRequest & rReq)52cdf0e10cSrcweir void SwTextShell::ExecEnterNum(SfxRequest &rReq)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	//wg. Aufzeichnung schon vor dem evtl. Shellwechsel
55cdf0e10cSrcweir 	switch(rReq.GetSlot())
56cdf0e10cSrcweir 	{
57cdf0e10cSrcweir 	case FN_NUM_NUMBERING_ON:
58cdf0e10cSrcweir 	{
591ff378efSZheng Fan 		GetShell().StartAllAction();
601ff378efSZheng Fan 		SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
611ff378efSZheng Fan 		sal_Bool bMode = !GetShell().SelectionHasNumber(); // #i29560#
621ff378efSZheng Fan 		if ( pItem )
631ff378efSZheng Fan 			bMode = pItem->GetValue();
641ff378efSZheng Fan 		else
651ff378efSZheng Fan 			rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
66cdf0e10cSrcweir 
671ff378efSZheng Fan 		if ( bMode != (GetShell().SelectionHasNumber()) ) // #i29560#
681ff378efSZheng Fan 		{
691ff378efSZheng Fan 			rReq.Done();
701ff378efSZheng Fan 			if( bMode )
711ff378efSZheng Fan 				GetShell().NumOn();
721ff378efSZheng Fan 			else
731ff378efSZheng Fan 				GetShell().NumOrBulletOff(); // #i29560#
741ff378efSZheng Fan 		}
751ff378efSZheng Fan 		sal_Bool bNewResult = GetShell().SelectionHasNumber();
761ff378efSZheng Fan 		if (bNewResult!=bMode) {
771ff378efSZheng Fan 			SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
781ff378efSZheng Fan 			SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult);
791ff378efSZheng Fan 			rBindings.SetState(aItem);
801ff378efSZheng Fan 			SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult);
811ff378efSZheng Fan 			rBindings.SetState(aNewItem);
821ff378efSZheng Fan 		}
831ff378efSZheng Fan 		GetShell().EndAllAction();
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 	break;
86cdf0e10cSrcweir 	case FN_NUM_BULLET_ON:
87cdf0e10cSrcweir 	{
881ff378efSZheng Fan 		GetShell().StartAllAction();
891ff378efSZheng Fan 		SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
901ff378efSZheng Fan 		sal_Bool bMode = !GetShell().SelectionHasBullet(); // #i29560#
911ff378efSZheng Fan 		if ( pItem )
921ff378efSZheng Fan 			bMode = pItem->GetValue();
931ff378efSZheng Fan 		else
941ff378efSZheng Fan 			rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
95cdf0e10cSrcweir 
961ff378efSZheng Fan 		if ( bMode != (GetShell().SelectionHasBullet()) ) // #i29560#
971ff378efSZheng Fan 		{
981ff378efSZheng Fan 			rReq.Done();
991ff378efSZheng Fan 			if( bMode )
1001ff378efSZheng Fan 				GetShell().BulletOn();
1011ff378efSZheng Fan 			else
1021ff378efSZheng Fan 				GetShell().NumOrBulletOff(); // #i29560#
1031ff378efSZheng Fan 		}
1041ff378efSZheng Fan 		sal_Bool bNewResult = GetShell().SelectionHasBullet();
1051ff378efSZheng Fan 		if (bNewResult!=bMode) {
1061ff378efSZheng Fan 			SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
1071ff378efSZheng Fan 			SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult);
1081ff378efSZheng Fan 			rBindings.SetState(aItem);
1091ff378efSZheng Fan 			SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult);
1101ff378efSZheng Fan 			rBindings.SetState(aNewItem);
1111ff378efSZheng Fan 		}
1121ff378efSZheng Fan 		GetShell().EndAllAction();
113cdf0e10cSrcweir 	}
114cdf0e10cSrcweir 	break;
115cdf0e10cSrcweir 
116*34760e49SOliver-Rainer Wittmann     case FN_NUMBER_BULLETS:
117*34760e49SOliver-Rainer Wittmann     case SID_OUTLINE_BULLET:
118*34760e49SOliver-Rainer Wittmann     {
119*34760e49SOliver-Rainer Wittmann         SfxItemSet aSet( GetPool(),
120*34760e49SOliver-Rainer Wittmann                          SID_HTML_MODE, SID_HTML_MODE,
121*34760e49SOliver-Rainer Wittmann                          SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
122*34760e49SOliver-Rainer Wittmann                          0 );
123*34760e49SOliver-Rainer Wittmann         SwDocShell* pDocSh = GetView().GetDocShell();
124*34760e49SOliver-Rainer Wittmann         const bool bHtml = 0 != PTR_CAST( SwWebDocShell, pDocSh );
125*34760e49SOliver-Rainer Wittmann         const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
126*34760e49SOliver-Rainer Wittmann         if ( pNumRuleAtCurrentSelection != NULL )
127*34760e49SOliver-Rainer Wittmann         {
128*34760e49SOliver-Rainer Wittmann             SvxNumRule aRule = pNumRuleAtCurrentSelection->MakeSvxNumRule();
129*34760e49SOliver-Rainer Wittmann 
130*34760e49SOliver-Rainer Wittmann             //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
131*34760e49SOliver-Rainer Wittmann             for ( sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++ )
132*34760e49SOliver-Rainer Wittmann             {
133*34760e49SOliver-Rainer Wittmann                 SvxNumberFormat aFmt( aRule.GetLevel( i ) );
134*34760e49SOliver-Rainer Wittmann                 if ( SVX_NUM_BITMAP == aFmt.GetNumberingType() )
135*34760e49SOliver-Rainer Wittmann                 {
136*34760e49SOliver-Rainer Wittmann                     const SvxBrushItem* pBrush = aFmt.GetBrush();
137*34760e49SOliver-Rainer Wittmann                     const String* pLinkStr = pBrush != NULL
138*34760e49SOliver-Rainer Wittmann                                              ? pBrush->GetGraphicLink()
139*34760e49SOliver-Rainer Wittmann                                              : NULL;
140*34760e49SOliver-Rainer Wittmann                     if ( pLinkStr != NULL && pLinkStr->Len() > 0 )
141*34760e49SOliver-Rainer Wittmann                     {
142*34760e49SOliver-Rainer Wittmann                         aFmt.SetNumberingType( SvxExtNumType( SVX_NUM_BITMAP | LINK_TOKEN ) );
143*34760e49SOliver-Rainer Wittmann                     }
144*34760e49SOliver-Rainer Wittmann                     aRule.SetLevel( i, aFmt, aRule.Get( i ) != 0 );
145*34760e49SOliver-Rainer Wittmann                 }
146*34760e49SOliver-Rainer Wittmann             }
147*34760e49SOliver-Rainer Wittmann             if ( bHtml )
148*34760e49SOliver-Rainer Wittmann                 aRule.SetFeatureFlag( NUM_ENABLE_EMBEDDED_BMP, sal_False );
149cdf0e10cSrcweir 
150*34760e49SOliver-Rainer Wittmann             aSet.Put( SvxNumBulletItem( aRule ) );
151cdf0e10cSrcweir             ASSERT( GetShell().GetNumLevel() < MAXLEVEL,
152cdf0e10cSrcweir                     "<SwTextShell::ExecEnterNum()> - numbered node without valid list level. Serious defect -> please inform OD." );
153cdf0e10cSrcweir             sal_uInt16 nLevel = GetShell().GetNumLevel();
154*34760e49SOliver-Rainer Wittmann             if ( nLevel < MAXLEVEL )
155*34760e49SOliver-Rainer Wittmann             {
156*34760e49SOliver-Rainer Wittmann                 nLevel = 1 << nLevel;
157*34760e49SOliver-Rainer Wittmann                 aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
158*34760e49SOliver-Rainer Wittmann             }
159*34760e49SOliver-Rainer Wittmann         }
160*34760e49SOliver-Rainer Wittmann         else
161*34760e49SOliver-Rainer Wittmann         {
162cdf0e10cSrcweir             SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
163cdf0e10cSrcweir                              numfunc::GetDefaultPositionAndSpaceMode() );
164*34760e49SOliver-Rainer Wittmann             SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
165cdf0e10cSrcweir             const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
166cdf0e10cSrcweir 
167*34760e49SOliver-Rainer Wittmann             if ( bHtml || bRightToLeft )
168*34760e49SOliver-Rainer Wittmann             {
169*34760e49SOliver-Rainer Wittmann                 for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
170*34760e49SOliver-Rainer Wittmann                 {
171*34760e49SOliver-Rainer Wittmann                     SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
172cdf0e10cSrcweir                     if ( n && bHtml )
173cdf0e10cSrcweir                     {
174cdf0e10cSrcweir                         // 1/2" fuer HTML
175*34760e49SOliver-Rainer Wittmann                         aFmt.SetLSpace( 720 );
176*34760e49SOliver-Rainer Wittmann                         aFmt.SetAbsLSpace( n * 720 );
177cdf0e10cSrcweir                     }
178*34760e49SOliver-Rainer Wittmann                     // Default alignment for numbering/bullet should be rtl in rtl paragraph:
179cdf0e10cSrcweir                     if ( bRightToLeft )
180cdf0e10cSrcweir                     {
181cdf0e10cSrcweir                         aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
182cdf0e10cSrcweir                     }
183cdf0e10cSrcweir                     aSvxRule.SetLevel( n, aFmt, sal_False );
184*34760e49SOliver-Rainer Wittmann                 }
185*34760e49SOliver-Rainer Wittmann                 aSvxRule.SetFeatureFlag( NUM_ENABLE_EMBEDDED_BMP, sal_False );
186*34760e49SOliver-Rainer Wittmann             }
187*34760e49SOliver-Rainer Wittmann             aSet.Put( SvxNumBulletItem( aSvxRule ) );
188*34760e49SOliver-Rainer Wittmann         }
189cdf0e10cSrcweir 
190*34760e49SOliver-Rainer Wittmann         aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET, sal_False ) );
191cdf0e10cSrcweir 
192*34760e49SOliver-Rainer Wittmann         // vor dem Dialog wird der HtmlMode an der DocShell versenkt
193*34760e49SOliver-Rainer Wittmann         pDocSh->PutItem( SfxUInt16Item( SID_HTML_MODE, ::GetHtmlMode( pDocSh ) ) );
194cdf0e10cSrcweir 
195*34760e49SOliver-Rainer Wittmann         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
196*34760e49SOliver-Rainer Wittmann         DBG_ASSERT( pFact, "Dialogdiet fail!" );
197*34760e49SOliver-Rainer Wittmann         SfxAbstractTabDialog* pDlg =
198*34760e49SOliver-Rainer Wittmann             pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET, GetView().GetWindow(), &aSet, GetShell() );
199cdf0e10cSrcweir         DBG_ASSERT(pDlg, "Dialogdiet fail!");
200*34760e49SOliver-Rainer Wittmann         const sal_uInt16 nRet = pDlg->Execute();
201*34760e49SOliver-Rainer Wittmann         const SfxPoolItem* pItem;
202*34760e49SOliver-Rainer Wittmann         if ( RET_OK == nRet )
203*34760e49SOliver-Rainer Wittmann         {
204*34760e49SOliver-Rainer Wittmann             if ( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ) )
205*34760e49SOliver-Rainer Wittmann             {
206*34760e49SOliver-Rainer Wittmann                 rReq.AppendItem( *pItem );
207*34760e49SOliver-Rainer Wittmann                 rReq.Done();
208*34760e49SOliver-Rainer Wittmann                 SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule();
209*34760e49SOliver-Rainer Wittmann                 pSetRule->UnLinkGraphics();
210*34760e49SOliver-Rainer Wittmann                 SwNumRule aSetRule( pNumRuleAtCurrentSelection != NULL
211*34760e49SOliver-Rainer Wittmann                                     ? pNumRuleAtCurrentSelection->GetName()
212*34760e49SOliver-Rainer Wittmann                                     : GetShell().GetUniqueNumRuleName(),
213*34760e49SOliver-Rainer Wittmann                     numfunc::GetDefaultPositionAndSpaceMode() );
214*34760e49SOliver-Rainer Wittmann                 aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
215*34760e49SOliver-Rainer Wittmann                 aSetRule.SetAutoRule( sal_True );
216cdf0e10cSrcweir                 // No start of new list, if an existing list style is edited.
217cdf0e10cSrcweir                 // Otherwise start a new list.
218*34760e49SOliver-Rainer Wittmann                 const bool bCreateList = ( pNumRuleAtCurrentSelection == NULL );
219cdf0e10cSrcweir                 GetShell().SetCurNumRule( aSetRule, bCreateList );
220*34760e49SOliver-Rainer Wittmann             }
221*34760e49SOliver-Rainer Wittmann             // wenn der Dialog mit OK verlassen wurde, aber nichts ausgewaehlt
222*34760e49SOliver-Rainer Wittmann             // wurde dann muss die Numerierung zumindest eingeschaltet werden,
223*34760e49SOliver-Rainer Wittmann             // wenn sie das noch nicht ist
224*34760e49SOliver-Rainer Wittmann             else if ( pNumRuleAtCurrentSelection == NULL
225*34760e49SOliver-Rainer Wittmann                       && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ) )
226*34760e49SOliver-Rainer Wittmann             {
227*34760e49SOliver-Rainer Wittmann                 rReq.AppendItem( *pItem );
228*34760e49SOliver-Rainer Wittmann                 rReq.Done();
229*34760e49SOliver-Rainer Wittmann                 SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule();
230*34760e49SOliver-Rainer Wittmann                 SwNumRule aSetRule(
231*34760e49SOliver-Rainer Wittmann                     GetShell().GetUniqueNumRuleName(),
232*34760e49SOliver-Rainer Wittmann                     numfunc::GetDefaultPositionAndSpaceMode() );
233*34760e49SOliver-Rainer Wittmann                 aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
234*34760e49SOliver-Rainer Wittmann                 aSetRule.SetAutoRule( sal_True );
235cdf0e10cSrcweir                 // start new list
236cdf0e10cSrcweir                 GetShell().SetCurNumRule( aSetRule, true );
237766ce4d0SZheng Fan             }
238*34760e49SOliver-Rainer Wittmann         }
239*34760e49SOliver-Rainer Wittmann         else if ( RET_USER == nRet )
240*34760e49SOliver-Rainer Wittmann             GetShell().DelNumRules();
241766ce4d0SZheng Fan 
242*34760e49SOliver-Rainer Wittmann         delete pDlg;
243*34760e49SOliver-Rainer Wittmann     }
244*34760e49SOliver-Rainer Wittmann         break;
245766ce4d0SZheng Fan 
246*34760e49SOliver-Rainer Wittmann     default:
247*34760e49SOliver-Rainer Wittmann         ASSERT( sal_False, "wrong Dispatcher" );
248*34760e49SOliver-Rainer Wittmann         return;
249*34760e49SOliver-Rainer Wittmann     }
250*34760e49SOliver-Rainer Wittmann }
251766ce4d0SZheng Fan 
252cdf0e10cSrcweir 
ExecSetNumber(SfxRequest & rReq)253*34760e49SOliver-Rainer Wittmann void SwTextShell::ExecSetNumber(SfxRequest &rReq)
254*34760e49SOliver-Rainer Wittmann {
255*34760e49SOliver-Rainer Wittmann     const sal_uInt16 nSlot = rReq.GetSlot();
256*34760e49SOliver-Rainer Wittmann     switch ( nSlot )
257*34760e49SOliver-Rainer Wittmann     {
258*34760e49SOliver-Rainer Wittmann     case FN_SVX_SET_NUMBER:
259*34760e49SOliver-Rainer Wittmann     case FN_SVX_SET_BULLET:
260*34760e49SOliver-Rainer Wittmann         {
261*34760e49SOliver-Rainer Wittmann             SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSlot, sal_False );
262*34760e49SOliver-Rainer Wittmann             if ( pItem != NULL )
263*34760e49SOliver-Rainer Wittmann             {
264*34760e49SOliver-Rainer Wittmann                 const sal_uInt16 nChoosenItemIdx = pItem->GetValue();
265*34760e49SOliver-Rainer Wittmann                 if ( nChoosenItemIdx == DEFAULT_NONE )
266*34760e49SOliver-Rainer Wittmann                 {
267*34760e49SOliver-Rainer Wittmann                     GetShell().DelNumRules();
268*34760e49SOliver-Rainer Wittmann                 }
269*34760e49SOliver-Rainer Wittmann                 else
270*34760e49SOliver-Rainer Wittmann                 {
271*34760e49SOliver-Rainer Wittmann                     svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr =
272*34760e49SOliver-Rainer Wittmann                         nSlot == FN_SVX_SET_NUMBER
273*34760e49SOliver-Rainer Wittmann                             ? svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::NUMBERING )
274*34760e49SOliver-Rainer Wittmann                             : svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::MIXBULLETS );
275*34760e49SOliver-Rainer Wittmann                     if ( pNBOTypeMgr != NULL )
276*34760e49SOliver-Rainer Wittmann                     {
277*34760e49SOliver-Rainer Wittmann                         const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
278*34760e49SOliver-Rainer Wittmann                         sal_uInt16 nActNumLvl = (sal_uInt16) 0xFFFF;
279*34760e49SOliver-Rainer Wittmann                         if ( pNumRuleAtCurrentSelection != NULL )
280*34760e49SOliver-Rainer Wittmann                         {
281*34760e49SOliver-Rainer Wittmann                             sal_uInt16 nLevel = GetShell().GetNumLevel();
282*34760e49SOliver-Rainer Wittmann                             if ( nLevel < MAXLEVEL )
283*34760e49SOliver-Rainer Wittmann                             {
284*34760e49SOliver-Rainer Wittmann                                 nActNumLvl = 1 << nLevel;
285*34760e49SOliver-Rainer Wittmann                             }
286*34760e49SOliver-Rainer Wittmann                         }
287*34760e49SOliver-Rainer Wittmann                         SwNumRule aNewNumRule(
288*34760e49SOliver-Rainer Wittmann                             pNumRuleAtCurrentSelection != NULL ? pNumRuleAtCurrentSelection->GetName() : GetShell().GetUniqueNumRuleName(),
289*34760e49SOliver-Rainer Wittmann                             numfunc::GetDefaultPositionAndSpaceMode() );
290*34760e49SOliver-Rainer Wittmann                         SvxNumRule aNewSvxNumRule = pNumRuleAtCurrentSelection != NULL
291*34760e49SOliver-Rainer Wittmann                                                         ? pNumRuleAtCurrentSelection->MakeSvxNumRule()
292*34760e49SOliver-Rainer Wittmann                                                         : aNewNumRule.MakeSvxNumRule();
293*34760e49SOliver-Rainer Wittmann                         // set unit attribute to NB Manager
294*34760e49SOliver-Rainer Wittmann                         SfxItemSet aSet( GetPool(), SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 );
295*34760e49SOliver-Rainer Wittmann                         aSet.Put( SvxNumBulletItem( aNewSvxNumRule ) );
296*34760e49SOliver-Rainer Wittmann                         pNBOTypeMgr->SetItems( &aSet );
297*34760e49SOliver-Rainer Wittmann                         pNBOTypeMgr->ApplyNumRule( aNewSvxNumRule, nChoosenItemIdx - 1, nActNumLvl );
298766ce4d0SZheng Fan 
299*34760e49SOliver-Rainer Wittmann                         aNewNumRule.SetSvxRule( aNewSvxNumRule, GetShell().GetDoc() );
300*34760e49SOliver-Rainer Wittmann                         aNewNumRule.SetAutoRule( sal_True );
301*34760e49SOliver-Rainer Wittmann                         const bool bCreateNewList = ( pNumRuleAtCurrentSelection == NULL );
302*34760e49SOliver-Rainer Wittmann                         GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
303*34760e49SOliver-Rainer Wittmann                     }
304*34760e49SOliver-Rainer Wittmann                 }
305*34760e49SOliver-Rainer Wittmann             }
306*34760e49SOliver-Rainer Wittmann         }
307*34760e49SOliver-Rainer Wittmann         break;
308766ce4d0SZheng Fan 
309*34760e49SOliver-Rainer Wittmann     default:
310*34760e49SOliver-Rainer Wittmann         ASSERT( sal_False, "wrong Dispatcher" );
311*34760e49SOliver-Rainer Wittmann         return;
312*34760e49SOliver-Rainer Wittmann     }
313766ce4d0SZheng Fan }
314