LCOV - code coverage report
Current view: top level - xmloff/source/transform - DlgOASISTContext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 36 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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             : #include "DlgOASISTContext.hxx"
      21             : #include "MutableAttrList.hxx"
      22             : #include <xmloff/xmlnmspe.hxx>
      23             : #include "ActionMapTypesOASIS.hxx"
      24             : #include "AttrTransformerAction.hxx"
      25             : #include "TransformerActions.hxx"
      26             : #include "TransformerBase.hxx"
      27             : #include <osl/diagnose.h>
      28             : 
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::xml::sax;
      31             : using namespace ::xmloff::token;
      32             : 
      33           0 : TYPEINIT1( XMLDlgOASISTransformerContext, XMLTransformerContext);
      34             : 
      35           0 : XMLDlgOASISTransformerContext::XMLDlgOASISTransformerContext(
      36             :         XMLTransformerBase& rImp,
      37             :         const OUString& rQName ) :
      38           0 :     XMLTransformerContext( rImp, rQName )
      39             : {
      40           0 : }
      41             : 
      42           0 : XMLDlgOASISTransformerContext::~XMLDlgOASISTransformerContext()
      43             : {
      44           0 : }
      45             : 
      46           0 : void XMLDlgOASISTransformerContext::StartElement(
      47             :     const Reference< XAttributeList >& rAttrList )
      48             : {
      49             :     XMLTransformerActions *pActions =
      50           0 :         GetTransformer().GetUserDefinedActions( OASIS_DLG_ACTIONS );
      51             :     OSL_ENSURE( pActions, "go no actions" );
      52             : 
      53           0 :     Reference< XAttributeList > xAttrList( rAttrList );
      54           0 :     XMLMutableAttributeList *pMutableAttrList = 0;
      55           0 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
      56             : 
      57           0 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
      58             :     {
      59           0 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
      60           0 :         OUString aLocalName;
      61             :         sal_uInt16 nPrefix =
      62           0 :             GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
      63           0 :                                                                  &aLocalName );
      64             : 
      65           0 :         XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
      66             :         XMLTransformerActions::const_iterator aIter =
      67           0 :             pActions->find( aKey );
      68             : 
      69           0 :         if( !(aIter == pActions->end() ) )
      70             :         {
      71           0 :             if( !pMutableAttrList )
      72             :             {
      73             :                 pMutableAttrList =
      74           0 :                         new XMLMutableAttributeList( xAttrList );
      75           0 :                 xAttrList = pMutableAttrList;
      76             :             }
      77           0 :             const OUString& rAttrValue = xAttrList->getValueByIndex( i );
      78           0 :             switch( (*aIter).second.m_nActionType )
      79             :             {
      80             :             case XML_ATACTION_DLG_BORDER:
      81             :                 {
      82           0 :                     OUString aAttrValue( rAttrValue );
      83             : 
      84           0 :                     if ( !aAttrValue.equals( GetXMLToken( XML_NONE ) ) &&
      85           0 :                          !aAttrValue.equals( GetXMLToken( XML_SIMPLE ) ) &&
      86           0 :                          !aAttrValue.equals( GetXMLToken( XML_3D ) ) )
      87             :                     {
      88             :                         pMutableAttrList->SetValueByIndex(
      89           0 :                             i, GetXMLToken( XML_NONE ) );
      90           0 :                     }
      91             :                 }
      92           0 :                 break;
      93             :             default:
      94             :                 OSL_ENSURE( false, "unknown action" );
      95           0 :                 break;
      96           0 :             }
      97             :         }
      98           0 :     }
      99             : 
     100           0 :     XMLTransformerContext::StartElement( xAttrList );
     101           0 : }
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11