LCOV - code coverage report
Current view: top level - oox/source/drawingml/diagram - diagramdefinitioncontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 34 100.0 %
Date: 2015-06-13 12:38:46 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 "diagramdefinitioncontext.hxx"
      21             : #include "layoutnodecontext.hxx"
      22             : #include "datamodelcontext.hxx"
      23             : #include <osl/diagnose.h>
      24             : 
      25             : using namespace ::oox::core;
      26             : using namespace ::com::sun::star::uno;
      27             : using namespace ::com::sun::star::xml::sax;
      28             : 
      29             : namespace oox { namespace drawingml {
      30             : 
      31             : // CT_DiagramDefinition
      32          10 : DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler2Helper& rParent,
      33             :                                                     const AttributeList& rAttributes,
      34             :                                                     const DiagramLayoutPtr &pLayout )
      35             :     : ContextHandler2( rParent )
      36          10 :     , mpLayout( pLayout )
      37             : {
      38             :     OSL_TRACE( "OOX: DiagramDefinitionContext::DiagramDefinitionContext()" );
      39          10 :     mpLayout->setDefStyle( rAttributes.getString( XML_defStyle ).get() );
      40          10 :     OUString sValue = rAttributes.getString( XML_minVer ).get();
      41          10 :     if( sValue.isEmpty() )
      42             :     {
      43          10 :         sValue = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
      44             :     }
      45          10 :     mpLayout->setMinVer( sValue );
      46          10 :     mpLayout->setUniqueId( rAttributes.getString( XML_uniqueId ).get() );
      47          10 : }
      48             : 
      49          30 : DiagramDefinitionContext::~DiagramDefinitionContext()
      50             : {
      51          10 :     LayoutNodePtr node = mpLayout->getNode();
      52          10 :     if (node)
      53          10 :         node->dump(0);
      54          20 : }
      55             : 
      56             : ContextHandlerRef
      57          83 : DiagramDefinitionContext::onCreateContext( ::sal_Int32 aElement,
      58             :                                            const AttributeList& rAttribs )
      59             : {
      60          83 :     switch( aElement )
      61             :     {
      62             :     case DGM_TOKEN( title ):
      63          10 :         mpLayout->setTitle( rAttribs.getString( XML_val ).get() );
      64          10 :         break;
      65             :     case DGM_TOKEN( desc ):
      66          10 :         mpLayout->setDesc( rAttribs.getString( XML_val ).get() );
      67          10 :         break;
      68             :     case DGM_TOKEN( layoutNode ):
      69             :     {
      70          10 :         LayoutNodePtr pNode( new LayoutNode() );
      71          10 :         mpLayout->getNode() = pNode;
      72          10 :         pNode->setChildOrder( rAttribs.getToken( XML_chOrder, XML_b ) );
      73          10 :         pNode->setMoveWith( rAttribs.getString( XML_moveWith ).get() );
      74          10 :         pNode->setStyleLabel( rAttribs.getString( XML_styleLbl ).get() );
      75          10 :         return new LayoutNodeContext( *this, rAttribs, pNode );
      76             :     }
      77             :      case DGM_TOKEN( clrData ):
      78             :         // TODO, does not matter for the UI. skip.
      79          10 :         return 0;
      80             :     case DGM_TOKEN( sampData ):
      81          10 :         mpLayout->getSampData().reset( new DiagramData );
      82          10 :         return new DataModelContext( *this, mpLayout->getSampData() );
      83             :     case DGM_TOKEN( styleData ):
      84          10 :         mpLayout->getStyleData().reset( new DiagramData );
      85          10 :         return new DataModelContext( *this, mpLayout->getStyleData() );
      86             :     case DGM_TOKEN( cat ):
      87             :     case DGM_TOKEN( catLst ):
      88             :         // TODO, does not matter for the UI
      89             :     default:
      90          23 :         break;
      91             :     }
      92             : 
      93          43 :     return this;
      94             : }
      95             : 
      96         246 : } }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11