15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 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 10cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 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 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 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); 83766ce4d0SZheng Fan return; 84766ce4d0SZheng Fan } 85766ce4d0SZheng Fan 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 153*af89ca6eSOliver-Rainer Wittmann void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq) 154766ce4d0SZheng Fan { 155766ce4d0SZheng Fan if (!mpDoc || !mpView) 156766ce4d0SZheng Fan return; 157cdf0e10cSrcweir 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 { 174766ce4d0SZheng Fan SfxItemSet aEditAttr( mpDoc->GetPool() ); 175766ce4d0SZheng Fan mpView->GetAttributes( aEditAttr ); 176766ce4d0SZheng Fan aNewAttr.Put( aEditAttr, sal_False ); 177*af89ca6eSOliver-Rainer Wittmann } 178766ce4d0SZheng Fan 179*af89ca6eSOliver-Rainer Wittmann const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell); 180766ce4d0SZheng Fan //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; 182766ce4d0SZheng Fan if ( bInMasterView ) 183766ce4d0SZheng Fan { 184766ce4d0SZheng Fan SdrObject* pObj = mpView->GetTextEditObject(); 185766ce4d0SZheng Fan if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) 186766ce4d0SZheng Fan { 187*af89ca6eSOliver-Rainer Wittmann const sal_uInt16 nLevel = mpView->GetSelectionLevel(); 188766ce4d0SZheng Fan if( nLevel != 0xFFFF ) 189766ce4d0SZheng Fan { 190766ce4d0SZheng Fan //save the itemset value 191766ce4d0SZheng Fan SfxItemSet aStoreSet( aNewAttr ); 192766ce4d0SZheng Fan aNewAttr.ClearItem(); 193766ce4d0SZheng Fan //extend range 194766ce4d0SZheng Fan aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); 195766ce4d0SZheng Fan aNewAttr.Put( aStoreSet ); 196766ce4d0SZheng Fan //put current level user selected 197766ce4d0SZheng Fan aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); 198766ce4d0SZheng Fan } 199766ce4d0SZheng Fan } 200766ce4d0SZheng Fan } 201766ce4d0SZheng Fan 202766ce4d0SZheng Fan sal_uInt16 nIdx = pItem->GetValue(); 203*af89ca6eSOliver-Rainer Wittmann bool bToggle = false; 204*af89ca6eSOliver-Rainer Wittmann bool bSwitchOff = false; 205766ce4d0SZheng Fan if( nIdx == (sal_uInt16)0xFFFF ) 206766ce4d0SZheng Fan { 207*af89ca6eSOliver-Rainer Wittmann // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off 208766ce4d0SZheng Fan nIdx = 1; 209*af89ca6eSOliver-Rainer Wittmann bToggle = true; 210766ce4d0SZheng Fan } 211*af89ca6eSOliver-Rainer Wittmann else if (nIdx == DEFAULT_NONE) 212766ce4d0SZheng Fan { 213*af89ca6eSOliver-Rainer Wittmann bSwitchOff = true; 214766ce4d0SZheng Fan } 215766ce4d0SZheng Fan nIdx--; 216766ce4d0SZheng Fan 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 ) 221766ce4d0SZheng Fan { 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); 236766ce4d0SZheng Fan SvxNumRule aTmpRule( *pNumRule ); 237*af89ca6eSOliver-Rainer Wittmann if ( nSId == FN_SVX_SET_BULLET && bToggle && nIdx==0 ) 238766ce4d0SZheng Fan { 239*af89ca6eSOliver-Rainer Wittmann // for toggling bullets get default numbering rule 240*af89ca6eSOliver-Rainer Wittmann pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl, true ); 241766ce4d0SZheng Fan } 242*af89ca6eSOliver-Rainer Wittmann else 243*af89ca6eSOliver-Rainer Wittmann { 244*af89ca6eSOliver-Rainer Wittmann pNumRuleMgr->ApplyNumRule( aTmpRule, nIdx, nActNumLvl ); 245766ce4d0SZheng Fan } 246*af89ca6eSOliver-Rainer Wittmann 247766ce4d0SZheng Fan sal_uInt16 nMask = 1; 248766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) 249766ce4d0SZheng Fan { 250766ce4d0SZheng Fan if(nActNumLvl & nMask) 251766ce4d0SZheng Fan { 252766ce4d0SZheng Fan SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); 253766ce4d0SZheng Fan pNumRule->SetLevel(i, aFmt); 254766ce4d0SZheng Fan } 255766ce4d0SZheng Fan nMask <<= 1; 256766ce4d0SZheng Fan } 257*af89ca6eSOliver-Rainer Wittmann } 258*af89ca6eSOliver-Rainer Wittmann } 259766ce4d0SZheng Fan 260766ce4d0SZheng Fan OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 261766ce4d0SZheng Fan std::auto_ptr< OutlineViewModelChangeGuard > aGuard; 262*af89ca6eSOliver-Rainer Wittmann { 263766ce4d0SZheng Fan if (mpView->ISA(OutlineView)) 264766ce4d0SZheng Fan { 265766ce4d0SZheng Fan pOLV = static_cast<OutlineView*>(mpView) 266766ce4d0SZheng Fan ->GetViewByWindow(mpViewShell->GetActiveWindow()); 267766ce4d0SZheng Fan 268766ce4d0SZheng Fan aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); 269766ce4d0SZheng Fan } 270*af89ca6eSOliver-Rainer Wittmann } 271766ce4d0SZheng Fan 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(); 276766ce4d0SZheng Fan 277*af89ca6eSOliver-Rainer Wittmann if ( bOutlinerUndoEnabled ) 278766ce4d0SZheng Fan { 279766ce4d0SZheng Fan pOwner->UndoActionStart( OLUNDO_ATTR ); 280766ce4d0SZheng Fan } 281*af89ca6eSOliver-Rainer Wittmann else if ( bModelUndoEnabled ) 282766ce4d0SZheng Fan { 283766ce4d0SZheng Fan pSdrModel->BegUndo(); 284766ce4d0SZheng Fan } 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 } 301766ce4d0SZheng Fan if ( bInMasterView ) 302766ce4d0SZheng Fan { 303*af89ca6eSOliver-Rainer Wittmann SfxItemSet aSetAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END ); 304*af89ca6eSOliver-Rainer Wittmann aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); 305766ce4d0SZheng Fan mpView->SetAttributes(aSetAttr); 306766ce4d0SZheng Fan } 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 ) 313766ce4d0SZheng Fan { 314766ce4d0SZheng Fan pSdrModel->EndUndo(); 315766ce4d0SZheng Fan } 316*af89ca6eSOliver-Rainer Wittmann 317766ce4d0SZheng Fan delete pNumRule; 318766ce4d0SZheng Fan rReq.Done(); 319766ce4d0SZheng Fan } 320766ce4d0SZheng Fan 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 ); 390766ce4d0SZheng Fan 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