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

Generated by: LCOV version 1.10