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 case SID_FLIP_HORIZONTAL: 329 pView->MirrorAllMarkedHorizontal(); 330 rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); 331 break; 332 case SID_MIRROR_VERTICAL: 333 case SID_FLIP_VERTICAL: 334 pView->MirrorAllMarkedVertical(); 335 rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); 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