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