LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLAutoTextEventImport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 28 0.0 %

           Branch data     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 "XMLAutoTextEventImport.hxx"
      21                 :            : #include <com/sun/star/uno/Reference.hxx>
      22                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      23                 :            : #include <com/sun/star/document/XEventsSupplier.hpp>
      24                 :            : #include <com/sun/star/uno/XInterface.hpp>
      25                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26                 :            : #include "XMLAutoTextContainerEventImport.hxx"
      27                 :            : #include "xmloff/xmlnmspe.hxx"
      28                 :            : #include <xmloff/xmltoken.hxx>
      29                 :            : #include <tools/debug.hxx>
      30                 :            : 
      31                 :            : using namespace ::com::sun::star;
      32                 :            : 
      33                 :            : using ::rtl::OUString;
      34                 :            : using ::com::sun::star::uno::Any;
      35                 :            : using ::com::sun::star::uno::Reference;
      36                 :            : using ::com::sun::star::uno::Sequence;
      37                 :            : using ::com::sun::star::uno::Type;
      38                 :            : using ::com::sun::star::uno::XInterface;
      39                 :            : using ::com::sun::star::uno::RuntimeException;
      40                 :            : using ::com::sun::star::uno::Exception;
      41                 :            : using ::com::sun::star::xml::sax::XAttributeList;
      42                 :            : using ::com::sun::star::document::XEventsSupplier;
      43                 :            : using ::com::sun::star::container::XNameReplace;
      44                 :            : using ::com::sun::star::lang::XMultiServiceFactory;
      45                 :            : using ::xmloff::token::IsXMLToken;
      46                 :            : using ::xmloff::token::XML_AUTO_TEXT_EVENTS;
      47                 :            : 
      48                 :            : const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer";
      49                 :            : 
      50                 :            : 
      51                 :            : // #110680#
      52                 :          0 : XMLAutoTextEventImport::XMLAutoTextEventImport(
      53                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory) throw()
      54                 :          0 : :   SvXMLImport(xServiceFactory)
      55                 :            : {
      56                 :          0 : }
      57                 :            : 
      58                 :          0 : XMLAutoTextEventImport::~XMLAutoTextEventImport() throw()
      59                 :            : {
      60         [ #  # ]:          0 : }
      61                 :            : 
      62                 :          0 : void XMLAutoTextEventImport::initialize(
      63                 :            :     const Sequence<Any> & rArguments )
      64                 :            :         throw(Exception, RuntimeException)
      65                 :            : {
      66                 :            :     // The events may come as either an XNameReplace or XEventsSupplier.
      67                 :            : 
      68                 :          0 :     const sal_Int32 nLength = rArguments.getLength();
      69         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < nLength; i++ )
      70                 :            :     {
      71                 :          0 :         const Type& rType = rArguments[i].getValueType();
      72         [ #  # ]:          0 :         if ( rType == ::getCppuType( (Reference<XEventsSupplier>*)NULL ) )
      73                 :            :         {
      74                 :          0 :             Reference<XEventsSupplier> xSupplier;
      75         [ #  # ]:          0 :             rArguments[i] >>= xSupplier;
      76                 :            :             DBG_ASSERT(xSupplier.is(), "need XEventsSupplier or XNameReplace");
      77                 :            : 
      78 [ #  # ][ #  # ]:          0 :             xEvents = xSupplier->getEvents();
                 [ #  # ]
      79                 :            :         }
      80         [ #  # ]:          0 :         else if (rType == ::getCppuType( (Reference<XNameReplace>*)NULL ) )
      81                 :            :         {
      82                 :          0 :             rArguments[i] >>= xEvents;
      83                 :            :             DBG_ASSERT(xEvents.is(), "need XEventsSupplier or XNameReplace");
      84                 :            :         }
      85                 :            :     }
      86                 :            : 
      87                 :            :     // call parent
      88                 :          0 :     SvXMLImport::initialize(rArguments);
      89                 :          0 : }
      90                 :            : 
      91                 :            : 
      92                 :            : 
      93                 :          0 : SvXMLImportContext* XMLAutoTextEventImport::CreateContext(
      94                 :            :     sal_uInt16 nPrefix,
      95                 :            :     const OUString& rLocalName,
      96                 :            :     const Reference<XAttributeList > & xAttrList )
      97                 :            : {
      98         [ #  # ]:          0 :     if ( xEvents.is() && (XML_NAMESPACE_OOO == nPrefix) &&
           [ #  #  #  # ]
                 [ #  # ]
      99                 :          0 :          IsXMLToken( rLocalName, XML_AUTO_TEXT_EVENTS) )
     100                 :            :     {
     101                 :            :         return new XMLAutoTextContainerEventImport(
     102         [ #  # ]:          0 :             *this, nPrefix, rLocalName, xEvents);
     103                 :            :     }
     104                 :            :     else
     105                 :            :     {
     106                 :          0 :         return SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
     107                 :            :     }
     108                 :            : }
     109                 :            : 
     110                 :            : 
     111                 :            : Sequence< OUString > SAL_CALL
     112                 :          0 :     XMLAutoTextEventImport_getSupportedServiceNames()
     113                 :            :         throw()
     114                 :            : {
     115                 :          0 :     Sequence< OUString > aSeq( 1 );
     116         [ #  # ]:          0 :     aSeq[0] = XMLAutoTextEventImport_getImplementationName();
     117                 :          0 :     return aSeq;
     118                 :            : }
     119                 :            : 
     120                 :          0 : OUString SAL_CALL XMLAutoTextEventImport_getImplementationName() throw()
     121                 :            : {
     122                 :          0 :     return OUString( "com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter" );
     123                 :            : }
     124                 :            : 
     125                 :          0 : Reference< XInterface > SAL_CALL XMLAutoTextEventImport_createInstance(
     126                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     127                 :            :     throw( Exception )
     128                 :            : {
     129                 :            :     // #110680#
     130                 :            :     // return (cppu::OWeakObject*)new XMLAutoTextEventImport;
     131                 :          0 :     return (cppu::OWeakObject*)new XMLAutoTextEventImport(rSMgr);
     132                 :            : }
     133                 :            : 
     134                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10