LCOV - code coverage report
Current view: top level - svx/source/dialog - paraprev.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 95 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 101 0.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 <svx/paraprev.hxx>
      30                 :            : 
      31                 :            : // class SvxParaPrevWindow -----------------------------------------------
      32                 :            : 
      33                 :          0 : SvxParaPrevWindow::SvxParaPrevWindow( Window* pParent, const ResId& rId ) :
      34                 :            : 
      35                 :            :     Window( pParent, rId ),
      36                 :            : 
      37                 :            :     nLeftMargin     ( 0 ),
      38                 :            :     nRightMargin    ( 0 ),
      39                 :            :     nFirstLineOfst  ( 0 ),
      40                 :            :     nUpper          ( 0 ),
      41                 :            :     nLower          ( 0 ),
      42                 :            :     eAdjust         ( SVX_ADJUST_LEFT ),
      43                 :            :     eLastLine       ( SVX_ADJUST_LEFT ),
      44                 :            :     eLine           ( SVX_PREV_LINESPACE_1 ),
      45 [ #  # ][ #  # ]:          0 :     nLineVal        ( 0 )
                 [ #  # ]
      46                 :            : 
      47                 :            : {
      48                 :            :     // Count in Twips by default
      49 [ #  # ][ #  # ]:          0 :     SetMapMode( MapMode( MAP_TWIP ) );
                 [ #  # ]
      50                 :          0 :     aWinSize = GetOutputSizePixel();
      51         [ #  # ]:          0 :     aWinSize = PixelToLogic( aWinSize );
      52                 :          0 :     Size aTmp(1, 1);
      53         [ #  # ]:          0 :     aTmp = PixelToLogic(aTmp);
      54                 :          0 :     aWinSize.Width() -= aTmp.Width() /2;
      55                 :          0 :     aWinSize.Height() -= aTmp.Height() /2;
      56                 :            : 
      57                 :          0 :     aSize = Size( 11905, 16837 );
      58                 :            : 
      59         [ #  # ]:          0 :     SetBorderStyle( WINDOW_BORDER_MONO );
      60                 :          0 : }
      61                 :            : 
      62                 :            : // -----------------------------------------------------------------------
      63                 :            : 
      64                 :          0 : void SvxParaPrevWindow::Paint( const Rectangle& )
      65                 :            : {
      66                 :          0 :     DrawParagraph( sal_True );
      67                 :          0 : }
      68                 :            : 
      69                 :            : // -----------------------------------------------------------------------
      70                 :            : 
      71                 :            : #define DEF_MARGIN  120
      72                 :            : 
      73                 :          0 : void SvxParaPrevWindow::DrawParagraph( sal_Bool bAll )
      74                 :            : {
      75                 :          0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
      76                 :          0 :     const Color& rWinColor = rStyleSettings.GetWindowColor();
      77                 :          0 :     Color aGrayColor(COL_LIGHTGRAY);
      78                 :            : 
      79         [ #  # ]:          0 :     SetFillColor( Color( rWinColor ) );
      80         [ #  # ]:          0 :     if( bAll )
      81 [ #  # ][ #  # ]:          0 :         DrawRect( Rectangle( Point(), aWinSize ) );
      82                 :            : 
      83         [ #  # ]:          0 :     SetLineColor();
      84                 :            : 
      85                 :          0 :     long nH = aWinSize.Height() / 19;
      86                 :          0 :     Size aLineSiz( aWinSize.Width() - DEF_MARGIN, nH ),
      87                 :          0 :          aSiz = aLineSiz;
      88                 :          0 :     Point aPnt;
      89                 :          0 :     aPnt.X() = DEF_MARGIN / 2;
      90         [ #  # ]:          0 :     SetFillColor( aGrayColor );
      91                 :            : 
      92         [ #  # ]:          0 :     for ( sal_uInt16 i = 0; i < 9; ++i )
      93                 :            :     {
      94         [ #  # ]:          0 :         if ( 3 == i )
      95                 :            :         {
      96         [ #  # ]:          0 :             SetFillColor( Color( COL_GRAY ) );
      97                 :          0 :             long nTop = nUpper * aLineSiz.Height() / aSize.Height();
      98                 :          0 :             aPnt.Y() += nTop * 2;
      99                 :            :         }
     100                 :            : 
     101         [ #  # ]:          0 :         if ( 6 == i )
     102         [ #  # ]:          0 :             SetFillColor( aGrayColor );
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 :         if ( 3 <= i && 6 > i )
     105                 :            :         {
     106                 :          0 :             long nLeft = nLeftMargin * aLineSiz.Width() / aSize.Width();
     107                 :          0 :             long nFirst = nFirstLineOfst * aLineSiz.Width() / aSize.Width();
     108                 :          0 :             long nTmp = nLeft + nFirst;
     109                 :            : 
     110         [ #  # ]:          0 :             if ( 3 == i )
     111                 :            :             {
     112                 :          0 :                 aPnt.X() += nTmp;
     113                 :          0 :                 aSiz.Width() -= nTmp;
     114                 :            :             }
     115                 :            :             else
     116                 :            :             {
     117                 :          0 :                 aPnt.X() += nLeft;
     118                 :          0 :                 aSiz.Width() -= nLeft;
     119                 :            :             }
     120                 :          0 :             long nRight = nRightMargin * aLineSiz.Width() / aSize.Width();
     121                 :          0 :             aSiz.Width() -= nRight;
     122                 :            :         }
     123                 :            : 
     124 [ #  # ][ #  # ]:          0 :         if ( 4 == i || 5 == i || 6 == i )
                 [ #  # ]
     125                 :            :         {
     126   [ #  #  #  #  :          0 :             switch ( eLine )
                      # ]
     127                 :            :             {
     128                 :          0 :                 case SVX_PREV_LINESPACE_1:                      break;
     129                 :          0 :                 case SVX_PREV_LINESPACE_15: aPnt.Y() += nH / 2; break;
     130                 :          0 :                 case SVX_PREV_LINESPACE_2:  aPnt.Y() += nH;     break;
     131                 :            : 
     132                 :            :                 case SVX_PREV_LINESPACE_PROP:
     133                 :            :                 case SVX_PREV_LINESPACE_MIN:
     134                 :          0 :                 case SVX_PREV_LINESPACE_DURCH:                  break;
     135                 :            :             }
     136                 :            :         }
     137                 :            : 
     138                 :          0 :         aPnt.Y() += nH;
     139                 :            : 
     140 [ #  # ][ #  # ]:          0 :         if ( (3 <= i) && (5 >= i) )
     141                 :            :         {
     142                 :            :             long nLW;
     143      [ #  #  # ]:          0 :             switch( i )
     144                 :            :             {
     145                 :            :                 default:
     146                 :          0 :                 case 3: nLW = aLineSiz.Width() * 8 / 10;    break;
     147                 :          0 :                 case 4: nLW = aLineSiz.Width() * 9 / 10;    break;
     148                 :          0 :                 case 5: nLW = aLineSiz.Width() / 2;         break;
     149                 :            :             }
     150                 :            : 
     151         [ #  # ]:          0 :             if ( nLW > aSiz.Width() )
     152                 :          0 :                 nLW = aSiz.Width();
     153                 :            : 
     154   [ #  #  #  # ]:          0 :             switch ( eAdjust )
     155                 :            :             {
     156                 :            :                 case SVX_ADJUST_LEFT:
     157                 :          0 :                     break;
     158                 :            :                 case SVX_ADJUST_RIGHT:
     159                 :          0 :                     aPnt.X() += ( aSiz.Width() - nLW );
     160                 :          0 :                     break;
     161                 :            :                 case SVX_ADJUST_CENTER:
     162                 :          0 :                     aPnt.X() += ( aSiz.Width() - nLW ) / 2;
     163                 :          0 :                     break;
     164                 :            :                 default: ; //prevent warning
     165                 :            :             }
     166         [ #  # ]:          0 :             if( SVX_ADJUST_BLOCK == eAdjust )
     167                 :            :             {
     168         [ #  # ]:          0 :                 if( 5 == i )
     169                 :            :                 {
     170   [ #  #  #  #  :          0 :                     switch( eLastLine )
                      # ]
     171                 :            :                     {
     172                 :            :                         case SVX_ADJUST_LEFT:
     173                 :          0 :                             break;
     174                 :            :                         case SVX_ADJUST_RIGHT:
     175                 :          0 :                             aPnt.X() += ( aSiz.Width() - nLW );
     176                 :          0 :                             break;
     177                 :            :                         case SVX_ADJUST_CENTER:
     178                 :          0 :                             aPnt.X() += ( aSiz.Width() - nLW ) / 2;
     179                 :          0 :                             break;
     180                 :            :                         case SVX_ADJUST_BLOCK:
     181                 :          0 :                             nLW = aSiz.Width();
     182                 :          0 :                             break;
     183                 :            :                         default: ; //prevent warning
     184                 :            :                     }
     185                 :            :                 }
     186                 :            :                 else
     187                 :          0 :                     nLW = aSiz.Width();
     188                 :            :             }
     189                 :          0 :             aSiz.Width() = nLW;
     190                 :            :         }
     191                 :            : 
     192         [ #  # ]:          0 :         Rectangle aRect( aPnt, aSiz );
     193                 :            : 
     194 [ #  # ][ #  # ]:          0 :         if ( Lines[i] != aRect || bAll )
         [ #  # ][ #  # ]
     195                 :            :         {
     196         [ #  # ]:          0 :             if ( !bAll )
     197                 :            :             {
     198                 :          0 :                 Color aFillCol = GetFillColor();
     199         [ #  # ]:          0 :                 SetFillColor( rWinColor );
     200         [ #  # ]:          0 :                 DrawRect( Lines[i] );
     201         [ #  # ]:          0 :                 SetFillColor( aFillCol );
     202                 :            :             }
     203         [ #  # ]:          0 :             DrawRect( aRect );
     204                 :          0 :             Lines[i] = aRect;
     205                 :            :         }
     206                 :            : 
     207         [ #  # ]:          0 :         if ( 5 == i )
     208                 :            :         {
     209                 :          0 :             long nBottom = nLower * aLineSiz.Height() / aSize.Height();
     210                 :          0 :             aPnt.Y() += nBottom * 2;
     211                 :            :         }
     212                 :            : 
     213                 :          0 :         aPnt.Y() += nH;
     214                 :            :         // Reset, recalculate for each line
     215                 :          0 :         aPnt.X() = DEF_MARGIN / 2;
     216                 :          0 :         aSiz = aLineSiz;
     217                 :            :     }
     218                 :          0 : }
     219                 :            : 
     220                 :            : #undef DEF_MARGIN
     221                 :            : 
     222                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10