1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 32 33 //------------------------------------------------------------------ 34 35 #include <editeng/eeitem.hxx> 36 37 #include <sfx2/viewfrm.hxx> 38 #include <sfx2/request.hxx> 39 #include <sfx2/bindings.hxx> 40 #include <tools/urlobj.hxx> 41 //CHINA001 #include <svx/dlgname.hxx> 42 #include <svx/svxdlg.hxx> //CHINA001 43 #include <svx/dialogs.hrc> //CHINA001 44 #include <svx/fmglob.hxx> 45 #include <svx/hlnkitem.hxx> 46 #include <svx/fontwork.hxx> 47 #include <svx/svdocapt.hxx> 48 #include <svx/svdoole2.hxx> 49 #include <svx/svdouno.hxx> 50 #include <svx/svdpage.hxx> 51 #include <svx/svdundo.hxx> 52 #include <svx/xdef.hxx> 53 #include <svx/xftsfit.hxx> 54 #include <vcl/msgbox.hxx> 55 #include <svx/extrusionbar.hxx> 56 #include <svx/fontworkbar.hxx> 57 #include <sfx2/docfile.hxx> 58 59 #include <com/sun/star/form/FormButtonType.hpp> 60 #include <com/sun/star/beans/XPropertySet.hpp> 61 #include <com/sun/star/beans/XPropertySetInfo.hpp> 62 #include <com/sun/star/awt/XControlModel.hpp> 63 64 #include "drawsh.hxx" 65 #include "drawview.hxx" 66 #include "viewdata.hxx" 67 #include "tabvwsh.hxx" 68 #include "docsh.hxx" 69 //CHINA001 #include "strindlg.hxx" 70 #include "scresid.hxx" 71 #include "undotab.hxx" 72 #include "drwlayer.hxx" 73 #include "userdat.hxx" 74 #include "postit.hxx" 75 76 #include "sc.hrc" 77 78 using namespace com::sun::star; 79 80 //------------------------------------------------------------------ 81 82 void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink 83 { 84 ScDrawView* pView = pViewData->GetScDrawView(); 85 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 86 sal_uLong nMarkCount = rMarkList.GetMarkCount(); 87 88 // Hyperlink 89 90 SvxHyperlinkItem aHLinkItem; 91 92 if ( nMarkCount == 1 ) // URL-Button markiert ? 93 { 94 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 95 #ifdef ISSUE66550_HLINK_FOR_SHAPES 96 ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj ); 97 if ( pInfo && (pInfo->GetHlink().getLength() > 0) ) 98 { 99 aHLinkItem.SetURL( pInfo->GetHlink() ); 100 aHLinkItem.SetInsertMode(HLINK_FIELD); 101 } 102 #endif 103 SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj); 104 if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) 105 { 106 uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel(); 107 DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" ); 108 if( !xControlModel.is() ) 109 return; 110 111 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY ); 112 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); 113 114 rtl::OUString sPropButtonType = rtl::OUString::createFromAscii( "ButtonType" ); 115 rtl::OUString sPropTargetURL = rtl::OUString::createFromAscii( "TargetURL" ); 116 rtl::OUString sPropTargetFrame = rtl::OUString::createFromAscii( "TargetFrame" ); 117 rtl::OUString sPropLabel = rtl::OUString::createFromAscii( "Label" ); 118 119 if(xInfo->hasPropertyByName( sPropButtonType )) 120 { 121 uno::Any aAny = xPropSet->getPropertyValue( sPropButtonType ); 122 form::FormButtonType eTmp; 123 if ( (aAny >>= eTmp) && eTmp == form::FormButtonType_URL ) 124 { 125 rtl::OUString sTmp; 126 // Label 127 if(xInfo->hasPropertyByName( sPropLabel )) 128 { 129 aAny = xPropSet->getPropertyValue( sPropLabel ); 130 if ( (aAny >>= sTmp) && sTmp.getLength() ) 131 { 132 aHLinkItem.SetName(sTmp); 133 } 134 } 135 // URL 136 if(xInfo->hasPropertyByName( sPropTargetURL )) 137 { 138 aAny = xPropSet->getPropertyValue( sPropTargetURL ); 139 if ( (aAny >>= sTmp) && sTmp.getLength() ) 140 { 141 aHLinkItem.SetURL(sTmp); 142 } 143 } 144 // Target 145 if(xInfo->hasPropertyByName( sPropTargetFrame )) 146 { 147 aAny = xPropSet->getPropertyValue( sPropTargetFrame ); 148 if ( (aAny >>= sTmp) && sTmp.getLength() ) 149 { 150 aHLinkItem.SetTargetFrame(sTmp); 151 } 152 } 153 aHLinkItem.SetInsertMode(HLINK_BUTTON); 154 } 155 } 156 } 157 } 158 159 rSet.Put(aHLinkItem); 160 } 161 162 void ScDrawShell::ExecuteHLink( SfxRequest& rReq ) 163 { 164 const SfxItemSet* pReqArgs = rReq.GetArgs(); 165 166 sal_uInt16 nSlot = rReq.GetSlot(); 167 switch ( nSlot ) 168 { 169 case SID_HYPERLINK_SETLINK: 170 if( pReqArgs ) 171 { 172 const SfxPoolItem* pItem; 173 if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, sal_True, &pItem ) == SFX_ITEM_SET ) 174 { 175 const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem; 176 const String& rName = pHyper->GetName(); 177 const String& rURL = pHyper->GetURL(); 178 const String& rTarget = pHyper->GetTargetFrame(); 179 SvxLinkInsertMode eMode = pHyper->GetInsertMode(); 180 181 sal_Bool bDone = sal_False; 182 if ( eMode == HLINK_FIELD || eMode == HLINK_BUTTON ) 183 { 184 ScDrawView* pView = pViewData->GetScDrawView(); 185 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 186 if ( rMarkList.GetMarkCount() == 1 ) 187 { 188 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 189 SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj ); 190 if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) 191 { 192 uno::Reference<awt::XControlModel> xControlModel = 193 pUnoCtrl->GetUnoControlModel(); 194 DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" ); 195 if( !xControlModel.is() ) 196 return; 197 198 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY ); 199 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); 200 201 rtl::OUString sPropTargetURL = 202 rtl::OUString::createFromAscii( "TargetURL" ); 203 204 // Darf man eine URL an dem Objekt setzen? 205 if (xInfo->hasPropertyByName( sPropTargetURL )) 206 { 207 // Ja! 208 209 rtl::OUString sPropButtonType = 210 rtl::OUString::createFromAscii( "ButtonType" ); 211 rtl::OUString sPropTargetFrame = 212 rtl::OUString::createFromAscii( "TargetFrame" ); 213 rtl::OUString sPropLabel = 214 rtl::OUString::createFromAscii( "Label" ); 215 216 uno::Any aAny; 217 if ( xInfo->hasPropertyByName( sPropLabel ) ) 218 { 219 aAny <<= rtl::OUString(rName); 220 xPropSet->setPropertyValue( sPropLabel, aAny ); 221 } 222 223 ::rtl::OUString aTmp = INetURLObject::GetAbsURL( pViewData->GetDocShell()->GetMedium()->GetBaseURL(), rURL ); 224 aAny <<= aTmp; 225 xPropSet->setPropertyValue( sPropTargetURL, aAny ); 226 227 if( rTarget.Len() && xInfo->hasPropertyByName( sPropTargetFrame ) ) 228 { 229 aAny <<= rtl::OUString(rTarget); 230 xPropSet->setPropertyValue( sPropTargetFrame, aAny ); 231 } 232 233 if ( xInfo->hasPropertyByName( sPropButtonType ) ) 234 { 235 form::FormButtonType eButtonType = form::FormButtonType_URL; 236 aAny <<= eButtonType; 237 xPropSet->setPropertyValue( sPropButtonType, aAny ); 238 } 239 240 //! Undo ??? 241 pViewData->GetDocShell()->SetDocumentModified(); 242 bDone = sal_True; 243 } 244 } 245 #ifdef ISSUE66550_HLINK_FOR_SHAPES 246 else 247 { 248 SetHlinkForObject( pObj, rURL ); 249 bDone = sal_True; 250 } 251 #endif 252 } 253 } 254 255 if (!bDone) 256 pViewData->GetViewShell()-> 257 InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode ); 258 259 // InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!! 260 } 261 } 262 break; 263 default: 264 DBG_ERROR("falscher Slot"); 265 } 266 } 267 268 sal_uInt16 ScGetFontWorkId(); // wegen CLOOKs - in drtxtob2 269 270 //------------------------------------------------------------------ 271 272 // 273 // Funktionen auf Drawing-Objekten 274 // 275 276 void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) 277 { 278 SfxBindings& rBindings = pViewData->GetBindings(); 279 ScTabView* pTabView = pViewData->GetView(); 280 ScDrawView* pView = pTabView->GetScDrawView(); 281 const SfxItemSet *pArgs = rReq.GetArgs(); 282 sal_uInt16 nSlotId = rReq.GetSlot(); 283 284 //!!! 285 // wer weiss, wie lange das funktioniert? (->vom Abreisscontrol funktioniert es) 286 // 287 if (nSlotId == SID_OBJECT_ALIGN && pArgs) 288 nSlotId = SID_OBJECT_ALIGN + ((SfxEnumItem&)pArgs->Get(SID_OBJECT_ALIGN)).GetValue() + 1; 289 290 switch (nSlotId) 291 { 292 case SID_OBJECT_HEAVEN: 293 pView->SetMarkedToLayer( SC_LAYER_FRONT ); 294 rBindings.Invalidate(SID_OBJECT_HEAVEN); 295 rBindings.Invalidate(SID_OBJECT_HELL); 296 break; 297 case SID_OBJECT_HELL: 298 pView->SetMarkedToLayer( SC_LAYER_BACK ); 299 rBindings.Invalidate(SID_OBJECT_HEAVEN); 300 rBindings.Invalidate(SID_OBJECT_HELL); 301 // leave draw shell if nothing selected (layer may be locked) 302 pViewData->GetViewShell()->UpdateDrawShell(); 303 break; 304 305 case SID_FRAME_TO_TOP: 306 pView->PutMarkedToTop(); 307 break; 308 case SID_FRAME_TO_BOTTOM: 309 pView->PutMarkedToBtm(); 310 break; 311 case SID_FRAME_UP: 312 pView->MovMarkedToTop(); 313 break; 314 case SID_FRAME_DOWN: 315 pView->MovMarkedToBtm(); 316 break; 317 318 case SID_GROUP: 319 pView->GroupMarked(); 320 break; 321 case SID_UNGROUP: 322 pView->UnGroupMarked(); 323 break; 324 case SID_ENTER_GROUP: 325 pView->EnterMarkedGroup(); 326 break; 327 case SID_LEAVE_GROUP: 328 pView->LeaveOneGroup(); 329 break; 330 331 case SID_MIRROR_HORIZONTAL: 332 pView->MirrorAllMarkedHorizontal(); 333 break; 334 case SID_MIRROR_VERTICAL: 335 pView->MirrorAllMarkedVertical(); 336 break; 337 338 case SID_OBJECT_ALIGN_LEFT: 339 case SID_ALIGN_ANY_LEFT: 340 if (pView->IsAlignPossible()) 341 pView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE); 342 break; 343 case SID_OBJECT_ALIGN_CENTER: 344 case SID_ALIGN_ANY_HCENTER: 345 if (pView->IsAlignPossible()) 346 pView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE); 347 break; 348 case SID_OBJECT_ALIGN_RIGHT: 349 case SID_ALIGN_ANY_RIGHT: 350 if (pView->IsAlignPossible()) 351 pView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE); 352 break; 353 case SID_OBJECT_ALIGN_UP: 354 case SID_ALIGN_ANY_TOP: 355 if (pView->IsAlignPossible()) 356 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP); 357 break; 358 case SID_OBJECT_ALIGN_MIDDLE: 359 case SID_ALIGN_ANY_VCENTER: 360 if (pView->IsAlignPossible()) 361 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER); 362 break; 363 case SID_OBJECT_ALIGN_DOWN: 364 case SID_ALIGN_ANY_BOTTOM: 365 if (pView->IsAlignPossible()) 366 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM); 367 break; 368 369 case SID_DELETE: 370 case SID_DELETE_CONTENTS: 371 pView->DeleteMarked(); 372 pViewData->GetViewShell()->UpdateDrawShell(); 373 break; 374 375 case SID_CUT: 376 pView->DoCut(); 377 pViewData->GetViewShell()->UpdateDrawShell(); 378 break; 379 380 case SID_COPY: 381 pView->DoCopy(); 382 break; 383 384 case SID_PASTE: 385 DBG_ERROR( "SdrView::PasteClipboard not supported anymore" ); 386 // pView->PasteClipboard( pWin ); 387 break; 388 389 case SID_SELECTALL: 390 pView->MarkAll(); 391 break; 392 393 case SID_ANCHOR_PAGE: 394 pView->SetAnchor( SCA_PAGE ); 395 rBindings.Invalidate( SID_ANCHOR_PAGE ); 396 rBindings.Invalidate( SID_ANCHOR_CELL ); 397 break; 398 399 case SID_ANCHOR_CELL: 400 pView->SetAnchor( SCA_CELL ); 401 rBindings.Invalidate( SID_ANCHOR_PAGE ); 402 rBindings.Invalidate( SID_ANCHOR_CELL ); 403 break; 404 405 case SID_ANCHOR_TOGGLE: 406 { 407 switch( pView->GetAnchor() ) 408 { 409 case SCA_CELL: 410 pView->SetAnchor( SCA_PAGE ); 411 break; 412 default: 413 pView->SetAnchor( SCA_CELL ); 414 break; 415 } 416 } 417 rBindings.Invalidate( SID_ANCHOR_PAGE ); 418 rBindings.Invalidate( SID_ANCHOR_CELL ); 419 break; 420 421 case SID_OBJECT_ROTATE: 422 { 423 SdrDragMode eMode; 424 if (pView->GetDragMode() == SDRDRAG_ROTATE) 425 eMode = SDRDRAG_MOVE; 426 else 427 eMode = SDRDRAG_ROTATE; 428 pView->SetDragMode( eMode ); 429 rBindings.Invalidate( SID_OBJECT_ROTATE ); 430 rBindings.Invalidate( SID_OBJECT_MIRROR ); 431 if (eMode == SDRDRAG_ROTATE && !pView->IsFrameDragSingles()) 432 { 433 pView->SetFrameDragSingles( sal_True ); 434 rBindings.Invalidate( SID_BEZIER_EDIT ); 435 } 436 } 437 break; 438 case SID_OBJECT_MIRROR: 439 { 440 SdrDragMode eMode; 441 if (pView->GetDragMode() == SDRDRAG_MIRROR) 442 eMode = SDRDRAG_MOVE; 443 else 444 eMode = SDRDRAG_MIRROR; 445 pView->SetDragMode( eMode ); 446 rBindings.Invalidate( SID_OBJECT_ROTATE ); 447 rBindings.Invalidate( SID_OBJECT_MIRROR ); 448 if (eMode == SDRDRAG_MIRROR && !pView->IsFrameDragSingles()) 449 { 450 pView->SetFrameDragSingles( sal_True ); 451 rBindings.Invalidate( SID_BEZIER_EDIT ); 452 } 453 } 454 break; 455 case SID_BEZIER_EDIT: 456 { 457 sal_Bool bOld = pView->IsFrameDragSingles(); 458 pView->SetFrameDragSingles( !bOld ); 459 rBindings.Invalidate( SID_BEZIER_EDIT ); 460 if (bOld && pView->GetDragMode() != SDRDRAG_MOVE) 461 { 462 pView->SetDragMode( SDRDRAG_MOVE ); 463 rBindings.Invalidate( SID_OBJECT_ROTATE ); 464 rBindings.Invalidate( SID_OBJECT_MIRROR ); 465 } 466 } 467 break; 468 469 case SID_FONTWORK: 470 { 471 sal_uInt16 nId = ScGetFontWorkId(); 472 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); 473 474 if ( rReq.GetArgs() ) 475 pViewFrm->SetChildWindow( nId, 476 ((const SfxBoolItem&) 477 (rReq.GetArgs()->Get(SID_FONTWORK))). 478 GetValue() ); 479 else 480 pViewFrm->ToggleChildWindow( nId ); 481 482 rBindings.Invalidate( SID_FONTWORK ); 483 rReq.Done(); 484 } 485 break; 486 487 case SID_ORIGINALSIZE: 488 pView->SetMarkedOriginalSize(); 489 break; 490 491 case SID_ENABLE_HYPHENATION: 492 { 493 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_ENABLE_HYPHENATION, sal_False); 494 if( pItem ) 495 { 496 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 497 sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue(); 498 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); 499 pView->SetAttributes( aSet ); 500 } 501 rReq.Done(); 502 } 503 break; 504 505 case SID_RENAME_OBJECT: 506 { 507 if(1L == pView->GetMarkedObjectCount()) 508 { 509 // #i68101# 510 SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L); 511 OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)"); 512 513 if(SC_LAYER_INTERN != pSelected->GetLayer()) 514 { 515 String aName(pSelected->GetName()); 516 517 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 518 OSL_ENSURE(pFact, "Dialogdiet fail!"); 519 AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName); 520 OSL_ENSURE(pDlg, "Dialogdiet fail!"); 521 522 pDlg->SetCheckNameHdl(LINK(this, ScDrawShell, NameObjectHdl)); 523 524 if(RET_OK == pDlg->Execute()) 525 { 526 ScDocShell* pDocSh = pViewData->GetDocShell(); 527 pDlg->GetName(aName); 528 529 if(aName != pSelected->GetName()) 530 { 531 // handle name change 532 const sal_uInt16 nObjType(pSelected->GetObjIdentifier()); 533 534 if(OBJ_GRAF == nObjType && 0L == aName.Len()) 535 { 536 // graphics objects must have names 537 // (all graphics are supposed to be in the navigator) 538 ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); 539 540 if(pModel) 541 { 542 aName = pModel->GetNewGraphicName(); 543 } 544 } 545 546 // An undo action for renaming is missing in svdraw (99363). 547 // For OLE objects (which can be identified using the persist name), 548 // ScUndoRenameObject can be used until there is a common action for all objects. 549 if(OBJ_OLE2 == nObjType) 550 { 551 const String aPersistName = static_cast<SdrOle2Obj*>(pSelected)->GetPersistName(); 552 553 if(aPersistName.Len()) 554 { 555 pDocSh->GetUndoManager()->AddUndoAction( 556 new ScUndoRenameObject(pDocSh, aPersistName, pSelected->GetName(), aName)); 557 } 558 } 559 560 // set new name 561 pSelected->SetName(aName); 562 } 563 564 // ChartListenerCollectionNeedsUpdate is needed for Navigator update 565 pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True ); 566 pDocSh->SetDrawModified(); 567 } 568 569 delete pDlg; 570 } 571 } 572 break; 573 } 574 575 // #i68101# 576 case SID_TITLE_DESCRIPTION_OBJECT: 577 { 578 if(1L == pView->GetMarkedObjectCount()) 579 { 580 SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L); 581 OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)"); 582 583 if(SC_LAYER_INTERN != pSelected->GetLayer()) 584 { 585 String aTitle(pSelected->GetTitle()); 586 String aDescription(pSelected->GetDescription()); 587 588 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 589 OSL_ENSURE(pFact, "Dialogdiet fail!"); 590 AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription); 591 OSL_ENSURE(pDlg, "Dialogdiet fail!"); 592 593 if(RET_OK == pDlg->Execute()) 594 { 595 ScDocShell* pDocSh = pViewData->GetDocShell(); 596 597 // handle Title and Description 598 pDlg->GetTitle(aTitle); 599 pDlg->GetDescription(aDescription); 600 pSelected->SetTitle(aTitle); 601 pSelected->SetDescription(aDescription); 602 603 // ChartListenerCollectionNeedsUpdate is needed for Navigator update 604 pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True ); 605 pDocSh->SetDrawModified(); 606 } 607 608 delete pDlg; 609 } 610 } 611 break; 612 } 613 614 case SID_EXTRUSION_TOOGLE: 615 case SID_EXTRUSION_TILT_DOWN: 616 case SID_EXTRUSION_TILT_UP: 617 case SID_EXTRUSION_TILT_LEFT: 618 case SID_EXTRUSION_TILT_RIGHT: 619 case SID_EXTRUSION_3D_COLOR: 620 case SID_EXTRUSION_DEPTH: 621 case SID_EXTRUSION_DIRECTION: 622 case SID_EXTRUSION_PROJECTION: 623 case SID_EXTRUSION_LIGHTING_DIRECTION: 624 case SID_EXTRUSION_LIGHTING_INTENSITY: 625 case SID_EXTRUSION_SURFACE: 626 case SID_EXTRUSION_DEPTH_FLOATER: 627 case SID_EXTRUSION_DIRECTION_FLOATER: 628 case SID_EXTRUSION_LIGHTING_FLOATER: 629 case SID_EXTRUSION_SURFACE_FLOATER: 630 case SID_EXTRUSION_DEPTH_DIALOG: 631 svx::ExtrusionBar::execute( pView, rReq, rBindings ); 632 rReq.Ignore (); 633 break; 634 635 case SID_FONTWORK_SHAPE: 636 case SID_FONTWORK_SHAPE_TYPE: 637 case SID_FONTWORK_ALIGNMENT: 638 case SID_FONTWORK_SAME_LETTER_HEIGHTS: 639 case SID_FONTWORK_CHARACTER_SPACING: 640 case SID_FONTWORK_KERN_CHARACTER_PAIRS: 641 case SID_FONTWORK_CHARACTER_SPACING_FLOATER: 642 case SID_FONTWORK_ALIGNMENT_FLOATER: 643 case SID_FONTWORK_CHARACTER_SPACING_DIALOG: 644 svx::FontworkBar::execute( pView, rReq, rBindings ); 645 rReq.Ignore (); 646 break; 647 648 default: 649 break; 650 } 651 } 652 653 IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog ) 654 { 655 String aName; 656 657 if( pDialog ) 658 pDialog->GetName( aName ); 659 660 ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); 661 if ( aName.Len() && pModel ) 662 { 663 SCTAB nDummyTab; 664 if ( pModel->GetNamedObject( aName, 0, nDummyTab ) ) 665 { 666 // existing object found -> name invalid 667 return 0; 668 } 669 } 670 671 return 1; // name is valid 672 } 673 674 //------------------------------------------------------------------ 675 676 void ScDrawShell::ExecFormText(SfxRequest& rReq) 677 { 678 ScDrawView* pDrView = pViewData->GetScDrawView(); 679 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 680 681 if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() ) 682 { 683 const SfxItemSet& rSet = *rReq.GetArgs(); 684 const SfxPoolItem* pItem; 685 686 if ( pDrView->IsTextEdit() ) 687 pDrView->ScEndTextEdit(); 688 689 if ( SFX_ITEM_SET == 690 rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) 691 && XFTFORM_NONE != 692 ((const XFormTextStdFormItem*) pItem)->GetValue() ) 693 { 694 695 sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 696 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); 697 SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) 698 (pViewFrm-> 699 GetChildWindow(nId)->GetWindow()); 700 701 pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(), 702 rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(), 703 ((const XFormTextStdFormItem*) pItem)-> 704 GetValue()); 705 } 706 else 707 pDrView->SetAttributes(rSet); 708 } 709 } 710 711 //------------------------------------------------------------------ 712 713 void ScDrawShell::ExecFormatPaintbrush( SfxRequest& rReq ) 714 { 715 ScViewFunc* pView = pViewData->GetView(); 716 if ( pView->HasPaintBrush() ) 717 { 718 // cancel paintbrush mode 719 pView->ResetBrushDocument(); 720 } 721 else 722 { 723 sal_Bool bLock = sal_False; 724 const SfxItemSet *pArgs = rReq.GetArgs(); 725 if( pArgs && pArgs->Count() >= 1 ) 726 bLock = static_cast<const SfxBoolItem&>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue(); 727 728 ScDrawView* pDrawView = pViewData->GetScDrawView(); 729 if ( pDrawView && pDrawView->AreObjectsMarked() ) 730 { 731 sal_Bool bOnlyHardAttr = sal_True; 732 SfxItemSet* pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) ); 733 pView->SetDrawBrushSet( pItemSet, bLock ); 734 } 735 } 736 } 737 738 void ScDrawShell::StateFormatPaintbrush( SfxItemSet& rSet ) 739 { 740 ScDrawView* pDrawView = pViewData->GetScDrawView(); 741 sal_Bool bSelection = pDrawView && pDrawView->AreObjectsMarked(); 742 sal_Bool bHasPaintBrush = pViewData->GetView()->HasPaintBrush(); 743 744 if ( !bHasPaintBrush && !bSelection ) 745 rSet.DisableItem( SID_FORMATPAINTBRUSH ); 746 else 747 rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, bHasPaintBrush ) ); 748 } 749 750 ScDrawView* ScDrawShell::GetDrawView() 751 { 752 return pViewData->GetView()->GetScDrawView(); 753 } 754 755 756 757 758