LCOV - code coverage report
Current view: top level - xmloff/source/forms - elementimport_impl.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 28 42.9 %
Date: 2014-11-03 Functions: 2 14 14.3 %
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             : // no include protection. This file is included from elementimport.hxx only.
      21             : 
      22             : #ifndef _INCLUDING_FROM_ELEMENTIMPORT_HXX_
      23             : #error "do not include this file directly!"
      24             : #endif
      25             : 
      26             : // no namespace. Same as above: this file is included from elementimport.hxx only,
      27             : // and this is done inside the namespace
      28             : 
      29             : //= OContainerImport
      30             : template <class BASE>
      31           0 : inline SvXMLImportContext* OContainerImport< BASE >::CreateChildContext(
      32             :     sal_uInt16 _nPrefix, const OUString& _rLocalName,
      33             :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList)
      34             : {
      35             :     // maybe it's a sub control
      36           0 :     if (_rLocalName == m_sWrapperElementName)
      37             :     {
      38           0 :         if (m_xMeAsContainer.is())
      39           0 :             return implCreateControlWrapper(_nPrefix, _rLocalName);
      40             :         else
      41             :         {
      42             :             OSL_FAIL("OContainerImport::CreateChildContext: don't have an element!");
      43           0 :             return NULL;
      44             :         }
      45             :     }
      46             : 
      47           0 :     return BASE::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
      48             : }
      49             : 
      50             : template <class BASE>
      51             : inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
      52          18 :     OContainerImport< BASE >::createElement()
      53             : {
      54             :     // let the base class create the object
      55          18 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn = BASE::createElement();
      56          18 :     if (!xReturn.is())
      57           0 :         return xReturn;
      58             : 
      59             :     // ensure that the object is a XNameContainer (we strongly need this for inserting child elements)
      60          18 :     m_xMeAsContainer = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >(xReturn, ::com::sun::star::uno::UNO_QUERY);
      61          18 :     if (!m_xMeAsContainer.is())
      62             :     {
      63             :         OSL_FAIL("OContainerImport::createElement: invalid element (no XNameContainer) created!");
      64           0 :         xReturn.clear();
      65             :     }
      66             : 
      67          18 :     return xReturn;
      68             : }
      69             : 
      70             : template <class BASE>
      71          18 : inline void OContainerImport< BASE >::EndElement()
      72             : {
      73          18 :     BASE::EndElement();
      74             : 
      75             :     // now that we have all children, attach the events
      76          18 :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, ::com::sun::star::uno::UNO_QUERY);
      77          18 :     if (xIndexContainer.is())
      78          18 :         ODefaultEventAttacherManager::setEvents(xIndexContainer);
      79          18 : }
      80             : 
      81             : //= OColumnImport
      82             : template <class BASE>
      83           0 : OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
      84             :         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
      85             :         OControlElement::ElementType _eType)
      86             :     :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
      87           0 :     ,m_xColumnFactory(_rxParentContainer, ::com::sun::star::uno::UNO_QUERY)
      88             : {
      89             :     OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!");
      90           0 : }
      91             : 
      92             : // OElementImport overridables
      93             : template <class BASE>
      94           0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement()
      95             : {
      96           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn;
      97             :     // no call to the base class' method. We have to use the grid column factory
      98           0 :     if (m_xColumnFactory.is())
      99             :     {
     100             :         // create the column
     101           0 :         xReturn = m_xColumnFactory->createColumn(this->m_sServiceName);
     102             :         OSL_ENSURE(xReturn.is(), "OColumnImport::createElement: the factory returned an invalid object!");
     103             :     }
     104           0 :     return xReturn;
     105             : }
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10