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 <editeng/escpitem.hxx> 67 #include <editeng/kernitem.hxx> 68 #include <editeng/wghtitem.hxx> 69 #include <editeng/postitem.hxx> 70 #include <editeng/udlnitem.hxx> 71 #include <editeng/crsditem.hxx> 72 #include <editeng/cntritem.hxx> 73 #include <editeng/shdditem.hxx> 74 #include <svx/xtable.hxx> 75 #include <svx/svdobj.hxx> 76 #include <editeng/outlobj.hxx> 77 #include <editeng/flstitem.hxx> 78 #include <editeng/scripttypeitem.hxx> 79 #include <editeng/fontitem.hxx> 80 #include <editeng/fhgtitem.hxx> 81 #include <editeng/colritem.hxx> 82 #include <editeng/brshitem.hxx> 83 84 #include <svl/whiter.hxx> 85 86 #include <svx/svxdlg.hxx> 87 #include <svx/dialogs.hrc> 88 89 #include <sfx2/viewfrm.hxx> 90 #include "sdgrffilter.hxx" 91 92 #include "app.hrc" 93 #include "glob.hrc" 94 #include "helpids.h" 95 #include "sdattr.hxx" 96 #include "drawview.hxx" 97 #include "Window.hxx" 98 #include "drawdoc.hxx" 99 #include "DrawDocShell.hxx" 100 #include "sdpage.hxx" 101 #include "fuscale.hxx" 102 #include "sdresid.hxx" 103 #include "GraphicViewShell.hxx" 104 #include "unmodpg.hxx" 105 #include "slideshow.hxx" 106 #include "fuvect.hxx" 107 #include "futext.hxx" 108 #include "stlpool.hxx" 109 110 // #90356# 111 #include "optsitem.hxx" 112 #include "sdabstdlg.hxx" 113 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> 114 #include <com/sun/star/drawing/XDrawPages.hpp> 115 116 #include <strings.hrc> 117 118 using namespace ::com::sun::star; 119 using namespace ::com::sun::star::uno; 120 121 namespace sd { 122 123 /************************************************************************* 124 |* 125 |* SfxRequests fuer temporaere Funktionen 126 |* 127 \************************************************************************/ 128 129 void DrawViewShell::FuTemporary(SfxRequest& rReq) 130 { 131 // Waehrend einer Native-Diashow wird nichts ausgefuehrt! 132 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR)) 133 return; 134 135 DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" ); 136 if( !mpDrawView ) 137 return; 138 139 CheckLineTo (rReq); 140 141 DeactivateCurrentFunction(); 142 143 sal_uInt16 nSId = rReq.GetSlot(); 144 145 // Slot wird gemapped (ToolboxImages/-Slots) 146 MapSlot( nSId ); 147 148 switch ( nSId ) 149 { 150 // Flaechen und Linien-Attribute: 151 // Sollten (wie StateMethode) eine eigene 152 // Execute-Methode besitzen 153 case SID_ATTR_FILL_STYLE: 154 case SID_ATTR_FILL_COLOR: 155 case SID_ATTR_FILL_GRADIENT: 156 case SID_ATTR_FILL_HATCH: 157 case SID_ATTR_FILL_BITMAP: 158 case SID_ATTR_FILL_SHADOW: 159 case SID_ATTR_FILL_TRANSPARENCE: 160 case SID_ATTR_FILL_FLOATTRANSPARENCE: 161 162 case SID_ATTR_LINE_STYLE: 163 case SID_ATTR_LINE_DASH: 164 case SID_ATTR_LINE_WIDTH: 165 case SID_ATTR_LINE_COLOR: 166 case SID_ATTR_LINEEND_STYLE: 167 case SID_ATTR_LINE_START: 168 case SID_ATTR_LINE_END: 169 case SID_ATTR_LINE_TRANSPARENCE: 170 case SID_ATTR_LINE_JOINT: 171 case SID_ATTR_LINE_CAP: 172 173 case SID_ATTR_TEXT_FITTOSIZE: 174 { 175 if( rReq.GetArgs() ) 176 { 177 sal_Bool bMergeUndo = sal_False; 178 ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager(); 179 180 // Anpassungen Start/EndWidth #63083# 181 if(nSId == SID_ATTR_LINE_WIDTH) 182 { 183 SdrObject* pObj = NULL; 184 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 185 sal_uLong nCount = rMarkList.GetMarkCount(); 186 const sal_Int32 nNewLineWidth(((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue()); 187 const bool bUndo(mpDrawView->IsUndoEnabled()); 188 189 for (sal_uLong i=0; i<nCount; i++) 190 { 191 SfxItemSet aAttr(GetDoc()->GetPool()); 192 pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 193 aAttr.Put(pObj->GetMergedItemSet()); 194 195 sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue(); 196 197 if(nActLineWidth != nNewLineWidth) 198 { 199 sal_Bool bSetItemSet(sal_False); 200 201 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET 202 if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH)) 203 { 204 sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue(); 205 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 206 if(nValNew < 0) 207 nValNew = 0; 208 bSetItemSet = sal_True; 209 aAttr.Put(XLineStartWidthItem(nValNew)); 210 } 211 212 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET 213 if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH)) 214 { 215 sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue(); 216 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 217 if(nValNew < 0) 218 nValNew = 0; 219 bSetItemSet = sal_True; 220 aAttr.Put(XLineEndWidthItem(nValNew)); 221 } 222 223 if(bSetItemSet) 224 { 225 if(bUndo) 226 { 227 if(!bMergeUndo) 228 { 229 pUndoManager->EnterListAction( String(), String() ); 230 mpDrawView->BegUndo(); 231 bMergeUndo = sal_True; 232 } 233 234 mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); 235 } 236 237 pObj->SetMergedItemSet(aAttr); 238 } 239 } 240 } 241 242 if(bMergeUndo) 243 { 244 mpDrawView->EndUndo(); 245 } 246 } 247 248 if (nSId == SID_ATTR_FILL_SHADOW) 249 { 250 // Ggf. werden transparente Objekte wei?gefuellt 251 SdrObject* pObj = NULL; 252 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 253 sal_uLong nCount = rMarkList.GetMarkCount(); 254 const bool bUndo = mpDrawView->IsUndoEnabled(); 255 256 for (sal_uLong i=0; i<nCount; i++) 257 { 258 SfxItemSet aAttr(GetDoc()->GetPool()); 259 pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 260 261 // #i25616# 262 if(!pObj->ISA(SdrGrafObj)) 263 { 264 aAttr.Put(pObj->GetMergedItemSet()); 265 266 const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE); 267 const XLineStyleItem& rLineStyle = (const XLineStyleItem&) aAttr.Get(XATTR_LINESTYLE); 268 269 if(XFILL_NONE == rFillStyle.GetValue() && XLINE_NONE == rLineStyle.GetValue()) 270 { 271 if( bUndo ) 272 { 273 // Vorlage hat keine Fuellung, 274 // daher hart attributieren: Fuellung setzen 275 if (!bMergeUndo) 276 { 277 bMergeUndo = sal_True; 278 pUndoManager->EnterListAction( String(), String() ); 279 mpDrawView->BegUndo(); 280 } 281 282 mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); 283 } 284 285 aAttr.Put(XFillStyleItem(XFILL_SOLID)); 286 aAttr.Put(XFillColorItem(String(), COL_WHITE)); 287 288 pObj->SetMergedItemSet(aAttr); 289 } 290 } 291 } 292 293 if (bMergeUndo) 294 { 295 mpDrawView->EndUndo(); 296 } 297 } 298 299 mpDrawView->SetAttributes(*rReq.GetArgs()); 300 301 if (bMergeUndo) 302 { 303 pUndoManager->LeaveListAction(); 304 } 305 306 rReq.Done(); 307 } 308 else 309 { 310 switch( rReq.GetSlot() ) 311 { 312 case SID_ATTR_FILL_SHADOW: 313 case SID_ATTR_FILL_STYLE: 314 case SID_ATTR_FILL_COLOR: 315 case SID_ATTR_FILL_GRADIENT: 316 case SID_ATTR_FILL_HATCH: 317 case SID_ATTR_FILL_BITMAP: 318 case SID_ATTR_FILL_TRANSPARENCE: 319 case SID_ATTR_FILL_FLOATTRANSPARENCE: 320 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON ); 321 break; 322 case SID_ATTR_LINE_STYLE: 323 case SID_ATTR_LINE_DASH: 324 case SID_ATTR_LINE_WIDTH: 325 case SID_ATTR_LINE_COLOR: 326 case SID_ATTR_LINE_TRANSPARENCE: 327 case SID_ATTR_LINE_JOINT: 328 case SID_ATTR_LINE_CAP: 329 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON ); 330 break; 331 case SID_ATTR_TEXT_FITTOSIZE: 332 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON ); 333 break; 334 } 335 } 336 Cancel(); 337 } 338 break; 339 340 case SID_HYPHENATION: 341 { 342 // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION ); 343 // ^-- Soll so nicht benutzt werden (Defaults sind falsch) ! 344 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False); 345 346 if( pItem ) 347 { 348 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 349 sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue(); 350 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); 351 mpDrawView->SetAttributes( aSet ); 352 } 353 else // nur zum Test 354 { 355 DBG_ERROR(" Kein Wert fuer Silbentrennung!"); 356 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 357 sal_Bool bValue = sal_True; 358 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); 359 mpDrawView->SetAttributes( aSet ); 360 } 361 rReq.Done(); 362 Cancel(); 363 } 364 break; 365 366 case SID_INSERTPAGE: 367 case SID_INSERTPAGE_QUICK: 368 case SID_DUPLICATE_PAGE: 369 { 370 SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage()); 371 Cancel(); 372 if(HasCurrentFunction(SID_BEZIER_EDIT) ) 373 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 374 if (pNewPage != NULL) 375 SwitchPage((pNewPage->GetPageNum()-1)/2); 376 rReq.Done (); 377 } 378 break; 379 380 case SID_INSERT_MASTER_PAGE: 381 { 382 // Use the API to create a new page. 383 Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier ( 384 GetDoc()->getUnoModel(), UNO_QUERY); 385 if (xMasterPagesSupplier.is()) 386 { 387 Reference<drawing::XDrawPages> xMasterPages ( 388 xMasterPagesSupplier->getMasterPages()); 389 if (xMasterPages.is()) 390 { 391 sal_uInt16 nIndex = GetCurPageId(); 392 xMasterPages->insertNewByIndex (nIndex); 393 394 // Create shapes for the default layout. 395 SdPage* pMasterPage = GetDoc()->GetMasterSdPage( 396 nIndex, PK_STANDARD); 397 pMasterPage->CreateTitleAndLayout (sal_True,sal_True); 398 } 399 } 400 401 Cancel(); 402 if(HasCurrentFunction(SID_BEZIER_EDIT)) 403 GetViewFrame()->GetDispatcher()->Execute( 404 SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 405 rReq.Done (); 406 } 407 break; 408 409 case SID_MODIFYPAGE: 410 { 411 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || 412 (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) ) 413 { 414 if ( mpDrawView->IsTextEdit() ) 415 { 416 mpDrawView->SdrEndTextEdit(); 417 } 418 sal_uInt16 nPage = maTabControl.GetCurPageId() - 1; 419 mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind); 420 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot ( 421 rReq, 422 mpActualPage, 423 mePageKind); 424 } 425 426 Cancel(); 427 rReq.Done (); 428 } 429 break; 430 431 case SID_ASSIGN_LAYOUT: 432 { 433 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE)) 434 { 435 if ( mpDrawView->IsTextEdit() ) 436 mpDrawView->SdrEndTextEdit(); 437 438 ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind); 439 } 440 Cancel(); 441 rReq.Done (); 442 } 443 break; 444 445 case SID_RENAMEPAGE: 446 case SID_RENAME_MASTER_PAGE: 447 { 448 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ) 449 { 450 if ( mpDrawView->IsTextEdit() ) 451 { 452 mpDrawView->SdrEndTextEdit(); 453 } 454 455 sal_uInt16 nPageId = maTabControl.GetCurPageId(); 456 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE ) 457 ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() ) 458 : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() ); 459 460 String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) ); 461 String aDescr( SdResId( STR_DESC_RENAMESLIDE ) ); 462 String aPageName = pCurrentPage->GetName(); 463 464 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 465 DBG_ASSERT(pFact, "Dialogdiet fail!"); 466 AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr ); 467 DBG_ASSERT(aNameDlg, "Dialogdiet fail!"); 468 aNameDlg->SetText( aTitle ); 469 aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true ); 470 aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); 471 472 if( aNameDlg->Execute() == RET_OK ) 473 { 474 String aNewName; 475 aNameDlg->GetName( aNewName ); 476 if( ! aNewName.Equals( aPageName ) ) 477 { 478 #ifdef DBG_UTIL 479 bool bResult = 480 #endif 481 RenameSlide( nPageId, aNewName ); 482 DBG_ASSERT( bResult, "Couldn't rename slide" ); 483 } 484 } 485 delete aNameDlg; 486 } 487 488 Cancel(); 489 rReq.Ignore (); 490 } 491 break; 492 493 case SID_RENAMEPAGE_QUICK: 494 { 495 if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ) 496 { 497 if ( mpDrawView->IsTextEdit() ) 498 { 499 mpDrawView->SdrEndTextEdit(); 500 } 501 502 maTabControl.StartEditMode( maTabControl.GetCurPageId() ); 503 } 504 505 Cancel(); 506 rReq.Ignore (); 507 } 508 break; 509 510 case SID_PAGESIZE : // entweder dieses (kein menueeintrag o. ae. !!) 511 { 512 const SfxItemSet *pArgs = rReq.GetArgs (); 513 514 if (pArgs) 515 if (pArgs->Count () == 3) 516 { 517 SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False); 518 SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False); 519 SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False); 520 521 Size aSize (pWidth->GetValue (), pHeight->GetValue ()); 522 523 SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ()); 524 rReq.Ignore (); 525 break; 526 } 527 528 StarBASIC::FatalError (SbERR_WRONG_ARGS); 529 rReq.Ignore (); 530 break; 531 } 532 533 case SID_PAGEMARGIN : // oder dieses (kein menueeintrag o. ae. !!) 534 { 535 const SfxItemSet *pArgs = rReq.GetArgs (); 536 537 if (pArgs) 538 if (pArgs->Count () == 5) 539 { 540 SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False); 541 SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False); 542 SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False); 543 SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False); 544 SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False); 545 546 Size aEmptySize (0, 0); 547 548 SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (), 549 pUpper->GetValue (), pLower->GetValue (), 550 sal_False, sal_True, pScaleAll->GetValue ()); 551 rReq.Ignore (); 552 break; 553 } 554 555 StarBASIC::FatalError (SbERR_WRONG_ARGS); 556 rReq.Ignore (); 557 break; 558 } 559 560 case SID_ATTR_ZOOMSLIDER: 561 { 562 const SfxItemSet* pArgs = rReq.GetArgs(); 563 564 if (pArgs && pArgs->Count () == 1 ) 565 { 566 SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False); 567 if (CHECK_RANGE (5, pScale->GetValue (), 3000)) 568 { 569 SetZoom (pScale->GetValue ()); 570 571 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 572 rBindings.Invalidate( SID_ATTR_ZOOM ); 573 rBindings.Invalidate( SID_ZOOM_IN ); 574 rBindings.Invalidate( SID_ZOOM_OUT ); 575 rBindings.Invalidate( SID_ATTR_ZOOMSLIDER ); 576 577 } 578 } 579 580 Cancel(); 581 rReq.Done (); 582 break; 583 } 584 case SID_ZOOMING : // kein Menueintrag, sondern aus dem Zoomdialog generiert 585 { 586 const SfxItemSet* pArgs = rReq.GetArgs(); 587 588 if (pArgs) 589 if (pArgs->Count () == 1) 590 { 591 SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False); 592 if (CHECK_RANGE (10, pScale->GetValue (), 1000)) 593 { 594 SetZoom (pScale->GetValue ()); 595 596 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 597 rBindings.Invalidate( SID_ATTR_ZOOM ); 598 rBindings.Invalidate( SID_ZOOM_IN ); 599 rBindings.Invalidate( SID_ZOOM_OUT ); 600 rBindings.Invalidate( SID_ATTR_ZOOMSLIDER ); 601 } 602 else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); 603 604 rReq.Ignore (); 605 break; 606 } 607 608 StarBASIC::FatalError (SbERR_WRONG_ARGS); 609 rReq.Ignore (); 610 break; 611 } 612 613 case SID_ATTR_ZOOM: 614 { 615 const SfxItemSet* pArgs = rReq.GetArgs(); 616 mbZoomOnPage = sal_False; 617 618 if ( pArgs ) 619 { 620 SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs-> 621 Get( SID_ATTR_ZOOM ) ).GetType(); 622 switch( eZT ) 623 { 624 case SVX_ZOOM_PERCENT: 625 SetZoom( (long) ( ( const SvxZoomItem& ) pArgs-> 626 Get( SID_ATTR_ZOOM ) ).GetValue() ); 627 break; 628 629 case SVX_ZOOM_OPTIMAL: 630 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, 631 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 632 break; 633 634 case SVX_ZOOM_PAGEWIDTH: 635 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, 636 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 637 break; 638 639 case SVX_ZOOM_WHOLEPAGE: 640 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE, 641 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 642 break; 643 case SVX_ZOOM_PAGEWIDTH_NOBORDER: 644 DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" ); 645 break; 646 } 647 rReq.Ignore (); 648 } 649 else 650 { 651 // hier den Zoom-Dialog oeffnen 652 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 653 } 654 Cancel(); 655 } 656 break; 657 658 case SID_CHANGEBEZIER: 659 case SID_CHANGEPOLYGON: 660 if ( mpDrawView->IsTextEdit() ) 661 { 662 mpDrawView->SdrEndTextEdit(); 663 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 664 } 665 666 if ( mpDrawView->IsPresObjSelected() ) 667 { 668 ::sd::Window* pWindow = GetActiveWindow(); 669 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 670 } 671 else 672 { 673 if( rReq.GetSlot() == SID_CHANGEBEZIER ) 674 { 675 WaitObject aWait( (Window*)GetActiveWindow() ); 676 mpDrawView->ConvertMarkedToPathObj(sal_False); 677 } 678 else 679 { 680 if( mpDrawView->IsVectorizeAllowed() ) 681 { 682 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 683 } 684 else 685 { 686 WaitObject aWait( (Window*)GetActiveWindow() ); 687 mpDrawView->ConvertMarkedToPolyObj(sal_False); 688 } 689 } 690 691 Invalidate(SID_CHANGEBEZIER); 692 Invalidate(SID_CHANGEPOLYGON); 693 } 694 Cancel(); 695 696 if( HasCurrentFunction(SID_BEZIER_EDIT) ) 697 { // ggf. die richtige Editfunktion aktivieren 698 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT, 699 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 700 } 701 rReq.Ignore (); 702 break; 703 704 case SID_CONVERT_TO_CONTOUR: 705 if ( mpDrawView->IsTextEdit() ) 706 { 707 mpDrawView->SdrEndTextEdit(); 708 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 709 } 710 711 if ( mpDrawView->IsPresObjSelected() ) 712 { 713 ::sd::Window* pWindow = GetActiveWindow(); 714 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 715 } 716 else 717 { 718 WaitObject aWait( (Window*)GetActiveWindow() ); 719 mpDrawView->ConvertMarkedToPathObj(sal_True); 720 721 Invalidate(SID_CONVERT_TO_CONTOUR); 722 } 723 Cancel(); 724 725 rReq.Ignore (); 726 break; 727 728 case SID_CONVERT_TO_METAFILE: 729 case SID_CONVERT_TO_BITMAP: 730 { 731 // End text edit mode when it is active because the metafile or 732 // bitmap that will be created does not support it. 733 if ( mpDrawView->IsTextEdit() ) 734 { 735 mpDrawView->SdrEndTextEdit(); 736 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 737 } 738 739 if ( mpDrawView->IsPresObjSelected(true,true,true) ) 740 { 741 ::sd::Window* pWindow = GetActiveWindow(); 742 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 743 } 744 else 745 { 746 WaitObject aWait( (Window*)GetActiveWindow() ); 747 748 // switch on undo for the next operations 749 mpDrawView->BegUndo( 750 String( 751 SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP))); 752 753 // create SdrGrafObj from metafile/bitmap 754 Graphic aGraphic; 755 switch (nSId) 756 { 757 case SID_CONVERT_TO_METAFILE: 758 { 759 GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile()); 760 aGraphic = Graphic(aMetaFile); 761 } 762 break; 763 case SID_CONVERT_TO_BITMAP: 764 { 765 bool bDone(false); 766 767 // I have to get the image here directly since GetMarkedObjBitmapEx works 768 // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha 769 // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely 770 // change that, e.g. in the exchange formats. For now I can only add this 771 // exception to get good results for Svgs. This is how the code gets more 772 // and more crowded, at last I made a remark for myself to change this 773 // as one of the next tasks. 774 if(1 == mpDrawView->GetMarkedObjectCount()) 775 { 776 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0)); 777 778 if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg()) 779 { 780 aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement()); 781 bDone = true; 782 } 783 } 784 785 if(!bDone) 786 { 787 aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx()); 788 } 789 } 790 break; 791 } 792 793 // create new object 794 SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic); 795 796 // get some necessary info and ensure it 797 const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); 798 const sal_uInt32 nMarkCount(rMarkList.GetMarkCount()); 799 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 800 OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)"); 801 OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)"); 802 803 // fit rectangle of new graphic object to selection's mark rect 804 Rectangle aAllMarkedRect; 805 rMarkList.TakeBoundRect(pPageView, aAllMarkedRect); 806 pGraphicObj->SetLogicRect(aAllMarkedRect); 807 808 // #i71540# to keep the order, it is necessary to replace the lowest object 809 // of the selection with the new object. This also means that with multi 810 // selection, all other objects need to be deleted first 811 SdrMark* pFirstMark = rMarkList.GetMark(0L); 812 SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj(); 813 814 if(nMarkCount > 1L) 815 { 816 // take first object out of selection 817 mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true); 818 819 // clear remaining selection 820 mpDrawView->DeleteMarkedObj(); 821 } 822 823 // now replace lowest object with new one 824 mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj); 825 826 // switch off undo 827 mpDrawView->EndUndo(); 828 } 829 } 830 831 Cancel(); 832 833 rReq.Done (); 834 break; 835 836 case SID_SET_DEFAULT: 837 { 838 SfxItemSet* pSet = NULL; 839 840 if (mpDrawView->IsTextEdit()) 841 { 842 ::Outliner* pOutl = mpDrawView->GetTextEditOutliner(); 843 if (pOutl) 844 { 845 pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType()); 846 } 847 848 pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END ); 849 mpDrawView->SetAttributes( *pSet, sal_True ); 850 } 851 else 852 { 853 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 854 sal_uLong nCount = rMarkList.GetMarkCount(); 855 856 // In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet 857 // der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden 858 // mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert 859 // werden muessen 860 List* pAttrList = new List(); 861 SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage(); 862 sal_uLong i; 863 864 for ( i = 0; i < nCount; i++ ) 865 { 866 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 867 868 if( pPresPage->IsPresObj( pObj ) ) 869 { 870 SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 ); 871 pNewSet->Put(pObj->GetMergedItemSet()); 872 pAttrList->Insert( pNewSet, LIST_APPEND ); 873 pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND ); 874 } 875 } 876 877 pSet = new SfxItemSet( GetPool() ); 878 mpDrawView->SetAttributes( *pSet, sal_True ); 879 880 sal_uLong j = 0; 881 882 for ( i = 0; i < nCount; i++ ) 883 { 884 SfxStyleSheet* pSheet = NULL; 885 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 886 887 if (pObj->GetObjIdentifier() == OBJ_TITLETEXT) 888 { 889 pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE); 890 if (pSheet) 891 pObj->SetStyleSheet(pSheet, sal_False); 892 } 893 else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT) 894 { 895 for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++) 896 { 897 pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); 898 DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden"); 899 if (pSheet) 900 { 901 pObj->StartListening(*pSheet); 902 903 if( nLevel == 1 ) 904 // Textrahmen hoert auf StyleSheet der Ebene1 905 pObj->NbcSetStyleSheet(pSheet, sal_False); 906 907 } 908 } 909 } 910 911 if( pPresPage->IsPresObj( pObj ) ) 912 { 913 SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++); 914 SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++); 915 916 if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON ) 917 { 918 pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT)); 919 } 920 921 if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON ) 922 { 923 pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT)); 924 } 925 926 if( pUserCall ) 927 pObj->SetUserCall( pUserCall ); 928 929 delete pNewSet; 930 } 931 } 932 933 delete pAttrList; 934 } 935 936 delete pSet; 937 Cancel(); 938 } 939 break; 940 941 case SID_DELETE_SNAPITEM: 942 { 943 SdrPageView* pPV; 944 Point aMPos = GetActiveWindow()->PixelToLogic( maMousePos ); 945 sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size( 946 FuPoor::HITPIX, 0 ) ).Width(); 947 sal_uInt16 nHelpLine; 948 949 mbMousePosFreezed = sal_False; 950 951 if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) 952 { 953 pPV->DeleteHelpLine( nHelpLine ); 954 } 955 Cancel(); 956 rReq.Ignore (); 957 } 958 break; 959 960 case SID_DELETE_PAGE: 961 case SID_DELETE_MASTER_PAGE: 962 DeleteActualPage(); 963 Cancel(); 964 rReq.Ignore (); 965 break; 966 967 case SID_DELETE_LAYER: 968 DeleteActualLayer(); 969 Cancel(); 970 rReq.Ignore (); 971 break; 972 973 case SID_ORIGINAL_SIZE: 974 mpDrawView->SetMarkedOriginalSize(); 975 Cancel(); 976 rReq.Done(); 977 break; 978 979 case SID_DRAW_FONTWORK: 980 case SID_DRAW_FONTWORK_VERTICAL: 981 { 982 svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think) 983 Cancel(); 984 rReq.Done(); 985 } 986 break; 987 988 case SID_SAVEGRAPHIC: 989 { 990 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 991 if( rMarkList.GetMarkCount() == 1 ) 992 { 993 SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() ); 994 if(pGrafObj ) 995 { 996 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY ); 997 SdGRFFilter::SaveGraphic( xShape ); 998 } 999 } 1000 Cancel(); 1001 rReq.Ignore(); 1002 } 1003 break; 1004 1005 default: 1006 { 1007 // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die 1008 // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8) 1009 // gewandert. 1010 FuTemp01(rReq); 1011 } 1012 break; 1013 } 1014 1015 if(HasCurrentFunction()) 1016 { 1017 GetCurrentFunction()->Activate(); 1018 } 1019 } 1020 1021 void DrawViewShell::ExecChar( SfxRequest &rReq ) 1022 { 1023 SdDrawDocument* pDoc = GetDoc(); 1024 if (!pDoc || !mpDrawView) 1025 return; 1026 1027 SfxItemSet aEditAttr( pDoc->GetPool() ); 1028 mpDrawView->GetAttributes( aEditAttr ); 1029 1030 //modified by wj for sym2_1580, if put old itemset into new set, 1031 //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item 1032 // and use old attr to update all the attributes 1033 // SfxItemSet aNewAttr( GetPool(), 1034 // EE_ITEMS_START, EE_ITEMS_END ); 1035 // aNewAttr.Put( aEditAttr, sal_False ); 1036 SfxItemSet aNewAttr( pDoc->GetPool() ); 1037 //modified end 1038 1039 sal_uInt16 nSId = rReq.GetSlot(); 1040 1041 MapSlot( nSId ); 1042 1043 switch ( nSId ) 1044 { 1045 case SID_ATTR_CHAR_FONT: 1046 if( rReq.GetArgs() ) 1047 { 1048 SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False ); 1049 if (pItem) 1050 { 1051 aNewAttr.Put(*pItem); 1052 } 1053 } 1054 break; 1055 case SID_ATTR_CHAR_FONTHEIGHT: 1056 if( rReq.GetArgs() ) 1057 { 1058 SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False ); 1059 if (pItem) 1060 { 1061 aNewAttr.Put(*pItem); 1062 } 1063 } 1064 break; 1065 case SID_ATTR_CHAR_WEIGHT: 1066 if( rReq.GetArgs() ) 1067 { 1068 //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) ); 1069 SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False ); 1070 if (pItem) 1071 { 1072 aNewAttr.Put(*pItem); 1073 } 1074 } 1075 break; 1076 case SID_ATTR_CHAR_POSTURE: 1077 if( rReq.GetArgs() ) 1078 { 1079 //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) ); 1080 SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False ); 1081 if (pItem) 1082 { 1083 aNewAttr.Put(*pItem); 1084 } 1085 } 1086 break; 1087 case SID_ATTR_CHAR_UNDERLINE: 1088 if( rReq.GetArgs() ) 1089 { 1090 //<<modify by wj for sym2_1873 1091 //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); 1092 SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); 1093 //end>> 1094 if (pItem) 1095 { 1096 aNewAttr.Put(*pItem); 1097 } 1098 else 1099 { 1100 FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); 1101 aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); 1102 }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) ); 1103 } 1104 break; 1105 case SID_ATTR_CHAR_SHADOWED: 1106 if( rReq.GetArgs() ) 1107 { 1108 SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False ); 1109 if (pItem) 1110 { 1111 aNewAttr.Put(*pItem); 1112 } 1113 } 1114 break; 1115 case SID_ATTR_CHAR_STRIKEOUT: 1116 if( rReq.GetArgs() ) 1117 { 1118 SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False ); 1119 if (pItem) 1120 { 1121 aNewAttr.Put(*pItem); 1122 } 1123 } 1124 break; 1125 case SID_ATTR_CHAR_COLOR: 1126 if( rReq.GetArgs() ) 1127 { 1128 SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False ); 1129 if (pItem) 1130 { 1131 aNewAttr.Put(*pItem); 1132 } 1133 } 1134 break; 1135 case SID_ATTR_CHAR_KERNING: 1136 if( rReq.GetArgs() ) 1137 { 1138 SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False ); 1139 if (pItem) 1140 { 1141 aNewAttr.Put(*pItem); 1142 } 1143 } 1144 break; 1145 case SID_SET_SUB_SCRIPT: 1146 if( rReq.GetArgs() ) 1147 { 1148 SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); 1149 SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 1150 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 1151 if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) 1152 aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 1153 else 1154 aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); 1155 aNewAttr.Put( aItem ); 1156 } 1157 break; 1158 case SID_SET_SUPER_SCRIPT: 1159 if( rReq.GetArgs() ) 1160 { 1161 SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); 1162 SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) 1163 aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); 1164 if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) 1165 aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); 1166 else 1167 aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); 1168 aNewAttr.Put( aItem ); 1169 } 1170 break; 1171 case SID_SHRINK_FONT_SIZE: 1172 case SID_GROW_FONT_SIZE: 1173 //if (rReq.GetArgs()) 1174 { 1175 const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); 1176 const FontList* pFontList = pFonts->GetFontList(); 1177 if( pFontList ) 1178 { 1179 FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView ); 1180 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); 1181 } 1182 } 1183 default: 1184 ; 1185 } 1186 1187 mpDrawView->SetAttributes(aNewAttr); 1188 rReq.Done(); 1189 Cancel(); 1190 } 1191 1192 1193 /** This method consists basically of three parts: 1194 1. Process the arguments of the SFX request. 1195 2. Use the model to create a new page or duplicate an existing one. 1196 3. Update the tab control and switch to the new page. 1197 */ 1198 SdPage* DrawViewShell::CreateOrDuplicatePage ( 1199 SfxRequest& rRequest, 1200 PageKind ePageKind, 1201 SdPage* pPage, 1202 const sal_Int32 nInsertPosition) 1203 { 1204 SdPage* pNewPage = NULL; 1205 if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE) 1206 { 1207 if ( mpDrawView->IsTextEdit() ) 1208 { 1209 mpDrawView->SdrEndTextEdit(); 1210 } 1211 pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition); 1212 } 1213 return pNewPage; 1214 } 1215 1216 void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq) 1217 { 1218 if(SlideShow::IsRunning( GetViewShellBase() )) 1219 return; 1220 1221 SdDrawDocument* pDoc = GetDoc(); 1222 if (!pDoc || !mpDrawView) 1223 return; 1224 1225 sal_uInt16 nSId = rReq.GetSlot(); 1226 SfxItemSet aAttrs( pDoc->GetPool() ); 1227 1228 switch ( nSId ) 1229 { 1230 case SID_TABLE_VERT_NONE: 1231 case SID_TABLE_VERT_CENTER: 1232 case SID_TABLE_VERT_BOTTOM: 1233 SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; 1234 if (nSId == SID_TABLE_VERT_CENTER) 1235 eTVA = SDRTEXTVERTADJUST_CENTER; 1236 else if (nSId == SID_TABLE_VERT_BOTTOM) 1237 eTVA = SDRTEXTVERTADJUST_BOTTOM; 1238 1239 aAttrs.Put( SdrTextVertAdjustItem(eTVA) ); 1240 mpDrawView->SetAttributes(aAttrs); 1241 1242 break; 1243 } 1244 } 1245 1246 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet) 1247 { 1248 SfxWhichIter aIter( rSet ); 1249 sal_uInt16 nWhich = aIter.FirstWhich(); 1250 1251 SdDrawDocument* pDoc = GetDoc(); 1252 if (!pDoc || !mpDrawView) 1253 return; 1254 1255 SfxItemSet aAttrs( pDoc->GetPool() ); 1256 mpDrawView->GetAttributes( aAttrs ); 1257 1258 while ( nWhich ) 1259 { 1260 sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 1261 ? GetPool().GetSlotId(nWhich) 1262 : nWhich; 1263 switch ( nSlotId ) 1264 { 1265 case SID_TABLE_VERT_NONE: 1266 case SID_TABLE_VERT_CENTER: 1267 case SID_TABLE_VERT_BOTTOM: 1268 sal_Bool bContour = sal_False; 1269 SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); 1270 if( eConState != SFX_ITEM_DONTCARE ) 1271 { 1272 bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); 1273 } 1274 if (bContour) break; 1275 1276 SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); 1277 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); 1278 1279 //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) 1280 if(SFX_ITEM_DONTCARE != eVState) 1281 { 1282 SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); 1283 sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP|| 1284 nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER || 1285 nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM; 1286 rSet.Put(SfxBoolItem(nSlotId, bSet)); 1287 } 1288 else 1289 { 1290 rSet.Put(SfxBoolItem(nSlotId, sal_False)); 1291 } 1292 break; 1293 } 1294 nWhich = aIter.NextWhich(); 1295 } 1296 } 1297 1298 } // end of namespace sd 1299