LCOV - code coverage report
Current view: top level - include/xmloff - xmlimppr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 3 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
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             : #ifndef INCLUDED_XMLOFF_XMLIMPPR_HXX
      20             : #define INCLUDED_XMLOFF_XMLIMPPR_HXX
      21             : 
      22             : #include <rtl/ref.hxx>
      23             : #include <sal/config.h>
      24             : #include <xmloff/dllapi.h>
      25             : #include <sal/types.h>
      26             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <com/sun/star/beans/PropertyValue.hpp>
      29             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      30             : #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
      31             : 
      32             : #include <vector>
      33             : #include <salhelper/simplereferenceobject.hxx>
      34             : 
      35             : struct XMLPropertyState;
      36             : class XMLPropertySetMapper;
      37             : 
      38             : 
      39             : class SvXMLUnitConverter;
      40             : class SvXMLNamespaceMap;
      41             : class SvXMLImport;
      42             : 
      43             : /** This struct is used as an optional parameter to the static
      44             :  * _FillPropertySet() methods.
      45             :  *
      46             :  * It should not be used in any other context.
      47             :  */
      48             : struct _ContextID_Index_Pair
      49             : {
      50             :     sal_Int16 nContextID;
      51             :     sal_Int32 nIndex;
      52             : };
      53             : 
      54             : class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public salhelper::SimpleReferenceObject
      55             : {
      56             :     rtl::Reference< SvXMLImportPropertyMapper> mxNextMapper;
      57             : 
      58             :     SvXMLImport& rImport;   // access to error handling
      59             : 
      60             :     SvXMLImportPropertyMapper(SvXMLImportPropertyMapper &) SAL_DELETED_FUNCTION;
      61             :     void operator =(SvXMLImportPropertyMapper &) SAL_DELETED_FUNCTION;
      62             : 
      63             : protected:
      64             : 
      65             :     rtl::Reference< XMLPropertySetMapper > maPropMapper;
      66       19438 :     SvXMLImport& GetImport() const { return rImport;}
      67             : 
      68             : public:
      69             : 
      70             :     SvXMLImportPropertyMapper(
      71             :             const rtl::Reference< XMLPropertySetMapper >& rMapper,
      72             :             SvXMLImport& rImport);
      73             :     virtual ~SvXMLImportPropertyMapper();
      74             : 
      75             :     // Add a ImportPropertyMapper at the end of the import mapper chain.
      76             :     // The added mapper MUST not be used outside the Mapper chain any longer,
      77             :     // because its PropertyMapper will be replaced.
      78             :     void ChainImportMapper(
      79             :         const rtl::Reference< SvXMLImportPropertyMapper>& rMapper );
      80             : 
      81             :     /** fills the given itemset with the attributes in the given list
      82             :       * the map is only searched within the range
      83             :       * [nStartIdx, nEndIdx[
      84             :       */
      85             :     void importXML(
      86             :             ::std::vector< XMLPropertyState >& rProperties,
      87             :             ::com::sun::star::uno::Reference<
      88             :                     ::com::sun::star::xml::sax::XAttributeList > xAttrList,
      89             :             const SvXMLUnitConverter& rUnitConverter,
      90             :             const SvXMLNamespaceMap& rNamespaceMap,
      91             :             sal_uInt32 nPropType,
      92             :             sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
      93             : 
      94             :     /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
      95             :     virtual bool handleSpecialItem(
      96             :             XMLPropertyState& rProperty,
      97             :             ::std::vector< XMLPropertyState >& rProperties,
      98             :             const OUString& rValue,
      99             :             const SvXMLUnitConverter& rUnitConverter,
     100             :             const SvXMLNamespaceMap& rNamespaceMap ) const;
     101             : 
     102             :     /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
     103             :     virtual void finished(
     104             :             ::std::vector< XMLPropertyState >& rProperties,
     105             :             sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
     106             : 
     107             :     void CheckSpecialContext(
     108             :             const ::std::vector< XMLPropertyState >& rProperties,
     109             :             const ::com::sun::star::uno::Reference<
     110             :                     ::com::sun::star::beans::XPropertySet >& rPropSet,
     111             :             _ContextID_Index_Pair* pSpecialContextIds ) const;
     112             : 
     113             :     bool FillPropertySet(
     114             :             const ::std::vector< XMLPropertyState >& rProperties,
     115             :             const ::com::sun::star::uno::Reference<
     116             :                     ::com::sun::star::beans::XPropertySet >& rPropSet,
     117             :             _ContextID_Index_Pair* pSpecialContextIds = NULL ) const;
     118             : 
     119             :     void FillPropertySequence(
     120             :             const ::std::vector< XMLPropertyState >& aProperties,
     121             :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues )
     122             :             const;
     123             : 
     124             :     inline const rtl::Reference< XMLPropertySetMapper >&
     125             :         getPropertySetMapper() const;
     126             : 
     127             : 
     128             : 
     129             :     /** implementation helper for FillPropertySet: fill an XPropertySet.
     130             :      * Exceptions will be asserted. */
     131             :     static bool _FillPropertySet(
     132             :         const ::std::vector<XMLPropertyState> & rProperties,
     133             :         const ::com::sun::star::uno::Reference<
     134             :             ::com::sun::star::beans::XPropertySet> & rPropSet,
     135             :         const ::com::sun::star::uno::Reference<
     136             :             ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
     137             :         const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
     138             :         SvXMLImport& rImport,
     139             : 
     140             :         // parameter for use by txtstyli.cxx; allows efficient
     141             :         // catching the combined characters property
     142             :         _ContextID_Index_Pair* pSpecialContextIds = NULL );
     143             : 
     144             :     /** implementation helper for FillPropertySet: fill an XMultiPropertySet.
     145             :      * If unsuccessul, set return value. */
     146             :     static bool _FillMultiPropertySet(
     147             :         const ::std::vector<XMLPropertyState> & rProperties,
     148             :         const ::com::sun::star::uno::Reference<
     149             :             ::com::sun::star::beans::XMultiPropertySet> & rMultiPropSet,
     150             :         const ::com::sun::star::uno::Reference<
     151             :             ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
     152             :         const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
     153             : 
     154             :         // parameters for use by txtstyli.cxx; allows efficient
     155             :         // catching the combined characters property
     156             :         _ContextID_Index_Pair* pSpecialContextIds = NULL );
     157             : 
     158             :     /** implementation helper for FillPropertySet: fill an XTolerantMultiPropertySet.
     159             :      * If unsuccessul, set return value. */
     160             :     static bool _FillTolerantMultiPropertySet(
     161             :         const ::std::vector<XMLPropertyState> & rProperties,
     162             :         const ::com::sun::star::uno::Reference<
     163             :             ::com::sun::star::beans::XTolerantMultiPropertySet> & rTolPropSet,
     164             :         const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
     165             :         SvXMLImport& rImport,
     166             : 
     167             :         // parameters for use by txtstyli.cxx; allows efficient
     168             :         // catching the combined characters property
     169             :         _ContextID_Index_Pair* pSpecialContextIds = NULL );
     170             : 
     171             : 
     172             :     static void _PrepareForMultiPropertySet(
     173             :         const ::std::vector<XMLPropertyState> & rProperties,
     174             :         const ::com::sun::star::uno::Reference<
     175             :             ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
     176             :         const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
     177             :         _ContextID_Index_Pair* pSpecialContextIds,
     178             :         ::com::sun::star::uno::Sequence< OUString >& rNames,
     179             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues);
     180             : };
     181             : 
     182             : 
     183             : inline const rtl::Reference< XMLPropertySetMapper >&
     184      300107 :     SvXMLImportPropertyMapper::getPropertySetMapper() const
     185             : {
     186      300107 :     return maPropMapper;
     187             : }
     188             : 
     189             : #endif // INCLUDED_XMLOFF_XMLIMPPR_HXX
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11