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