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 29 #include <sfx2/viewfrm.hxx> 30 #include <editeng/eeitem.hxx> 31 #include <editeng/tstpitem.hxx> 32 #include <editeng/lrspitem.hxx> 33 #include <editeng/protitem.hxx> 34 #include <editeng/frmdiritem.hxx> 35 #include <svx/ruler.hxx> 36 #ifndef _SVX_RULERITEM_HXX 37 #include <svx/rulritem.hxx> 38 #endif 39 #include <svx/zoomitem.hxx> 40 #ifndef _SVXIDS_HRC 41 #include <svx/svxids.hrc> 42 #endif 43 #include <svx/svdpagv.hxx> 44 #include <sfx2/request.hxx> 45 #include <sfx2/dispatch.hxx> 46 #include <tools/urlobj.hxx> 47 #include <svl/aeitem.hxx> 48 #include <svl/eitem.hxx> 49 #include <svl/rectitem.hxx> 50 #include <svl/stritem.hxx> 51 #include <svx/svdoole2.hxx> 52 #include <svl/itempool.hxx> 53 #include <svl/ptitem.hxx> 54 #include <basic/sbstar.hxx> 55 #include <basic/sberrors.hxx> 56 #include <svx/fmshell.hxx> 57 #include <svx/f3dchild.hxx> 58 #include <svx/float3d.hxx> 59 #include "optsitem.hxx" 60 61 #include "app.hrc" 62 #include "glob.hrc" 63 #include "strings.hrc" 64 #include "res_bmp.hrc" 65 66 #include "sdundogr.hxx" 67 #include "undopage.hxx" 68 #include "glob.hxx" 69 #include "app.hxx" 70 #include "fupoor.hxx" 71 #include "slideshow.hxx" 72 #ifndef SD_FRAME_VIEW 73 #include "FrameView.hxx" 74 #endif 75 #include "sdpage.hxx" 76 #include "Window.hxx" 77 #include "sdresid.hxx" 78 #include "drawview.hxx" 79 #include "drawdoc.hxx" 80 #include "DrawViewShell.hxx" 81 #include "Ruler.hxx" 82 #include "DrawDocShell.hxx" 83 #include "headerfooterdlg.hxx" 84 #include "masterlayoutdlg.hxx" 85 #include "Ruler.hxx" 86 #include "DrawDocShell.hxx" 87 #include "sdabstdlg.hxx" 88 #include <sfx2/ipclient.hxx> 89 #include <tools/diagnose_ex.h> 90 #include "ViewShellBase.hxx" 91 #include "FormShellManager.hxx" 92 #include "LayerTabBar.hxx" 93 #include "sdabstdlg.hxx" 94 #include "sdpage.hxx" 95 #include <com/sun/star/drawing/framework/XControllerManager.hpp> 96 #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 97 #include <com/sun/star/drawing/framework/XConfiguration.hpp> 98 #include <com/sun/star/frame/XFrame.hpp> 99 #include <editeng/lspcitem.hxx> 100 #include <editeng/ulspitem.hxx> 101 using namespace ::com::sun::star::uno; 102 using namespace ::com::sun::star::drawing::framework; 103 using ::com::sun::star::frame::XFrame; 104 using ::com::sun::star::frame::XController; 105 106 namespace sd { 107 108 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED 109 #define SO2_DECL_SVINPLACEOBJECT_DEFINED 110 SO2_DECL_REF(SvInPlaceObject) 111 #endif 112 113 114 115 /************************************************************************* 116 |* 117 |* SfxRequests fuer Controller bearbeiten 118 |* 119 \************************************************************************/ 120 121 void DrawViewShell::ExecCtrl(SfxRequest& rReq) 122 { 123 // waehrend einer Diashow wird nichts ausser dem Seitenwechsel und dem 124 // Sprung zur Bookmark ausgefuehrt! 125 if( HasCurrentFunction(SID_PRESENTATION) && 126 rReq.GetSlot() != SID_SWITCHPAGE && 127 rReq.GetSlot() != SID_JUMPTOMARK) 128 return; 129 130 CheckLineTo (rReq); 131 132 // End text edit mode for some requests. 133 sal_uInt16 nSlot = rReq.GetSlot(); 134 switch (nSlot) 135 { 136 case SID_OUTPUT_QUALITY_COLOR: 137 case SID_OUTPUT_QUALITY_GRAYSCALE: 138 case SID_OUTPUT_QUALITY_BLACKWHITE: 139 case SID_OUTPUT_QUALITY_CONTRAST: 140 // Do nothing. 141 break; 142 default: 143 if ( mpDrawView->IsTextEdit() ) 144 { 145 mpDrawView->SdrEndTextEdit(); 146 } 147 } 148 149 // sal_uInt16 nSlot = rReq.GetSlot(); 150 switch (nSlot) 151 { 152 case SID_SWITCHPAGE: // BASIC 153 { 154 sal_Bool bWasBasic = sal_False; 155 156 // switch page in running slide show 157 if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs()) 158 { 159 SFX_REQUEST_ARG(rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False); 160 SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1)); 161 } 162 else 163 { 164 const SfxItemSet *pArgs = rReq.GetArgs (); 165 sal_uInt16 nSelectedPage = 0; 166 167 if (! pArgs) 168 { 169 nSelectedPage = maTabControl.GetCurPageId() - 1; 170 } 171 else if (pArgs->Count () == 2) 172 { 173 SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False); 174 SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False); 175 176 sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue (); 177 sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue (); 178 if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT)) 179 { 180 StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); 181 rReq.Ignore (); 182 break; 183 } 184 else if (meEditMode != EM_MASTERPAGE) 185 { 186 if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind))) 187 { 188 StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); 189 rReq.Ignore (); 190 break; 191 } 192 193 nSelectedPage = (short) nWhatPage; 194 mePageKind = (PageKind) nWhatKind; 195 bWasBasic = sal_True; 196 } 197 } 198 else 199 { 200 StarBASIC::FatalError (SbERR_WRONG_ARGS); 201 rReq.Ignore (); 202 break; 203 } 204 205 206 if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)) 207 GetDocSh()->SetModified(); 208 209 SwitchPage(nSelectedPage); 210 211 if(HasCurrentFunction(SID_BEZIER_EDIT)) 212 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); 213 214 Invalidate(); 215 InvalidateWindows(); 216 rReq.Done (); 217 } 218 break; 219 } 220 221 case SID_SWITCHLAYER: // BASIC 222 { 223 const SfxItemSet *pArgs = rReq.GetArgs (); 224 sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId (); 225 226 if( pArgs && pArgs->Count () == 1) 227 { 228 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False); 229 if( pWhatLayer ) 230 nCurPage = (short) pWhatLayer->GetValue (); 231 } 232 233 mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) ); 234 Invalidate(); 235 rReq.Done (); 236 237 break; 238 } 239 240 case SID_PAGEMODE: // BASIC 241 { 242 243 const SfxItemSet *pArgs = rReq.GetArgs (); 244 245 if ( pArgs && pArgs->Count () == 2) 246 { 247 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, ID_VAL_ISACTIVE, sal_False); 248 SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False); 249 250 sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue (); 251 if (CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT)) 252 { 253 mbIsLayerModeActive = pIsActive->GetValue (); 254 mePageKind = (PageKind) nWhatKind; 255 } 256 } 257 258 // Default-Layer der Page einschalten 259 mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) ); 260 261 ChangeEditMode(EM_PAGE, mbIsLayerModeActive); 262 263 Invalidate(); 264 rReq.Done (); 265 266 break; 267 } 268 269 case SID_LAYERMODE: // BASIC 270 { 271 const SfxItemSet *pArgs = rReq.GetArgs (); 272 273 if ( pArgs && pArgs->Count () == 2) 274 { 275 SFX_REQUEST_ARG (rReq, pWhatLayerMode, SfxBoolItem, ID_VAL_ISACTIVE, sal_False); 276 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False); 277 278 sal_Int32 nWhatLayer = (sal_Int32)pWhatLayer->GetValue (); 279 if (CHECK_RANGE (EM_PAGE, nWhatLayer, EM_MASTERPAGE)) 280 { 281 mbIsLayerModeActive = pWhatLayerMode->GetValue (); 282 meEditMode = (EditMode) nWhatLayer; 283 } 284 } 285 286 ChangeEditMode(meEditMode, !mbIsLayerModeActive); 287 288 Invalidate(); 289 rReq.Done (); 290 291 break; 292 } 293 294 case SID_HEADER_AND_FOOTER: 295 case SID_INSERT_PAGE_NUMBER: 296 case SID_INSERT_DATE_TIME: 297 { 298 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 299 AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0; 300 if( pDlg ) 301 { 302 pDlg->Execute(); 303 delete pDlg; 304 305 GetActiveWindow()->Invalidate(); 306 UpdatePreview( mpActualPage ); 307 } 308 309 Invalidate(); 310 rReq.Done (); 311 312 break; 313 } 314 315 case SID_MASTER_LAYOUTS: 316 { 317 SdPage* pPage = GetActualPage(); 318 if (meEditMode == EM_MASTERPAGE) 319 // Use the master page of the current page. 320 pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage()); 321 322 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 323 VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0; 324 if( pDlg ) 325 { 326 pDlg->Execute(); 327 delete pDlg; 328 Invalidate(); 329 } 330 rReq.Done (); 331 break; 332 } 333 case SID_OBJECTRESIZE: 334 { 335 /****************************************************************** 336 * Der Server moechte die Clientgrosse verandern 337 ******************************************************************/ 338 OSL_ASSERT (GetViewShell()!=NULL); 339 SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); 340 341 if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) 342 { 343 const SfxRectangleItem& rRect = 344 (SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE); 345 Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) ); 346 347 if ( mpDrawView->AreObjectsMarked() ) 348 { 349 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 350 351 if (rMarkList.GetMarkCount() == 1) 352 { 353 SdrMark* pMark = rMarkList.GetMark(0); 354 SdrObject* pObj = pMark->GetMarkedSdrObj(); 355 356 SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj ); 357 if(pOle2Obj) 358 { 359 if( pOle2Obj->GetObjRef().is() ) 360 { 361 pOle2Obj->SetLogicRect(aRect); 362 } 363 } 364 } 365 } 366 } 367 rReq.Ignore (); 368 break; 369 } 370 371 case SID_RELOAD: 372 { 373 // #83951# 374 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId(); 375 SfxViewFrame* pFrame = GetViewFrame(); 376 377 try 378 { 379 Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW ); 380 381 // Save the current configuration of panes and views. 382 Reference<XControllerManager> xControllerManager ( 383 GetViewShellBase().GetController(), UNO_QUERY_THROW); 384 Reference<XConfigurationController> xConfigurationController ( 385 xControllerManager->getConfigurationController(), UNO_QUERY_THROW ); 386 Reference<XConfiguration> xConfiguration ( 387 xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW ); 388 389 SfxChildWindow* pWindow = pFrame->GetChildWindow(nId); 390 if(pWindow) 391 { 392 Svx3DWin* p3DWin = (Svx3DWin*)(pWindow->GetWindow()); 393 if(p3DWin) 394 p3DWin->DocumentReload(); 395 } 396 397 // Normale Weiterleitung an ViewFrame zur Ausfuehrung 398 GetViewFrame()->ExecuteSlot(rReq); 399 400 // From here on we must cope with this object and the frame already being 401 // deleted. Do not call any methods or use data members. 402 Reference<XController> xController( xFrame->getController(), UNO_SET_THROW ); 403 404 // Restore the configuration. 405 xControllerManager = Reference<XControllerManager>( xController, UNO_QUERY_THROW); 406 xConfigurationController = Reference<XConfigurationController>( 407 xControllerManager->getConfigurationController()); 408 if ( ! xConfigurationController.is()) 409 throw RuntimeException(); 410 xConfigurationController->restoreConfiguration(xConfiguration); 411 } 412 catch (RuntimeException&) 413 { 414 DBG_UNHANDLED_EXCEPTION(); 415 } 416 417 // We have to return immediately to avoid accessing this object. 418 return; 419 } 420 421 case SID_JUMPTOMARK: 422 { 423 if( rReq.GetArgs() ) 424 { 425 SFX_REQUEST_ARG(rReq, pBookmark, SfxStringItem, SID_JUMPTOMARK, sal_False); 426 427 if (pBookmark) 428 { 429 UniString sBookmark( INetURLObject::decode( pBookmark->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET ) ); 430 431 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 432 if(xSlideshow.is() && xSlideshow->isRunning()) 433 { 434 xSlideshow->jumpToBookmark(sBookmark); 435 } 436 else 437 { 438 GotoBookmark( sBookmark ); 439 } 440 } 441 } 442 rReq.Done(); 443 break; 444 } 445 446 case SID_OUTPUT_QUALITY_COLOR: 447 case SID_OUTPUT_QUALITY_GRAYSCALE: 448 case SID_OUTPUT_QUALITY_BLACKWHITE: 449 case SID_OUTPUT_QUALITY_CONTRAST: 450 { 451 ExecReq( rReq ); 452 break; 453 } 454 455 case SID_MAIL_SCROLLBODY_PAGEDOWN: 456 { 457 ExecReq( rReq ); 458 break; 459 } 460 461 case SID_ATTR_YEAR2000: 462 { 463 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 464 if (pFormShell != NULL) 465 { 466 const SfxPoolItem* pItem; 467 if (rReq.GetArgs()->GetItemState( 468 SID_ATTR_YEAR2000, sal_True, &pItem) == SFX_ITEM_SET) 469 pFormShell->SetY2KState ( 470 static_cast<const SfxUInt16Item*>(pItem)->GetValue()); 471 } 472 473 rReq.Done(); 474 } 475 break; 476 477 case SID_OPT_LOCALE_CHANGED: 478 { 479 GetActiveWindow()->Invalidate(); 480 UpdatePreview( mpActualPage ); 481 rReq.Done(); 482 } 483 484 default: 485 break; 486 } 487 } 488 489 /************************************************************************* 490 |* 491 |* SfxRequests fuer Lineale bearbeiten 492 |* 493 \************************************************************************/ 494 495 void DrawViewShell::ExecRuler(SfxRequest& rReq) 496 { 497 // waehrend einer Diashow wird nichts ausgefuehrt! 498 if(HasCurrentFunction(SID_PRESENTATION)) 499 return; 500 501 CheckLineTo (rReq); 502 503 const SfxItemSet* pArgs = rReq.GetArgs(); 504 const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); 505 Size aPageSize = mpActualPage->GetSize(); 506 Size aViewSize = GetActiveWindow()->GetViewSize(); 507 SdUndoGroup* pUndoGroup = NULL; 508 509 if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE || 510 rReq.GetSlot() == SID_ATTR_LONG_ULSPACE ) 511 { 512 pUndoGroup = new SdUndoGroup(GetDoc()); 513 String aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); 514 pUndoGroup->SetComment(aString); 515 } 516 517 switch ( rReq.GetSlot() ) 518 { 519 case SID_ATTR_LONG_LRSPACE: 520 { 521 const SvxLongLRSpaceItem& rLRSpace = (const SvxLongLRSpaceItem&) 522 pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE)); 523 524 if( mpDrawView->IsTextEdit() ) 525 { 526 Rectangle aRect = maMarkRect; 527 aRect.SetPos(aRect.TopLeft() + aPagePos); 528 aRect.Left() = rLRSpace.GetLeft(); 529 aRect.Right() = aViewSize.Width() - rLRSpace.GetRight(); 530 aRect.SetPos(aRect.TopLeft() - aPagePos); 531 if ( aRect != maMarkRect) 532 { 533 mpDrawView->SetAllMarkedRect(aRect); 534 maMarkRect = mpDrawView->GetAllMarkedRect(); 535 Invalidate( SID_RULER_OBJECT ); 536 } 537 } 538 else 539 { 540 long nLeft = Max(0L, rLRSpace.GetLeft() - aPagePos.X()); 541 long nRight = Max(0L, rLRSpace.GetRight() + aPagePos.X() + 542 aPageSize.Width() - aViewSize.Width()); 543 544 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); 545 sal_uInt16 i; 546 for ( i = 0; i < nPageCnt; i++) 547 { 548 SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 549 SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(), 550 pPage, 551 pPage->GetLftBorder(), 552 pPage->GetRgtBorder(), 553 nLeft, nRight); 554 pUndoGroup->AddAction(pUndo); 555 pPage->SetLftBorder(nLeft); 556 pPage->SetRgtBorder(nRight); 557 } 558 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 559 560 for (i = 0; i < nPageCnt; i++) 561 { 562 SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); 563 SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(), 564 pPage, 565 pPage->GetLftBorder(), 566 pPage->GetRgtBorder(), 567 nLeft, nRight); 568 pUndoGroup->AddAction(pUndo); 569 pPage->SetLftBorder(nLeft); 570 pPage->SetRgtBorder(nRight); 571 } 572 InvalidateWindows(); 573 } 574 break; 575 } 576 case SID_ATTR_LONG_ULSPACE: 577 { 578 const SvxLongULSpaceItem& rULSpace = (const SvxLongULSpaceItem&) 579 pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE)); 580 581 if( mpDrawView->IsTextEdit() ) 582 { 583 Rectangle aRect = maMarkRect; 584 aRect.SetPos(aRect.TopLeft() + aPagePos); 585 aRect.Top() = rULSpace.GetUpper(); 586 aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower(); 587 aRect.SetPos(aRect.TopLeft() - aPagePos); 588 589 if ( aRect != maMarkRect) 590 { 591 mpDrawView->SetAllMarkedRect(aRect); 592 maMarkRect = mpDrawView->GetAllMarkedRect(); 593 Invalidate( SID_RULER_OBJECT ); 594 } 595 } 596 else 597 { 598 long nUpper = Max(0L, rULSpace.GetUpper() - aPagePos.Y()); 599 long nLower = Max(0L, rULSpace.GetLower() + aPagePos.Y() + 600 aPageSize.Height() - aViewSize.Height()); 601 602 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); 603 sal_uInt16 i; 604 for ( i = 0; i < nPageCnt; i++) 605 { 606 SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 607 SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(), 608 pPage, 609 pPage->GetUppBorder(), 610 pPage->GetLwrBorder(), 611 nUpper, nLower); 612 pUndoGroup->AddAction(pUndo); 613 pPage->SetUppBorder(nUpper); 614 pPage->SetLwrBorder(nLower); 615 } 616 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 617 618 for (i = 0; i < nPageCnt; i++) 619 { 620 SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind); 621 SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(), 622 pPage, 623 pPage->GetUppBorder(), 624 pPage->GetLwrBorder(), 625 nUpper, nLower); 626 pUndoGroup->AddAction(pUndo); 627 pPage->SetUppBorder(nUpper); 628 pPage->SetLwrBorder(nLower); 629 } 630 InvalidateWindows(); 631 } 632 break; 633 } 634 635 case SID_RULER_OBJECT: 636 { 637 Rectangle aRect = maMarkRect; 638 aRect.SetPos(aRect.TopLeft() + aPagePos); 639 640 const SvxObjectItem& rOI = (const SvxObjectItem&) 641 pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT)); 642 643 if ( rOI.GetStartX() != rOI.GetEndX() ) 644 { 645 aRect.Left() = rOI.GetStartX(); 646 aRect.Right() = rOI.GetEndX(); 647 } 648 if ( rOI.GetStartY() != rOI.GetEndY() ) 649 { 650 aRect.Top() = rOI.GetStartY(); 651 aRect.Bottom() = rOI.GetEndY(); 652 } 653 aRect.SetPos(aRect.TopLeft() - aPagePos); 654 if ( aRect != maMarkRect) 655 { 656 mpDrawView->SetAllMarkedRect(aRect); 657 maMarkRect = mpDrawView->GetAllMarkedRect(); 658 Invalidate( SID_RULER_OBJECT ); 659 } 660 break; 661 } 662 663 case SID_ATTR_TABSTOP: 664 { 665 if( mpDrawView->IsTextEdit() ) 666 { 667 const SvxTabStopItem& rItem = (const SvxTabStopItem&) 668 pArgs->Get( EE_PARA_TABS ); 669 670 SfxItemSet aEditAttr( GetPool(), EE_PARA_TABS, EE_PARA_TABS ); 671 672 aEditAttr.Put( rItem ); 673 mpDrawView->SetAttributes( aEditAttr ); 674 675 // #91081# Invalidate is missing here 676 Invalidate(SID_ATTR_TABSTOP); 677 } 678 break; 679 } 680 681 case SID_ATTR_PARA_LINESPACE: 682 { 683 sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE; 684 SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get( 685 GetPool().GetWhich(nSlot)); 686 687 SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); 688 aParaLineSP.SetWhich( EE_PARA_SBL ); 689 690 aEditAttr.Put( aParaLineSP ); 691 mpDrawView->SetAttributes( aEditAttr ); 692 693 Invalidate(SID_ATTR_PARA_LINESPACE); 694 } 695 break; 696 //xuxu for UL 697 case SID_ATTR_PARA_ULSPACE: 698 { 699 sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE; 700 SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get( 701 GetPool().GetWhich(nSlot)); 702 SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); 703 aULSP.SetWhich( EE_PARA_ULSPACE ); 704 705 aEditAttr.Put( aULSP ); 706 mpDrawView->SetAttributes( aEditAttr ); 707 708 Invalidate(SID_ATTR_PARA_ULSPACE); 709 } 710 break; 711 712 case SID_ATTR_PARA_LRSPACE: 713 { 714 if( mpDrawView->IsTextEdit() ) 715 { 716 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; 717 const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&) 718 pArgs->Get( nId ); 719 720 SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); 721 722 nId = EE_PARA_LRSPACE; 723 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), 724 rItem.GetRight(), rItem.GetTxtLeft(), 725 rItem.GetTxtFirstLineOfst(), nId ); 726 aEditAttr.Put( aLRSpaceItem ); 727 mpDrawView->SetAttributes( aEditAttr ); 728 729 // #92557# Invalidate is missing here 730 Invalidate(SID_ATTR_PARA_LRSPACE); 731 } 732 break; 733 } 734 case SID_ATTR_LRSPACE: 735 { 736 if( mpDrawView->IsTextEdit() ) 737 { 738 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; 739 const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&) 740 pArgs->Get( nId ); 741 742 SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); 743 744 nId = EE_PARA_LRSPACE; 745 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), 746 rItem.GetRight(), rItem.GetTxtLeft(), 747 rItem.GetTxtFirstLineOfst(), nId ); 748 aEditAttr.Put( aLRSpaceItem ); 749 mpDrawView->SetAttributes( aEditAttr ); 750 751 // #92557# Invalidate is missing here 752 Invalidate(SID_ATTR_PARA_LRSPACE); 753 } 754 break; 755 } 756 } 757 if ( pUndoGroup ) 758 // Undo Gruppe dem Undo Manager uebergeben 759 GetViewFrame()->GetObjectShell()->GetUndoManager()-> 760 AddUndoAction(pUndoGroup); 761 } 762 763 /************************************************************************* 764 |* 765 |* Statuswerte der Lineale bestimmen 766 |* 767 \************************************************************************/ 768 void DrawViewShell::GetRulerState(SfxItemSet& rSet) 769 { 770 Point aOrigin; 771 772 if (mpDrawView->GetSdrPageView()) 773 { 774 aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin(); 775 } 776 777 Size aViewSize = GetActiveWindow()->GetViewSize(); 778 779 const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); 780 Size aPageSize = mpActualPage->GetSize(); 781 782 Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()), 783 aViewSize.Height() - (aPagePos.Y() + aPageSize.Height()))); 784 785 if( mpDrawView->IsTextEdit() ) 786 { 787 Point aPnt1 = GetActiveWindow()->GetWinViewPos(); 788 Point aPnt2 = GetActiveWindow()->GetViewOrigin(); 789 Rectangle aMinMaxRect = Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) ); 790 rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) ); 791 } 792 else 793 { 794 rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) ); 795 } 796 797 SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLftBorder(), 798 aRect.Right() + mpActualPage->GetRgtBorder(), 799 GetPool().GetWhich(SID_ATTR_LONG_LRSPACE)); 800 SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUppBorder(), 801 aRect.Bottom() + mpActualPage->GetLwrBorder(), 802 GetPool().GetWhich(SID_ATTR_LONG_ULSPACE)); 803 rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(), 804 aViewSize.Height())); 805 SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin ); 806 807 SvxProtectItem aProtect( SID_RULER_PROTECT ); 808 809 maMarkRect = mpDrawView->GetAllMarkedRect(); 810 811 const sal_Bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB; 812 rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL)); 813 814 if( mpDrawView->AreObjectsMarked() ) 815 { 816 if( mpDrawView->IsTextEdit() ) 817 { 818 SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj(); 819 if( pObj->GetObjInventor() == SdrInventor) 820 { 821 SfxItemSet aEditAttr( GetDoc()->GetPool() ); 822 mpDrawView->GetAttributes( aEditAttr ); 823 if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SFX_ITEM_AVAILABLE ) 824 { 825 const SvxTabStopItem& rItem = (const SvxTabStopItem&) aEditAttr.Get( EE_PARA_TABS ); 826 rSet.Put( rItem ); 827 828 //Rectangle aRect = maMarkRect; 829 830 const SvxLRSpaceItem& rLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ); 831 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; 832 SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(), 833 rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(), 834 rLRSpaceItem.GetTxtFirstLineOfst(), nId ); 835 rSet.Put( aLRSpaceItem ); 836 837 Point aPos( aPagePos + maMarkRect.TopLeft() ); 838 839 if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON ) 840 { 841 const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&) 842 aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); 843 long nLD = rTLDItem.GetValue(); 844 aPos.X() += nLD; 845 } 846 847 aPointItem.SetValue( aPos ); 848 849 aLRSpace.SetLeft( aPagePos.X() + maMarkRect.Left() ); 850 851 if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON ) 852 { 853 const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&) 854 aEditAttr.Get( SDRATTR_TEXT_LEFTDIST ); 855 long nLD = rTLDItem.GetValue(); 856 aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD ); 857 } 858 859 aLRSpace.SetRight( aRect.Right() + aPageSize.Width() - maMarkRect.Right() ); 860 aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() ); 861 aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() ); 862 863 rSet.DisableItem( SID_RULER_OBJECT ); 864 865 // Seitenraender werden gelocked 866 aProtect.SetSizeProtect( sal_True ); 867 aProtect.SetPosProtect( sal_True ); 868 } 869 870 if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SFX_ITEM_AVAILABLE ) 871 { 872 const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ); 873 rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == ::com::sun::star::text::WritingMode_RL_TB)); 874 } 875 } 876 } 877 else 878 { 879 rSet.DisableItem( EE_PARA_TABS ); 880 rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT ); 881 882 if( mpDrawView->IsResizeAllowed(sal_True) ) 883 { 884 Rectangle aResizeRect( maMarkRect ); 885 886 aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos); 887 SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(), 888 aResizeRect.Top(), aResizeRect.Bottom()); 889 rSet.Put(aObjItem); 890 rSet.DisableItem( EE_PARA_TABS ); 891 } 892 else 893 { 894 rSet.DisableItem( SID_RULER_OBJECT ); 895 } 896 } 897 } 898 else 899 { 900 rSet.DisableItem( SID_RULER_OBJECT ); 901 rSet.DisableItem( EE_PARA_TABS ); 902 // rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT ); 903 } 904 905 rSet.Put( aLRSpace ); 906 rSet.Put( aULSpace ); 907 908 rSet.Put( aPointItem ); 909 rSet.Put( aProtect ); 910 } 911 912 /************************************************************************* 913 |* 914 |* SfxRequests fuer StatusBar bearbeiten 915 |* 916 \************************************************************************/ 917 918 void DrawViewShell::ExecStatusBar(SfxRequest& rReq) 919 { 920 // waehrend einer Diashow wird nichts ausgefuehrt! 921 if(HasCurrentFunction(SID_PRESENTATION)) 922 return; 923 924 CheckLineTo (rReq); 925 926 switch ( rReq.GetSlot() ) 927 { 928 case SID_ATTR_SIZE: 929 { 930 GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON ); 931 } 932 break; 933 934 case SID_STATUS_LAYOUT: 935 { 936 GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SFX_CALLMODE_ASYNCHRON ); 937 } 938 break; 939 } 940 } 941 942 /************************************************************************* 943 |* 944 |* Status der Snap-Objekt-Eintraege im Popup setzen 945 |* 946 \************************************************************************/ 947 948 void DrawViewShell::GetSnapItemState( SfxItemSet &rSet ) 949 { 950 SdrPageView* pPV; 951 Point aMPos = GetActiveWindow()->PixelToLogic(maMousePos); 952 sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( 953 Size(FuPoor::HITPIX,0)).Width(); 954 sal_uInt16 nHelpLine; 955 956 if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) 957 { 958 const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine]; 959 960 if ( rHelpLine.GetKind() == SDRHELPLINE_POINT ) 961 { 962 rSet.Put( SfxStringItem( SID_SET_SNAPITEM, 963 String( SdResId( STR_POPUP_EDIT_SNAPPOINT))) ); 964 rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, 965 String( SdResId( STR_POPUP_DELETE_SNAPPOINT))) ); 966 } 967 else 968 { 969 rSet.Put( SfxStringItem( SID_SET_SNAPITEM, 970 String( SdResId( STR_POPUP_EDIT_SNAPLINE))) ); 971 rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM, 972 String( SdResId( STR_POPUP_DELETE_SNAPLINE))) ); 973 } 974 } 975 } 976 977 978 /************************************************************************* 979 |* 980 |* 981 |* 982 \************************************************************************/ 983 984 void DrawViewShell::AddWindow (::sd::Window* pWin) 985 { 986 mpDrawView->AddWindowToPaintView(pWin); 987 } 988 989 /************************************************************************* 990 |* 991 |* 992 |* 993 \************************************************************************/ 994 995 void DrawViewShell::RemoveWindow(::sd::Window* pWin) 996 { 997 mpDrawView->DeleteWindowFromPaintView(pWin); 998 } 999 1000 } // end of namespace sd 1001