LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximpnote.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 36 42 85.7 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.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 "ximpnote.hxx"
      21             : #include <com/sun/star/presentation/XPresentationPage.hpp>
      22             : 
      23             : using namespace ::com::sun::star;
      24             : 
      25         115 : SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
      26             :     sal_uInt16 nPrfx, const OUString& rLocalName,
      27             :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
      28             :     uno::Reference< drawing::XShapes >& rShapes)
      29         115 : :   SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
      30             : {
      31         115 :     OUString sStyleName;
      32             : 
      33         115 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
      34         230 :     for(sal_Int16 i=0; i < nAttrCount; i++)
      35             :     {
      36         115 :         OUString sAttrName = xAttrList->getNameByIndex( i );
      37         230 :         OUString aLocalName;
      38         115 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
      39         230 :         OUString sValue = xAttrList->getValueByIndex( i );
      40         115 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
      41             : 
      42         115 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
      43             :         {
      44             :             case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
      45             :             {
      46          42 :                 msPageMasterName = sValue;
      47          42 :                 break;
      48             :             }
      49             :             case XML_TOK_MASTERPAGE_STYLE_NAME:
      50             :             {
      51          73 :                 sStyleName = sValue;
      52          73 :                 break;
      53             :             }
      54             :             case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
      55             :             {
      56           0 :                 maUseHeaderDeclName =  sValue;
      57           0 :                 break;
      58             :             }
      59             :             case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
      60             :             {
      61           0 :                 maUseFooterDeclName =  sValue;
      62           0 :                 break;
      63             :             }
      64             :             case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
      65             :             {
      66           0 :                 maUseDateTimeDeclName =  sValue;
      67           0 :                 break;
      68             :             }
      69             : 
      70             :         }
      71         115 :     }
      72             : 
      73         115 :     SetStyle( sStyleName );
      74             : 
      75             :     // now delete all up-to-now contained shapes from this notes page
      76         115 :     uno::Reference< drawing::XShape > xShape;
      77         628 :     while(rShapes->getCount())
      78             :     {
      79         398 :         rShapes->getByIndex(0L) >>= xShape;
      80         398 :         if(xShape.is())
      81         398 :             rShapes->remove(xShape);
      82             :     }
      83             : 
      84             :     // set page-master?
      85         115 :     if(!msPageMasterName.isEmpty())
      86             :     {
      87          42 :         SetPageMaster( msPageMasterName );
      88         115 :     }
      89         115 : }
      90             : 
      91         230 : SdXMLNotesContext::~SdXMLNotesContext()
      92             : {
      93         230 : }
      94             : 
      95         400 : SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix,
      96             :     const OUString& rLocalName,
      97             :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
      98             : {
      99             :     // OK, notes page is set on base class, objects can be imported on notes page
     100         400 :     SvXMLImportContext *pContext = 0L;
     101             : 
     102             :     // some special objects inside presentation:notes context
     103             : 
     104             : 
     105             :     // call parent when no own context was created
     106         400 :     if(!pContext)
     107         400 :         pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
     108             : 
     109         400 :     return pContext;
     110             : }
     111             : 
     112         115 : void SdXMLNotesContext::EndElement()
     113             : {
     114         115 :     SdXMLGenericPageContext::EndElement();
     115         115 : }
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11