LCOV - code coverage report
Current view: top level - editeng/source/uno - unofield.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 260 436 59.6 %
Date: 2012-08-25 Functions: 27 40 67.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 197 535 36.8 %

           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 <com/sun/star/util/DateTime.hpp>
      30                 :            : #include <com/sun/star/text/FilenameDisplayFormat.hpp>
      31                 :            : #include <com/sun/star/lang/NoSupportException.hpp>
      32                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : #include <osl/mutex.hxx>
      35                 :            : 
      36                 :            : #include <editeng/eeitem.hxx>
      37                 :            : #include <editeng/flditem.hxx>
      38                 :            : #include <editeng/measfld.hxx>
      39                 :            : #include <editeng/unofield.hxx>
      40                 :            : #include <editeng/unotext.hxx>
      41                 :            : #include <comphelper/serviceinfohelper.hxx>
      42                 :            : #include <comphelper/servicehelper.hxx>
      43                 :            : 
      44                 :            : #include "editeng/unonames.hxx"
      45                 :            : 
      46                 :            : using namespace ::rtl;
      47                 :            : using namespace ::cppu;
      48                 :            : using namespace ::com::sun::star;
      49                 :            : 
      50                 :            : #define QUERYINT( xint ) \
      51                 :            :     if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
      52                 :            :         aAny <<= uno::Reference< xint >(this)
      53                 :            : 
      54                 :            : 
      55                 :            : #define WID_DATE    0
      56                 :            : #define WID_BOOL1   1
      57                 :            : #define WID_BOOL2   2
      58                 :            : #define WID_INT32   3
      59                 :            : #define WID_INT16   4
      60                 :            : #define WID_STRING1 5
      61                 :            : #define WID_STRING2 6
      62                 :            : #define WID_STRING3 7
      63                 :            : 
      64                 :            : inline bool isValidFieldId(sal_Int32 nId)
      65                 :            : {
      66                 :            :     return nId >= 0;
      67                 :            : }
      68                 :            : 
      69                 :        538 : class SvxUnoFieldData_Impl
      70                 :            : {
      71                 :            : public:
      72                 :            :     sal_Bool    mbBoolean1;
      73                 :            :     sal_Bool    mbBoolean2;
      74                 :            :     sal_Int32   mnInt32;
      75                 :            :     sal_Int16   mnInt16;
      76                 :            :     OUString    msString1;
      77                 :            :     OUString    msString2;
      78                 :            :     OUString    msString3;
      79                 :            :     util::DateTime maDateTime;
      80                 :            : 
      81                 :            :     OUString    msPresentation;
      82                 :            : };
      83                 :            : 
      84                 :        269 : const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
      85                 :            : {
      86                 :            :     static SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
      87                 :            :     {
      88         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_DATE_TIME), WID_DATE,  &::getCppuType((const util::DateTime*)0), 0, 0 },
      89         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),  WID_BOOL1, &::getBooleanCppuType(),                  0, 0 },
      90         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_IS_DATE),   WID_BOOL2, &::getBooleanCppuType(),                  0, 0 },
      91         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_NUMFORMAT), WID_INT32, &::getCppuType((const sal_Int32*)0),      0, 0 },
      92                 :            :         {0,0,0,0,0,0}
      93 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
      94 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
      95                 :            : 
      96                 :            :     static SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
      97                 :            :     {
      98         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_IS_DATE), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
      99                 :            :         {0,0,0,0,0,0}
     100 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
     101 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
     102                 :            : 
     103                 :            :     static SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
     104                 :            :     {
     105                 :            : 
     106         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_URL_FORMAT),         WID_INT16,   &::getCppuType((const sal_Int16*)0), 0, 0 },
     107         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_URL_REPRESENTATION), WID_STRING1, &::getCppuType((const OUString*)0),  0, 0 },
     108         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_URL_TARGET),         WID_STRING2, &::getCppuType((const OUString*)0),  0, 0 },
     109         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_URL),                WID_STRING3, &::getCppuType((const OUString*)0),  0, 0 },
     110                 :            :         {0,0,0,0,0,0}
     111 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
     112 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
     113                 :            : 
     114                 :            :     static SfxItemPropertyMapEntry aEmptyPropertyMap_Impl[] =
     115                 :            :     {
     116                 :            :         {0,0,0,0,0,0}
     117                 :            :     };
     118 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aEmptyPropertySet_Impl(aEmptyPropertyMap_Impl);
         [ +  - ][ #  # ]
     119                 :            : 
     120                 :            :     static SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
     121                 :            :     {
     122         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),             WID_BOOL1,   &::getBooleanCppuType(),             0, 0 },
     123         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_FILE_FORMAT),          WID_INT16,   &::getCppuType((const sal_Int16*)0), 0, 0 },
     124         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1, &::getCppuType((const OUString*)0),  0, 0 },
     125                 :            :         {0,0,0,0,0,0}
     126 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
     127 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
     128                 :            : 
     129                 :            :     static SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
     130                 :            :     {
     131         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_IS_FIXED),             WID_BOOL1,  &::getBooleanCppuType(),             0, 0 },
     132         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1,&::getCppuType((const OUString*)0),  0, 0 },
     133         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_CONTENT),       WID_STRING2,&::getCppuType((const OUString*)0),  0, 0 },
     134         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_FORMAT),        WID_INT16,  &::getCppuType((const sal_Int16*)0), 0, 0 },
     135         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_AUTHOR_FULLNAME),      WID_BOOL2,  &::getBooleanCppuType(),             0, 0 },
     136                 :            :         {0,0,0,0,0,0}
     137 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
     138 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aAuthorFieldPropertySet_Impl(aAuthorFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
     139                 :            : 
     140                 :            :     static SfxItemPropertyMapEntry aMeasureFieldPropertyMap_Impl[] =
     141                 :            :     {
     142         [ +  - ]:         10 :         { MAP_CHAR_LEN(UNO_TC_PROP_MEASURE_KIND), WID_INT16,  &::getCppuType((const sal_Int16*)0), 0, 0 },
     143                 :            :         {0,0,0,0,0,0}
     144 [ +  + ][ +  - ]:        279 :     };
                 [ #  # ]
     145 [ +  + ][ +  - ]:        269 :     static SfxItemPropertySet aMeasureFieldPropertySet_Impl(aMeasureFieldPropertyMap_Impl);
         [ +  - ][ #  # ]
     146                 :            : 
     147   [ +  +  +  +  :        269 :     switch( mnId )
                +  +  + ]
     148                 :            :     {
     149                 :            :     case text::textfield::Type::EXTENDED_TIME:
     150                 :            :     case text::textfield::Type::DATE:
     151                 :         25 :         return &aExDateTimeFieldPropertySet_Impl;
     152                 :            :     case text::textfield::Type::URL:
     153                 :          3 :         return &aUrlFieldPropertySet_Impl;
     154                 :            :     case text::textfield::Type::TIME:
     155                 :         11 :         return &aDateTimeFieldPropertySet_Impl;
     156                 :            :     case text::textfield::Type::EXTENDED_FILE:
     157                 :          3 :         return &aExtFileFieldPropertySet_Impl;
     158                 :            :     case text::textfield::Type::AUTHOR:
     159                 :          3 :         return &aAuthorFieldPropertySet_Impl;
     160                 :            :     case text::textfield::Type::MEASURE:
     161                 :          3 :         return &aMeasureFieldPropertySet_Impl;
     162                 :            :     default:
     163                 :        269 :         return &aEmptyPropertySet_Impl;
     164                 :            :     }
     165                 :            : }
     166                 :            : 
     167                 :            : /* conversion routines */
     168                 :            : 
     169                 :          0 : static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat )
     170                 :            : {
     171   [ #  #  #  # ]:          0 :     switch( nFormat )
     172                 :            :     {
     173                 :          0 :     case SVXFILEFORMAT_NAME_EXT:    return text::FilenameDisplayFormat::NAME_AND_EXT;
     174                 :          0 :     case SVXFILEFORMAT_FULLPATH:    return text::FilenameDisplayFormat::FULL;
     175                 :          0 :     case SVXFILEFORMAT_PATH:    return text::FilenameDisplayFormat::PATH;
     176                 :            : //  case SVXFILEFORMAT_NAME:
     177                 :          0 :     default: return text::FilenameDisplayFormat::NAME;
     178                 :            :     }
     179                 :            : }
     180                 :            : 
     181                 :          0 : static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat )
     182                 :            : {
     183   [ #  #  #  # ]:          0 :     switch( nFormat )
     184                 :            :     {
     185                 :          0 :     case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH;
     186                 :          0 :     case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH;
     187                 :          0 :     case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME;
     188                 :            : //  case text::FilenameDisplayFormat::NAME_AND_EXT:
     189                 :            :     default:
     190                 :          0 :         return SVXFILEFORMAT_NAME_EXT;
     191                 :            :     }
     192                 :            : }
     193                 :            : 
     194                 :          8 : static util::DateTime getDate( sal_uLong nDate )
     195                 :            : {
     196                 :          8 :     util::DateTime aDate;
     197                 :          8 :     memset( &aDate, 0, sizeof( util::DateTime ) );
     198                 :            : 
     199                 :          8 :     Date aTempDate( nDate );
     200                 :            : 
     201                 :          8 :     aDate.Day = aTempDate.GetDay();
     202                 :          8 :     aDate.Month = aTempDate.GetMonth();
     203                 :          8 :     aDate.Year = aTempDate.GetYear();
     204                 :            : 
     205                 :          8 :     return aDate;
     206                 :            : }
     207                 :            : 
     208                 :          2 : inline Date setDate( util::DateTime& rDate )
     209                 :            : {
     210                 :          2 :     return Date( rDate.Day, rDate.Month, rDate.Year );
     211                 :            : }
     212                 :            : 
     213                 :          0 : static util::DateTime getTime( long nTime )
     214                 :            : {
     215                 :          0 :     util::DateTime aTime;
     216                 :          0 :     memset( &aTime, 0, sizeof( util::DateTime ) );
     217                 :            : 
     218                 :          0 :     Time aTempTime( nTime );
     219                 :            : 
     220                 :          0 :     aTime.HundredthSeconds = aTempTime.Get100Sec();
     221                 :          0 :     aTime.Seconds = aTempTime.GetSec();
     222                 :          0 :     aTime.Minutes = aTempTime.GetMin();
     223                 :          0 :     aTime.Hours = aTempTime.GetHour();
     224                 :            : 
     225                 :          0 :     return aTime;
     226                 :            : }
     227                 :            : 
     228                 :          0 : inline Time setTime( util::DateTime& rDate )
     229                 :            : {
     230                 :          0 :     return Time( rDate.Hours, rDate.Minutes, rDate.Seconds, rDate.HundredthSeconds  );
     231                 :            : }
     232                 :            : 
     233                 :            : // ====================================================================
     234                 :            : // class SvxUnoTextField
     235                 :            : // ====================================================================
     236                 :            : namespace
     237                 :            : {
     238                 :            :     class theSvxUnoTextFieldUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldUnoTunnelId> {};
     239                 :            : }
     240                 :            : 
     241                 :          0 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() throw()
     242                 :            : {
     243                 :          0 :     return theSvxUnoTextFieldUnoTunnelId::get().getSeq();
     244                 :            : }
     245                 :            : 
     246                 :          0 : sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
     247                 :            : {
     248   [ #  #  #  # ]:          0 :     if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
                 [ #  # ]
     249                 :          0 :                                                          rId.getConstArray(), 16 ) )
     250                 :            :     {
     251                 :          0 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     252                 :            :     }
     253                 :          0 :     return 0;
     254                 :            : }
     255                 :            : 
     256                 :        117 : SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
     257                 :        117 : :   OComponentHelper( getMutex() )
     258                 :            : ,   mpPropSet(NULL)
     259                 :            : ,   mnServiceId(nServiceId)
     260 [ +  - ][ +  - ]:        234 : ,   mpImpl( new SvxUnoFieldData_Impl )
                 [ +  - ]
     261                 :            : {
     262         [ +  - ]:        117 :     mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
     263                 :            : 
     264                 :        117 :     memset( &(mpImpl->maDateTime), 0, sizeof( util::DateTime ) );
     265                 :            : 
     266   [ +  +  +  +  :        117 :     switch( nServiceId )
                +  +  + ]
     267                 :            :     {
     268                 :            :     case text::textfield::Type::DATE:
     269                 :         14 :         mpImpl->mbBoolean2 = sal_True;
     270                 :         14 :         mpImpl->mnInt32 = SVXDATEFORMAT_STDSMALL;
     271                 :         14 :         mpImpl->mbBoolean1 = sal_False;
     272                 :         14 :         break;
     273                 :            : 
     274                 :            :     case text::textfield::Type::EXTENDED_TIME:
     275                 :            :     case text::textfield::Type::TIME:
     276                 :          6 :         mpImpl->mbBoolean2 = sal_False;
     277                 :          6 :         mpImpl->mbBoolean1 = sal_False;
     278                 :          6 :         mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
     279                 :          6 :         break;
     280                 :            : 
     281                 :            :     case text::textfield::Type::URL:
     282                 :          3 :         mpImpl->mnInt16 = SVXURLFORMAT_REPR;
     283                 :          3 :         break;
     284                 :            : 
     285                 :            :     case text::textfield::Type::EXTENDED_FILE:
     286                 :          3 :         mpImpl->mbBoolean1 = sal_False;
     287                 :          3 :         mpImpl->mnInt16 = text::FilenameDisplayFormat::FULL;
     288                 :          3 :         break;
     289                 :            : 
     290                 :            :     case text::textfield::Type::AUTHOR:
     291                 :          3 :         mpImpl->mnInt16 = SVXAUTHORFORMAT_FULLNAME;
     292                 :          3 :         mpImpl->mbBoolean1 = sal_False;
     293                 :          3 :         mpImpl->mbBoolean2 = sal_True;
     294                 :          3 :         break;
     295                 :            : 
     296                 :            :     case text::textfield::Type::MEASURE:
     297                 :          3 :         mpImpl->mnInt16 = SDRMEASUREFIELD_VALUE;
     298                 :          3 :         break;
     299                 :            : 
     300                 :            :     default:
     301                 :         85 :         mpImpl->mbBoolean1 = sal_False;
     302                 :         85 :         mpImpl->mbBoolean2 = sal_False;
     303                 :         85 :         mpImpl->mnInt32 = 0;
     304                 :         85 :         mpImpl->mnInt16 = 0;
     305                 :            : 
     306                 :            :     }
     307                 :        117 : }
     308                 :            : 
     309                 :        152 : SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) throw()
     310                 :        152 : :   OComponentHelper( getMutex() )
     311                 :            : ,   mxAnchor( xAnchor )
     312                 :            : ,   mpPropSet(NULL)
     313                 :            : ,   mnServiceId(text::textfield::Type::UNSPECIFIED)
     314 [ +  - ][ +  - ]:        304 : ,   mpImpl( new SvxUnoFieldData_Impl )
                 [ +  - ]
     315                 :            : {
     316                 :            :     DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
     317                 :            : 
     318                 :        152 :     mpImpl->msPresentation = rPresentation;
     319                 :            : 
     320         [ +  - ]:        152 :     if(pData)
     321                 :            :     {
     322         [ +  - ]:        152 :         mnServiceId = pData->GetClassId();
     323                 :            :         DBG_ASSERT(mnServiceId != text::textfield::Type::UNSPECIFIED, "unknown SvxFieldData! [CL]");
     324         [ +  - ]:        152 :         if (mnServiceId != text::textfield::Type::UNSPECIFIED)
     325                 :            :         {
     326                 :            :             // extract field properties from data class
     327   [ +  +  -  -  :        152 :             switch( mnServiceId )
             -  -  -  + ]
     328                 :            :             {
     329                 :            :             case text::textfield::Type::DATE:
     330                 :            :                 {
     331                 :          8 :                     mpImpl->mbBoolean2 = sal_True;
     332                 :            :                     // #i35416# for variable date field, don't use invalid "0000-00-00" date,
     333                 :            :                     // use current date instead
     334                 :          8 :                     sal_Bool bFixed = ((SvxDateField*)pData)->GetType() == SVXDATETYPE_FIX;
     335                 :            :                     mpImpl->maDateTime = getDate( bFixed ?
     336                 :            :                                             ((SvxDateField*)pData)->GetFixDate() :
     337 [ +  - ][ +  - ]:          8 :                                             Date( Date::SYSTEM ).GetDate() );
         [ #  # ][ -  + ]
     338                 :          8 :                     mpImpl->mnInt32 = ((SvxDateField*)pData)->GetFormat();
     339                 :          8 :                     mpImpl->mbBoolean1 = bFixed;
     340                 :            :                 }
     341                 :          8 :                 break;
     342                 :            : 
     343                 :            :             case text::textfield::Type::TIME:
     344                 :          8 :                 mpImpl->mbBoolean2 = sal_False;
     345                 :          8 :                 mpImpl->mbBoolean1 = sal_False;
     346                 :          8 :                 mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
     347                 :          8 :                 break;
     348                 :            : 
     349                 :            :             case text::textfield::Type::EXTENDED_TIME:
     350                 :          0 :                 mpImpl->mbBoolean2 = sal_False;
     351                 :          0 :                 mpImpl->maDateTime = getTime( ((SvxExtTimeField*)pData)->GetFixTime() );
     352                 :          0 :                 mpImpl->mbBoolean1 = ((SvxExtTimeField*)pData)->GetType() == SVXTIMETYPE_FIX;
     353                 :          0 :                 mpImpl->mnInt32 = ((SvxExtTimeField*)pData)->GetFormat();
     354                 :          0 :                 break;
     355                 :            : 
     356                 :            :             case text::textfield::Type::URL:
     357                 :          0 :                 mpImpl->msString1 = ((SvxURLField*)pData)->GetRepresentation();
     358                 :          0 :                 mpImpl->msString2 = ((SvxURLField*)pData)->GetTargetFrame();
     359                 :          0 :                 mpImpl->msString3 = ((SvxURLField*)pData)->GetURL();
     360                 :            :                 mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
     361                 :          0 :                     ((SvxURLField*)pData)->GetFormat());
     362                 :          0 :                 break;
     363                 :            : 
     364                 :            :             case text::textfield::Type::EXTENDED_FILE:
     365                 :          0 :                 mpImpl->msString1 = ((SvxExtFileField*)pData)->GetFile();
     366                 :          0 :                 mpImpl->mbBoolean1 = ((SvxExtFileField*)pData)->GetType() == SVXFILETYPE_FIX;
     367                 :          0 :                 mpImpl->mnInt16 = getFileNameDisplayFormat(((SvxExtFileField*)pData)->GetFormat());
     368                 :          0 :                 break;
     369                 :            : 
     370                 :            :             case text::textfield::Type::AUTHOR:
     371         [ #  # ]:          0 :                 mpImpl->msString1  = ((SvxAuthorField*)pData)->GetFormatted();
     372         [ #  # ]:          0 :                 mpImpl->msString2  = ((SvxAuthorField*)pData)->GetFormatted();
     373                 :            :                 mpImpl->mnInt16    = sal::static_int_cast< sal_Int16 >(
     374                 :          0 :                     ((SvxAuthorField*)pData)->GetFormat());
     375                 :          0 :                 mpImpl->mbBoolean1 = ((SvxAuthorField*)pData)->GetType() == SVXAUTHORTYPE_FIX;
     376                 :          0 :                 mpImpl->mbBoolean2 = ((SvxAuthorField*)pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME;
     377                 :          0 :                 break;
     378                 :            : 
     379                 :            :             case text::textfield::Type::MEASURE:
     380                 :          0 :                 mpImpl->mnInt16     = sal::static_int_cast< sal_Int16 >(((SdrMeasureField*)pData)->GetMeasureFieldKind());
     381                 :        152 :                 break;
     382                 :            :             }
     383                 :            :         }
     384                 :            :     }
     385                 :            : 
     386         [ +  - ]:        152 :     mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
     387                 :        152 : }
     388                 :            : 
     389 [ +  - ][ +  - ]:        269 : SvxUnoTextField::~SvxUnoTextField() throw()
     390                 :            : {
     391         [ +  - ]:        269 :     delete mpImpl;
     392         [ -  + ]:        496 : }
     393                 :            : 
     394                 :          2 : SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
     395                 :            : {
     396                 :          2 :     SvxFieldData* pData = NULL;
     397                 :            : 
     398   [ +  -  -  -  :          2 :     switch( mnServiceId )
          -  -  -  -  -  
             -  -  -  - ]
     399                 :            :     {
     400                 :            :     case text::textfield::Type::TIME:
     401                 :            :     case text::textfield::Type::EXTENDED_TIME:
     402                 :            :     case text::textfield::Type::DATE:
     403                 :            :     {
     404         [ +  - ]:          2 :         if( mpImpl->mbBoolean2 ) // IsDate?
     405                 :            :         {
     406                 :          2 :             Date aDate( setDate( mpImpl->maDateTime ) );
     407 [ +  - ][ +  - ]:          2 :             pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
     408 [ +  - ][ +  - ]:          2 :             if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F )
     409                 :          2 :                 ((SvxDateField*)pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 );
     410                 :            :         }
     411                 :            :         else
     412                 :            :         {
     413 [ #  # ][ #  # ]:          0 :             if( mnServiceId != text::textfield::Type::TIME && mnServiceId != text::textfield::Type::DATE )
     414                 :            :             {
     415         [ #  # ]:          0 :                 Time aTime( setTime( mpImpl->maDateTime ) );
     416 [ #  # ][ #  # ]:          0 :                 pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
     417                 :            : 
     418 [ #  # ][ #  # ]:          0 :                 if( mpImpl->mnInt32 >= SVXTIMEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXTIMEFORMAT_AM_HMSH )
     419                 :          0 :                     ((SvxExtTimeField*)pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 );
     420                 :            :             }
     421                 :            :             else
     422                 :            :             {
     423         [ #  # ]:          0 :                 pData = new SvxTimeField();
     424                 :            :             }
     425                 :            :         }
     426                 :            : 
     427                 :            :     }
     428                 :          2 :         break;
     429                 :            : 
     430                 :            :     case text::textfield::Type::URL:
     431 [ #  # ][ #  # ]:          0 :         pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
     432                 :          0 :         ((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 );
     433 [ #  # ][ #  # ]:          0 :         if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
     434                 :          0 :             ((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
     435                 :          0 :         break;
     436                 :            : 
     437                 :            :     case text::textfield::Type::PAGE:
     438         [ #  # ]:          0 :         pData = new SvxPageField();
     439                 :          0 :         break;
     440                 :            : 
     441                 :            :     case text::textfield::Type::PAGES:
     442         [ #  # ]:          0 :         pData = new SvxPagesField();
     443                 :          0 :         break;
     444                 :            : 
     445                 :            :     case text::textfield::Type::DOCINFO_TITLE:
     446         [ #  # ]:          0 :         pData = new SvxFileField();
     447                 :          0 :         break;
     448                 :            : 
     449                 :            :     case text::textfield::Type::TABLE:
     450         [ #  # ]:          0 :         pData = new SvxTableField();
     451                 :          0 :         break;
     452                 :            : 
     453                 :            :     case text::textfield::Type::EXTENDED_FILE:
     454                 :            :     {
     455                 :            :         // #92009# pass fixed attribute to constructor
     456                 :            :         pData = new SvxExtFileField( mpImpl->msString1,
     457                 :            :                                      mpImpl->mbBoolean1 ? SVXFILETYPE_FIX : SVXFILETYPE_VAR,
     458         [ #  # ]:          0 :                                      setFileNameDisplayFormat(mpImpl->mnInt16 ) );
     459                 :          0 :         break;
     460                 :            :     }
     461                 :            : 
     462                 :            :     case text::textfield::Type::AUTHOR:
     463                 :            :     {
     464                 :          0 :         ::rtl::OUString aContent;
     465         [ #  # ]:          0 :         String aFirstName;
     466         [ #  # ]:          0 :         String aLastName;
     467         [ #  # ]:          0 :         String aEmpty;
     468                 :            : 
     469                 :            :         // do we have CurrentPresentation given?
     470                 :            :         // mimic behaviour of writer, which means:
     471                 :            :         // prefer CurrentPresentation over Content
     472                 :            :         // if both are given.
     473         [ #  # ]:          0 :         if( !mpImpl->msString1.isEmpty() )
     474                 :          0 :             aContent = mpImpl->msString1;
     475                 :            :         else
     476                 :          0 :             aContent = mpImpl->msString2;
     477                 :            : 
     478                 :          0 :         sal_Int32 nPos = aContent.lastIndexOf( sal_Char(' '), 0 );
     479         [ #  # ]:          0 :         if( nPos > 0 )
     480                 :            :         {
     481         [ #  # ]:          0 :             aFirstName = aContent.copy( 0, nPos );
     482         [ #  # ]:          0 :             aLastName = aContent.copy( nPos + 1 );
     483                 :            :         }
     484                 :            :         else
     485                 :            :         {
     486         [ #  # ]:          0 :             aLastName = aContent;
     487                 :            :         }
     488                 :            : 
     489                 :            :         // #92009# pass fixed attribute to constructor
     490                 :            :         pData = new SvxAuthorField( aFirstName, aLastName, aEmpty,
     491 [ #  # ][ #  # ]:          0 :                                     mpImpl->mbBoolean1 ? SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR );
         [ #  # ][ #  # ]
                 [ #  # ]
     492                 :            : 
     493         [ #  # ]:          0 :         if( !mpImpl->mbBoolean2 )
     494                 :            :         {
     495                 :          0 :             ((SvxAuthorField*)pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME );
     496                 :            :         }
     497 [ #  # ][ #  # ]:          0 :         else if( mpImpl->mnInt16 >= SVXAUTHORFORMAT_FULLNAME || mpImpl->mnInt16 <= SVXAUTHORFORMAT_SHORTNAME )
     498                 :            :         {
     499                 :          0 :             ((SvxAuthorField*)pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 );
     500                 :            :         }
     501                 :            : 
     502 [ #  # ][ #  # ]:          0 :         break;
                 [ #  # ]
     503                 :            :     }
     504                 :            : 
     505                 :            :     case text::textfield::Type::MEASURE:
     506                 :            :     {
     507                 :          0 :         SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
     508 [ #  # ][ #  # ]:          0 :         if( mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_UNIT || mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_ROTA90BLANCS )
     509                 :          0 :             eKind = (SdrMeasureFieldKind) mpImpl->mnInt16;
     510         [ #  # ]:          0 :         pData = new SdrMeasureField( eKind);
     511                 :          0 :         break;
     512                 :            :     }
     513                 :            :     case text::textfield::Type::PRESENTATION_HEADER:
     514         [ #  # ]:          0 :         pData = new SvxHeaderField();
     515                 :          0 :         break;
     516                 :            :     case text::textfield::Type::PRESENTATION_FOOTER:
     517         [ #  # ]:          0 :         pData = new SvxFooterField();
     518                 :          0 :         break;
     519                 :            :     case text::textfield::Type::PRESENTATION_DATE_TIME:
     520         [ #  # ]:          0 :         pData = new SvxDateTimeField();
     521                 :          0 :         break;
     522                 :            :     };
     523                 :            : 
     524                 :          2 :     return pData;
     525                 :            : }
     526                 :            : 
     527                 :            : // uno::XInterface
     528                 :       1100 : uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType )
     529                 :            :     throw(uno::RuntimeException)
     530                 :            : {
     531                 :       1100 :     uno::Any aAny;
     532                 :            : 
     533 [ +  + ][ +  - ]:       1100 :     QUERYINT( beans::XPropertySet );
         [ +  - ][ +  - ]
     534 [ +  - ][ +  + ]:        742 :     else QUERYINT( text::XTextContent );
         [ +  - ][ +  - ]
     535 [ +  - ][ +  + ]:        667 :     else QUERYINT( text::XTextField );
         [ +  - ][ +  - ]
     536 [ +  - ][ +  + ]:        501 :     else QUERYINT( lang::XServiceInfo );
         [ +  - ][ +  - ]
     537 [ +  - ][ -  + ]:        347 :     else QUERYINT( lang::XUnoTunnel );
         [ #  # ][ #  # ]
     538                 :            :     else
     539         [ +  - ]:        347 :         return OComponentHelper::queryAggregation( rType );
     540                 :            : 
     541                 :       1100 :     return aAny;
     542                 :            : }
     543                 :            : 
     544                 :            : // XTypeProvider
     545                 :            : 
     546                 :          0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes()
     547                 :            :     throw (uno::RuntimeException)
     548                 :            : {
     549         [ #  # ]:          0 :     if( maTypeSequence.getLength() == 0 )
     550                 :            :     {
     551         [ #  # ]:          0 :         maTypeSequence = OComponentHelper::getTypes();
     552                 :          0 :         sal_Int32 nOldCount = maTypeSequence.getLength();
     553                 :            : 
     554                 :          0 :         maTypeSequence.realloc( nOldCount + 4 ); // !DANGER! keep this updated
     555                 :          0 :         uno::Type* pTypes = &maTypeSequence.getArray()[nOldCount];
     556                 :            : 
     557                 :          0 :         *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextField >*)0);
     558                 :          0 :         *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
     559                 :          0 :         *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
     560                 :          0 :         *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
     561                 :            :     }
     562                 :          0 :     return maTypeSequence;
     563                 :            : }
     564                 :            : 
     565                 :            : namespace
     566                 :            : {
     567                 :            :     class theSvxUnoTextFieldImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldImplementationId > {};
     568                 :            : }
     569                 :            : 
     570                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId()
     571                 :            :     throw (uno::RuntimeException)
     572                 :            : {
     573                 :          0 :     return theSvxUnoTextFieldImplementationId::get().getSeq();
     574                 :            : }
     575                 :            : 
     576                 :       1100 : uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType )
     577                 :            :     throw(uno::RuntimeException)
     578                 :            : {
     579                 :       1100 :     return OComponentHelper::queryInterface(rType);
     580                 :            : }
     581                 :            : 
     582                 :       3791 : void SAL_CALL SvxUnoTextField::acquire() throw( )
     583                 :            : {
     584                 :       3791 :     OComponentHelper::acquire();
     585                 :       3791 : }
     586                 :            : 
     587                 :       3791 : void SAL_CALL SvxUnoTextField::release() throw( )
     588                 :            : {
     589                 :       3791 :     OComponentHelper::release();
     590                 :       3791 : }
     591                 :            : 
     592                 :            : // Interface text::XTextField
     593                 :         80 : OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
     594                 :            :     throw(uno::RuntimeException)
     595                 :            : {
     596         [ +  - ]:         80 :     SolarMutexGuard aGuard;
     597         [ +  + ]:         80 :     if (bShowCommand)
     598                 :            :     {
     599   [ +  -  -  -  :          2 :         switch (mnServiceId)
          -  -  -  -  -  
          -  -  -  -  -  
                      - ]
     600                 :            :         {
     601                 :            :             case text::textfield::Type::DATE:
     602                 :          2 :                 return OUString("Date");
     603                 :            :             case text::textfield::Type::URL:
     604                 :          0 :                 return OUString("URL");
     605                 :            :             case text::textfield::Type::PAGE:
     606                 :          0 :                 return OUString("Page");
     607                 :            :             case text::textfield::Type::PAGES:
     608                 :          0 :                 return OUString("Pages");
     609                 :            :             case text::textfield::Type::TIME:
     610                 :          0 :                 return OUString("Time");
     611                 :            :             case text::textfield::Type::DOCINFO_TITLE:
     612                 :          0 :                 return OUString("File");
     613                 :            :             case text::textfield::Type::TABLE:
     614                 :          0 :                 return OUString("Table");
     615                 :            :             case text::textfield::Type::EXTENDED_TIME:
     616                 :          0 :                 return OUString("ExtTime");
     617                 :            :             case text::textfield::Type::EXTENDED_FILE:
     618                 :          0 :                 return OUString("ExtFile");
     619                 :            :             case text::textfield::Type::AUTHOR:
     620                 :          0 :                 return OUString("Author");
     621                 :            :             case text::textfield::Type::MEASURE:
     622                 :          0 :                 return OUString("Measure");
     623                 :            :             case text::textfield::Type::PRESENTATION_HEADER:
     624                 :          0 :                 return OUString("Header");
     625                 :            :             case text::textfield::Type::PRESENTATION_FOOTER:
     626                 :          0 :                 return OUString("Footer");
     627                 :            :             case text::textfield::Type::PRESENTATION_DATE_TIME:
     628                 :          0 :                 return OUString("DateTime");
     629                 :            :             default:
     630                 :          0 :                 return OUString("Unknown");
     631                 :            :         }
     632                 :            :     }
     633                 :            :     else
     634                 :            :     {
     635                 :         78 :         return mpImpl->msPresentation;
     636         [ +  - ]:         80 :     }
     637                 :            : }
     638                 :            : 
     639                 :            : // Interface text::XTextContent
     640                 :          2 : void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange )
     641                 :            :     throw(lang::IllegalArgumentException, uno::RuntimeException)
     642                 :            : {
     643                 :          2 :     SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xTextRange );
     644         [ -  + ]:          2 :     if(pRange == NULL)
     645         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     646                 :            : 
     647                 :          2 :     SvxFieldData* pData = CreateFieldData();
     648         [ +  - ]:          2 :     if( pData )
     649                 :          2 :         pRange->attachField( pData );
     650                 :            : 
     651         [ +  - ]:          2 :     delete pData;
     652                 :          2 : }
     653                 :            : 
     654                 :        154 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextField::getAnchor()
     655                 :            :     throw(uno::RuntimeException)
     656                 :            : {
     657                 :        154 :     return mxAnchor;
     658                 :            : }
     659                 :            : 
     660                 :            : // lang::XComponent
     661                 :        227 : void SAL_CALL SvxUnoTextField::dispose()
     662                 :            :     throw(uno::RuntimeException)
     663                 :            : {
     664                 :        227 :     OComponentHelper::dispose();
     665                 :        227 : }
     666                 :            : 
     667                 :          4 : void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
     668                 :            :     throw(uno::RuntimeException)
     669                 :            : {
     670                 :          4 :     OComponentHelper::addEventListener(xListener);
     671                 :          4 : }
     672                 :            : 
     673                 :          2 : void SAL_CALL SvxUnoTextField::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
     674                 :            :     throw(uno::RuntimeException)
     675                 :            : {
     676                 :          2 :     OComponentHelper::removeEventListener(aListener);
     677                 :          2 : }
     678                 :            : 
     679                 :            : 
     680                 :            : // Interface beans::XPropertySet
     681                 :        147 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextField::getPropertySetInfo(  )
     682                 :            :     throw(uno::RuntimeException)
     683                 :            : {
     684         [ +  - ]:        147 :     SolarMutexGuard aGuard;
     685 [ +  - ][ +  - ]:        147 :     return mpPropSet->getPropertySetInfo();
     686                 :            : }
     687                 :            : 
     688                 :         95 : void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
     689                 :            :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     690                 :            : {
     691         [ +  - ]:         95 :     SolarMutexGuard aGuard;
     692                 :            : 
     693         [ -  + ]:         95 :     if( mpImpl == NULL )
     694         [ #  # ]:          0 :         throw uno::RuntimeException();
     695                 :            : 
     696         [ +  + ]:         95 :     if (aPropertyName == UNO_TC_PROP_ANCHOR)
     697                 :            :     {
     698         [ +  - ]:         73 :         aValue >>= mxAnchor;
     699                 :            :         return;
     700                 :            :     }
     701                 :            : 
     702         [ +  - ]:         22 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( aPropertyName );
     703         [ -  + ]:         22 :     if ( !pMap )
     704         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     705                 :            : 
     706   [ +  +  +  -  :         22 :     switch( pMap->nWID )
             +  -  -  -  
                      - ]
     707                 :            :     {
     708                 :            :     case WID_DATE:
     709 [ +  - ][ -  + ]:          4 :         if(aValue >>= mpImpl->maDateTime)
     710                 :            :             return;
     711                 :          0 :         break;
     712                 :            :     case WID_BOOL1:
     713         [ -  + ]:          7 :         if(aValue >>= mpImpl->mbBoolean1)
     714                 :            :             return;
     715                 :          0 :         break;
     716                 :            :     case WID_BOOL2:
     717         [ -  + ]:          7 :         if(aValue >>= mpImpl->mbBoolean2)
     718                 :            :             return;
     719                 :          0 :         break;
     720                 :            :     case WID_INT16:
     721         [ #  # ]:          0 :         if(aValue >>= mpImpl->mnInt16)
     722                 :            :             return;
     723                 :          0 :         break;
     724                 :            :     case WID_INT32:
     725         [ -  + ]:          4 :         if(aValue >>= mpImpl->mnInt32)
     726                 :            :             return;
     727                 :          0 :         break;
     728                 :            :     case WID_STRING1:
     729         [ #  # ]:          0 :         if(aValue >>= mpImpl->msString1)
     730                 :            :             return;
     731                 :          0 :         break;
     732                 :            :     case WID_STRING2:
     733         [ #  # ]:          0 :         if(aValue >>= mpImpl->msString2)
     734                 :            :             return;
     735                 :          0 :         break;
     736                 :            :     case WID_STRING3:
     737         [ #  # ]:          0 :         if(aValue >>= mpImpl->msString3)
     738                 :            :             return;
     739                 :          0 :         break;
     740                 :            :     }
     741                 :            : 
     742 [ #  # ][ +  - ]:         95 :     throw lang::IllegalArgumentException();
     743                 :            : }
     744                 :            : 
     745                 :        181 : uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName )
     746                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     747                 :            : {
     748         [ +  - ]:        181 :     SolarMutexGuard aGuard;
     749                 :            : 
     750         [ -  + ]:        181 :     if (PropertyName == UNO_TC_PROP_ANCHOR)
     751         [ #  # ]:          0 :         return uno::makeAny(mxAnchor);
     752                 :            : 
     753         [ +  + ]:        181 :     if (PropertyName == UNO_TC_PROP_TEXTFIELD_TYPE)
     754         [ +  - ]:         73 :         return uno::makeAny(mnServiceId);
     755                 :            : 
     756                 :        108 :     uno::Any aValue;
     757                 :            : 
     758         [ +  - ]:        108 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( PropertyName );
     759         [ -  + ]:        108 :     if ( !pMap )
     760         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     761                 :            : 
     762   [ +  +  +  -  :        108 :     switch( pMap->nWID )
             +  -  -  -  
                      - ]
     763                 :            :     {
     764                 :            :     case WID_DATE:
     765         [ +  - ]:         23 :         aValue <<= mpImpl->maDateTime;
     766                 :         23 :         break;
     767                 :            :     case WID_BOOL1:
     768         [ +  - ]:         23 :         aValue <<= mpImpl->mbBoolean1;
     769                 :         23 :         break;
     770                 :            :     case WID_BOOL2:
     771         [ +  - ]:         35 :         aValue <<= mpImpl->mbBoolean2;
     772                 :         35 :         break;
     773                 :            :     case WID_INT16:
     774         [ #  # ]:          0 :         aValue <<= mpImpl->mnInt16;
     775                 :          0 :         break;
     776                 :            :     case WID_INT32:
     777         [ +  - ]:         27 :         aValue <<= mpImpl->mnInt32;
     778                 :         27 :         break;
     779                 :            :     case WID_STRING1:
     780         [ #  # ]:          0 :         aValue <<= mpImpl->msString1;
     781                 :          0 :         break;
     782                 :            :     case WID_STRING2:
     783         [ #  # ]:          0 :         aValue <<= mpImpl->msString2;
     784                 :          0 :         break;
     785                 :            :     case WID_STRING3:
     786         [ #  # ]:          0 :         aValue <<= mpImpl->msString3;
     787                 :          0 :         break;
     788                 :            :     }
     789                 :            : 
     790         [ +  - ]:        181 :     return aValue;
     791                 :            : }
     792                 :            : 
     793                 :          0 : void SAL_CALL SvxUnoTextField::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     794                 :          0 : void SAL_CALL SvxUnoTextField::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     795                 :          0 : void SAL_CALL SvxUnoTextField::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     796                 :          0 : void SAL_CALL SvxUnoTextField::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
     797                 :            : 
     798                 :            : // OComponentHelper
     799                 :        227 : void SvxUnoTextField::disposing()
     800                 :            : {
     801                 :            :     // nothing to do
     802                 :        227 : }
     803                 :            : 
     804                 :            : // lang::XServiceInfo
     805                 :          0 : OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException)
     806                 :            : {
     807                 :          0 :     return OUString("SvxUnoTextField");
     808                 :            : }
     809                 :            : 
     810                 :        196 : uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
     811                 :            :     throw(uno::RuntimeException)
     812                 :            : {
     813                 :        196 :     uno::Sequence<OUString> aSeq(4);
     814         [ +  - ]:        196 :     OUString* pServices = aSeq.getArray();
     815                 :        196 :     pServices[0] = "com.sun.star.text.TextContent";
     816                 :        196 :     pServices[1] = "com.sun.star.text.TextField";
     817                 :            : 
     818   [ +  +  +  +  :        196 :     switch (mnServiceId)
          +  +  +  +  +  
          +  +  +  +  +  
                      - ]
     819                 :            :     {
     820                 :            :         case text::textfield::Type::DATE:
     821                 :         13 :             pServices[2] = "com.sun.star.text.TextField.DateTime";
     822                 :         13 :             pServices[3] = "com.sun.star.text.textfield.DateTime";
     823                 :         13 :         break;
     824                 :            :         case text::textfield::Type::URL:
     825                 :          3 :             pServices[2] = "com.sun.star.text.TextField.URL";
     826                 :          3 :             pServices[3] = "com.sun.star.text.textfield.URL";
     827                 :          3 :         break;
     828                 :            :         case text::textfield::Type::PAGE:
     829                 :         43 :             pServices[2] = "com.sun.star.text.TextField.PageNumber";
     830                 :         43 :             pServices[3] = "com.sun.star.text.textfield.PageNumber";
     831                 :         43 :         break;
     832                 :            :         case text::textfield::Type::PAGES:
     833                 :         11 :             pServices[2] = "com.sun.star.text.TextField.PageCount";
     834                 :         11 :             pServices[3] = "com.sun.star.text.textfield.PageCount";
     835                 :         11 :         break;
     836                 :            :         case text::textfield::Type::TIME:
     837                 :         11 :             pServices[2] = "com.sun.star.text.TextField.DateTime";
     838                 :         11 :             pServices[3] = "com.sun.star.text.textfield.DateTime";
     839                 :         11 :         break;
     840                 :            :         case text::textfield::Type::DOCINFO_TITLE:
     841                 :         11 :             pServices[2] = "com.sun.star.text.TextField.docinfo.Title";
     842                 :         11 :             pServices[3] = "com.sun.star.text.textfield.docinfo.Title";
     843                 :         11 :         break;
     844                 :            :         case text::textfield::Type::TABLE:
     845                 :         19 :             pServices[2] = "com.sun.star.text.TextField.SheetName";
     846                 :         19 :             pServices[3] = "com.sun.star.text.textfield.SheetName";
     847                 :         19 :         break;
     848                 :            :         case text::textfield::Type::EXTENDED_TIME:
     849                 :          3 :             pServices[2] = "com.sun.star.text.TextField.DateTime";
     850                 :          3 :             pServices[3] = "com.sun.star.text.textfield.DateTime";
     851                 :          3 :         break;
     852                 :            :         case text::textfield::Type::EXTENDED_FILE:
     853                 :          3 :             pServices[2] = "com.sun.star.text.TextField.FileName";
     854                 :          3 :             pServices[3] = "com.sun.star.text.textfield.FileName";
     855                 :          3 :         break;
     856                 :            :         case text::textfield::Type::AUTHOR:
     857                 :          3 :             pServices[2] = "com.sun.star.text.TextField.Author";
     858                 :          3 :             pServices[3] = "com.sun.star.text.textfield.Author";
     859                 :          3 :         break;
     860                 :            :         case text::textfield::Type::MEASURE:
     861                 :          3 :             pServices[2] = "com.sun.star.text.TextField.Measure";
     862                 :          3 :             pServices[3] = "com.sun.star.text.textfield.Measure";
     863                 :          3 :         break;
     864                 :            :         case text::textfield::Type::PRESENTATION_HEADER:
     865                 :         19 :             pServices[2] = "com.sun.star.presentation.TextField.Header";
     866                 :         19 :             pServices[3] = "com.sun.star.presentation.textfield.Header";
     867                 :         19 :         break;
     868                 :            :         case text::textfield::Type::PRESENTATION_FOOTER:
     869                 :         27 :             pServices[2] = "com.sun.star.presentation.TextField.Footer";
     870                 :         27 :             pServices[3] = "com.sun.star.presentation.textfield.Footer";
     871                 :         27 :         break;
     872                 :            :         case text::textfield::Type::PRESENTATION_DATE_TIME:
     873                 :         27 :             pServices[2] = "com.sun.star.presentation.TextField.DateTime";
     874                 :         27 :             pServices[3] = "com.sun.star.presentation.textfield.DateTime";
     875                 :         27 :         break;
     876                 :            :         default:
     877         [ #  # ]:          0 :             aSeq.realloc(0);
     878                 :            :     }
     879                 :            : 
     880                 :        196 :     return aSeq;
     881                 :            : }
     882                 :            : 
     883                 :          2 : sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     884                 :            : {
     885                 :          2 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     886                 :            : }
     887                 :            : 
     888                 :        262 : uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
     889                 :            : {
     890                 :        262 :     uno::Reference< uno::XInterface > xRet;
     891                 :            : 
     892                 :        262 :     const OUString aTextFieldPrexit( "com.sun.star.text.textfield." );
     893                 :            : 
     894                 :            :     // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
     895                 :            :     // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
     896                 :        262 :     const OUString aTextFieldPrexit2( "com.sun.star.text.TextField." );
     897                 :            : 
     898         [ +  + ]:        524 :     if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
           [ +  -  +  + ]
     899                 :        262 :         (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
     900                 :            :     {
     901                 :         24 :         OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
     902                 :            : 
     903                 :         24 :         sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
     904                 :            : 
     905         [ -  + ]:         24 :         if ( aFieldType == "DateTime" )
     906                 :            :         {
     907                 :          0 :             nId = text::textfield::Type::DATE;
     908                 :            :         }
     909         [ -  + ]:         24 :         else if ( aFieldType == "URL" )
     910                 :            :         {
     911                 :          0 :             nId = text::textfield::Type::URL;
     912                 :            :         }
     913         [ +  - ]:         24 :         else if ( aFieldType == "PageNumber" )
     914                 :            :         {
     915                 :         24 :             nId = text::textfield::Type::PAGE;
     916                 :            :         }
     917         [ #  # ]:          0 :         else if ( aFieldType == "PageCount" )
     918                 :            :         {
     919                 :          0 :             nId = text::textfield::Type::PAGES;
     920                 :            :         }
     921         [ #  # ]:          0 :         else if ( aFieldType == "SheetName" )
     922                 :            :         {
     923                 :          0 :             nId = text::textfield::Type::TABLE;
     924                 :            :         }
     925         [ #  # ]:          0 :         else if ( aFieldType == "FileName" )
     926                 :            :         {
     927                 :          0 :             nId = text::textfield::Type::EXTENDED_FILE;
     928                 :            :         }
     929         [ #  # ]:          0 :         else if (aFieldType.equalsAsciiL(
           [ #  #  #  # ]
     930                 :          0 :                     RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
     931                 :            :                  aFieldType.equalsAsciiL(
     932                 :          0 :                     RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
     933                 :            :         {
     934                 :          0 :             nId = text::textfield::Type::DOCINFO_TITLE;
     935                 :            :         }
     936         [ #  # ]:          0 :         else if ( aFieldType == "Author" )
     937                 :            :         {
     938                 :          0 :             nId = text::textfield::Type::AUTHOR;
     939                 :            :         }
     940         [ #  # ]:          0 :         else if ( aFieldType == "Measure" )
     941                 :            :         {
     942                 :          0 :             nId = text::textfield::Type::MEASURE;
     943                 :            :         }
     944                 :            : 
     945         [ +  - ]:         24 :         if (nId != text::textfield::Type::UNSPECIFIED)
     946         [ +  - ]:         24 :             xRet = (::cppu::OWeakObject * )new SvxUnoTextField( nId );
     947                 :            :     }
     948                 :            : 
     949                 :        262 :     return xRet;
     950                 :            : }
     951                 :            : 
     952                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10