LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLSectionFootnoteConfigExport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 68 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "XMLSectionFootnoteConfigExport.hxx"
      30                 :            : #include <xmloff/xmlexp.hxx>
      31                 :            : #include <xmloff/xmlprmap.hxx>
      32                 :            : #include <com/sun/star/style/NumberingType.hpp>
      33                 :            : #include <sax/tools/converter.hxx>
      34                 :            : #include <xmloff/maptype.hxx>
      35                 :            : 
      36                 :            : #include <xmloff/txtprmap.hxx>
      37                 :            : #include <xmloff/nmspmap.hxx>
      38                 :            : #include "xmloff/xmlnmspe.hxx"
      39                 :            : #include <xmloff/xmluconv.hxx>
      40                 :            : #include <xmloff/xmltoken.hxx>
      41                 :            : #include <xmloff/xmlnume.hxx>
      42                 :            : #include <tools/debug.hxx>
      43                 :            : #include <rtl/ustring.hxx>
      44                 :            : #include <rtl/ustrbuf.hxx>
      45                 :            : 
      46                 :            : #include <vector>
      47                 :            : 
      48                 :            : 
      49                 :            : using namespace ::xmloff::token;
      50                 :            : 
      51                 :            : using ::std::vector;
      52                 :            : using ::rtl::OUString;
      53                 :            : using ::rtl::OUStringBuffer;
      54                 :            : using ::com::sun::star::style::NumberingType::ARABIC;
      55                 :            : 
      56                 :            : 
      57                 :          0 : void XMLSectionFootnoteConfigExport::exportXML(
      58                 :            :     SvXMLExport& rExport,
      59                 :            :     sal_Bool bEndnote,
      60                 :            :     const vector<XMLPropertyState> *pProperties,
      61                 :            :     sal_uInt32
      62                 :            :     #ifdef DBG_UTIL
      63                 :            :     nIdx
      64                 :            :     #endif
      65                 :            :     ,
      66                 :            :     const UniReference<XMLPropertySetMapper> & rMapper)
      67                 :            : {
      68                 :            :     // store and initialize the values
      69                 :          0 :     sal_Bool bNumOwn = sal_False;
      70                 :          0 :     sal_Bool bNumRestart = sal_False;
      71                 :          0 :     sal_Int16 nNumRestartAt = 0;
      72                 :          0 :     sal_Int16 nNumberingType = ARABIC;
      73                 :          0 :     OUString sNumPrefix;
      74                 :          0 :     OUString sNumSuffix;
      75                 :          0 :     sal_Bool bEnd = sal_False;
      76                 :            : 
      77                 :            :     // find entries in property states vector
      78                 :          0 :     sal_uInt32 nCount = pProperties->size();
      79         [ #  # ]:          0 :     for(sal_uInt32 i = 0; i < nCount; i++)
      80                 :            :     {
      81                 :          0 :         const XMLPropertyState& rState = (*pProperties)[i];
      82                 :            : 
      83 [ #  # ][ #  # ]:          0 :         sal_Int16 nContextId = rMapper->GetEntryContextId(rState.mnIndex);
      84         [ #  # ]:          0 :         if (!bEndnote)
      85                 :            :         {
      86   [ #  #  #  #  :          0 :             switch (nContextId)
             #  #  #  # ]
      87                 :            :             {
      88                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_OWN:
      89                 :          0 :                     rState.maValue >>= bNumOwn;
      90                 :          0 :                     break;
      91                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_RESTART:
      92                 :          0 :                     rState.maValue >>= bNumRestart;
      93                 :          0 :                     break;
      94                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
      95                 :          0 :                     rState.maValue >>= nNumRestartAt;
      96                 :          0 :                     break;
      97                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_TYPE:
      98                 :          0 :                     rState.maValue >>= nNumberingType;
      99                 :          0 :                     break;
     100                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
     101                 :          0 :                     rState.maValue >>= sNumPrefix;
     102                 :          0 :                     break;
     103                 :            :                 case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
     104                 :          0 :                     rState.maValue >>= sNumSuffix;
     105                 :          0 :                     break;
     106                 :            :                 case CTF_SECTION_FOOTNOTE_END:
     107                 :            :                     DBG_ASSERT( i == nIdx,
     108                 :            :                                 "received wrong property state index" );
     109                 :          0 :                     rState.maValue >>= bEnd;
     110                 :          0 :                     break;
     111                 :            :             }
     112                 :            :         }
     113                 :            :         else
     114                 :            :         {
     115   [ #  #  #  #  :          0 :             switch (nContextId)
             #  #  #  # ]
     116                 :            :             {
     117                 :            :                 case CTF_SECTION_ENDNOTE_NUM_OWN:
     118                 :          0 :                     rState.maValue >>= bNumOwn;
     119                 :          0 :                     break;
     120                 :            :                 case CTF_SECTION_ENDNOTE_NUM_RESTART:
     121                 :          0 :                     rState.maValue >>= bNumRestart;
     122                 :          0 :                     break;
     123                 :            :                 case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
     124                 :          0 :                     rState.maValue >>= nNumRestartAt;
     125                 :          0 :                     break;
     126                 :            :                 case CTF_SECTION_ENDNOTE_NUM_TYPE:
     127                 :          0 :                     rState.maValue >>= nNumberingType;
     128                 :          0 :                     break;
     129                 :            :                 case CTF_SECTION_ENDNOTE_NUM_PREFIX:
     130                 :          0 :                     rState.maValue >>= sNumPrefix;
     131                 :          0 :                     break;
     132                 :            :                 case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
     133                 :          0 :                     rState.maValue >>= sNumSuffix;
     134                 :          0 :                     break;
     135                 :            :                 case CTF_SECTION_ENDNOTE_END:
     136                 :            :                     DBG_ASSERT( i == nIdx,
     137                 :            :                                 "received wrong property state index" );
     138                 :          0 :                     rState.maValue >>= bEnd;
     139                 :          0 :                     break;
     140                 :            :             }
     141                 :            :         }
     142                 :            :     }
     143                 :            : 
     144                 :            :     // we only make an element if we have an own footnote/endnote numbering
     145         [ #  # ]:          0 :     if (bEnd)
     146                 :            :     {
     147                 :            :         rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
     148                 :            :                                  GetXMLToken( bEndnote ? XML_ENDNOTE
     149 [ #  # ][ #  # ]:          0 :                                                          : XML_FOOTNOTE ) );
                 [ #  # ]
     150                 :            :         // start numbering
     151                 :          0 :         OUStringBuffer sBuf;
     152         [ #  # ]:          0 :         if (bNumRestart)
     153                 :            :         {
     154                 :            :             // restart number is stored as 0.., but interpreted as 1..
     155                 :            :             ::sax::Converter::convertNumber(sBuf,
     156         [ #  # ]:          0 :                                               (sal_Int32)(nNumRestartAt+1));
     157                 :            :             rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_START_VALUE,
     158 [ #  # ][ #  # ]:          0 :                                  sBuf.makeStringAndClear());
     159                 :            :         }
     160                 :            : 
     161         [ #  # ]:          0 :         if (bNumOwn)
     162                 :            :         {
     163                 :            :             // prefix and suffix
     164         [ #  # ]:          0 :             if (!sNumPrefix.isEmpty())
     165                 :            :             {
     166                 :            :                     rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
     167         [ #  # ]:          0 :                                          sNumPrefix);
     168                 :            :             }
     169         [ #  # ]:          0 :             if (!sNumSuffix.isEmpty())
     170                 :            :             {
     171                 :            :                 rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
     172         [ #  # ]:          0 :                                      sNumSuffix);
     173                 :            :             }
     174                 :            : 
     175                 :            :             // number type: num format
     176                 :          0 :             rExport.GetMM100UnitConverter().convertNumFormat( sBuf,
     177         [ #  # ]:          0 :                                                               nNumberingType );
     178                 :            :             rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
     179 [ #  # ][ #  # ]:          0 :                                  sBuf.makeStringAndClear());
     180                 :            : 
     181                 :            :             // and letter sync, if applicable
     182                 :          0 :             rExport.GetMM100UnitConverter().convertNumLetterSync(
     183         [ #  # ]:          0 :                 sBuf, nNumberingType );
     184         [ #  # ]:          0 :             if (sBuf.getLength())
     185                 :            :             {
     186                 :            :                 rExport.AddAttribute(XML_NAMESPACE_STYLE,
     187                 :            :                                      XML_NUM_LETTER_SYNC,
     188 [ #  # ][ #  # ]:          0 :                                      sBuf.makeStringAndClear());
     189                 :            :             }
     190                 :            :         }
     191                 :            : 
     192                 :            :         // and finally, the element
     193                 :            :         SvXMLElementExport rElem(rExport, XML_NAMESPACE_TEXT,
     194                 :            :                                  XML_NOTES_CONFIGURATION,
     195 [ #  # ][ #  # ]:          0 :                                  sal_True, sal_True);
     196                 :          0 :     }
     197                 :          0 : }
     198                 :            : 
     199                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10