LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpfont.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 175 205 85.4 %
Date: 2012-08-25 Functions: 34 38 89.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 93 136 68.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  *  The Contents of this file are made available subject to the terms of
       5                 :            :  *  either of the following licenses
       6                 :            :  *
       7                 :            :  *         - GNU Lesser General Public License Version 2.1
       8                 :            :  *         - Sun Industry Standards Source License Version 1.1
       9                 :            :  *
      10                 :            :  *  Sun Microsystems Inc., October, 2000
      11                 :            :  *
      12                 :            :  *  GNU Lesser General Public License Version 2.1
      13                 :            :  *  =============================================
      14                 :            :  *  Copyright 2000 by Sun Microsystems, Inc.
      15                 :            :  *  901 San Antonio Road, Palo Alto, CA 94303, USA
      16                 :            :  *
      17                 :            :  *  This library is free software; you can redistribute it and/or
      18                 :            :  *  modify it under the terms of the GNU Lesser General Public
      19                 :            :  *  License version 2.1, as published by the Free Software Foundation.
      20                 :            :  *
      21                 :            :  *  This library is distributed in the hope that it will be useful,
      22                 :            :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      23                 :            :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24                 :            :  *  Lesser General Public License for more details.
      25                 :            :  *
      26                 :            :  *  You should have received a copy of the GNU Lesser General Public
      27                 :            :  *  License along with this library; if not, write to the Free Software
      28                 :            :  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      29                 :            :  *  MA  02111-1307  USA
      30                 :            :  *
      31                 :            :  *
      32                 :            :  *  Sun Industry Standards Source License Version 1.1
      33                 :            :  *  =================================================
      34                 :            :  *  The contents of this file are subject to the Sun Industry Standards
      35                 :            :  *  Source License Version 1.1 (the "License"); You may not use this file
      36                 :            :  *  except in compliance with the License. You may obtain a copy of the
      37                 :            :  *  License at http://www.openoffice.org/license.html.
      38                 :            :  *
      39                 :            :  *  Software provided under this License is provided on an "AS IS" basis,
      40                 :            :  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
      41                 :            :  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
      42                 :            :  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
      43                 :            :  *  See the License for the specific provisions governing your rights and
      44                 :            :  *  obligations concerning the Software.
      45                 :            :  *
      46                 :            :  *  The Initial Developer of the Original Code is: IBM Corporation
      47                 :            :  *
      48                 :            :  *  Copyright: 2008 by IBM Corporation
      49                 :            :  *
      50                 :            :  *  All Rights Reserved.
      51                 :            :  *
      52                 :            :  *  Contributor(s): _______________________________________
      53                 :            :  *
      54                 :            :  *
      55                 :            :  ************************************************************************/
      56                 :            : #include "lwpglobalmgr.hxx"
      57                 :            : #include "lwpfont.hxx"
      58                 :            : #include "xfilter/xfstylemanager.hxx"
      59                 :            : #include "xfilter/xffontfactory.hxx"
      60                 :            : 
      61                 :         75 : void LwpFontAttrEntry::Read(LwpObjectStream *pStrm)
      62                 :            : {
      63                 :         75 :     m_nAttrBits = pStrm->QuickReaduInt16();
      64                 :         75 :     m_nAttrOverrideBits = pStrm->QuickReaduInt16();
      65                 :         75 :     m_nAttrApplyBits = pStrm->QuickReaduInt16();
      66                 :         75 :     m_nAttrOverrideBits2 = pStrm->QuickReaduInt8();
      67                 :         75 :     m_nAttrApplyBits2 = pStrm->QuickReaduInt8();
      68                 :         75 :     m_nCase = pStrm->QuickReaduInt8();
      69                 :         75 :     m_nUnder = pStrm->QuickReaduInt8();
      70                 :         75 :     pStrm->SkipExtra();
      71                 :         75 : }
      72                 :            : 
      73                 :            : #include "xfilter/xfdefs.hxx"
      74                 :        312 : void LwpFontAttrEntry::Override( XFFont*pFont )
      75                 :            : {
      76         [ +  + ]:        312 :     if (IsBoldOverridden())
      77                 :        267 :         pFont->SetBold(Is(BOLD));
      78                 :            : 
      79         [ +  + ]:        312 :     if (IsItalicOverridden())
      80                 :        219 :         pFont->SetItalic(Is(ITALIC));
      81                 :            : 
      82         [ +  + ]:        312 :     if (IsStrikeThruOverridden())
      83                 :            :     {
      84         [ +  + ]:        183 :         if(Is(STRIKETHRU))
      85                 :            :         {
      86                 :          3 :             pFont->SetCrossout(enumXFCrossoutSignel);
      87                 :            :         }
      88                 :            :         else
      89                 :            :         {
      90                 :        180 :             pFont->SetCrossout(enumXFCrossoutNone);
      91                 :            :         }
      92                 :            :     }
      93                 :            : 
      94         [ +  + ]:        312 :     if (IsSuperOverridden())
      95                 :            :     {
      96         [ +  + ]:        186 :         if(Is(SUPERSCRIPT))
      97                 :          3 :             pFont->SetPosition(sal_True);
      98                 :            :     }
      99                 :            : 
     100         [ +  + ]:        312 :     if (IsSubOverridden())
     101                 :            :     {
     102         [ +  + ]:        186 :         if(Is(SUBSCRIPT))
     103                 :          3 :             pFont->SetPosition(sal_False);
     104                 :            :     }
     105                 :            : 
     106         [ +  + ]:        312 :     if (IsUnderlineOverridden())
     107                 :            :     {
     108   [ +  -  -  -  :        183 :         switch(m_nUnder)
                      + ]
     109                 :            :         {
     110                 :            :             case UNDER_SINGLE:
     111                 :          3 :                 pFont->SetUnderline(enumXFUnderlineSingle);
     112                 :          3 :                 break;
     113                 :            :             case UNDER_DOUBLE:
     114                 :          0 :                 pFont->SetUnderline(enumXFUnderlineDouble);
     115                 :          0 :                 break;
     116                 :            :             case UNDER_WORD_SINGLE:
     117                 :          0 :                 pFont->SetUnderline(enumXFUnderlineSingle, true);
     118                 :          0 :                 break;
     119                 :            :             case UNDER_WORD_DOUBLE:
     120                 :          0 :                 pFont->SetUnderline(enumXFUnderlineSingle, true);
     121                 :          0 :                 break;
     122                 :            :             case UNDER_DONTCARE:    //fall through
     123                 :            :             case UNDER_OFF:         //fall through
     124                 :            :             case UNDER_STYLE:       //fall through
     125                 :            :             default:
     126                 :        183 :                 break;
     127                 :            :                 //do nothing;
     128                 :            :         }
     129                 :            :     }
     130                 :            : 
     131         [ +  + ]:        312 :     if (IsCaseOverridden())
     132                 :            :     {
     133   [ -  -  +  -  :        180 :         switch(m_nCase)
                      - ]
     134                 :            :         {
     135                 :            :         case CASE_UPPER:
     136                 :          0 :             pFont->SetTransform(enumXFTransformUpper);
     137                 :          0 :             break;
     138                 :            :         case CASE_LOWER:
     139                 :          0 :             pFont->SetTransform(enumXFTransformLower);
     140                 :          0 :             break;
     141                 :            :         case CASE_NORMAL:
     142                 :        180 :             pFont->SetTransform(enumXFTransformNone);
     143                 :        180 :             break;
     144                 :            :         case CASE_INITCAPS:
     145                 :          0 :             pFont->SetTransform(enumXFTransformCapitalize);
     146                 :        180 :             break;
     147                 :            :         case CASE_STYLE:        //fall through
     148                 :            :         case CASE_DONTCARE: //fall through
     149                 :            :         default:
     150                 :            :             //do nothing
     151                 :            :             ;
     152                 :            :         }
     153                 :            :     }
     154                 :            : 
     155                 :            :     //Please note that, put the SmallCaps setting after the case setting,
     156                 :            :     //for SmallCaps has higher priority than LowerCase but low
     157         [ +  + ]:        312 :     if (IsSmallCapsOverridden())
     158                 :            :     {
     159         [ +  - ]:        180 :         if( pFont->GetTransform()!=enumXFTransformUpper )   //SmallCaps should not override upper case
     160                 :            :         {
     161         [ -  + ]:        180 :             if(Is(SMALLCAPS))
     162                 :          0 :                 pFont->SetTransform(enumXFTransformSmallCaps);
     163                 :            :         }
     164                 :            :     }
     165                 :            : 
     166                 :            :     // TODO: tightness
     167                 :            :     //if (IsTightnessOverridden())
     168                 :            :     //  pFont->SetTightness(cTightness);*/
     169                 :        312 : }
     170                 :            : 
     171                 :       1221 : sal_Bool LwpFontAttrEntry::Is(sal_uInt16 Attr)
     172                 :            : {
     173                 :       1221 :     return (0 != (m_nAttrBits & Attr));
     174                 :            : }
     175                 :            : 
     176                 :        312 : sal_Bool LwpFontAttrEntry::IsBoldOverridden()
     177                 :            : {
     178                 :        312 :     return (0 != (m_nAttrOverrideBits & BOLD));
     179                 :            : }
     180                 :            : 
     181                 :        312 : sal_Bool LwpFontAttrEntry::IsItalicOverridden()
     182                 :            : {
     183                 :        312 :     return (0 != (m_nAttrOverrideBits & ITALIC));
     184                 :            : }
     185                 :        312 : sal_Bool LwpFontAttrEntry::IsStrikeThruOverridden()
     186                 :            : {
     187                 :        312 :     return (0 != (m_nAttrOverrideBits & STRIKETHRU));
     188                 :            : }
     189                 :        312 : sal_Bool LwpFontAttrEntry::IsSmallCapsOverridden()
     190                 :            : {
     191                 :        312 :     return (0 != (m_nAttrOverrideBits & SMALLCAPS));
     192                 :            : }
     193                 :        312 : sal_Bool LwpFontAttrEntry::IsSuperOverridden()
     194                 :            : {
     195                 :        312 :     return (0 != (m_nAttrOverrideBits & SUPERSCRIPT));
     196                 :            : 
     197                 :            : }
     198                 :        312 : sal_Bool LwpFontAttrEntry::IsSubOverridden()
     199                 :            : {
     200                 :        312 :     return (0 != (m_nAttrOverrideBits & SUBSCRIPT));
     201                 :            : 
     202                 :            : }
     203                 :            : 
     204                 :        312 : sal_Bool LwpFontAttrEntry::IsUnderlineOverridden()
     205                 :            : {
     206                 :        312 :     return (0 != (m_nAttrOverrideBits2 & UNDER));
     207                 :            : }
     208                 :        312 : sal_Bool LwpFontAttrEntry::IsCaseOverridden()
     209                 :            : {
     210                 :        312 :     return (0 != (m_nAttrOverrideBits2 & CASE));
     211                 :            : }
     212                 :            : 
     213                 :         78 : void LwpFontTableEntry::Read(LwpObjectStream *pStrm)
     214                 :            : {
     215         [ +  - ]:         78 :     m_WindowsFaceName.Read(pStrm);
     216                 :            : 
     217                 :            :     // use the m_WindowsFaceName to set the m_FaceName temporarily
     218                 :         78 :     m_FaceName = m_WindowsFaceName;
     219                 :            : 
     220                 :            :     //Skip the panoseNumber
     221                 :            :     //m_PanoseNumber.Read(pStrm);
     222                 :         78 :     LwpPanoseNumber thePanoseToSkip;
     223         [ +  - ]:         78 :     thePanoseToSkip.Read(pStrm);
     224                 :            : 
     225         [ +  - ]:         78 :     pStrm->SkipExtra();
     226                 :            : 
     227         [ +  - ]:         78 :     RegisterFontDecl();
     228                 :         78 : }
     229                 :            : 
     230                 :        864 : OUString LwpFontTableEntry::GetFaceName()
     231                 :            : {
     232                 :        864 :     return (m_WindowsFaceName.str());
     233                 :            : }
     234                 :            : 
     235                 :         78 : void LwpFontTableEntry::RegisterFontDecl()
     236                 :            : {
     237         [ +  + ]:        156 :     if(m_FaceName.str().isEmpty()) return;
     238         [ +  - ]:         66 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     239         [ +  - ]:         66 :     XFFontDecl aFontDecl1( m_FaceName.str(), m_FaceName.str(), false );
     240         [ +  - ]:         78 :     pXFStyleManager->AddFontDecl(aFontDecl1);
     241                 :            : }
     242                 :            : 
     243                 :         27 : LwpFontTable::LwpFontTable()
     244                 :            :     : m_nCount(0)
     245                 :         27 :     , m_pFontEntries(NULL)
     246                 :         27 : {}
     247                 :            : 
     248                 :         27 : void LwpFontTable::Read(LwpObjectStream *pStrm)
     249                 :            : {
     250                 :         27 :     m_pFontEntries = NULL;
     251                 :         27 :     m_nCount = pStrm->QuickReaduInt16();
     252         [ +  + ]:         27 :     if(m_nCount>0)
     253                 :            :     {
     254 [ +  - ][ +  +  :         90 :         m_pFontEntries = new LwpFontTableEntry[m_nCount];
             #  #  #  # ]
     255         [ +  + ]:         90 :         for(sal_uInt16 i=0; i<m_nCount; i++)
     256                 :            :         {
     257                 :         78 :             m_pFontEntries[i].Read(pStrm);
     258                 :            :         }
     259                 :            :     }
     260                 :         27 :     pStrm->SkipExtra();
     261                 :         27 : }
     262                 :            : 
     263                 :        864 : OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1
     264                 :            : {
     265                 :            :     assert(index <= m_nCount && index > 0);
     266 [ +  - ][ +  - ]:        864 :     return (index <= m_nCount && index > 0) ? m_pFontEntries[index-1].GetFaceName() : OUString();
     267                 :            : }
     268                 :            : 
     269                 :         24 : LwpFontTable::~LwpFontTable()
     270                 :            : {
     271         [ +  + ]:         24 :     if(m_pFontEntries)
     272                 :            :     {
     273 [ +  - ][ +  + ]:         90 :         delete [] m_pFontEntries;
     274                 :         12 :         m_pFontEntries = NULL;
     275                 :            :     }
     276                 :         24 : }
     277                 :            : 
     278                 :        243 : void LwpFontNameEntry::Read(LwpObjectStream *pStrm)
     279                 :            : {
     280                 :            :     //Read CFontDescriptionOverrideBase
     281                 :        243 :     m_nOverrideBits = pStrm->QuickReaduInt8();
     282                 :        243 :     m_nApplyBits = pStrm->QuickReaduInt8();
     283                 :        243 :     m_nPointSize = pStrm->QuickReaduInt32();
     284                 :        243 :     m_nOverstrike = pStrm->QuickReaduInt16();
     285                 :        243 :     m_nTightness = pStrm->QuickReaduInt16();
     286                 :        243 :     m_Color.Read(pStrm);
     287                 :        243 :     m_BackColor.Read(pStrm);
     288                 :        243 :     pStrm->SkipExtra();
     289                 :            : 
     290                 :            :     //Read data of LwpFontNameEntry
     291                 :        243 :     m_nFaceName = pStrm->QuickReaduInt16();
     292                 :        243 :     m_nAltFaceName = pStrm->QuickReaduInt16();
     293                 :        243 :     pStrm->SkipExtra();
     294                 :        243 : }
     295                 :            : #include "xfilter/xfcolor.hxx"
     296                 :        750 : void LwpFontNameEntry::Override(XFFont* pFont)
     297                 :            : {
     298         [ +  + ]:        750 :     if (IsPointSizeOverridden())
     299                 :        708 :         pFont->SetFontSize(static_cast<sal_uInt8>(m_nPointSize/65536L));
     300                 :            : 
     301 [ +  + ][ +  - ]:        750 :     if (IsColorOverridden() && m_Color.IsValidColor())
                 [ +  + ]
     302                 :            :     {
     303         [ +  - ]:        285 :         XFColor aColor(m_Color.To24Color());
     304                 :        285 :         pFont->SetColor(aColor);
     305                 :            :     }
     306                 :            : 
     307                 :            : 
     308         [ +  + ]:        750 :     if (IsBackgroundColorOverridden() )
     309                 :            :     {
     310         [ -  + ]:        180 :         if (m_BackColor.IsValidColor())
     311                 :            :         {
     312         [ #  # ]:          0 :             XFColor aColor(m_BackColor.To24Color());
     313                 :          0 :             pFont->SetBackColor( aColor );
     314                 :            :         }
     315         [ +  - ]:        180 :         else if (m_BackColor.IsTransparent())
     316                 :            :         {
     317                 :        180 :             pFont->SetBackColorTransparent();
     318                 :            :         }
     319                 :            :     }
     320                 :            : 
     321                 :            :     // TODO: tightness
     322                 :            :     //if (IsTightnessOverridden())
     323                 :            :     //  pFont->SetTightness(cTightness);
     324                 :        750 : }
     325                 :            : 
     326                 :        750 : sal_Bool LwpFontNameEntry::IsFaceNameOverridden()
     327                 :            : {
     328                 :        750 :     return (0 != (m_nOverrideBits & FACENAME));
     329                 :            : }
     330                 :            : 
     331                 :        750 : sal_Bool LwpFontNameEntry::IsAltFaceNameOverridden()
     332                 :            : {
     333                 :        750 :     return (0 != (m_nOverrideBits & ALTFACENAME));
     334                 :            : }
     335                 :            : 
     336                 :        750 : sal_Bool LwpFontNameEntry::IsPointSizeOverridden()
     337                 :            : {
     338                 :        750 :     return (0 != (m_nOverrideBits & POINTSIZE));
     339                 :            : }
     340                 :            : 
     341                 :        750 : sal_Bool LwpFontNameEntry::IsColorOverridden()
     342                 :            : {
     343                 :        750 :     return (0 != (m_nOverrideBits & COLOR));
     344                 :            : }
     345                 :            : 
     346                 :        750 : sal_Bool LwpFontNameEntry::IsBackgroundColorOverridden()
     347                 :            : {
     348                 :        750 :     return (0 != (m_nOverrideBits & BKCOLOR));
     349                 :            : }
     350                 :            : 
     351                 :            : //TODO
     352                 :            : //sal_Bool LwpFontNameEntry::IsTightnessOverridden()
     353                 :            : //{
     354                 :            : //    return (0 != (m_nOverrideBits & TIGHTNESS));
     355                 :            : //}
     356                 :            : 
     357                 :            : //sal_Bool LwpFontNameEntry::IsAnythingOverridden()
     358                 :            : //{
     359                 :            : //    return (0 != (m_nOverrideBits & ALL_BITS));
     360                 :            : //}
     361                 :            : 
     362                 :            : 
     363                 :         27 : LwpFontNameManager::LwpFontNameManager()
     364                 :         27 :     :m_pFontNames(NULL)
     365                 :         27 : {}
     366                 :            : 
     367                 :         24 : LwpFontNameManager::~LwpFontNameManager()
     368                 :            : {
     369         [ +  + ]:         24 :     if(m_pFontNames)
     370                 :            :     {
     371 [ +  - ][ +  + ]:        255 :         delete [] m_pFontNames;
     372                 :         12 :         m_pFontNames = NULL;
     373                 :            :     }
     374                 :         24 : }
     375                 :            : 
     376                 :         27 : void LwpFontNameManager::Read(LwpObjectStream *pStrm)
     377                 :            : {
     378                 :         27 :     m_nCount = pStrm->QuickReaduInt16();
     379         [ +  + ]:         27 :     if(m_nCount>0)
     380                 :            :     {
     381         [ +  + ]:        255 :         m_pFontNames = new LwpFontNameEntry[m_nCount];
     382         [ +  + ]:        255 :         for(sal_uInt16 i=0; i<m_nCount; i++)
     383                 :            :         {
     384                 :        243 :             m_pFontNames[i].Read(pStrm);
     385                 :            :         }
     386                 :            :     }
     387                 :         27 :     m_FontTbl.Read(pStrm);
     388                 :         27 :     pStrm->SkipExtra();
     389                 :         27 : }
     390                 :            : 
     391                 :        774 : void    LwpFontNameManager::Override(sal_uInt16 index, XFFont* pFont)
     392                 :            :     //index: start from 1
     393                 :            : {
     394 [ +  - ][ +  + ]:        774 :     if (index > m_nCount || index < 1)
     395                 :        774 :         return ;
     396                 :            : 
     397                 :        750 :     m_pFontNames[index-1].Override(pFont);
     398         [ +  + ]:        750 :     if(m_pFontNames[index-1].IsFaceNameOverridden())
     399         [ +  - ]:        684 :         pFont->SetFontName(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetFaceID()));
     400         [ +  + ]:        750 :     if(m_pFontNames[index-1].IsAltFaceNameOverridden())
     401                 :        180 :         pFont->SetFontNameAsia(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetAltFaceID()));
     402                 :            : }
     403                 :          0 : OUString LwpFontNameManager::GetNameByIndex(sal_uInt16 index)
     404                 :            : {
     405                 :          0 :     sal_uInt16 nameindex = m_pFontNames[index-1].GetFaceID();
     406                 :          0 :     return (m_FontTbl.GetFaceName(nameindex));
     407                 :            : }
     408                 :            : 
     409                 :         27 : void LwpFontAttrManager::Read(LwpObjectStream *pStrm)
     410                 :            : {
     411                 :         27 :     m_nCount = pStrm->QuickReaduInt16();
     412         [ +  + ]:        102 :     m_pFontAttrs = new LwpFontAttrEntry[m_nCount];
     413                 :            : 
     414         [ +  + ]:        102 :     for(sal_uInt16 i=0; i<m_nCount; i++)
     415                 :            :     {
     416                 :         75 :         m_pFontAttrs[i].Read(pStrm);
     417                 :            :     }
     418                 :         27 :     pStrm->SkipExtra();
     419                 :         27 : }
     420                 :            : 
     421                 :        774 : void    LwpFontAttrManager::Override(sal_uInt16 index, XFFont* pFont)
     422                 :            :     //index: start from 1
     423                 :            : {
     424 [ +  - ][ +  + ]:        774 :     if (index > m_nCount || index < 1)
     425                 :        774 :         return ;
     426                 :            : 
     427                 :        312 :     m_pFontAttrs[index-1].Override(pFont);
     428                 :            : }
     429                 :            : 
     430                 :         24 : LwpFontAttrManager::~LwpFontAttrManager()
     431                 :            : {
     432         [ +  - ]:         24 :     if(m_pFontAttrs)
     433 [ +  - ][ +  + ]:         99 :         delete []m_pFontAttrs;
     434                 :         24 : }
     435                 :            : 
     436                 :         27 : void LwpFontManager::Read(LwpObjectStream *pStrm)
     437                 :            : {
     438                 :         27 :     m_FNMgr.Read(pStrm);
     439                 :         27 :     m_AttrMgr.Read(pStrm);
     440                 :         27 :     pStrm->SkipExtra();
     441                 :            : 
     442                 :         27 : }
     443                 :            : 
     444                 :            : #include "xfilter/xftextstyle.hxx"
     445                 :            : 
     446                 :            : /*
     447                 :            : VO_PARASTYLE call this method to add its style to XFStyleManager based on the fontID
     448                 :            : 1. Construct the text style based on the fontID
     449                 :            : 2. Add the style to XFStyleManager, and return the <office:styles> style name
     450                 :            : 3. Add it to LwpParaStyleMap.
     451                 :            : Note: A temporary method for only font support phase. The next AddStyle should be used later.
     452                 :            : // To be replaced by LwpStyleManager::AddStyle() and the following CreateFont()
     453                 :            : */
     454                 :            : /*void LwpFontManager::AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName)
     455                 :            : {
     456                 :            :     XFTextStyle* pStyle = new XFTextStyle();        //to be deleted by XFStyleManager
     457                 :            :     AddStyle(styleObjID, fontID, styleName, pStyle);
     458                 :            : }*/
     459                 :            : 
     460                 :            : /*
     461                 :            : VO_PARASTYLE/VO_CHARACTERSTYLE call this method to add its style to XFStyleManager based on the fontID
     462                 :            : 1. Construct the text style based on the fontID
     463                 :            : 2. Add the style to XFStyleManager, and return the <office:styles> style name
     464                 :            : 3. Add it to LwpParaStyleMap.
     465                 :            : Prerequisite: pStyle has been created and the paragraph properties has been set to it.
     466                 :            : //To be replaced by LwpStyleManager::AddStyle() and the following CreateFont()
     467                 :            : */
     468                 :            : /*void LwpFontManager::AddStyle(LwpObjectID styleObjID, sal_uInt32 fontID, OUString styleName, XFTextStyle* pStyle)
     469                 :            : {
     470                 :            :     assert(pStyle);
     471                 :            :     XFFont* pFont = CreateFont(fontID);
     472                 :            :     pStyle->SetFont(pFont);
     473                 :            :     pStyle->SetStyleName(styleName);
     474                 :            :     XFStyleManager::AddStyle(pStyle);
     475                 :            :     m_StyleList.insert(LwpParaStyleMap::value_type(styleObjID, styleName));
     476                 :            : }*/
     477                 :            : 
     478                 :            : /*
     479                 :            : Create XFFont based on the fotID
     480                 :            : */
     481                 :        774 : XFFont* LwpFontManager::CreateFont(sal_uInt32 fontID)
     482                 :            : {
     483         [ +  - ]:        774 :     XFFont* pFont = new XFFont();
     484                 :        774 :     m_FNMgr.Override(GetFontNameIndex(fontID), pFont);
     485                 :        774 :     m_AttrMgr.Override(GetFontAttrIndex(fontID), pFont);
     486                 :        774 :     return pFont;
     487                 :            : }
     488                 :            : 
     489                 :            : /*
     490                 :            : Called XFFont based on the override result of two font ids.
     491                 :            : Refer to CFontManager::OverrideID
     492                 :            : */
     493                 :            : //OUString LwpFontManager::GetOverrideStyle(sal_uInt32 fontID, sal_uInt32 overID)
     494                 :          0 : XFFont* LwpFontManager::CreateOverrideFont(sal_uInt32 fontID, sal_uInt32 overID)
     495                 :            : {
     496         [ #  # ]:          0 :     XFFont* pFont = new XFFont();   //To be deleted by XFFontFactory
     497         [ #  # ]:          0 :     if(fontID)
     498                 :            :     {
     499                 :          0 :         Override(fontID, pFont);
     500                 :            :     }
     501         [ #  # ]:          0 :     if(overID)
     502                 :            :     {
     503                 :          0 :         Override(overID, pFont);
     504                 :            :     }
     505                 :          0 :     return pFont;
     506                 :            : }
     507                 :            : 
     508                 :          0 : void LwpFontManager::Override(sal_uInt32 fontID, XFFont* pFont)
     509                 :            : {
     510                 :          0 :     m_FNMgr.Override(GetFontNameIndex(fontID), pFont);
     511                 :          0 :     m_AttrMgr.Override(GetFontAttrIndex(fontID), pFont);
     512                 :          0 : }
     513                 :            : 
     514                 :          0 : OUString LwpFontManager::GetNameByID(sal_uInt32 fontID)
     515                 :            : {
     516                 :          0 :     return ( m_FNMgr.GetNameByIndex(GetFontNameIndex(fontID)) );//use font id for bullet?
     517                 :            : }
     518                 :            : 
     519                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10