LCOV - code coverage report
Current view: top level - xmloff/source/style - XMLRectangleMembersHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 40 12.5 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 28 3.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <xmloff/xmluconv.hxx>
      30                 :            : #include <rtl/ustrbuf.hxx>
      31                 :            : #include <com/sun/star/uno/Any.hxx>
      32                 :            : 
      33                 :            : #include <com/sun/star/awt/Rectangle.hpp>
      34                 :            : #include "XMLRectangleMembersHandler.hxx"
      35                 :            : #include <xmloff/xmltypes.hxx>
      36                 :            : 
      37                 :            : using namespace ::com::sun::star;
      38                 :            : using namespace ::com::sun::star::uno;
      39                 :            : using ::rtl::OUString;
      40                 :            : using ::rtl::OUStringBuffer;
      41                 :            : 
      42                 :            : 
      43                 :       2976 : XMLRectangleMembersHdl::XMLRectangleMembersHdl( sal_Int32 nType )
      44                 :       2976 : : mnType( nType )
      45                 :            : {
      46                 :       2976 : }
      47                 :            : 
      48                 :       2936 : XMLRectangleMembersHdl::~XMLRectangleMembersHdl()
      49                 :            : {
      50         [ -  + ]:       5872 : }
      51                 :            : 
      52                 :          0 : sal_Bool XMLRectangleMembersHdl::importXML(
      53                 :            :     const OUString& rStrImpValue,
      54                 :            :     Any& rValue,
      55                 :            :     const SvXMLUnitConverter& rUnitConverter ) const
      56                 :            : {
      57                 :          0 :     awt::Rectangle aRect( 0, 0, 0, 0 );
      58         [ #  # ]:          0 :     if( rValue.hasValue() )
      59         [ #  # ]:          0 :         rValue >>= aRect;
      60                 :            : 
      61                 :            :     sal_Int32 nValue;
      62                 :            : 
      63 [ #  # ][ #  # ]:          0 :     if (rUnitConverter.convertMeasureToCore( nValue, rStrImpValue ))
      64                 :            :     {
      65   [ #  #  #  #  :          0 :         switch( mnType )
                      # ]
      66                 :            :         {
      67                 :            :             case XML_TYPE_RECTANGLE_LEFT :
      68                 :          0 :                 aRect.X = nValue;
      69                 :          0 :                 break;
      70                 :            :             case XML_TYPE_RECTANGLE_TOP :
      71                 :          0 :                 aRect.Y = nValue;
      72                 :          0 :                 break;
      73                 :            :             case XML_TYPE_RECTANGLE_WIDTH :
      74                 :          0 :                 aRect.Width = nValue;
      75                 :          0 :                 break;
      76                 :            :             case XML_TYPE_RECTANGLE_HEIGHT :
      77                 :          0 :                 aRect.Height = nValue;
      78                 :          0 :                 break;
      79                 :            :         }
      80                 :            : 
      81         [ #  # ]:          0 :         rValue <<= aRect;
      82                 :          0 :         return sal_True;
      83                 :            :     }
      84                 :            : 
      85                 :          0 :     return sal_False;
      86                 :            : }
      87                 :            : 
      88                 :          0 : sal_Bool XMLRectangleMembersHdl::exportXML(
      89                 :            :     OUString& rStrExpValue,
      90                 :            :     const Any& rValue,
      91                 :            :     const SvXMLUnitConverter& rUnitConverter ) const
      92                 :            : {
      93                 :          0 :     awt::Rectangle aRect( 0, 0, 0, 0 );
      94         [ #  # ]:          0 :     rValue >>= aRect;
      95                 :            : 
      96                 :            :     sal_Int32 nValue;
      97                 :            : 
      98   [ #  #  #  #  :          0 :     switch( mnType )
                      # ]
      99                 :            :     {
     100                 :            :         case XML_TYPE_RECTANGLE_LEFT :
     101                 :          0 :             nValue = aRect.X;
     102                 :          0 :             break;
     103                 :            :         case XML_TYPE_RECTANGLE_TOP :
     104                 :          0 :             nValue = aRect.Y;
     105                 :          0 :             break;
     106                 :            :         case XML_TYPE_RECTANGLE_WIDTH :
     107                 :          0 :             nValue = aRect.Width;
     108                 :          0 :             break;
     109                 :            :         case XML_TYPE_RECTANGLE_HEIGHT :
     110                 :          0 :             nValue = aRect.Height;
     111                 :          0 :             break;
     112                 :            :         default:
     113                 :          0 :             nValue = 0;  // TODO What value should this be?
     114                 :          0 :             break;
     115                 :            :     }
     116                 :            : 
     117                 :          0 :     rtl::OUStringBuffer sBuffer;
     118         [ #  # ]:          0 :     rUnitConverter.convertMeasureToXML( sBuffer, nValue );
     119         [ #  # ]:          0 :     rStrExpValue = sBuffer.makeStringAndClear();
     120                 :          0 :     return sal_True;
     121                 :            : }
     122                 :            : 
     123                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10