LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/view - output3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 82 98 83.7 %
Date: 2013-07-09 Functions: 6 7 85.7 %
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             : #include <editeng/eeitem.hxx>
      21             : #include <svx/svdograf.hxx>
      22             : #include <svx/svdoole2.hxx>
      23             : #include <svx/svdoutl.hxx>
      24             : #include <svx/svdpage.hxx>
      25             : #include <svx/svdpagv.hxx>
      26             : #include <svx/svdview.hxx>
      27             : #include <vcl/svapp.hxx>
      28             : 
      29             : #include "output.hxx"
      30             : #include "drwlayer.hxx"
      31             : #include "document.hxx"
      32             : #include "tabvwsh.hxx"
      33             : #include "fillinfo.hxx"
      34             : 
      35             : #include <svx/fmview.hxx>
      36             : 
      37             : //==================================================================
      38             : 
      39             : // #i72502#
      40          36 : Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
      41             : {
      42          36 :     Rectangle aRect;
      43             :     SCCOL nCol;
      44          36 :     Point aOffset;
      45          36 :     long nLayoutSign(bLayoutRTL ? -1 : 1);
      46             : 
      47          36 :     for (nCol=0; nCol<nX1; nCol++)
      48           0 :         aOffset.X() -= mpDoc->GetColWidth( nCol, nTab ) * nLayoutSign;
      49          36 :     aOffset.Y() -= mpDoc->GetRowHeight( 0, nY1-1, nTab );
      50             : 
      51          36 :     long nDataWidth = 0;
      52          81 :     for (nCol=nX1; nCol<=nX2; nCol++)
      53          45 :         nDataWidth += mpDoc->GetColWidth( nCol, nTab );
      54             : 
      55          36 :     if ( bLayoutRTL )
      56           0 :         aOffset.X() += nDataWidth;
      57             : 
      58          36 :     aRect.Left() = aRect.Right()  = -aOffset.X();
      59          36 :     aRect.Top()  = aRect.Bottom() = -aOffset.Y();
      60             : 
      61          36 :     Point aMMOffset( aOffset );
      62          36 :     aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS);
      63          36 :     aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS);
      64             : 
      65          36 :     if (!bMetaFile)
      66          33 :         aMMOffset += Point( nLogStX, nLogStY );
      67             : 
      68          81 :     for (nCol=nX1; nCol<=nX2; nCol++)
      69          45 :         aRect.Right() += mpDoc->GetColWidth( nCol, nTab );
      70          36 :     aRect.Bottom() += mpDoc->GetRowHeight( nY1, nY2, nTab );
      71             : 
      72          36 :     aRect.Left()   = (long) (aRect.Left()   * HMM_PER_TWIPS);
      73          36 :     aRect.Top()    = (long) (aRect.Top()    * HMM_PER_TWIPS);
      74          36 :     aRect.Right()  = (long) (aRect.Right()  * HMM_PER_TWIPS);
      75          36 :     aRect.Bottom() = (long) (aRect.Bottom() * HMM_PER_TWIPS);
      76             : 
      77          36 :     if(pViewShell || pDrawView)
      78             :     {
      79          36 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
      80             : 
      81          36 :         if(pLocalDrawView)
      82             :         {
      83             :             // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
      84          36 :             MapMode aOldMode = mpDev->GetMapMode();
      85          36 :             if (!bMetaFile)
      86          33 :                 mpDev->SetMapMode( MapMode( MAP_100TH_MM, aMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
      87             : 
      88             :             // #i74769# work with SdrPaintWindow directly
      89             :             // #i76114# pass bDisableIntersect = true, because the intersection of the table area
      90             :             // with the Window's paint region can be empty
      91          72 :             Region aRectRegion(aRect);
      92          36 :             mpTargetPaintWindow = pLocalDrawView->BeginDrawLayers(mpDev, aRectRegion, true);
      93             :             OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
      94             : 
      95          36 :             if (!bMetaFile)
      96          69 :                 mpDev->SetMapMode( aOldMode );
      97             :         }
      98             :     }
      99             : 
     100          36 :     return aMMOffset;
     101             : }
     102             : 
     103             : // #i72502#
     104          36 : void ScOutputData::PostPrintDrawingLayer(const Point& rMMOffset) // #i74768#
     105             : {
     106             :     // #i74768# just use offset as in PrintDrawingLayer() to also get the form controls
     107             :     // painted with offset
     108          36 :     MapMode aOldMode = mpDev->GetMapMode();
     109             : 
     110          36 :     if (!bMetaFile)
     111             :     {
     112          33 :         mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
     113             :     }
     114             : 
     115          36 :     if(pViewShell || pDrawView)
     116             :     {
     117          36 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     118             : 
     119          36 :         if(pLocalDrawView)
     120             :         {
     121             :             // #i74769# work with SdrPaintWindow directly
     122          36 :             pLocalDrawView->EndDrawLayers(*mpTargetPaintWindow, true);
     123          36 :             mpTargetPaintWindow = 0;
     124             :         }
     125             :     }
     126             : 
     127             :     // #i74768#
     128          36 :     if (!bMetaFile)
     129             :     {
     130          33 :         mpDev->SetMapMode( aOldMode );
     131          36 :     }
     132          36 : }
     133             : 
     134             : // #i72502#
     135         108 : void ScOutputData::PrintDrawingLayer(const sal_uInt16 nLayer, const Point& rMMOffset)
     136             : {
     137         108 :     bool bHideAllDrawingLayer(false);
     138             : 
     139         108 :     if(pViewShell || pDrawView)
     140             :     {
     141         108 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     142             : 
     143         108 :         if(pLocalDrawView)
     144             :         {
     145         108 :             bHideAllDrawingLayer = pLocalDrawView->getHideOle() && pLocalDrawView->getHideChart()
     146         108 :                     && pLocalDrawView->getHideDraw() && pLocalDrawView->getHideFormControl();
     147             :         }
     148             :     }
     149             : 
     150             :     // #109985#
     151         108 :     if(bHideAllDrawingLayer || (!mpDoc->GetDrawLayer()))
     152             :     {
     153         108 :         return;
     154             :     }
     155             : 
     156         108 :     MapMode aOldMode = mpDev->GetMapMode();
     157             : 
     158         108 :     if (!bMetaFile)
     159             :     {
     160          99 :         mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
     161             :     }
     162             : 
     163             :     // #109985#
     164         108 :     DrawSelectiveObjects( nLayer );
     165             : 
     166         108 :     if (!bMetaFile)
     167             :     {
     168          99 :         mpDev->SetMapMode( aOldMode );
     169         108 :     }
     170             : }
     171             : 
     172             : // #109985#
     173        2394 : void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer)
     174             : {
     175        2394 :     ScDrawLayer* pModel = mpDoc->GetDrawLayer();
     176        2394 :     if (!pModel)
     177           0 :         return;
     178             : 
     179             :     //  #i46362# high contrast mode (and default text direction) must be handled
     180             :     //  by the application, so it's still needed when using DrawLayer().
     181             : 
     182        2394 :     SdrOutliner& rOutl = pModel->GetDrawOutliner();
     183        2394 :     rOutl.EnableAutoColor( mbUseStyleColor );
     184             :     rOutl.SetDefaultHorizontalTextDirection(
     185        2394 :                 (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
     186             : 
     187             :     //  #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
     188             :     //  LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
     189             :     //  so it's not a performance problem to call UseHyphenator even when it's not needed.
     190             : 
     191        2394 :     pModel->UseHyphenator();
     192             : 
     193        2394 :     sal_uLong nOldDrawMode = mpDev->GetDrawMode();
     194        2394 :     if ( mbUseStyleColor && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
     195             :     {
     196             :         mpDev->SetDrawMode( nOldDrawMode | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL |
     197           0 :                             DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
     198             :     }
     199             : 
     200             :     // #109985#
     201        2394 :     if(pViewShell || pDrawView)
     202             :     {
     203        2394 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     204             : 
     205        2394 :         if(pLocalDrawView)
     206             :         {
     207        2394 :             SdrPageView* pPageView = pLocalDrawView->GetSdrPageView();
     208             : 
     209        2394 :             if(pPageView)
     210             :             {
     211        2394 :                 pPageView->DrawLayer(sal::static_int_cast<SdrLayerID>(nLayer), mpDev);
     212             :             }
     213             :         }
     214             :     }
     215             : 
     216        2394 :     mpDev->SetDrawMode(nOldDrawMode);
     217             : 
     218             :     // #109985#
     219        2394 :     return;
     220             : }
     221             : 
     222             : //  Teile nur fuer Bildschirm
     223             : 
     224             : // #109985#
     225           0 : void ScOutputData::DrawingSingle(const sal_uInt16 nLayer)
     226             : {
     227           0 :     sal_Bool    bHad    = false;
     228             :     SCSIZE  nArrY;
     229           0 :     for (nArrY=1; nArrY+1<nArrCount; nArrY++)
     230             :     {
     231           0 :         RowInfo* pThisRowInfo = &pRowInfo[nArrY];
     232             : 
     233           0 :         if ( pThisRowInfo->bChanged )
     234             :         {
     235           0 :             if (!bHad)
     236             :             {
     237           0 :                 bHad = sal_True;
     238             :             }
     239             :         }
     240           0 :         else if (bHad)
     241             :         {
     242           0 :             DrawSelectiveObjects( nLayer );
     243           0 :             bHad = false;
     244             :         }
     245             :     }
     246             : 
     247           0 :     if (bHad)
     248           0 :         DrawSelectiveObjects( nLayer );
     249          93 : }
     250             : 
     251             : 
     252             : 
     253             : 
     254             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10