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_sd.hxx" 26 27 #include "DrawViewShell.hxx" 28 #include "ViewShellImplementation.hxx" 29 #include <vcl/waitobj.hxx> 30 31 #ifndef _SVXIDS_HRC 32 #include <svx/svxids.hrc> 33 #endif 34 #include <svx/dialogs.hrc> 35 #ifndef _IMAPDLG_HXX 36 #include <svx/imapdlg.hxx> 37 #endif 38 #include <vcl/msgbox.hxx> 39 #include <sfx2/request.hxx> 40 #include <svx/svdogrp.hxx> 41 #include <svx/svdoole2.hxx> 42 #include <svx/svdograf.hxx> 43 #include <svx/svxdlg.hxx> 44 #ifndef _BINDING_HXX //autogen 45 #include <sfx2/bindings.hxx> 46 #endif 47 #include <sfx2/dispatch.hxx> 48 #include <svx/svdoole2.hxx> 49 #include <svl/style.hxx> 50 #include <svx/svdpagv.hxx> 51 #include <svx/grafctrl.hxx> 52 #include "stlsheet.hxx" 53 54 #include <sfx2/viewfrm.hxx> 55 56 #include "app.hrc" 57 #include "strings.hrc" 58 #include "helpids.h" 59 #include "misc.hxx" 60 #include "Window.hxx" 61 #include "imapinfo.hxx" 62 #include "futempl.hxx" 63 #include "fusel.hxx" 64 #include "sdresid.hxx" 65 #include "drawdoc.hxx" 66 #include "DrawDocShell.hxx" 67 #include "drawview.hxx" 68 #include "sdabstdlg.hxx" 69 #include "brkdlg.hrc" 70 namespace sd { 71 72 #define MIN_ACTIONS_FOR_DIALOG 5000 // bei mehr als 1600 Metaobjekten 73 // wird beim Aufbrechen ein Dialog 74 // angezeigt. 75 /************************************************************************* 76 |* 77 |* SfxRequests fuer temporaere Funktionen 78 |* 79 \************************************************************************/ 80 81 void DrawViewShell::FuTemp03(SfxRequest& rReq) 82 { 83 sal_uInt16 nSId = rReq.GetSlot(); 84 switch( nSId ) 85 { 86 case SID_GROUP: // BASIC 87 { 88 if ( mpDrawView->IsPresObjSelected( sal_True, sal_True, sal_True ) ) 89 { 90 ::sd::Window* pWindow = GetActiveWindow(); 91 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 92 } 93 else 94 { 95 mpDrawView->GroupMarked(); 96 } 97 Cancel(); 98 rReq.Done (); 99 } 100 break; 101 102 case SID_UNGROUP: // BASIC 103 { 104 mpDrawView->UnGroupMarked(); 105 Cancel(); 106 rReq.Done (); 107 } 108 break; 109 110 case SID_NAME_GROUP: 111 { 112 // only allow for single object selection since the name of an object needs 113 // to be unique 114 if(1L == mpDrawView->GetMarkedObjectCount()) 115 { 116 // #i68101# 117 SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L); 118 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); 119 String aName(pSelected->GetName()); 120 121 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 122 OSL_ENSURE(pFact, "Dialogdiet fail!"); 123 AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName); 124 OSL_ENSURE(pDlg, "Dialogdiet fail!"); 125 126 pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl)); 127 128 if(RET_OK == pDlg->Execute()) 129 { 130 pDlg->GetName(aName); 131 pSelected->SetName(aName); 132 } 133 134 delete pDlg; 135 } 136 137 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 138 rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False ); 139 rBindings.Invalidate( SID_CONTEXT ); 140 141 Cancel(); 142 rReq.Ignore(); 143 break; 144 } 145 146 // #i68101# 147 case SID_OBJECT_TITLE_DESCRIPTION: 148 { 149 if(1L == mpDrawView->GetMarkedObjectCount()) 150 { 151 SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L); 152 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); 153 String aTitle(pSelected->GetTitle()); 154 String aDescription(pSelected->GetDescription()); 155 156 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 157 OSL_ENSURE(pFact, "Dialogdiet fail!"); 158 AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription); 159 OSL_ENSURE(pDlg, "Dialogdiet fail!"); 160 161 if(RET_OK == pDlg->Execute()) 162 { 163 pDlg->GetTitle(aTitle); 164 pDlg->GetDescription(aDescription); 165 pSelected->SetTitle(aTitle); 166 pSelected->SetDescription(aDescription); 167 } 168 169 delete pDlg; 170 } 171 172 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 173 rBindings.Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False ); 174 rBindings.Invalidate( SID_CONTEXT ); 175 176 Cancel(); 177 rReq.Ignore(); 178 break; 179 } 180 181 case SID_ENTER_GROUP: // BASIC 182 { 183 mpDrawView->EnterMarkedGroup(); 184 Cancel(); 185 rReq.Done (); 186 } 187 break; 188 189 case SID_LEAVE_GROUP: // BASIC 190 { 191 mpDrawView->LeaveOneGroup(); 192 Cancel(); 193 rReq.Done (); 194 } 195 break; 196 197 case SID_LEAVE_ALL_GROUPS: // BASIC 198 { 199 mpDrawView->LeaveAllGroup(); 200 Cancel(); 201 rReq.Done (); 202 } 203 break; 204 205 case SID_COMBINE: // BASIC 206 { 207 // #88224# End text edit to avoid conflicts 208 if(mpDrawView->IsTextEdit()) 209 mpDrawView->SdrEndTextEdit(); 210 211 if ( mpDrawView->IsPresObjSelected() ) 212 { 213 ::sd::Window* pWindow = GetActiveWindow(); 214 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 215 } 216 else 217 { 218 WaitObject aWait( (Window*)GetActiveWindow() ); 219 mpDrawView->CombineMarkedObjects(sal_False); 220 } 221 Cancel(); 222 rReq.Done (); 223 } 224 break; 225 226 case SID_DISTRIBUTE_DLG: 227 { 228 if ( mpDrawView->IsPresObjSelected() ) 229 { 230 ::sd::Window* pWindow = GetActiveWindow(); 231 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 232 } 233 else 234 { 235 mpDrawView->DistributeMarkedObjects(); 236 } 237 Cancel(); 238 rReq.Done (); 239 } 240 break; 241 242 case SID_POLY_MERGE: 243 { 244 // #88224# End text edit to avoid conflicts 245 if(mpDrawView->IsTextEdit()) 246 mpDrawView->SdrEndTextEdit(); 247 248 if ( mpDrawView->IsPresObjSelected() ) 249 { 250 ::sd::Window* pWindow = GetActiveWindow(); 251 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 252 } 253 else 254 { 255 WaitObject aWait( (Window*)GetActiveWindow() ); 256 mpDrawView->MergeMarkedObjects(SDR_MERGE_MERGE); 257 } 258 Cancel(); 259 rReq.Done (); 260 } 261 break; 262 263 case SID_POLY_SUBSTRACT: 264 { 265 // #88224# End text edit to avoid conflicts 266 if(mpDrawView->IsTextEdit()) 267 mpDrawView->SdrEndTextEdit(); 268 269 if ( mpDrawView->IsPresObjSelected() ) 270 { 271 ::sd::Window* pWindow = GetActiveWindow(); 272 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 273 } 274 else 275 { 276 WaitObject aWait( (Window*)GetActiveWindow() ); 277 mpDrawView->MergeMarkedObjects(SDR_MERGE_SUBSTRACT); 278 } 279 Cancel(); 280 rReq.Done (); 281 } 282 break; 283 284 case SID_POLY_INTERSECT: 285 { 286 // #88224# End text edit to avoid conflicts 287 if(mpDrawView->IsTextEdit()) 288 mpDrawView->SdrEndTextEdit(); 289 290 if ( mpDrawView->IsPresObjSelected() ) 291 { 292 ::sd::Window* pWindow = GetActiveWindow(); 293 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 294 } 295 else 296 { 297 WaitObject aWait( (Window*)GetActiveWindow() ); 298 mpDrawView->MergeMarkedObjects(SDR_MERGE_INTERSECT); 299 } 300 Cancel(); 301 rReq.Done (); 302 } 303 break; 304 305 case SID_DISMANTLE: // BASIC 306 { 307 if ( mpDrawView->IsDismantlePossible(sal_False) ) 308 { 309 WaitObject aWait( (Window*)GetActiveWindow() ); 310 mpDrawView->DismantleMarkedObjects(sal_False); 311 } 312 Cancel(); 313 rReq.Done (); 314 } 315 break; 316 317 case SID_CONNECT: // BASIC 318 { 319 if ( mpDrawView->IsPresObjSelected() ) 320 { 321 ::sd::Window* pWindow = GetActiveWindow(); 322 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 323 } 324 else 325 { 326 WaitObject aWait( (Window*)GetActiveWindow() ); 327 mpDrawView->CombineMarkedObjects(sal_True); 328 } 329 Cancel(); 330 rReq.Done (); 331 } 332 break; 333 334 case SID_BREAK: // BASIC 335 { 336 if ( mpDrawView->IsTextEdit() ) 337 { 338 mpDrawView->SdrEndTextEdit(); 339 } 340 341 if ( mpDrawView->IsBreak3DObjPossible() ) 342 { 343 WaitObject aWait( (Window*)GetActiveWindow() ); 344 mpDrawView->Break3DObj(); 345 } 346 else if ( mpDrawView->IsDismantlePossible(sal_True) ) 347 { 348 WaitObject aWait( (Window*)GetActiveWindow() ); 349 mpDrawView->DismantleMarkedObjects(sal_True); 350 } 351 else if ( mpDrawView->IsImportMtfPossible() ) 352 { 353 354 WaitObject aWait( (Window*)GetActiveWindow() ); 355 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 356 sal_uLong nAnz=rMarkList.GetMarkCount(); 357 358 // Summe der Metaobjekte aller sel. Metafiles erm. 359 sal_uLong nCount = 0; 360 for(sal_uLong nm=0; nm<nAnz; nm++) 361 { 362 SdrMark* pM=rMarkList.GetMark(nm); 363 SdrObject* pObj=pM->GetMarkedSdrObj(); 364 SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj); 365 SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj); 366 367 if(pGraf) 368 { 369 if(pGraf->HasGDIMetaFile()) 370 { 371 nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount(); 372 } 373 else if(pGraf->isEmbeddedSvg()) 374 { 375 nCount += pGraf->getMetafileFromEmbeddedSvg().GetActionCount(); 376 } 377 } 378 379 if(pOle2 && pOle2->GetGraphic()) 380 { 381 nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount(); 382 } 383 } 384 385 // anhand der erm. Summe entscheiden ob mit 386 // oder ohne Dialog aufgebrochen wird. 387 if(nCount < MIN_ACTIONS_FOR_DIALOG) 388 { 389 // ohne Dialog aufbrechen 390 mpDrawView->DoImportMarkedMtf(); 391 } 392 else 393 { 394 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 395 if( pFact ) 396 { 397 VclAbstractDialog* pDlg = pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, nAnz ); 398 if( pDlg ) 399 { 400 pDlg->Execute(); 401 delete pDlg; 402 } 403 } 404 } 405 } 406 407 Cancel(); 408 rReq.Done (); 409 } 410 break; 411 412 case SID_CONVERT_TO_3D: 413 { 414 if ( mpDrawView->IsPresObjSelected() ) 415 { 416 ::sd::Window* pWindow = GetActiveWindow(); 417 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 418 } 419 else 420 { 421 if (mpDrawView->IsConvertTo3DObjPossible()) 422 { 423 if (mpDrawView->IsTextEdit()) 424 { 425 mpDrawView->SdrEndTextEdit(); 426 } 427 428 WaitObject aWait( (Window*)GetActiveWindow() ); 429 mpDrawView->ConvertMarkedObjTo3D(sal_True); 430 } 431 } 432 433 Cancel(); 434 rReq.Done(); 435 } 436 break; 437 438 case SID_FRAME_TO_TOP: // BASIC 439 { 440 mpDrawView->PutMarkedToTop(); 441 Cancel(); 442 Invalidate( SID_POSITION ); 443 rReq.Done (); 444 } 445 break; 446 447 case SID_MOREFRONT: // BASIC 448 { 449 mpDrawView->MovMarkedToTop(); 450 Cancel(); 451 Invalidate( SID_POSITION ); 452 rReq.Done (); 453 } 454 break; 455 456 case SID_MOREBACK: // BASIC 457 { 458 mpDrawView->MovMarkedToBtm(); 459 Cancel(); 460 Invalidate( SID_POSITION ); 461 rReq.Done (); 462 } 463 break; 464 465 case SID_FRAME_TO_BOTTOM: // BASIC 466 { 467 mpDrawView->PutMarkedToBtm(); 468 Cancel(); 469 Invalidate( SID_POSITION ); 470 rReq.Done (); 471 } 472 break; 473 474 case SID_HORIZONTAL: // BASIC 475 { 476 mpDrawView->MirrorAllMarkedHorizontal(); 477 Cancel(); 478 rReq.Done (); 479 } 480 break; 481 482 case SID_VERTICAL: // BASIC 483 { 484 mpDrawView->MirrorAllMarkedVertical(); 485 Cancel(); 486 rReq.Done (); 487 } 488 break; 489 490 case SID_OBJECT_ALIGN_LEFT: // BASIC 491 { 492 mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE); 493 Cancel(); 494 rReq.Done (); 495 } 496 break; 497 498 case SID_OBJECT_ALIGN_CENTER: // BASIC 499 { 500 mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE); 501 Cancel(); 502 rReq.Done (); 503 } 504 break; 505 506 case SID_OBJECT_ALIGN_RIGHT: // BASIC 507 { 508 mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE); 509 Cancel(); 510 rReq.Done (); 511 } 512 break; 513 514 case SID_OBJECT_ALIGN_UP: // BASIC 515 { 516 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP); 517 Cancel(); 518 rReq.Done (); 519 } 520 break; 521 522 case SID_OBJECT_ALIGN_MIDDLE: // BASIC 523 { 524 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER); 525 Cancel(); 526 rReq.Done (); 527 } 528 break; 529 530 case SID_OBJECT_ALIGN_DOWN: // BASIC 531 { 532 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM); 533 Cancel(); 534 rReq.Done (); 535 } 536 break; 537 538 case SID_SELECTALL: // BASIC 539 { 540 if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != 0) && 541 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints()) 542 { 543 if ( !mpDrawView->IsAction() ) 544 mpDrawView->MarkAllPoints(); 545 } 546 else 547 mpDrawView->SelectAll(); 548 549 Cancel(); 550 rReq.Done (); 551 } 552 break; 553 554 case SID_STYLE_NEW: // BASIC ??? 555 case SID_STYLE_APPLY: 556 case SID_STYLE_EDIT: 557 case SID_STYLE_DELETE: 558 case SID_STYLE_FAMILY: 559 case SID_STYLE_WATERCAN: 560 case SID_STYLE_UPDATE_BY_EXAMPLE: 561 case SID_STYLE_NEW_BY_EXAMPLE: 562 { 563 if( rReq.GetSlot() == SID_STYLE_EDIT && !rReq.GetArgs() ) 564 { 565 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet(); 566 if( pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 567 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 568 569 if( (pStyleSheet == NULL) && GetView()->IsTextEdit() ) 570 { 571 GetView()->SdrEndTextEdit(); 572 573 pStyleSheet = mpDrawView->GetStyleSheet(); 574 if(pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 575 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 576 } 577 578 if( pStyleSheet == NULL ) 579 { 580 rReq.Ignore(); 581 break; 582 } 583 584 SfxAllItemSet aSet(GetDoc()->GetPool()); 585 586 SfxStringItem aStyleNameItem( SID_STYLE_EDIT, pStyleSheet->GetName() ); 587 aSet.Put(aStyleNameItem); 588 589 SfxUInt16Item aStyleFamilyItem( SID_STYLE_FAMILY, (sal_uInt16)pStyleSheet->GetFamily() ); 590 aSet.Put(aStyleFamilyItem); 591 592 rReq.SetArgs(aSet); 593 } 594 595 if( rReq.GetArgs() ) 596 { 597 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 598 if( rReq.GetSlot() == SID_STYLE_APPLY ) 599 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY ); 600 Cancel(); 601 } 602 else if( rReq.GetSlot() == SID_STYLE_APPLY ) 603 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON ); 604 rReq.Ignore (); 605 } 606 break; 607 608 case SID_IMAP: 609 { 610 SvxIMapDlg* pDlg; 611 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 612 613 GetViewFrame()->ToggleChildWindow( nId ); 614 GetViewFrame()->GetBindings().Invalidate( SID_IMAP ); 615 616 if ( GetViewFrame()->HasChildWindow( nId ) 617 && ( ( pDlg = ViewShell::Implementation::GetImageMapDialog() ) != NULL ) ) 618 { 619 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 620 621 if ( rMarkList.GetMarkCount() == 1 ) 622 UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() ); 623 } 624 625 Cancel(); 626 rReq.Ignore (); 627 } 628 break; 629 630 case SID_GRID_FRONT: 631 { 632 mpDrawView->SetGridFront( !mpDrawView->IsGridFront() ); 633 Cancel(); 634 rReq.Done (); 635 } 636 break; 637 638 case SID_HELPLINES_FRONT: 639 { 640 mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() ); 641 Cancel(); 642 rReq.Done (); 643 } 644 break; 645 646 default: 647 FuTemp04(rReq); 648 break; 649 }; 650 }; 651 652 /************************************************************************* 653 |* 654 |* Liefert die globale/Haupt-ID zurueck, also die ID, ueber die die 655 |* Toolbox ausgeloest wird 656 |* 657 \************************************************************************/ 658 659 sal_uInt16 DrawViewShell::GetIdBySubId( sal_uInt16 nSId ) 660 { 661 sal_uInt16 nMappedSId = 0; 662 switch( nSId ) 663 { 664 case SID_OBJECT_ROTATE: 665 case SID_OBJECT_MIRROR: 666 case SID_OBJECT_TRANSPARENCE: 667 case SID_OBJECT_GRADIENT: 668 case SID_OBJECT_SHEAR: 669 case SID_OBJECT_CROOK_ROTATE: 670 case SID_OBJECT_CROOK_SLANT: 671 case SID_OBJECT_CROOK_STRETCH: 672 case SID_CONVERT_TO_3D_LATHE: 673 { 674 nMappedSId = SID_OBJECT_CHOOSE_MODE; 675 } 676 break; 677 678 case SID_OBJECT_ALIGN_LEFT: 679 case SID_OBJECT_ALIGN_CENTER: 680 case SID_OBJECT_ALIGN_RIGHT: 681 case SID_OBJECT_ALIGN_UP: 682 case SID_OBJECT_ALIGN_MIDDLE: 683 case SID_OBJECT_ALIGN_DOWN: 684 { 685 nMappedSId = SID_OBJECT_ALIGN; 686 } 687 break; 688 689 case SID_FRAME_TO_TOP: 690 case SID_MOREFRONT: 691 case SID_MOREBACK: 692 case SID_FRAME_TO_BOTTOM: 693 case SID_BEFORE_OBJ: 694 case SID_BEHIND_OBJ: 695 case SID_REVERSE_ORDER: 696 { 697 nMappedSId = SID_POSITION; 698 } 699 break; 700 701 case SID_ZOOM_OUT: 702 case SID_ZOOM_IN: 703 case SID_SIZE_REAL: 704 case SID_ZOOM_PANNING: 705 case SID_SIZE_PAGE: 706 case SID_SIZE_PAGE_WIDTH: 707 case SID_SIZE_ALL: 708 case SID_SIZE_OPTIMAL: 709 case SID_ZOOM_NEXT: 710 case SID_ZOOM_PREV: 711 { 712 nMappedSId = SID_ZOOM_TOOLBOX; 713 } 714 break; 715 716 case SID_ATTR_CHAR: 717 case SID_TEXT_FITTOSIZE: 718 case SID_DRAW_CAPTION: 719 case SID_DRAW_FONTWORK: 720 case SID_DRAW_FONTWORK_VERTICAL: 721 { 722 nMappedSId = SID_DRAWTBX_TEXT; 723 } 724 break; 725 726 case SID_DRAW_RECT: 727 case SID_DRAW_SQUARE: 728 case SID_DRAW_RECT_ROUND: 729 case SID_DRAW_SQUARE_ROUND: 730 case SID_DRAW_RECT_NOFILL: 731 case SID_DRAW_SQUARE_NOFILL: 732 case SID_DRAW_RECT_ROUND_NOFILL: 733 case SID_DRAW_SQUARE_ROUND_NOFILL: 734 { 735 nMappedSId = SID_DRAWTBX_RECTANGLES; 736 } 737 break; 738 739 case SID_DRAW_ELLIPSE: 740 case SID_DRAW_CIRCLE: 741 case SID_DRAW_PIE: 742 case SID_DRAW_CIRCLEPIE: 743 case SID_DRAW_ELLIPSECUT: 744 case SID_DRAW_CIRCLECUT: 745 case SID_DRAW_ARC: 746 case SID_DRAW_CIRCLEARC: 747 case SID_DRAW_ELLIPSE_NOFILL: 748 case SID_DRAW_CIRCLE_NOFILL: 749 case SID_DRAW_PIE_NOFILL: 750 case SID_DRAW_CIRCLEPIE_NOFILL: 751 case SID_DRAW_ELLIPSECUT_NOFILL: 752 case SID_DRAW_CIRCLECUT_NOFILL: 753 { 754 nMappedSId = SID_DRAWTBX_ELLIPSES; 755 } 756 break; 757 758 case SID_DRAW_BEZIER_NOFILL: 759 case SID_DRAW_POLYGON_NOFILL: 760 case SID_DRAW_XPOLYGON_NOFILL: 761 case SID_DRAW_FREELINE_NOFILL: 762 case SID_DRAW_BEZIER_FILL: 763 case SID_DRAW_POLYGON: 764 case SID_DRAW_XPOLYGON: 765 case SID_DRAW_FREELINE: 766 { 767 nMappedSId = SID_DRAWTBX_LINES; 768 } 769 break; 770 771 case SID_DRAW_LINE: 772 case SID_DRAW_XLINE: 773 case SID_DRAW_MEASURELINE: 774 case SID_LINE_ARROW_START: 775 case SID_LINE_ARROW_END: 776 case SID_LINE_ARROWS: 777 case SID_LINE_ARROW_CIRCLE: 778 case SID_LINE_CIRCLE_ARROW: 779 case SID_LINE_ARROW_SQUARE: 780 case SID_LINE_SQUARE_ARROW: 781 { 782 nMappedSId = SID_DRAWTBX_ARROWS; 783 } 784 break; 785 786 case SID_3D_CUBE: 787 case SID_3D_TORUS: 788 case SID_3D_SPHERE: 789 case SID_3D_SHELL: 790 case SID_3D_HALF_SPHERE: 791 case SID_3D_CYLINDER: 792 case SID_3D_CONE: 793 case SID_3D_PYRAMID: 794 { 795 nMappedSId = SID_DRAWTBX_3D_OBJECTS; 796 } 797 break; 798 799 case SID_INSERT_DIAGRAM: 800 case SID_ATTR_TABLE: 801 case SID_INSERTFILE: 802 case SID_INSERT_GRAPHIC: 803 case SID_INSERT_AVMEDIA: 804 case SID_INSERTPAGE: 805 case SID_INSERT_MATH: 806 case SID_INSERT_FLOATINGFRAME: 807 case SID_INSERT_OBJECT: 808 case SID_INSERT_PLUGIN: 809 case SID_INSERT_SOUND: 810 case SID_INSERT_VIDEO: 811 case SID_INSERT_TABLE: 812 { 813 nMappedSId = SID_DRAWTBX_INSERT; 814 } 815 break; 816 817 case SID_TOOL_CONNECTOR: 818 case SID_CONNECTOR_ARROW_START: 819 case SID_CONNECTOR_ARROW_END: 820 case SID_CONNECTOR_ARROWS: 821 case SID_CONNECTOR_CIRCLE_START: 822 case SID_CONNECTOR_CIRCLE_END: 823 case SID_CONNECTOR_CIRCLES: 824 case SID_CONNECTOR_LINE: 825 case SID_CONNECTOR_LINE_ARROW_START: 826 case SID_CONNECTOR_LINE_ARROW_END: 827 case SID_CONNECTOR_LINE_ARROWS: 828 case SID_CONNECTOR_LINE_CIRCLE_START: 829 case SID_CONNECTOR_LINE_CIRCLE_END: 830 case SID_CONNECTOR_LINE_CIRCLES: 831 case SID_CONNECTOR_CURVE: 832 case SID_CONNECTOR_CURVE_ARROW_START: 833 case SID_CONNECTOR_CURVE_ARROW_END: 834 case SID_CONNECTOR_CURVE_ARROWS: 835 case SID_CONNECTOR_CURVE_CIRCLE_START: 836 case SID_CONNECTOR_CURVE_CIRCLE_END: 837 case SID_CONNECTOR_CURVE_CIRCLES: 838 case SID_CONNECTOR_LINES: 839 case SID_CONNECTOR_LINES_ARROW_START: 840 case SID_CONNECTOR_LINES_ARROW_END: 841 case SID_CONNECTOR_LINES_ARROWS: 842 case SID_CONNECTOR_LINES_CIRCLE_START: 843 case SID_CONNECTOR_LINES_CIRCLE_END: 844 case SID_CONNECTOR_LINES_CIRCLES: 845 { 846 nMappedSId = SID_DRAWTBX_CONNECTORS; 847 } 848 } 849 return( nMappedSId ); 850 } 851 852 /************************************************************************* 853 |* 854 |* Fuellt das SlotArray, um das aktuelle Mapping des ToolboxSlots zu 855 |* bekommen 856 |* 857 \************************************************************************/ 858 859 void DrawViewShell::MapSlot( sal_uInt16 nSId ) 860 { 861 sal_uInt16 nMappedSId = GetIdBySubId( nSId ); 862 863 if( nMappedSId > 0 ) 864 { 865 sal_uInt16 nID = GetArrayId( nMappedSId ) + 1; 866 mpSlotArray[ nID ] = nSId; 867 } 868 } 869 870 /************************************************************************* 871 |* 872 |* Ermoeglicht ueber das SlotArray ein ImageMapping 873 |* 874 \************************************************************************/ 875 876 void DrawViewShell::UpdateToolboxImages( SfxItemSet &rSet, sal_Bool bPermanent ) 877 { 878 if( !bPermanent ) 879 { 880 sal_uInt16 nId = GetArrayId( SID_ZOOM_TOOLBOX ) + 1; 881 rSet.Put( TbxImageItem( SID_ZOOM_TOOLBOX, mpSlotArray[nId] ) ); 882 883 nId = GetArrayId( SID_DRAWTBX_INSERT ) + 1; 884 rSet.Put( TbxImageItem( SID_DRAWTBX_INSERT, mpSlotArray[nId] ) ); 885 886 nId = GetArrayId( SID_POSITION ) + 1; 887 rSet.Put( TbxImageItem( SID_POSITION, mpSlotArray[nId] ) ); 888 889 nId = GetArrayId( SID_OBJECT_ALIGN ) + 1; 890 rSet.Put( TbxImageItem( SID_OBJECT_ALIGN, mpSlotArray[nId] ) ); 891 } 892 else 893 { 894 for( sal_uInt16 nId = 0; nId < SLOTARRAY_COUNT; nId += 2 ) 895 { 896 rSet.Put( TbxImageItem( mpSlotArray[nId], mpSlotArray[nId+1] ) ); 897 } 898 } 899 } 900 901 /************************************************************************* 902 |* 903 |* Gibt den gemappten Slot zurueck 904 |* 905 \************************************************************************/ 906 907 sal_uInt16 DrawViewShell::GetMappedSlot( sal_uInt16 nSId ) 908 { 909 sal_uInt16 nSlot = 0; 910 sal_uInt16 nId = GetArrayId( nSId ); 911 if( nId != USHRT_MAX ) 912 nSlot = mpSlotArray[ nId+1 ]; 913 914 // Wenn der Slot noch auf sich selbst gemapped ist, muss 0 zurueck- 915 // gegeben werden, da sonst der Slot immer wieder selbst executet 916 // wird. Im Array ist der Slot selbst initial vorhanden, damit das 917 // Image richtig angezeigt wird. 918 if( nSId == nSlot ) 919 return( 0 ); 920 921 return( nSlot ); 922 } 923 924 /************************************************************************* 925 |* 926 |* Gibt die Nummer des HauptSlots im SlotArray zurueck 927 |* 928 \************************************************************************/ 929 930 sal_uInt16 DrawViewShell::GetArrayId( sal_uInt16 nSId ) 931 { 932 for( sal_uInt16 i = 0; i < SLOTARRAY_COUNT; i += 2 ) 933 { 934 if( mpSlotArray[ i ] == nSId ) 935 return( i ); 936 } 937 DBG_ERROR( "Slot im Array nicht gefunden!" ); 938 return( USHRT_MAX ); 939 } 940 941 942 /************************************************************************* 943 |* 944 |* IMap-Dlg updaten 945 |* 946 \************************************************************************/ 947 948 void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) 949 { 950 if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() && 951 GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) 952 { 953 Graphic aGraphic; 954 ImageMap* pIMap = NULL; 955 TargetList* pTargetList = NULL; 956 SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pObj ); 957 958 // get graphic from shape 959 SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj ); 960 if( pGrafObj ) 961 aGraphic = pGrafObj->GetGraphic(); 962 963 if ( pIMapInfo ) 964 { 965 pIMap = (ImageMap*) &pIMapInfo->GetImageMap(); 966 pTargetList = new TargetList; 967 GetViewFrame()->GetTargetList( *pTargetList ); 968 } 969 970 SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList, pObj ); 971 972 // TargetListe kann von uns wieder geloescht werden 973 if ( pTargetList ) 974 { 975 String* pEntry = pTargetList->First(); 976 while( pEntry ) 977 { 978 delete pEntry; 979 pEntry = pTargetList->Next(); 980 } 981 982 delete pTargetList; 983 } 984 } 985 } 986 987 // ----------------------------------------------------------------------------- 988 989 IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog ) 990 { 991 String aName; 992 993 if( pDialog ) 994 pDialog->GetName( aName ); 995 996 return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 ); 997 } 998 999 } // end of namespace sd 1000