LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/filter/oox - richstringcontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 31 58.1 %
Date: 2013-07-09 Functions: 4 4 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 "richstringcontext.hxx"
      21             : 
      22             : #include "stylesfragment.hxx"
      23             : 
      24             : namespace oox {
      25             : namespace xls {
      26             : 
      27             : // ============================================================================
      28             : 
      29             : using ::oox::core::ContextHandlerRef;
      30             : 
      31             : // ============================================================================
      32             : 
      33          63 : ContextHandlerRef RichStringContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      34             : {
      35          63 :     if( isRootElement() )
      36             :     {
      37          61 :         switch( nElement )
      38             :         {
      39             :             case XLS_TOKEN( t ):
      40          60 :                 mxPortion = mxString->importText( rAttribs );
      41          60 :                 return this;    // collect text in onCharacters()
      42             :             case XLS_TOKEN( r ):
      43           1 :                 mxPortion = mxString->importRun( rAttribs );
      44           1 :                 return this;
      45             :             case XLS_TOKEN( rPh ):
      46           0 :                 mxPhonetic = mxString->importPhoneticRun( rAttribs );
      47           0 :                 return this;
      48             :             case XLS_TOKEN( phoneticPr ):
      49           0 :                 mxString->importPhoneticPr( rAttribs );
      50           0 :             break;
      51             :         }
      52             :     }
      53           2 :     else switch( getCurrentElement() )
      54             :     {
      55             :         case XLS_TOKEN( r ):
      56           2 :             switch( nElement )
      57             :             {
      58             :                 case XLS_TOKEN( rPr ):
      59           1 :                     if( mxPortion.get() )
      60           1 :                         return new FontContext( *this, mxPortion->createFont() );
      61           0 :                 break;
      62             : 
      63             :                 case XLS_TOKEN( t ):
      64           1 :                     return this;    // collect portion text in onCharacters()
      65             :             }
      66           0 :         break;
      67             : 
      68             :         case XLS_TOKEN( rPh ):
      69           0 :             switch( nElement )
      70             :             {
      71             :                 case XLS_TOKEN( t ):
      72           0 :                     return this;    // collect phonetic text in onCharacters()
      73             :             }
      74           0 :         break;
      75             :     }
      76           0 :     return 0;
      77             : }
      78             : 
      79          61 : void RichStringContext::onCharacters( const OUString& rChars )
      80             : {
      81          61 :     if( isCurrentElement( XLS_TOKEN( t ) ) ) switch( getParentElement() )
      82             :     {
      83             :         case XLS_TOKEN( rPh ):
      84           0 :             if( mxPhonetic.get() )
      85           0 :                 mxPhonetic->setText( rChars );
      86           0 :         break;
      87             :         default:
      88          61 :             if( mxPortion.get() )
      89          61 :                 mxPortion->setText( rChars );
      90             :     }
      91          61 : }
      92             : 
      93             : // ============================================================================
      94             : 
      95             : } // namespace xls
      96          15 : } // namespace oox
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10