LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/reportdesign/source/filter/xml - xmlImage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 33 0.0 %
Date: 2013-07-09 Functions: 0 3 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             : #include "xmlImage.hxx"
      20             : #include "xmlfilter.hxx"
      21             : #include <xmloff/xmltoken.hxx>
      22             : #include <xmloff/xmlnmspe.hxx>
      23             : #include <xmloff/nmspmap.hxx>
      24             : #include <xmloff/xmluconv.hxx>
      25             : #include "xmlEnums.hxx"
      26             : #include "xmlComponent.hxx"
      27             : #include "xmlReportElement.hxx"
      28             : #include "xmlControlProperty.hxx"
      29             : #include "xmlHelper.hxx"
      30             : #include <tools/debug.hxx>
      31             : #include <unotools/pathoptions.hxx>
      32             : 
      33             : #include <com/sun/star/awt/ImageScaleMode.hpp>
      34             : 
      35             : namespace rptxml
      36             : {
      37             :     using namespace ::com::sun::star;
      38             :     using namespace ::com::sun::star::uno;
      39             :     using namespace ::com::sun::star::xml::sax;
      40             : DBG_NAME( rpt_OXMLImage )
      41             : 
      42             : 
      43             : // -----------------------------------------------------------------------------
      44           0 : OXMLImage::OXMLImage( ORptFilter& rImport,
      45             :                 sal_uInt16 nPrfx, const OUString& rLName,
      46             :                 const Reference< XAttributeList > & _xAttrList
      47             :                 ,const Reference< XImageControl > & _xComponent
      48             :                 ,OXMLTable* _pContainer) :
      49           0 :     OXMLReportElementBase( rImport, nPrfx, rLName,_xComponent.get(),_pContainer)
      50             : {
      51             :     DBG_CTOR( rpt_OXMLImage,NULL);
      52             : 
      53             :     OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
      54           0 :     const SvXMLNamespaceMap& rMap = m_rImport.GetNamespaceMap();
      55           0 :     const SvXMLTokenMap& rTokenMap = m_rImport.GetControlElemTokenMap();
      56           0 :     static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
      57             : 
      58           0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
      59             :     try
      60             :     {
      61           0 :         for(sal_Int16 i = 0; i < nLength; ++i)
      62             :         {
      63           0 :          OUString sLocalName;
      64           0 :             const OUString sAttrName = _xAttrList->getNameByIndex( i );
      65           0 :             const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      66           0 :             /* const */ OUString sValue = _xAttrList->getValueByIndex( i );
      67             : 
      68           0 :             switch( rTokenMap.Get( nPrefix, sLocalName ) )
      69             :             {
      70             :                 case XML_TOK_IMAGE_DATA:
      71             :                     {
      72           0 :                         SvtPathOptions aPathOptions;
      73           0 :                         sValue = aPathOptions.SubstituteVariable(sValue);
      74           0 :                         _xComponent->setImageURL(rImport.GetAbsoluteReference( sValue ));
      75             :                     }
      76             : 
      77           0 :                     break;
      78             :                 case XML_TOK_PRESERVE_IRI:
      79           0 :                     _xComponent->setPreserveIRI(s_sTRUE == sValue);
      80           0 :                     break;
      81             :                 case XML_TOK_SCALE:
      82             :                     {
      83           0 :                         sal_uInt16 nRet = awt::ImageScaleMode::NONE;
      84           0 :                         if ( s_sTRUE == sValue )
      85             :                         {
      86           0 :                             nRet = awt::ImageScaleMode::ANISOTROPIC;
      87             :                         }
      88             :                         else
      89             :                         {
      90           0 :                                    const SvXMLEnumMapEntry* aXML_EnumMap = OXMLHelper::GetImageScaleOptions();
      91           0 :                                    SvXMLUnitConverter::convertEnum( nRet, sValue, aXML_EnumMap );
      92             :                         }
      93           0 :                         _xComponent->setScaleMode( nRet );
      94             :                     }
      95           0 :                     break;
      96             :                 case XML_TOK_DATA_FORMULA:
      97           0 :                     _xComponent->setDataField(ORptFilter::convertFormula(sValue));
      98           0 :                     break;
      99             :                 default:
     100           0 :                     break;
     101             :             }
     102           0 :         }
     103             :     }
     104           0 :     catch(Exception&)
     105             :     {
     106             :         OSL_FAIL("Exception catched while filling the image props");
     107             :     }
     108           0 : }
     109             : // -----------------------------------------------------------------------------
     110             : 
     111           0 : OXMLImage::~OXMLImage()
     112             : {
     113             : 
     114             :     DBG_DTOR( rpt_OXMLImage,NULL);
     115           0 : }
     116             : // -----------------------------------------------------------------------------
     117             : 
     118             : //----------------------------------------------------------------------------
     119             : } // namespace rptxml
     120             : // -----------------------------------------------------------------------------
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10