LCOV - code coverage report
Current view: top level - sc/source/ui/view - output3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 81 98 82.7 %
Date: 2012-08-25 Functions: 4 5 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 78 156 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <editeng/eeitem.hxx>
      30                 :            : #include <svx/svdograf.hxx>
      31                 :            : #include <svx/svdoole2.hxx>
      32                 :            : #include <svx/svdoutl.hxx>
      33                 :            : #include <svx/svdpage.hxx>
      34                 :            : #include <svx/svdpagv.hxx>
      35                 :            : #include <svx/svdview.hxx>
      36                 :            : #include <vcl/svapp.hxx>
      37                 :            : 
      38                 :            : #include "output.hxx"
      39                 :            : #include "drwlayer.hxx"
      40                 :            : #include "document.hxx"
      41                 :            : #include "tabvwsh.hxx"
      42                 :            : #include "fillinfo.hxx"
      43                 :            : 
      44                 :            : #include <svx/fmview.hxx>
      45                 :            : 
      46                 :            : // STATIC DATA -----------------------------------------------------------
      47                 :            : 
      48                 :            : SdrObject* pSkipPaintObj = NULL;
      49                 :            : 
      50                 :            : //==================================================================
      51                 :            : 
      52                 :            : // #i72502#
      53                 :         67 : Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
      54                 :            : {
      55         [ +  - ]:         67 :     Rectangle aRect;
      56                 :            :     SCCOL nCol;
      57                 :         67 :     Point aOffset;
      58         [ -  + ]:         67 :     long nLayoutSign(bLayoutRTL ? -1 : 1);
      59                 :            : 
      60         [ -  + ]:         67 :     for (nCol=0; nCol<nX1; nCol++)
      61         [ #  # ]:          0 :         aOffset.X() -= mpDoc->GetColWidth( nCol, nTab ) * nLayoutSign;
      62         [ +  - ]:         67 :     aOffset.Y() -= mpDoc->GetRowHeight( 0, nY1-1, nTab );
      63                 :            : 
      64                 :         67 :     long nDataWidth = 0;
      65         [ +  + ]:        162 :     for (nCol=nX1; nCol<=nX2; nCol++)
      66         [ +  - ]:         95 :         nDataWidth += mpDoc->GetColWidth( nCol, nTab );
      67                 :            : 
      68         [ -  + ]:         67 :     if ( bLayoutRTL )
      69                 :          0 :         aOffset.X() += nDataWidth;
      70                 :            : 
      71                 :         67 :     aRect.Left() = aRect.Right()  = -aOffset.X();
      72                 :         67 :     aRect.Top()  = aRect.Bottom() = -aOffset.Y();
      73                 :            : 
      74                 :         67 :     Point aMMOffset( aOffset );
      75                 :         67 :     aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS);
      76                 :         67 :     aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS);
      77                 :            : 
      78         [ +  + ]:         67 :     if (!bMetaFile)
      79                 :         63 :         aMMOffset += Point( nLogStX, nLogStY );
      80                 :            : 
      81         [ +  + ]:        162 :     for (nCol=nX1; nCol<=nX2; nCol++)
      82         [ +  - ]:         95 :         aRect.Right() += mpDoc->GetColWidth( nCol, nTab );
      83         [ +  - ]:         67 :     aRect.Bottom() += mpDoc->GetRowHeight( nY1, nY2, nTab );
      84                 :            : 
      85                 :         67 :     aRect.Left()   = (long) (aRect.Left()   * HMM_PER_TWIPS);
      86                 :         67 :     aRect.Top()    = (long) (aRect.Top()    * HMM_PER_TWIPS);
      87                 :         67 :     aRect.Right()  = (long) (aRect.Right()  * HMM_PER_TWIPS);
      88                 :         67 :     aRect.Bottom() = (long) (aRect.Bottom() * HMM_PER_TWIPS);
      89                 :            : 
      90 [ +  - ][ +  - ]:         67 :     if(pViewShell || pDrawView)
      91                 :            :     {
      92 [ +  - ][ #  # ]:         67 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
      93                 :            : 
      94         [ +  - ]:         67 :         if(pLocalDrawView)
      95                 :            :         {
      96                 :            :             // #i76114# MapMode has to be set because BeginDrawLayers uses GetPaintRegion
      97         [ +  - ]:         67 :             MapMode aOldMode = mpDev->GetMapMode();
      98         [ +  + ]:         67 :             if (!bMetaFile)
      99 [ +  - ][ +  - ]:         63 :                 mpDev->SetMapMode( MapMode( MAP_100TH_MM, aMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
                 [ +  - ]
     100                 :            : 
     101                 :            :             // #i74769# work with SdrPaintWindow directly
     102                 :            :             // #i76114# pass bDisableIntersect = true, because the intersection of the table area
     103                 :            :             // with the Window's paint region can be empty
     104         [ +  - ]:         67 :             Region aRectRegion(aRect);
     105         [ +  - ]:         67 :             mpTargetPaintWindow = pLocalDrawView->BeginDrawLayers(mpDev, aRectRegion, true);
     106                 :            :             OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
     107                 :            : 
     108         [ +  + ]:         67 :             if (!bMetaFile)
     109 [ +  - ][ +  - ]:         67 :                 mpDev->SetMapMode( aOldMode );
                 [ +  - ]
     110                 :            :         }
     111                 :            :     }
     112                 :            : 
     113                 :         67 :     return aMMOffset;
     114                 :            : }
     115                 :            : 
     116                 :            : // #i72502#
     117                 :         67 : void ScOutputData::PostPrintDrawingLayer(const Point& rMMOffset) // #i74768#
     118                 :            : {
     119                 :            :     // #i74768# just use offset as in PrintDrawingLayer() to also get the form controls
     120                 :            :     // painted with offset
     121         [ +  - ]:         67 :     MapMode aOldMode = mpDev->GetMapMode();
     122                 :            : 
     123         [ +  + ]:         67 :     if (!bMetaFile)
     124                 :            :     {
     125 [ +  - ][ +  - ]:         63 :         mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
                 [ +  - ]
     126                 :            :     }
     127                 :            : 
     128 [ +  - ][ +  - ]:         67 :     if(pViewShell || pDrawView)
     129                 :            :     {
     130 [ +  - ][ #  # ]:         67 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     131                 :            : 
     132         [ +  - ]:         67 :         if(pLocalDrawView)
     133                 :            :         {
     134                 :            :             // #i74769# work with SdrPaintWindow directly
     135         [ +  - ]:         67 :             pLocalDrawView->EndDrawLayers(*mpTargetPaintWindow, true);
     136                 :         67 :             mpTargetPaintWindow = 0;
     137                 :            :         }
     138                 :            :     }
     139                 :            : 
     140                 :            :     // #i74768#
     141         [ +  + ]:         67 :     if (!bMetaFile)
     142                 :            :     {
     143         [ +  - ]:         63 :         mpDev->SetMapMode( aOldMode );
     144         [ +  - ]:         67 :     }
     145                 :         67 : }
     146                 :            : 
     147                 :            : // #i72502#
     148                 :        201 : void ScOutputData::PrintDrawingLayer(const sal_uInt16 nLayer, const Point& rMMOffset)
     149                 :            : {
     150                 :        201 :     bool bHideAllDrawingLayer(false);
     151                 :            : 
     152 [ +  - ][ +  - ]:        201 :     if(pViewShell || pDrawView)
     153                 :            :     {
     154 [ +  - ][ #  # ]:        201 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     155                 :            : 
     156         [ +  - ]:        201 :         if(pLocalDrawView)
     157                 :            :         {
     158                 :        201 :             bHideAllDrawingLayer = pLocalDrawView->getHideOle() && pLocalDrawView->getHideChart()
     159 [ #  # ][ #  # ]:        201 :                     && pLocalDrawView->getHideDraw() && pLocalDrawView->getHideFormControl();
           [ -  +  #  # ]
     160                 :            :         }
     161                 :            :     }
     162                 :            : 
     163                 :            :     // #109985#
     164 [ +  - ][ +  - ]:        201 :     if(bHideAllDrawingLayer || (!mpDoc->GetDrawLayer()))
         [ -  + ][ +  - ]
     165                 :            :     {
     166                 :        201 :         return;
     167                 :            :     }
     168                 :            : 
     169         [ +  - ]:        201 :     MapMode aOldMode = mpDev->GetMapMode();
     170                 :            : 
     171         [ +  + ]:        201 :     if (!bMetaFile)
     172                 :            :     {
     173 [ +  - ][ +  - ]:        189 :         mpDev->SetMapMode( MapMode( MAP_100TH_MM, rMMOffset, aOldMode.GetScaleX(), aOldMode.GetScaleY() ) );
                 [ +  - ]
     174                 :            :     }
     175                 :            : 
     176                 :            :     // #109985#
     177         [ +  - ]:        201 :     DrawSelectiveObjects( nLayer );
     178                 :            : 
     179         [ +  + ]:        201 :     if (!bMetaFile)
     180                 :            :     {
     181         [ +  - ]:        189 :         mpDev->SetMapMode( aOldMode );
     182         [ +  - ]:        201 :     }
     183                 :            : }
     184                 :            : 
     185                 :            : // #109985#
     186                 :       2757 : void ScOutputData::DrawSelectiveObjects(const sal_uInt16 nLayer)
     187                 :            : {
     188                 :       2757 :     ScDrawLayer* pModel = mpDoc->GetDrawLayer();
     189         [ -  + ]:       2757 :     if (!pModel)
     190                 :          0 :         return;
     191                 :            : 
     192                 :            :     //  #i46362# high contrast mode (and default text direction) must be handled
     193                 :            :     //  by the application, so it's still needed when using DrawLayer().
     194                 :            : 
     195                 :       2757 :     SdrOutliner& rOutl = pModel->GetDrawOutliner();
     196                 :       2757 :     rOutl.EnableAutoColor( mbUseStyleColor );
     197                 :            :     rOutl.SetDefaultHorizontalTextDirection(
     198                 :       2757 :                 (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
     199                 :            : 
     200                 :            :     //  #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
     201                 :            :     //  LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
     202                 :            :     //  so it's not a performance problem to call UseHyphenator even when it's not needed.
     203                 :            : 
     204                 :       2757 :     pModel->UseHyphenator();
     205                 :            : 
     206                 :       2757 :     sal_uLong nOldDrawMode = mpDev->GetDrawMode();
     207 [ -  + ][ -  + ]:       2757 :     if ( mbUseStyleColor && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
                 [ +  + ]
     208                 :            :     {
     209                 :            :         mpDev->SetDrawMode( nOldDrawMode | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL |
     210                 :          0 :                             DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
     211                 :            :     }
     212                 :            : 
     213                 :            :     // #109985#
     214 [ +  + ][ +  - ]:       2757 :     if(pViewShell || pDrawView)
     215                 :            :     {
     216         [ +  + ]:       2757 :         SdrView* pLocalDrawView = (pDrawView) ? pDrawView : pViewShell->GetSdrView();
     217                 :            : 
     218         [ +  - ]:       2757 :         if(pLocalDrawView)
     219                 :            :         {
     220                 :       2757 :             SdrPageView* pPageView = pLocalDrawView->GetSdrPageView();
     221                 :            : 
     222         [ +  - ]:       2757 :             if(pPageView)
     223                 :            :             {
     224                 :       2757 :                 pPageView->DrawLayer(sal::static_int_cast<SdrLayerID>(nLayer), mpDev);
     225                 :            :             }
     226                 :            :         }
     227                 :            :     }
     228                 :            : 
     229                 :       2757 :     mpDev->SetDrawMode(nOldDrawMode);
     230                 :            : 
     231                 :            :     // #109985#
     232                 :       2757 :     return;
     233                 :            : }
     234                 :            : 
     235                 :            : //  Teile nur fuer Bildschirm
     236                 :            : 
     237                 :            : // #109985#
     238                 :          0 : void ScOutputData::DrawingSingle(const sal_uInt16 nLayer)
     239                 :            : {
     240                 :          0 :     sal_Bool    bHad    = false;
     241                 :            :     SCSIZE  nArrY;
     242         [ #  # ]:          0 :     for (nArrY=1; nArrY+1<nArrCount; nArrY++)
     243                 :            :     {
     244                 :          0 :         RowInfo* pThisRowInfo = &pRowInfo[nArrY];
     245                 :            : 
     246         [ #  # ]:          0 :         if ( pThisRowInfo->bChanged )
     247                 :            :         {
     248         [ #  # ]:          0 :             if (!bHad)
     249                 :            :             {
     250                 :          0 :                 bHad = sal_True;
     251                 :            :             }
     252                 :            :         }
     253         [ #  # ]:          0 :         else if (bHad)
     254                 :            :         {
     255                 :          0 :             DrawSelectiveObjects( nLayer );
     256                 :          0 :             bHad = false;
     257                 :            :         }
     258                 :            :     }
     259                 :            : 
     260         [ #  # ]:          0 :     if (bHad)
     261                 :          0 :         DrawSelectiveObjects( nLayer );
     262                 :          0 : }
     263                 :            : 
     264                 :            : 
     265                 :            : 
     266                 :            : 
     267                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10