LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/xmloff - xmlexppr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-12-27 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             : 
      20             : #ifndef _XMLOFF_XMLEXPPR_HXX
      21             : #define _XMLOFF_XMLEXPPR_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : #include "xmloff/dllapi.h"
      25             : #include <xmloff/xmlprmap.hxx>
      26             : #include <xmloff/uniref.hxx>
      27             : 
      28             : namespace rtl { class OUString; }
      29             : 
      30             : class SvXMLUnitConverter;
      31             : class SvXMLAttributeList;
      32             : class SvXMLNamespaceMap;
      33             : class FilterPropertiesInfos_Impl;
      34             : class SvXMLExport;
      35             : 
      36             : #define XML_EXPORT_FLAG_DEFAULTS    0x0001      // export also default items
      37             : #define XML_EXPORT_FLAG_DEEP        0x0002      // export also items from
      38             :                                                 // parent item sets
      39             : #define XML_EXPORT_FLAG_EMPTY       0x0004      // export attribs element
      40             :                                                 // even if its empty
      41             : #define XML_EXPORT_FLAG_IGN_WS      0x0008
      42             : 
      43             : class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase
      44             : {
      45             :     UniReference< SvXMLExportPropertyMapper> mxNextMapper;
      46             : 
      47             :     FilterPropertiesInfos_Impl *pCache;
      48             : 
      49             : protected:
      50             :     UniReference< XMLPropertySetMapper > maPropMapper;
      51             : 
      52             :     rtl::OUString maStyleName;
      53             : 
      54             :     /** Filter all properties we don't want to export:
      55             :         Take all properties of the XPropertySet which are also found in the
      56             :         XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
      57             :         default and isn't inherited, apart from bDefault is true)
      58             :         After this process It'll called 'Contextfilter' for application-specific
      59             :         filter-processes. */
      60             :     ::std::vector< XMLPropertyState > _Filter(
      61             :             const ::com::sun::star::uno::Reference<
      62             :                     ::com::sun::star::beans::XPropertySet > rPropSet,
      63             :             const sal_Bool bDefault ) const;
      64             : 
      65             :     /** Application-specific filter. By default do nothing. */
      66             :     virtual void ContextFilter(
      67             :             ::std::vector< XMLPropertyState >& rProperties,
      68             :             ::com::sun::star::uno::Reference<
      69             :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const;
      70             : 
      71             :     /** fills the given attribute list with the items in the given set */
      72             :     void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
      73             :                      SvXMLAttributeList& rAttrList,
      74             :                      const ::std::vector< XMLPropertyState >& rProperties,
      75             :                      const SvXMLUnitConverter& rUnitConverter,
      76             :                      const SvXMLNamespaceMap& rNamespaceMap,
      77             :                      sal_uInt16 nFlags,
      78             :                      std::vector<sal_uInt16>* pIndexArray,
      79             :                        sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const;
      80             : 
      81             :     void _exportXML( SvXMLAttributeList& rAttrList,
      82             :                      const XMLPropertyState& rProperty,
      83             :                      const SvXMLUnitConverter& rUnitConverter,
      84             :                      const SvXMLNamespaceMap& rNamespaceMap,
      85             :                      sal_uInt16 nFlags,
      86             :                      const ::std::vector< XMLPropertyState > *pProperties = 0,
      87             :                      sal_uInt32 nIdx = 0 ) const;
      88             : 
      89             :     void exportElementItems(
      90             :             SvXMLExport& rExport,
      91             :             const ::std::vector< XMLPropertyState >& rProperties,
      92             :             sal_uInt16 nFlags,
      93             :             const std::vector<sal_uInt16>& rIndexArray ) const;
      94             : 
      95             : public:
      96             : 
      97             :     SvXMLExportPropertyMapper(
      98             :             const UniReference< XMLPropertySetMapper >& rMapper );
      99             :     virtual ~SvXMLExportPropertyMapper();
     100             : 
     101             :     // Add a ExportPropertyMapper at the end of the import mapper chain.
     102             :     // The added mapper MUST not be used outside the Mapper chain any longer,
     103             :     // because its PropertyMapper will be replaced.
     104             :     void ChainExportMapper(
     105             :         const UniReference< SvXMLExportPropertyMapper>& rMapper );
     106             : 
     107             :     /** Filter all properties we don't want to export:
     108             :         Take all properties of the XPropertySet which are also found in the
     109             :         XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
     110             :         default and isn't inherited)
     111             :         After this process It'll called 'Contextfilter' for application-specific
     112             :         filter-processes. */
     113           8 :     ::std::vector< XMLPropertyState > Filter(
     114             :             const ::com::sun::star::uno::Reference<
     115             :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const
     116           8 :                     { return _Filter(rPropSet, sal_False); }
     117             : 
     118             :     /** Like Filter(), except that:
     119             :       * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT
     120             :       *   set are exported,
     121             :       * - instead of the property's value, its default value is exported.
     122             :       */
     123             :     ::std::vector< XMLPropertyState > FilterDefaults(
     124             :             const ::com::sun::star::uno::Reference<
     125             :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const
     126             :                     { return _Filter(rPropSet, sal_True); }
     127             : 
     128             :     /** Compare to arrays of XMLPropertyState */
     129             :     sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
     130             :                      const ::std::vector< XMLPropertyState >& aProperties2 ) const;
     131             : 
     132             :     /** fills the given attribute list with the items in the given set */
     133             :     void exportXML(
     134             :            SvXMLAttributeList& rAttrList,
     135             :            const ::std::vector< XMLPropertyState >& rProperties,
     136             :            const SvXMLUnitConverter& rUnitConverter,
     137             :            const SvXMLNamespaceMap& rNamespaceMap,
     138             :            sal_uInt16 nFlags = 0 ) const;
     139             :     /** like above but only properties whose property map index is within the
     140             :         specified range are exported */
     141             :     void exportXML(
     142             :            SvXMLAttributeList& rAttrList,
     143             :            const ::std::vector< XMLPropertyState >& rProperties,
     144             :            const SvXMLUnitConverter& rUnitConverter,
     145             :            const SvXMLNamespaceMap& rNamespaceMap,
     146             :            sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     147             :            sal_uInt16 nFlags = 0 ) const;
     148             : 
     149             :     void exportXML(
     150             :             SvXMLExport& rExport,
     151             :             const ::std::vector< XMLPropertyState >& rProperties,
     152             :             sal_uInt16 nFlags = 0 ) const;
     153             : 
     154             :     /** like above but only properties whose property map index is within the
     155             :         specified range are exported */
     156             :     void exportXML(
     157             :             SvXMLExport& rExport,
     158             :             const ::std::vector< XMLPropertyState >& rProperties,
     159             :             sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     160             :             sal_uInt16 nFlags = 0 ) const;
     161             : 
     162             :     /** this method is called for every item that has the
     163             :         MID_FLAG_ELEMENT_EXPORT flag set */
     164             :     virtual void handleElementItem(
     165             :             SvXMLExport& rExport,
     166             :             const XMLPropertyState& rProperty,
     167             :             sal_uInt16 nFlags,
     168             :             const ::std::vector< XMLPropertyState > *pProperties = 0,
     169             :             sal_uInt32 nIdx = 0 ) const;
     170             : 
     171             :     /** this method is called for every item that has the
     172             :         MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
     173             :     virtual void handleSpecialItem(
     174             :             SvXMLAttributeList& rAttrList,
     175             :             const XMLPropertyState& rProperty,
     176             :             const SvXMLUnitConverter& rUnitConverter,
     177             :             const SvXMLNamespaceMap& rNamespaceMap,
     178             :             const ::std::vector< XMLPropertyState > *pProperties = 0,
     179             :             sal_uInt32 nIdx = 0 ) const;
     180             : 
     181             :     inline const UniReference< XMLPropertySetMapper >&
     182         118 :         getPropertySetMapper() const { return maPropMapper; }
     183             : 
     184             :     void SetStyleName( const rtl::OUString& rStyleName ) { maStyleName = rStyleName; }
     185             : };
     186             : 
     187             : #endif  //  _XMLOFF_XMLEXPPR_HXX
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10