LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/draw - layerexp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 29 0.0 %
Date: 2012-12-27 Functions: 0 1 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             : 
      21             : #include <com/sun/star/drawing/XLayerSupplier.hpp>
      22             : #include <com/sun/star/container/XIndexAccess.hpp>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include <xmloff/xmltoken.hxx>
      25             : #include "xmloff/xmlnmspe.hxx"
      26             : #include <xmloff/xmlexp.hxx>
      27             : #include <xmloff/xmlement.hxx>
      28             : #include <xmloff/nmspmap.hxx>
      29             : #include "layerexp.hxx"
      30             : 
      31             : using ::rtl::OUString;
      32             : using ::rtl::OUStringBuffer;
      33             : using ::com::sun::star::uno::Reference;
      34             : 
      35             : using namespace ::cppu;
      36             : using namespace ::com::sun::star;
      37             : using namespace ::com::sun::star::uno;
      38             : using namespace ::com::sun::star::drawing;
      39             : using namespace ::com::sun::star::beans;
      40             : using namespace ::com::sun::star::lang;
      41             : using namespace ::com::sun::star::container;
      42             : using namespace ::xmloff::token;
      43             : 
      44           0 : void SdXMLayerExporter::exportLayer( SvXMLExport& rExport )
      45             : {
      46           0 :     Reference< XLayerSupplier > xLayerSupplier( rExport.GetModel(), UNO_QUERY );
      47           0 :     if( !xLayerSupplier.is() )
      48             :         return;
      49             : 
      50           0 :     Reference< XIndexAccess > xLayerManager( xLayerSupplier->getLayerManager(), UNO_QUERY );
      51           0 :     if( !xLayerManager.is() )
      52             :         return;
      53             : 
      54           0 :     const sal_Int32 nCount = xLayerManager->getCount();
      55           0 :     if( nCount == 0 )
      56             :         return;
      57             : 
      58           0 :     const OUString strName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
      59           0 :     const OUString strTitle( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
      60           0 :     const OUString strDescription( RTL_CONSTASCII_USTRINGPARAM( "Description" ) );
      61             : 
      62           0 :     OUString sTmp;
      63             : 
      64           0 :     SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_LAYER_SET, sal_True, sal_True );
      65             : 
      66           0 :     for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
      67             :     {
      68             :         try
      69             :         {
      70           0 :             Reference< XPropertySet> xLayer( xLayerManager->getByIndex( nIndex ), UNO_QUERY_THROW );
      71           0 :             xLayer->getPropertyValue( strName ) >>= sTmp;
      72           0 :             if(!sTmp.isEmpty())
      73           0 :                 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, sTmp );
      74             : 
      75           0 :             SvXMLElementExport aEle( rExport, XML_NAMESPACE_DRAW, XML_LAYER, sal_True, sal_True );
      76             : 
      77             :             // title property (as <svg:title> element)
      78           0 :             xLayer->getPropertyValue(strTitle) >>= sTmp;
      79           0 :             if(!sTmp.isEmpty())
      80             :             {
      81           0 :                 SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
      82           0 :                 rExport.Characters(sTmp);
      83             :             }
      84             : 
      85             :             // description property (as <svg:desc> element)
      86           0 :             xLayer->getPropertyValue(strDescription) >>= sTmp;
      87           0 :             if(!sTmp.isEmpty())
      88             :             {
      89           0 :                 SvXMLElementExport aDesc(rExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False);
      90           0 :                 rExport.Characters(sTmp);
      91           0 :             }
      92             :         }
      93           0 :         catch( Exception& )
      94             :         {
      95             :             OSL_FAIL("SdXMLayerExporter::exportLayer(), exception caught during export of one layer!");
      96             :         }
      97           0 :     }
      98             : }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10