LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter/xfilter - xfdatestyle.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 48 95 50.5 %
Date: 2012-08-25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 26 120 21.7 %

           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                 :            :  * Date style. The date format for date field.
      59                 :            :  ************************************************************************/
      60                 :            : #include    "xfdatestyle.hxx"
      61                 :            : 
      62                 :         75 : XFDatePart::XFDatePart()
      63                 :            : {
      64                 :         75 :     m_bTexture = sal_False;
      65                 :         75 : }
      66                 :            : 
      67                 :         50 : void    XFDatePart::ToXml(IXFStream *pStrm)
      68                 :            : {
      69                 :         50 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
      70                 :            : 
      71   [ -  +  +  +  :         50 :     switch(m_ePart)
          -  -  -  -  -  
             -  -  -  +  
                      - ]
      72                 :            :     {
      73                 :            :     case enumXFDateUnknown:
      74                 :          0 :         break;
      75                 :            :     case enumXFDateYear:
      76                 :         10 :         pAttrList->Clear();
      77         [ +  - ]:         10 :         if( m_bLongFmt )
      78         [ +  - ]:         10 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
      79         [ +  - ]:         10 :         pStrm->StartElement( A2OUSTR("number:year") );
      80         [ +  - ]:         10 :         pStrm->EndElement( A2OUSTR("number:year") );
      81                 :         10 :         break;
      82                 :            :     case enumXFDateMonth:
      83                 :         10 :         pAttrList->Clear();
      84         [ +  - ]:         10 :         if( m_bTexture )
      85         [ +  - ]:         10 :             pAttrList->AddAttribute( A2OUSTR("number:textual"), A2OUSTR("true") );
      86         [ +  - ]:         10 :         if( m_bLongFmt )
      87         [ +  - ]:         10 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
      88         [ +  - ]:         10 :         pStrm->StartElement( A2OUSTR("number:month") );
      89         [ +  - ]:         10 :         pStrm->EndElement( A2OUSTR("number:month") );
      90                 :         10 :         break;
      91                 :            :     case enumXFDateMonthDay:
      92                 :         10 :         pAttrList->Clear();
      93         [ -  + ]:         10 :         if( m_bLongFmt )
      94         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
      95         [ +  - ]:         10 :         pStrm->StartElement( A2OUSTR("number:day") );
      96         [ +  - ]:         10 :         pStrm->EndElement( A2OUSTR("number:day") );
      97                 :         10 :         break;
      98                 :            :     case enumXFDateWeekDay:
      99                 :          0 :         pAttrList->Clear();
     100         [ #  # ]:          0 :         if( m_bLongFmt )
     101         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     102         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:day-of-week") );
     103         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:day-of-week") );
     104                 :          0 :         break;
     105                 :            :     case enumXFDateYearWeek:
     106                 :          0 :         pAttrList->Clear();
     107         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:week-of-year") );
     108         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:week-of-year") );
     109                 :          0 :         break;
     110                 :            :     case enumXFDateEra:
     111                 :          0 :         pAttrList->Clear();
     112         [ #  # ]:          0 :         if( m_bLongFmt )
     113         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     114         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:era") );
     115         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:era") );
     116                 :          0 :         break;
     117                 :            :     case enumXFDateQuarter:
     118                 :          0 :         pAttrList->Clear();
     119         [ #  # ]:          0 :         if( m_bLongFmt )
     120         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     121         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:quarter") );
     122         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:quarter") );
     123                 :          0 :         break;
     124                 :            :     case enumXFDateHour:
     125                 :          0 :         pAttrList->Clear();
     126         [ #  # ]:          0 :         if( m_bLongFmt )
     127         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     128         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:hours") );
     129         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:hours") );
     130                 :          0 :         break;
     131                 :            :     case enumXFDateMinute:
     132                 :          0 :         pAttrList->Clear();
     133         [ #  # ]:          0 :         if( m_bLongFmt )
     134         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     135         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:minutes") );
     136         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:minutes") );
     137                 :          0 :         break;
     138                 :            :     case enumXFDateSecond:
     139                 :          0 :         pAttrList->Clear();
     140         [ #  # ]:          0 :         if( m_bLongFmt )
     141         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:style"), A2OUSTR("long") );
     142         [ #  # ]:          0 :         if( m_nDecimalPos )
     143         [ #  # ]:          0 :             pAttrList->AddAttribute( A2OUSTR("number:decimal-places"), Int32ToOUString(m_nDecimalPos) );
     144         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:seconds") );
     145         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:seconds") );
     146                 :          0 :         break;
     147                 :            :     case enumXFDateAmPm:
     148         [ #  # ]:          0 :         pStrm->StartElement( A2OUSTR("number:am-pm") );
     149         [ #  # ]:          0 :         pStrm->EndElement( A2OUSTR("number:am-pm") );
     150                 :          0 :         break;
     151                 :            :     case enumXFDateText:
     152                 :         20 :         pAttrList->Clear();
     153         [ +  - ]:         20 :         pStrm->StartElement( A2OUSTR("number:text") );
     154                 :         20 :         pStrm->Characters( m_strText );
     155         [ +  - ]:         20 :         pStrm->EndElement( A2OUSTR("number:text") );
     156                 :         20 :         break;
     157                 :            :     }
     158                 :         50 : }
     159                 :            : 
     160         [ +  - ]:         15 : XFDateStyle::XFDateStyle()
     161                 :            : {
     162                 :         15 :     m_bFixed = sal_False;
     163                 :         15 :     m_bAutoOrder = sal_False;
     164                 :         15 : }
     165                 :            : 
     166         [ +  - ]:         15 : XFDateStyle::~XFDateStyle()
     167                 :            : {
     168         [ -  + ]:         30 : }
     169                 :            : 
     170                 :        165 : enumXFStyle XFDateStyle::GetStyleFamily()
     171                 :            : {
     172                 :        165 :     return enumXFStyleDate;
     173                 :            : }
     174                 :            : 
     175                 :         10 : void    XFDateStyle::ToXml(IXFStream *pStrm)
     176                 :            : {
     177                 :         10 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
     178                 :            : 
     179                 :         10 :     pAttrList->Clear();
     180         [ +  - ]:         10 :     pAttrList->AddAttribute( A2OUSTR("style:name"), GetStyleName() );
     181         [ +  - ]:         10 :     pAttrList->AddAttribute( A2OUSTR("style:family"), A2OUSTR("data-style") );
     182                 :            : 
     183         [ +  - ]:         10 :     pStrm->StartElement( A2OUSTR("number:date-style") );
     184                 :            : 
     185                 :         10 :     m_aParts.ToXml(pStrm);
     186                 :            : 
     187         [ +  - ]:         10 :     pStrm->EndElement( A2OUSTR("number:date-style") );
     188                 :         10 : }
     189                 :            : 
     190                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10