LCOV - code coverage report
Current view: top level - xmloff/source/style - XMLFootnoteSeparatorExport.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 57 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "XMLFootnoteSeparatorExport.hxx"
      22             : 
      23             : #include <tools/debug.hxx>
      24             : 
      25             : #include <sax/tools/converter.hxx>
      26             : 
      27             : #include <xmloff/xmlexp.hxx>
      28             : #include <xmloff/xmlnmspe.hxx>
      29             : #include <xmloff/xmluconv.hxx>
      30             : #include <xmloff/xmltoken.hxx>
      31             : #include <xmloff/xmlprmap.hxx>
      32             : 
      33             : #include <xmloff/PageMasterStyleMap.hxx>
      34             : #include <com/sun/star/text/HorizontalAdjust.hpp>
      35             : #include <rtl/ustrbuf.hxx>
      36             : 
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::xmloff::token;
      40             : using ::std::vector;
      41             : 
      42           0 : XMLFootnoteSeparatorExport::XMLFootnoteSeparatorExport(SvXMLExport& rExp) :
      43           0 :     rExport(rExp)
      44             : {
      45           0 : }
      46             : 
      47           0 : XMLFootnoteSeparatorExport::~XMLFootnoteSeparatorExport()
      48             : {
      49           0 : }
      50             : 
      51             : 
      52           0 : void XMLFootnoteSeparatorExport::exportXML(
      53             :     const vector<XMLPropertyState> * pProperties,
      54             :     sal_uInt32
      55             :     #ifdef DBG_UTIL
      56             :     nIdx
      57             :     #endif
      58             :     ,
      59             :     const UniReference<XMLPropertySetMapper> & rMapper)
      60             : {
      61             :     DBG_ASSERT(NULL != pProperties, "Need property states");
      62             : 
      63             :     // intialize values
      64           0 :     sal_Int16 eLineAdjust = text::HorizontalAdjust_LEFT;
      65           0 :     sal_Int32 nLineColor = 0;
      66           0 :     sal_Int32 nLineDistance = 0;
      67           0 :     sal_Int8 nLineRelWidth = 0;
      68           0 :     sal_Int32 nLineTextDistance = 0;
      69           0 :     sal_Int16 nLineWeight = 0;
      70           0 :     sal_Int8 nLineStyle = 0;
      71             : 
      72             :     // find indices into property map and get values
      73           0 :     sal_uInt32 nCount = pProperties->size();
      74           0 :     for(sal_uInt32 i = 0; i < nCount; i++)
      75             :     {
      76           0 :         const XMLPropertyState& rState = (*pProperties)[i];
      77             : 
      78           0 :         if( rState.mnIndex == -1 )
      79           0 :             continue;
      80             : 
      81           0 :         switch (rMapper->GetEntryContextId(rState.mnIndex))
      82             :         {
      83             :         case CTF_PM_FTN_LINE_ADJUST:
      84           0 :             rState.maValue >>= eLineAdjust;
      85           0 :             break;
      86             :         case CTF_PM_FTN_LINE_COLOR:
      87           0 :             rState.maValue >>= nLineColor;
      88           0 :             break;
      89             :         case CTF_PM_FTN_DISTANCE:
      90           0 :             rState.maValue >>= nLineDistance;
      91           0 :             break;
      92             :         case CTF_PM_FTN_LINE_WIDTH:
      93           0 :             rState.maValue >>= nLineRelWidth;
      94           0 :             break;
      95             :         case CTF_PM_FTN_LINE_DISTANCE:
      96           0 :             rState.maValue >>= nLineTextDistance;
      97           0 :             break;
      98             :         case CTF_PM_FTN_LINE_WEIGHT:
      99             :             DBG_ASSERT( i == nIdx,
     100             :                         "received wrong property state index" );
     101           0 :             rState.maValue >>= nLineWeight;
     102           0 :             break;
     103             :         case CTF_PM_FTN_LINE_STYLE:
     104           0 :             rState.maValue >>= nLineStyle;
     105           0 :             break;
     106             :         }
     107             :     }
     108             : 
     109           0 :     OUStringBuffer sBuf;
     110             : 
     111             :     // weight/width
     112           0 :     if (nLineWeight > 0)
     113             :     {
     114           0 :         rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf, nLineWeight);
     115             :         rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_WIDTH,
     116           0 :                              sBuf.makeStringAndClear());
     117             :     }
     118             : 
     119             :     // line text distance
     120           0 :     if (nLineTextDistance > 0)
     121             :     {
     122           0 :         rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf,
     123           0 :                 nLineTextDistance);
     124             :         rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_BEFORE_SEP,
     125           0 :                              sBuf.makeStringAndClear());
     126             :     }
     127             : 
     128             :     // line distance
     129           0 :     if (nLineDistance > 0)
     130             :     {
     131           0 :         rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf,
     132           0 :                 nLineDistance);
     133             :         rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_AFTER_SEP,
     134           0 :                              sBuf.makeStringAndClear());
     135             :     }
     136             : 
     137             :     // line style
     138             :     static const SvXMLEnumMapEntry aXML_LineStyle_Enum[] =
     139             :     {
     140             :         { XML_NONE,     0 },
     141             :         { XML_SOLID,    1 },
     142             :         { XML_DOTTED,   2 },
     143             :         { XML_DASH,     3 },
     144             :         { XML_TOKEN_INVALID, 0 }
     145             :     };
     146           0 :     if (rExport.GetMM100UnitConverter().convertEnum(
     147           0 :             sBuf, nLineStyle, aXML_LineStyle_Enum ) )
     148             :     {
     149             :         rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LINE_STYLE,
     150           0 :                 sBuf.makeStringAndClear());
     151             :     }
     152             : 
     153             :     // adjustment
     154             :     static const SvXMLEnumMapEntry aXML_HorizontalAdjust_Enum[] =
     155             :     {
     156             :         { XML_LEFT,     text::HorizontalAdjust_LEFT },
     157             :         { XML_CENTER,   text::HorizontalAdjust_CENTER },
     158             :         { XML_RIGHT,    text::HorizontalAdjust_RIGHT },
     159             :         { XML_TOKEN_INVALID, 0 }
     160             :     };
     161             : 
     162           0 :     if (rExport.GetMM100UnitConverter().convertEnum(
     163           0 :         sBuf, eLineAdjust, aXML_HorizontalAdjust_Enum))
     164             :     {
     165             :         rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_ADJUSTMENT,
     166           0 :                              sBuf.makeStringAndClear());
     167             :     }
     168             : 
     169             :     // relative line width
     170           0 :     ::sax::Converter::convertPercent(sBuf, nLineRelWidth);
     171             :     rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_REL_WIDTH,
     172           0 :                          sBuf.makeStringAndClear());
     173             : 
     174             :     // color
     175           0 :     ::sax::Converter::convertColor(sBuf, nLineColor);
     176             :     rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_COLOR,
     177           0 :                          sBuf.makeStringAndClear());
     178             : 
     179             :     // line-style
     180             : 
     181             :     SvXMLElementExport aElem(rExport, XML_NAMESPACE_STYLE,
     182           0 :                              XML_FOOTNOTE_SEP, true, true);
     183           0 : }
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10