LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximpgrp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 28 34 82.4 %
Date: 2012-08-25 Functions: 6 11 54.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 21 56 37.5 %

           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"xmloff/xmlnmspe.hxx"
      30                 :            : #include "ximpgrp.hxx"
      31                 :            : #include <xmloff/xmltoken.hxx>
      32                 :            : #include "ximpshap.hxx"
      33                 :            : #include "eventimp.hxx"
      34                 :            : #include "descriptionimp.hxx"
      35                 :            : 
      36                 :            : using ::rtl::OUString;
      37                 :            : using ::rtl::OUStringBuffer;
      38                 :            : 
      39                 :            : using namespace ::com::sun::star;
      40                 :            : using namespace ::xmloff::token;
      41                 :            : 
      42                 :            : //////////////////////////////////////////////////////////////////////////////
      43                 :            : 
      44 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext );
      45                 :            : 
      46                 :          6 : SdXMLGroupShapeContext::SdXMLGroupShapeContext(
      47                 :            :     SvXMLImport& rImport,
      48                 :            :     sal_uInt16 nPrfx, const OUString& rLocalName,
      49                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList,
      50                 :            :     uno::Reference< drawing::XShapes >& rShapes,
      51                 :            :     sal_Bool bTemporaryShape)
      52                 :          6 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
      53                 :            : {
      54                 :          6 : }
      55                 :            : 
      56                 :            : //////////////////////////////////////////////////////////////////////////////
      57                 :            : 
      58                 :          6 : SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
      59                 :            : {
      60         [ -  + ]:         12 : }
      61                 :            : 
      62                 :            : //////////////////////////////////////////////////////////////////////////////
      63                 :            : 
      64                 :         12 : SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
      65                 :            :     const OUString& rLocalName,
      66                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
      67                 :            : {
      68                 :         12 :     SvXMLImportContext* pContext = 0L;
      69                 :            : 
      70                 :            :     // #i68101#
      71   [ -  +  #  #  :         12 :     if( nPrefix == XML_NAMESPACE_SVG &&
           #  # ][ -  + ]
      72                 :          0 :         (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
      73                 :            :     {
      74         [ #  # ]:          0 :         pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
      75                 :            :     }
      76 [ -  + ][ #  # ]:         12 :     else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
                 [ -  + ]
      77                 :            :     {
      78         [ #  # ]:          0 :         pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
      79                 :            :     }
      80 [ +  - ][ -  + ]:         12 :     else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
                 [ -  + ]
      81                 :            :     {
      82                 :          0 :         addGluePoint( xAttrList );
      83                 :            :     }
      84                 :            :     else
      85                 :            :     {
      86                 :            :         // call GroupChildContext function at common ShapeImport
      87                 :         12 :         pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
      88 [ +  - ][ +  - ]:         24 :             GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
      89                 :            :     }
      90                 :            : 
      91                 :            :     // call parent when no own context was created
      92         [ -  + ]:         12 :     if(!pContext)
      93                 :            :         pContext = SvXMLImportContext::CreateChildContext(
      94                 :          0 :         nPrefix, rLocalName, xAttrList);
      95                 :            : 
      96                 :         12 :     return pContext;
      97                 :            : }
      98                 :            : 
      99                 :            : //////////////////////////////////////////////////////////////////////////////
     100                 :            : 
     101                 :          6 : void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
     102                 :            : {
     103                 :            :     // create new group shape and add it to rShapes, use it
     104                 :            :     // as base for the new group import
     105                 :          6 :     AddShape( "com.sun.star.drawing.GroupShape" );
     106                 :            : 
     107         [ +  - ]:          6 :     if(mxShape.is())
     108                 :            :     {
     109                 :          6 :         SetStyle( false );
     110                 :            : 
     111         [ +  - ]:          6 :         mxChildren = uno::Reference< drawing::XShapes >::query( mxShape );
     112         [ +  - ]:          6 :         if( mxChildren.is() )
     113 [ +  - ][ +  - ]:          6 :             GetImport().GetShapeImport()->pushGroupForSorting( mxChildren );
     114                 :            :     }
     115                 :            : 
     116 [ +  - ][ +  - ]:          6 :     GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
     117                 :          6 : }
     118                 :            : 
     119                 :            : //////////////////////////////////////////////////////////////////////////////
     120                 :            : 
     121                 :          6 : void SdXMLGroupShapeContext::EndElement()
     122                 :            : {
     123         [ +  - ]:          6 :     if( mxChildren.is() )
     124 [ +  - ][ +  - ]:          6 :         GetImport().GetShapeImport()->popGroupAndSort();
     125                 :            : 
     126                 :          6 :     SdXMLShapeContext::EndElement();
     127                 :          6 : }
     128                 :            : 
     129                 :            : 
     130                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10