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

Generated by: LCOV version 1.10