LCOV - code coverage report
Current view: top level - oox/source/vml - vmldrawingfragment.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 20 90.0 %
Date: 2014-11-03 Functions: 6 6 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 "oox/vml/vmldrawingfragment.hxx"
      21             : 
      22             : #include "oox/core/xmlfilterbase.hxx"
      23             : #include "oox/vml/vmldrawing.hxx"
      24             : #include "oox/vml/vmlinputstream.hxx"
      25             : #include "oox/vml/vmlshapecontext.hxx"
      26             : 
      27             : namespace oox {
      28             : namespace vml {
      29             : 
      30             : using namespace ::com::sun::star::io;
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::oox::core;
      33             : 
      34        1532 : DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, Drawing& rDrawing ) :
      35             :     FragmentHandler2( rFilter, rFragmentPath, false ),  // do not trim whitespace, has been preprocessed by the input stream
      36        1532 :     mrDrawing( rDrawing )
      37             : {
      38        1532 : }
      39             : 
      40           8 : Reference< XInputStream > DrawingFragment::openFragmentStream() const
      41             : {
      42             :     // #i104719# create an input stream that preprocesses the VML data
      43           8 :     return new InputStream( getFilter().getComponentContext(), FragmentHandler2::openFragmentStream() );
      44             : }
      45             : 
      46        1094 : ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      47             : {
      48        1094 :     switch( mrDrawing.getType() )
      49             :     {
      50             :         // DOCX filter handles plain shape elements with this fragment handler
      51             :         case VMLDRAWING_WORD:
      52        1062 :             if ( getNamespace( nElement ) == NMSP_vml )
      53        1050 :                 return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
      54          12 :         break;
      55             : 
      56             :         // XLSX and PPTX filters load the entire VML fragment
      57             :         case VMLDRAWING_EXCEL:
      58             :         case VMLDRAWING_POWERPOINT:
      59          32 :             switch( getCurrentElement() )
      60             :             {
      61             :                 case XML_ROOT_CONTEXT:
      62           8 :                     if( nElement == XML_xml ) return this;
      63           0 :                 break;
      64             :                 case XML_xml:
      65          24 :                     return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
      66             :             }
      67           0 :         break;
      68             :     }
      69          12 :     return 0;
      70             : }
      71             : 
      72           8 : void DrawingFragment::finalizeImport()
      73             : {
      74             :     // resolve shape template references for all shapes
      75           8 :     mrDrawing.finalizeFragmentImport();
      76           8 : }
      77             : 
      78             : } // namespace vml
      79         408 : } // namespace oox
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10