LCOV - code coverage report
Current view: top level - oox/source/drawingml - transform2dcontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 4 0.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/drawingml/transform2dcontext.hxx"
      21             : #include "oox/helper/attributelist.hxx"
      22             : #include "oox/drawingml/shape.hxx"
      23             : #include "oox/drawingml/textbody.hxx"
      24             : 
      25             : using namespace ::com::sun::star;
      26             : using ::com::sun::star::uno::Reference;
      27             : using ::com::sun::star::uno::RuntimeException;
      28             : using ::com::sun::star::xml::sax::SAXException;
      29             : using ::com::sun::star::xml::sax::XFastAttributeList;
      30             : using ::com::sun::star::xml::sax::XFastContextHandler;
      31             : using ::oox::core::ContextHandlerRef;
      32             : 
      33             : namespace oox {
      34             : namespace drawingml {
      35             : 
      36             : /** context to import a CT_Transform2D */
      37           0 : Transform2DContext::Transform2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, Shape& rShape, bool btxXfrm ) throw()
      38             : : ContextHandler2( rParent )
      39             : , mrShape( rShape )
      40           0 : , mbtxXfrm ( btxXfrm )
      41             : {
      42           0 :     if( !btxXfrm )
      43             :     {
      44           0 :         mrShape.setRotation( rAttribs.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise
      45           0 :         mrShape.setFlip( rAttribs.getBool( XML_flipH, false ), rAttribs.getBool( XML_flipV, false ) );
      46             :     }
      47             :     else
      48             :     {
      49           0 :         if( rAttribs.hasAttribute( XML_rot ) )
      50           0 :             mrShape.getTextBody()->getTextProperties().moRotation = -rAttribs.getInteger( XML_rot ).get();
      51             :     }
      52           0 : }
      53             : 
      54           0 : ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      55             : {
      56           0 :     if( mbtxXfrm )
      57             :     {
      58           0 :         switch( aElementToken )
      59             :         {
      60             :             case A_TOKEN( off ):
      61             :                 {
      62           0 :                     OUString sXValue = rAttribs.getString( XML_x ).get();
      63           0 :                     OUString sYValue = rAttribs.getString( XML_y ).get();
      64           0 :                     if( !sXValue.isEmpty() )
      65           0 :                         mrShape.getTextBody()->getTextProperties().moTextOffX = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
      66           0 :                     if( !sYValue.isEmpty() )
      67           0 :                         mrShape.getTextBody()->getTextProperties().moTextOffY = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
      68             :                 }
      69           0 :                 break;
      70             :             case A_TOKEN( ext ):
      71           0 :                 break;
      72             :         }
      73           0 :         return 0;
      74             :     }
      75             : 
      76           0 :     switch( aElementToken )
      77             :     {
      78             :     case A_TOKEN( off ):        // horz/vert translation
      79           0 :         mrShape.setPosition( awt::Point( rAttribs.getString( XML_x ).get().toInt32(), rAttribs.getString( XML_y ).get().toInt32() ) );
      80           0 :         break;
      81             :     case A_TOKEN( ext ):        // horz/vert size
      82           0 :         mrShape.setSize( awt::Size( rAttribs.getString( XML_cx ).get().toInt32(), rAttribs.getString( XML_cy ).get().toInt32() ) );
      83           0 :         break;
      84             :     case A_TOKEN( chOff ):  // horz/vert translation of children
      85           0 :         mrShape.setChildPosition( awt::Point( rAttribs.getString( XML_x ).get().toInt32(), rAttribs.getString( XML_y ).get().toInt32() ) );
      86           0 :         break;
      87             :     case A_TOKEN( chExt ):  // horz/vert size of children
      88           0 :         mrShape.setChildSize( awt::Size( rAttribs.getString( XML_cx ).get().toInt32(), rAttribs.getString( XML_cy ).get().toInt32() ) );
      89           0 :         break;
      90             :     }
      91             : 
      92           0 :     return 0;
      93             : }
      94             : 
      95             : } // namespace drawingml
      96           0 : } // namespace oox
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10