1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 31 #include "DrawViewShell.hxx" 32 #include "PresentationViewShell.hxx" 33 #include <editeng/outliner.hxx> 34 #ifndef _SVXIDS_HXX 35 #include <svx/svxids.hrc> 36 #endif 37 #include <sfx2/request.hxx> 38 #include <sfx2/dispatch.hxx> 39 #include <svx/svdpagv.hxx> 40 #include <vcl/scrbar.hxx> 41 #include <tools/poly.hxx> 42 #include <svx/fmshell.hxx> 43 #include <editeng/eeitem.hxx> 44 #include <svtools/colorcfg.hxx> 45 #include "AccessibleDrawDocumentView.hxx" 46 47 #include <sfx2/viewfrm.hxx> 48 #include "LayerTabBar.hxx" 49 50 #include "strings.hrc" 51 #include "res_bmp.hrc" 52 #include "glob.hrc" 53 #include "app.hrc" 54 #include "helpids.h" 55 #include "optsitem.hxx" 56 #include "app.hxx" 57 #include "FrameView.hxx" 58 #include "sdattr.hxx" 59 #include "futext.hxx" 60 #include "sdpage.hxx" 61 #include "stlpool.hxx" 62 #include "prntopts.hxx" 63 #include "sdresid.hxx" 64 #include "Window.hxx" 65 #include "drawview.hxx" 66 #include "drawdoc.hxx" 67 #include "DrawDocShell.hxx" 68 #include "Outliner.hxx" 69 #include "Client.hxx" 70 #include "slideshow.hxx" 71 #include "unokywds.hxx" 72 #include "SdUnoDrawView.hxx" 73 #include "ViewShellBase.hxx" 74 #include "FormShellManager.hxx" 75 #include "LayerDialogContent.hxx" 76 #include "DrawController.hxx" 77 78 namespace sd { 79 80 static const int TABCONTROL_INITIAL_SIZE = 350; 81 static const int PAPER_SHADOW_EXT_PIXEL = 2; 82 83 84 /************************************************************************* 85 |* 86 |* Wird gerufen, wenn sich das Model aendert 87 |* 88 \************************************************************************/ 89 90 void DrawViewShell::ModelHasChanged() 91 { 92 Invalidate(); 93 // Damit der Navigator auch einen aktuellen Status bekommt 94 GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False ); 95 96 //Update3DWindow(); 97 SfxBoolItem aItem( SID_3D_STATE, sal_True ); 98 GetViewFrame()->GetDispatcher()->Execute( 99 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 100 101 // jetzt den von der Drawing Engine neu erzeugten TextEditOutliner 102 // initialisieren 103 ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner(); 104 if (pOutliner) 105 { 106 SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool(); 107 pOutliner->SetStyleSheetPool(pSPool); 108 } 109 } 110 111 112 113 114 void DrawViewShell::Resize (void) 115 { 116 ViewShell::Resize(); 117 118 if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 119 { 120 SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) ); 121 } 122 123 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 124 if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() ) 125 { 126 xSlideshow->resize(maViewSize); 127 } 128 } 129 130 131 132 133 void DrawViewShell::ArrangeGUIElements (void) 134 { 135 // Retrieve the current size (thickness) of the scroll bars. That is 136 // the width of the vertical and the height of the horizontal scroll 137 // bar. 138 int nScrollBarSize = 139 GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize(); 140 maScrBarWH = Size (nScrollBarSize, nScrollBarSize); 141 142 Point aHPos = maViewPos; 143 aHPos.Y() += maViewSize.Height(); 144 145 146 ViewShell::ArrangeGUIElements (); 147 148 maTabControl.Hide(); 149 150 OSL_ASSERT (GetViewShell()!=NULL); 151 Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient()); 152 sal_Bool bClientActive = sal_False; 153 if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) 154 bClientActive = sal_True; 155 156 sal_Bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace(); 157 158 if ( mbZoomOnPage && !bInPlaceActive && !bClientActive ) 159 { 160 // bei Split immer erstes Fenster resizen 161 //af pWindow = mpContentWindow.get(); 162 SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool()); 163 ExecuteSlot( aReq ); 164 } 165 } 166 167 /************************************************************************* 168 |* 169 |* Daten der FrameView auf die aktuelle View uebertragen 170 |* 171 \************************************************************************/ 172 173 void DrawViewShell::ReadFrameViewData(FrameView* pView) 174 { 175 ModifyGuard aGuard( GetDoc() ); 176 177 // Diese Option wird am Model eingestellt 178 GetDoc()->SetPickThroughTransparentTextFrames( 179 SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough()); 180 181 // Initialisierungen der Zeichen-(Bildschirm-)Attribute 182 if (HasRuler() != pView->HasRuler()) 183 SetRuler( pView->HasRuler() ); 184 185 if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse()) 186 mpDrawView->SetGridCoarse( pView->GetGridCoarse() ); 187 188 if (mpDrawView->GetGridFine() != pView->GetGridFine()) 189 mpDrawView->SetGridFine( pView->GetGridFine() ); 190 191 if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY()) 192 mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY()); 193 194 if (mpDrawView->IsGridVisible() != pView->IsGridVisible()) 195 mpDrawView->SetGridVisible( pView->IsGridVisible() ); 196 197 if (mpDrawView->IsGridFront() != pView->IsGridFront()) 198 mpDrawView->SetGridFront( pView->IsGridFront() ); 199 200 if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle()) 201 mpDrawView->SetSnapAngle( pView->GetSnapAngle() ); 202 203 if (mpDrawView->IsGridSnap() != pView->IsGridSnap() ) 204 mpDrawView->SetGridSnap( pView->IsGridSnap() ); 205 206 if (mpDrawView->IsBordSnap() != pView->IsBordSnap() ) 207 mpDrawView->SetBordSnap( pView->IsBordSnap() ); 208 209 if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() ) 210 mpDrawView->SetHlplSnap( pView->IsHlplSnap() ); 211 212 if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() ) 213 mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() ); 214 215 if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() ) 216 mpDrawView->SetOPntSnap( pView->IsOPntSnap() ); 217 218 if (mpDrawView->IsOConSnap() != pView->IsOConSnap() ) 219 mpDrawView->SetOConSnap( pView->IsOConSnap() ); 220 221 if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() ) 222 mpDrawView->SetHlplVisible( pView->IsHlplVisible() ); 223 224 if (mpDrawView->IsDragStripes() != pView->IsDragStripes() ) 225 mpDrawView->SetDragStripes( pView->IsDragStripes() ); 226 227 if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() ) 228 mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() ); 229 230 if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() ) 231 mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() ); 232 233 if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() ) 234 mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() ); 235 236 if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() ) 237 mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() ); 238 239 // mpDrawView->SetSlantButShear( pView->IsSlantButShear() ); 240 241 if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() ) 242 mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() ); 243 244 if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() ) 245 mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() ); 246 247 if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() ) 248 mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() ); 249 250 if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() ) 251 mpDrawView->SetBigOrtho( pView->IsBigOrtho() ); 252 253 if (mpDrawView->IsOrtho() != pView->IsOrtho() ) 254 mpDrawView->SetOrtho( pView->IsOrtho() ); 255 256 if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() ) 257 mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() ); 258 259 if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() ) 260 mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() ); 261 262 if (mpDrawView->IsSolidMarkHdl() != pView->IsSolidMarkHdl() ) 263 mpDrawView->SetSolidMarkHdl( pView->IsSolidMarkHdl() ); 264 265 if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() ) 266 mpDrawView->SetSolidDragging( pView->IsSolidDragging() ); 267 268 if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit()) 269 mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() ); 270 271 // #i26631# 272 if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching()) 273 mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() ); 274 275 // Definition: 276 // grosse Handles: 9 277 // kleine Handles: 7 278 sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel(); 279 //DBG_ASSERT(nTmp != 7, "HandleSize != 7 oder 9"); 280 if( nTmp == 9 && !pView->IsBigHandles() ) 281 mpDrawView->SetMarkHdlSizePixel( 7 ); 282 else if( nTmp == 7 && pView->IsBigHandles() ) 283 mpDrawView->SetMarkHdlSizePixel( 9 ); 284 285 286 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 287 if (pPageView) 288 { 289 if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() ) 290 pPageView->SetVisibleLayers( pView->GetVisibleLayers() ); 291 292 if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() ) 293 pPageView->SetPrintableLayers( pView->GetPrintableLayers() ); 294 295 if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() ) 296 pPageView->SetLockedLayers( pView->GetLockedLayers() ); 297 298 if (mePageKind == PK_NOTES) 299 { 300 if (pPageView->GetHelpLines() != pView->GetNotesHelpLines()) 301 pPageView->SetHelpLines( pView->GetNotesHelpLines() ); 302 } 303 else if (mePageKind == PK_HANDOUT) 304 { 305 if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines()) 306 pPageView->SetHelpLines( pView->GetHandoutHelpLines() ); 307 } 308 else 309 { 310 if (pPageView->GetHelpLines() != pView->GetStandardHelpLines()) 311 pPageView->SetHelpLines( pView->GetStandardHelpLines() ); 312 } 313 } 314 315 if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() ) 316 mpDrawView->SetActiveLayer( pView->GetActiveLayer() ); 317 318 sal_uInt16 nSelectedPage = 0; 319 320 if (mePageKind != PK_HANDOUT) 321 { 322 nSelectedPage = pView->GetSelectedPage(); 323 } 324 325 EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind); 326 sal_Bool bNewLayerMode = pView->IsLayerMode(); 327 ChangeEditMode(eNewEditMode, bNewLayerMode); 328 SwitchPage(nSelectedPage); 329 330 // DrawMode fuer 'Normales' Fenster wiederherstellen 331 if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode()) 332 GetActiveWindow()->SetDrawMode(pView->GetDrawMode()); 333 334 if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() ) 335 { 336 SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() ); 337 GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L ); 338 } 339 340 // Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird 341 if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() ) 342 mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() ); 343 } 344 345 /************************************************************************* 346 |* 347 |* Daten der aktuellen View auf die FrameView uebertragen 348 |* 349 \************************************************************************/ 350 351 void DrawViewShell::WriteFrameViewData() 352 { 353 // Zeichen-(Bildschirm-)Attribute an FrameView merken 354 mpFrameView->SetRuler( HasRuler() ); 355 mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() ); 356 mpFrameView->SetGridFine( mpDrawView->GetGridFine() ); 357 mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY()); 358 mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() ); 359 mpFrameView->SetGridFront( mpDrawView->IsGridFront() ); 360 mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() ); 361 mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() ); 362 mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() ); 363 mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() ); 364 mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() ); 365 mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() ); 366 mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() ); 367 mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() ); 368 mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() ); 369 mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() ); 370 mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() ); 371 mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() ); 372 mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() ); 373 mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() ); 374 mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() ); 375 mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() ); 376 mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() ); 377 mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() ); 378 379 mpFrameView->SetSolidMarkHdl( mpDrawView->IsSolidMarkHdl() ); 380 mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() ); 381 mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() ); 382 383 mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() ); 384 385 Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); 386 Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) ); 387 mpFrameView->SetVisArea(aVisArea); 388 389 if( mePageKind == PK_HANDOUT ) 390 mpFrameView->SetSelectedPage(0); 391 else 392 { 393 mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 ); 394 } 395 396 mpFrameView->SetViewShEditMode(meEditMode, mePageKind); 397 mpFrameView->SetLayerMode(IsLayerModeActive()); 398 399 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 400 401 if (pPageView) 402 { 403 if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() ) 404 mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() ); 405 406 if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() ) 407 mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() ); 408 409 if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() ) 410 mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() ); 411 412 if (mePageKind == PK_NOTES) 413 { 414 mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() ); 415 } 416 else if (mePageKind == PK_HANDOUT) 417 { 418 mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() ); 419 } 420 else 421 { 422 mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() ); 423 } 424 } 425 426 if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() ) 427 mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() ); 428 429 // DrawMode fuer 'Normales' Fenster merken 430 if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode()) 431 mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode()); 432 } 433 434 435 436 /************************************************************************* 437 |* 438 |* PrePaint-Method 439 |* 440 \************************************************************************/ 441 442 void DrawViewShell::PrePaint() 443 { 444 mpDrawView->PrePaint(); 445 } 446 447 /************************************************************************* 448 |* 449 |* Paint-Methode: das Ereignis wird vom Fenster pWin an 450 |* die Viewshell und die aktuelle Funktion weitergeleitet 451 |* 452 |* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird! 453 |* 454 \************************************************************************/ 455 456 void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin) 457 { 458 // #103834# Fill var FillColor here to have it available on later call 459 svtools::ColorConfig aColorConfig; 460 Color aFillColor; 461 462 if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType()) 463 { 464 aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ); 465 } 466 else 467 { 468 aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); 469 } 470 471 /* #97517# This is done before each text edit, so why not do it before every paint. 472 The default language is only used if the outliner only contains one 473 character in a symbol font */ 474 GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) ); 475 476 // #103834# Set Application Background color for usage in SdrPaintView(s) 477 mpDrawView->SetApplicationBackgroundColor(aFillColor); 478 479 /* #97517# This is done before each text edit, so why not do it before every paint. 480 The default language is only used if the outliner only contains one 481 character in a symbol font */ 482 GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 483 484 mpDrawView->CompleteRedraw( pWin, Region( rRect ) ); 485 486 if( pWin ) 487 { 488 if( GetDocSh()->GetDocShellFunction().is() ) 489 GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin ); 490 491 if( HasCurrentFunction() ) 492 GetCurrentFunction()->Paint( rRect, pWin ); 493 } 494 } 495 496 /************************************************************************* 497 |* 498 |* Zoom-Faktor fuer InPlace einstellen 499 |* 500 \************************************************************************/ 501 502 void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) 503 { 504 ViewShell::SetZoomFactor(rZoomX, rZoomY); 505 mbZoomOnPage = sal_False; 506 Point aOrigin = GetActiveWindow()->GetViewOrigin(); 507 GetActiveWindow()->SetWinViewPos(aOrigin); 508 } 509 510 /************************************************************************* 511 |* 512 |* Optimale Groesse zurueckgeben 513 |* 514 \************************************************************************/ 515 516 Size DrawViewShell::GetOptimalSizePixel() const 517 { 518 Size aSize; 519 520 SdrPageView* pPV = mpDrawView->GetSdrPageView(); 521 if (pPV) 522 { 523 SdPage* pPage = (SdPage*) pPV->GetPage(); 524 525 if (pPage) 526 { 527 if (!mbZoomOnPage) 528 { 529 // Gegenwaertigen MapMode beruecksichtigen 530 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() ); 531 } 532 else 533 { 534 // 1:1 Darstellung 535 MapMode aMapMode(MAP_100TH_MM); 536 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode ); 537 const_cast< DrawViewShell* >(this)->mbZoomOnPage = sal_True; 538 } 539 } 540 } 541 542 return(aSize); 543 } 544 545 546 /************************************************************************* 547 |* 548 |* Seite wird gehided 549 |* 550 \************************************************************************/ 551 552 void DrawViewShell::HidePage() 553 { 554 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 555 if (pFormShell != NULL) 556 pFormShell->PrepareClose (sal_False); 557 } 558 559 560 561 void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse ) 562 { 563 WriteFrameViewData(); 564 565 ViewShell::WriteUserDataSequence( rSequence, bBrowse ); 566 567 const sal_Int32 nIndex = rSequence.getLength(); 568 rSequence.realloc( nIndex + 1 ); 569 rSequence[nIndex].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ZoomOnPage ) ); 570 rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage; 571 } 572 573 void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse ) 574 { 575 WriteFrameViewData(); 576 577 ViewShell::ReadUserDataSequence( rSequence, bBrowse ); 578 579 const sal_Int32 nLength = rSequence.getLength(); 580 const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray(); 581 for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ ) 582 { 583 if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ZoomOnPage ) ) ) 584 { 585 sal_Bool bZoomPage = sal_False; 586 if( pValue->Value >>= bZoomPage ) 587 { 588 mbZoomOnPage = bZoomPage; 589 } 590 } 591 } 592 593 if( mpFrameView->GetPageKind() != mePageKind ) 594 { 595 mePageKind = mpFrameView->GetPageKind(); 596 597 if (mePageKind == PK_NOTES) 598 { 599 SetHelpId( SID_NOTESMODE ); 600 GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE ); 601 GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE ); 602 } 603 else if (mePageKind == PK_HANDOUT) 604 { 605 SetHelpId( SID_HANDOUTMODE ); 606 GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE ); 607 GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE ); 608 } 609 else 610 { 611 SetHelpId( SD_IF_SDDRAWVIEWSHELL ); 612 GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL ); 613 GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL ); 614 } 615 } 616 617 ReadFrameViewData( mpFrameView ); 618 619 if( !mbZoomOnPage ) 620 { 621 const Rectangle aVisArea( mpFrameView->GetVisArea() ); 622 623 if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 624 { 625 GetDocSh()->SetVisArea(aVisArea); 626 } 627 628 VisAreaChanged(aVisArea); 629 630 ::sd::View* pView = GetView(); 631 632 if (pView) 633 { 634 pView->VisAreaChanged(GetActiveWindow()); 635 } 636 637 SetZoomRect(aVisArea); 638 } 639 640 ChangeEditMode (meEditMode, ! IsLayerModeActive()); 641 ChangeEditMode (meEditMode, ! IsLayerModeActive()); 642 } 643 644 void DrawViewShell::VisAreaChanged(const Rectangle& rRect) 645 { 646 ViewShell::VisAreaChanged( rRect ); 647 648 DrawController& rController = GetViewShellBase().GetDrawController(); 649 rController.FireVisAreaChanged (rRect); 650 } 651 652 653 654 655 /** If there is a valid controller then create a new instance of 656 <type>AccessibleDrawDocumentView</type>. Otherwise delegate this call 657 to the base class to return a default object (probably an empty 658 reference). 659 */ 660 ::com::sun::star::uno::Reference< 661 ::com::sun::star::accessibility::XAccessible> 662 DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) 663 { 664 if (GetViewShellBase().GetController() != NULL) 665 { 666 accessibility::AccessibleDrawDocumentView* pDocumentView = 667 new accessibility::AccessibleDrawDocumentView ( 668 pWindow, 669 this, 670 GetViewShellBase().GetController(), 671 pWindow->GetAccessibleParentWindow()->GetAccessible()); 672 pDocumentView->Init(); 673 return ::com::sun::star::uno::Reference< 674 ::com::sun::star::accessibility::XAccessible> 675 (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView), 676 ::com::sun::star::uno::UNO_QUERY); 677 } 678 else 679 { 680 OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller"); 681 return ViewShell::CreateAccessibleDocumentView (pWindow); 682 } 683 } 684 685 686 687 688 int DrawViewShell::GetActiveTabLayerIndex (void) const 689 { 690 const LayerTabBar* pBar 691 = const_cast<DrawViewShell*>(this)->GetLayerTabControl (); 692 if (pBar != NULL) 693 return pBar->GetPagePos (pBar->GetCurPageId()); 694 else 695 return -1; 696 } 697 698 699 700 701 void DrawViewShell::SetActiveTabLayerIndex (int nIndex) 702 { 703 LayerTabBar* pBar = GetLayerTabControl (); 704 if (pBar != NULL) 705 { 706 // Ignore invalid indices silently. 707 if (nIndex>=0 && nIndex<pBar->GetPageCount()) 708 { 709 // Tell the draw view and the tab control of the new active layer. 710 mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex))); 711 pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex)); 712 } 713 } 714 } 715 716 717 718 719 TabControl* DrawViewShell::GetPageTabControl (void) 720 { 721 return &maTabControl; 722 } 723 724 725 726 727 LayerTabBar* DrawViewShell::GetLayerTabControl (void) 728 { 729 return mpLayerTabBar.get(); 730 } 731 732 733 734 735 int DrawViewShell::GetTabLayerCount (void) const 736 { 737 const LayerTabBar* pBar 738 = const_cast<DrawViewShell*>(this)->GetLayerTabControl (); 739 if (pBar != NULL) 740 return pBar->GetPageCount(); 741 else 742 return 0; 743 } 744 745 746 } // end of namespace sd 747