LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviews5.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 301 0.0 %
Date: 2014-04-14 Functions: 0 20 0.0 %
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 <vcl/settings.hxx>
      30             : 
      31             : #include <tools/poly.hxx>
      32             : #include <svx/fmshell.hxx>
      33             : #include <editeng/eeitem.hxx>
      34             : #include <svtools/colorcfg.hxx>
      35             : #include "AccessibleDrawDocumentView.hxx"
      36             : 
      37             : #include <sfx2/viewfrm.hxx>
      38             : #include "LayerTabBar.hxx"
      39             : 
      40             : #include "strings.hrc"
      41             : #include "res_bmp.hrc"
      42             : #include "glob.hrc"
      43             : #include "app.hrc"
      44             : #include "helpids.h"
      45             : #include "optsitem.hxx"
      46             : #include "sdmod.hxx"
      47             : #include "FrameView.hxx"
      48             : #include "sdattr.hxx"
      49             : #include "futext.hxx"
      50             : #include "sdpage.hxx"
      51             : #include "stlpool.hxx"
      52             : #include "prntopts.hxx"
      53             : #include "sdresid.hxx"
      54             : #include "Window.hxx"
      55             : #include "drawview.hxx"
      56             : #include "drawdoc.hxx"
      57             : #include "DrawDocShell.hxx"
      58             : #include "Outliner.hxx"
      59             : #include "Client.hxx"
      60             : #include "slideshow.hxx"
      61             : #include "unokywds.hxx"
      62             : #include "SdUnoDrawView.hxx"
      63             : #include "ViewShellBase.hxx"
      64             : #include "FormShellManager.hxx"
      65             : #include "LayerDialogContent.hxx"
      66             : #include "DrawController.hxx"
      67             : 
      68             : namespace sd {
      69             : 
      70           0 : void DrawViewShell::ModelHasChanged()
      71             : {
      72           0 :     Invalidate();
      73             :     // that the navigator also gets an up to date state
      74           0 :     GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, true, false );
      75             : 
      76           0 :     SfxBoolItem aItem( SID_3D_STATE, true );
      77             :     GetViewFrame()->GetDispatcher()->Execute(
      78           0 :         SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
      79             : 
      80             :     // now initialize the TextEditOutliner which was newly created by the draw engine
      81           0 :     ::Outliner* pOutliner     = mpDrawView->GetTextEditOutliner();
      82           0 :     if (pOutliner)
      83             :     {
      84           0 :         SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
      85           0 :         pOutliner->SetStyleSheetPool(pSPool);
      86           0 :     }
      87           0 : }
      88             : 
      89             : 
      90             : 
      91             : 
      92           0 : void DrawViewShell::Resize (void)
      93             : {
      94           0 :     ViewShell::Resize();
      95             : 
      96           0 :     if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
      97             :     {
      98           0 :         SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
      99             :     }
     100             : 
     101           0 :     rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     102           0 :     if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
     103             :     {
     104           0 :         xSlideshow->resize(maViewSize);
     105           0 :     }
     106           0 : }
     107             : 
     108             : 
     109             : 
     110             : 
     111           0 : void DrawViewShell::ArrangeGUIElements (void)
     112             : {
     113             :     // Retrieve the current size (thickness) of the scroll bars.  That is
     114             :     // the width of the vertical and the height of the horizontal scroll
     115             :     // bar.
     116             :     int nScrollBarSize =
     117           0 :         GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
     118           0 :     maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
     119             : 
     120           0 :     Point aHPos = maViewPos;
     121           0 :     aHPos.Y() += maViewSize.Height();
     122             : 
     123             : 
     124           0 :     ViewShell::ArrangeGUIElements ();
     125             : 
     126           0 :     maTabControl.Hide();
     127             : 
     128             :     OSL_ASSERT (GetViewShell()!=NULL);
     129           0 :     Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
     130           0 :     sal_Bool bClientActive = sal_False;
     131           0 :     if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
     132           0 :         bClientActive = sal_True;
     133             : 
     134           0 :     sal_Bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
     135             : 
     136           0 :     if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
     137             :     {
     138             :         // with split, always resize first window
     139             :         //af pWindow = mpContentWindow.get();
     140           0 :         SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool());
     141           0 :         ExecuteSlot( aReq );
     142             :     }
     143           0 : }
     144             : 
     145             : /**
     146             :  * Apply data of the FrameView on the current view
     147             :  */
     148           0 : void DrawViewShell::ReadFrameViewData(FrameView* pView)
     149             : {
     150           0 :     ModifyGuard aGuard( GetDoc() );
     151             : 
     152             :     // this option has to be adjust at the model
     153           0 :     GetDoc()->SetPickThroughTransparentTextFrames(
     154           0 :              SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
     155             : 
     156             :     // initialization of the Character-(Screen-) attribute
     157           0 :     if (HasRuler() != pView->HasRuler())
     158           0 :         SetRuler( pView->HasRuler() );
     159             : 
     160           0 :     if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
     161           0 :         mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
     162             : 
     163           0 :     if (mpDrawView->GetGridFine() != pView->GetGridFine())
     164           0 :         mpDrawView->SetGridFine( pView->GetGridFine() );
     165             : 
     166           0 :     if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
     167           0 :         mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
     168             : 
     169           0 :     if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
     170           0 :         mpDrawView->SetGridVisible( pView->IsGridVisible() );
     171             : 
     172           0 :     if (mpDrawView->IsGridFront() != pView->IsGridFront())
     173           0 :         mpDrawView->SetGridFront( pView->IsGridFront() );
     174             : 
     175           0 :     if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
     176           0 :         mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
     177             : 
     178           0 :     if (mpDrawView->IsGridSnap() !=  pView->IsGridSnap() )
     179           0 :         mpDrawView->SetGridSnap( pView->IsGridSnap() );
     180             : 
     181           0 :     if (mpDrawView->IsBordSnap() !=  pView->IsBordSnap() )
     182           0 :         mpDrawView->SetBordSnap( pView->IsBordSnap() );
     183             : 
     184           0 :     if (mpDrawView->IsHlplSnap() !=  pView->IsHlplSnap() )
     185           0 :         mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
     186             : 
     187           0 :     if (mpDrawView->IsOFrmSnap() !=  pView->IsOFrmSnap() )
     188           0 :         mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
     189             : 
     190           0 :     if (mpDrawView->IsOPntSnap() !=  pView->IsOPntSnap() )
     191           0 :         mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
     192             : 
     193           0 :     if (mpDrawView->IsOConSnap() !=  pView->IsOConSnap() )
     194           0 :         mpDrawView->SetOConSnap( pView->IsOConSnap() );
     195             : 
     196           0 :     if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
     197           0 :         mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
     198             : 
     199           0 :     if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
     200           0 :         mpDrawView->SetDragStripes( pView->IsDragStripes() );
     201             : 
     202           0 :     if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
     203           0 :         mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
     204             : 
     205           0 :     if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
     206           0 :         mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
     207             : 
     208           0 :     if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
     209           0 :         mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
     210             : 
     211           0 :     if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
     212           0 :         mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
     213             : 
     214           0 :     if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
     215           0 :         mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
     216             : 
     217           0 :     if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
     218           0 :         mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
     219             : 
     220           0 :     if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
     221           0 :         mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
     222             : 
     223           0 :     if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
     224           0 :         mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
     225             : 
     226           0 :     if (mpDrawView->IsOrtho() != pView->IsOrtho() )
     227           0 :         mpDrawView->SetOrtho( pView->IsOrtho() );
     228             : 
     229           0 :     if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
     230           0 :         mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
     231             : 
     232           0 :     if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
     233           0 :         mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
     234             : 
     235           0 :     if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
     236           0 :         mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
     237             : 
     238           0 :     if ((mpDrawView->IsQuickTextEditMode() ? 1 : 0) != pView->IsQuickEdit())
     239           0 :         mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
     240             : 
     241             :     // #i26631#
     242           0 :     if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
     243           0 :         mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
     244             : 
     245             :     // handle size: 9 pixels
     246           0 :     sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
     247           0 :     if( nTmp != 9 )
     248           0 :         mpDrawView->SetMarkHdlSizePixel( 9 );
     249             : 
     250             : 
     251           0 :     SdrPageView* pPageView = mpDrawView->GetSdrPageView();
     252           0 :     if (pPageView)
     253             :     {
     254           0 :         if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
     255           0 :             pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
     256             : 
     257           0 :         if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
     258           0 :             pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
     259             : 
     260           0 :         if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
     261           0 :             pPageView->SetLockedLayers( pView->GetLockedLayers() );
     262             : 
     263           0 :         if (mePageKind == PK_NOTES)
     264             :         {
     265           0 :             if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
     266           0 :                 pPageView->SetHelpLines( pView->GetNotesHelpLines() );
     267             :         }
     268           0 :         else if (mePageKind == PK_HANDOUT)
     269             :         {
     270           0 :             if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
     271           0 :                 pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
     272             :         }
     273             :         else
     274             :         {
     275           0 :             if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
     276           0 :                 pPageView->SetHelpLines( pView->GetStandardHelpLines() );
     277             :         }
     278             :     }
     279             : 
     280           0 :     if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
     281           0 :         mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
     282             : 
     283           0 :     sal_uInt16 nSelectedPage = 0;
     284             : 
     285           0 :     if (mePageKind != PK_HANDOUT)
     286             :     {
     287           0 :         nSelectedPage = pView->GetSelectedPage();
     288             :     }
     289             : 
     290           0 :     EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
     291           0 :     sal_Bool bNewLayerMode = pView->IsLayerMode();
     292             : 
     293           0 :     if(IsLayerModeActive() && bNewLayerMode)
     294             :     {
     295             :         // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
     296             :         // below does something regarding LayerTabBar content refresh. That refresh
     297             :         // is only done when IsLayerModeActive changes. It needs to be done
     298             :         // since e.g. Layer vsisibility was changed above and this may need
     299             :         // a refresh to show the correct graphical representation
     300           0 :         mbIsLayerModeActive = false;
     301             :     }
     302             : 
     303           0 :     ChangeEditMode(eNewEditMode, bNewLayerMode);
     304           0 :     SwitchPage(nSelectedPage);
     305             : 
     306             :     // restore DrawMode for 'normal' window
     307           0 :     if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
     308           0 :       GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
     309             : 
     310           0 :     if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
     311             :     {
     312           0 :         SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
     313           0 :         GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
     314             :     }
     315             : 
     316             :     // has to be called in the end, because it executes a WriteFrameViewData()
     317           0 :     if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
     318           0 :         mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
     319           0 : }
     320             : 
     321             : 
     322             : /**
     323             :  * Apply data of the current view on the FrameView
     324             :  */
     325           0 : void DrawViewShell::WriteFrameViewData()
     326             : {
     327             :     // store character-(screen-) attribute of FrameView
     328           0 :     mpFrameView->SetRuler( HasRuler() );
     329           0 :     mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
     330           0 :     mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
     331           0 :     mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
     332           0 :     mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
     333           0 :     mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
     334           0 :     mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
     335           0 :     mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
     336           0 :     mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
     337           0 :     mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
     338           0 :     mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
     339           0 :     mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
     340           0 :     mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
     341           0 :     mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
     342           0 :     mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
     343           0 :     mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
     344           0 :     mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
     345           0 :     mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
     346           0 :     mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
     347           0 :     mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
     348           0 :     mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
     349           0 :     mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
     350           0 :     mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
     351           0 :     mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
     352             : 
     353           0 :     mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
     354           0 :     mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
     355             : 
     356           0 :     mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
     357             : 
     358           0 :     Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
     359           0 :     Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
     360           0 :     mpFrameView->SetVisArea(aVisArea);
     361             : 
     362           0 :     if( mePageKind == PK_HANDOUT )
     363           0 :         mpFrameView->SetSelectedPage(0);
     364             :     else
     365             :     {
     366           0 :         mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
     367             :     }
     368             : 
     369           0 :     mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
     370           0 :     mpFrameView->SetLayerMode(IsLayerModeActive());
     371             : 
     372           0 :     SdrPageView* pPageView = mpDrawView->GetSdrPageView();
     373             : 
     374           0 :     if (pPageView)
     375             :     {
     376           0 :         if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
     377           0 :             mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
     378             : 
     379           0 :         if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
     380           0 :             mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
     381             : 
     382           0 :         if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
     383           0 :             mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
     384             : 
     385           0 :         if (mePageKind == PK_NOTES)
     386             :         {
     387           0 :             mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
     388             :         }
     389           0 :         else if (mePageKind == PK_HANDOUT)
     390             :         {
     391           0 :             mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
     392             :         }
     393             :         else
     394             :         {
     395           0 :             mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
     396             :         }
     397             :     }
     398             : 
     399           0 :     if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
     400           0 :         mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
     401             : 
     402             :     // store DrawMode for 'normal' window
     403           0 :     if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
     404           0 :       mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
     405           0 : }
     406             : 
     407             : 
     408             : 
     409           0 : void DrawViewShell::PrePaint()
     410             : {
     411           0 :     mpDrawView->PrePaint();
     412           0 : }
     413             : 
     414             : /**
     415             :  * The event is forwarded to the Viewshell and the current function by the
     416             :  * window pWin.
     417             :  *
     418             :  * Remark: pWin==NULL, if Paint() is called from ShowWindow!
     419             :  */
     420           0 : void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
     421             : {
     422             :     // Fill var FillColor here to have it available on later call
     423           0 :     svtools::ColorConfig aColorConfig;
     424           0 :     Color aFillColor;
     425             : 
     426           0 :     aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
     427             : 
     428             :     /* This is done before each text edit, so why not do it before every paint.
     429             :                 The default language is only used if the outliner only contains one
     430             :                 character in a symbol font */
     431           0 :     GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
     432             : 
     433             :     // Set Application Background color for usage in SdrPaintView(s)
     434           0 :     mpDrawView->SetApplicationBackgroundColor(aFillColor);
     435             : 
     436             :     /* This is done before each text edit, so why not do it before every paint.
     437             :                 The default language is only used if the outliner only contains one
     438             :                 character in a symbol font */
     439           0 :     GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
     440             : 
     441           0 :     mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
     442             : 
     443           0 :     if( pWin )
     444             :     {
     445           0 :         if( GetDocSh()->GetDocShellFunction().is() )
     446           0 :             GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
     447             : 
     448           0 :         if( HasCurrentFunction() )
     449           0 :             GetCurrentFunction()->Paint( rRect, pWin );
     450           0 :     }
     451           0 : }
     452             : 
     453             : /**
     454             :  * adjust zoom factor for InPlace
     455             :  */
     456           0 : void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
     457             : {
     458           0 :     ViewShell::SetZoomFactor(rZoomX, rZoomY);
     459           0 :     mbZoomOnPage = sal_False;
     460           0 :     Point aOrigin = GetActiveWindow()->GetViewOrigin();
     461           0 :     GetActiveWindow()->SetWinViewPos(aOrigin);
     462           0 : }
     463             : 
     464             : 
     465           0 : void DrawViewShell::HidePage()
     466             : {
     467           0 :     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     468           0 :     if (pFormShell != NULL)
     469           0 :         pFormShell->PrepareClose(false);
     470           0 : }
     471             : 
     472             : 
     473             : 
     474           0 : void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
     475             : {
     476           0 :     WriteFrameViewData();
     477             : 
     478           0 :     ViewShell::WriteUserDataSequence( rSequence, bBrowse );
     479             : 
     480           0 :     const sal_Int32 nIndex = rSequence.getLength();
     481           0 :     rSequence.realloc( nIndex + 1 );
     482           0 :     rSequence[nIndex].Name = sUNO_View_ZoomOnPage ;
     483           0 :     rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
     484           0 : }
     485             : 
     486           0 : void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
     487             : {
     488           0 :     WriteFrameViewData();
     489             : 
     490           0 :     ViewShell::ReadUserDataSequence( rSequence, bBrowse );
     491             : 
     492           0 :     const sal_Int32 nLength = rSequence.getLength();
     493           0 :     const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
     494           0 :     for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
     495             :     {
     496           0 :         if ( pValue->Name == sUNO_View_ZoomOnPage )
     497             :         {
     498           0 :             sal_Bool bZoomPage = sal_False;
     499           0 :             if( pValue->Value >>= bZoomPage )
     500             :             {
     501           0 :                 mbZoomOnPage = bZoomPage;
     502             :             }
     503             :         }
     504             :     }
     505             : 
     506           0 :     if( mpFrameView->GetPageKind() != mePageKind )
     507             :     {
     508           0 :         mePageKind = mpFrameView->GetPageKind();
     509             : 
     510           0 :         if (mePageKind == PK_NOTES)
     511             :         {
     512           0 :             SetHelpId( SID_NOTESMODE );
     513           0 :             GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
     514           0 :             GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
     515             :         }
     516           0 :         else if (mePageKind == PK_HANDOUT)
     517             :         {
     518           0 :             SetHelpId( SID_HANDOUTMODE );
     519           0 :             GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
     520           0 :             GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
     521             :         }
     522             :         else
     523             :         {
     524           0 :             SetHelpId( SD_IF_SDDRAWVIEWSHELL );
     525           0 :             GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
     526           0 :             GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
     527             :         }
     528             :     }
     529             : 
     530           0 :     ReadFrameViewData( mpFrameView );
     531             : 
     532           0 :     if( !mbZoomOnPage )
     533             :     {
     534           0 :         const Rectangle aVisArea( mpFrameView->GetVisArea() );
     535             : 
     536           0 :         if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
     537             :         {
     538           0 :             GetDocSh()->SetVisArea(aVisArea);
     539             :         }
     540             : 
     541           0 :         VisAreaChanged(aVisArea);
     542             : 
     543           0 :         ::sd::View* pView = GetView();
     544             : 
     545           0 :         if (pView)
     546             :         {
     547           0 :             pView->VisAreaChanged(GetActiveWindow());
     548             :         }
     549             : 
     550           0 :         SetZoomRect(aVisArea);
     551             :     }
     552             : 
     553           0 :     ChangeEditMode (meEditMode, ! IsLayerModeActive());
     554           0 :     ResetActualLayer();
     555           0 : }
     556             : 
     557           0 : void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
     558             : {
     559           0 :     ViewShell::VisAreaChanged( rRect );
     560             : 
     561           0 :     DrawController& rController = GetViewShellBase().GetDrawController();
     562           0 :     rController.FireVisAreaChanged (rRect);
     563           0 : }
     564             : 
     565             : 
     566             : 
     567             : 
     568             : /** If there is a valid controller then create a new instance of
     569             :     <type>AccessibleDrawDocumentView</type>.  Otherwise return an empty
     570             :     reference.
     571             : */
     572             : ::com::sun::star::uno::Reference<
     573             :     ::com::sun::star::accessibility::XAccessible>
     574           0 :     DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
     575             : {
     576           0 :     if (GetViewShellBase().GetController() != NULL)
     577             :     {
     578             :         accessibility::AccessibleDrawDocumentView* pDocumentView =
     579             :             new accessibility::AccessibleDrawDocumentView (
     580             :                 pWindow,
     581             :                 this,
     582           0 :                 GetViewShellBase().GetController(),
     583           0 :                 pWindow->GetAccessibleParentWindow()->GetAccessible());
     584           0 :         pDocumentView->Init();
     585             :         return ::com::sun::star::uno::Reference<
     586             :             ::com::sun::star::accessibility::XAccessible>
     587             :             (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
     588           0 :                 ::com::sun::star::uno::UNO_QUERY);
     589             :     }
     590             : 
     591             :     OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
     592           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>();
     593             : }
     594             : 
     595             : 
     596             : 
     597             : 
     598           0 : int DrawViewShell::GetActiveTabLayerIndex (void) const
     599             : {
     600             :     const LayerTabBar* pBar
     601           0 :         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
     602           0 :     if (pBar != NULL)
     603           0 :         return pBar->GetPagePos (pBar->GetCurPageId());
     604             :     else
     605           0 :         return -1;
     606             : }
     607             : 
     608             : 
     609             : 
     610             : 
     611           0 : void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
     612             : {
     613           0 :     LayerTabBar* pBar = GetLayerTabControl ();
     614           0 :     if (pBar != NULL)
     615             :     {
     616             :         // Ignore invalid indices silently.
     617           0 :         if (nIndex>=0 && nIndex<pBar->GetPageCount())
     618             :         {
     619             :             // Tell the draw view and the tab control of the new active layer.
     620           0 :             mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
     621           0 :             pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
     622             :             SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
     623             :                 *this,
     624           0 :                 *GetView());
     625           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
     626           0 :             GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
     627           0 :             delete pUnoDrawView;
     628             :         }
     629             :     }
     630           0 : }
     631             : 
     632             : 
     633             : 
     634             : 
     635           0 : TabControl* DrawViewShell::GetPageTabControl (void)
     636             : {
     637           0 :     return &maTabControl;
     638             : }
     639             : 
     640             : 
     641             : 
     642             : 
     643           0 : LayerTabBar* DrawViewShell::GetLayerTabControl (void)
     644             : {
     645           0 :     return mpLayerTabBar.get();
     646             : }
     647             : 
     648             : 
     649             : 
     650             : 
     651           0 : int DrawViewShell::GetTabLayerCount (void) const
     652             : {
     653             :     const LayerTabBar* pBar
     654           0 :         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
     655           0 :     if (pBar != NULL)
     656           0 :         return pBar->GetPageCount();
     657             :     else
     658           0 :         return 0;
     659             : }
     660             : 
     661             : 
     662           0 : } // end of namespace sd
     663             : 
     664             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10