LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/view - drviews5.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 310 0.3 %
Date: 2012-12-27 Functions: 2 21 9.5 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10