LCOV - code coverage report
Current view: top level - xmloff/source/text - txtdrope.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 28 78.6 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.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             : #include <rtl/ustrbuf.hxx>
      21             : #include <com/sun/star/style/DropCapFormat.hpp>
      22             : #include <sax/tools/converter.hxx>
      23             : #include <xmloff/xmltoken.hxx>
      24             : #include <xmloff/xmlexp.hxx>
      25             : #include <xmloff/xmluconv.hxx>
      26             : #include <xmloff/xmlnmspe.hxx>
      27             : #include "txtdrope.hxx"
      28             : 
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::style;
      31             : using namespace ::com::sun::star::uno;
      32             : 
      33             : using namespace ::xmloff::token;
      34             : 
      35             : 
      36        7303 : XMLTextDropCapExport::XMLTextDropCapExport( SvXMLExport& rExp ) :
      37        7303 :     rExport(rExp)
      38             : {
      39        7303 : }
      40             : 
      41        7298 : XMLTextDropCapExport::~XMLTextDropCapExport()
      42             : {
      43        7298 : }
      44             : 
      45           3 : void XMLTextDropCapExport::exportXML( const Any& rAny,
      46             :                                       bool bWholeWord,
      47             :                                       const OUString& rStyleName )
      48             : {
      49           3 :     DropCapFormat aFormat;
      50           3 :     rAny >>= aFormat;
      51           3 :     OUString sValue;
      52           6 :     OUStringBuffer sBuffer;
      53           3 :     if( aFormat.Lines > 1 )
      54             :     {
      55           3 :         SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
      56             : 
      57             :         // style:lines
      58           3 :         ::sax::Converter::convertNumber( sBuffer, (sal_Int32)aFormat.Lines );
      59             :         rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LINES,
      60           3 :                               sBuffer.makeStringAndClear() );
      61             : 
      62             :         // style:length
      63           3 :         if( bWholeWord )
      64             :         {
      65           0 :             sValue = GetXMLToken(XML_WORD);
      66             :         }
      67           3 :         else if( aFormat.Count > 1 )
      68             :         {
      69           0 :             ::sax::Converter::convertNumber(sBuffer, (sal_Int32)aFormat.Count);
      70           0 :             sValue = sBuffer.makeStringAndClear();
      71             :         }
      72           3 :         if( !sValue.isEmpty() )
      73           0 :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LENGTH, sValue );
      74             : 
      75             :         // style:distance
      76           3 :         if( aFormat.Distance > 0 )
      77             :         {
      78           0 :             rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance );
      79             :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE,
      80           0 :                                   sBuffer.makeStringAndClear() );
      81             :         }
      82             : 
      83             :         // style:style-name
      84           3 :         if( !rStyleName.isEmpty() )
      85             :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE_NAME,
      86           2 :                                   rExport.EncodeStyleName( rStyleName ) );
      87             :     }
      88             : 
      89             :     SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_DROP_CAP,
      90           6 :                               false, false );
      91           3 : }
      92             : 
      93             : 
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11