LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/oox/drawingml - drawingmltypes.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 12 66.7 %
Date: 2012-08-25 Functions: 6 10 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : #ifndef OOX_DRAWINGML_TYPES_HXX
      21                 :            : #define OOX_DRAWINGML_TYPES_HXX
      22                 :            : 
      23                 :            : #include <boost/shared_ptr.hpp>
      24                 :            : #include <com/sun/star/style/TabAlign.hpp>
      25                 :            : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      26                 :            : #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
      27                 :            : #include <com/sun/star/awt/Point.hpp>
      28                 :            : #include <com/sun/star/awt/Size.hpp>
      29                 :            : #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
      30                 :            : #include "oox/helper/helper.hxx"
      31                 :            : 
      32                 :            : namespace oox {
      33                 :            : namespace drawingml {
      34                 :            : 
      35                 :            : // ============================================================================
      36                 :            : 
      37                 :            : const sal_Int32 PER_PERCENT     = 1000;
      38                 :            : const sal_Int32 MAX_PERCENT     = 100 * PER_PERCENT;
      39                 :            : 
      40                 :            : const sal_Int32 PER_DEGREE      = 60000;
      41                 :            : const sal_Int32 MAX_DEGREE      = 360 * PER_DEGREE;
      42                 :            : 
      43                 :            : // ============================================================================
      44                 :            : 
      45                 :            : struct LineProperties;
      46                 :            : typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
      47                 :            : 
      48                 :            : struct FillProperties;
      49                 :            : typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
      50                 :            : 
      51                 :            : struct GraphicProperties;
      52                 :            : typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
      53                 :            : 
      54                 :            : struct Shape3DProperties;
      55                 :            : typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
      56                 :            : 
      57                 :            : struct TextCharacterProperties;
      58                 :            : typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
      59                 :            : 
      60                 :            : struct TextBodyProperties;
      61                 :            : typedef ::boost::shared_ptr< TextBodyProperties > TextBodyPropertiesPtr;
      62                 :            : 
      63                 :            : class TextBody;
      64                 :            : typedef ::boost::shared_ptr< TextBody > TextBodyPtr;
      65                 :            : 
      66                 :            : class Shape;
      67                 :            : typedef ::boost::shared_ptr< Shape > ShapePtr;
      68                 :            : 
      69                 :            : class Theme;
      70                 :            : typedef ::boost::shared_ptr< Theme > ThemePtr;
      71                 :            : 
      72                 :            : // ---------------------------------------------------------------------------
      73                 :            : 
      74                 :            : namespace table {
      75                 :            : 
      76                 :            : class TableProperties;
      77                 :            : typedef ::boost::shared_ptr< TableProperties > TablePropertiesPtr;
      78                 :            : 
      79                 :            : } // namespace table
      80                 :            : 
      81                 :            : // ============================================================================
      82                 :            : 
      83                 :            : /** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */
      84                 :            : com::sun::star::awt::Point GetPointPercent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs );
      85                 :            : 
      86                 :            : 
      87                 :            : /** converts the attributes from an CT_Size2D into an awt Size with 1/100th mm */
      88                 :            : com::sun::star::awt::Size GetSize2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
      89                 :            : 
      90                 :            : /** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */
      91                 :            : com::sun::star::geometry::IntegerRectangle2D GetRelativeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
      92                 :            : 
      93                 :            : /** converts EMUs into 1/100th mmm */
      94                 :            : sal_Int32 GetCoordinate( sal_Int32 nValue );
      95                 :            : 
      96                 :            : /** converts an emu string into 1/100th mmm */
      97                 :            : sal_Int32 GetCoordinate( const ::rtl::OUString& sValue );
      98                 :            : 
      99                 :            : /** converts a ST_Percentage % string into 1/1000th of % */
     100                 :            : sal_Int32 GetPercent( const ::rtl::OUString& sValue );
     101                 :            : 
     102                 :            : /** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */
     103                 :            : double GetPositiveFixedPercentage( const ::rtl::OUString& sValue );
     104                 :            : 
     105                 :            : /** converts the ST_TextFontSize to point */
     106                 :            : float GetTextSize( const ::rtl::OUString& rValue );
     107                 :            : 
     108                 :            : /** converts the ST_TextSpacingPoint to 1/100mm */
     109                 :            : sal_Int32 GetTextSpacingPoint(  const ::rtl::OUString& sValue );
     110                 :            : sal_Int32 GetTextSpacingPoint(  const sal_Int32 nValue );
     111                 :            : 
     112                 :            : /** */
     113                 :            : ::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
     114                 :            : 
     115                 :            : float GetFontHeight( sal_Int32 nHeight );
     116                 :            : 
     117                 :            : sal_Int16 GetFontUnderline( sal_Int32 nToken );
     118                 :            : 
     119                 :            : sal_Int16 GetFontStrikeout( sal_Int32 nToken );
     120                 :            : 
     121                 :            : sal_Int16 GetCaseMap( sal_Int32 nToken );
     122                 :            : 
     123                 :            : /** converts a paragraph align to a ParaAdjust */
     124                 :            : sal_Int16 GetParaAdjust( sal_Int32 nAlign );
     125                 :            : 
     126                 :            : // ============================================================================
     127                 :            : 
     128                 :            : // CT_IndexRange
     129                 :            : struct IndexRange {
     130                 :            :     sal_Int32 start;
     131                 :            :     sal_Int32 end;
     132                 :            : };
     133                 :            : 
     134                 :            : /** retrieve the content of CT_IndexRange */
     135                 :            : IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
     136                 :            : 
     137                 :            : // ============================================================================
     138                 :            : 
     139                 :            : const sal_Int32 EMU_PER_HMM = 360;      /// 360 EMUs per 1/100 mm.
     140                 :            : 
     141                 :            : /** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
     142                 :         36 : inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
     143                 :            : {
     144                 :         36 :     return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
     145                 :            : }
     146                 :            : 
     147                 :            : /** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
     148                 :        393 : inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
     149                 :            : {
     150                 :        393 :     return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
     151                 :            : }
     152                 :            : 
     153                 :            : // ============================================================================
     154                 :            : 
     155                 :            : /** A structure for a point with 64-bit interger components. */
     156                 :            : struct EmuPoint
     157                 :            : {
     158                 :            :     sal_Int64           X;
     159                 :            :     sal_Int64           Y;
     160                 :            : 
     161                 :          0 :     inline explicit     EmuPoint() : X( 0 ), Y( 0 ) {}
     162                 :         24 :     inline explicit     EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {}
     163                 :            : };
     164                 :            : 
     165                 :            : // ============================================================================
     166                 :            : 
     167                 :            : /** A structure for a size with 64-bit interger components. */
     168                 :            : struct EmuSize
     169                 :            : {
     170                 :            :     sal_Int64           Width;
     171                 :            :     sal_Int64           Height;
     172                 :            : 
     173                 :          0 :     inline explicit     EmuSize() : Width( 0 ), Height( 0 ) {}
     174                 :         18 :     inline explicit     EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {}
     175                 :            : };
     176                 :            : 
     177                 :            : // ============================================================================
     178                 :            : 
     179                 :            : /** A structure for a rectangle with 64-bit interger components. */
     180                 :            : struct EmuRectangle : public EmuPoint, public EmuSize
     181                 :            : {
     182                 :          0 :     inline explicit     EmuRectangle() {}
     183                 :            :     inline explicit     EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
     184                 :          6 :     inline explicit     EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
     185                 :            : 
     186                 :          6 :     inline void         setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
     187                 :          0 :     inline void         setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
     188                 :            : };
     189                 :            : 
     190                 :            : // ============================================================================
     191                 :            : 
     192                 :            : } // namespace drawingml
     193                 :            : } // namespace oox
     194                 :            : 
     195                 :            : #endif
     196                 :            : 
     197                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10