LCOV - code coverage report
Current view: top level - sc/source/filter/excel - fontbuff.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 60 0.0 %
Date: 2014-04-14 Functions: 0 5 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 "lotfntbf.hxx"
      22             : 
      23             : #include "scitems.hxx"
      24             : #include <editeng/contouritem.hxx>
      25             : #include <editeng/crossedoutitem.hxx>
      26             : #include <editeng/eeitem.hxx>
      27             : #include <editeng/postitem.hxx>
      28             : #include <editeng/shdditem.hxx>
      29             : #include <editeng/escapementitem.hxx>
      30             : #include <editeng/udlnitem.hxx>
      31             : #include <editeng/wghtitem.hxx>
      32             : #include <sfx2/printer.hxx>
      33             : 
      34             : #include "attrib.hxx"
      35             : #include "document.hxx"
      36             : #include "global.hxx"
      37             : #include "docpool.hxx"
      38             : #include "patattr.hxx"
      39             : #include "ftools.hxx"
      40             : 
      41           0 : void LotusFontBuffer::Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet )
      42             : {
      43           0 :     sal_uInt8   nIntIndex = nIndex & 0x07;
      44             : 
      45           0 :     ENTRY*  pAkt = pData + nIntIndex;
      46             : 
      47           0 :     if( pAkt->pFont )
      48           0 :         rItemSet.Put( *pAkt->pFont );
      49             : 
      50           0 :     if( pAkt->pHeight )
      51           0 :         rItemSet.Put( *pAkt->pHeight );
      52             : 
      53           0 :     if( pAkt->pColor )
      54           0 :         rItemSet.Put( *pAkt->pColor );
      55             : 
      56           0 :     if( nIndex & 0x08 )
      57             :     {
      58           0 :         SvxWeightItem aWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT );
      59           0 :         rItemSet.Put( aWeightItem );
      60             :     }
      61             : 
      62           0 :     if( nIndex & 0x10 )
      63             :     {
      64           0 :         SvxPostureItem aAttr( ITALIC_NORMAL, ATTR_FONT_POSTURE );
      65           0 :         rItemSet.Put( aAttr );
      66             :     }
      67             : 
      68             :     FontUnderline eUnderline;
      69           0 :     switch( nIndex & 0x60 ) // Bit 5+6
      70             :     {
      71             :         case 0x60:
      72           0 :         case 0x20:  eUnderline = UNDERLINE_SINGLE;      break;
      73           0 :         case 0x40:  eUnderline = UNDERLINE_DOUBLE;      break;
      74           0 :         default:    eUnderline = UNDERLINE_NONE;
      75             :     }
      76           0 :     if( eUnderline != UNDERLINE_NONE )
      77             :     {
      78           0 :         SvxUnderlineItem aUndItem( eUnderline, ATTR_FONT_UNDERLINE );
      79           0 :         rItemSet.Put( aUndItem );
      80             :     }
      81           0 : }
      82             : 
      83             : 
      84           0 : void LotusFontBuffer::SetName( const sal_uInt16 nIndex, const OUString& rName )
      85             : {
      86             :     OSL_ENSURE( nIndex < nSize, "*LotusFontBuffer::SetName(): Array too small!" );
      87           0 :     if( nIndex < nSize )
      88             :     {
      89           0 :         ENTRY* pEntry = pData + nIndex;
      90           0 :         pEntry->TmpName( rName );
      91             : 
      92           0 :         if( pEntry->nType >= 0 )
      93           0 :             MakeFont( pEntry );
      94             :     }
      95           0 : }
      96             : 
      97             : 
      98           0 : void LotusFontBuffer::SetHeight( const sal_uInt16 nIndex, const sal_uInt16 nHeight )
      99             : {
     100             :     OSL_ENSURE( nIndex < nSize, "*LotusFontBuffer::SetHeight(): Array too small!" );
     101           0 :     if( nIndex < nSize )
     102           0 :         pData[ nIndex ].Height( *( new SvxFontHeightItem( ( sal_uLong ) nHeight * 20, 100, ATTR_FONT_HEIGHT ) ) );
     103           0 : }
     104             : 
     105             : 
     106           0 : void LotusFontBuffer::SetType( const sal_uInt16 nIndex, const sal_uInt16 nType )
     107             : {
     108             :     OSL_ENSURE( nIndex < nSize, "*LotusFontBuffer::SetType(): Array too small!" );
     109           0 :     if( nIndex < nSize )
     110             :     {
     111           0 :         ENTRY* pEntry = pData + nIndex;
     112           0 :         pEntry->Type( nType );
     113             : 
     114           0 :         if( pEntry->pTmpName )
     115           0 :             MakeFont( pEntry );
     116             :     }
     117           0 : }
     118             : 
     119             : 
     120           0 : void LotusFontBuffer::MakeFont( ENTRY* pEntry )
     121             : {
     122           0 :     FontFamily      eFamily = FAMILY_DONTKNOW;
     123           0 :     FontPitch       ePitch = PITCH_DONTKNOW;
     124           0 :     rtl_TextEncoding eCharSet = RTL_TEXTENCODING_DONTKNOW;
     125             : 
     126           0 :     switch( pEntry->nType )
     127             :     {
     128             :         case 0x00:                      // Helvetica
     129           0 :             eFamily = FAMILY_SWISS;
     130           0 :             ePitch  = PITCH_VARIABLE;
     131           0 :             break;
     132             :         case 0x01:                      // Times Roman
     133           0 :             eFamily = FAMILY_ROMAN;
     134           0 :             ePitch  = PITCH_VARIABLE;
     135           0 :             break;
     136             :         case 0x02:                      // Courier
     137           0 :             ePitch  = PITCH_FIXED;
     138           0 :             break;
     139             :         case 0x03:                      // Symbol
     140           0 :             eCharSet = RTL_TEXTENCODING_SYMBOL;
     141           0 :             break;
     142             :     }
     143             : 
     144           0 :     pEntry->pFont = new SvxFontItem( eFamily, *pEntry->pTmpName, EMPTY_OUSTRING, ePitch, eCharSet, ATTR_FONT );
     145             : 
     146           0 :     delete pEntry->pTmpName;
     147           0 :     pEntry->pTmpName = NULL;
     148           0 : }
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10