LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/draw - XMLShapePropertySetContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 31 93.5 %
Date: 2012-12-27 Functions: 5 10 50.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 "XMLShapePropertySetContext.hxx"
      22             : #include <xmloff/xmlimp.hxx>
      23             : #include <xmloff/xmlnumi.hxx>
      24             : #include "xmltabi.hxx"
      25             : #include <xmloff/txtprmap.hxx>
      26             : 
      27             : #include "sdpropls.hxx"
      28             : 
      29             : using ::rtl::OUString;
      30             : using ::rtl::OUStringBuffer;
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::com::sun::star::uno;
      34             : 
      35             : //////////////////////////////////////////////////////////////////////////////
      36             : 
      37           0 : TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext );
      38             : 
      39         213 : XMLShapePropertySetContext::XMLShapePropertySetContext(
      40             :                  SvXMLImport& rImport, sal_uInt16 nPrfx,
      41             :                  const OUString& rLName,
      42             :                  const Reference< xml::sax::XAttributeList > & xAttrList,
      43             :                  sal_uInt32 nFam,
      44             :                  ::std::vector< XMLPropertyState > &rProps,
      45             :                  const UniReference < SvXMLImportPropertyMapper > &rMap ) :
      46             :     SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
      47             :                              rProps, rMap ),
      48         213 :     mnBulletIndex(-1)
      49             : {
      50         213 : }
      51             : 
      52         418 : XMLShapePropertySetContext::~XMLShapePropertySetContext()
      53             : {
      54         418 : }
      55             : 
      56         213 : void XMLShapePropertySetContext::EndElement()
      57             : {
      58         213 :     Reference< container::XIndexReplace > xNumRule;
      59         213 :     if( mxBulletStyle.Is() )
      60             :     {
      61           7 :         SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle;
      62           7 :         xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() );
      63           7 :         if( xNumRule.is() )
      64           7 :             pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
      65             :     }
      66             : 
      67         213 :     Any aAny;
      68         213 :     aAny <<= xNumRule;
      69             : 
      70         213 :     XMLPropertyState aPropState( mnBulletIndex, aAny );
      71         213 :     mrProperties.push_back( aPropState );
      72             : 
      73         213 :     SvXMLPropertySetContext::EndElement();
      74         213 : }
      75             : 
      76          27 : SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext(
      77             :                    sal_uInt16 nPrefix,
      78             :                    const OUString& rLocalName,
      79             :                    const Reference< xml::sax::XAttributeList > & xAttrList,
      80             :                    ::std::vector< XMLPropertyState > &rProperties,
      81             :                    const XMLPropertyState& rProp )
      82             : {
      83          27 :     SvXMLImportContext *pContext = 0;
      84             : 
      85          27 :     switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
      86             :     {
      87             :     case CTF_NUMBERINGRULES:
      88           7 :         mnBulletIndex = rProp.mnIndex;
      89           7 :         mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
      90           7 :         break;
      91             :     case CTF_TABSTOP:
      92          20 :         pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
      93             :                                                    rLocalName, rProp,
      94          20 :                                                    rProperties );
      95          20 :         break;
      96             :     }
      97             : 
      98          27 :     if( !pContext )
      99             :         pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
     100             :                                                             xAttrList,
     101           0 :                                                             rProperties, rProp );
     102             : 
     103          27 :     return pContext;
     104             : }
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10