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

Generated by: LCOV version 1.10