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

Generated by: LCOV version 1.10