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

Generated by: LCOV version 1.10