LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter/xfilter - xfparastyle.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 192 288 66.7 %
Date: 2012-08-25 Functions: 18 21 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 136 323 42.1 %

           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                 :            : /*************************************************************************
      57                 :            :  * @file
      58                 :            :  * Styles for paragraph.
      59                 :            :  * Styles for paragraph may include many style,include font,indent,margin,
      60                 :            :  * shadow,line height,and so on.
      61                 :            :  ************************************************************************/
      62                 :            : #include    "xfparastyle.hxx"
      63                 :            : #include    "xffont.hxx"
      64                 :            : #include    "xfborders.hxx"
      65                 :            : #include    "xftabstyle.hxx"
      66                 :            : #include    "xfbgimage.hxx"
      67                 :            : 
      68 [ +  - ][ +  - ]:       1300 : XFParaStyle::XFParaStyle()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      69                 :            : {
      70                 :            :     //init member variables:
      71                 :       1300 :     m_nFlag = 0;
      72                 :       1300 :     m_eAlignType = enumXFAlignNone;
      73                 :       1300 :     m_eLastLineAlign = enumXFAlignNone;
      74                 :       1300 :     m_bJustSingleWord = sal_False;
      75                 :       1300 :     m_bKeepWithNext = sal_False;
      76                 :       1300 :     m_nPageNumber = 0;
      77                 :       1300 :     m_fTextIndent = 0;
      78                 :            : 
      79                 :       1300 :     m_pFont = NULL;
      80                 :       1300 :     m_pBorders = NULL;
      81                 :       1300 :     m_pBGImage = NULL;
      82                 :            : 
      83                 :       1300 :     m_nLineNumberRestart = 0;
      84                 :       1300 :     m_bNumberLines = sal_True;
      85                 :       1300 :     m_bNumberRight = sal_False;
      86                 :       1300 : }
      87                 :            : 
      88 [ #  # ][ #  # ]:          0 : XFParaStyle::XFParaStyle(const XFParaStyle& other) : XFStyle(other)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      89                 :            : {
      90                 :          0 :     m_strParentStyleName = other.m_strParentStyleName;
      91                 :          0 :     m_nFlag = other.m_nFlag;
      92                 :          0 :     m_eAlignType = other.m_eAlignType;
      93                 :          0 :     m_fTextIndent = other.m_fTextIndent;
      94                 :          0 :     m_bNumberLines = other.m_bNumberLines;
      95                 :          0 :     m_nLineNumberRestart = other.m_nLineNumberRestart;
      96                 :          0 :     m_bNumberRight = other.m_bNumberRight;
      97                 :            : 
      98         [ #  # ]:          0 :     if( other.m_pFont )
      99                 :          0 :         m_pFont = other.m_pFont;
     100                 :            :     else
     101                 :          0 :         m_pFont = NULL;
     102                 :            : 
     103         [ #  # ]:          0 :     if( other.m_pBorders )
     104         [ #  # ]:          0 :         m_pBorders = new XFBorders(*other.m_pBorders);
     105                 :            :     else
     106                 :          0 :         m_pBorders = NULL;
     107                 :          0 :     m_aBackColor = other.m_aBackColor;
     108         [ #  # ]:          0 :     if( other.m_pBGImage )
     109 [ #  # ][ #  # ]:          0 :         m_pBGImage = new XFBGImage(*other.m_pBGImage);
     110                 :            :     else
     111                 :          0 :         m_pBGImage = NULL;
     112                 :            : 
     113                 :          0 :     m_aShadow = other.m_aShadow;
     114         [ #  # ]:          0 :     m_aMargin = other.m_aMargin;
     115                 :          0 :     m_aDropcap = other.m_aDropcap;
     116                 :          0 :     m_aLineHeight = other.m_aLineHeight;
     117                 :          0 :     m_aPadding = other.m_aPadding;
     118                 :          0 :     m_aBreaks = other.m_aBreaks;
     119                 :            : 
     120         [ #  # ]:          0 :     for (size_t i=0; i<other.m_aTabs.GetCount(); ++i)
     121                 :            :     {
     122         [ #  # ]:          0 :         const IXFStyle *pStyle = other.m_aTabs.Item(i);
     123         [ #  # ]:          0 :         if( pStyle )
     124                 :            :         {
     125         [ #  # ]:          0 :             const XFTabStyle *pTabStyle = dynamic_cast<const XFTabStyle*>(pStyle);
     126         [ #  # ]:          0 :             if( pTabStyle )
     127                 :            :             {
     128 [ #  # ][ #  # ]:          0 :                 XFTabStyle *pCopyStyle = new XFTabStyle(*pTabStyle);
     129         [ #  # ]:          0 :                 m_aTabs.AddStyle(pCopyStyle);
     130                 :            :             }
     131                 :            :         }
     132                 :            :     }
     133                 :          0 : }
     134                 :            : 
     135                 :        960 : XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
     136                 :            : {
     137                 :            :     // Check for self-assignment
     138         [ +  - ]:        960 :     if (this != &other)
     139                 :            :     {
     140                 :            :         // first , clean member
     141         [ -  + ]:        960 :         delete(m_pBGImage);
     142                 :        960 :         m_aTabs.Reset();
     143                 :            : 
     144                 :        960 :         m_strParentStyleName = other.m_strParentStyleName;
     145                 :        960 :         m_nFlag = other.m_nFlag;
     146                 :        960 :         m_eAlignType = other.m_eAlignType;
     147                 :        960 :         m_fTextIndent = other.m_fTextIndent;
     148                 :        960 :         m_bNumberLines = other.m_bNumberLines;
     149                 :        960 :         m_nLineNumberRestart = other.m_nLineNumberRestart;
     150                 :        960 :         m_bNumberRight = other.m_bNumberRight;
     151                 :            : 
     152         [ +  - ]:        960 :         if( other.m_pFont )
     153                 :        960 :             m_pFont = other.m_pFont;
     154                 :            :         else
     155                 :          0 :             m_pFont = NULL;
     156                 :            : 
     157         [ -  + ]:        960 :         if( other.m_pBorders )
     158                 :          0 :             m_pBorders = new XFBorders(*other.m_pBorders);
     159                 :            :         else
     160                 :        960 :             m_pBorders = NULL;
     161                 :        960 :         m_aBackColor = other.m_aBackColor;
     162         [ -  + ]:        960 :         if( other.m_pBGImage )
     163         [ #  # ]:          0 :             m_pBGImage = new XFBGImage(*other.m_pBGImage);
     164                 :            :         else
     165                 :        960 :             m_pBGImage = NULL;
     166                 :            : 
     167                 :        960 :         m_aShadow = other.m_aShadow;
     168                 :        960 :         m_aMargin = other.m_aMargin;
     169                 :        960 :         m_aDropcap = other.m_aDropcap;
     170                 :        960 :         m_aLineHeight = other.m_aLineHeight;
     171                 :        960 :         m_aPadding = other.m_aPadding;
     172                 :        960 :         m_aBreaks = other.m_aBreaks;
     173                 :            : 
     174         [ -  + ]:        960 :         for (size_t i=0; i<other.m_aTabs.GetCount(); ++i)
     175                 :            :         {
     176                 :          0 :             const IXFStyle *pStyle = other.m_aTabs.Item(i);
     177         [ #  # ]:          0 :             if( pStyle )
     178                 :            :             {
     179         [ #  # ]:          0 :                 const XFTabStyle *pTabStyle = dynamic_cast<const XFTabStyle*>(pStyle);
     180         [ #  # ]:          0 :                 if( pTabStyle )
     181                 :            :                 {
     182         [ #  # ]:          0 :                     XFTabStyle *pCopyStyle = new XFTabStyle(*pTabStyle);
     183                 :          0 :                     m_aTabs.AddStyle(pCopyStyle);
     184                 :            :                 }
     185                 :            :             }
     186                 :            :         }
     187                 :            :     }
     188                 :        960 :     return *this;
     189                 :            : }
     190                 :            : 
     191 [ +  - ][ +  - ]:       1300 : XFParaStyle::~XFParaStyle()
     192                 :            : {
     193         [ +  + ]:       1300 :     if( m_pBorders )
     194                 :         10 :         delete m_pBorders;
     195         [ -  + ]:       1300 :     if( m_pBGImage )
     196 [ #  # ][ #  # ]:          0 :         delete m_pBGImage;
     197         [ -  + ]:       2600 : }
     198                 :            : 
     199                 :       9305 : enumXFStyle XFParaStyle::GetStyleFamily()
     200                 :            : {
     201                 :       9305 :     return enumXFStylePara;
     202                 :            : }
     203                 :            : 
     204                 :       1480 : void    XFParaStyle::SetFont(XFFont *pFont)
     205                 :            : {
     206                 :       1480 :     m_pFont = pFont;
     207                 :       1480 : }
     208                 :            : 
     209                 :        875 : void    XFParaStyle::SetIndent(double indent )
     210                 :            : {
     211                 :        875 :     m_fTextIndent = indent;
     212                 :        875 : }
     213                 :            : 
     214                 :       1590 : void    XFParaStyle::SetMargins(double left, double right, double top, double bottom)
     215                 :            : {
     216         [ +  + ]:       1590 :     if( left != -1 )
     217                 :        895 :         m_aMargin.SetLeft(left);
     218         [ +  + ]:       1590 :     if( right != -1 )
     219                 :        895 :         m_aMargin.SetRight(right);
     220         [ +  + ]:       1590 :     if( top != -1 )
     221                 :        520 :         m_aMargin.SetTop(top);
     222         [ +  + ]:       1590 :     if( bottom != -1 )
     223                 :        520 :         m_aMargin.SetBottom( bottom );
     224                 :       1590 : }
     225                 :            : 
     226                 :          5 : void    XFParaStyle::SetShadow(enumXFShadowPos pos, double offset, XFColor& color)
     227                 :            : {
     228                 :          5 :     m_aShadow.SetPosition(pos);
     229                 :          5 :     m_aShadow.SetOffset(offset);
     230                 :          5 :     m_aShadow.SetColor(color);
     231                 :          5 : }
     232                 :            : 
     233                 :         10 : void    XFParaStyle::SetBackColor(XFColor& color)
     234                 :            : {
     235                 :         10 :     m_aBackColor = color;
     236                 :         10 :     m_nFlag |= XFPARA_FLAG_BACKCOLOR;
     237                 :         10 : }
     238                 :            : 
     239                 :          0 : void    XFParaStyle::SetBackImage(XFBGImage *image)
     240                 :            : {
     241         [ #  # ]:          0 :     if( m_pBGImage )
     242         [ #  # ]:          0 :         delete m_pBGImage;
     243                 :          0 :     m_pBGImage = image;
     244                 :          0 : }
     245                 :            : 
     246                 :         10 : void    XFParaStyle::SetBorders(XFBorders *pBorders)
     247                 :            : {
     248         [ -  + ]:         10 :     if( m_pBorders )
     249                 :          0 :         delete m_pBorders;
     250                 :         10 :     m_pBorders = pBorders;
     251                 :         10 : }
     252                 :            : 
     253                 :          0 : void    XFParaStyle::SetDropCap(sal_Int16 nLength,
     254                 :            :                        sal_Int16 nLines,
     255                 :            :                        double fDistance
     256                 :            :                        )
     257                 :            : {
     258                 :            :     assert(nLength>=1);
     259                 :            :     assert(nLines>=2);
     260                 :            :     assert(fDistance>=0);
     261                 :            : 
     262                 :          0 :     m_aDropcap.SetCharCount(nLength);
     263                 :          0 :     m_aDropcap.SetLines(nLines);
     264                 :          0 :     m_aDropcap.SetDistance(fDistance);
     265                 :          0 : }
     266                 :            : 
     267                 :        585 : void    XFParaStyle::SetLineHeight(enumLHType type, double value)
     268                 :            : {
     269         [ -  + ]:        585 :     if( type == enumLHNone )
     270                 :            :     {
     271                 :        585 :         return;
     272                 :            :     }
     273   [ -  -  +  -  :        585 :     switch(type)
                      - ]
     274                 :            :     {
     275                 :            :     case enumLHHeight:
     276                 :          0 :         m_aLineHeight.SetHeight(value)  ;
     277                 :          0 :         break;
     278                 :            :     case enumLHLeast:
     279                 :          0 :         m_aLineHeight.SetLeastHeight(value);
     280                 :          0 :         break;
     281                 :            :     case enumLHPercent: //perhaps i should redesign the interface here,ohm..
     282                 :        585 :         m_aLineHeight.SetPercent((sal_Int32)value);
     283                 :        585 :         break;
     284                 :            :     case enumLHSpace:
     285                 :          0 :         m_aLineHeight.SetSpace(value*0.5666);   //don't known why,just suspect.
     286                 :          0 :         break;
     287                 :            :     default:
     288                 :          0 :         break;
     289                 :            :     }
     290                 :            : }
     291                 :            : 
     292                 :         50 : void    XFParaStyle::AddTabStyle(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter)
     293                 :            : {
     294         [ +  - ]:         50 :     XFTabStyle  *tab = new XFTabStyle();
     295                 :         50 :     tab->SetTabType(type);
     296                 :         50 :     tab->SetLength(len);
     297                 :         50 :     tab->SetLeaderChar(leader);
     298                 :         50 :     tab->SetDelimiter(delimiter);
     299                 :         50 :     m_aTabs.AddStyle(tab);
     300                 :         50 : }
     301                 :            : 
     302                 :            : /**
     303                 :            :  *Affirm whether two XFParaStyle objects are equal.
     304                 :            :  */
     305                 :       4105 : sal_Bool    XFParaStyle::Equal(IXFStyle *pStyle)
     306                 :            : {
     307         [ -  + ]:       4105 :     if( this == pStyle )
     308                 :          0 :         return sal_True;
     309 [ +  - ][ -  + ]:       4105 :     if( !pStyle || pStyle->GetStyleFamily() != enumXFStylePara )
                 [ -  + ]
     310                 :          0 :         return sal_False;
     311                 :            : 
     312                 :       4105 :     XFParaStyle *pOther = (XFParaStyle*)(pStyle);
     313         [ -  + ]:       4105 :     if( !pOther )
     314                 :          0 :         return sal_False;
     315                 :            : 
     316         [ +  + ]:       4105 :     if( m_nFlag != pOther->m_nFlag )
     317                 :        110 :         return sal_False;
     318         [ +  + ]:       3995 :     if( m_strParentStyleName != pOther->m_strParentStyleName )
     319                 :       1015 :         return sal_False;
     320         [ +  + ]:       2980 :     if( m_strMasterPage != pOther->m_strMasterPage )
     321                 :        655 :         return sal_False;
     322         [ -  + ]:       2325 :     if( m_fTextIndent != pOther->m_fTextIndent )
     323                 :          0 :         return sal_False;
     324         [ -  + ]:       2325 :     if( m_bJustSingleWord != pOther->m_bJustSingleWord )
     325                 :          0 :         return sal_False;
     326         [ -  + ]:       2325 :     if( m_bKeepWithNext != pOther->m_bKeepWithNext )
     327                 :          0 :         return sal_False;
     328                 :            :     //line number:
     329         [ -  + ]:       2325 :     if( m_bNumberLines != pOther->m_bNumberLines )
     330                 :          0 :         return sal_False;
     331         [ -  + ]:       2325 :     if( m_nLineNumberRestart != pOther->m_nLineNumberRestart )
     332                 :          0 :         return sal_False;
     333                 :            :     //align:
     334         [ +  + ]:       2325 :     if( m_eAlignType != pOther->m_eAlignType )
     335                 :        140 :         return sal_False;
     336                 :            :     //last line align:
     337         [ -  + ]:       2185 :     if( m_eLastLineAlign != pOther->m_eLastLineAlign )
     338                 :          0 :         return sal_False;
     339                 :            : 
     340                 :            :     //shadow:
     341         [ +  + ]:       2185 :     if( m_aShadow != pOther->m_aShadow )
     342                 :          5 :         return sal_False;
     343                 :            :     //margin:
     344         [ +  + ]:       2180 :     if( m_aMargin != pOther->m_aMargin )
     345                 :       1340 :         return sal_False;
     346                 :            : 
     347         [ -  + ]:        840 :     if( m_aPadding != pOther->m_aPadding )
     348                 :          0 :         return sal_False;
     349                 :            : 
     350                 :            :     //dropcap:
     351         [ -  + ]:        840 :     if( m_aDropcap != pOther->m_aDropcap )
     352                 :          0 :         return sal_False;
     353                 :            :     //line height:
     354         [ -  + ]:        840 :     if( m_aLineHeight != pOther->m_aLineHeight )
     355                 :          0 :         return sal_False;
     356                 :            :     //breaks:
     357         [ +  + ]:        840 :     if( m_aBreaks != pOther->m_aBreaks )
     358                 :         45 :         return sal_False;
     359         [ -  + ]:        795 :     if( m_nPageNumber != pOther->m_nPageNumber )
     360                 :          0 :         return sal_False;
     361         [ +  + ]:        795 :     if( m_aTabs != pOther->m_aTabs )
     362                 :         35 :         return sal_False;
     363                 :            : 
     364                 :            :     //font:
     365         [ +  - ]:        760 :     if( m_pFont )
     366                 :            :     {
     367         [ -  + ]:        760 :         if( !pOther->m_pFont )
     368                 :          0 :             return sal_False;
     369         [ -  + ]:        760 :         if(*m_pFont != *pOther->m_pFont )
     370                 :          0 :             return sal_False;
     371                 :            :     }
     372         [ #  # ]:          0 :     else if( pOther->m_pFont )
     373                 :          0 :         return sal_False;
     374                 :            : 
     375                 :            :     //border:
     376         [ -  + ]:        760 :     if( m_pBorders )
     377                 :            :     {
     378         [ #  # ]:          0 :         if( !pOther->m_pBorders )
     379                 :          0 :             return sal_False;
     380         [ #  # ]:          0 :         if( *m_pBorders != *pOther->m_pBorders )
     381                 :          0 :             return sal_False;
     382                 :            :     }
     383         [ -  + ]:        760 :     else if( pOther->m_pBorders )
     384                 :          0 :         return sal_False;
     385                 :            : 
     386         [ -  + ]:        760 :     if( m_pBGImage )
     387                 :            :     {
     388         [ #  # ]:          0 :         if( !pOther->m_pBGImage )
     389                 :          0 :             return sal_False;
     390         [ #  # ]:          0 :         if( *m_pBGImage != *pOther->m_pBGImage )
     391                 :          0 :             return sal_False;
     392                 :            :     }
     393         [ -  + ]:        760 :     else if( pOther->m_pBGImage )
     394                 :          0 :         return sal_False;//add end
     395                 :            : 
     396                 :            :     //number right
     397         [ -  + ]:        760 :     if (    m_bNumberRight  != pOther->m_bNumberRight)
     398                 :          0 :         return sal_False;
     399                 :            : 
     400                 :       4105 :     return sal_True;
     401                 :            : }
     402                 :            : 
     403                 :        390 : void    XFParaStyle::ToXml(IXFStream *pStrm)
     404                 :            : {
     405         [ +  - ]:        390 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
     406         [ +  - ]:        390 :     rtl::OUString style = GetStyleName();
     407                 :            : 
     408         [ +  - ]:        390 :     pAttrList->Clear();
     409         [ +  - ]:        390 :     if( !style.isEmpty() )
     410 [ +  - ][ +  - ]:        390 :         pAttrList->AddAttribute(A2OUSTR("style:name"),GetStyleName());
     411         [ +  - ]:        390 :     pAttrList->AddAttribute(A2OUSTR("style:family"), A2OUSTR("paragraph"));
     412 [ +  + ][ +  - ]:        390 :     if( !GetParentStyleName().isEmpty() )
     413 [ +  - ][ +  - ]:        135 :         pAttrList->AddAttribute(A2OUSTR("style:parent-style-name"),GetParentStyleName());
     414                 :            : 
     415         [ +  + ]:        390 :     if( !m_strMasterPage.isEmpty() )
     416         [ +  - ]:         15 :         pAttrList->AddAttribute(A2OUSTR("style:master-page-name"),m_strMasterPage);
     417         [ +  - ]:        390 :     pStrm->StartElement(A2OUSTR("style:style"));
     418                 :            : 
     419                 :            :     //Paragraph properties:
     420         [ +  - ]:        390 :     pAttrList->Clear();
     421                 :            : 
     422                 :            :     //text indent:
     423         [ +  + ]:        390 :     if( m_fTextIndent )
     424                 :            :     {
     425 [ +  - ][ +  - ]:         15 :         pAttrList->AddAttribute(A2OUSTR("fo:text-indent"), DoubleToOUString(m_fTextIndent) + A2OUSTR("cm") );
     426                 :            :     }
     427                 :            :     //padding:
     428         [ +  - ]:        390 :     m_aPadding.ToXml(pStrm);
     429                 :            :     //margin:
     430         [ +  - ]:        390 :     m_aMargin.ToXml(pStrm);
     431                 :            : 
     432                 :            :     //text align:
     433         [ +  + ]:        390 :     if( m_eAlignType != enumXFAlignNone )
     434                 :            :     {
     435 [ +  - ][ +  - ]:        195 :         pAttrList->AddAttribute(A2OUSTR("fo:text-align"), GetAlignName(m_eAlignType) );
     436                 :            :     }
     437                 :            :     //last line align:
     438         [ -  + ]:        390 :     if( m_eLastLineAlign != enumXFAlignNone )
     439                 :            :     {
     440 [ #  # ][ #  # ]:          0 :         pAttrList->AddAttribute(A2OUSTR("fo:fo:text-align-last"), GetAlignName(m_eLastLineAlign) );
     441         [ #  # ]:          0 :         if( m_bJustSingleWord )
     442         [ #  # ]:          0 :             pAttrList->AddAttribute(A2OUSTR("style:justify-single-word"), A2OUSTR("true") );
     443                 :            :     }
     444                 :            :     //line number:
     445         [ +  - ]:        390 :     if( m_bNumberLines )
     446                 :            :     {
     447         [ +  - ]:        390 :         pAttrList->AddAttribute( A2OUSTR("text:number-lines"), A2OUSTR("true") );
     448 [ +  - ][ +  - ]:        390 :         pAttrList->AddAttribute( A2OUSTR("text:line-number"), Int32ToOUString(m_nLineNumberRestart) );
     449                 :            :     }
     450                 :            :     else
     451                 :            :     {
     452         [ #  # ]:          0 :         pAttrList->AddAttribute( A2OUSTR("text:number-lines"), A2OUSTR("false") );
     453                 :            :         assert(m_nLineNumberRestart>0);
     454         [ #  # ]:          0 :         pAttrList->AddAttribute( A2OUSTR("text:line-number"), A2OUSTR("0") );
     455                 :            :     }
     456                 :            : 
     457                 :            :     //shadow:
     458         [ +  - ]:        390 :     m_aShadow.ToXml(pStrm);
     459                 :            :     //borders:
     460         [ +  + ]:        390 :     if( m_pBorders )
     461         [ +  - ]:         10 :         m_pBorders->ToXml(pStrm);
     462                 :            :     //line height:
     463         [ +  - ]:        390 :     m_aLineHeight.ToXml(pStrm);
     464                 :            : 
     465                 :            :     //background color:
     466 [ +  + ][ +  - ]:        390 :     if( m_nFlag&XFPARA_FLAG_BACKCOLOR && m_aBackColor.IsValid() )
                 [ +  + ]
     467                 :            :     {
     468 [ +  - ][ +  - ]:         10 :         pAttrList->AddAttribute(A2OUSTR("fo:background-color"), m_aBackColor.ToString() );
     469                 :            :     }
     470                 :            :     //Font properties:
     471         [ +  - ]:        390 :     if( m_pFont )
     472         [ +  - ]:        390 :         m_pFont->ToXml(pStrm);
     473                 :            : 
     474                 :            :     //page number:
     475         [ -  + ]:        390 :     if( m_nPageNumber )
     476 [ #  # ][ #  # ]:          0 :         pAttrList->AddAttribute(A2OUSTR("fo:page-number"), Int32ToOUString(m_nPageNumber) );
     477                 :            :     //page breaks:
     478         [ +  - ]:        390 :     m_aBreaks.ToXml(pStrm);
     479                 :            : 
     480         [ -  + ]:        390 :     if( m_bKeepWithNext )
     481         [ #  # ]:          0 :         pAttrList->AddAttribute(A2OUSTR("fo:fo:keep-with-next"), A2OUSTR("true") );
     482                 :            : 
     483         [ +  - ]:        390 :     pStrm->StartElement(A2OUSTR("style:properties"));
     484                 :            : 
     485                 :            :     //dropcap:
     486         [ +  - ]:        390 :     m_aDropcap.ToXml(pStrm);
     487                 :            : 
     488                 :            :     //tabs:
     489         [ +  + ]:        390 :     if( m_aTabs.GetCount() > 0 )
     490                 :            :     {
     491         [ +  - ]:         20 :         pAttrList->Clear();
     492         [ +  - ]:         20 :         pStrm->StartElement( A2OUSTR("style:tab-stops") );
     493         [ +  - ]:         20 :         m_aTabs.ToXml(pStrm);
     494         [ +  - ]:         20 :         pStrm->EndElement( A2OUSTR("style:tab-stops") );
     495                 :            :     }
     496                 :            : 
     497                 :            :     //background color:
     498         [ -  + ]:        390 :     if( m_pBGImage )
     499         [ #  # ]:          0 :         m_pBGImage->ToXml(pStrm);
     500                 :            : 
     501         [ +  - ]:        390 :     pStrm->EndElement(A2OUSTR("style:properties"));
     502                 :            : 
     503         [ +  - ]:        390 :     pStrm->EndElement(A2OUSTR("style:style"));
     504                 :        390 : }
     505                 :            : 
     506                 :         20 : XFDefaultParaStyle::XFDefaultParaStyle()
     507                 :            : {
     508                 :         20 :     m_fTabDistance = 1.28;
     509                 :         20 : }
     510                 :            : 
     511                 :        100 : enumXFStyle XFDefaultParaStyle::GetStyleFamily()
     512                 :            : {
     513                 :        100 :     return enumXFStyleDefaultPara;
     514                 :            : }
     515                 :            : 
     516                 :            : 
     517                 :         15 : void XFDefaultParaStyle::ToXml(IXFStream * pStrm)
     518                 :            : {
     519                 :         15 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
     520                 :         15 :     pAttrList->Clear();
     521         [ +  - ]:         15 :     pAttrList->AddAttribute(A2OUSTR("style:family"), A2OUSTR("paragraph"));
     522         [ +  - ]:         15 :     pStrm->StartElement(A2OUSTR("style:default-style"));
     523                 :            : 
     524                 :            :     //Paragraph properties:
     525                 :         15 :     pAttrList->Clear();
     526                 :            : 
     527 [ +  - ][ +  - ]:         15 :     pAttrList->AddAttribute(A2OUSTR("style:tab-stop-distance"), DoubleToOUString(m_fTabDistance) + A2OUSTR("cm") );
     528                 :            : 
     529         [ +  - ]:         15 :     pStrm->StartElement(A2OUSTR("style:properties"));
     530         [ +  - ]:         15 :     pStrm->EndElement(A2OUSTR("style:properties"));
     531         [ +  - ]:         15 :     pStrm->EndElement(A2OUSTR("style:default-style"));
     532                 :         15 : }
     533                 :            : 
     534                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10