LCOV - code coverage report
Current view: top level - xmloff/source/forms - valueproperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 66 30.3 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 26 26.9 %

           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                 :            : #include "valueproperties.hxx"
      30                 :            : #include "strings.hxx"
      31                 :            : #include <com/sun/star/form/FormComponentType.hpp>
      32                 :            : 
      33                 :            : //.........................................................................
      34                 :            : namespace xmloff
      35                 :            : {
      36                 :            : //.........................................................................
      37                 :            : 
      38                 :            :     using namespace ::com::sun::star::form;
      39                 :            : 
      40                 :            :     //=====================================================================
      41                 :            :     //= OValuePropertiesMetaData
      42                 :            :     //=====================================================================
      43                 :            :     //---------------------------------------------------------------------
      44                 :          3 :     void OValuePropertiesMetaData::getValuePropertyNames(
      45                 :            :             OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
      46                 :            :             sal_Char const * & _rpCurrentValuePropertyName, sal_Char const * & _rpValuePropertyName)
      47                 :            :     {
      48                 :            :         // reset the pointers in case we can't determine the property names
      49                 :          3 :         _rpCurrentValuePropertyName = _rpValuePropertyName = NULL;
      50   [ +  -  -  -  :          3 :         switch (_nFormComponentType)
             -  -  -  -  
                      - ]
      51                 :            :         {
      52                 :            :             case FormComponentType::TEXTFIELD:
      53         [ -  + ]:          3 :                 if (OControlElement::FORMATTED_TEXT == _eType)
      54                 :            :                 {
      55                 :          0 :                     _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii;
      56                 :          0 :                     _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii;
      57                 :            :                 }
      58                 :            :                 else
      59                 :            :                 {
      60         [ +  - ]:          3 :                     if (OControlElement::PASSWORD != _eType)
      61                 :            :                         // no CurrentValue" for passwords
      62                 :          3 :                         _rpCurrentValuePropertyName = PROPERTY_TEXT.ascii;
      63                 :          3 :                     _rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
      64                 :            :                 }
      65                 :          3 :                 break;
      66                 :            : 
      67                 :            :             case FormComponentType::NUMERICFIELD:
      68                 :            :             case FormComponentType::CURRENCYFIELD:
      69                 :          0 :                 _rpCurrentValuePropertyName = PROPERTY_VALUE.ascii;
      70                 :          0 :                 _rpValuePropertyName = PROPERTY_DEFAULT_VALUE.ascii;
      71                 :          0 :                 break;
      72                 :            : 
      73                 :            :             case FormComponentType::PATTERNFIELD:
      74                 :            :             case FormComponentType::FILECONTROL:
      75                 :            :             case FormComponentType::COMBOBOX:
      76                 :          0 :                 _rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
      77                 :            :                 // NO BREAK!!
      78                 :            :             case FormComponentType::COMMANDBUTTON:
      79                 :          0 :                 _rpCurrentValuePropertyName = PROPERTY_TEXT.ascii;
      80                 :          0 :                 break;
      81                 :            : 
      82                 :            :             case FormComponentType::CHECKBOX:
      83                 :            :             case FormComponentType::RADIOBUTTON:
      84                 :          0 :                 _rpValuePropertyName = PROPERTY_REFVALUE.ascii;
      85                 :          0 :                 break;
      86                 :            : 
      87                 :            :             case FormComponentType::HIDDENCONTROL:
      88                 :          0 :                 _rpValuePropertyName = PROPERTY_HIDDEN_VALUE.ascii;
      89                 :          0 :                 break;
      90                 :            : 
      91                 :            :             case FormComponentType::SCROLLBAR:
      92                 :          0 :                 _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE.ascii;
      93                 :          0 :                 _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT.ascii;
      94                 :          0 :                 break;
      95                 :            : 
      96                 :            :             case FormComponentType::SPINBUTTON:
      97                 :          0 :                 _rpCurrentValuePropertyName = PROPERTY_SPINVALUE.ascii;
      98                 :          0 :                 _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE.ascii;
      99                 :          0 :                 break;
     100                 :            : 
     101                 :            :             default:
     102                 :            :                 OSL_ENSURE( false, "OValuePropertiesMetaData::getValuePropertyNames: unsupported component type!" );
     103                 :          0 :                 break;
     104                 :            :         }
     105                 :          3 :     }
     106                 :            : 
     107                 :            : 
     108                 :            :     //---------------------------------------------------------------------
     109                 :          0 :     void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType,
     110                 :            :         sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName)
     111                 :            :     {
     112                 :          0 :         _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL;
     113   [ #  #  #  #  :          0 :         switch (_nFormComponentType)
                      # ]
     114                 :            :         {
     115                 :            :             case FormComponentType::NUMERICFIELD:
     116                 :            :             case FormComponentType::CURRENCYFIELD:
     117                 :          0 :                 _rpMinValuePropertyName = PROPERTY_VALUE_MIN.ascii;
     118                 :          0 :                 _rpMaxValuePropertyName = PROPERTY_VALUE_MAX.ascii;
     119                 :          0 :                 break;
     120                 :            : 
     121                 :            :             case FormComponentType::TEXTFIELD:
     122                 :          0 :                 _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN.ascii;
     123                 :          0 :                 _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX.ascii;
     124                 :          0 :                 break;
     125                 :            : 
     126                 :            :             case FormComponentType::SCROLLBAR:
     127                 :          0 :                 _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN.ascii;
     128                 :          0 :                 _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX.ascii;
     129                 :          0 :                 break;
     130                 :            : 
     131                 :            :             case FormComponentType::SPINBUTTON:
     132                 :          0 :                 _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN.ascii;
     133                 :          0 :                 _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX.ascii;
     134                 :          0 :                 break;
     135                 :            : 
     136                 :            :             default:
     137                 :            :                 OSL_ENSURE( false, "OValuePropertiesMetaData::getValueLimitPropertyNames: unsupported component type!" );
     138                 :          0 :                 break;
     139                 :            :         }
     140                 :          0 :     }
     141                 :            : 
     142                 :            :     //---------------------------------------------------------------------
     143                 :         37 :     void OValuePropertiesMetaData::getRuntimeValuePropertyNames(
     144                 :            :         OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
     145                 :            :         sal_Char const * & _rpValuePropertyName, sal_Char const * & _rpDefaultValuePropertyName )
     146                 :            :     {
     147                 :            :         // reset the pointers in case we can't determine the property names
     148                 :         37 :         _rpValuePropertyName = _rpDefaultValuePropertyName = NULL;
     149   [ +  -  -  -  :         37 :         switch (_nFormComponentType)
                   +  + ]
     150                 :            :         {
     151                 :            :             case FormComponentType::TEXTFIELD:
     152         [ -  + ]:          8 :                 if (OControlElement::FORMATTED_TEXT == _eType)
     153                 :            :                 {
     154                 :          0 :                     _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii;
     155                 :          0 :                     _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii;
     156                 :            :                 }
     157                 :            :                 else
     158                 :            :                 {
     159                 :          8 :                     _rpValuePropertyName = PROPERTY_TEXT.ascii;
     160                 :          8 :                     _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
     161                 :            :                 }
     162                 :          8 :                 break;
     163                 :            : 
     164                 :            :             case FormComponentType::DATEFIELD:
     165                 :          0 :                 _rpValuePropertyName = PROPERTY_DATE.ascii;
     166                 :          0 :                 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE.ascii;
     167                 :          0 :                 break;
     168                 :            : 
     169                 :            :             case FormComponentType::TIMEFIELD:
     170                 :          0 :                 _rpValuePropertyName = PROPERTY_TIME.ascii;
     171                 :          0 :                 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME.ascii;
     172                 :          0 :                 break;
     173                 :            : 
     174                 :            :             case FormComponentType::NUMERICFIELD:
     175                 :            :             case FormComponentType::CURRENCYFIELD:
     176                 :            :             case FormComponentType::PATTERNFIELD:
     177                 :            :             case FormComponentType::FILECONTROL:
     178                 :            :             case FormComponentType::COMBOBOX:
     179                 :            :             case FormComponentType::SCROLLBAR:
     180                 :            :             case FormComponentType::SPINBUTTON:
     181                 :            :                 // For these types, the runtime properties are the same as the ones which in the XML
     182                 :            :                 // stream are named "value properties"
     183                 :          0 :                 getValuePropertyNames( _eType, _nFormComponentType, _rpValuePropertyName, _rpDefaultValuePropertyName );
     184                 :          0 :                 break;
     185                 :            : 
     186                 :            :             case FormComponentType::CHECKBOX:
     187                 :            :             case FormComponentType::RADIOBUTTON:
     188                 :         10 :                 _rpValuePropertyName = PROPERTY_STATE.ascii;
     189                 :         10 :                 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE.ascii;
     190                 :         10 :                 break;
     191                 :            :         }
     192                 :         37 :     }
     193                 :            : 
     194                 :            : //.........................................................................
     195                 :            : }   // namespace xmloff
     196                 :            : //.........................................................................
     197                 :            : 
     198                 :            : 
     199                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10