LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximpnote.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 36 42 85.7 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 30 56 53.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "ximpnote.hxx"
      30                 :            : #include <com/sun/star/presentation/XPresentationPage.hpp>
      31                 :            : 
      32                 :            : using ::rtl::OUString;
      33                 :            : using ::rtl::OUStringBuffer;
      34                 :            : 
      35                 :            : using namespace ::com::sun::star;
      36                 :            : 
      37                 :            : //////////////////////////////////////////////////////////////////////////////
      38                 :            : 
      39                 :         35 : SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
      40                 :            :     sal_uInt16 nPrfx, const OUString& rLocalName,
      41                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
      42                 :            :     uno::Reference< drawing::XShapes >& rShapes)
      43                 :         35 : :   SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
      44                 :            : {
      45                 :         35 :     OUString sStyleName;
      46                 :            : 
      47 [ +  - ][ +  - ]:         35 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
      48         [ +  + ]:         70 :     for(sal_Int16 i=0; i < nAttrCount; i++)
      49                 :            :     {
      50 [ +  - ][ +  - ]:         35 :         OUString sAttrName = xAttrList->getNameByIndex( i );
      51                 :         35 :         OUString aLocalName;
      52         [ +  - ]:         35 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
      53 [ +  - ][ +  - ]:         35 :         OUString sValue = xAttrList->getValueByIndex( i );
      54         [ +  - ]:         35 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
      55                 :            : 
      56 [ +  - ][ +  +  :         35 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
             -  -  -  - ]
      57                 :            :         {
      58                 :            :             case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
      59                 :            :             {
      60                 :          7 :                 msPageMasterName = sValue;
      61                 :          7 :                 break;
      62                 :            :             }
      63                 :            :             case XML_TOK_MASTERPAGE_STYLE_NAME:
      64                 :            :             {
      65                 :         28 :                 sStyleName = sValue;
      66                 :         28 :                 break;
      67                 :            :             }
      68                 :            :             case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
      69                 :            :             {
      70                 :          0 :                 maUseHeaderDeclName =  sValue;
      71                 :          0 :                 break;
      72                 :            :             }
      73                 :            :             case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
      74                 :            :             {
      75                 :          0 :                 maUseFooterDeclName =  sValue;
      76                 :          0 :                 break;
      77                 :            :             }
      78                 :            :             case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
      79                 :            :             {
      80                 :          0 :                 maUseDateTimeDeclName =  sValue;
      81                 :          0 :                 break;
      82                 :            :             }
      83                 :            : 
      84                 :            :         }
      85                 :         35 :     }
      86                 :            : 
      87         [ +  - ]:         35 :     SetStyle( sStyleName );
      88                 :            : 
      89                 :            :     // now delete all up-to-now contained shapes from this notes page
      90                 :         35 :     uno::Reference< drawing::XShape > xShape;
      91 [ +  - ][ +  - ]:        133 :     while(rShapes->getCount())
                 [ +  + ]
      92                 :            :     {
      93 [ +  - ][ +  - ]:         98 :         rShapes->getByIndex(0L) >>= xShape;
                 [ +  - ]
      94         [ +  - ]:         98 :         if(xShape.is())
      95 [ +  - ][ +  - ]:         98 :             rShapes->remove(xShape);
      96                 :            :     }
      97                 :            : 
      98                 :            :     // set page-master?
      99         [ +  + ]:         35 :     if(!msPageMasterName.isEmpty())
     100                 :            :     {
     101         [ +  - ]:          7 :         SetPageMaster( msPageMasterName );
     102                 :         35 :     }
     103                 :         35 : }
     104                 :            : 
     105                 :            : //////////////////////////////////////////////////////////////////////////////
     106                 :            : 
     107                 :         35 : SdXMLNotesContext::~SdXMLNotesContext()
     108                 :            : {
     109         [ -  + ]:         70 : }
     110                 :            : 
     111                 :            : //////////////////////////////////////////////////////////////////////////////
     112                 :            : 
     113                 :         90 : SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix,
     114                 :            :     const OUString& rLocalName,
     115                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
     116                 :            : {
     117                 :            :     // OK, notes page is set on base class, objects can be imported on notes page
     118                 :         90 :     SvXMLImportContext *pContext = 0L;
     119                 :            : 
     120                 :            :     // some special objects inside presentation:notes context
     121                 :            :     // ...
     122                 :            : 
     123                 :            : 
     124                 :            : 
     125                 :            : 
     126                 :            : 
     127                 :            : 
     128                 :            : 
     129                 :            :     // call parent when no own context was created
     130         [ +  - ]:         90 :     if(!pContext)
     131                 :         90 :         pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
     132                 :            : 
     133                 :         90 :     return pContext;
     134                 :            : }
     135                 :            : 
     136                 :            : //////////////////////////////////////////////////////////////////////////////
     137                 :            : 
     138                 :         35 : void SdXMLNotesContext::EndElement()
     139                 :            : {
     140                 :         35 :     SdXMLGenericPageContext::EndElement();
     141                 :         35 : }
     142                 :            : 
     143                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10