LCOV - code coverage report
Current view: top level - xmloff/source/forms - elementimport_impl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 28 42.9 %
Date: 2012-08-25 Functions: 2 14 14.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 80 10.0 %

           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                 :            : // no include protection. This file is included from elementimport.hxx only.
      30                 :            : 
      31                 :            : #ifndef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
      32                 :            : #error "do not include this file directly!"
      33                 :            : #endif
      34                 :            : 
      35                 :            : // no namespace. Same as above: this file is included from elementimport.hxx only,
      36                 :            : // and this is done inside the namespace
      37                 :            : 
      38                 :            : //=========================================================================
      39                 :            : //= OContainerImport
      40                 :            : //=========================================================================
      41                 :            : //-------------------------------------------------------------------------
      42                 :            : template <class BASE>
      43                 :          0 : inline SvXMLImportContext* OContainerImport< BASE >::CreateChildContext(
      44                 :            :     sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
      45                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList)
      46                 :            : {
      47                 :            :     // maybe it's a sub control
      48 [ #  # ][ #  # ]:          0 :     if (_rLocalName == m_sWrapperElementName)
      49                 :            :     {
      50 [ #  # ][ #  # ]:          0 :         if (m_xMeAsContainer.is())
      51                 :          0 :             return implCreateControlWrapper(_nPrefix, _rLocalName);
      52                 :            :         else
      53                 :            :         {
      54                 :            :             OSL_FAIL("OContainerImport::CreateChildContext: don't have an element!");
      55                 :          0 :             return NULL;
      56                 :            :         }
      57                 :            :     }
      58                 :            : 
      59                 :          0 :     return BASE::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
      60                 :            : }
      61                 :            : 
      62                 :            : //-------------------------------------------------------------------------
      63                 :            : template <class BASE>
      64                 :            : inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
      65                 :         12 :     OContainerImport< BASE >::createElement()
      66                 :            : {
      67                 :            :     // let the base class create the object
      68                 :         12 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn = BASE::createElement();
      69   [ #  #  -  + ]:         12 :     if (!xReturn.is())
      70                 :          0 :         return xReturn;
      71                 :            : 
      72                 :            :     // ensure that the object is a XNameContainer (we strongly need this for inserting child elements)
      73 [ #  # ][ #  # ]:         12 :     m_xMeAsContainer = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >(xReturn, ::com::sun::star::uno::UNO_QUERY);
         [ +  - ][ +  - ]
      74   [ #  #  -  + ]:         12 :     if (!m_xMeAsContainer.is())
      75                 :            :     {
      76                 :            :         OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!");
      77                 :          0 :         xReturn.clear();
      78                 :            :     }
      79                 :            : 
      80                 :         12 :     return xReturn;
      81                 :            : }
      82                 :            : 
      83                 :            : //-------------------------------------------------------------------------
      84                 :            : template <class BASE>
      85                 :         12 : inline void OContainerImport< BASE >::EndElement()
      86                 :            : {
      87 [ #  # ][ +  - ]:         12 :     BASE::EndElement();
      88                 :            : 
      89                 :            :     // now that we have all children, attach the events
      90 [ #  # ][ +  - ]:         12 :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, ::com::sun::star::uno::UNO_QUERY);
      91 [ #  # ][ +  - ]:         12 :     if (xIndexContainer.is())
      92 [ #  # ][ +  - ]:         12 :         ODefaultEventAttacherManager::setEvents(xIndexContainer);
      93                 :         12 : }
      94                 :            : 
      95                 :            : //=========================================================================
      96                 :            : //= OColumnImport
      97                 :            : //=========================================================================
      98                 :            : //-------------------------------------------------------------------------
      99                 :            : template <class BASE>
     100                 :          0 : OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
     101                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
     102                 :            :         OControlElement::ElementType _eType)
     103                 :            :     :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
     104 [ #  # ][ #  # ]:          0 :     ,m_xColumnFactory(_rxParentContainer, ::com::sun::star::uno::UNO_QUERY)
         [ #  # ][ #  # ]
     105                 :            : {
     106                 :            :     OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!");
     107                 :          0 : }
     108                 :            : 
     109                 :            : //-------------------------------------------------------------------------
     110                 :            : // OElementImport overridables
     111                 :            : template <class BASE>
     112                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement()
     113                 :            : {
     114                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn;
     115                 :            :     // no call to the base class' method. We have to use the grid column factory
     116   [ #  #  #  #  :          0 :     if (m_xColumnFactory.is())
             #  #  #  # ]
     117                 :            :     {
     118                 :            :         // create the column
     119 [ #  # ][ #  # ]:          0 :         xReturn = m_xColumnFactory->createColumn(this->m_sServiceName);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     120                 :            :         OSL_ENSURE(xReturn.is(), "OColumnImport::createElement: the factory returned an invalid object!");
     121                 :            :     }
     122                 :          0 :     return xReturn;
     123                 :            : }
     124                 :            : 
     125                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10