LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/text - txtdrope.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 28 17.9 %
Date: 2012-12-27 Functions: 2 3 66.7 %
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             : using ::rtl::OUString;
      33             : using ::rtl::OUStringBuffer;
      34             : 
      35             : using namespace ::xmloff::token;
      36             : 
      37             : 
      38          70 : XMLTextDropCapExport::XMLTextDropCapExport( SvXMLExport& rExp ) :
      39          70 :     rExport(rExp)
      40             : {
      41          70 : }
      42             : 
      43          70 : XMLTextDropCapExport::~XMLTextDropCapExport()
      44             : {
      45          70 : }
      46             : 
      47           0 : void XMLTextDropCapExport::exportXML( const Any& rAny,
      48             :                                       sal_Bool bWholeWord,
      49             :                                       const OUString& rStyleName )
      50             : {
      51           0 :     DropCapFormat aFormat;
      52           0 :     rAny >>= aFormat;
      53           0 :     OUString sValue;
      54           0 :     OUStringBuffer sBuffer;
      55           0 :     if( aFormat.Lines > 1 )
      56             :     {
      57           0 :         SvXMLUnitConverter& rUnitConv = rExport.GetMM100UnitConverter();
      58             : 
      59             :         // style:lines
      60           0 :         ::sax::Converter::convertNumber( sBuffer, (sal_Int32)aFormat.Lines );
      61             :         rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LINES,
      62           0 :                               sBuffer.makeStringAndClear() );
      63             : 
      64             :         // style:length
      65           0 :         if( bWholeWord )
      66             :         {
      67           0 :             sValue = GetXMLToken(XML_WORD);
      68             :         }
      69           0 :         else if( aFormat.Count > 1 )
      70             :         {
      71           0 :             ::sax::Converter::convertNumber(sBuffer, (sal_Int32)aFormat.Count);
      72           0 :             sValue = sBuffer.makeStringAndClear();
      73             :         }
      74           0 :         if( !sValue.isEmpty() )
      75           0 :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LENGTH, sValue );
      76             : 
      77             :         // style:distance
      78           0 :         if( aFormat.Distance > 0 )
      79             :         {
      80           0 :             rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance );
      81             :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE,
      82           0 :                                   sBuffer.makeStringAndClear() );
      83             :         }
      84             : 
      85             :         // style:style-name
      86           0 :         if( !rStyleName.isEmpty() )
      87             :             rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE_NAME,
      88           0 :                                   rExport.EncodeStyleName( rStyleName ) );
      89             :     }
      90             : 
      91             :     SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, XML_DROP_CAP,
      92           0 :                               sal_False, sal_False );
      93           0 : }
      94             : 
      95             : 
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10