LCOV - code coverage report
Current view: top level - sc/source/filter/qpro - qprostyle.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 61 9.8 %
Date: 2012-08-25 Functions: 1 2 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 100 3.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 <sal/config.h>
      30                 :            : #include <stdio.h>
      31                 :            : #include <sfx2/docfile.hxx>
      32                 :            : 
      33                 :            : #include "qproform.hxx"
      34                 :            : #include "qpro.hxx"
      35                 :            : #include "qprostyle.hxx"
      36                 :            : 
      37                 :            : #include <scitems.hxx>
      38                 :            : #include <svx/algitem.hxx>
      39                 :            : #include <editeng/udlnitem.hxx>
      40                 :            : #include <editeng/wghtitem.hxx>
      41                 :            : #include <editeng/postitem.hxx>
      42                 :            : #include <editeng/crsditem.hxx>
      43                 :            : #include <editeng/fhgtitem.hxx>
      44                 :            : #include <editeng/fontitem.hxx>
      45                 :            : #include <editeng/justifyitem.hxx>
      46                 :            : #include <map>
      47                 :            : 
      48                 :            : #include "global.hxx"
      49                 :            : #include "scerrors.hxx"
      50                 :            : #include "docpool.hxx"
      51                 :            : #include "patattr.hxx"
      52                 :            : #include "filter.hxx"
      53                 :            : #include "document.hxx"
      54                 :            : #include "cell.hxx"
      55                 :            : 
      56 [ +  - ][ +  +  :       2313 : ScQProStyle::ScQProStyle()
             #  #  #  # ]
      57                 :            : {
      58                 :          9 :     memset (maAlign, 0, sizeof (maAlign));
      59                 :          9 :     memset (maFont, 0, sizeof (maFont));
      60                 :          9 :     memset (maFontRecord, 0, sizeof (maFontRecord));
      61                 :          9 :     memset (maFontHeight, 0, sizeof (maFontHeight));
      62                 :          9 : }
      63                 :            : 
      64                 :          0 : void ScQProStyle::SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, SCTAB nTab, sal_uInt16 nStyle )
      65                 :            : {
      66         [ #  # ]:          0 :     if (nStyle >= maxsize)
      67                 :          0 :         return;
      68                 :            : 
      69 [ #  # ][ #  # ]:          0 :     ScPatternAttr aPattern(pDoc->GetPool());
      70                 :          0 :     SfxItemSet& rItemSet = aPattern.GetItemSet();
      71                 :            : 
      72                 :          0 :     sal_uInt8 nTmp = maAlign[ nStyle ];
      73                 :          0 :     sal_uInt8 nHor = ( nTmp & 0x07 );
      74                 :          0 :     sal_uInt8 nVer = ( nTmp & 0x18 );
      75                 :          0 :     sal_uInt8 nOrient = ( nTmp & 0x60 );
      76                 :            : 
      77                 :            :     // Horizontal Alignment
      78                 :          0 :     SvxCellHorJustify eJustify = SVX_HOR_JUSTIFY_STANDARD;
      79   [ #  #  #  #  :          0 :     switch( nHor )
                   #  # ]
      80                 :            :     {
      81                 :            :         case 0x00:
      82                 :          0 :             eJustify = SVX_HOR_JUSTIFY_STANDARD;
      83                 :          0 :             break;
      84                 :            : 
      85                 :            :         case 0x01:
      86                 :          0 :             eJustify = SVX_HOR_JUSTIFY_LEFT;
      87                 :          0 :             break;
      88                 :            : 
      89                 :            :         case 0x02:
      90                 :          0 :             eJustify = SVX_HOR_JUSTIFY_CENTER;
      91                 :          0 :             break;
      92                 :            : 
      93                 :            :         case 0x03:
      94                 :          0 :             eJustify = SVX_HOR_JUSTIFY_RIGHT;
      95                 :          0 :             break;
      96                 :            : 
      97                 :            :         case 0x04:
      98                 :          0 :             eJustify = SVX_HOR_JUSTIFY_BLOCK;
      99                 :          0 :             break;
     100                 :            :     }
     101 [ #  # ][ #  # ]:          0 :     rItemSet.Put( SvxHorJustifyItem( eJustify, ATTR_HOR_JUSTIFY ) );
                 [ #  # ]
     102                 :            : 
     103                 :            :     // Vertical Alignment
     104                 :          0 :     SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD;
     105   [ #  #  #  # ]:          0 :     switch( nVer )
     106                 :            :     {
     107                 :            :         case 0x00:
     108                 :          0 :             eVerJustify = SVX_VER_JUSTIFY_BOTTOM;
     109                 :          0 :             break;
     110                 :            : 
     111                 :            :         case 0x08:
     112                 :          0 :             eVerJustify = SVX_VER_JUSTIFY_CENTER;
     113                 :          0 :             break;
     114                 :            : 
     115                 :            :         case 0x10:
     116                 :          0 :             eVerJustify = SVX_VER_JUSTIFY_TOP;
     117                 :          0 :             break;
     118                 :            :     }
     119                 :            : 
     120 [ #  # ][ #  # ]:          0 :     rItemSet.Put(SvxVerJustifyItem( eVerJustify, ATTR_VER_JUSTIFY ) );
                 [ #  # ]
     121                 :            : 
     122                 :            :     // Orientation
     123                 :          0 :     SvxCellOrientation eOrient = SVX_ORIENTATION_STANDARD;
     124         [ #  # ]:          0 :     switch( nOrient )
     125                 :            :     {
     126                 :            :         case 0x20:
     127                 :          0 :             eOrient = SVX_ORIENTATION_TOPBOTTOM;
     128                 :          0 :             break;
     129                 :            : 
     130                 :            :     }
     131 [ #  # ][ #  # ]:          0 :     rItemSet.Put( SvxOrientationItem( eOrient, 0) );
                 [ #  # ]
     132                 :            : 
     133                 :            :     // Wrap cell contents
     134         [ #  # ]:          0 :     if( nTmp & 0x80 )
     135                 :            :     {
     136         [ #  # ]:          0 :         SfxBoolItem aWrapItem( ATTR_LINEBREAK );
     137                 :          0 :         aWrapItem.SetValue( sal_True );
     138 [ #  # ][ #  # ]:          0 :         rItemSet.Put( aWrapItem );
     139                 :            :     }
     140                 :            : 
     141                 :            :     // Font Attributes
     142                 :          0 :     sal_uInt16 nTmpFnt = maFontRecord[ maFont[ nStyle ] ];
     143                 :            :     sal_Bool bIsBold, bIsItalic, bIsUnderLine;
     144                 :            : 
     145                 :          0 :     bIsBold = ( nTmpFnt & 0x0001 ) != 0;
     146                 :          0 :     bIsItalic = ( nTmpFnt & 0x0002 ) != 0;
     147                 :          0 :     bIsUnderLine = ( nTmpFnt & 0x0004 ) != 0;
     148                 :            :     //(nTmpFnt & 0x0020 ) for StrikeThrough
     149                 :            : 
     150         [ #  # ]:          0 :     if( bIsBold )
     151 [ #  # ][ #  # ]:          0 :         rItemSet.Put( SvxWeightItem( WEIGHT_BOLD,ATTR_FONT_WEIGHT) );
                 [ #  # ]
     152         [ #  # ]:          0 :     if( bIsItalic )
     153 [ #  # ][ #  # ]:          0 :         rItemSet.Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
                 [ #  # ]
     154         [ #  # ]:          0 :     if( bIsUnderLine )
     155 [ #  # ][ #  # ]:          0 :         rItemSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
                 [ #  # ]
     156                 :            : 
     157         [ #  # ]:          0 :     if (maFontHeight[ maFont [ nStyle ] ])
     158 [ #  # ][ #  # ]:          0 :         rItemSet.Put( SvxFontHeightItem( (sal_uLong) (20 * maFontHeight[ maFont[ nStyle ] ] ), 100, ATTR_FONT_HEIGHT ) );
                 [ #  # ]
     159                 :            : 
     160         [ #  # ]:          0 :     String fntName = maFontType[ maFont[ nStyle ] ];
     161 [ #  # ][ #  # ]:          0 :     rItemSet.Put( SvxFontItem( FAMILY_SYSTEM, fntName, EMPTY_STRING, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ) );
         [ #  # ][ #  # ]
     162                 :            : 
     163 [ #  # ][ #  # ]:          0 :     pDoc->ApplyPattern( nCol, nRow, nTab, aPattern );
                 [ #  # ]
     164                 :            : }
     165                 :            : 
     166                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10