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 if (pGraf!=NULL && pGraf->HasGDIMetaFile()) 367 nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount(); 368 if(pOle2!=NULL && pOle2->GetGraphic()) 369 nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount(); 370 } 371 372 // anhand der erm. Summe entscheiden ob mit 373 // oder ohne Dialog aufgebrochen wird. 374 if(nCount < MIN_ACTIONS_FOR_DIALOG) 375 { 376 // ohne Dialog aufbrechen 377 mpDrawView->DoImportMarkedMtf(); 378 } 379 else 380 { 381 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 382 if( pFact ) 383 { 384 VclAbstractDialog* pDlg = pFact->CreateBreakDlg(GetActiveWindow(), mpDrawView, GetDocSh(), nCount, nAnz ); 385 if( pDlg ) 386 { 387 pDlg->Execute(); 388 delete pDlg; 389 } 390 } 391 } 392 } 393 394 Cancel(); 395 rReq.Done (); 396 } 397 break; 398 399 case SID_CONVERT_TO_3D: 400 { 401 if ( mpDrawView->IsPresObjSelected() ) 402 { 403 ::sd::Window* pWindow = GetActiveWindow(); 404 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 405 } 406 else 407 { 408 if (mpDrawView->IsConvertTo3DObjPossible()) 409 { 410 if (mpDrawView->IsTextEdit()) 411 { 412 mpDrawView->SdrEndTextEdit(); 413 } 414 415 WaitObject aWait( (Window*)GetActiveWindow() ); 416 mpDrawView->ConvertMarkedObjTo3D(sal_True); 417 } 418 } 419 420 Cancel(); 421 rReq.Done(); 422 } 423 break; 424 425 case SID_FRAME_TO_TOP: // BASIC 426 { 427 mpDrawView->PutMarkedToTop(); 428 Cancel(); 429 Invalidate( SID_POSITION ); 430 rReq.Done (); 431 } 432 break; 433 434 case SID_MOREFRONT: // BASIC 435 { 436 mpDrawView->MovMarkedToTop(); 437 Cancel(); 438 Invalidate( SID_POSITION ); 439 rReq.Done (); 440 } 441 break; 442 443 case SID_MOREBACK: // BASIC 444 { 445 mpDrawView->MovMarkedToBtm(); 446 Cancel(); 447 Invalidate( SID_POSITION ); 448 rReq.Done (); 449 } 450 break; 451 452 case SID_FRAME_TO_BOTTOM: // BASIC 453 { 454 mpDrawView->PutMarkedToBtm(); 455 Cancel(); 456 Invalidate( SID_POSITION ); 457 rReq.Done (); 458 } 459 break; 460 461 case SID_HORIZONTAL: // BASIC 462 { 463 mpDrawView->MirrorAllMarkedHorizontal(); 464 Cancel(); 465 rReq.Done (); 466 } 467 break; 468 469 case SID_VERTICAL: // BASIC 470 { 471 mpDrawView->MirrorAllMarkedVertical(); 472 Cancel(); 473 rReq.Done (); 474 } 475 break; 476 477 case SID_OBJECT_ALIGN_LEFT: // BASIC 478 { 479 mpDrawView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE); 480 Cancel(); 481 rReq.Done (); 482 } 483 break; 484 485 case SID_OBJECT_ALIGN_CENTER: // BASIC 486 { 487 mpDrawView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE); 488 Cancel(); 489 rReq.Done (); 490 } 491 break; 492 493 case SID_OBJECT_ALIGN_RIGHT: // BASIC 494 { 495 mpDrawView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE); 496 Cancel(); 497 rReq.Done (); 498 } 499 break; 500 501 case SID_OBJECT_ALIGN_UP: // BASIC 502 { 503 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP); 504 Cancel(); 505 rReq.Done (); 506 } 507 break; 508 509 case SID_OBJECT_ALIGN_MIDDLE: // BASIC 510 { 511 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER); 512 Cancel(); 513 rReq.Done (); 514 } 515 break; 516 517 case SID_OBJECT_ALIGN_DOWN: // BASIC 518 { 519 mpDrawView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM); 520 Cancel(); 521 rReq.Done (); 522 } 523 break; 524 525 case SID_SELECTALL: // BASIC 526 { 527 if( (dynamic_cast<FuSelection*>( GetOldFunction().get() ) != 0) && 528 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints()) 529 { 530 if ( !mpDrawView->IsAction() ) 531 mpDrawView->MarkAllPoints(); 532 } 533 else 534 mpDrawView->SelectAll(); 535 536 Cancel(); 537 rReq.Done (); 538 } 539 break; 540 541 case SID_STYLE_NEW: // BASIC ??? 542 case SID_STYLE_APPLY: 543 case SID_STYLE_EDIT: 544 case SID_STYLE_DELETE: 545 case SID_STYLE_FAMILY: 546 case SID_STYLE_WATERCAN: 547 case SID_STYLE_UPDATE_BY_EXAMPLE: 548 case SID_STYLE_NEW_BY_EXAMPLE: 549 { 550 if( rReq.GetSlot() == SID_STYLE_EDIT && !rReq.GetArgs() ) 551 { 552 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet(); 553 if( pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 554 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 555 556 if( (pStyleSheet == NULL) && GetView()->IsTextEdit() ) 557 { 558 GetView()->SdrEndTextEdit(); 559 560 pStyleSheet = mpDrawView->GetStyleSheet(); 561 if(pStyleSheet && pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 562 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 563 } 564 565 if( pStyleSheet == NULL ) 566 { 567 rReq.Ignore(); 568 break; 569 } 570 571 SfxAllItemSet aSet(GetDoc()->GetPool()); 572 573 SfxStringItem aStyleNameItem( SID_STYLE_EDIT, pStyleSheet->GetName() ); 574 aSet.Put(aStyleNameItem); 575 576 SfxUInt16Item aStyleFamilyItem( SID_STYLE_FAMILY, (sal_uInt16)pStyleSheet->GetFamily() ); 577 aSet.Put(aStyleFamilyItem); 578 579 rReq.SetArgs(aSet); 580 } 581 582 if( rReq.GetArgs() ) 583 { 584 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 585 if( rReq.GetSlot() == SID_STYLE_APPLY ) 586 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY ); 587 Cancel(); 588 } 589 else if( rReq.GetSlot() == SID_STYLE_APPLY ) 590 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON ); 591 rReq.Ignore (); 592 } 593 break; 594 595 case SID_IMAP: 596 { 597 SvxIMapDlg* pDlg; 598 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); 599 600 GetViewFrame()->ToggleChildWindow( nId ); 601 GetViewFrame()->GetBindings().Invalidate( SID_IMAP ); 602 603 if ( GetViewFrame()->HasChildWindow( nId ) 604 && ( ( pDlg = ViewShell::Implementation::GetImageMapDialog() ) != NULL ) ) 605 { 606 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 607 608 if ( rMarkList.GetMarkCount() == 1 ) 609 UpdateIMapDlg( rMarkList.GetMark( 0 )->GetMarkedSdrObj() ); 610 } 611 612 Cancel(); 613 rReq.Ignore (); 614 } 615 break; 616 617 case SID_GRID_FRONT: 618 { 619 mpDrawView->SetGridFront( !mpDrawView->IsGridFront() ); 620 Cancel(); 621 rReq.Done (); 622 } 623 break; 624 625 case SID_HELPLINES_FRONT: 626 { 627 mpDrawView->SetHlplFront( !mpDrawView->IsHlplFront() ); 628 Cancel(); 629 rReq.Done (); 630 } 631 break; 632 633 default: 634 FuTemp04(rReq); 635 break; 636 }; 637 }; 638 639 /************************************************************************* 640 |* 641 |* Liefert die globale/Haupt-ID zurueck, also die ID, ueber die die 642 |* Toolbox ausgeloest wird 643 |* 644 \************************************************************************/ 645 646 sal_uInt16 DrawViewShell::GetIdBySubId( sal_uInt16 nSId ) 647 { 648 sal_uInt16 nMappedSId = 0; 649 switch( nSId ) 650 { 651 case SID_OBJECT_ROTATE: 652 case SID_OBJECT_MIRROR: 653 case SID_OBJECT_TRANSPARENCE: 654 case SID_OBJECT_GRADIENT: 655 case SID_OBJECT_SHEAR: 656 case SID_OBJECT_CROOK_ROTATE: 657 case SID_OBJECT_CROOK_SLANT: 658 case SID_OBJECT_CROOK_STRETCH: 659 case SID_CONVERT_TO_3D_LATHE: 660 { 661 nMappedSId = SID_OBJECT_CHOOSE_MODE; 662 } 663 break; 664 665 case SID_OBJECT_ALIGN_LEFT: 666 case SID_OBJECT_ALIGN_CENTER: 667 case SID_OBJECT_ALIGN_RIGHT: 668 case SID_OBJECT_ALIGN_UP: 669 case SID_OBJECT_ALIGN_MIDDLE: 670 case SID_OBJECT_ALIGN_DOWN: 671 { 672 nMappedSId = SID_OBJECT_ALIGN; 673 } 674 break; 675 676 case SID_FRAME_TO_TOP: 677 case SID_MOREFRONT: 678 case SID_MOREBACK: 679 case SID_FRAME_TO_BOTTOM: 680 case SID_BEFORE_OBJ: 681 case SID_BEHIND_OBJ: 682 case SID_REVERSE_ORDER: 683 { 684 nMappedSId = SID_POSITION; 685 } 686 break; 687 688 case SID_ZOOM_OUT: 689 case SID_ZOOM_IN: 690 case SID_SIZE_REAL: 691 case SID_ZOOM_PANNING: 692 case SID_SIZE_PAGE: 693 case SID_SIZE_PAGE_WIDTH: 694 case SID_SIZE_ALL: 695 case SID_SIZE_OPTIMAL: 696 case SID_ZOOM_NEXT: 697 case SID_ZOOM_PREV: 698 { 699 nMappedSId = SID_ZOOM_TOOLBOX; 700 } 701 break; 702 703 case SID_ATTR_CHAR: 704 case SID_TEXT_FITTOSIZE: 705 case SID_DRAW_CAPTION: 706 case SID_DRAW_FONTWORK: 707 case SID_DRAW_FONTWORK_VERTICAL: 708 { 709 nMappedSId = SID_DRAWTBX_TEXT; 710 } 711 break; 712 713 case SID_DRAW_RECT: 714 case SID_DRAW_SQUARE: 715 case SID_DRAW_RECT_ROUND: 716 case SID_DRAW_SQUARE_ROUND: 717 case SID_DRAW_RECT_NOFILL: 718 case SID_DRAW_SQUARE_NOFILL: 719 case SID_DRAW_RECT_ROUND_NOFILL: 720 case SID_DRAW_SQUARE_ROUND_NOFILL: 721 { 722 nMappedSId = SID_DRAWTBX_RECTANGLES; 723 } 724 break; 725 726 case SID_DRAW_ELLIPSE: 727 case SID_DRAW_CIRCLE: 728 case SID_DRAW_PIE: 729 case SID_DRAW_CIRCLEPIE: 730 case SID_DRAW_ELLIPSECUT: 731 case SID_DRAW_CIRCLECUT: 732 case SID_DRAW_ARC: 733 case SID_DRAW_CIRCLEARC: 734 case SID_DRAW_ELLIPSE_NOFILL: 735 case SID_DRAW_CIRCLE_NOFILL: 736 case SID_DRAW_PIE_NOFILL: 737 case SID_DRAW_CIRCLEPIE_NOFILL: 738 case SID_DRAW_ELLIPSECUT_NOFILL: 739 case SID_DRAW_CIRCLECUT_NOFILL: 740 { 741 nMappedSId = SID_DRAWTBX_ELLIPSES; 742 } 743 break; 744 745 case SID_DRAW_BEZIER_NOFILL: 746 case SID_DRAW_POLYGON_NOFILL: 747 case SID_DRAW_XPOLYGON_NOFILL: 748 case SID_DRAW_FREELINE_NOFILL: 749 case SID_DRAW_BEZIER_FILL: 750 case SID_DRAW_POLYGON: 751 case SID_DRAW_XPOLYGON: 752 case SID_DRAW_FREELINE: 753 { 754 nMappedSId = SID_DRAWTBX_LINES; 755 } 756 break; 757 758 case SID_DRAW_LINE: 759 case SID_DRAW_XLINE: 760 case SID_DRAW_MEASURELINE: 761 case SID_LINE_ARROW_START: 762 case SID_LINE_ARROW_END: 763 case SID_LINE_ARROWS: 764 case SID_LINE_ARROW_CIRCLE: 765 case SID_LINE_CIRCLE_ARROW: 766 case SID_LINE_ARROW_SQUARE: 767 case SID_LINE_SQUARE_ARROW: 768 { 769 nMappedSId = SID_DRAWTBX_ARROWS; 770 } 771 break; 772 773 case SID_3D_CUBE: 774 case SID_3D_TORUS: 775 case SID_3D_SPHERE: 776 case SID_3D_SHELL: 777 case SID_3D_HALF_SPHERE: 778 case SID_3D_CYLINDER: 779 case SID_3D_CONE: 780 case SID_3D_PYRAMID: 781 { 782 nMappedSId = SID_DRAWTBX_3D_OBJECTS; 783 } 784 break; 785 786 case SID_INSERT_DIAGRAM: 787 case SID_ATTR_TABLE: 788 case SID_INSERTFILE: 789 case SID_INSERT_GRAPHIC: 790 case SID_INSERT_AVMEDIA: 791 case SID_INSERTPAGE: 792 case SID_INSERT_MATH: 793 case SID_INSERT_FLOATINGFRAME: 794 case SID_INSERT_OBJECT: 795 case SID_INSERT_PLUGIN: 796 case SID_INSERT_SOUND: 797 case SID_INSERT_VIDEO: 798 case SID_INSERT_TABLE: 799 { 800 nMappedSId = SID_DRAWTBX_INSERT; 801 } 802 break; 803 804 case SID_TOOL_CONNECTOR: 805 case SID_CONNECTOR_ARROW_START: 806 case SID_CONNECTOR_ARROW_END: 807 case SID_CONNECTOR_ARROWS: 808 case SID_CONNECTOR_CIRCLE_START: 809 case SID_CONNECTOR_CIRCLE_END: 810 case SID_CONNECTOR_CIRCLES: 811 case SID_CONNECTOR_LINE: 812 case SID_CONNECTOR_LINE_ARROW_START: 813 case SID_CONNECTOR_LINE_ARROW_END: 814 case SID_CONNECTOR_LINE_ARROWS: 815 case SID_CONNECTOR_LINE_CIRCLE_START: 816 case SID_CONNECTOR_LINE_CIRCLE_END: 817 case SID_CONNECTOR_LINE_CIRCLES: 818 case SID_CONNECTOR_CURVE: 819 case SID_CONNECTOR_CURVE_ARROW_START: 820 case SID_CONNECTOR_CURVE_ARROW_END: 821 case SID_CONNECTOR_CURVE_ARROWS: 822 case SID_CONNECTOR_CURVE_CIRCLE_START: 823 case SID_CONNECTOR_CURVE_CIRCLE_END: 824 case SID_CONNECTOR_CURVE_CIRCLES: 825 case SID_CONNECTOR_LINES: 826 case SID_CONNECTOR_LINES_ARROW_START: 827 case SID_CONNECTOR_LINES_ARROW_END: 828 case SID_CONNECTOR_LINES_ARROWS: 829 case SID_CONNECTOR_LINES_CIRCLE_START: 830 case SID_CONNECTOR_LINES_CIRCLE_END: 831 case SID_CONNECTOR_LINES_CIRCLES: 832 { 833 nMappedSId = SID_DRAWTBX_CONNECTORS; 834 } 835 } 836 return( nMappedSId ); 837 } 838 839 /************************************************************************* 840 |* 841 |* Fuellt das SlotArray, um das aktuelle Mapping des ToolboxSlots zu 842 |* bekommen 843 |* 844 \************************************************************************/ 845 846 void DrawViewShell::MapSlot( sal_uInt16 nSId ) 847 { 848 sal_uInt16 nMappedSId = GetIdBySubId( nSId ); 849 850 if( nMappedSId > 0 ) 851 { 852 sal_uInt16 nID = GetArrayId( nMappedSId ) + 1; 853 mpSlotArray[ nID ] = nSId; 854 } 855 } 856 857 /************************************************************************* 858 |* 859 |* Ermoeglicht ueber das SlotArray ein ImageMapping 860 |* 861 \************************************************************************/ 862 863 void DrawViewShell::UpdateToolboxImages( SfxItemSet &rSet, sal_Bool bPermanent ) 864 { 865 if( !bPermanent ) 866 { 867 sal_uInt16 nId = GetArrayId( SID_ZOOM_TOOLBOX ) + 1; 868 rSet.Put( TbxImageItem( SID_ZOOM_TOOLBOX, mpSlotArray[nId] ) ); 869 870 nId = GetArrayId( SID_DRAWTBX_INSERT ) + 1; 871 rSet.Put( TbxImageItem( SID_DRAWTBX_INSERT, mpSlotArray[nId] ) ); 872 873 nId = GetArrayId( SID_POSITION ) + 1; 874 rSet.Put( TbxImageItem( SID_POSITION, mpSlotArray[nId] ) ); 875 876 nId = GetArrayId( SID_OBJECT_ALIGN ) + 1; 877 rSet.Put( TbxImageItem( SID_OBJECT_ALIGN, mpSlotArray[nId] ) ); 878 } 879 else 880 { 881 for( sal_uInt16 nId = 0; nId < SLOTARRAY_COUNT; nId += 2 ) 882 { 883 rSet.Put( TbxImageItem( mpSlotArray[nId], mpSlotArray[nId+1] ) ); 884 } 885 } 886 } 887 888 /************************************************************************* 889 |* 890 |* Gibt den gemappten Slot zurueck 891 |* 892 \************************************************************************/ 893 894 sal_uInt16 DrawViewShell::GetMappedSlot( sal_uInt16 nSId ) 895 { 896 sal_uInt16 nSlot = 0; 897 sal_uInt16 nId = GetArrayId( nSId ); 898 if( nId != USHRT_MAX ) 899 nSlot = mpSlotArray[ nId+1 ]; 900 901 // Wenn der Slot noch auf sich selbst gemapped ist, muss 0 zurueck- 902 // gegeben werden, da sonst der Slot immer wieder selbst executet 903 // wird. Im Array ist der Slot selbst initial vorhanden, damit das 904 // Image richtig angezeigt wird. 905 if( nSId == nSlot ) 906 return( 0 ); 907 908 return( nSlot ); 909 } 910 911 /************************************************************************* 912 |* 913 |* Gibt die Nummer des HauptSlots im SlotArray zurueck 914 |* 915 \************************************************************************/ 916 917 sal_uInt16 DrawViewShell::GetArrayId( sal_uInt16 nSId ) 918 { 919 for( sal_uInt16 i = 0; i < SLOTARRAY_COUNT; i += 2 ) 920 { 921 if( mpSlotArray[ i ] == nSId ) 922 return( i ); 923 } 924 DBG_ERROR( "Slot im Array nicht gefunden!" ); 925 return( USHRT_MAX ); 926 } 927 928 929 /************************************************************************* 930 |* 931 |* IMap-Dlg updaten 932 |* 933 \************************************************************************/ 934 935 void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) 936 { 937 if( ( pObj->ISA( SdrGrafObj ) || pObj->ISA( SdrOle2Obj ) ) && !mpDrawView->IsTextEdit() && 938 GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) 939 { 940 Graphic aGraphic; 941 ImageMap* pIMap = NULL; 942 TargetList* pTargetList = NULL; 943 SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pObj ); 944 945 // get graphic from shape 946 SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj ); 947 if( pGrafObj ) 948 aGraphic = pGrafObj->GetGraphic(); 949 950 if ( pIMapInfo ) 951 { 952 pIMap = (ImageMap*) &pIMapInfo->GetImageMap(); 953 pTargetList = new TargetList; 954 GetViewFrame()->GetTargetList( *pTargetList ); 955 } 956 957 SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList, pObj ); 958 959 // TargetListe kann von uns wieder geloescht werden 960 if ( pTargetList ) 961 { 962 String* pEntry = pTargetList->First(); 963 while( pEntry ) 964 { 965 delete pEntry; 966 pEntry = pTargetList->Next(); 967 } 968 969 delete pTargetList; 970 } 971 } 972 } 973 974 // ----------------------------------------------------------------------------- 975 976 IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog ) 977 { 978 String aName; 979 980 if( pDialog ) 981 pDialog->GetName( aName ); 982 983 return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 ); 984 } 985 986 } // end of namespace sd 987