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 <com/sun/star/presentation/XPresentation2.hpp> 32 #include <com/sun/star/form/FormButtonType.hpp> 33 #include <com/sun/star/beans/XPropertySet.hpp> 34 #include <com/sun/star/i18n/TransliterationModules.hpp> 35 #include <com/sun/star/i18n/TransliterationModulesExtra.hpp> 36 37 #include <comphelper/processfactory.hxx> 38 39 #include "undo/undomanager.hxx" 40 #include <vcl/waitobj.hxx> 41 #include <svl/aeitem.hxx> 42 #include <editeng/editstat.hxx> 43 #include <vcl/msgbox.hxx> 44 #include <svl/urlbmk.hxx> 45 #include <svx/svdpagv.hxx> 46 #include <svx/fmshell.hxx> 47 #include <vcl/scrbar.hxx> 48 #include <svx/svdopath.hxx> 49 #include <svx/svdundo.hxx> 50 #include <svx/svdorect.hxx> 51 #include <svx/svdograf.hxx> 52 #include <svl/eitem.hxx> 53 #include <editeng/eeitem.hxx> 54 #include <sfx2/dispatch.hxx> 55 #include <sfx2/viewfrm.hxx> 56 #include <sfx2/request.hxx> 57 #include <svx/svxids.hrc> 58 #include <editeng/flditem.hxx> 59 #include <svx/ruler.hxx> 60 #include <svx/obj3d.hxx> 61 #include <svx/fmglob.hxx> 62 #include <svx/svdouno.hxx> 63 #include <svx/dataaccessdescriptor.hxx> 64 #include <tools/urlobj.hxx> 65 #include <svl/slstitm.hxx> 66 #include <sfx2/ipclient.hxx> 67 #include <toolkit/helper/vclunohelper.hxx> 68 #include <avmedia/mediawindow.hxx> 69 #include <svl/urihelper.hxx> 70 #include <sfx2/docfile.hxx> 71 72 #include "DrawViewShell.hxx" 73 #include "slideshow.hxx" 74 #include "ViewShellImplementation.hxx" 75 #include "ViewShellHint.hxx" 76 #include "framework/FrameworkHelper.hxx" 77 #include "app.hrc" 78 #include "glob.hrc" 79 #include "strings.hrc" 80 #include "res_bmp.hrc" 81 #include "drawdoc.hxx" 82 #include "fusel.hxx" 83 #include "futext.hxx" 84 #include "fuconrec.hxx" 85 #include "fuconcs.hxx" 86 #include "fuconuno.hxx" 87 #include "fuconbez.hxx" 88 #include "fuediglu.hxx" 89 #include "fuconarc.hxx" 90 #include "fucon3d.hxx" 91 #include "sdresid.hxx" 92 #include "slideshow.hxx" 93 #include "Outliner.hxx" 94 #include "PresentationViewShell.hxx" 95 #include "sdpage.hxx" 96 #include "FrameView.hxx" 97 #include "zoomlist.hxx" 98 #include "drawview.hxx" 99 #include "DrawDocShell.hxx" 100 #include "sdattr.hxx" 101 #include "ViewShellBase.hxx" 102 #include "ToolBarManager.hxx" 103 #include "anminfo.hxx" 104 #include "optsitem.hxx" 105 #include "Window.hxx" 106 #include "fuformatpaintbrush.hxx" 107 108 using ::rtl::OUString; 109 using namespace ::com::sun::star; 110 using namespace ::com::sun::star::uno; 111 using namespace ::com::sun::star::presentation; 112 113 namespace sd { 114 115 #ifdef _MSC_VER 116 #pragma optimize ( "", off ) 117 #endif 118 119 /************************************************************************* 120 |* 121 |* Permanente Funktionen 122 |* 123 \************************************************************************/ 124 125 void ImpAddPrintableCharactersToTextEdit(SfxRequest& rReq, ::sd::View* pView) 126 { 127 // #98198# evtl. feed characters to activated textedit 128 const SfxItemSet* pSet = rReq.GetArgs(); 129 130 if(pSet) 131 { 132 String aInputString; 133 134 if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR)) 135 aInputString = ((SfxStringItem&)pSet->Get(SID_ATTR_CHAR)).GetValue(); 136 137 if(aInputString.Len()) 138 { 139 OutlinerView* pOLV = pView->GetTextEditOutlinerView(); 140 141 if(pOLV) 142 { 143 for(sal_uInt16 a(0); a < aInputString.Len(); a++) 144 { 145 sal_Char aChar = (sal_Char)aInputString.GetChar(a); 146 KeyCode aKeyCode; 147 KeyEvent aKeyEvent(aChar, aKeyCode); 148 149 // add actual character 150 pOLV->PostKeyEvent(aKeyEvent); 151 } 152 } 153 } 154 } 155 } 156 157 void DrawViewShell::FuPermanent(SfxRequest& rReq) 158 { 159 // Waehrend einer Native-Diashow wird nichts ausgefuehrt! 160 161 if (SlideShow::IsRunning(GetViewShellBase())) 162 return; 163 164 sal_uInt16 nSId = rReq.GetSlot(); 165 166 if( HasCurrentFunction() && 167 ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE || 168 nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) ) 169 { 170 FunctionReference xFunc( GetCurrentFunction() ); 171 172 FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() ); 173 174 if( pFuText ) 175 { 176 pFuText->SetPermanent(sal_True); 177 xFunc->ReceiveRequest( rReq ); 178 179 MapSlot( nSId ); 180 181 Invalidate(); 182 183 Invalidate(); 184 185 // #98198# evtl. feed characters to activated textedit 186 if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit()) 187 ImpAddPrintableCharactersToTextEdit(rReq, GetView()); 188 189 rReq.Done(); 190 return; 191 } 192 } 193 194 CheckLineTo (rReq); 195 sal_uInt16 nOldSId = 0; 196 sal_Bool bPermanent = sal_False; 197 198 if( !mpDrawView ) 199 return; 200 201 if(HasCurrentFunction()) 202 { 203 if( (nSId == SID_FORMATPAINTBRUSH) && (GetCurrentFunction()->GetSlotID() == SID_TEXTEDIT) ) 204 { 205 // save text edit mode for format paintbrush! 206 SetOldFunction( GetCurrentFunction() ); 207 } 208 else 209 { 210 if(GetOldFunction() == GetCurrentFunction()) 211 { 212 SetOldFunction(0); 213 } 214 } 215 216 if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE && 217 nSId != SID_ATTR_CHAR_VERTICAL && nSId != SID_TEXT_FITTOSIZE_VERTICAL && 218 nSId != SID_FORMATPAINTBRUSH && 219 mpDrawView->IsTextEdit() ) 220 { 221 mpDrawView->SdrEndTextEdit(); 222 } 223 224 if( HasCurrentFunction() ) 225 { 226 nOldSId = GetCurrentFunction()->GetSlotID(); 227 228 if (nOldSId == nSId || 229 ((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE || 230 nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) && 231 (nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE || 232 nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ))) 233 { 234 bPermanent = sal_True; 235 } 236 237 GetCurrentFunction()->Deactivate(); 238 } 239 240 SetCurrentFunction(0); 241 242 SfxBindings& rBind = GetViewFrame()->GetBindings(); 243 rBind.Invalidate(nOldSId); 244 rBind.Update(nOldSId); 245 } 246 247 // Slot wird gemapped (ToolboxImages/-Slots) 248 MapSlot( nSId ); 249 250 switch ( nSId ) 251 { 252 case SID_TEXTEDIT: // BASIC ??? 253 case SID_ATTR_CHAR: 254 case SID_ATTR_CHAR_VERTICAL: 255 case SID_TEXT_FITTOSIZE: 256 case SID_TEXT_FITTOSIZE_VERTICAL: 257 { 258 SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 259 GetCurrentFunction()->DoExecute(rReq); 260 261 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 262 rBindings.Invalidate( SID_ATTR_CHAR ); 263 rBindings.Invalidate( SID_ATTR_CHAR_VERTICAL ); 264 rBindings.Invalidate( SID_TEXT_FITTOSIZE ); 265 rBindings.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL ); 266 267 // #98198# evtl. feed characters to activated textedit 268 if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit()) 269 ImpAddPrintableCharactersToTextEdit(rReq, GetView()); 270 271 rReq.Done(); 272 } 273 break; 274 275 case SID_FM_CREATE_CONTROL: 276 { 277 SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) ); 278 rReq.Done(); 279 } 280 break; 281 282 // #98721# 283 case SID_FM_CREATE_FIELDCONTROL: 284 { 285 SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False ); 286 DBG_ASSERT( pDescriptorItem, "DrawViewShell::FuPermanent(SID_FM_CREATE_FIELDCONTROL): invalid request args!" ); 287 288 if(pDescriptorItem) 289 { 290 // get the form view 291 FmFormView* pFormView = PTR_CAST(FmFormView, mpDrawView); 292 SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL; 293 294 if(pPageView) 295 { 296 ::svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue()); 297 SdrObject* pNewDBField = pFormView->CreateFieldControl(aDescriptor); 298 299 if(pNewDBField) 300 { 301 Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel())); 302 Point aObjPos(aVisArea.Center()); 303 Size aObjSize(pNewDBField->GetLogicRect().GetSize()); 304 aObjPos.X() -= aObjSize.Width() / 2; 305 aObjPos.Y() -= aObjSize.Height() / 2; 306 Rectangle aNewObjectRectangle(aObjPos, aObjSize); 307 308 pNewDBField->SetLogicRect(aNewObjectRectangle); 309 310 GetView()->InsertObjectAtView(pNewDBField, *pPageView); 311 } 312 } 313 } 314 rReq.Done(); 315 } 316 break; 317 318 case SID_OBJECT_SELECT: 319 case SID_OBJECT_ROTATE: 320 case SID_OBJECT_MIRROR: 321 case SID_OBJECT_CROP: 322 case SID_OBJECT_TRANSPARENCE: 323 case SID_OBJECT_GRADIENT: 324 case SID_OBJECT_SHEAR: 325 case SID_OBJECT_CROOK_ROTATE: 326 case SID_OBJECT_CROOK_SLANT: 327 case SID_OBJECT_CROOK_STRETCH: 328 case SID_CONVERT_TO_3D_LATHE: 329 { 330 short nSlotId = rReq.GetSlot(); 331 332 if( nSlotId == SID_OBJECT_ROTATE ) 333 { 334 // togle rotation 335 if( nOldSId == nSlotId ) 336 { 337 nSlotId = SID_OBJECT_SELECT; 338 rReq.SetSlot( nSlotId ); 339 } 340 } 341 342 if (nSlotId == SID_OBJECT_CROOK_ROTATE || 343 nSlotId == SID_OBJECT_CROOK_SLANT || 344 nSlotId == SID_OBJECT_CROOK_STRETCH) 345 { 346 if ( mpDrawView->GetMarkedObjectList().GetMarkCount() > 0 && 347 !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) ) 348 { 349 if ( mpDrawView->IsPresObjSelected() ) 350 { 351 ::sd::Window* pWindow = GetActiveWindow(); 352 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 353 } 354 else if ( QueryBox(GetActiveWindow(), WB_YES_NO, 355 String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) ) 356 ).Execute() == RET_YES ) 357 { 358 // Implizite Wandlung in Bezier 359 WaitObject aWait( (Window*)GetActiveWindow() ); 360 mpDrawView->ConvertMarkedToPathObj(sal_False); 361 } 362 } 363 } 364 else if (nSlotId == SID_OBJECT_SHEAR) 365 { 366 sal_uLong i = 0; 367 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 368 sal_uLong nMarkCnt = rMarkList.GetMarkCount(); 369 sal_Bool b3DObjMarked = sal_False; 370 371 while (i < nMarkCnt && !b3DObjMarked) 372 { 373 if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject)) 374 { 375 b3DObjMarked = sal_True; 376 } 377 else 378 { 379 i++; 380 } 381 } 382 383 if ( nMarkCnt > 0 && !b3DObjMarked && 384 (!mpDrawView->IsShearAllowed() || !mpDrawView->IsDistortAllowed()) ) 385 { 386 if ( mpDrawView->IsPresObjSelected() ) 387 { 388 ::sd::Window* pWindow = GetActiveWindow(); 389 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 390 } 391 else if ( QueryBox(GetActiveWindow(), WB_YES_NO, 392 String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) ) 393 ).Execute() == RET_YES ) 394 { 395 // Implizite Wandlung in Bezier 396 WaitObject aWait( (Window*)GetActiveWindow() ); 397 mpDrawView->ConvertMarkedToPathObj(sal_False); 398 } 399 } 400 } 401 402 SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 403 rReq.Done(); 404 Invalidate( SID_OBJECT_SELECT ); 405 } 406 break; 407 408 case SID_DRAW_LINE: 409 case SID_DRAW_XLINE: 410 case SID_DRAW_MEASURELINE: 411 case SID_LINE_ARROW_START: 412 case SID_LINE_ARROW_END: 413 case SID_LINE_ARROWS: 414 case SID_LINE_ARROW_CIRCLE: 415 case SID_LINE_CIRCLE_ARROW: 416 case SID_LINE_ARROW_SQUARE: 417 case SID_LINE_SQUARE_ARROW: 418 419 case SID_DRAW_RECT: 420 case SID_DRAW_RECT_NOFILL: 421 case SID_DRAW_RECT_ROUND: 422 case SID_DRAW_RECT_ROUND_NOFILL: 423 case SID_DRAW_SQUARE: 424 case SID_DRAW_SQUARE_NOFILL: 425 case SID_DRAW_SQUARE_ROUND: 426 case SID_DRAW_SQUARE_ROUND_NOFILL: 427 case SID_DRAW_ELLIPSE: 428 case SID_DRAW_ELLIPSE_NOFILL: 429 case SID_DRAW_CIRCLE: 430 case SID_DRAW_CIRCLE_NOFILL: 431 case SID_DRAW_CAPTION: 432 case SID_DRAW_CAPTION_VERTICAL: 433 case SID_TOOL_CONNECTOR: 434 case SID_CONNECTOR_ARROW_START: 435 case SID_CONNECTOR_ARROW_END: 436 case SID_CONNECTOR_ARROWS: 437 case SID_CONNECTOR_CIRCLE_START: 438 case SID_CONNECTOR_CIRCLE_END: 439 case SID_CONNECTOR_CIRCLES: 440 case SID_CONNECTOR_LINE: 441 case SID_CONNECTOR_LINE_ARROW_START: 442 case SID_CONNECTOR_LINE_ARROW_END: 443 case SID_CONNECTOR_LINE_ARROWS: 444 case SID_CONNECTOR_LINE_CIRCLE_START: 445 case SID_CONNECTOR_LINE_CIRCLE_END: 446 case SID_CONNECTOR_LINE_CIRCLES: 447 case SID_CONNECTOR_CURVE: 448 case SID_CONNECTOR_CURVE_ARROW_START: 449 case SID_CONNECTOR_CURVE_ARROW_END: 450 case SID_CONNECTOR_CURVE_ARROWS: 451 case SID_CONNECTOR_CURVE_CIRCLE_START: 452 case SID_CONNECTOR_CURVE_CIRCLE_END: 453 case SID_CONNECTOR_CURVE_CIRCLES: 454 case SID_CONNECTOR_LINES: 455 case SID_CONNECTOR_LINES_ARROW_START: 456 case SID_CONNECTOR_LINES_ARROW_END: 457 case SID_CONNECTOR_LINES_ARROWS: 458 case SID_CONNECTOR_LINES_CIRCLE_START: 459 case SID_CONNECTOR_LINES_CIRCLE_END: 460 case SID_CONNECTOR_LINES_CIRCLES: 461 { 462 SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) ); 463 rReq.Done(); 464 } 465 break; 466 case SID_DRAW_POLYGON: 467 case SID_DRAW_POLYGON_NOFILL: 468 case SID_DRAW_XPOLYGON: 469 case SID_DRAW_XPOLYGON_NOFILL: 470 case SID_DRAW_FREELINE: 471 case SID_DRAW_FREELINE_NOFILL: 472 case SID_DRAW_BEZIER_FILL: // BASIC 473 case SID_DRAW_BEZIER_NOFILL: // BASIC 474 { 475 SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) ); 476 rReq.Done(); 477 } 478 break; 479 480 case SID_GLUE_EDITMODE: 481 { 482 if (nOldSId != SID_GLUE_EDITMODE) 483 { 484 SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) ); 485 } 486 else 487 { 488 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 489 } 490 491 rReq.Done(); 492 } 493 break; 494 495 case SID_DRAW_ARC: 496 case SID_DRAW_CIRCLEARC: 497 case SID_DRAW_PIE: 498 case SID_DRAW_PIE_NOFILL: 499 case SID_DRAW_CIRCLEPIE: 500 case SID_DRAW_CIRCLEPIE_NOFILL: 501 case SID_DRAW_ELLIPSECUT: 502 case SID_DRAW_ELLIPSECUT_NOFILL: 503 case SID_DRAW_CIRCLECUT: 504 case SID_DRAW_CIRCLECUT_NOFILL: 505 { 506 SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) ); 507 rReq.Done(); 508 } 509 break; 510 511 case SID_3D_CUBE: 512 case SID_3D_SHELL: 513 case SID_3D_SPHERE: 514 case SID_3D_TORUS: 515 case SID_3D_HALF_SPHERE: 516 case SID_3D_CYLINDER: 517 case SID_3D_CONE: 518 case SID_3D_PYRAMID: 519 { 520 SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) ); 521 rReq.Done(); 522 } 523 break; 524 525 case SID_DRAWTBX_CS_BASIC : 526 case SID_DRAWTBX_CS_SYMBOL : 527 case SID_DRAWTBX_CS_ARROW : 528 case SID_DRAWTBX_CS_FLOWCHART : 529 case SID_DRAWTBX_CS_CALLOUT : 530 case SID_DRAWTBX_CS_STAR : 531 case SID_DRAW_CS_ID : 532 { 533 SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) ); 534 rReq.Done(); 535 536 if ( nSId != SID_DRAW_CS_ID ) 537 { 538 SfxBindings& rBind = GetViewFrame()->GetBindings(); 539 rBind.Invalidate( nSId ); 540 rBind.Update( nSId ); 541 } 542 } 543 break; 544 545 case SID_FORMATPAINTBRUSH: 546 { 547 SetCurrentFunction( FuFormatPaintBrush::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 548 rReq.Done(); 549 SfxBindings& rBind = GetViewFrame()->GetBindings(); 550 rBind.Invalidate( nSId ); 551 rBind.Update( nSId ); 552 break; 553 } 554 555 default: 556 break; 557 } 558 559 if(HasOldFunction()) 560 { 561 sal_uInt16 nSlotId = GetOldFunction()->GetSlotID(); 562 563 GetOldFunction()->Deactivate(); 564 SetOldFunction(0); 565 566 SfxBindings& rBind = GetViewFrame()->GetBindings(); 567 rBind.Invalidate( nSlotId ); 568 rBind.Update( nSlotId ); 569 } 570 571 if(HasCurrentFunction()) 572 { 573 GetCurrentFunction()->Activate(); 574 SetOldFunction( GetCurrentFunction() ); 575 576 SetHelpId( GetCurrentFunction()->GetSlotID() ); 577 } 578 579 // Shell wird invalidiert, schneller als einzeln (laut MI) 580 // Jetzt explizit der letzte Slot incl. Update() 581 Invalidate(); 582 583 // #97016# III CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet 584 if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1)) 585 { 586 if(!GetView()->AreObjectsMarked()) 587 { 588 // select first object 589 GetView()->UnmarkAllObj(); 590 GetView()->MarkNextObj(sal_True); 591 592 // ...and make it visible 593 if(GetView()->AreObjectsMarked()) 594 GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow()); 595 } 596 } 597 598 // #97016# with qualifier construct directly 599 if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1)) 600 { 601 // get SdOptions 602 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); 603 sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth()); 604 sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight()); 605 606 // calc position and size 607 Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel())); 608 Point aPagePos = aVisArea.Center(); 609 aPagePos.X() -= nDefaultObjectSizeWidth / 2; 610 aPagePos.Y() -= nDefaultObjectSizeHeight / 2; 611 Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight)); 612 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 613 614 if(pPageView) 615 { 616 // create the default object 617 SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle); 618 619 if(pObj) 620 { 621 // insert into page 622 GetView()->InsertObjectAtView(pObj, *pPageView); 623 624 // Now that pFuActual has done what it was created for we 625 // can switch on the edit mode for callout objects. 626 switch (nSId) 627 { 628 case SID_DRAW_CAPTION: 629 case SID_DRAW_CAPTION_VERTICAL: 630 { 631 // Make FuText the current function. 632 SfxUInt16Item aItem (SID_TEXTEDIT, 1); 633 GetViewFrame()->GetDispatcher()-> 634 Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON | 635 SFX_CALLMODE_RECORD, &aItem, 0L); 636 // Put text object into edit mode. 637 GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObj), pPageView); 638 break; 639 } 640 } 641 } 642 } 643 } 644 } 645 646 ////////////////////////////////////////////////////////////////////////////// 647 // service routine for Undo/Redo implementation 648 extern SfxUndoManager* ImpGetUndoManagerFromViewShell(DrawViewShell& rDViewShell); 649 650 /************************************************************************* 651 |* 652 |* SfxRequests fuer Support-Funktionen 653 |* 654 \************************************************************************/ 655 656 void DrawViewShell::FuSupport(SfxRequest& rReq) 657 { 658 if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs()) 659 GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue()); 660 661 // Waehrend einer Native-Diashow wird nichts ausgefuehrt! 662 if(SlideShow::IsRunning(GetViewShellBase()) && 663 (rReq.GetSlot() != SID_PRESENTATION_END && 664 rReq.GetSlot() != SID_SIZE_PAGE)) 665 return; 666 667 CheckLineTo (rReq); 668 669 if( !mpDrawView ) 670 return; 671 672 sal_uInt16 nSId = rReq.GetSlot(); 673 674 // Slot wird evtl. gemapped (ToolboxImages/-Slots) 675 MapSlot( nSId ); 676 677 switch ( nSId ) 678 { 679 case SID_CLEAR_UNDO_STACK: 680 { 681 GetDocSh()->ClearUndoBuffer(); 682 rReq.Ignore (); 683 } 684 break; 685 686 // Slots der ToolboxController gemapped ausfuehren 687 case SID_OBJECT_CHOOSE_MODE: 688 case SID_POSITION: 689 case SID_OBJECT_ALIGN: 690 case SID_ZOOM_TOOLBOX: 691 case SID_DRAWTBX_TEXT: 692 case SID_DRAWTBX_RECTANGLES: 693 case SID_DRAWTBX_ELLIPSES: 694 case SID_DRAWTBX_LINES: 695 case SID_DRAWTBX_ARROWS: 696 case SID_DRAWTBX_3D_OBJECTS: 697 case SID_DRAWTBX_CONNECTORS: 698 case SID_DRAWTBX_INSERT: 699 { 700 sal_uInt16 nMappedSlot = GetMappedSlot( nSId ); 701 if( nMappedSlot > 0 ) 702 { 703 SfxRequest aReq( nMappedSlot, 0, GetDoc()->GetItemPool() ); 704 ExecuteSlot( aReq ); 705 } 706 } 707 break; 708 709 case SID_PRESENTATION: 710 case SID_REHEARSE_TIMINGS: 711 { 712 Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() ); 713 if( xPresentation.is() ) 714 { 715 if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) ) 716 xPresentation->start(); 717 else 718 xPresentation->rehearseTimings(); 719 } 720 rReq.Ignore (); 721 } 722 break; 723 724 case SID_PRESENTATION_END: 725 { 726 StopSlideShow(true); 727 728 rReq.Ignore (); 729 } 730 break; 731 732 case SID_BEZIER_EDIT: 733 { 734 mpDrawView->SetFrameDragSingles(!mpDrawView->IsFrameDragSingles()); 735 736 /****************************************************************** 737 * ObjectBar einschalten 738 ******************************************************************/ 739 if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) ) 740 { 741 // Tell the tool bar manager about the context change. 742 GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView); 743 } 744 745 Invalidate(SID_BEZIER_EDIT); 746 rReq.Ignore(); 747 } 748 break; 749 750 case SID_OBJECT_CLOSE: 751 { 752 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 753 if ( rMarkList.GetMark(0) && !mpDrawView->IsAction() ) 754 { 755 SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj(); 756 const bool bUndo = mpDrawView->IsUndoEnabled(); 757 if( bUndo ) 758 mpDrawView->BegUndo(String(SdResId(STR_UNDO_BEZCLOSE))); 759 760 mpDrawView->UnmarkAllPoints(); 761 762 if( bUndo ) 763 mpDrawView->AddUndo(new SdrUndoGeoObj(*pPathObj)); 764 765 pPathObj->ToggleClosed(); 766 767 if( bUndo ) 768 mpDrawView->EndUndo(); 769 } 770 rReq.Done(); 771 } 772 break; 773 774 case SID_CUT: 775 { 776 if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) ) 777 { 778 ::sd::Window* pWindow = GetActiveWindow(); 779 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 780 } 781 else 782 { 783 if(HasCurrentFunction()) 784 { 785 GetCurrentFunction()->DoCut(); 786 } 787 else if(mpDrawView) 788 { 789 mpDrawView->DoCut(); 790 } 791 } 792 rReq.Ignore (); 793 } 794 break; 795 796 case SID_COPY: 797 { 798 if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) ) 799 { 800 ::sd::Window* pWindow = GetActiveWindow(); 801 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 802 } 803 else 804 { 805 if(HasCurrentFunction()) 806 { 807 GetCurrentFunction()->DoCopy(); 808 } 809 else if( mpDrawView ) 810 { 811 mpDrawView->DoCopy(); 812 } 813 } 814 rReq.Ignore (); 815 } 816 break; 817 818 case SID_PASTE: 819 { 820 WaitObject aWait( (Window*)GetActiveWindow() ); 821 822 if(HasCurrentFunction()) 823 { 824 GetCurrentFunction()->DoPaste(); 825 } 826 else if(mpDrawView) 827 { 828 mpDrawView->DoPaste(); 829 } 830 831 rReq.Ignore (); 832 } 833 break; 834 835 case SID_CLIPBOARD_FORMAT_ITEMS: 836 { 837 WaitObject aWait( (Window*)GetActiveWindow() ); 838 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) ); 839 const SfxItemSet* pReqArgs = rReq.GetArgs(); 840 sal_uInt32 nFormat = 0; 841 842 if( pReqArgs ) 843 { 844 SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, sal_False ); 845 nFormat = pIsActive->GetValue(); 846 } 847 848 849 if( nFormat && aDataHelper.GetTransferable().is() ) 850 { 851 sal_Int8 nAction = DND_ACTION_COPY; 852 853 if( !mpDrawView->InsertData( aDataHelper, 854 GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ), 855 nAction, sal_False, nFormat ) ) 856 { 857 INetBookmark aINetBookmark( aEmptyStr, aEmptyStr ); 858 859 if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) && 860 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) || 861 ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) && 862 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) || 863 ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) && 864 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) 865 { 866 InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL ); 867 } 868 } 869 } 870 } 871 break; 872 873 case SID_DELETE: 874 { 875 if ( mpDrawView->IsTextEdit() ) 876 { 877 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 878 879 if (pOLV) 880 { 881 KeyCode aKCode(KEY_DELETE); 882 KeyEvent aKEvt( 0, aKCode); 883 pOLV->PostKeyEvent(aKEvt); 884 } 885 } 886 else if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) ) 887 { 888 ::sd::Window* pWindow = GetActiveWindow(); 889 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 890 } 891 else 892 { 893 KeyCode aKCode(KEY_DELETE); 894 KeyEvent aKEvt( 0, aKCode); 895 896 bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt ); 897 898 if( !bConsumed && HasCurrentFunction() ) 899 bConsumed = GetCurrentFunction()->KeyInput(aKEvt); 900 901 if( !bConsumed && mpDrawView ) 902 mpDrawView->DeleteMarked(); 903 } 904 rReq.Ignore (); 905 } 906 break; 907 908 case SID_NOTESMODE: 909 case SID_HANDOUTMODE: 910 // AutoLayouts have to be ready. 911 GetDoc()->StopWorkStartupDelay(); 912 // Fall through to following case statements. 913 914 case SID_DRAWINGMODE: 915 case SID_DIAMODE: 916 case SID_OUTLINEMODE: 917 // Let the sub-shell manager handle the slot handling. 918 framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot( 919 nSId, 920 rReq); 921 rReq.Ignore (); 922 break; 923 924 case SID_MASTERPAGE: // BASIC 925 case SID_SLIDE_MASTERPAGE: // BASIC 926 case SID_TITLE_MASTERPAGE: // BASIC 927 case SID_NOTES_MASTERPAGE: // BASIC 928 case SID_HANDOUT_MASTERPAGE: // BASIC 929 { 930 // AutoLayouts muessen fertig sein 931 GetDoc()->StopWorkStartupDelay(); 932 933 const SfxItemSet* pReqArgs = rReq.GetArgs(); 934 935 if ( pReqArgs ) 936 { 937 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_MASTERPAGE, sal_False); 938 mbIsLayerModeActive = pIsActive->GetValue (); 939 } 940 941 Broadcast ( 942 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START)); 943 944 if (nSId == SID_MASTERPAGE || 945 (nSId == SID_SLIDE_MASTERPAGE && mePageKind == PK_STANDARD) || 946 (nSId == SID_TITLE_MASTERPAGE && mePageKind == PK_STANDARD) || 947 (nSId == SID_NOTES_MASTERPAGE && mePageKind == PK_NOTES) || 948 (nSId == SID_HANDOUT_MASTERPAGE && mePageKind == PK_HANDOUT)) 949 { 950 if (nSId == SID_TITLE_MASTERPAGE || 951 nSId == SID_SLIDE_MASTERPAGE) 952 { 953 // Gibt es eine Seite mit dem AutoLayout "Titel"? 954 sal_Bool bFound = sal_False; 955 sal_uInt16 i = 0; 956 sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD); 957 958 while (i < nCount && !bFound) 959 { 960 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD); 961 962 if (nSId == SID_TITLE_MASTERPAGE && pPage->GetAutoLayout() == AUTOLAYOUT_TITLE) 963 { 964 bFound = sal_True; 965 SwitchPage((pPage->GetPageNum() - 1) / 2); 966 } 967 else if (nSId == SID_SLIDE_MASTERPAGE && pPage->GetAutoLayout() != AUTOLAYOUT_TITLE) 968 { 969 bFound = sal_True; 970 SwitchPage((pPage->GetPageNum() - 1) / 2); 971 } 972 973 i++; 974 } 975 } 976 977 // Default-Layer der MasterPage einschalten 978 mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_BCKGRNDOBJ) ) ); 979 980 ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive); 981 982 if(HasCurrentFunction(SID_BEZIER_EDIT)) 983 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 984 } 985 else 986 { 987 // Switch to requested ViewShell. 988 ::OUString sRequestedView; 989 PageKind ePageKind; 990 switch (nSId) 991 { 992 case SID_SLIDE_MASTERPAGE: 993 case SID_TITLE_MASTERPAGE: 994 default: 995 sRequestedView = framework::FrameworkHelper::msImpressViewURL; 996 ePageKind = PK_STANDARD; 997 break; 998 999 case SID_NOTES_MASTERPAGE: 1000 sRequestedView = framework::FrameworkHelper::msNotesViewURL; 1001 ePageKind = PK_NOTES; 1002 break; 1003 1004 case SID_HANDOUT_MASTERPAGE: 1005 sRequestedView = framework::FrameworkHelper::msHandoutViewURL; 1006 ePageKind = PK_HANDOUT; 1007 break; 1008 } 1009 1010 mpFrameView->SetViewShEditMode(EM_MASTERPAGE, ePageKind); 1011 mpFrameView->SetLayerMode(mbIsLayerModeActive); 1012 framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView( 1013 sRequestedView, 1014 framework::FrameworkHelper::msCenterPaneURL); 1015 } 1016 Broadcast ( 1017 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END)); 1018 1019 InvalidateWindows(); 1020 Invalidate(); 1021 1022 rReq.Done(); 1023 } 1024 break; 1025 1026 1027 case SID_CLOSE_MASTER_VIEW: 1028 { 1029 Broadcast ( 1030 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START)); 1031 1032 // Switch page back to the first one. Not doing so leads to a 1033 // crash. This seems to be some bug in the edit mode switching 1034 // and page switching methods. 1035 SwitchPage (0); 1036 ChangeEditMode(EM_PAGE, IsLayerModeActive()); 1037 Broadcast ( 1038 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END)); 1039 1040 if(HasCurrentFunction(SID_BEZIER_EDIT)) 1041 { 1042 GetViewFrame()->GetDispatcher()->Execute( 1043 SID_OBJECT_SELECT, 1044 SFX_CALLMODE_ASYNCHRON); 1045 } 1046 1047 1048 rReq.Done(); 1049 } 1050 break; 1051 1052 1053 case SID_RULER: 1054 { 1055 const SfxItemSet* pReqArgs = rReq.GetArgs(); 1056 1057 // #97516# Remember old ruler state 1058 sal_Bool bOldHasRuler(HasRuler()); 1059 1060 if ( pReqArgs ) 1061 { 1062 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_RULER, sal_False); 1063 SetRuler (pIsActive->GetValue ()); 1064 } 1065 else SetRuler (!HasRuler()); 1066 1067 // #97516# Did ruler state change? Tell that to SdOptions, too. 1068 sal_Bool bHasRuler(HasRuler()); 1069 1070 if(bOldHasRuler != bHasRuler) 1071 { 1072 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); 1073 1074 if(pOptions && pOptions->IsRulerVisible() != bHasRuler) 1075 { 1076 pOptions->SetRulerVisible(bHasRuler); 1077 } 1078 } 1079 1080 Invalidate (SID_RULER); 1081 Resize(); 1082 rReq.Done (); 1083 } 1084 break; 1085 1086 case SID_SIZE_PAGE: 1087 case SID_SIZE_PAGE_WIDTH: // BASIC 1088 { 1089 mbZoomOnPage = ( rReq.GetSlot() == SID_SIZE_PAGE ); 1090 1091 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1092 1093 if ( pPageView ) 1094 { 1095 Point aPagePos(0, 0); // = pPageView->GetOffset(); 1096 Size aPageSize = pPageView->GetPage()->GetSize(); 1097 1098 aPagePos.X() += aPageSize.Width() / 2; 1099 aPageSize.Width() = (long) (aPageSize.Width() * 1.03); 1100 1101 if( rReq.GetSlot() == SID_SIZE_PAGE ) 1102 { 1103 aPagePos.Y() += aPageSize.Height() / 2; 1104 aPageSize.Height() = (long) (aPageSize.Height() * 1.03); 1105 aPagePos.Y() -= aPageSize.Height() / 2; 1106 } 1107 else 1108 { 1109 Point aPt = GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) ); 1110 aPagePos.Y() += aPt.Y(); 1111 aPageSize.Height() = 2; 1112 } 1113 1114 aPagePos.X() -= aPageSize.Width() / 2; 1115 1116 SetZoomRect( Rectangle( aPagePos, aPageSize ) ); 1117 1118 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), 1119 GetActiveWindow()->GetOutputSizePixel()) ); 1120 mpZoomList->InsertZoomRect(aVisAreaWin); 1121 } 1122 Invalidate( SID_ZOOM_IN ); 1123 Invalidate( SID_ZOOM_OUT ); 1124 Invalidate( SID_ZOOM_PANNING ); 1125 Invalidate( SID_ZOOM_TOOLBOX ); 1126 rReq.Done (); 1127 } 1128 break; 1129 1130 case SID_SIZE_REAL: // BASIC 1131 { 1132 mbZoomOnPage = sal_False; 1133 SetZoom( 100 ); 1134 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), 1135 GetActiveWindow()->GetOutputSizePixel()) ); 1136 mpZoomList->InsertZoomRect(aVisAreaWin); 1137 Invalidate( SID_ZOOM_IN ); 1138 Invalidate( SID_ZOOM_OUT ); 1139 Invalidate( SID_ZOOM_PANNING ); 1140 Invalidate( SID_ZOOM_TOOLBOX ); 1141 rReq.Done (); 1142 } 1143 break; 1144 1145 case SID_ZOOM_IN: // BASIC 1146 { 1147 mbZoomOnPage = sal_False; 1148 SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) ); 1149 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), 1150 GetActiveWindow()->GetOutputSizePixel()) ); 1151 mpZoomList->InsertZoomRect(aVisAreaWin); 1152 Invalidate( SID_ZOOM_IN ); 1153 Invalidate( SID_ZOOM_OUT ); 1154 Invalidate( SID_ZOOM_PANNING ); 1155 Invalidate( SID_ZOOM_TOOLBOX ); 1156 rReq.Done (); 1157 } 1158 break; 1159 1160 case SID_SIZE_VISAREA: 1161 { 1162 Rectangle aVisArea = mpFrameView->GetVisArea(); 1163 Size aVisAreaSize = aVisArea.GetSize(); 1164 1165 if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0) 1166 { 1167 mbZoomOnPage = sal_False; 1168 SetZoomRect(aVisArea); 1169 Invalidate( SID_ZOOM_IN ); 1170 Invalidate( SID_ZOOM_OUT ); 1171 Invalidate( SID_ZOOM_PANNING ); 1172 Invalidate( SID_ZOOM_TOOLBOX ); 1173 } 1174 rReq.Done (); 1175 } 1176 break; 1177 1178 // Namensverwirrung: SID_SIZE_OPTIMAL -> Zoom auf selektierte Objekte 1179 // --> Wird als Objektzoom im Programm angeboten 1180 case SID_SIZE_OPTIMAL: // BASIC 1181 { 1182 mbZoomOnPage = sal_False; 1183 if ( mpDrawView->AreObjectsMarked() ) 1184 { 1185 maMarkRect = mpDrawView->GetAllMarkedRect(); 1186 long nW = (long) (maMarkRect.GetWidth() * 1.03); 1187 long nH = (long) (maMarkRect.GetHeight() * 1.03); 1188 Point aPos = maMarkRect.Center(); 1189 aPos.X() -= nW / 2; 1190 aPos.Y() -= nH / 2; 1191 if ( nW && nH ) 1192 { 1193 SetZoomRect(Rectangle(aPos, Size(nW, nH))); 1194 1195 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), 1196 GetActiveWindow()->GetOutputSizePixel()) ); 1197 mpZoomList->InsertZoomRect(aVisAreaWin); 1198 } 1199 } 1200 Invalidate( SID_ZOOM_IN ); 1201 Invalidate( SID_ZOOM_OUT ); 1202 Invalidate( SID_ZOOM_PANNING ); 1203 Invalidate( SID_ZOOM_TOOLBOX ); 1204 rReq.Done (); 1205 } 1206 break; 1207 1208 // Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte 1209 // --> Wird als Optimal im Programm angeboten 1210 case SID_SIZE_ALL: // BASIC 1211 { 1212 mbZoomOnPage = sal_False; 1213 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1214 1215 if( pPageView ) 1216 { 1217 Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() ); 1218 1219 long nW = (long) (aBoundRect.GetWidth() * 1.03); 1220 long nH = (long) (aBoundRect.GetHeight() * 1.03); 1221 Point aPos = aBoundRect.Center(); 1222 aPos.X() -= nW / 2; 1223 aPos.Y() -= nH / 2; 1224 if ( nW && nH ) 1225 { 1226 SetZoomRect( Rectangle( aPos, Size( nW, nH ) ) ); 1227 1228 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), 1229 GetActiveWindow()->GetOutputSizePixel()) ); 1230 mpZoomList->InsertZoomRect(aVisAreaWin); 1231 } 1232 1233 Invalidate( SID_ZOOM_IN ); 1234 Invalidate( SID_ZOOM_OUT ); 1235 Invalidate( SID_ZOOM_PANNING ); 1236 Invalidate( SID_ZOOM_TOOLBOX ); 1237 } 1238 rReq.Done (); 1239 } 1240 break; 1241 1242 case SID_ZOOM_PREV: 1243 { 1244 if (mpDrawView->IsTextEdit()) 1245 { 1246 mpDrawView->SdrEndTextEdit(); 1247 } 1248 1249 if (mpZoomList->IsPreviousPossible()) 1250 { 1251 // Vorheriges ZoomRect einstellen 1252 SetZoomRect(mpZoomList->GetPreviousZoomRect()); 1253 } 1254 rReq.Done (); 1255 Invalidate( SID_ZOOM_TOOLBOX ); 1256 } 1257 break; 1258 1259 case SID_ZOOM_NEXT: 1260 { 1261 if (mpDrawView->IsTextEdit()) 1262 { 1263 mpDrawView->SdrEndTextEdit(); 1264 } 1265 1266 if (mpZoomList->IsNextPossible()) 1267 { 1268 // Naechstes ZoomRect einstellen 1269 SetZoomRect(mpZoomList->GetNextZoomRect()); 1270 } 1271 rReq.Done (); 1272 Invalidate( SID_ZOOM_TOOLBOX ); 1273 } 1274 break; 1275 1276 case SID_GLUE_INSERT_POINT: 1277 case SID_GLUE_PERCENT: 1278 case SID_GLUE_ESCDIR: 1279 case SID_GLUE_ESCDIR_LEFT: 1280 case SID_GLUE_ESCDIR_RIGHT: 1281 case SID_GLUE_ESCDIR_TOP: 1282 case SID_GLUE_ESCDIR_BOTTOM: 1283 case SID_GLUE_HORZALIGN_CENTER: 1284 case SID_GLUE_HORZALIGN_LEFT: 1285 case SID_GLUE_HORZALIGN_RIGHT: 1286 case SID_GLUE_VERTALIGN_CENTER: 1287 case SID_GLUE_VERTALIGN_TOP: 1288 case SID_GLUE_VERTALIGN_BOTTOM: 1289 { 1290 FunctionReference xFunc( GetCurrentFunction() ); 1291 FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() ); 1292 1293 if(pFunc) 1294 pFunc->ReceiveRequest(rReq); 1295 1296 rReq.Done(); 1297 } 1298 break; 1299 1300 #ifdef DBG_UTIL 1301 case SID_SHOW_ITEMBROWSER: 1302 { 1303 mpDrawView->ShowItemBrowser( !mpDrawView->IsItemBrowserVisible() ); 1304 rReq.Done (); 1305 } 1306 break; 1307 #endif 1308 1309 case SID_AUTOSPELL_CHECK: 1310 { 1311 sal_Bool bOnlineSpell = !GetDoc()->GetOnlineSpell(); 1312 GetDoc()->SetOnlineSpell(bOnlineSpell); 1313 1314 ::Outliner* pOL = mpDrawView->GetTextEditOutliner(); 1315 1316 if (pOL) 1317 { 1318 sal_uLong nCntrl = pOL->GetControlWord(); 1319 1320 if (bOnlineSpell) 1321 nCntrl |= EE_CNTRL_ONLINESPELLING; 1322 else 1323 nCntrl &= ~EE_CNTRL_ONLINESPELLING; 1324 1325 pOL->SetControlWord(nCntrl); 1326 } 1327 1328 GetActiveWindow()->Invalidate(); 1329 rReq.Done (); 1330 } 1331 break; 1332 1333 case SID_CONVERT_TO_1BIT_THRESHOLD: 1334 case SID_CONVERT_TO_1BIT_MATRIX: 1335 case SID_CONVERT_TO_4BIT_GRAYS: 1336 case SID_CONVERT_TO_4BIT_COLORS: 1337 case SID_CONVERT_TO_8BIT_GRAYS: 1338 case SID_CONVERT_TO_8BIT_COLORS: 1339 case SID_CONVERT_TO_24BIT: 1340 { 1341 BmpConversion eBmpConvert = BMP_CONVERSION_NONE; 1342 1343 switch( nSId ) 1344 { 1345 case SID_CONVERT_TO_1BIT_THRESHOLD: 1346 eBmpConvert = BMP_CONVERSION_1BIT_THRESHOLD; 1347 break; 1348 1349 case SID_CONVERT_TO_1BIT_MATRIX: 1350 eBmpConvert = BMP_CONVERSION_1BIT_MATRIX; 1351 break; 1352 1353 case SID_CONVERT_TO_4BIT_GRAYS: 1354 eBmpConvert = BMP_CONVERSION_4BIT_GREYS; 1355 break; 1356 1357 case SID_CONVERT_TO_4BIT_COLORS: 1358 eBmpConvert = BMP_CONVERSION_4BIT_COLORS; 1359 break; 1360 1361 case SID_CONVERT_TO_8BIT_GRAYS: 1362 eBmpConvert = BMP_CONVERSION_8BIT_GREYS; 1363 break; 1364 1365 case SID_CONVERT_TO_8BIT_COLORS: 1366 eBmpConvert = BMP_CONVERSION_8BIT_COLORS; 1367 break; 1368 1369 case SID_CONVERT_TO_24BIT: 1370 eBmpConvert = BMP_CONVERSION_24BIT; 1371 break; 1372 } 1373 1374 mpDrawView->BegUndo(String(SdResId(STR_UNDO_COLORRESOLUTION))); 1375 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 1376 1377 for (sal_uLong i=0; i<rMarkList.GetMarkCount(); i++) 1378 { 1379 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 1380 1381 if (pObj->GetObjInventor() == SdrInventor) 1382 { 1383 if (pObj->GetObjIdentifier() == OBJ_GRAF && !((SdrGrafObj*) pObj)->IsLinkedGraphic()) 1384 { 1385 const Graphic& rGraphic = ((SdrGrafObj*) pObj)->GetGraphic(); 1386 1387 if( rGraphic.GetType() == GRAPHIC_BITMAP ) 1388 { 1389 SdrGrafObj* pNewObj = (SdrGrafObj*) pObj->Clone(); 1390 1391 if( rGraphic.IsAnimated() ) 1392 { 1393 Animation aAnim( rGraphic.GetAnimation() ); 1394 aAnim.Convert( eBmpConvert ); 1395 pNewObj->SetGraphic( aAnim ); 1396 } 1397 else 1398 { 1399 BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); 1400 aBmpEx.Convert( eBmpConvert ); 1401 pNewObj->SetGraphic( aBmpEx ); 1402 } 1403 1404 mpDrawView->ReplaceObjectAtView( pObj, *mpDrawView->GetSdrPageView(), pNewObj ); 1405 } 1406 } 1407 } 1408 } 1409 1410 mpDrawView->EndUndo(); 1411 rReq.Done (); 1412 } 1413 break; 1414 1415 case SID_TRANSLITERATE_SENTENCE_CASE: 1416 case SID_TRANSLITERATE_TITLE_CASE: 1417 case SID_TRANSLITERATE_TOGGLE_CASE: 1418 case SID_TRANSLITERATE_UPPER: 1419 case SID_TRANSLITERATE_LOWER: 1420 case SID_TRANSLITERATE_HALFWIDTH: 1421 case SID_TRANSLITERATE_FULLWIDTH: 1422 case SID_TRANSLITERATE_HIRAGANA: 1423 case SID_TRANSLITERATE_KATAGANA: 1424 { 1425 OutlinerView* pOLV = GetView()->GetTextEditOutlinerView(); 1426 if( pOLV ) 1427 { 1428 using namespace ::com::sun::star::i18n; 1429 sal_Int32 nType = 0; 1430 1431 switch( nSId ) 1432 { 1433 case SID_TRANSLITERATE_SENTENCE_CASE: 1434 nType = TransliterationModulesExtra::SENTENCE_CASE; 1435 break; 1436 case SID_TRANSLITERATE_TITLE_CASE: 1437 nType = TransliterationModulesExtra::TITLE_CASE; 1438 break; 1439 case SID_TRANSLITERATE_TOGGLE_CASE: 1440 nType = TransliterationModulesExtra::TOGGLE_CASE; 1441 break; 1442 case SID_TRANSLITERATE_UPPER: 1443 nType = TransliterationModules_LOWERCASE_UPPERCASE; 1444 break; 1445 case SID_TRANSLITERATE_LOWER: 1446 nType = TransliterationModules_UPPERCASE_LOWERCASE; 1447 break; 1448 case SID_TRANSLITERATE_HALFWIDTH: 1449 nType = TransliterationModules_FULLWIDTH_HALFWIDTH; 1450 break; 1451 case SID_TRANSLITERATE_FULLWIDTH: 1452 nType = TransliterationModules_HALFWIDTH_FULLWIDTH; 1453 break; 1454 case SID_TRANSLITERATE_HIRAGANA: 1455 nType = TransliterationModules_KATAKANA_HIRAGANA; 1456 break; 1457 case SID_TRANSLITERATE_KATAGANA: 1458 nType = TransliterationModules_HIRAGANA_KATAKANA; 1459 break; 1460 } 1461 1462 pOLV->TransliterateText( nType ); 1463 } 1464 1465 rReq.Done(); 1466 } 1467 break; 1468 1469 // #UndoRedo# 1470 case SID_UNDO : 1471 { 1472 // #96090# moved implementation to BaseClass 1473 ImpSidUndo(sal_True, rReq); 1474 } 1475 break; 1476 case SID_REDO : 1477 { 1478 // #96090# moved implementation to BaseClass 1479 ImpSidRedo(sal_True, rReq); 1480 } 1481 break; 1482 1483 default: 1484 break; 1485 } 1486 } 1487 1488 /************************************************************************* 1489 |* 1490 |* URL-Feld einfuegen 1491 |* 1492 \************************************************************************/ 1493 1494 void DrawViewShell::InsertURLField(const String& rURL, const String& rText, 1495 const String& rTarget, const Point* pPos) 1496 { 1497 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 1498 1499 if (pOLV) 1500 { 1501 ESelection aSel( pOLV->GetSelection() ); 1502 SvxFieldItem aURLItem( SvxURLField( rURL, rText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); 1503 pOLV->InsertField( aURLItem ); 1504 if ( aSel.nStartPos <= aSel.nEndPos ) 1505 aSel.nEndPos = aSel.nStartPos + 1; 1506 else 1507 aSel.nStartPos = aSel.nEndPos + 1; 1508 pOLV->SetSelection( aSel ); 1509 } 1510 else 1511 { 1512 Outliner* pOutl = GetDoc()->GetInternalOutliner(); 1513 pOutl->Init( OUTLINERMODE_TEXTOBJECT ); 1514 sal_uInt16 nOutlMode = pOutl->GetMode(); 1515 1516 SvxURLField aURLField(rURL, rText, SVXURLFORMAT_REPR); 1517 aURLField.SetTargetFrame(rTarget); 1518 SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD); 1519 pOutl->QuickInsertField( aURLItem, ESelection() ); 1520 OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); 1521 1522 SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT); 1523 1524 pOutl->UpdateFields(); 1525 pOutl->SetUpdateMode( sal_True ); 1526 Size aSize(pOutl->CalcTextSize()); 1527 pOutl->SetUpdateMode( sal_False ); 1528 1529 Point aPos; 1530 1531 if (pPos) 1532 { 1533 aPos = *pPos; 1534 } 1535 else 1536 { 1537 Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() ); 1538 aPos = aRect.Center(); 1539 aPos = GetActiveWindow()->PixelToLogic(aPos); 1540 aPos.X() -= aSize.Width() / 2; 1541 aPos.Y() -= aSize.Height() / 2; 1542 } 1543 1544 Rectangle aLogicRect(aPos, aSize); 1545 pRectObj->SetLogicRect(aLogicRect); 1546 pRectObj->SetOutlinerParaObject( pOutlParaObject ); 1547 mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView()); 1548 pOutl->Init( nOutlMode ); 1549 } 1550 } 1551 1552 /************************************************************************* 1553 |* 1554 |* URL-Button einfuegen 1555 |* 1556 \************************************************************************/ 1557 1558 void DrawViewShell::InsertURLButton(const String& rURL, const String& rText, 1559 const String& rTarget, const Point* pPos) 1560 { 1561 sal_Bool bNewObj = sal_True; 1562 1563 const OUString sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL, URIHelper::GetMaybeFileHdl(), true, false, 1564 INetURLObject::WAS_ENCODED, 1565 INetURLObject::DECODE_UNAMBIGUOUS ) ); 1566 if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0) 1567 { 1568 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 1569 if( pMarkedObj ) try 1570 { 1571 // change first marked object 1572 if( (FmFormInventor == pMarkedObj->GetObjInventor() && pMarkedObj->GetObjIdentifier() == OBJ_FM_BUTTON) ) 1573 { 1574 bNewObj = sal_False; 1575 1576 SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pMarkedObj ); 1577 1578 Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), UNO_QUERY_THROW ); 1579 Reference< beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW ); 1580 1581 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) ); 1582 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) ); 1583 1584 if( rTarget.Len() ) 1585 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) ); 1586 1587 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) ); 1588 if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) 1589 { 1590 // #105638# OJ 1591 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) ); 1592 } 1593 } 1594 else 1595 { 1596 // add url as interaction for first selected shape 1597 bNewObj = sal_False; 1598 1599 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj, true); 1600 pInfo->meClickAction = presentation::ClickAction_DOCUMENT; 1601 pInfo->SetBookmark( sTargetURL ); 1602 } 1603 } 1604 catch( uno::Exception& ) 1605 { 1606 } 1607 } 1608 1609 if (bNewObj) try 1610 { 1611 SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON, 1612 mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) ); 1613 1614 Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); 1615 Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); 1616 1617 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) ); 1618 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) ); 1619 1620 if( rTarget.Len() ) 1621 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) ); 1622 1623 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) ); 1624 // #105638# OJ 1625 if ( ::avmedia::MediaWindow::isMediaURL( rURL ) ) 1626 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) ); 1627 1628 Point aPos; 1629 1630 if (pPos) 1631 { 1632 aPos = *pPos; 1633 } 1634 else 1635 { 1636 aPos = Rectangle(aPos, GetActiveWindow()->GetOutputSizePixel()).Center(); 1637 aPos = GetActiveWindow()->PixelToLogic(aPos); 1638 } 1639 1640 Size aSize(4000, 1000); 1641 aPos.X() -= aSize.Width() / 2; 1642 aPos.Y() -= aSize.Height() / 2; 1643 pUnoCtrl->SetLogicRect(Rectangle(aPos, aSize)); 1644 1645 sal_uLong nOptions = SDRINSERT_SETDEFLAYER; 1646 1647 OSL_ASSERT (GetViewShell()!=NULL); 1648 SfxInPlaceClient* pIpClient = GetViewShell()->GetIPClient(); 1649 if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive()) 1650 { 1651 nOptions |= SDRINSERT_DONTMARK; 1652 } 1653 1654 mpDrawView->InsertObjectAtView(pUnoCtrl, *mpDrawView->GetSdrPageView(), nOptions); 1655 } 1656 catch( Exception& ) 1657 { 1658 } 1659 } 1660 1661 /************************************************************************* 1662 |* 1663 |* 1664 |* 1665 \************************************************************************/ 1666 1667 void DrawViewShell::ShowUIControls (bool bVisible) 1668 { 1669 ViewShell::ShowUIControls (bVisible); 1670 1671 //AF: The LayerDialogChildWindow is not used anymore (I hope). 1672 // GetViewFrame()->SetChildWindow( 1673 // LayerDialogChildWindow::GetChildWindowId(), 1674 // IsLayerModeActive() && bVisible); 1675 maTabControl.Show (bVisible); 1676 } 1677 1678 void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/) 1679 { 1680 Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() ); 1681 if(xPresentation.is() && xPresentation->isRunning()) 1682 { 1683 if( mpDrawView->IsTextEdit() ) 1684 mpDrawView->SdrEndTextEdit(); 1685 1686 xPresentation->end(); 1687 } 1688 } 1689 1690 #ifdef _MSC_VER 1691 #pragma optimize ( "", on ) 1692 #endif 1693 1694 } // end of namespace sd 1695