LCOV - code coverage report
Current view: top level - xmloff/source/style - xmlbahdl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 16 93.8 %
Date: 2012-08-25 Functions: 17 18 94.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 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_PROPERTYHANDLER_BASICTYPES_HXX
      30                 :            : #define _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
      31                 :            : 
      32                 :            : #include <xmloff/xmlprhdl.hxx>
      33                 :            : #include <rtl/ustrbuf.hxx>
      34                 :            : #include <xmloff/xmltoken.hxx>
      35                 :            : 
      36                 :            : 
      37                 :            : /**
      38                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
      39                 :            : */
      40                 :            : class XMLNumberPropHdl : public XMLPropertyHandler
      41                 :            : {
      42                 :            :     sal_Int8 nBytes;
      43                 :            : 
      44                 :            : public:
      45                 :      10077 :     XMLNumberPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
      46                 :            :     virtual ~XMLNumberPropHdl();
      47                 :            : 
      48                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      49                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      50                 :            : };
      51                 :            : 
      52                 :            : /**
      53                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
      54                 :            : */
      55                 :            : class XMLNumberNonePropHdl : public XMLPropertyHandler
      56                 :            : {
      57                 :            :     ::rtl::OUString sZeroStr;
      58                 :            :     sal_Int8        nBytes;
      59                 :            : public:
      60                 :            :     XMLNumberNonePropHdl( sal_Int8 nB = 4 );
      61                 :            :     XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString, sal_Int8 nB = 4 );
      62                 :            :     virtual ~XMLNumberNonePropHdl();
      63                 :            : 
      64                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      65                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      66                 :            : };
      67                 :            : 
      68                 :            : /**
      69                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
      70                 :            : */
      71                 :            : class XMLMeasurePropHdl : public XMLPropertyHandler
      72                 :            : {
      73                 :            :     sal_Int8 nBytes;
      74                 :            : public:
      75                 :       8369 :     XMLMeasurePropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
      76                 :            :     virtual ~XMLMeasurePropHdl();
      77                 :            : 
      78                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      79                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      80                 :            : };
      81                 :            : 
      82                 :            : /**
      83                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
      84                 :            : */
      85                 :            : class XMLPercentPropHdl : public XMLPropertyHandler
      86                 :            : {
      87                 :            :     sal_Int8 nBytes;
      88                 :            : public:
      89                 :       9485 :     XMLPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
      90                 :            :     virtual ~XMLPercentPropHdl();
      91                 :            : 
      92                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      93                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
      94                 :            : };
      95                 :            : 
      96                 :            : /**
      97                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
      98                 :            :     that is mapped on a double from 0.0 to 1.0
      99                 :            : */
     100         [ -  + ]:       4868 : class XMLDoublePercentPropHdl : public XMLPropertyHandler
     101                 :            : {
     102                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     103                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     104                 :            : };
     105                 :            : 
     106                 :            : /**
     107                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
     108                 :            : */
     109                 :            : class XMLNegPercentPropHdl : public XMLPropertyHandler
     110                 :            : {
     111                 :            :     sal_Int8 nBytes;
     112                 :            : public:
     113                 :       2766 :     XMLNegPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
     114                 :            :     virtual ~XMLNegPercentPropHdl();
     115                 :            : 
     116                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     117                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     118                 :            : };
     119                 :            : 
     120                 :            : /**
     121                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
     122                 :            : */
     123                 :            : class XMLMeasurePxPropHdl : public XMLPropertyHandler
     124                 :            : {
     125                 :            :     sal_Int8 nBytes;
     126                 :            : public:
     127                 :       1876 :     XMLMeasurePxPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
     128                 :            :     virtual ~XMLMeasurePxPropHdl();
     129                 :            : 
     130                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     131                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     132                 :            : };
     133                 :            : 
     134                 :            : /**
     135                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_BOOL
     136                 :            : */
     137                 :       7446 : class XMLBoolPropHdl : public XMLPropertyHandler
     138                 :            : {
     139                 :            : public:
     140                 :            :     virtual ~XMLBoolPropHdl();
     141                 :            : 
     142                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     143                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     144                 :            : };
     145                 :            : 
     146                 :          0 : class XMLBoolFalsePropHdl : public XMLBoolPropHdl
     147                 :            : {
     148                 :            : public:
     149                 :            :     virtual ~XMLBoolFalsePropHdl();
     150                 :            : 
     151                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     152                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     153                 :            : 
     154                 :            : };
     155                 :            : 
     156                 :            : /**
     157                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_COLOR
     158                 :            : */
     159                 :       4531 : class XMLColorPropHdl : public XMLPropertyHandler
     160                 :            : {
     161                 :            : public:
     162                 :            :     virtual ~XMLColorPropHdl();
     163                 :            : 
     164                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     165                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     166                 :            : };
     167                 :            : 
     168                 :            : /**
     169                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_HEX
     170                 :            : */
     171                 :       2981 : class XMLHexPropHdl : public XMLPropertyHandler
     172                 :            : {
     173                 :            : public:
     174                 :            :     virtual ~XMLHexPropHdl();
     175                 :            : 
     176                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     177                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     178                 :            : };
     179                 :            : 
     180                 :            : /**
     181                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_STRING
     182                 :            : */
     183                 :      10232 : class XMLStringPropHdl : public XMLPropertyHandler
     184                 :            : {
     185                 :            : public:
     186                 :            :     virtual ~XMLStringPropHdl();
     187                 :            : 
     188                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     189                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     190                 :            : };
     191                 :            : 
     192                 :            : /**
     193                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
     194                 :            : */
     195                 :       3387 : class XMLStyleNamePropHdl : public XMLStringPropHdl
     196                 :            : {
     197                 :            : public:
     198                 :            :     virtual ~XMLStyleNamePropHdl();
     199                 :            : 
     200                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     201                 :            : };
     202                 :            : 
     203                 :            : 
     204                 :            : /**
     205                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
     206                 :            : */
     207                 :         33 : class XMLDoublePropHdl : public XMLPropertyHandler
     208                 :            : {
     209                 :            : public:
     210                 :            :     virtual ~XMLDoublePropHdl();
     211                 :            : 
     212                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     213                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     214                 :            : };
     215                 :            : 
     216                 :            : /**
     217                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
     218                 :            : */
     219                 :         45 : class XMLNBoolPropHdl : public XMLPropertyHandler
     220                 :            : {
     221                 :            : public:
     222                 :            :     virtual ~XMLNBoolPropHdl();
     223                 :            : 
     224                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     225                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     226                 :            : };
     227                 :            : 
     228                 :            : /**
     229                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
     230                 :            : */
     231                 :            : class XMLColorTransparentPropHdl : public XMLPropertyHandler
     232                 :            : {
     233                 :            :     const ::rtl::OUString sTransparent;
     234                 :            : 
     235                 :            : public:
     236                 :            :     XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID );
     237                 :            :     virtual ~XMLColorTransparentPropHdl();
     238                 :            : 
     239                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     240                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     241                 :            : };
     242                 :            : 
     243                 :            : /**
     244                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
     245                 :            : */
     246                 :            : class XMLIsTransparentPropHdl : public XMLPropertyHandler
     247                 :            : {
     248                 :            :     const ::rtl::OUString sTransparent;
     249                 :            :     sal_Bool bTransPropValue;
     250                 :            : 
     251                 :            : public:
     252                 :            :     XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID,
     253                 :            :                              sal_Bool bTransPropValue = sal_True );
     254                 :            :     virtual ~XMLIsTransparentPropHdl();
     255                 :            : 
     256                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     257                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     258                 :            : };
     259                 :            : 
     260                 :            : /**
     261                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
     262                 :            : */
     263                 :            : class XMLColorAutoPropHdl : public XMLPropertyHandler
     264                 :            : {
     265                 :            : public:
     266                 :            :     XMLColorAutoPropHdl();
     267                 :            :     virtual ~XMLColorAutoPropHdl();
     268                 :            : 
     269                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     270                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     271                 :            : };
     272                 :            : 
     273                 :            : /**
     274                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
     275                 :            : */
     276                 :            : class XMLIsAutoColorPropHdl : public XMLPropertyHandler
     277                 :            : {
     278                 :            : public:
     279                 :            :     XMLIsAutoColorPropHdl();
     280                 :            :     virtual ~XMLIsAutoColorPropHdl();
     281                 :            : 
     282                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     283                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     284                 :            : };
     285                 :            : 
     286                 :            : 
     287                 :            : /**
     288                 :            :     PropertyHandler for properties that cannot make use of importXML
     289                 :            :     and exportXML methods, but can make use of the default comparison
     290                 :            : */
     291                 :       5668 : class XMLCompareOnlyPropHdl : public XMLPropertyHandler
     292                 :            : {
     293                 :            : public:
     294                 :            :     virtual ~XMLCompareOnlyPropHdl();
     295                 :            : 
     296                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     297                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     298                 :            : };
     299                 :            : 
     300                 :            : /**
     301                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
     302                 :            :     Reads/writes numeric properties, but fails for the value zero
     303                 :            :     (i.e., a value 0 property will not be written)
     304                 :            : */
     305                 :            : class XMLNumberWithoutZeroPropHdl : public XMLPropertyHandler
     306                 :            : {
     307                 :            :     sal_Int8        nBytes;
     308                 :            : public:
     309                 :            :     XMLNumberWithoutZeroPropHdl( sal_Int8 nB = 4 );
     310                 :            :     virtual ~XMLNumberWithoutZeroPropHdl();
     311                 :            : 
     312                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     313                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     314                 :            : };
     315                 :            : 
     316                 :            : /**
     317                 :            :     PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
     318                 :            :     Reads/writes numeric properties with special handling for the value zero
     319                 :            :     (i.e., a value 0 property will be written as "auto")
     320                 :            : */
     321                 :       2242 : class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
     322                 :            : {
     323                 :            : public:
     324                 :            :     virtual ~XMLNumberWithAutoInsteadZeroPropHdl();
     325                 :            : 
     326                 :            :     virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     327                 :            :     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
     328                 :            : };
     329                 :            : 
     330                 :            : #endif      // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
     331                 :            : 
     332                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10