LCOV - code coverage report
Current view: top level - xmloff/inc/xmloff - xmlexppr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 6 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _XMLOFF_XMLEXPPR_HXX
      30                 :            : #define _XMLOFF_XMLEXPPR_HXX
      31                 :            : 
      32                 :            : #include "sal/config.h"
      33                 :            : #include "xmloff/dllapi.h"
      34                 :            : #include <xmloff/xmlprmap.hxx>
      35                 :            : #include <xmloff/uniref.hxx>
      36                 :            : 
      37                 :            : namespace rtl { class OUString; }
      38                 :            : 
      39                 :            : class SvXMLUnitConverter;
      40                 :            : class SvXMLAttributeList;
      41                 :            : class SvXMLNamespaceMap;
      42                 :            : class FilterPropertiesInfos_Impl;
      43                 :            : class SvXMLExport;
      44                 :            : 
      45                 :            : #define XML_EXPORT_FLAG_DEFAULTS    0x0001      // export also default items
      46                 :            : #define XML_EXPORT_FLAG_DEEP        0x0002      // export also items from
      47                 :            :                                                 // parent item sets
      48                 :            : #define XML_EXPORT_FLAG_EMPTY       0x0004      // export attribs element
      49                 :            :                                                 // even if its empty
      50                 :            : #define XML_EXPORT_FLAG_IGN_WS      0x0008
      51                 :            : 
      52                 :            : class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase
      53                 :            : {
      54                 :            :     UniReference< SvXMLExportPropertyMapper> mxNextMapper;
      55                 :            : 
      56                 :            :     FilterPropertiesInfos_Impl *pCache;
      57                 :            : 
      58                 :            : protected:
      59                 :            :     UniReference< XMLPropertySetMapper > maPropMapper;
      60                 :            : 
      61                 :            :     rtl::OUString maStyleName;
      62                 :            : 
      63                 :            :     /** Filter all properties we don't want to export:
      64                 :            :         Take all properties of the XPropertySet which are also found in the
      65                 :            :         XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
      66                 :            :         default and isn't inherited, apart from bDefault is true)
      67                 :            :         After this process It'll called 'Contextfilter' for application-specific
      68                 :            :         filter-processes. */
      69                 :            :     ::std::vector< XMLPropertyState > _Filter(
      70                 :            :             const ::com::sun::star::uno::Reference<
      71                 :            :                     ::com::sun::star::beans::XPropertySet > rPropSet,
      72                 :            :             const sal_Bool bDefault ) const;
      73                 :            : 
      74                 :            :     /** Application-specific filter. By default do nothing. */
      75                 :            :     virtual void ContextFilter(
      76                 :            :             ::std::vector< XMLPropertyState >& rProperties,
      77                 :            :             ::com::sun::star::uno::Reference<
      78                 :            :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const;
      79                 :            : 
      80                 :            :     /** fills the given attribute list with the items in the given set */
      81                 :            :     void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
      82                 :            :                      SvXMLAttributeList& rAttrList,
      83                 :            :                      const ::std::vector< XMLPropertyState >& rProperties,
      84                 :            :                      const SvXMLUnitConverter& rUnitConverter,
      85                 :            :                      const SvXMLNamespaceMap& rNamespaceMap,
      86                 :            :                      sal_uInt16 nFlags,
      87                 :            :                      std::vector<sal_uInt16>* pIndexArray,
      88                 :            :                        sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const;
      89                 :            : 
      90                 :            :     void _exportXML( SvXMLAttributeList& rAttrList,
      91                 :            :                      const XMLPropertyState& rProperty,
      92                 :            :                      const SvXMLUnitConverter& rUnitConverter,
      93                 :            :                      const SvXMLNamespaceMap& rNamespaceMap,
      94                 :            :                      sal_uInt16 nFlags,
      95                 :            :                      const ::std::vector< XMLPropertyState > *pProperties = 0,
      96                 :            :                      sal_uInt32 nIdx = 0 ) const;
      97                 :            : 
      98                 :            :     void exportElementItems(
      99                 :            :             SvXMLExport& rExport,
     100                 :            :             const ::std::vector< XMLPropertyState >& rProperties,
     101                 :            :             sal_uInt16 nFlags,
     102                 :            :             const std::vector<sal_uInt16>& rIndexArray ) const;
     103                 :            : 
     104                 :            : public:
     105                 :            : 
     106                 :            :     SvXMLExportPropertyMapper(
     107                 :            :             const UniReference< XMLPropertySetMapper >& rMapper );
     108                 :            :     virtual ~SvXMLExportPropertyMapper();
     109                 :            : 
     110                 :            :     // Add a ExportPropertyMapper at the end of the import mapper chain.
     111                 :            :     // The added mapper MUST not be used outside the Mapper chain any longer,
     112                 :            :     // because its PropertyMapper will be replaced.
     113                 :            :     void ChainExportMapper(
     114                 :            :         const UniReference< SvXMLExportPropertyMapper>& rMapper );
     115                 :            : 
     116                 :            :     /** Filter all properties we don't want to export:
     117                 :            :         Take all properties of the XPropertySet which are also found in the
     118                 :            :         XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
     119                 :            :         default and isn't inherited)
     120                 :            :         After this process It'll called 'Contextfilter' for application-specific
     121                 :            :         filter-processes. */
     122                 :       5380 :     ::std::vector< XMLPropertyState > Filter(
     123                 :            :             const ::com::sun::star::uno::Reference<
     124                 :            :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const
     125         [ +  - ]:       5380 :                     { return _Filter(rPropSet, sal_False); }
     126                 :            : 
     127                 :            :     /** Like Filter(), except that:
     128                 :            :       * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT
     129                 :            :       *   set are exported,
     130                 :            :       * - instead of the property's value, its default value is exported.
     131                 :            :       */
     132                 :        121 :     ::std::vector< XMLPropertyState > FilterDefaults(
     133                 :            :             const ::com::sun::star::uno::Reference<
     134                 :            :                     ::com::sun::star::beans::XPropertySet > rPropSet ) const
     135         [ +  - ]:        121 :                     { return _Filter(rPropSet, sal_True); }
     136                 :            : 
     137                 :            :     /** Compare to arrays of XMLPropertyState */
     138                 :            :     sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
     139                 :            :                      const ::std::vector< XMLPropertyState >& aProperties2 ) const;
     140                 :            : 
     141                 :            :     /** fills the given attribute list with the items in the given set */
     142                 :            :     void exportXML(
     143                 :            :            SvXMLAttributeList& rAttrList,
     144                 :            :            const ::std::vector< XMLPropertyState >& rProperties,
     145                 :            :            const SvXMLUnitConverter& rUnitConverter,
     146                 :            :            const SvXMLNamespaceMap& rNamespaceMap,
     147                 :            :            sal_uInt16 nFlags = 0 ) const;
     148                 :            :     /** like above but only properties whose property map index is within the
     149                 :            :         specified range are exported */
     150                 :            :     void exportXML(
     151                 :            :            SvXMLAttributeList& rAttrList,
     152                 :            :            const ::std::vector< XMLPropertyState >& rProperties,
     153                 :            :            const SvXMLUnitConverter& rUnitConverter,
     154                 :            :            const SvXMLNamespaceMap& rNamespaceMap,
     155                 :            :            sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     156                 :            :            sal_uInt16 nFlags = 0 ) const;
     157                 :            : 
     158                 :            :     void exportXML(
     159                 :            :             SvXMLExport& rExport,
     160                 :            :             const ::std::vector< XMLPropertyState >& rProperties,
     161                 :            :             sal_uInt16 nFlags = 0 ) const;
     162                 :            : 
     163                 :            :     /** like above but only properties whose property map index is within the
     164                 :            :         specified range are exported */
     165                 :            :     void exportXML(
     166                 :            :             SvXMLExport& rExport,
     167                 :            :             const ::std::vector< XMLPropertyState >& rProperties,
     168                 :            :             sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
     169                 :            :             sal_uInt16 nFlags = 0 ) const;
     170                 :            : 
     171                 :            :     /** this method is called for every item that has the
     172                 :            :         MID_FLAG_ELEMENT_EXPORT flag set */
     173                 :            :     virtual void handleElementItem(
     174                 :            :             SvXMLExport& rExport,
     175                 :            :             const XMLPropertyState& rProperty,
     176                 :            :             sal_uInt16 nFlags,
     177                 :            :             const ::std::vector< XMLPropertyState > *pProperties = 0,
     178                 :            :             sal_uInt32 nIdx = 0 ) const;
     179                 :            : 
     180                 :            :     /** this method is called for every item that has the
     181                 :            :         MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
     182                 :            :     virtual void handleSpecialItem(
     183                 :            :             SvXMLAttributeList& rAttrList,
     184                 :            :             const XMLPropertyState& rProperty,
     185                 :            :             const SvXMLUnitConverter& rUnitConverter,
     186                 :            :             const SvXMLNamespaceMap& rNamespaceMap,
     187                 :            :             const ::std::vector< XMLPropertyState > *pProperties = 0,
     188                 :            :             sal_uInt32 nIdx = 0 ) const;
     189                 :            : 
     190                 :            :     inline const UniReference< XMLPropertySetMapper >&
     191                 :      25670 :         getPropertySetMapper() const { return maPropMapper; }
     192                 :            : 
     193                 :        824 :     void SetStyleName( const rtl::OUString& rStyleName ) { maStyleName = rStyleName; }
     194                 :            : };
     195                 :            : 
     196                 :            : #endif  //  _XMLOFF_XMLEXPPR_HXX
     197                 :            : 
     198                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10