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

Generated by: LCOV version 1.10