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 #include <svx/svdograf.hxx> 31 #ifndef _SVXIDS_HRC 32 #include <svx/svxids.hrc> 33 #endif 34 #include <svx/svdpagv.hxx> 35 #include <svx/svdundo.hxx> 36 #ifndef _ZOOMITEM_HXX 37 #include <svx/zoomitem.hxx> 38 #endif 39 #ifndef _EDITDATA_HXX 40 #include <editeng/editdata.hxx> 41 #endif 42 #include <basic/sberrors.hxx> 43 #include <vcl/msgbox.hxx> 44 #include <sfx2/request.hxx> 45 #include <sfx2/dispatch.hxx> 46 #include <svx/xfillit0.hxx> 47 #include <svx/xflclit.hxx> 48 #include <svl/aeitem.hxx> 49 #include <editeng/eeitem.hxx> 50 #include <basic/sbstar.hxx> 51 #include <editeng/flditem.hxx> 52 #include <svx/xlineit0.hxx> 53 #include <svx/xfillit0.hxx> 54 55 #ifndef _SDOUTL_HXX //autogen 56 #include <svx/svdoutl.hxx> 57 #endif 58 #include <svx/xlnwtit.hxx> 59 #include <svx/svdoattr.hxx> 60 #include <svx/xlnstwit.hxx> 61 #include <svx/sdtmfitm.hxx> 62 #include <svx/sdtagitm.hxx> 63 #include <svx/xlnedwit.hxx> 64 #include <svx/fontworkbar.hxx> 65 66 #include <svx/svxdlg.hxx> 67 #include <svx/dialogs.hrc> 68 69 #include <sfx2/viewfrm.hxx> 70 #include "sdgrffilter.hxx" 71 72 #include "app.hrc" 73 #include "glob.hrc" 74 #include "helpids.h" 75 #include "sdattr.hxx" 76 #include "drawview.hxx" 77 #include "Window.hxx" 78 #include "drawdoc.hxx" 79 #include "DrawDocShell.hxx" 80 #include "sdpage.hxx" 81 #include "fuscale.hxx" 82 #include "sdresid.hxx" 83 #include "GraphicViewShell.hxx" 84 #include "unmodpg.hxx" 85 #include "slideshow.hxx" 86 #include "fuvect.hxx" 87 #include "stlpool.hxx" 88 89 // #90356# 90 #include "optsitem.hxx" 91 #include "sdabstdlg.hxx" 92 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> 93 #include <com/sun/star/drawing/XDrawPages.hpp> 94 95 #include <strings.hrc> 96 97 using namespace ::com::sun::star; 98 using namespace ::com::sun::star::uno; 99 100 namespace sd { 101 102 /************************************************************************* 103 |* 104 |* SfxRequests fuer temporaere Funktionen 105 |* 106 \************************************************************************/ 107 108 void DrawViewShell::FuTemporary(SfxRequest& rReq) 109 { 110 // Waehrend einer Native-Diashow wird nichts ausgefuehrt! 111 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR)) 112 return; 113 114 DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" ); 115 if( !mpDrawView ) 116 return; 117 118 CheckLineTo (rReq); 119 120 DeactivateCurrentFunction(); 121 122 sal_uInt16 nSId = rReq.GetSlot(); 123 124 // Slot wird gemapped (ToolboxImages/-Slots) 125 MapSlot( nSId ); 126 127 switch ( nSId ) 128 { 129 // Flaechen und Linien-Attribute: 130 // Sollten (wie StateMethode) eine eigene 131 // Execute-Methode besitzen 132 case SID_ATTR_FILL_STYLE: 133 case SID_ATTR_FILL_COLOR: 134 case SID_ATTR_FILL_GRADIENT: 135 case SID_ATTR_FILL_HATCH: 136 case SID_ATTR_FILL_BITMAP: 137 case SID_ATTR_FILL_SHADOW: 138 139 case SID_ATTR_LINE_STYLE: 140 case SID_ATTR_LINE_DASH: 141 case SID_ATTR_LINE_WIDTH: 142 case SID_ATTR_LINE_COLOR: 143 case SID_ATTR_LINEEND_STYLE: 144 145 case SID_ATTR_TEXT_FITTOSIZE: 146 { 147 if( rReq.GetArgs() ) 148 { 149 sal_Bool bMergeUndo = sal_False; 150 ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager(); 151 152 // Anpassungen Start/EndWidth #63083# 153 if(nSId == SID_ATTR_LINE_WIDTH) 154 { 155 SdrObject* pObj = NULL; 156 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 157 sal_uLong nCount = rMarkList.GetMarkCount(); 158 const sal_Int32 nNewLineWidth(((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue()); 159 const bool bUndo(mpDrawView->IsUndoEnabled()); 160 161 for (sal_uLong i=0; i<nCount; i++) 162 { 163 SfxItemSet aAttr(GetDoc()->GetPool()); 164 pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 165 aAttr.Put(pObj->GetMergedItemSet()); 166 167 sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue(); 168 169 if(nActLineWidth != nNewLineWidth) 170 { 171 sal_Bool bSetItemSet(sal_False); 172 173 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET 174 if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH)) 175 { 176 sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue(); 177 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 178 if(nValNew < 0) 179 nValNew = 0; 180 bSetItemSet = sal_True; 181 aAttr.Put(XLineStartWidthItem(nValNew)); 182 } 183 184 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET 185 if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH)) 186 { 187 sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue(); 188 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 189 if(nValNew < 0) 190 nValNew = 0; 191 bSetItemSet = sal_True; 192 aAttr.Put(XLineEndWidthItem(nValNew)); 193 } 194 195 if(bSetItemSet) 196 { 197 if(bUndo) 198 { 199 if(!bMergeUndo) 200 { 201 pUndoManager->EnterListAction( String(), String() ); 202 mpDrawView->BegUndo(); 203 bMergeUndo = sal_True; 204 } 205 206 mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); 207 } 208 209 pObj->SetMergedItemSet(aAttr); 210 } 211 } 212 } 213 214 if(bMergeUndo) 215 { 216 mpDrawView->EndUndo(); 217 } 218 } 219 220 if (nSId == SID_ATTR_FILL_SHADOW) 221 { 222 // Ggf. werden transparente Objekte wei?gefuellt 223 SdrObject* pObj = NULL; 224 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 225 sal_uLong nCount = rMarkList.GetMarkCount(); 226 const bool bUndo = mpDrawView->IsUndoEnabled(); 227 228 for (sal_uLong i=0; i<nCount; i++) 229 { 230 SfxItemSet aAttr(GetDoc()->GetPool()); 231 pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 232 233 // #i25616# 234 if(!pObj->ISA(SdrGrafObj)) 235 { 236 aAttr.Put(pObj->GetMergedItemSet()); 237 238 const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE); 239 const XLineStyleItem& rLineStyle = (const XLineStyleItem&) aAttr.Get(XATTR_LINESTYLE); 240 241 if(XFILL_NONE == rFillStyle.GetValue() && XLINE_NONE == rLineStyle.GetValue()) 242 { 243 if( bUndo ) 244 { 245 // Vorlage hat keine Fuellung, 246 // daher hart attributieren: Fuellung setzen 247 if (!bMergeUndo) 248 { 249 bMergeUndo = sal_True; 250 pUndoManager->EnterListAction( String(), String() ); 251 mpDrawView->BegUndo(); 252 } 253 254 mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); 255 } 256 257 aAttr.Put(XFillStyleItem(XFILL_SOLID)); 258 aAttr.Put(XFillColorItem(String(), COL_WHITE)); 259 260 pObj->SetMergedItemSet(aAttr); 261 } 262 } 263 } 264 265 if (bMergeUndo) 266 { 267 mpDrawView->EndUndo(); 268 } 269 } 270 271 mpDrawView->SetAttributes(*rReq.GetArgs()); 272 273 if (bMergeUndo) 274 { 275 pUndoManager->LeaveListAction(); 276 } 277 278 rReq.Done(); 279 } 280 else 281 { 282 switch( rReq.GetSlot() ) 283 { 284 case SID_ATTR_FILL_SHADOW: 285 case SID_ATTR_FILL_STYLE: 286 case SID_ATTR_FILL_COLOR: 287 case SID_ATTR_FILL_GRADIENT: 288 case SID_ATTR_FILL_HATCH: 289 case SID_ATTR_FILL_BITMAP: 290 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON ); 291 break; 292 case SID_ATTR_LINE_STYLE: 293 case SID_ATTR_LINE_DASH: 294 case SID_ATTR_LINE_WIDTH: 295 case SID_ATTR_LINE_COLOR: 296 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON ); 297 break; 298 case SID_ATTR_TEXT_FITTOSIZE: 299 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON ); 300 break; 301 } 302 } 303 Cancel(); 304 } 305 break; 306 307 case SID_HYPHENATION: 308 { 309 // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION ); 310 // ^-- Soll so nicht benutzt werden (Defaults sind falsch) ! 311 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False); 312 313 if( pItem ) 314 { 315 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 316 sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue(); 317 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); 318 mpDrawView->SetAttributes( aSet ); 319 } 320 else // nur zum Test 321 { 322 DBG_ERROR(" Kein Wert fuer Silbentrennung!"); 323 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 324 sal_Bool bValue = sal_True; 325 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); 326 mpDrawView->SetAttributes( aSet ); 327 } 328 rReq.Done(); 329 Cancel(); 330 } 331 break; 332 333 case SID_INSERTPAGE: 334 case SID_INSERTPAGE_QUICK: 335 case SID_DUPLICATE_PAGE: 336 { 337 SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage()); 338 Cancel(); 339 if(HasCurrentFunction(SID_BEZIER_EDIT) ) 340 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 341 if (pNewPage != NULL) 342 SwitchPage((pNewPage->GetPageNum()-1)/2); 343 rReq.Done (); 344 } 345 break; 346 347 case SID_INSERT_MASTER_PAGE: 348 { 349 // Use the API to create a new page. 350 Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier ( 351 GetDoc()->getUnoModel(), UNO_QUERY); 352 if (xMasterPagesSupplier.is()) 353 { 354 Reference<drawing::XDrawPages> xMasterPages ( 355 xMasterPagesSupplier->getMasterPages()); 356 if (xMasterPages.is()) 357 { 358 sal_uInt16 nIndex = GetCurPageId(); 359 xMasterPages->insertNewByIndex (nIndex); 360 361 // Create shapes for the default layout. 362 SdPage* pMasterPage = GetDoc()->GetMasterSdPage( 363 nIndex, PK_STANDARD); 364 pMasterPage->CreateTitleAndLayout (sal_True,sal_True); 365 } 366 } 367 368 Cancel(); 369 if(HasCurrentFunction(SID_BEZIER_EDIT)) 370 GetViewFrame()->GetDispatcher()->Execute( 371 SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 372 rReq.Done (); 373 } 374 break; 375 376 case SID_MODIFYPAGE: 377 { 378 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || 379 (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) ) 380 { 381 if ( mpDrawView->IsTextEdit() ) 382 { 383 mpDrawView->SdrEndTextEdit(); 384 } 385 sal_uInt16 nPage = maTabControl.GetCurPageId() - 1; 386 mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind); 387 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot ( 388 rReq, 389 mpActualPage, 390 mePageKind); 391 } 392 393 Cancel(); 394 rReq.Done (); 395 } 396 break; 397 398 case SID_ASSIGN_LAYOUT: 399 { 400 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE)) 401 { 402 if ( mpDrawView->IsTextEdit() ) 403 mpDrawView->SdrEndTextEdit(); 404 405 ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind); 406 } 407 Cancel(); 408 rReq.Done (); 409 } 410 break; 411 412 case SID_RENAMEPAGE: 413 case SID_RENAME_MASTER_PAGE: 414 { 415 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ) 416 { 417 if ( mpDrawView->IsTextEdit() ) 418 { 419 mpDrawView->SdrEndTextEdit(); 420 } 421 422 sal_uInt16 nPageId = maTabControl.GetCurPageId(); 423 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE ) 424 ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() ) 425 : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() ); 426 427 String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) ); 428 String aDescr( SdResId( STR_DESC_RENAMESLIDE ) ); 429 String aPageName = pCurrentPage->GetName(); 430 431 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 432 DBG_ASSERT(pFact, "Dialogdiet fail!"); 433 AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr ); 434 DBG_ASSERT(aNameDlg, "Dialogdiet fail!"); 435 aNameDlg->SetText( aTitle ); 436 aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true ); 437 aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); 438 439 if( aNameDlg->Execute() == RET_OK ) 440 { 441 String aNewName; 442 aNameDlg->GetName( aNewName ); 443 if( ! aNewName.Equals( aPageName ) ) 444 { 445 #ifdef DBG_UTIL 446 bool bResult = 447 #endif 448 RenameSlide( nPageId, aNewName ); 449 DBG_ASSERT( bResult, "Couldn't rename slide" ); 450 } 451 } 452 delete aNameDlg; 453 } 454 455 Cancel(); 456 rReq.Ignore (); 457 } 458 break; 459 460 case SID_RENAMEPAGE_QUICK: 461 { 462 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ) 463 { 464 if ( mpDrawView->IsTextEdit() ) 465 { 466 mpDrawView->SdrEndTextEdit(); 467 } 468 469 maTabControl.StartEditMode( maTabControl.GetCurPageId() ); 470 } 471 472 Cancel(); 473 rReq.Ignore (); 474 } 475 break; 476 477 case SID_PAGESIZE : // entweder dieses (kein menueeintrag o. ae. !!) 478 { 479 const SfxItemSet *pArgs = rReq.GetArgs (); 480 481 if (pArgs) 482 if (pArgs->Count () == 3) 483 { 484 SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False); 485 SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False); 486 SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False); 487 488 Size aSize (pWidth->GetValue (), pHeight->GetValue ()); 489 490 SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ()); 491 rReq.Ignore (); 492 break; 493 } 494 495 StarBASIC::FatalError (SbERR_WRONG_ARGS); 496 rReq.Ignore (); 497 break; 498 } 499 500 case SID_PAGEMARGIN : // oder dieses (kein menueeintrag o. ae. !!) 501 { 502 const SfxItemSet *pArgs = rReq.GetArgs (); 503 504 if (pArgs) 505 if (pArgs->Count () == 5) 506 { 507 SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False); 508 SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False); 509 SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False); 510 SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False); 511 SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False); 512 513 Size aEmptySize (0, 0); 514 515 SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (), 516 pUpper->GetValue (), pLower->GetValue (), 517 sal_False, sal_True, pScaleAll->GetValue ()); 518 rReq.Ignore (); 519 break; 520 } 521 522 StarBASIC::FatalError (SbERR_WRONG_ARGS); 523 rReq.Ignore (); 524 break; 525 } 526 527 case SID_ATTR_ZOOMSLIDER: 528 { 529 const SfxItemSet* pArgs = rReq.GetArgs(); 530 531 if (pArgs && pArgs->Count () == 1 ) 532 { 533 SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False); 534 if (CHECK_RANGE (5, pScale->GetValue (), 3000)) 535 { 536 SetZoom (pScale->GetValue ()); 537 538 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 539 rBindings.Invalidate( SID_ATTR_ZOOM ); 540 rBindings.Invalidate( SID_ZOOM_IN ); 541 rBindings.Invalidate( SID_ZOOM_OUT ); 542 rBindings.Invalidate( SID_ATTR_ZOOMSLIDER ); 543 544 } 545 } 546 547 Cancel(); 548 rReq.Done (); 549 break; 550 } 551 case SID_ZOOMING : // kein Menueintrag, sondern aus dem Zoomdialog generiert 552 { 553 const SfxItemSet* pArgs = rReq.GetArgs(); 554 555 if (pArgs) 556 if (pArgs->Count () == 1) 557 { 558 SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False); 559 if (CHECK_RANGE (10, pScale->GetValue (), 1000)) 560 { 561 SetZoom (pScale->GetValue ()); 562 563 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 564 rBindings.Invalidate( SID_ATTR_ZOOM ); 565 rBindings.Invalidate( SID_ZOOM_IN ); 566 rBindings.Invalidate( SID_ZOOM_OUT ); 567 rBindings.Invalidate( SID_ATTR_ZOOMSLIDER ); 568 } 569 else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); 570 571 rReq.Ignore (); 572 break; 573 } 574 575 StarBASIC::FatalError (SbERR_WRONG_ARGS); 576 rReq.Ignore (); 577 break; 578 } 579 580 case SID_ATTR_ZOOM: 581 { 582 const SfxItemSet* pArgs = rReq.GetArgs(); 583 mbZoomOnPage = sal_False; 584 585 if ( pArgs ) 586 { 587 SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs-> 588 Get( SID_ATTR_ZOOM ) ).GetType(); 589 switch( eZT ) 590 { 591 case SVX_ZOOM_PERCENT: 592 SetZoom( (long) ( ( const SvxZoomItem& ) pArgs-> 593 Get( SID_ATTR_ZOOM ) ).GetValue() ); 594 break; 595 596 case SVX_ZOOM_OPTIMAL: 597 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, 598 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 599 break; 600 601 case SVX_ZOOM_PAGEWIDTH: 602 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, 603 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 604 break; 605 606 case SVX_ZOOM_WHOLEPAGE: 607 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE, 608 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 609 break; 610 case SVX_ZOOM_PAGEWIDTH_NOBORDER: 611 DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" ); 612 break; 613 } 614 rReq.Ignore (); 615 } 616 else 617 { 618 // hier den Zoom-Dialog oeffnen 619 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 620 } 621 Cancel(); 622 } 623 break; 624 625 case SID_CHANGEBEZIER: 626 case SID_CHANGEPOLYGON: 627 if ( mpDrawView->IsTextEdit() ) 628 { 629 mpDrawView->SdrEndTextEdit(); 630 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 631 } 632 633 if ( mpDrawView->IsPresObjSelected() ) 634 { 635 ::sd::Window* pWindow = GetActiveWindow(); 636 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 637 } 638 else 639 { 640 if( rReq.GetSlot() == SID_CHANGEBEZIER ) 641 { 642 WaitObject aWait( (Window*)GetActiveWindow() ); 643 mpDrawView->ConvertMarkedToPathObj(sal_False); 644 } 645 else 646 { 647 if( mpDrawView->IsVectorizeAllowed() ) 648 { 649 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 650 } 651 else 652 { 653 WaitObject aWait( (Window*)GetActiveWindow() ); 654 mpDrawView->ConvertMarkedToPolyObj(sal_False); 655 } 656 } 657 658 Invalidate(SID_CHANGEBEZIER); 659 Invalidate(SID_CHANGEPOLYGON); 660 } 661 Cancel(); 662 663 if( HasCurrentFunction(SID_BEZIER_EDIT) ) 664 { // ggf. die richtige Editfunktion aktivieren 665 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT, 666 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 667 } 668 rReq.Ignore (); 669 break; 670 671 case SID_CONVERT_TO_CONTOUR: 672 if ( mpDrawView->IsTextEdit() ) 673 { 674 mpDrawView->SdrEndTextEdit(); 675 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 676 } 677 678 if ( mpDrawView->IsPresObjSelected() ) 679 { 680 ::sd::Window* pWindow = GetActiveWindow(); 681 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 682 } 683 else 684 { 685 WaitObject aWait( (Window*)GetActiveWindow() ); 686 mpDrawView->ConvertMarkedToPathObj(sal_True); 687 688 Invalidate(SID_CONVERT_TO_CONTOUR); 689 } 690 Cancel(); 691 692 rReq.Ignore (); 693 break; 694 695 case SID_CONVERT_TO_METAFILE: 696 case SID_CONVERT_TO_BITMAP: 697 { 698 // End text edit mode when it is active because the metafile or 699 // bitmap that will be created does not support it. 700 if ( mpDrawView->IsTextEdit() ) 701 { 702 mpDrawView->SdrEndTextEdit(); 703 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 704 } 705 706 if ( mpDrawView->IsPresObjSelected(true,true,true) ) 707 { 708 ::sd::Window* pWindow = GetActiveWindow(); 709 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 710 } 711 else 712 { 713 WaitObject aWait( (Window*)GetActiveWindow() ); 714 715 // switch on undo for the next operations 716 mpDrawView->BegUndo( 717 String( 718 SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP))); 719 720 // create SdrGrafObj from metafile/bitmap 721 Graphic aGraphic; 722 switch (nSId) 723 { 724 case SID_CONVERT_TO_METAFILE: 725 { 726 GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile()); 727 aGraphic = Graphic(aMetaFile); 728 } 729 break; 730 case SID_CONVERT_TO_BITMAP: 731 { 732 bool bDone(false); 733 734 // I have to get the image here directly since GetMarkedObjBitmapEx works 735 // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha 736 // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely 737 // change that, e.g. in the exchange formats. For now I can only add this 738 // exception to get good results for Svgs. This is how the code gets more 739 // and more crowded, at last I made a remark for myself to change this 740 // as one of the next tasks. 741 if(1 == mpDrawView->GetMarkedObjectCount()) 742 { 743 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0)); 744 745 if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg()) 746 { 747 aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement()); 748 bDone = true; 749 } 750 } 751 752 if(!bDone) 753 { 754 aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx()); 755 } 756 } 757 break; 758 } 759 760 // create new object 761 SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic); 762 763 // get some necessary info and ensure it 764 const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); 765 const sal_uInt32 nMarkCount(rMarkList.GetMarkCount()); 766 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 767 OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)"); 768 OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)"); 769 770 // fit rectangle of new graphic object to selection's mark rect 771 Rectangle aAllMarkedRect; 772 rMarkList.TakeBoundRect(pPageView, aAllMarkedRect); 773 pGraphicObj->SetLogicRect(aAllMarkedRect); 774 775 // #i71540# to keep the order, it is necessary to replace the lowest object 776 // of the selection with the new object. This also means that with multi 777 // selection, all other objects need to be deleted first 778 SdrMark* pFirstMark = rMarkList.GetMark(0L); 779 SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj(); 780 781 if(nMarkCount > 1L) 782 { 783 // take first object out of selection 784 mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true); 785 786 // clear remaining selection 787 mpDrawView->DeleteMarkedObj(); 788 } 789 790 // now replace lowest object with new one 791 mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj); 792 793 // switch off undo 794 mpDrawView->EndUndo(); 795 } 796 } 797 798 Cancel(); 799 800 rReq.Done (); 801 break; 802 803 case SID_SET_DEFAULT: 804 { 805 SfxItemSet* pSet = NULL; 806 807 if (mpDrawView->IsTextEdit()) 808 { 809 ::Outliner* pOutl = mpDrawView->GetTextEditOutliner(); 810 if (pOutl) 811 { 812 pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType()); 813 } 814 815 pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END ); 816 mpDrawView->SetAttributes( *pSet, sal_True ); 817 } 818 else 819 { 820 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 821 sal_uLong nCount = rMarkList.GetMarkCount(); 822 823 // In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet 824 // der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden 825 // mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert 826 // werden muessen 827 List* pAttrList = new List(); 828 SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage(); 829 sal_uLong i; 830 831 for ( i = 0; i < nCount; i++ ) 832 { 833 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 834 835 if( pPresPage->IsPresObj( pObj ) ) 836 { 837 SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 ); 838 pNewSet->Put(pObj->GetMergedItemSet()); 839 pAttrList->Insert( pNewSet, LIST_APPEND ); 840 pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND ); 841 } 842 } 843 844 pSet = new SfxItemSet( GetPool() ); 845 mpDrawView->SetAttributes( *pSet, sal_True ); 846 847 sal_uLong j = 0; 848 849 for ( i = 0; i < nCount; i++ ) 850 { 851 SfxStyleSheet* pSheet = NULL; 852 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 853 854 if (pObj->GetObjIdentifier() == OBJ_TITLETEXT) 855 { 856 pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE); 857 if (pSheet) 858 pObj->SetStyleSheet(pSheet, sal_False); 859 } 860 else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT) 861 { 862 for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++) 863 { 864 pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); 865 DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden"); 866 if (pSheet) 867 { 868 pObj->StartListening(*pSheet); 869 870 if( nLevel == 1 ) 871 // Textrahmen hoert auf StyleSheet der Ebene1 872 pObj->NbcSetStyleSheet(pSheet, sal_False); 873 874 } 875 } 876 } 877 878 if( pPresPage->IsPresObj( pObj ) ) 879 { 880 SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++); 881 SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++); 882 883 if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON ) 884 { 885 pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT)); 886 } 887 888 if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON ) 889 { 890 pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT)); 891 } 892 893 if( pUserCall ) 894 pObj->SetUserCall( pUserCall ); 895 896 delete pNewSet; 897 } 898 } 899 900 delete pAttrList; 901 } 902 903 delete pSet; 904 Cancel(); 905 } 906 break; 907 908 case SID_DELETE_SNAPITEM: 909 { 910 SdrPageView* pPV; 911 Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos ); 912 sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size( 913 FuPoor::HITPIX, 0 ) ).Width(); 914 sal_uInt16 nHelpLine; 915 916 mbMousePosFreezed = sal_False; 917 918 if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) 919 { 920 pPV->DeleteHelpLine( nHelpLine ); 921 } 922 Cancel(); 923 rReq.Ignore (); 924 } 925 break; 926 927 case SID_DELETE_PAGE: 928 case SID_DELETE_MASTER_PAGE: 929 DeleteActualPage(); 930 Cancel(); 931 rReq.Ignore (); 932 break; 933 934 case SID_DELETE_LAYER: 935 DeleteActualLayer(); 936 Cancel(); 937 rReq.Ignore (); 938 break; 939 940 case SID_ORIGINAL_SIZE: 941 mpDrawView->SetMarkedOriginalSize(); 942 Cancel(); 943 rReq.Done(); 944 break; 945 946 case SID_DRAW_FONTWORK: 947 case SID_DRAW_FONTWORK_VERTICAL: 948 { 949 svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think) 950 Cancel(); 951 rReq.Done(); 952 } 953 break; 954 955 case SID_SAVEGRAPHIC: 956 { 957 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 958 if( rMarkList.GetMarkCount() == 1 ) 959 { 960 SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() ); 961 if(pGrafObj ) 962 { 963 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY ); 964 SdGRFFilter::SaveGraphic( xShape ); 965 } 966 } 967 Cancel(); 968 rReq.Ignore(); 969 } 970 break; 971 972 default: 973 { 974 // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die 975 // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8) 976 // gewandert. 977 FuTemp01(rReq); 978 } 979 break; 980 } 981 982 if(HasCurrentFunction()) 983 { 984 GetCurrentFunction()->Activate(); 985 } 986 } 987 988 989 990 991 /** This method consists basically of three parts: 992 1. Process the arguments of the SFX request. 993 2. Use the model to create a new page or duplicate an existing one. 994 3. Update the tab control and switch to the new page. 995 */ 996 SdPage* DrawViewShell::CreateOrDuplicatePage ( 997 SfxRequest& rRequest, 998 PageKind ePageKind, 999 SdPage* pPage, 1000 const sal_Int32 nInsertPosition) 1001 { 1002 SdPage* pNewPage = NULL; 1003 if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE) 1004 { 1005 if ( mpDrawView->IsTextEdit() ) 1006 { 1007 mpDrawView->SdrEndTextEdit(); 1008 } 1009 pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition); 1010 } 1011 return pNewPage; 1012 } 1013 1014 } // end of namespace sd 1015