xref: /aoo42x/main/sd/source/ui/func/fuolbull.cxx (revision af89ca6e)
15b190011SAndrew Rist /**************************************************************
25b190011SAndrew Rist  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "fuolbull.hxx"
29cdf0e10cSrcweir #include <vcl/msgbox.hxx>
30cdf0e10cSrcweir #include <svl/intitem.hxx>
31cdf0e10cSrcweir #include <editeng/outliner.hxx>
32cdf0e10cSrcweir #include <editeng/eeitem.hxx>
33cdf0e10cSrcweir #include <sfx2/request.hxx>
34cdf0e10cSrcweir #include <svl/intitem.hxx>
35766ce4d0SZheng Fan #include <editeng/numitem.hxx>
36766ce4d0SZheng Fan #include "sdresid.hxx"
37766ce4d0SZheng Fan #include "glob.hrc"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <editeng/editdata.hxx>
40cdf0e10cSrcweir #include <svx/svxids.hrc>
41cdf0e10cSrcweir #include "OutlineView.hxx"
42cdf0e10cSrcweir #include "OutlineViewShell.hxx"
43cdf0e10cSrcweir #include "DrawViewShell.hxx"
44cdf0e10cSrcweir #ifndef SD_WINDOW_SHELL_HXX
45cdf0e10cSrcweir #include "Window.hxx"
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #include "drawdoc.hxx"
48cdf0e10cSrcweir #include "sdabstdlg.hxx"
49766ce4d0SZheng Fan #include <svx/nbdtmg.hxx>
50766ce4d0SZheng Fan #include <svx/nbdtmgfact.hxx>
51766ce4d0SZheng Fan #include <svx/svdoutl.hxx>
52766ce4d0SZheng Fan using namespace svx::sidebar;
53cdf0e10cSrcweir namespace sd {
54cdf0e10cSrcweir 
55cdf0e10cSrcweir TYPEINIT1( FuOutlineBullet, FuPoor );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir /*************************************************************************
58cdf0e10cSrcweir |*
59cdf0e10cSrcweir |* Konstruktor
60cdf0e10cSrcweir |*
61cdf0e10cSrcweir \************************************************************************/
62cdf0e10cSrcweir 
FuOutlineBullet(ViewShell * pViewShell,::sd::Window * pWindow,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)63cdf0e10cSrcweir FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
64cdf0e10cSrcweir 								 ::sd::View* pView, SdDrawDocument* pDoc,
65cdf0e10cSrcweir 								 SfxRequest& rReq)
66cdf0e10cSrcweir 	   : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)70cdf0e10cSrcweir FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	FunctionReference xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
73cdf0e10cSrcweir 	xFunc->DoExecute(rReq);
74cdf0e10cSrcweir 	return xFunc;
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
DoExecute(SfxRequest & rReq)77cdf0e10cSrcweir void FuOutlineBullet::DoExecute( SfxRequest& rReq )
78cdf0e10cSrcweir {
79*af89ca6eSOliver-Rainer Wittmann     const sal_uInt16 nSId = rReq.GetSlot();
80*af89ca6eSOliver-Rainer Wittmann     if ( nSId == FN_SVX_SET_BULLET || nSId == FN_SVX_SET_NUMBER )
81*af89ca6eSOliver-Rainer Wittmann     {
82*af89ca6eSOliver-Rainer Wittmann         SetCurrentBulletsNumbering(rReq);
83*af89ca6eSOliver-Rainer Wittmann         return;
84*af89ca6eSOliver-Rainer Wittmann     }
85*af89ca6eSOliver-Rainer Wittmann 
86cdf0e10cSrcweir 	const SfxItemSet* pArgs = rReq.GetArgs();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	if( !pArgs )
89cdf0e10cSrcweir 	{
90cdf0e10cSrcweir 		// ItemSet fuer Dialog fuellen
91cdf0e10cSrcweir 		SfxItemSet aEditAttr( mpDoc->GetPool() );
92cdf0e10cSrcweir 		mpView->GetAttributes( aEditAttr );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 		SfxItemSet aNewAttr( mpViewShell->GetPool(),
95cdf0e10cSrcweir 							 EE_ITEMS_START, EE_ITEMS_END );
96cdf0e10cSrcweir 		aNewAttr.Put( aEditAttr, sal_False );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 		// Dialog hochfahren und ausfuehren
99cdf0e10cSrcweir 		SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
100cdf0e10cSrcweir 		SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdOutlineBulletTabDlg( NULL, &aNewAttr, mpView ) : 0;
101cdf0e10cSrcweir 		if( pDlg )
102cdf0e10cSrcweir 		{
103cdf0e10cSrcweir 			sal_uInt16 nResult = pDlg->Execute();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 			switch( nResult )
106cdf0e10cSrcweir 			{
107cdf0e10cSrcweir 				case RET_OK:
108cdf0e10cSrcweir 				{
109cdf0e10cSrcweir 					SfxItemSet aSet( *pDlg->GetOutputItemSet() );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	                OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	                std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	                if (mpView->ISA(OutlineView))
116cdf0e10cSrcweir 	                {
117cdf0e10cSrcweir 		                pOLV = static_cast<OutlineView*>(mpView)
118cdf0e10cSrcweir                             ->GetViewByWindow(mpViewShell->GetActiveWindow());
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		                aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
121cdf0e10cSrcweir 	                }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir                     if( pOLV )
124cdf0e10cSrcweir                         pOLV->EnableBullets();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 					rReq.Done( aSet );
127cdf0e10cSrcweir 					pArgs = rReq.GetArgs();
128cdf0e10cSrcweir 				}
129cdf0e10cSrcweir 				break;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 				default:
132cdf0e10cSrcweir 				{
133cdf0e10cSrcweir 					delete pDlg;
134cdf0e10cSrcweir 					return;
135cdf0e10cSrcweir 				}
136cdf0e10cSrcweir 			}
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 			delete pDlg;
139cdf0e10cSrcweir 		}
140cdf0e10cSrcweir 	}
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	// nicht direkt an pOlView, damit SdDrawView::SetAttributes
143cdf0e10cSrcweir 	// Aenderungen auf der Masterpage abfangen und in eine
144cdf0e10cSrcweir 	// Vorlage umleiten kann
145cdf0e10cSrcweir 	mpView->SetAttributes(*pArgs);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir /* #i35937#
148cdf0e10cSrcweir 	// evtl. Betroffene Felder invalidieren
149cdf0e10cSrcweir 	mpViewShell->Invalidate( FN_NUM_BULLET_ON );
150cdf0e10cSrcweir */
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
SetCurrentBulletsNumbering(SfxRequest & rReq)153*af89ca6eSOliver-Rainer Wittmann void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq)
154766ce4d0SZheng Fan {
155*af89ca6eSOliver-Rainer Wittmann     if (!mpDoc || !mpView)
156*af89ca6eSOliver-Rainer Wittmann         return;
157*af89ca6eSOliver-Rainer Wittmann 
158*af89ca6eSOliver-Rainer Wittmann     const sal_uInt16 nSId = rReq.GetSlot();
159*af89ca6eSOliver-Rainer Wittmann     if ( nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER )
160*af89ca6eSOliver-Rainer Wittmann     {
161*af89ca6eSOliver-Rainer Wittmann         // unexpected SfxRequest
162*af89ca6eSOliver-Rainer Wittmann         return;
163*af89ca6eSOliver-Rainer Wittmann     }
164*af89ca6eSOliver-Rainer Wittmann 
165*af89ca6eSOliver-Rainer Wittmann     SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSId, sal_False );
166*af89ca6eSOliver-Rainer Wittmann     if ( !pItem )
167*af89ca6eSOliver-Rainer Wittmann     {
168*af89ca6eSOliver-Rainer Wittmann         rReq.Done();
169*af89ca6eSOliver-Rainer Wittmann         return;
170*af89ca6eSOliver-Rainer Wittmann     }
171*af89ca6eSOliver-Rainer Wittmann 
172*af89ca6eSOliver-Rainer Wittmann     SfxItemSet aNewAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END );
173*af89ca6eSOliver-Rainer Wittmann     {
174*af89ca6eSOliver-Rainer Wittmann         SfxItemSet aEditAttr( mpDoc->GetPool() );
175*af89ca6eSOliver-Rainer Wittmann         mpView->GetAttributes( aEditAttr );
176*af89ca6eSOliver-Rainer Wittmann         aNewAttr.Put( aEditAttr, sal_False );
177*af89ca6eSOliver-Rainer Wittmann     }
178*af89ca6eSOliver-Rainer Wittmann 
179*af89ca6eSOliver-Rainer Wittmann     const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
180*af89ca6eSOliver-Rainer Wittmann     //Init bullet level in "Customize" tab page in bullet dialog in master page view
181*af89ca6eSOliver-Rainer Wittmann     const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
182*af89ca6eSOliver-Rainer Wittmann     if ( bInMasterView )
183*af89ca6eSOliver-Rainer Wittmann     {
184*af89ca6eSOliver-Rainer Wittmann         SdrObject* pObj = mpView->GetTextEditObject();
185*af89ca6eSOliver-Rainer Wittmann         if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
186*af89ca6eSOliver-Rainer Wittmann         {
187*af89ca6eSOliver-Rainer Wittmann             const sal_uInt16 nLevel = mpView->GetSelectionLevel();
188*af89ca6eSOliver-Rainer Wittmann             if( nLevel != 0xFFFF )
189*af89ca6eSOliver-Rainer Wittmann             {
190*af89ca6eSOliver-Rainer Wittmann                 //save the itemset value
191*af89ca6eSOliver-Rainer Wittmann                 SfxItemSet aStoreSet( aNewAttr );
192*af89ca6eSOliver-Rainer Wittmann                 aNewAttr.ClearItem();
193*af89ca6eSOliver-Rainer Wittmann                 //extend range
194*af89ca6eSOliver-Rainer Wittmann                 aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
195*af89ca6eSOliver-Rainer Wittmann                 aNewAttr.Put( aStoreSet );
196*af89ca6eSOliver-Rainer Wittmann                 //put current level user selected
197*af89ca6eSOliver-Rainer Wittmann                 aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
198*af89ca6eSOliver-Rainer Wittmann             }
199*af89ca6eSOliver-Rainer Wittmann         }
200*af89ca6eSOliver-Rainer Wittmann     }
201*af89ca6eSOliver-Rainer Wittmann 
202*af89ca6eSOliver-Rainer Wittmann     sal_uInt16 nIdx = pItem->GetValue();
203*af89ca6eSOliver-Rainer Wittmann     bool bToggle = false;
204*af89ca6eSOliver-Rainer Wittmann     bool bSwitchOff = false;
205*af89ca6eSOliver-Rainer Wittmann     if( nIdx == (sal_uInt16)0xFFFF )
206*af89ca6eSOliver-Rainer Wittmann     {
207*af89ca6eSOliver-Rainer Wittmann         // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off
208*af89ca6eSOliver-Rainer Wittmann         nIdx = 1;
209*af89ca6eSOliver-Rainer Wittmann         bToggle = true;
210*af89ca6eSOliver-Rainer Wittmann     }
211*af89ca6eSOliver-Rainer Wittmann     else if (nIdx == DEFAULT_NONE)
212*af89ca6eSOliver-Rainer Wittmann     {
213*af89ca6eSOliver-Rainer Wittmann         bSwitchOff = true;
214*af89ca6eSOliver-Rainer Wittmann     }
215*af89ca6eSOliver-Rainer Wittmann     nIdx--;
216*af89ca6eSOliver-Rainer Wittmann 
217*af89ca6eSOliver-Rainer Wittmann     sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
218*af89ca6eSOliver-Rainer Wittmann     const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
219*af89ca6eSOliver-Rainer Wittmann     SvxNumRule* pNumRule = NULL;
220*af89ca6eSOliver-Rainer Wittmann     if ( pTmpItem )
221*af89ca6eSOliver-Rainer Wittmann     {
222*af89ca6eSOliver-Rainer Wittmann         pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
223*af89ca6eSOliver-Rainer Wittmann 
224*af89ca6eSOliver-Rainer Wittmann         // get numbering rule corresponding to <nIdx> and apply the needed number formats to <pNumRule>
225*af89ca6eSOliver-Rainer Wittmann         NBOTypeMgrBase* pNumRuleMgr =
226*af89ca6eSOliver-Rainer Wittmann             NBOutlineTypeMgrFact::CreateInstance(
227*af89ca6eSOliver-Rainer Wittmann                 nSId == FN_SVX_SET_BULLET ? eNBOType::MIXBULLETS : eNBOType::NUMBERING );
228*af89ca6eSOliver-Rainer Wittmann         if ( pNumRuleMgr )
229*af89ca6eSOliver-Rainer Wittmann         {
230*af89ca6eSOliver-Rainer Wittmann             sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
231*af89ca6eSOliver-Rainer Wittmann             const SfxPoolItem* pNumLevelItem = NULL;
232*af89ca6eSOliver-Rainer Wittmann             if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pNumLevelItem))
233*af89ca6eSOliver-Rainer Wittmann                 nActNumLvl = ((const SfxUInt16Item*)pNumLevelItem)->GetValue();
234*af89ca6eSOliver-Rainer Wittmann 
235*af89ca6eSOliver-Rainer Wittmann             pNumRuleMgr->SetItems(&aNewAttr);
236*af89ca6eSOliver-Rainer Wittmann             SvxNumRule aTmpRule( *pNumRule );
237*af89ca6eSOliver-Rainer Wittmann             if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 )
238*af89ca6eSOliver-Rainer Wittmann             {
239*af89ca6eSOliver-Rainer Wittmann                 // for toggling bullets get default numbering rule
240*af89ca6eSOliver-Rainer Wittmann                 pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true );
241*af89ca6eSOliver-Rainer Wittmann             }
242*af89ca6eSOliver-Rainer Wittmann             else
243*af89ca6eSOliver-Rainer Wittmann             {
244*af89ca6eSOliver-Rainer Wittmann                 pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl );
245*af89ca6eSOliver-Rainer Wittmann             }
246*af89ca6eSOliver-Rainer Wittmann 
247*af89ca6eSOliver-Rainer Wittmann             sal_uInt16 nMask = 1;
248*af89ca6eSOliver-Rainer Wittmann             for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
249*af89ca6eSOliver-Rainer Wittmann             {
250*af89ca6eSOliver-Rainer Wittmann                 if(nActNumLvl & nMask)
251*af89ca6eSOliver-Rainer Wittmann                 {
252*af89ca6eSOliver-Rainer Wittmann                     SvxNumberFormat aFmt(aTmpRule.GetLevel(i));
253*af89ca6eSOliver-Rainer Wittmann                     pNumRule->SetLevel(i, aFmt);
254*af89ca6eSOliver-Rainer Wittmann                 }
255*af89ca6eSOliver-Rainer Wittmann                 nMask <<= 1;
256*af89ca6eSOliver-Rainer Wittmann             }
257*af89ca6eSOliver-Rainer Wittmann         }
258*af89ca6eSOliver-Rainer Wittmann     }
259*af89ca6eSOliver-Rainer Wittmann 
260*af89ca6eSOliver-Rainer Wittmann     OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
261*af89ca6eSOliver-Rainer Wittmann     std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
262*af89ca6eSOliver-Rainer Wittmann     {
263*af89ca6eSOliver-Rainer Wittmann         if (mpView->ISA(OutlineView))
264*af89ca6eSOliver-Rainer Wittmann         {
265*af89ca6eSOliver-Rainer Wittmann             pOLV = static_cast<OutlineView*>(mpView)
266*af89ca6eSOliver-Rainer Wittmann                 ->GetViewByWindow(mpViewShell->GetActiveWindow());
267*af89ca6eSOliver-Rainer Wittmann 
268*af89ca6eSOliver-Rainer Wittmann             aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
269*af89ca6eSOliver-Rainer Wittmann         }
270*af89ca6eSOliver-Rainer Wittmann     }
271*af89ca6eSOliver-Rainer Wittmann 
272*af89ca6eSOliver-Rainer Wittmann     SdrOutliner* pOwner = bInMasterView ? mpView->GetTextEditOutliner() : 0;
273*af89ca6eSOliver-Rainer Wittmann     const bool bOutlinerUndoEnabled = pOwner && !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
274*af89ca6eSOliver-Rainer Wittmann     SdrModel* pSdrModel = bInMasterView ? mpView->GetModel() : 0;
275*af89ca6eSOliver-Rainer Wittmann     const bool bModelUndoEnabled = pSdrModel && pSdrModel->IsUndoEnabled();
276*af89ca6eSOliver-Rainer Wittmann 
277*af89ca6eSOliver-Rainer Wittmann     if ( bOutlinerUndoEnabled )
278*af89ca6eSOliver-Rainer Wittmann     {
279*af89ca6eSOliver-Rainer Wittmann         pOwner->UndoActionStart( OLUNDO_ATTR );
280*af89ca6eSOliver-Rainer Wittmann     }
281*af89ca6eSOliver-Rainer Wittmann     else if ( bModelUndoEnabled )
282*af89ca6eSOliver-Rainer Wittmann     {
283*af89ca6eSOliver-Rainer Wittmann         pSdrModel->BegUndo();
284*af89ca6eSOliver-Rainer Wittmann     }
285*af89ca6eSOliver-Rainer Wittmann 
286*af89ca6eSOliver-Rainer Wittmann     if ( pOLV )
287*af89ca6eSOliver-Rainer Wittmann     {
288*af89ca6eSOliver-Rainer Wittmann         if ( bSwitchOff )
289*af89ca6eSOliver-Rainer Wittmann         {
290*af89ca6eSOliver-Rainer Wittmann             pOLV->SwitchOffBulletsNumbering( true );
291*af89ca6eSOliver-Rainer Wittmann         }
292*af89ca6eSOliver-Rainer Wittmann         else
293*af89ca6eSOliver-Rainer Wittmann         {
294*af89ca6eSOliver-Rainer Wittmann             pOLV->ToggleBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule );
295*af89ca6eSOliver-Rainer Wittmann         }
296*af89ca6eSOliver-Rainer Wittmann     }
297*af89ca6eSOliver-Rainer Wittmann     else
298*af89ca6eSOliver-Rainer Wittmann     {
299*af89ca6eSOliver-Rainer Wittmann         mpView->ChangeMarkedObjectsBulletsNumbering( bToggle, nSId == FN_SVX_SET_BULLET, bInMasterView ? 0 : pNumRule, bSwitchOff );
300*af89ca6eSOliver-Rainer Wittmann     }
301*af89ca6eSOliver-Rainer Wittmann     if ( bInMasterView )
302*af89ca6eSOliver-Rainer Wittmann     {
303*af89ca6eSOliver-Rainer Wittmann         SfxItemSet aSetAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END );
304*af89ca6eSOliver-Rainer Wittmann         aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId);
305*af89ca6eSOliver-Rainer Wittmann         mpView->SetAttributes(aSetAttr);
306*af89ca6eSOliver-Rainer Wittmann     }
307*af89ca6eSOliver-Rainer Wittmann 
308*af89ca6eSOliver-Rainer Wittmann     if( bOutlinerUndoEnabled )
309*af89ca6eSOliver-Rainer Wittmann     {
310*af89ca6eSOliver-Rainer Wittmann         pOwner->UndoActionEnd( OLUNDO_ATTR );
311*af89ca6eSOliver-Rainer Wittmann     }
312*af89ca6eSOliver-Rainer Wittmann     else if ( bModelUndoEnabled )
313*af89ca6eSOliver-Rainer Wittmann     {
314*af89ca6eSOliver-Rainer Wittmann         pSdrModel->EndUndo();
315*af89ca6eSOliver-Rainer Wittmann     }
316*af89ca6eSOliver-Rainer Wittmann 
317*af89ca6eSOliver-Rainer Wittmann     delete pNumRule;
318*af89ca6eSOliver-Rainer Wittmann     rReq.Done();
319766ce4d0SZheng Fan }
320766ce4d0SZheng Fan 
GetNumBulletItem(SfxItemSet & aNewAttr,sal_uInt32 & nNumItemId)321766ce4d0SZheng Fan const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)
322766ce4d0SZheng Fan {
323766ce4d0SZheng Fan 	//SvxNumBulletItem* pRetItem = NULL;
324766ce4d0SZheng Fan 	const SfxPoolItem* pTmpItem = NULL;
325766ce4d0SZheng Fan 
326766ce4d0SZheng Fan 	if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET)
327766ce4d0SZheng Fan 	{
328766ce4d0SZheng Fan 		return pTmpItem;
329766ce4d0SZheng Fan 	}
330766ce4d0SZheng Fan 	else
331766ce4d0SZheng Fan 	{
332766ce4d0SZheng Fan 		nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
333766ce4d0SZheng Fan 		SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
334766ce4d0SZheng Fan 		if (eState == SFX_ITEM_SET)
335766ce4d0SZheng Fan 			return pTmpItem;
336766ce4d0SZheng Fan 		else
337766ce4d0SZheng Fan 		{
338766ce4d0SZheng Fan 			sal_Bool bOutliner = sal_False;
339766ce4d0SZheng Fan 			sal_Bool bTitle = sal_False;
340766ce4d0SZheng Fan 
341766ce4d0SZheng Fan 			if( mpView )
342766ce4d0SZheng Fan      		{
343766ce4d0SZheng Fan 				const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
344766ce4d0SZheng Fan 				const sal_uInt32 nCount = rMarkList.GetMarkCount();
345766ce4d0SZheng Fan 
346766ce4d0SZheng Fan 				for(sal_uInt32 nNum = 0; nNum < nCount; nNum++)
347766ce4d0SZheng Fan 				{
348766ce4d0SZheng Fan 					SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
349766ce4d0SZheng Fan 					if( pObj->GetObjInventor() == SdrInventor )
350766ce4d0SZheng Fan 					{
351766ce4d0SZheng Fan 						switch(pObj->GetObjIdentifier())
352766ce4d0SZheng Fan 						{
353766ce4d0SZheng Fan 						case OBJ_TITLETEXT:
354766ce4d0SZheng Fan 							bTitle = sal_True;
355766ce4d0SZheng Fan 							break;
356766ce4d0SZheng Fan 						case OBJ_OUTLINETEXT:
357766ce4d0SZheng Fan 							bOutliner = sal_True;
358766ce4d0SZheng Fan 							break;
359766ce4d0SZheng Fan 						}
360766ce4d0SZheng Fan 					}
361766ce4d0SZheng Fan 				}
362766ce4d0SZheng Fan 			}
363766ce4d0SZheng Fan 
364766ce4d0SZheng Fan 			const SvxNumBulletItem *pItem = NULL;
365766ce4d0SZheng Fan 			if(bOutliner)
366766ce4d0SZheng Fan 			{
367766ce4d0SZheng Fan 				SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
368766ce4d0SZheng Fan 				String aStyleName((SdResId((sal_uInt16)STR_LAYOUT_OUTLINE)));
369766ce4d0SZheng Fan 				aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
370766ce4d0SZheng Fan 				SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
371766ce4d0SZheng Fan 				if( pFirstStyleSheet )
372766ce4d0SZheng Fan 					pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
373766ce4d0SZheng Fan 			}
374766ce4d0SZheng Fan 
375766ce4d0SZheng Fan 			if( pItem == NULL )
376766ce4d0SZheng Fan 				pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
377766ce4d0SZheng Fan 
378766ce4d0SZheng Fan 			//DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" );
379766ce4d0SZheng Fan 
380766ce4d0SZheng Fan 			aNewAttr.Put(*pItem, EE_PARA_NUMBULLET);
381766ce4d0SZheng Fan 
382766ce4d0SZheng Fan 			if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
383766ce4d0SZheng Fan 			{
384766ce4d0SZheng Fan 				SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True);
385766ce4d0SZheng Fan 				SvxNumRule* pRule = pItem->GetNumRule();
386766ce4d0SZheng Fan 				if(pRule)
387766ce4d0SZheng Fan 				{
388766ce4d0SZheng Fan 					SvxNumRule aNewRule( *pRule );
389766ce4d0SZheng Fan 					aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
390cdf0e10cSrcweir 
391766ce4d0SZheng Fan 					SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
392766ce4d0SZheng Fan 					aNewAttr.Put(aNewItem);
393766ce4d0SZheng Fan 				}
394766ce4d0SZheng Fan 			}
395766ce4d0SZheng Fan 
396766ce4d0SZheng Fan 			SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
397766ce4d0SZheng Fan 			if (eState == SFX_ITEM_SET)
398766ce4d0SZheng Fan 				return pTmpItem;
399766ce4d0SZheng Fan 
400766ce4d0SZheng Fan 		}
401766ce4d0SZheng Fan 		//DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!")
402766ce4d0SZheng Fan 	}
403766ce4d0SZheng Fan 	return pTmpItem;
404766ce4d0SZheng Fan }
405cdf0e10cSrcweir 
406cdf0e10cSrcweir } // end of namespace sd
407