LCOV - code coverage report
Current view: top level - sw/source/core/fields - docufld.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 224 1232 18.2 %
Date: 2012-08-25 Functions: 47 163 28.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 126 1673 7.5 %

           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                 :            : 
      30                 :            : #include <textapi.hxx>
      31                 :            : 
      32                 :            : #include <hintids.hxx>
      33                 :            : #include <com/sun/star/text/XText.hpp>
      34                 :            : #include <com/sun/star/script/XTypeConverter.hpp>
      35                 :            : #include <com/sun/star/text/SetVariableType.hpp>
      36                 :            : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      37                 :            : #include <com/sun/star/text/UserDataPart.hpp>
      38                 :            : #include <com/sun/star/text/ChapterFormat.hpp>
      39                 :            : #include <com/sun/star/text/XTextField.hpp>
      40                 :            : #include <com/sun/star/text/PlaceholderType.hpp>
      41                 :            : #include <com/sun/star/text/TemplateDisplayFormat.hpp>
      42                 :            : #include <com/sun/star/text/UserFieldFormat.hpp>
      43                 :            : #include <com/sun/star/text/PageNumberType.hpp>
      44                 :            : #include <com/sun/star/text/ReferenceFieldPart.hpp>
      45                 :            : #include <com/sun/star/text/FilenameDisplayFormat.hpp>
      46                 :            : #include <com/sun/star/text/XDependentTextField.hpp>
      47                 :            : #include <com/sun/star/text/DocumentStatistic.hpp>
      48                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      49                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      50                 :            : #include <com/sun/star/util/Date.hpp>
      51                 :            : #include <com/sun/star/util/Duration.hpp>
      52                 :            : #include <unotools/localedatawrapper.hxx>
      53                 :            : #include <editeng/unolingu.hxx>
      54                 :            : #include <comphelper/processfactory.hxx>
      55                 :            : #include <comphelper/types.hxx>
      56                 :            : #include <comphelper/string.hxx>
      57                 :            : #include <tools/urlobj.hxx>
      58                 :            : #include <vcl/svapp.hxx>
      59                 :            : #include <svl/urihelper.hxx>
      60                 :            : #include <unotools/useroptions.hxx>
      61                 :            : #include <unotools/syslocale.hxx>
      62                 :            : #include <svl/zforlist.hxx>
      63                 :            : 
      64                 :            : #include <tools/time.hxx>
      65                 :            : #include <tools/datetime.hxx>
      66                 :            : 
      67                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      68                 :            : #include <com/sun/star/util/DateTime.hpp>
      69                 :            : #include <com/sun/star/util/Time.hpp>
      70                 :            : 
      71                 :            : #include <tools/shl.hxx>
      72                 :            : #include <swmodule.hxx>
      73                 :            : #include <sfx2/app.hxx>
      74                 :            : #include <sfx2/docfile.hxx>
      75                 :            : #include <sfx2/doctempl.hxx>
      76                 :            : #include <fmtfld.hxx>
      77                 :            : #include <txtfld.hxx>
      78                 :            : #include <charfmt.hxx>
      79                 :            : #include <docstat.hxx>
      80                 :            : #include <pagedesc.hxx>
      81                 :            : #include <fmtpdsc.hxx>
      82                 :            : #include <doc.hxx>
      83                 :            : #include <rootfrm.hxx>      // AuthorField
      84                 :            : #include <pagefrm.hxx>      //
      85                 :            : #include <cntfrm.hxx>       //
      86                 :            : #include <pam.hxx>
      87                 :            : #include <viewsh.hxx>
      88                 :            : #include <dbmgr.hxx>
      89                 :            : #include <shellres.hxx>
      90                 :            : #include <docufld.hxx>
      91                 :            : #include <flddat.hxx>
      92                 :            : #include <docfld.hxx>
      93                 :            : #include <ndtxt.hxx>
      94                 :            : #include <expfld.hxx>
      95                 :            : #include <poolfmt.hxx>
      96                 :            : #include <docsh.hxx>
      97                 :            : #include <unofldmid.h>
      98                 :            : #include <swunohelper.hxx>
      99                 :            : #include <comcore.hrc>
     100                 :            : 
     101                 :            : #include <editeng/outliner.hxx>
     102                 :            : #include <editeng/outlobj.hxx>
     103                 :            : #include <switerator.hxx>
     104                 :            : 
     105                 :            : #define URL_DECODE  INetURLObject::DECODE_UNAMBIGUOUS
     106                 :            : 
     107                 :            : using ::rtl::OUString;
     108                 :            : using namespace ::com::sun::star;
     109                 :            : using namespace ::com::sun::star::uno;
     110                 :            : using namespace nsSwDocInfoSubType;
     111                 :            : 
     112                 :            : /*--------------------------------------------------------------------
     113                 :            :     Beschreibung: SwPageNumberFieldType
     114                 :            :  --------------------------------------------------------------------*/
     115                 :            : 
     116                 :       1549 : SwPageNumberFieldType::SwPageNumberFieldType()
     117                 :            :     : SwFieldType( RES_PAGENUMBERFLD ),
     118                 :            :     nNumberingType( SVX_NUM_ARABIC ),
     119                 :            :     nNum( 0 ),
     120                 :            :     nMax( USHRT_MAX ),
     121                 :       1549 :     bVirtuell( sal_False )
     122                 :            : {
     123                 :       1549 : }
     124                 :            : 
     125                 :       1443 : String& SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
     126                 :            :                                 const String& rUserStr, String& rRet ) const
     127                 :            : {
     128         [ +  + ]:       1443 :     sal_uInt32 nTmpFmt = (SVX_NUM_PAGEDESC == nFmt) ? (sal_uInt32)nNumberingType : nFmt;
     129                 :       1443 :     long nTmp = nNum + nOff;
     130                 :            : 
     131 [ +  + ][ +  - ]:       1443 :     if( 0 >= nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMax) )
         [ +  - ][ -  + ]
     132                 :       1431 :         rRet = aEmptyStr;
     133         [ -  + ]:         12 :     else if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
     134                 :          0 :         rRet = rUserStr;
     135                 :            :     else
     136         [ +  - ]:         12 :         rRet = FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
     137                 :       1443 :     return rRet;
     138                 :            : }
     139                 :            : 
     140                 :          0 : SwFieldType* SwPageNumberFieldType::Copy() const
     141                 :            : {
     142         [ #  # ]:          0 :     SwPageNumberFieldType *pTmp = new SwPageNumberFieldType();
     143                 :            : 
     144                 :          0 :     pTmp->nNum       = nNum;
     145                 :          0 :     pTmp->nMax       = nMax;
     146                 :          0 :     pTmp->nNumberingType = nNumberingType;
     147                 :          0 :     pTmp->bVirtuell  = bVirtuell;
     148                 :            : 
     149                 :          0 :     return pTmp;
     150                 :            : }
     151                 :            : 
     152                 :            : /*--------------------------------------------------------------------
     153                 :            :     Beschreibung: Verschiedene Expandierung
     154                 :            :  --------------------------------------------------------------------*/
     155                 :            : 
     156                 :         12 : void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, sal_uInt16 nPage,
     157                 :            :                                             sal_uInt16 nNumPages, sal_Bool bVirt,
     158                 :            :                                             const sal_Int16* pNumFmt )
     159                 :            : {
     160                 :         12 :     nNum = nPage;
     161                 :         12 :     nMax = nNumPages;
     162         [ +  - ]:         12 :     if( pNumFmt )
     163                 :         12 :         nNumberingType = *pNumFmt;
     164                 :            : 
     165                 :         12 :     bVirtuell = sal_False;
     166         [ -  + ]:         12 :     if( bVirt )
     167                 :            :     {
     168                 :            :         // dann muss das Flag ueberprueft werden, denn das Layout setzt
     169                 :            :         // es NIE zurueck
     170                 :          0 :         const SfxItemPool &rPool = pDoc->GetAttrPool();
     171                 :            :         const SwFmtPageDesc *pDesc;
     172                 :          0 :         sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC );
     173         [ #  # ]:          0 :         for( sal_uInt32 n = 0; n < nMaxItems; ++n )
     174   [ #  #  #  #  :          0 :             if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem2( RES_PAGEDESC, n ) )
           #  # ][ #  # ]
     175                 :          0 :                 && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
     176                 :            :             {
     177 [ #  # ][ #  # ]:          0 :                 SwCntntNode* pNd = PTR_CAST( SwCntntNode, pDesc->GetDefinedIn() );
     178         [ #  # ]:          0 :                 if( pNd )
     179                 :            :                 {
     180         [ #  # ]:          0 :                     if ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*pNd) )
     181                 :          0 :                         bVirtuell = sal_True;
     182                 :            :                 }
     183         [ #  # ]:          0 :                 else if( pDesc->GetDefinedIn()->ISA( SwFmt ))
     184                 :            :                 {
     185 [ #  # ][ #  # ]:          0 :                     SwAutoFmtGetDocNode aGetHt( &pDoc->GetNodes() );
     186         [ #  # ]:          0 :                     bVirtuell = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
     187         [ #  # ]:          0 :                     break;
     188                 :            :                 }
     189                 :            :             }
     190                 :            :     }
     191                 :         12 : }
     192                 :            : 
     193                 :            : /*--------------------------------------------------------------------
     194                 :            :     Beschreibung: SwPageNumberField
     195                 :            :  --------------------------------------------------------------------*/
     196                 :            : 
     197                 :       7170 : SwPageNumberField::SwPageNumberField(SwPageNumberFieldType* pTyp,
     198                 :            :                                      sal_uInt16 nSub, sal_uInt32 nFmt, short nOff)
     199         [ +  - ]:       7170 :     : SwField(pTyp, nFmt), nSubType(nSub), nOffset(nOff)
     200                 :            : {
     201                 :       7170 : }
     202                 :            : 
     203                 :       1443 : String SwPageNumberField::Expand() const
     204                 :            : {
     205                 :       1443 :     String sRet;
     206                 :       1443 :     SwPageNumberFieldType* pFldType = (SwPageNumberFieldType*)GetTyp();
     207                 :            : 
     208 [ #  # ][ -  + ]:       1443 :     if( PG_NEXT == nSubType && 1 != nOffset )
     209                 :            :     {
     210 [ #  # ][ #  # ]:          0 :         if( pFldType->Expand( GetFormat(), 1, sUserStr, sRet ).Len() )
     211         [ #  # ]:          0 :             pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
     212                 :            :     }
     213 [ -  + ][ #  # ]:       1443 :     else if( PG_PREV == nSubType && -1 != nOffset )
     214                 :            :     {
     215 [ #  # ][ #  # ]:          0 :         if( pFldType->Expand( GetFormat(), -1, sUserStr, sRet ).Len() )
     216         [ #  # ]:          0 :             pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
     217                 :            :     }
     218                 :            :     else
     219         [ +  - ]:       1443 :         pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
     220                 :       1443 :     return sRet;
     221                 :            : }
     222                 :            : 
     223                 :       5739 : SwField* SwPageNumberField::Copy() const
     224                 :            : {
     225                 :            :     SwPageNumberField *pTmp =
     226         [ +  - ]:       5739 :         new SwPageNumberField((SwPageNumberFieldType*)GetTyp(), nSubType, GetFormat(), nOffset);
     227                 :       5739 :     pTmp->SetLanguage( GetLanguage() );
     228                 :       5739 :     pTmp->SetUserString( sUserStr );
     229                 :       5739 :     return pTmp;
     230                 :            : }
     231                 :            : 
     232                 :          0 : rtl::OUString SwPageNumberField::GetPar2() const
     233                 :            : {
     234                 :          0 :     return rtl::OUString::valueOf(static_cast<sal_Int32>(nOffset));
     235                 :            : }
     236                 :            : 
     237                 :          0 : void SwPageNumberField::SetPar2(const rtl::OUString& rStr)
     238                 :            : {
     239                 :          0 :     nOffset = (short)rStr.toInt32();
     240                 :          0 : }
     241                 :            : 
     242                 :          0 : sal_uInt16 SwPageNumberField::GetSubType() const
     243                 :            : {
     244                 :          0 :     return nSubType;
     245                 :            : }
     246                 :            : 
     247                 :          0 : bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     248                 :            : {
     249   [ #  #  #  #  :          0 :     switch( nWhichId )
                      # ]
     250                 :            :     {
     251                 :            :     case FIELD_PROP_FORMAT:
     252         [ #  # ]:          0 :         rAny <<= (sal_Int16)GetFormat();
     253                 :          0 :         break;
     254                 :            :     case FIELD_PROP_USHORT1:
     255                 :          0 :         rAny <<= nOffset;
     256                 :          0 :         break;
     257                 :            :     case FIELD_PROP_SUBTYPE:
     258                 :            :         {
     259                 :            :              text::PageNumberType eType;
     260                 :          0 :             eType = text::PageNumberType_CURRENT;
     261         [ #  # ]:          0 :             if(nSubType == PG_PREV)
     262                 :          0 :                 eType = text::PageNumberType_PREV;
     263         [ #  # ]:          0 :             else if(nSubType == PG_NEXT)
     264                 :          0 :                 eType = text::PageNumberType_NEXT;
     265         [ #  # ]:          0 :             rAny.setValue(&eType, ::getCppuType((const text::PageNumberType*)0));
     266                 :            :         }
     267                 :          0 :         break;
     268                 :            :     case FIELD_PROP_PAR1:
     269         [ #  # ]:          0 :         rAny <<= OUString(sUserStr);
     270                 :          0 :         break;
     271                 :            : 
     272                 :            :     default:
     273                 :            :         OSL_FAIL("illegal property");
     274                 :            :     }
     275                 :          0 :     return true;
     276                 :            : }
     277                 :            : 
     278                 :         12 : bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     279                 :            : {
     280                 :         12 :     bool bRet = true;
     281                 :         12 :     sal_Int16 nSet = 0;
     282   [ -  -  +  -  :         12 :     switch( nWhichId )
                      - ]
     283                 :            :     {
     284                 :            :     case FIELD_PROP_FORMAT:
     285                 :          0 :         rAny >>= nSet;
     286                 :            : 
     287                 :            :         // TODO: woher kommen die defines?
     288         [ #  # ]:          0 :         if(nSet <= SVX_NUM_PAGEDESC )
     289                 :          0 :             SetFormat(nSet);
     290                 :            :         else {
     291                 :            :         }
     292                 :          0 :         break;
     293                 :            :     case FIELD_PROP_USHORT1:
     294                 :          0 :         rAny >>= nSet;
     295                 :          0 :         nOffset = nSet;
     296                 :          0 :         break;
     297                 :            :     case FIELD_PROP_SUBTYPE:
     298         [ +  - ]:         12 :         switch( SWUnoHelper::GetEnumAsInt32( rAny ) )
           [ +  -  -  - ]
     299                 :            :         {
     300                 :            :             case text::PageNumberType_CURRENT:
     301                 :         12 :                 nSubType = PG_RANDOM;
     302                 :         12 :             break;
     303                 :            :             case text::PageNumberType_PREV:
     304                 :          0 :                 nSubType = PG_PREV;
     305                 :          0 :             break;
     306                 :            :             case text::PageNumberType_NEXT:
     307                 :          0 :                 nSubType = PG_NEXT;
     308                 :          0 :             break;
     309                 :            :             default:
     310                 :          0 :                 bRet = false;
     311                 :            :         }
     312                 :         12 :         break;
     313                 :            :     case FIELD_PROP_PAR1:
     314         [ #  # ]:          0 :         ::GetString( rAny, sUserStr );
     315                 :          0 :         break;
     316                 :            : 
     317                 :            :     default:
     318                 :            :         OSL_FAIL("illegal property");
     319                 :            :     }
     320                 :         12 :     return bRet;
     321                 :            : }
     322                 :            : /*--------------------------------------------------------------------
     323                 :            :     Beschreibung: SwAuthorFieldType
     324                 :            :  --------------------------------------------------------------------*/
     325                 :            : 
     326                 :       1549 : SwAuthorFieldType::SwAuthorFieldType()
     327                 :       1549 :     : SwFieldType( RES_AUTHORFLD )
     328                 :            : {
     329                 :       1549 : }
     330                 :            : 
     331                 :        268 : String SwAuthorFieldType::Expand(sal_uLong nFmt) const
     332                 :            : {
     333                 :        268 :     String sRet;
     334 [ +  - ][ +  - ]:        268 :     SvtUserOptions&  rOpt = SW_MOD()->GetUserOptions();
     335         [ -  + ]:        268 :     if((nFmt & 0xff) == AF_NAME)
     336 [ #  # ][ #  # ]:          0 :         sRet = rOpt.GetFullName();
     337                 :            :     else
     338 [ +  - ][ +  - ]:        268 :         sRet = rOpt.GetID();
     339                 :        268 :     return sRet;
     340                 :            : }
     341                 :            : 
     342                 :          0 : SwFieldType* SwAuthorFieldType::Copy() const
     343                 :            : {
     344         [ #  # ]:          0 :     return new SwAuthorFieldType;
     345                 :            : }
     346                 :            : 
     347                 :            : /*--------------------------------------------------------------------
     348                 :            :     Beschreibung: SwAuthorField
     349                 :            :  --------------------------------------------------------------------*/
     350                 :            : 
     351                 :        268 : SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFmt)
     352         [ +  - ]:        268 :     : SwField(pTyp, nFmt)
     353                 :            : {
     354 [ +  - ][ +  - ]:        268 :     aContent = ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
                 [ +  - ]
     355                 :        268 : }
     356                 :            : 
     357                 :        116 : String SwAuthorField::Expand() const
     358                 :            : {
     359         [ -  + ]:        116 :     if (!IsFixed())
     360                 :            :         ((SwAuthorField*)this)->aContent =
     361         [ #  # ]:          0 :                     ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
     362                 :            : 
     363                 :        116 :     return aContent;
     364                 :            : }
     365                 :            : 
     366                 :        230 : SwField* SwAuthorField::Copy() const
     367                 :            : {
     368                 :        230 :     SwAuthorField *pTmp = new SwAuthorField( (SwAuthorFieldType*)GetTyp(),
     369         [ +  - ]:        230 :                                                 GetFormat());
     370                 :        230 :     pTmp->SetExpansion(aContent);
     371                 :        230 :     return pTmp;
     372                 :            : }
     373                 :            : 
     374                 :         80 : bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     375                 :            : {
     376                 :            :     bool bVal;
     377   [ -  +  +  - ]:         80 :     switch( nWhichId )
     378                 :            :     {
     379                 :            :     case FIELD_PROP_BOOL1:
     380                 :          0 :         bVal = (GetFormat() & 0xff) == AF_NAME;
     381         [ #  # ]:          0 :         rAny.setValue(&bVal, ::getBooleanCppuType());
     382                 :          0 :         break;
     383                 :            : 
     384                 :            :     case FIELD_PROP_BOOL2:
     385         [ +  - ]:         40 :         bVal = IsFixed();
     386         [ +  - ]:         40 :         rAny.setValue(&bVal, ::getBooleanCppuType());
     387                 :         40 :         break;
     388                 :            : 
     389                 :            :     case FIELD_PROP_PAR1:
     390 [ +  - ][ +  - ]:         40 :         rAny <<= rtl::OUString(GetContent());
     391                 :         40 :         break;
     392                 :            : 
     393                 :            :     default:
     394                 :            :         OSL_FAIL("illegal property");
     395                 :            :     }
     396                 :         80 :     return true;
     397                 :            : }
     398                 :            : 
     399                 :          0 : bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     400                 :            : {
     401   [ #  #  #  # ]:          0 :     switch( nWhichId )
     402                 :            :     {
     403                 :            :     case FIELD_PROP_BOOL1:
     404                 :          0 :         SetFormat( *(sal_Bool*)rAny.getValue() ? AF_NAME : AF_SHORTCUT );
     405                 :          0 :         break;
     406                 :            : 
     407                 :            :     case FIELD_PROP_BOOL2:
     408         [ #  # ]:          0 :         if( *(sal_Bool*)rAny.getValue() )
     409                 :          0 :             SetFormat( GetFormat() | AF_FIXED);
     410                 :            :         else
     411                 :          0 :             SetFormat( GetFormat() & ~AF_FIXED);
     412                 :          0 :         break;
     413                 :            : 
     414                 :            :     case FIELD_PROP_PAR1:
     415                 :          0 :         ::GetString( rAny, aContent );
     416                 :          0 :         break;
     417                 :            : 
     418                 :            :     default:
     419                 :            :         OSL_FAIL("illegal property");
     420                 :            :     }
     421                 :          0 :     return true;
     422                 :            : }
     423                 :            : 
     424                 :            : /*--------------------------------------------------------------------
     425                 :            :     Beschreibung: SwFileNameFieldType
     426                 :            :  --------------------------------------------------------------------*/
     427                 :            : 
     428                 :       1552 : SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument)
     429                 :       1552 :     : SwFieldType( RES_FILENAMEFLD )
     430                 :            : {
     431                 :       1552 :     pDoc = pDocument;
     432                 :       1552 : }
     433                 :            : 
     434                 :         12 : String SwFileNameFieldType::Expand(sal_uLong nFmt) const
     435                 :            : {
     436                 :         12 :     String aRet;
     437                 :         12 :     const SwDocShell* pDShell = pDoc->GetDocShell();
     438 [ +  - ][ +  - ]:         12 :     if( pDShell && pDShell->HasName() )
                 [ +  - ]
     439                 :            :     {
     440         [ +  - ]:         12 :         const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
     441   [ +  +  +  + ]:         12 :         switch( nFmt & ~FF_FIXED )
     442                 :            :         {
     443                 :            :             case FF_PATH:
     444                 :            :                 {
     445         [ +  - ]:          3 :                     if( INET_PROT_FILE == rURLObj.GetProtocol() )
     446                 :            :                     {
     447         [ +  - ]:          3 :                         INetURLObject aTemp(rURLObj);
     448         [ +  - ]:          3 :                         aTemp.removeSegment();
     449                 :            :                         // last slash should belong to the pathname
     450 [ +  - ][ +  - ]:          3 :                         aRet = aTemp.PathToFileName();
                 [ +  - ]
     451                 :            :                     }
     452                 :            :                     else
     453                 :            :                     {
     454                 :            :                         aRet = URIHelper::removePassword(
     455                 :            :                                     rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
     456 [ #  # ][ #  # ]:          0 :                                     INetURLObject::WAS_ENCODED, URL_DECODE );
                 [ #  # ]
     457                 :            :                         aRet.Erase( aRet.Search( String(rURLObj.GetLastName(
     458 [ #  # ][ #  # ]:          0 :                                                     URL_DECODE )) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     459                 :            :                     }
     460                 :            :                 }
     461                 :          3 :                 break;
     462                 :            : 
     463                 :            :             case FF_NAME:
     464 [ +  - ][ +  - ]:          3 :                 aRet = rURLObj.GetLastName( INetURLObject::DECODE_WITH_CHARSET );
     465                 :          3 :                 break;
     466                 :            : 
     467                 :            :             case FF_NAME_NOEXT:
     468 [ +  - ][ +  - ]:          3 :                 aRet = rURLObj.GetBase();
     469                 :          3 :                 break;
     470                 :            : 
     471                 :            :             default:
     472         [ +  - ]:          3 :                 if( INET_PROT_FILE == rURLObj.GetProtocol() )
     473 [ +  - ][ +  - ]:          3 :                     aRet = rURLObj.GetFull();
     474                 :            :                 else
     475                 :            :                     aRet = URIHelper::removePassword(
     476                 :            :                                     rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
     477 [ #  # ][ #  # ]:         12 :                                     INetURLObject::WAS_ENCODED, URL_DECODE );
                 [ #  # ]
     478                 :            :         }
     479                 :            :     }
     480                 :         12 :     return aRet;
     481                 :            : }
     482                 :            : 
     483                 :          0 : SwFieldType* SwFileNameFieldType::Copy() const
     484                 :            : {
     485         [ #  # ]:          0 :     SwFieldType *pTmp = new SwFileNameFieldType(pDoc);
     486                 :          0 :     return pTmp;
     487                 :            : }
     488                 :            : /*--------------------------------------------------------------------
     489                 :            :     Beschreibung: SwFileNameField
     490                 :            :  --------------------------------------------------------------------*/
     491                 :            : 
     492                 :          0 : SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFmt)
     493         [ #  # ]:          0 :     : SwField(pTyp, nFmt)
     494                 :            : {
     495 [ #  # ][ #  # ]:          0 :     aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
                 [ #  # ]
     496                 :          0 : }
     497                 :            : 
     498                 :          0 : String SwFileNameField::Expand() const
     499                 :            : {
     500         [ #  # ]:          0 :     if (!IsFixed())
     501         [ #  # ]:          0 :         ((SwFileNameField*)this)->aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
     502                 :            : 
     503                 :          0 :     return aContent;
     504                 :            : }
     505                 :            : 
     506                 :          0 : SwField* SwFileNameField::Copy() const
     507                 :            : {
     508                 :            :     SwFileNameField *pTmp =
     509         [ #  # ]:          0 :         new SwFileNameField((SwFileNameFieldType*)GetTyp(), GetFormat());
     510                 :          0 :     pTmp->SetExpansion(aContent);
     511                 :            : 
     512                 :          0 :     return pTmp;
     513                 :            : }
     514                 :            : 
     515                 :          0 : bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     516                 :            : {
     517   [ #  #  #  # ]:          0 :     switch( nWhichId )
     518                 :            :     {
     519                 :            :     case FIELD_PROP_FORMAT:
     520                 :            :         {
     521                 :            :             sal_Int16 nRet;
     522   [ #  #  #  # ]:          0 :             switch( GetFormat() &(~FF_FIXED) )
     523                 :            :             {
     524                 :            :                 case FF_PATH:
     525                 :          0 :                     nRet = text::FilenameDisplayFormat::PATH;
     526                 :          0 :                 break;
     527                 :            :                 case FF_NAME_NOEXT:
     528                 :          0 :                     nRet = text::FilenameDisplayFormat::NAME;
     529                 :          0 :                 break;
     530                 :            :                 case FF_NAME:
     531                 :          0 :                     nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
     532                 :          0 :                 break;
     533                 :          0 :                 default:    nRet = text::FilenameDisplayFormat::FULL;
     534                 :            :             }
     535         [ #  # ]:          0 :             rAny <<= nRet;
     536                 :            :         }
     537                 :          0 :         break;
     538                 :            : 
     539                 :            :     case FIELD_PROP_BOOL2:
     540                 :            :         {
     541         [ #  # ]:          0 :             sal_Bool bVal = IsFixed();
     542         [ #  # ]:          0 :             rAny.setValue(&bVal, ::getBooleanCppuType());
     543                 :            :         }
     544                 :          0 :         break;
     545                 :            : 
     546                 :            :     case FIELD_PROP_PAR3:
     547         [ #  # ]:          0 :         rAny <<= OUString(GetContent());
     548                 :          0 :         break;
     549                 :            :     default:
     550                 :            :         OSL_FAIL("illegal property");
     551                 :            :     }
     552                 :          0 :     return true;
     553                 :            : }
     554                 :            : 
     555                 :          0 : bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     556                 :            : {
     557   [ #  #  #  # ]:          0 :     switch( nWhichId )
     558                 :            :     {
     559                 :            :     case FIELD_PROP_FORMAT:
     560                 :            :         {
     561                 :            :             //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
     562                 :            :             //              called with a int32 value! But normally we need
     563                 :            :             //              here only a int16
     564                 :          0 :             sal_Int32 nType = 0;
     565                 :          0 :             rAny >>= nType;
     566         [ #  # ]:          0 :             sal_Bool bFixed = IsFixed();
     567   [ #  #  #  # ]:          0 :             switch( nType )
     568                 :            :             {
     569                 :            :                 case text::FilenameDisplayFormat::PATH:
     570                 :          0 :                     nType = FF_PATH;
     571                 :          0 :                 break;
     572                 :            :                 case text::FilenameDisplayFormat::NAME:
     573                 :          0 :                     nType = FF_NAME_NOEXT;
     574                 :          0 :                 break;
     575                 :            :                 case text::FilenameDisplayFormat::NAME_AND_EXT:
     576                 :          0 :                     nType = FF_NAME;
     577                 :          0 :                 break;
     578                 :          0 :                 default:    nType = FF_PATHNAME;
     579                 :            :             }
     580         [ #  # ]:          0 :             if(bFixed)
     581                 :          0 :                 nType |= FF_FIXED;
     582                 :          0 :             SetFormat(nType);
     583                 :            :         }
     584                 :          0 :         break;
     585                 :            : 
     586                 :            :     case FIELD_PROP_BOOL2:
     587         [ #  # ]:          0 :         if( *(sal_Bool*)rAny.getValue() )
     588                 :          0 :             SetFormat( GetFormat() | FF_FIXED);
     589                 :            :         else
     590                 :          0 :             SetFormat( GetFormat() & ~FF_FIXED);
     591                 :          0 :         break;
     592                 :            : 
     593                 :            :     case FIELD_PROP_PAR3:
     594                 :          0 :         ::GetString( rAny, aContent );
     595                 :          0 :         break;
     596                 :            : 
     597                 :            :     default:
     598                 :            :         OSL_FAIL("illegal property");
     599                 :            :     }
     600                 :          0 :     return true;
     601                 :            : }
     602                 :            : /*--------------------------------------------------------------------
     603                 :            :     Beschreibung: SwTemplNameFieldType
     604                 :            :  --------------------------------------------------------------------*/
     605                 :            : 
     606                 :       3098 : SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument)
     607                 :       3098 :     : SwFieldType( RES_TEMPLNAMEFLD )
     608                 :            : {
     609                 :       3098 :     pDoc = pDocument;
     610                 :       3098 : }
     611                 :            : 
     612                 :          0 : String SwTemplNameFieldType::Expand(sal_uLong nFmt) const
     613                 :            : {
     614                 :            :     OSL_ENSURE( nFmt < FF_END, "Expand: kein guelt. Fmt!" );
     615                 :            : 
     616                 :          0 :     String aRet;
     617                 :          0 :     SwDocShell *pDocShell(pDoc->GetDocShell());
     618                 :            :     OSL_ENSURE(pDocShell, "no SwDocShell");
     619         [ #  # ]:          0 :     if (pDocShell) {
     620                 :            :         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
     621 [ #  # ][ #  # ]:          0 :             pDocShell->GetModel(), uno::UNO_QUERY_THROW);
     622                 :            :         uno::Reference<document::XDocumentProperties> xDocProps(
     623 [ #  # ][ #  # ]:          0 :             xDPS->getDocumentProperties());
     624                 :            :         OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
     625                 :            : 
     626         [ #  # ]:          0 :         if( FF_UI_NAME == nFmt )
     627 [ #  # ][ #  # ]:          0 :             aRet = xDocProps->getTemplateName();
                 [ #  # ]
     628 [ #  # ][ #  # ]:          0 :         else if( !xDocProps->getTemplateURL().isEmpty() )
                 [ #  # ]
     629                 :            :         {
     630         [ #  # ]:          0 :             if( FF_UI_RANGE == nFmt )
     631                 :            :             {
     632                 :            :                 // fuers besorgen vom RegionNamen !!
     633         [ #  # ]:          0 :                 SfxDocumentTemplates aFac;
     634         [ #  # ]:          0 :                 aFac.Construct();
     635         [ #  # ]:          0 :                 String sTmp;
     636 [ #  # ][ #  # ]:          0 :                 aFac.GetLogicNames( xDocProps->getTemplateURL(), aRet, sTmp );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     637                 :            :             }
     638                 :            :             else
     639                 :            :             {
     640 [ #  # ][ #  # ]:          0 :                 INetURLObject aPathName( xDocProps->getTemplateURL() );
                 [ #  # ]
     641         [ #  # ]:          0 :                 if( FF_NAME == nFmt )
     642 [ #  # ][ #  # ]:          0 :                     aRet = aPathName.GetName(URL_DECODE);
     643         [ #  # ]:          0 :                 else if( FF_NAME_NOEXT == nFmt )
     644 [ #  # ][ #  # ]:          0 :                     aRet = aPathName.GetBase();
     645                 :            :                 else
     646                 :            :                 {
     647         [ #  # ]:          0 :                     if( FF_PATH == nFmt )
     648                 :            :                     {
     649         [ #  # ]:          0 :                         aPathName.removeSegment();
     650 [ #  # ][ #  # ]:          0 :                         aRet = aPathName.GetFull();
     651                 :            :                     }
     652                 :            :                     else
     653 [ #  # ][ #  # ]:          0 :                         aRet = aPathName.GetFull();
     654         [ #  # ]:          0 :                 }
     655                 :            :             }
     656                 :          0 :         }
     657                 :            :     }
     658                 :          0 :     return aRet;
     659                 :            : }
     660                 :            : 
     661                 :          0 : SwFieldType* SwTemplNameFieldType::Copy() const
     662                 :            : {
     663         [ #  # ]:          0 :     SwFieldType *pTmp = new SwTemplNameFieldType(pDoc);
     664                 :          0 :     return pTmp;
     665                 :            : }
     666                 :            : /*--------------------------------------------------------------------
     667                 :            :     Beschreibung: SwTemplNameField
     668                 :            :  --------------------------------------------------------------------*/
     669                 :            : 
     670                 :          0 : SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nFmt)
     671                 :          0 :     : SwField(pTyp, nFmt)
     672                 :          0 : {}
     673                 :            : 
     674                 :          0 : String SwTemplNameField::Expand() const
     675                 :            : {
     676                 :          0 :     return((SwTemplNameFieldType*)GetTyp())->Expand(GetFormat());
     677                 :            : }
     678                 :            : 
     679                 :          0 : SwField* SwTemplNameField::Copy() const
     680                 :            : {
     681                 :            :     SwTemplNameField *pTmp =
     682         [ #  # ]:          0 :         new SwTemplNameField((SwTemplNameFieldType*)GetTyp(), GetFormat());
     683                 :          0 :     return pTmp;
     684                 :            : }
     685                 :            : 
     686                 :          0 : bool SwTemplNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     687                 :            : {
     688         [ #  # ]:          0 :     switch ( nWhichId )
     689                 :            :     {
     690                 :            :     case FIELD_PROP_FORMAT:
     691                 :            :         {
     692                 :            :             sal_Int16 nRet;
     693   [ #  #  #  #  :          0 :             switch( GetFormat() )
                   #  # ]
     694                 :            :             {
     695                 :          0 :                 case FF_PATH:       nRet = text::FilenameDisplayFormat::PATH; break;
     696                 :          0 :                 case FF_NAME_NOEXT: nRet = text::FilenameDisplayFormat::NAME; break;
     697                 :          0 :                 case FF_NAME:       nRet = text::FilenameDisplayFormat::NAME_AND_EXT; break;
     698                 :          0 :                 case FF_UI_RANGE:   nRet = text::TemplateDisplayFormat::AREA; break;
     699                 :          0 :                 case FF_UI_NAME:    nRet = text::TemplateDisplayFormat::TITLE;  break;
     700                 :          0 :                 default:    nRet = text::FilenameDisplayFormat::FULL;
     701                 :            : 
     702                 :            :             }
     703         [ #  # ]:          0 :             rAny <<= nRet;
     704                 :            :         }
     705                 :          0 :         break;
     706                 :            :     default:
     707                 :            :         OSL_FAIL("illegal property");
     708                 :            :     }
     709                 :          0 :     return true;
     710                 :            : }
     711                 :            : 
     712                 :          0 : bool SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     713                 :            : {
     714         [ #  # ]:          0 :     switch ( nWhichId )
     715                 :            :     {
     716                 :            :     case FIELD_PROP_FORMAT:
     717                 :            :         {
     718                 :            :             //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
     719                 :            :             //              called with a int32 value! But normally we need
     720                 :            :             //              here only a int16
     721                 :          0 :             sal_Int32 nType = 0;
     722                 :          0 :             rAny >>= nType;
     723   [ #  #  #  #  :          0 :             switch( nType )
                   #  # ]
     724                 :            :             {
     725                 :            :             case text::FilenameDisplayFormat::PATH:
     726                 :          0 :                 SetFormat(FF_PATH);
     727                 :          0 :             break;
     728                 :            :             case text::FilenameDisplayFormat::NAME:
     729                 :          0 :                 SetFormat(FF_NAME_NOEXT);
     730                 :          0 :             break;
     731                 :            :             case text::FilenameDisplayFormat::NAME_AND_EXT:
     732                 :          0 :                 SetFormat(FF_NAME);
     733                 :          0 :             break;
     734                 :            :             case text::TemplateDisplayFormat::AREA  :
     735                 :          0 :                 SetFormat(FF_UI_RANGE);
     736                 :          0 :             break;
     737                 :            :             case text::TemplateDisplayFormat::TITLE  :
     738                 :          0 :                 SetFormat(FF_UI_NAME);
     739                 :          0 :             break;
     740                 :          0 :             default:    SetFormat(FF_PATHNAME);
     741                 :            :             }
     742                 :            :         }
     743                 :          0 :         break;
     744                 :            :     default:
     745                 :            :         OSL_FAIL("illegal property");
     746                 :            :     }
     747                 :          0 :     return true;
     748                 :            : }
     749                 :            : /*--------------------------------------------------------------------
     750                 :            :     Beschreibung: SwDocStatFieldType
     751                 :            :  --------------------------------------------------------------------*/
     752                 :            : 
     753                 :       1549 : SwDocStatFieldType::SwDocStatFieldType(SwDoc* pDocument)
     754                 :       1549 :     : SwFieldType( RES_DOCSTATFLD ), nNumberingType( SVX_NUM_ARABIC )
     755                 :            : {
     756                 :       1549 :     pDoc = pDocument;
     757                 :       1549 : }
     758                 :            : 
     759                 :          0 : String SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const
     760                 :            : {
     761                 :          0 :     sal_uInt32 nVal = 0;
     762                 :          0 :     const SwDocStat& rDStat = pDoc->GetDocStat();
     763   [ #  #  #  #  :          0 :     switch( nSubType )
             #  #  #  # ]
     764                 :            :     {
     765                 :          0 :         case DS_TBL:  nVal = rDStat.nTbl;   break;
     766                 :          0 :         case DS_GRF:  nVal = rDStat.nGrf;   break;
     767                 :          0 :         case DS_OLE:  nVal = rDStat.nOLE;   break;
     768                 :          0 :         case DS_PARA: nVal = rDStat.nPara;  break;
     769                 :          0 :         case DS_WORD: nVal = rDStat.nWord;  break;
     770                 :          0 :         case DS_CHAR: nVal = rDStat.nChar;  break;
     771                 :            :         case DS_PAGE:
     772         [ #  # ]:          0 :             if( pDoc->GetCurrentLayout() )//swmod 080218
     773                 :          0 :                 ((SwDocStat &)rDStat).nPage = pDoc->GetCurrentLayout()->GetPageNum();   //swmod 080218
     774                 :          0 :             nVal = rDStat.nPage;
     775         [ #  # ]:          0 :             if( SVX_NUM_PAGEDESC == nFmt )
     776                 :          0 :                 nFmt = (sal_uInt32)nNumberingType;
     777                 :          0 :             break;
     778                 :            :         default:
     779                 :            :             OSL_FAIL( "SwDocStatFieldType::Expand: unbekannter SubType" );
     780                 :            :     }
     781                 :            : 
     782                 :          0 :     String sRet;
     783         [ #  # ]:          0 :     if( nVal <= SHRT_MAX )
     784 [ #  # ][ #  # ]:          0 :         sRet = FormatNumber( (sal_uInt16)nVal, nFmt );
                 [ #  # ]
     785                 :            :     else
     786 [ #  # ][ #  # ]:          0 :         sRet = String::CreateFromInt32( nVal );
                 [ #  # ]
     787                 :          0 :     return sRet;
     788                 :            : }
     789                 :            : 
     790                 :          0 : SwFieldType* SwDocStatFieldType::Copy() const
     791                 :            : {
     792         [ #  # ]:          0 :     SwDocStatFieldType *pTmp = new SwDocStatFieldType(pDoc);
     793                 :          0 :     return pTmp;
     794                 :            : }
     795                 :            : 
     796                 :            : /*--------------------------------------------------------------------
     797                 :            :     Beschreibung: SwDocStatFieldType
     798                 :            :                   Aus historischen Gruenden steht in nFormat der
     799                 :            :                   SubType
     800                 :            :  --------------------------------------------------------------------*/
     801                 :            : 
     802                 :          0 : SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFmt)
     803                 :            :     : SwField(pTyp, nFmt),
     804                 :          0 :     nSubType(nSub)
     805                 :          0 : {}
     806                 :            : 
     807                 :          0 : String SwDocStatField::Expand() const
     808                 :            : {
     809                 :          0 :     return((SwDocStatFieldType*)GetTyp())->Expand(nSubType, GetFormat());
     810                 :            : }
     811                 :            : 
     812                 :          0 : SwField* SwDocStatField::Copy() const
     813                 :            : {
     814                 :            :     SwDocStatField *pTmp = new SwDocStatField(
     815         [ #  # ]:          0 :                     (SwDocStatFieldType*)GetTyp(), nSubType, GetFormat() );
     816                 :          0 :     return pTmp;
     817                 :            : }
     818                 :            : 
     819                 :          0 : sal_uInt16 SwDocStatField::GetSubType() const
     820                 :            : {
     821                 :          0 :     return nSubType;
     822                 :            : }
     823                 :            : 
     824                 :          0 : void SwDocStatField::SetSubType(sal_uInt16 nSub)
     825                 :            : {
     826                 :          0 :     nSubType = nSub;
     827                 :          0 : }
     828                 :            : 
     829                 :          0 : void SwDocStatField::ChangeExpansion( const SwFrm* pFrm )
     830                 :            : {
     831 [ #  # ][ #  # ]:          0 :     if( DS_PAGE == nSubType && SVX_NUM_PAGEDESC == GetFormat() )
                 [ #  # ]
     832                 :          0 :         ((SwDocStatFieldType*)GetTyp())->SetNumFormat(
     833                 :          0 :                 pFrm->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType() );
     834                 :          0 : }
     835                 :            : 
     836                 :          0 : bool SwDocStatField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
     837                 :            : {
     838         [ #  # ]:          0 :     switch ( nWhichId )
     839                 :            :     {
     840                 :            :     case FIELD_PROP_USHORT2:
     841         [ #  # ]:          0 :         rAny <<= (sal_Int16)GetFormat();
     842                 :          0 :         break;
     843                 :            :     default:
     844                 :            :         OSL_FAIL("illegal property");
     845                 :            :     }
     846                 :          0 :     return true;
     847                 :            : }
     848                 :            : 
     849                 :          0 : bool SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     850                 :            : {
     851                 :          0 :     bool bRet = false;
     852         [ #  # ]:          0 :     switch ( nWhichId )
     853                 :            :     {
     854                 :            :     case FIELD_PROP_USHORT2:
     855                 :            :         {
     856                 :          0 :             sal_Int16 nSet = 0;
     857                 :          0 :             rAny >>= nSet;
     858 [ #  # ][ #  # ]:          0 :             if(nSet <= SVX_NUM_CHARS_LOWER_LETTER_N &&
                 [ #  # ]
     859                 :            :                 nSet != SVX_NUM_CHAR_SPECIAL &&
     860                 :            :                     nSet != SVX_NUM_BITMAP)
     861                 :            :             {
     862                 :          0 :                 SetFormat(nSet);
     863                 :          0 :                 bRet = true;
     864                 :            :             }
     865                 :            :         }
     866                 :          0 :         break;
     867                 :            : 
     868                 :            :     default:
     869                 :            :         OSL_FAIL("illegal property");
     870                 :            :     }
     871                 :          0 :     return bRet;
     872                 :            : }
     873                 :            : 
     874                 :            : /*--------------------------------------------------------------------
     875                 :            :     Beschreibung: DokumentinfoFields
     876                 :            :  --------------------------------------------------------------------*/
     877                 :            : 
     878                 :       1549 : SwDocInfoFieldType::SwDocInfoFieldType(SwDoc* pDc)
     879                 :       1549 :     : SwValueFieldType( pDc, RES_DOCINFOFLD )
     880                 :            : {
     881                 :       1549 : }
     882                 :            : 
     883                 :          0 : SwFieldType* SwDocInfoFieldType::Copy() const
     884                 :            : {
     885         [ #  # ]:          0 :     SwDocInfoFieldType* pTyp = new SwDocInfoFieldType(GetDoc());
     886                 :          0 :     return pTyp;
     887                 :            : }
     888                 :            : 
     889                 :          0 : void lcl_GetLocalDataWrapper( sal_uLong nLang,
     890                 :            :                               const LocaleDataWrapper **ppAppLocalData,
     891                 :            :                               const LocaleDataWrapper **ppLocalData )
     892                 :            : {
     893         [ #  # ]:          0 :     SvtSysLocale aLocale;
     894         [ #  # ]:          0 :     *ppAppLocalData = &aLocale.GetLocaleData();
     895                 :          0 :     *ppLocalData = *ppAppLocalData;
     896 [ #  # ][ #  # ]:          0 :     if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLocale() ) )
                 [ #  # ]
     897                 :            :         *ppLocalData = new LocaleDataWrapper(
     898                 :            :                         ::comphelper::getProcessServiceFactory(),
     899 [ #  # ][ #  # ]:          0 :                         SvxCreateLocale( static_cast<LanguageType>(nLang) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     900                 :          0 : }
     901                 :            : 
     902                 :          0 : String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
     903                 :            :                                     sal_uInt16 nLang, const String& rName ) const
     904                 :            : {
     905         [ #  # ]:          0 :     String aStr;
     906                 :          0 :     const LocaleDataWrapper *pAppLocalData = 0, *pLocalData = 0;
     907                 :          0 :     SwDocShell *pDocShell(GetDoc()->GetDocShell());
     908                 :            :     OSL_ENSURE(pDocShell, "no SwDocShell");
     909 [ #  # ][ #  # ]:          0 :     if (!pDocShell) { return aStr; }
     910                 :            : 
     911                 :            :     uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
     912 [ #  # ][ #  # ]:          0 :         pDocShell->GetModel(), uno::UNO_QUERY_THROW);
     913                 :            :     uno::Reference<document::XDocumentProperties> xDocProps(
     914 [ #  # ][ #  # ]:          0 :         xDPS->getDocumentProperties());
     915                 :            :     OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
     916                 :            : 
     917                 :          0 :     sal_uInt16 nExtSub = nSub & 0xff00;
     918                 :          0 :     nSub &= 0xff;   // ExtendedSubTypes nicht beachten
     919                 :            : 
     920   [ #  #  #  #  :          0 :     switch(nSub)
             #  #  #  # ]
     921                 :            :     {
     922 [ #  # ][ #  # ]:          0 :     case DI_TITEL:  aStr = xDocProps->getTitle();       break;
                 [ #  # ]
     923 [ #  # ][ #  # ]:          0 :     case DI_THEMA:  aStr = xDocProps->getSubject();     break;
                 [ #  # ]
     924                 :            :     case DI_KEYS:   aStr = ::comphelper::string::convertCommaSeparated(
     925 [ #  # ][ #  # ]:          0 :                                 xDocProps->getKeywords());
         [ #  # ][ #  # ]
                 [ #  # ]
     926                 :          0 :                     break;
     927 [ #  # ][ #  # ]:          0 :     case DI_COMMENT:aStr = xDocProps->getDescription(); break;
                 [ #  # ]
     928                 :            :     case DI_DOCNO:  aStr = String::CreateFromInt32(
     929 [ #  # ][ #  # ]:          0 :                                         xDocProps->getEditingCycles() );
         [ #  # ][ #  # ]
                 [ #  # ]
     930                 :          0 :                     break;
     931                 :            :     case DI_EDIT:
     932         [ #  # ]:          0 :         if ( !nFormat )
     933                 :            :         {
     934         [ #  # ]:          0 :             lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
     935 [ #  # ][ #  # ]:          0 :             sal_Int32 dur = xDocProps->getEditingDuration();
     936                 :            :             aStr = pLocalData->getTime( Time(dur/3600, (dur%3600)/60, dur%60),
     937 [ #  # ][ #  # ]:          0 :                                         sal_False, sal_False);
                 [ #  # ]
     938                 :            :         }
     939                 :            :         else
     940                 :            :         {
     941 [ #  # ][ #  # ]:          0 :             sal_Int32 dur = xDocProps->getEditingDuration();
     942 [ #  # ][ #  # ]:          0 :             double fVal = Time(dur/3600, (dur%3600)/60, dur%60).GetTimeInDays();
     943 [ #  # ][ #  # ]:          0 :             aStr = ExpandValue(fVal, nFormat, nLang);
                 [ #  # ]
     944                 :            :         }
     945                 :          0 :         break;
     946                 :            :     case DI_CUSTOM:
     947                 :            :         {
     948                 :          0 :             ::rtl::OUString sVal;
     949                 :            :             try
     950                 :            :             {
     951                 :          0 :                 uno::Any aAny;
     952                 :            :                 uno::Reference < beans::XPropertySet > xSet(
     953         [ #  # ]:          0 :                     xDocProps->getUserDefinedProperties(),
     954 [ #  # ][ #  # ]:          0 :                     uno::UNO_QUERY_THROW);
     955 [ #  # ][ #  # ]:          0 :                 aAny = xSet->getPropertyValue( rName );
                 [ #  # ]
     956                 :            : 
     957                 :            :                 uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
     958 [ #  # ][ #  # ]:          0 :                     ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
     959                 :          0 :                 uno::Any aNew;
     960 [ #  # ][ #  # ]:          0 :                     aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
     961         [ #  # ]:          0 :                 aNew >>= sVal;
     962                 :            :             }
     963         [ #  # ]:          0 :             catch (uno::Exception&) {}
     964         [ #  # ]:          0 :             return sVal;
     965                 :            :         }
     966                 :            : 
     967                 :            :     default:
     968                 :            :         {
     969 [ #  # ][ #  # ]:          0 :             String aName( xDocProps->getAuthor() );
                 [ #  # ]
     970 [ #  # ][ #  # ]:          0 :             util::DateTime uDT( xDocProps->getCreationDate() );
     971                 :          0 :             Date aD(uDT.Day, uDT.Month, uDT.Year);
     972         [ #  # ]:          0 :             Time aT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
     973         [ #  # ]:          0 :             DateTime aDate(aD,aT);
     974         [ #  # ]:          0 :             if( nSub == DI_CREATE )
     975                 :            :                 ;       // das wars schon!!
     976         [ #  # ]:          0 :             else if( nSub == DI_CHANGE )
     977                 :            :             {
     978 [ #  # ][ #  # ]:          0 :                 aName = xDocProps->getModifiedBy();
                 [ #  # ]
     979 [ #  # ][ #  # ]:          0 :                 uDT = xDocProps->getModificationDate();
     980                 :          0 :                 Date bD(uDT.Day, uDT.Month, uDT.Year);
     981         [ #  # ]:          0 :                 Time bT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
     982         [ #  # ]:          0 :                 DateTime bDate(bD,bT);
     983         [ #  # ]:          0 :                 aDate = bDate;
     984                 :            :             }
     985         [ #  # ]:          0 :             else if( nSub == DI_PRINT )
     986                 :            :             {
     987 [ #  # ][ #  # ]:          0 :                 aName = xDocProps->getPrintedBy();
                 [ #  # ]
     988 [ #  # ][ #  # ]:          0 :                 uDT = xDocProps->getPrintDate();
     989                 :          0 :                 Date bD(uDT.Day, uDT.Month, uDT.Year);
     990         [ #  # ]:          0 :                 Time bT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds);
     991         [ #  # ]:          0 :                 DateTime bDate(bD,bT);
     992         [ #  # ]:          0 :                 aDate = bDate;
     993                 :            :             }
     994                 :            :             else
     995                 :            :                 break;
     996                 :            : 
     997 [ #  # ][ #  # ]:          0 :             if (aDate.IsValidAndGregorian())
     998                 :            :             {
     999   [ #  #  #  # ]:          0 :                 switch (nExtSub & ~DI_SUB_FIXED)
    1000                 :            :                 {
    1001                 :            :                 case DI_SUB_AUTHOR:
    1002         [ #  # ]:          0 :                     aStr = aName;
    1003                 :          0 :                     break;
    1004                 :            : 
    1005                 :            :                 case DI_SUB_TIME:
    1006         [ #  # ]:          0 :                     if (!nFormat)
    1007                 :            :                     {
    1008                 :            :                         lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
    1009         [ #  # ]:          0 :                                                         &pLocalData );
    1010                 :            :                         aStr = pLocalData->getTime( aDate,
    1011 [ #  # ][ #  # ]:          0 :                                                     sal_False, sal_False);
    1012                 :            :                     }
    1013                 :            :                     else
    1014                 :            :                     {
    1015                 :            :                         // Numberformatter anwerfen!
    1016                 :            :                         double fVal = SwDateTimeField::GetDateTime( GetDoc(),
    1017         [ #  # ]:          0 :                                                     aDate);
    1018 [ #  # ][ #  # ]:          0 :                         aStr = ExpandValue(fVal, nFormat, nLang);
                 [ #  # ]
    1019                 :            :                     }
    1020                 :          0 :                     break;
    1021                 :            : 
    1022                 :            :                 case DI_SUB_DATE:
    1023         [ #  # ]:          0 :                     if (!nFormat)
    1024                 :            :                     {
    1025                 :            :                         lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
    1026         [ #  # ]:          0 :                                                  &pLocalData );
    1027 [ #  # ][ #  # ]:          0 :                         aStr = pLocalData->getDate( aDate );
    1028                 :            :                     }
    1029                 :            :                     else
    1030                 :            :                     {
    1031                 :            :                         // Numberformatter anwerfen!
    1032                 :            :                         double fVal = SwDateTimeField::GetDateTime( GetDoc(),
    1033         [ #  # ]:          0 :                                                     aDate);
    1034 [ #  # ][ #  # ]:          0 :                         aStr = ExpandValue(fVal, nFormat, nLang);
                 [ #  # ]
    1035                 :            :                     }
    1036                 :          0 :                     break;
    1037                 :            :                 }
    1038 [ #  # ][ #  # ]:          0 :             }
    1039                 :            :         }
    1040                 :          0 :         break;
    1041                 :            :     }
    1042                 :            : 
    1043         [ #  # ]:          0 :     if( pAppLocalData != pLocalData )
    1044 [ #  # ][ #  # ]:          0 :         delete pLocalData;
    1045                 :            : 
    1046 [ #  # ][ #  # ]:          0 :     return aStr;
    1047                 :            : }
    1048                 :            : 
    1049                 :          0 : SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const String& rName, sal_uInt32 nFmt) :
    1050 [ #  # ][ #  # ]:          0 :     SwValueField(pTyp, nFmt), nSubType(nSub)
    1051                 :            : {
    1052         [ #  # ]:          0 :     aName = rName;
    1053 [ #  # ][ #  # ]:          0 :     aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, nFmt, GetLanguage(), aName);
                 [ #  # ]
    1054                 :          0 : }
    1055                 :            : 
    1056                 :          0 : SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const String& rName, const String& rValue, sal_uInt32 nFmt) :
    1057 [ #  # ][ #  # ]:          0 :     SwValueField(pTyp, nFmt), nSubType(nSub)
    1058                 :            : {
    1059         [ #  # ]:          0 :     aName = rName;
    1060         [ #  # ]:          0 :     aContent = rValue;
    1061                 :          0 : }
    1062                 :            : 
    1063                 :            : 
    1064                 :            : template<class T>
    1065                 :          0 : double lcl_TimeToDouble( const T& rTime )
    1066                 :            : {
    1067                 :          0 :     const double fMilliSecondsPerDay = 86400000.0;
    1068                 :          0 :     return ((rTime.Hours*3600000)+(rTime.Minutes*60000)+(rTime.Seconds*1000)+(rTime.HundredthSeconds*10)) / fMilliSecondsPerDay;
    1069                 :            : }
    1070                 :            : 
    1071                 :            : template<class D>
    1072                 :          0 : double lcl_DateToDouble( const D& rDate, const Date& rNullDate )
    1073                 :            : {
    1074                 :          0 :     long nDate = Date::DateToDays( rDate.Day, rDate.Month, rDate.Year );
    1075                 :          0 :     long nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() );
    1076                 :          0 :     return double( nDate - nNullDate );
    1077                 :            : }
    1078                 :            : 
    1079                 :          0 : String SwDocInfoField::Expand() const
    1080                 :            : {
    1081         [ #  # ]:          0 :     if ( ( nSubType & 0xFF ) == DI_CUSTOM )
    1082                 :            :     {
    1083                 :            :          // custom properties currently need special treatment
    1084                 :            :          // we don't have a secure way to detect "real" custom properties in Word  Import of text fields
    1085                 :            :         // so we treat *every* unknown property as a custom property, even the "built-in" section in Word's document summary information stream
    1086                 :            :         // as these properties have not been inserted when the document summary information was imported, we do it here
    1087                 :            :         // this approach is still a lot better than the old one to import such fields as "user fields" and simple text
    1088                 :          0 :         SwDocShell* pDocShell = GetDoc()->GetDocShell();
    1089         [ #  # ]:          0 :         if( !pDocShell )
    1090                 :          0 :             return aContent;
    1091                 :            :         try
    1092                 :            :         {
    1093 [ #  # ][ #  # ]:          0 :             uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW);
    1094 [ #  # ][ #  # ]:          0 :             uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
    1095 [ #  # ][ #  # ]:          0 :             uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
                 [ #  # ]
    1096 [ #  # ][ #  # ]:          0 :             uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
    1097                 :            : 
    1098                 :          0 :             uno::Any aAny;
    1099 [ #  # ][ #  # ]:          0 :             if( xSetInfo->hasPropertyByName( aName ) )
         [ #  # ][ #  # ]
    1100 [ #  # ][ #  # ]:          0 :                 aAny = xSet->getPropertyValue( aName );
                 [ #  # ]
    1101 [ #  # ][ #  # ]:          0 :             if ( aAny.getValueType() != ::getVoidCppuType() )
    1102                 :            :             {
    1103                 :            :                 // "void" type means that the property has not been inserted until now
    1104 [ #  # ][ #  # ]:          0 :                 if ( !IsFixed() )
    1105                 :            :                 {
    1106                 :            :                     // if the field is "fixed" we don't update it from the property
    1107                 :          0 :                     ::rtl::OUString sVal;
    1108                 :            :                     uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory()
    1109 [ #  # ][ #  # ]:          0 :                         ->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
    1110                 :          0 :                     util::Date aDate;
    1111                 :          0 :                     util::DateTime aDateTime;
    1112                 :          0 :                     util::Duration aDuration;
    1113 [ #  # ][ #  # ]:          0 :                     if( aAny >>= aDate)
    1114                 :            :                     {
    1115         [ #  # ]:          0 :                         SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
    1116         [ #  # ]:          0 :                         Date* pNullDate = pFormatter->GetNullDate();
    1117 [ #  # ][ #  # ]:          0 :                         sVal = ExpandValue( lcl_DateToDouble<util::Date>( aDate, *pNullDate ), GetFormat(), GetLanguage());
         [ #  # ][ #  # ]
    1118                 :            :                     }
    1119 [ #  # ][ #  # ]:          0 :                     else if( aAny >>= aDateTime )
    1120                 :            :                     {
    1121                 :          0 :                         double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime );
    1122         [ #  # ]:          0 :                         SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
    1123         [ #  # ]:          0 :                         Date* pNullDate = pFormatter->GetNullDate();
    1124         [ #  # ]:          0 :                         fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, *pNullDate );
    1125 [ #  # ][ #  # ]:          0 :                         sVal = ExpandValue( fDateTime, GetFormat(), GetLanguage());
                 [ #  # ]
    1126                 :            :                     }
    1127 [ #  # ][ #  # ]:          0 :                     else if( aAny >>= aDuration )
    1128                 :            :                     {
    1129 [ #  # ][ #  # ]:          0 :                         String sText = aDuration.Negative ? rtl::OUString('-') : rtl::OUString('+');
    1130 [ #  # ][ #  # ]:          0 :                         sText += ViewShell::GetShellRes()->sDurationFormat;
    1131 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%1"), String::CreateFromInt32( aDuration.Years ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1132 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%2"), String::CreateFromInt32( aDuration.Months ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1133 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%3"), String::CreateFromInt32( aDuration.Days   ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1134 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%4"), String::CreateFromInt32( aDuration.Hours  ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1135 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%5"), String::CreateFromInt32( aDuration.Minutes) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1136 [ #  # ][ #  # ]:          0 :                         sText.SearchAndReplace(rtl::OUString("%6"), String::CreateFromInt32( aDuration.Seconds) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1137 [ #  # ][ #  # ]:          0 :                         sVal = sText;
    1138                 :            :                     }
    1139                 :            :                     else
    1140                 :            :                     {
    1141 [ #  # ][ #  # ]:          0 :                         uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
    1142                 :          0 :                         aNew >>= sVal;
    1143                 :            :                     }
    1144         [ #  # ]:          0 :                     ((SwDocInfoField*)this)->aContent = sVal;
    1145                 :            :                 }
    1146         [ #  # ]:          0 :             }
    1147                 :            :         }
    1148                 :          0 :         catch (uno::Exception&) {}
    1149                 :            :     }
    1150         [ #  # ]:          0 :     else if ( !IsFixed() )
    1151         [ #  # ]:          0 :         ((SwDocInfoField*)this)->aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, GetFormat(), GetLanguage(), aName);
    1152                 :            : 
    1153                 :          0 :     return aContent;
    1154                 :            : }
    1155                 :            : 
    1156                 :          0 : String SwDocInfoField::GetFieldName() const
    1157                 :            : {
    1158                 :          0 :     String aStr(SwFieldType::GetTypeStr(GetTypeId()));
    1159         [ #  # ]:          0 :     aStr += ':';
    1160                 :            : 
    1161                 :          0 :     sal_uInt16 const nSub = nSubType & 0xff;
    1162                 :            : 
    1163         [ #  # ]:          0 :     switch (nSub)
    1164                 :            :     {
    1165                 :            :         case DI_CUSTOM:
    1166         [ #  # ]:          0 :             aStr += aName;
    1167                 :          0 :             break;
    1168                 :            : 
    1169                 :            :         default:
    1170         [ #  # ]:          0 :             aStr += ViewShell::GetShellRes()
    1171 [ #  # ][ #  # ]:          0 :                      ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
    1172                 :          0 :             break;
    1173                 :            :     }
    1174 [ #  # ][ #  # ]:          0 :     if (IsFixed())
    1175                 :            :     {
    1176         [ #  # ]:          0 :         aStr += ' ';
    1177 [ #  # ][ #  # ]:          0 :         aStr += ViewShell::GetShellRes()->aFixedStr;
    1178                 :            :     }
    1179                 :          0 :     return aStr;
    1180                 :            : }
    1181                 :            : 
    1182                 :          0 : SwField* SwDocInfoField::Copy() const
    1183                 :            : {
    1184         [ #  # ]:          0 :     SwDocInfoField* pFld = new SwDocInfoField((SwDocInfoFieldType*)GetTyp(), nSubType, aName, GetFormat());
    1185                 :          0 :     pFld->SetAutomaticLanguage(IsAutomaticLanguage());
    1186                 :          0 :     pFld->aContent = aContent;
    1187                 :            : 
    1188                 :          0 :     return pFld;
    1189                 :            : }
    1190                 :            : 
    1191                 :          0 : sal_uInt16 SwDocInfoField::GetSubType() const
    1192                 :            : {
    1193                 :          0 :     return nSubType;
    1194                 :            : }
    1195                 :            : 
    1196                 :          0 : void SwDocInfoField::SetSubType(sal_uInt16 nSub)
    1197                 :            : {
    1198                 :          0 :     nSubType = nSub;
    1199                 :          0 : }
    1200                 :            : 
    1201                 :          0 : void SwDocInfoField::SetLanguage(sal_uInt16 nLng)
    1202                 :            : {
    1203         [ #  # ]:          0 :     if (!GetFormat())
    1204                 :          0 :         SwField::SetLanguage(nLng);
    1205                 :            :     else
    1206                 :          0 :         SwValueField::SetLanguage(nLng);
    1207                 :          0 : }
    1208                 :            : 
    1209                 :          0 : bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    1210                 :            : {
    1211   [ #  #  #  #  :          0 :     switch( nWhichId )
             #  #  #  #  
                      # ]
    1212                 :            :     {
    1213                 :            :     case FIELD_PROP_PAR1:
    1214         [ #  # ]:          0 :         rAny <<= OUString(aContent);
    1215                 :          0 :         break;
    1216                 :            : 
    1217                 :            :     case FIELD_PROP_PAR4:
    1218         [ #  # ]:          0 :         rAny <<= OUString(aName);
    1219                 :          0 :         break;
    1220                 :            : 
    1221                 :            :     case FIELD_PROP_USHORT1:
    1222         [ #  # ]:          0 :         rAny  <<= (sal_Int16)aContent.ToInt32();
    1223                 :          0 :         break;
    1224                 :            : 
    1225                 :            :     case FIELD_PROP_BOOL1:
    1226                 :            :         {
    1227                 :          0 :             sal_Bool bVal = 0 != (nSubType & DI_SUB_FIXED);
    1228         [ #  # ]:          0 :             rAny.setValue(&bVal, ::getBooleanCppuType());
    1229                 :            :         }
    1230                 :          0 :         break;
    1231                 :            :     case FIELD_PROP_FORMAT:
    1232         [ #  # ]:          0 :         rAny  <<= (sal_Int32)GetFormat();
    1233                 :          0 :         break;
    1234                 :            : 
    1235                 :            :     case FIELD_PROP_DOUBLE:
    1236                 :            :         {
    1237         [ #  # ]:          0 :             double fVal = GetValue();
    1238         [ #  # ]:          0 :             rAny.setValue(&fVal, ::getCppuType(&fVal));
    1239                 :            :         }
    1240                 :          0 :         break;
    1241                 :            :     case FIELD_PROP_PAR3:
    1242 [ #  # ][ #  # ]:          0 :         rAny <<= rtl::OUString(Expand());
    1243                 :          0 :         break;
    1244                 :            :     case FIELD_PROP_BOOL2:
    1245                 :            :         {
    1246                 :          0 :             sal_uInt16 nExtSub = (nSubType & 0xff00) & ~DI_SUB_FIXED;
    1247                 :          0 :             sal_Bool bVal = (nExtSub == DI_SUB_DATE);
    1248         [ #  # ]:          0 :             rAny.setValue(&bVal, ::getBooleanCppuType());
    1249                 :            :         }
    1250                 :          0 :         break;
    1251                 :            :     default:
    1252                 :          0 :         return SwField::QueryValue(rAny, nWhichId);
    1253                 :            :     }
    1254                 :          0 :     return true;
    1255                 :            : }
    1256                 :            : 
    1257                 :          0 : bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    1258                 :            : {
    1259                 :          0 :     sal_Int32 nValue = 0;
    1260   [ #  #  #  #  :          0 :     switch( nWhichId )
                #  #  # ]
    1261                 :            :     {
    1262                 :            :     case FIELD_PROP_PAR1:
    1263         [ #  # ]:          0 :         if( nSubType & DI_SUB_FIXED )
    1264         [ #  # ]:          0 :             ::GetString( rAny, aContent );
    1265                 :          0 :         break;
    1266                 :            : 
    1267                 :            :     case FIELD_PROP_USHORT1:
    1268         [ #  # ]:          0 :         if( nSubType & DI_SUB_FIXED )
    1269                 :            :         {
    1270                 :          0 :             rAny >>= nValue;
    1271 [ #  # ][ #  # ]:          0 :             aContent = String::CreateFromInt32(nValue);
                 [ #  # ]
    1272                 :            :         }
    1273                 :          0 :         break;
    1274                 :            : 
    1275                 :            :     case FIELD_PROP_BOOL1:
    1276         [ #  # ]:          0 :         if(*(sal_Bool*)rAny.getValue())
    1277                 :          0 :             nSubType |= DI_SUB_FIXED;
    1278                 :            :         else
    1279                 :          0 :             nSubType &= ~DI_SUB_FIXED;
    1280                 :          0 :         break;
    1281                 :            :     case FIELD_PROP_FORMAT:
    1282                 :            :         {
    1283                 :          0 :             rAny >>= nValue;
    1284         [ #  # ]:          0 :             if( nValue >= 0)
    1285                 :          0 :                 SetFormat(nValue);
    1286                 :            :         }
    1287                 :          0 :         break;
    1288                 :            : 
    1289                 :            :     case FIELD_PROP_PAR3:
    1290         [ #  # ]:          0 :         ::GetString( rAny, aContent );
    1291                 :          0 :         break;
    1292                 :            :     case FIELD_PROP_BOOL2:
    1293                 :          0 :         nSubType &= 0xf0ff;
    1294         [ #  # ]:          0 :         if(*(sal_Bool*)rAny.getValue())
    1295                 :          0 :             nSubType |= DI_SUB_DATE;
    1296                 :            :         else
    1297                 :          0 :             nSubType |= DI_SUB_TIME;
    1298                 :          0 :         break;
    1299                 :            :     default:
    1300         [ #  # ]:          0 :         return SwField::PutValue(rAny, nWhichId);
    1301                 :            :     }
    1302                 :          0 :     return true;
    1303                 :            : }
    1304                 :            : 
    1305                 :            : /*--------------------------------------------------------------------
    1306                 :            :     Beschreibung: SwHiddenTxtFieldType by JP
    1307                 :            :  --------------------------------------------------------------------*/
    1308                 :            : 
    1309                 :       1549 : SwHiddenTxtFieldType::SwHiddenTxtFieldType( sal_Bool bSetHidden )
    1310                 :       1549 :     : SwFieldType( RES_HIDDENTXTFLD ), bHidden( bSetHidden )
    1311                 :            : {
    1312                 :       1549 : }
    1313                 :            : 
    1314                 :          0 : SwFieldType* SwHiddenTxtFieldType::Copy() const
    1315                 :            : {
    1316         [ #  # ]:          0 :     return new SwHiddenTxtFieldType( bHidden );
    1317                 :            : }
    1318                 :            : 
    1319                 :       1343 : void SwHiddenTxtFieldType::SetHiddenFlag( sal_Bool bSetHidden )
    1320                 :            : {
    1321         [ +  + ]:       1343 :     if( bHidden != bSetHidden )
    1322                 :            :     {
    1323                 :          6 :         bHidden = bSetHidden;
    1324                 :          6 :         UpdateFlds();       // alle HiddenText benachrichtigen
    1325                 :            :     }
    1326                 :       1343 : }
    1327                 :            : 
    1328                 :          0 : SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
    1329                 :            :                                     sal_Bool    bConditional,
    1330                 :            :                                     const   String& rCond,
    1331                 :            :                                     const   String& rStr,
    1332                 :            :                                     sal_Bool    bHidden,
    1333                 :            :                                     sal_uInt16  nSub) :
    1334                 :            :     SwField( pFldType ), aCond(rCond), nSubType(nSub),
    1335         [ #  # ]:          0 :     bCanToggle(bConditional), bIsHidden(bHidden), bValid(sal_False)
    1336                 :            : {
    1337         [ #  # ]:          0 :     if(nSubType == TYP_CONDTXTFLD)
    1338                 :            :     {
    1339                 :          0 :         sal_uInt16 nPos = 0;
    1340 [ #  # ][ #  # ]:          0 :         aTRUETxt = rStr.GetToken(0, '|', nPos);
                 [ #  # ]
    1341                 :            : 
    1342         [ #  # ]:          0 :         if(nPos != STRING_NOTFOUND)
    1343                 :            :         {
    1344 [ #  # ][ #  # ]:          0 :             aFALSETxt = rStr.GetToken(0, '|', nPos);
                 [ #  # ]
    1345         [ #  # ]:          0 :             if(nPos != STRING_NOTFOUND)
    1346                 :            :             {
    1347 [ #  # ][ #  # ]:          0 :                 aContent = rStr.GetToken(0, '|', nPos);
                 [ #  # ]
    1348                 :          0 :                 bValid = sal_True;
    1349                 :            :             }
    1350                 :            :         }
    1351                 :            :     }
    1352                 :            :     else
    1353         [ #  # ]:          0 :         aTRUETxt = rStr;
    1354                 :          0 : }
    1355                 :            : 
    1356                 :          0 : SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
    1357                 :            :                                     const String& rCond,
    1358                 :            :                                     const String& rTrue,
    1359                 :            :                                     const String& rFalse,
    1360                 :            :                                     sal_uInt16 nSub)
    1361                 :            :     : SwField( pFldType ), aTRUETxt(rTrue), aFALSETxt(rFalse), aCond(rCond), nSubType(nSub),
    1362 [ #  # ][ #  # ]:          0 :       bIsHidden(sal_True), bValid(sal_False)
                 [ #  # ]
    1363                 :            : {
    1364                 :          0 :     bCanToggle  = aCond.getLength() > 0;
    1365                 :          0 : }
    1366                 :            : 
    1367                 :          0 : String SwHiddenTxtField::Expand() const
    1368                 :            : {
    1369                 :            :     // Type: !Hidden  -> immer anzeigen
    1370                 :            :     //        Hide    -> Werte die Bedingung aus
    1371                 :            : 
    1372         [ #  # ]:          0 :     if( TYP_CONDTXTFLD == nSubType )
    1373                 :            :     {
    1374         [ #  # ]:          0 :         if( bValid )
    1375                 :          0 :             return aContent;
    1376                 :            : 
    1377 [ #  # ][ #  # ]:          0 :         if( bCanToggle && !bIsHidden )
    1378                 :          0 :             return aTRUETxt;
    1379                 :            :     }
    1380 [ #  # ][ #  # ]:          0 :     else if( !((SwHiddenTxtFieldType*)GetTyp())->GetHiddenFlag() ||
         [ #  # ][ #  # ]
    1381                 :            :         ( bCanToggle && bIsHidden ))
    1382                 :          0 :         return aTRUETxt;
    1383                 :            : 
    1384                 :          0 :     return aFALSETxt;
    1385                 :            : }
    1386                 :            : 
    1387                 :            : /*--------------------------------------------------------------------
    1388                 :            :     Beschreibung: Aktuellen Field-Value holen und cachen
    1389                 :            :  --------------------------------------------------------------------*/
    1390                 :            : 
    1391                 :          0 : void SwHiddenTxtField::Evaluate(SwDoc* pDoc)
    1392                 :            : {
    1393                 :            :     OSL_ENSURE(pDoc, "Wo ist das Dokument Seniore");
    1394                 :            : 
    1395         [ #  # ]:          0 :     if( TYP_CONDTXTFLD == nSubType )
    1396                 :            :     {
    1397                 :          0 :         SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
    1398                 :            : 
    1399                 :          0 :         bValid = sal_False;
    1400         [ #  # ]:          0 :         String sTmpName;
    1401                 :            : 
    1402 [ #  # ][ #  # ]:          0 :         if (bCanToggle && !bIsHidden)
    1403         [ #  # ]:          0 :             sTmpName = aTRUETxt;
    1404                 :            :         else
    1405         [ #  # ]:          0 :             sTmpName = aFALSETxt;
    1406                 :            : 
    1407                 :            : // Datenbankausdruecke muessen sich von
    1408                 :            : //              einfachem Text unterscheiden. also wird der einfache Text
    1409                 :            : //              bevorzugt in Anfuehrungszeichen gesetzt.
    1410                 :            : //              Sind diese vorhanden werden umschliessende entfernt.
    1411                 :            : //              Wenn nicht, dann wird auf die Tauglichkeit als Datenbankname
    1412                 :            : //              geprueft. Nur wenn zwei oder mehr Punkte vorhanden sind und kein
    1413                 :            : //              Anfuehrungszeichen enthalten ist, gehen wir von einer DB aus.
    1414         [ #  # ]:          0 :         if(sTmpName.Len() > 1 && sTmpName.GetChar(0) == '\"' &&
           [ #  #  #  # ]
                 [ #  # ]
    1415                 :          0 :             sTmpName.GetChar((sTmpName.Len() - 1))== '\"')
    1416                 :            :         {
    1417 [ #  # ][ #  # ]:          0 :             aContent = sTmpName.Copy(1, sTmpName.Len() - 2);
                 [ #  # ]
    1418                 :          0 :             bValid = sal_True;
    1419                 :            :         }
    1420 [ #  # ][ #  # ]:          0 :         else if(sTmpName.Search('\"') == STRING_NOTFOUND &&
         [ #  # ][ #  # ]
    1421 [ #  # ][ #  # ]:          0 :             comphelper::string::getTokenCount(sTmpName, '.') > 2)
         [ #  # ][ #  # ]
    1422                 :            :         {
    1423         [ #  # ]:          0 :             ::ReplacePoint(sTmpName);
    1424 [ #  # ][ #  # ]:          0 :             if(sTmpName.GetChar(0) == '[' && sTmpName.GetChar(sTmpName.Len()-1) == ']')
                 [ #  # ]
    1425                 :            :             {   // Eckige Klammern entfernen
    1426         [ #  # ]:          0 :                 sTmpName.Erase(0, 1);
    1427         [ #  # ]:          0 :                 sTmpName.Erase(sTmpName.Len()-1, 1);
    1428                 :            :             }
    1429                 :            : 
    1430         [ #  # ]:          0 :             if( pMgr)
    1431                 :            :             {
    1432         [ #  # ]:          0 :                 String sDBName( GetDBName( sTmpName, pDoc ));
    1433         [ #  # ]:          0 :                 String sDataSource(sDBName.GetToken(0, DB_DELIM));
    1434         [ #  # ]:          0 :                 String sDataTableOrQuery(sDBName.GetToken(1, DB_DELIM));
    1435 [ #  # ][ #  # ]:          0 :                 if( pMgr->IsInMerge() && sDBName.Len() &&
         [ #  # ][ #  # ]
    1436                 :            :                     pMgr->IsDataSourceOpen( sDataSource,
    1437         [ #  # ]:          0 :                                                 sDataTableOrQuery, sal_False))
    1438                 :            :                 {
    1439                 :            :                     double fNumber;
    1440                 :            :                     sal_uInt32 nTmpFormat;
    1441                 :            :                     pMgr->GetMergeColumnCnt(GetColumnName( sTmpName ),
    1442 [ #  # ][ #  # ]:          0 :                         GetLanguage(), aContent, &fNumber, &nTmpFormat );
                 [ #  # ]
    1443                 :          0 :                     bValid = sal_True;
    1444                 :            :                 }
    1445         [ #  # ]:          0 :                 else if( sDBName.Len() && sDataSource.Len() &&
           [ #  #  #  # ]
                 [ #  # ]
    1446                 :          0 :                          sDataTableOrQuery.Len() )
    1447 [ #  # ][ #  # ]:          0 :                     bValid = sal_True;
                 [ #  # ]
    1448                 :            :             }
    1449         [ #  # ]:          0 :         }
    1450                 :            :     }
    1451                 :          0 : }
    1452                 :            : 
    1453                 :          0 : String SwHiddenTxtField::GetFieldName() const
    1454                 :            : {
    1455                 :          0 :     String aStr(SwFieldType::GetTypeStr(nSubType));
    1456         [ #  # ]:          0 :     aStr += ' ';
    1457         [ #  # ]:          0 :     aStr += aCond;
    1458         [ #  # ]:          0 :     aStr += ' ';
    1459         [ #  # ]:          0 :     aStr += aTRUETxt;
    1460                 :            : 
    1461         [ #  # ]:          0 :     if (nSubType == TYP_CONDTXTFLD)
    1462                 :            :     {
    1463         [ #  # ]:          0 :         aStr.AppendAscii(" : ");
    1464         [ #  # ]:          0 :         aStr += aFALSETxt;
    1465                 :            :     }
    1466                 :          0 :     return aStr;
    1467                 :            : }
    1468                 :            : 
    1469                 :          0 : SwField* SwHiddenTxtField::Copy() const
    1470                 :            : {
    1471                 :            :     SwHiddenTxtField* pFld =
    1472                 :          0 :         new SwHiddenTxtField((SwHiddenTxtFieldType*)GetTyp(), aCond,
    1473 [ #  # ][ #  # ]:          0 :                               aTRUETxt, aFALSETxt);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1474                 :          0 :     pFld->bIsHidden = bIsHidden;
    1475                 :          0 :     pFld->bValid    = bValid;
    1476                 :          0 :     pFld->aContent  = aContent;
    1477                 :          0 :     pFld->SetFormat(GetFormat());
    1478                 :          0 :     pFld->nSubType  = nSubType;
    1479                 :          0 :     return pFld;
    1480                 :            : }
    1481                 :            : 
    1482                 :            : 
    1483                 :            : /*--------------------------------------------------------------------
    1484                 :            :     Beschreibung: Bedingung setzen
    1485                 :            :  --------------------------------------------------------------------*/
    1486                 :            : 
    1487                 :          0 : void SwHiddenTxtField::SetPar1(const rtl::OUString& rStr)
    1488                 :            : {
    1489                 :          0 :     aCond = rStr;
    1490                 :          0 :     bCanToggle = aCond.getLength() > 0;
    1491                 :          0 : }
    1492                 :            : 
    1493                 :          0 : const rtl::OUString& SwHiddenTxtField::GetPar1() const
    1494                 :            : {
    1495                 :          0 :     return aCond;
    1496                 :            : }
    1497                 :            : 
    1498                 :            : /*--------------------------------------------------------------------
    1499                 :            :     Beschreibung: True/False Text
    1500                 :            :  --------------------------------------------------------------------*/
    1501                 :            : 
    1502                 :          0 : void SwHiddenTxtField::SetPar2(const rtl::OUString& rStr)
    1503                 :            : {
    1504         [ #  # ]:          0 :     if (nSubType == TYP_CONDTXTFLD)
    1505                 :            :     {
    1506                 :          0 :         sal_Int32 nPos = rStr.indexOf('|');
    1507         [ #  # ]:          0 :         if (nPos == STRING_NOTFOUND)
    1508                 :          0 :             aTRUETxt = rStr;
    1509                 :            :         else
    1510                 :            :         {
    1511                 :          0 :             aTRUETxt = rStr.copy(0, nPos);
    1512                 :          0 :             aFALSETxt = rStr.copy(nPos + 1);
    1513                 :            :         }
    1514                 :            :     }
    1515                 :            :     else
    1516                 :          0 :         aTRUETxt = rStr;
    1517                 :          0 : }
    1518                 :            : 
    1519                 :          0 : rtl::OUString SwHiddenTxtField::GetPar2() const
    1520                 :            : {
    1521         [ #  # ]:          0 :     String aRet(aTRUETxt);
    1522         [ #  # ]:          0 :     if(nSubType == TYP_CONDTXTFLD)
    1523                 :            :     {
    1524         [ #  # ]:          0 :         aRet += '|';
    1525         [ #  # ]:          0 :         aRet += aFALSETxt;
    1526                 :            :     }
    1527 [ #  # ][ #  # ]:          0 :     return aRet;
    1528                 :            : }
    1529                 :            : 
    1530                 :          0 : sal_uInt16 SwHiddenTxtField::GetSubType() const
    1531                 :            : {
    1532                 :          0 :     return nSubType;
    1533                 :            : }
    1534                 :            : 
    1535                 :          0 : bool SwHiddenTxtField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    1536                 :            : {
    1537                 :          0 :     const rtl::OUString* pOut = 0;
    1538   [ #  #  #  #  :          0 :     switch( nWhichId )
                   #  # ]
    1539                 :            :     {
    1540                 :            :     case FIELD_PROP_PAR1:
    1541                 :          0 :         pOut = &aCond;
    1542                 :          0 :         break;
    1543                 :            :     case FIELD_PROP_PAR2:
    1544                 :          0 :         pOut = &aTRUETxt;
    1545                 :          0 :         break;
    1546                 :            :     case FIELD_PROP_PAR3:
    1547                 :          0 :         pOut = &aFALSETxt;
    1548                 :          0 :         break;
    1549                 :            :     case FIELD_PROP_PAR4 :
    1550                 :          0 :         pOut = &aContent;
    1551                 :          0 :     break;
    1552                 :            :     case FIELD_PROP_BOOL1:
    1553                 :            :         {
    1554                 :          0 :             sal_Bool bHidden = bIsHidden;
    1555         [ #  # ]:          0 :             rAny.setValue(&bHidden, ::getBooleanCppuType());
    1556                 :            :         }
    1557                 :          0 :         break;
    1558                 :            :     default:
    1559                 :            :         OSL_FAIL("illegal property");
    1560                 :            :     }
    1561         [ #  # ]:          0 :     if( pOut )
    1562                 :          0 :         rAny <<= *pOut;
    1563                 :          0 :     return true;
    1564                 :            : }
    1565                 :            : 
    1566                 :          0 : bool SwHiddenTxtField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    1567                 :            : {
    1568   [ #  #  #  #  :          0 :     switch( nWhichId )
                   #  # ]
    1569                 :            :     {
    1570                 :            :     case FIELD_PROP_PAR1:
    1571                 :            :         {
    1572                 :          0 :             rtl::OUString sVal;
    1573                 :          0 :             rAny >>= sVal;
    1574         [ #  # ]:          0 :             SetPar1(sVal);
    1575                 :            :         }
    1576                 :          0 :         break;
    1577                 :            :     case FIELD_PROP_PAR2:
    1578                 :          0 :         rAny >>= aTRUETxt;
    1579                 :          0 :         break;
    1580                 :            :     case FIELD_PROP_PAR3:
    1581                 :          0 :         rAny >>= aFALSETxt;
    1582                 :          0 :         break;
    1583                 :            :     case FIELD_PROP_BOOL1:
    1584                 :          0 :         bIsHidden = *(sal_Bool*)rAny.getValue();
    1585                 :          0 :         break;
    1586                 :            :     case FIELD_PROP_PAR4:
    1587                 :          0 :         rAny >>= aContent;
    1588                 :          0 :         bValid = sal_True;
    1589                 :          0 :     break;
    1590                 :            :     default:
    1591                 :            :         OSL_FAIL("illegal property");
    1592                 :            :     }
    1593                 :          0 :     return true;
    1594                 :            : }
    1595                 :            : 
    1596                 :            : //------------------------------------------------------------------------------
    1597                 :            : 
    1598                 :          0 : String SwHiddenTxtField::GetColumnName(const String& rName)
    1599                 :            : {
    1600                 :          0 :     sal_uInt16 nPos = rName.Search(DB_DELIM);
    1601         [ #  # ]:          0 :     if( STRING_NOTFOUND != nPos )
    1602                 :            :     {
    1603                 :          0 :         nPos = rName.Search(DB_DELIM, nPos + 1);
    1604                 :            : 
    1605         [ #  # ]:          0 :         if( STRING_NOTFOUND != nPos )
    1606                 :          0 :             return rName.Copy(nPos + 1);
    1607                 :            :     }
    1608                 :          0 :     return rName;
    1609                 :            : }
    1610                 :            : 
    1611                 :            : //------------------------------------------------------------------------------
    1612                 :            : 
    1613                 :          0 : String SwHiddenTxtField::GetDBName(const String& rName, SwDoc *pDoc)
    1614                 :            : {
    1615         [ #  # ]:          0 :     sal_uInt16 nPos = rName.Search(DB_DELIM);
    1616         [ #  # ]:          0 :     if( STRING_NOTFOUND != nPos )
    1617                 :            :     {
    1618         [ #  # ]:          0 :         nPos = rName.Search(DB_DELIM, nPos + 1);
    1619                 :            : 
    1620         [ #  # ]:          0 :         if( STRING_NOTFOUND != nPos )
    1621         [ #  # ]:          0 :             return rName.Copy( 0, nPos );
    1622                 :            :     }
    1623         [ #  # ]:          0 :     SwDBData aData = pDoc->GetDBData();
    1624         [ #  # ]:          0 :     String sRet = aData.sDataSource;
    1625         [ #  # ]:          0 :     sRet += DB_DELIM;
    1626 [ #  # ][ #  # ]:          0 :     sRet += String(aData.sCommand);
                 [ #  # ]
    1627 [ #  # ][ #  # ]:          0 :     return sRet;
    1628                 :            : }
    1629                 :            : 
    1630                 :            : /*--------------------------------------------------------------------
    1631                 :            :     Beschreibung: Der Feldtyp fuer Zeilenhoehe 0
    1632                 :            :  --------------------------------------------------------------------*/
    1633                 :            : 
    1634                 :       1549 : SwHiddenParaFieldType::SwHiddenParaFieldType()
    1635                 :       1549 :     : SwFieldType( RES_HIDDENPARAFLD )
    1636                 :            : {
    1637                 :       1549 : }
    1638                 :            : 
    1639                 :          0 : SwFieldType* SwHiddenParaFieldType::Copy() const
    1640                 :            : {
    1641         [ #  # ]:          0 :     SwHiddenParaFieldType* pTyp = new SwHiddenParaFieldType();
    1642                 :          0 :     return pTyp;
    1643                 :            : }
    1644                 :            : 
    1645                 :            : /*--------------------------------------------------------------------
    1646                 :            :     Beschreibung: Das Feld Zeilenhoehe 0
    1647                 :            :  --------------------------------------------------------------------*/
    1648                 :            : 
    1649                 :          0 : SwHiddenParaField::SwHiddenParaField(SwHiddenParaFieldType* pTyp, const String& rStr)
    1650         [ #  # ]:          0 :     : SwField(pTyp), aCond(rStr)
    1651                 :            : {
    1652                 :          0 :     bIsHidden = sal_False;
    1653                 :          0 : }
    1654                 :            : 
    1655                 :          0 : String SwHiddenParaField::Expand() const
    1656                 :            : {
    1657                 :          0 :     return aEmptyStr;
    1658                 :            : }
    1659                 :            : 
    1660                 :          0 : SwField* SwHiddenParaField::Copy() const
    1661                 :            : {
    1662 [ #  # ][ #  # ]:          0 :     SwHiddenParaField* pFld = new SwHiddenParaField((SwHiddenParaFieldType*)GetTyp(), aCond);
    1663                 :          0 :     pFld->bIsHidden = bIsHidden;
    1664                 :            : 
    1665                 :          0 :     return pFld;
    1666                 :            : }
    1667                 :            : 
    1668                 :          0 : bool SwHiddenParaField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    1669                 :            : {
    1670      [ #  #  # ]:          0 :     switch ( nWhichId )
    1671                 :            :     {
    1672                 :            :     case FIELD_PROP_PAR1:
    1673         [ #  # ]:          0 :         rAny <<= OUString(aCond);
    1674                 :          0 :         break;
    1675                 :            :     case  FIELD_PROP_BOOL1:
    1676                 :            :         {
    1677                 :          0 :             sal_Bool bHidden = bIsHidden;
    1678         [ #  # ]:          0 :             rAny.setValue(&bHidden, ::getBooleanCppuType());
    1679                 :            :         }
    1680                 :          0 :         break;
    1681                 :            : 
    1682                 :            :     default:
    1683                 :            :         OSL_FAIL("illegal property");
    1684                 :            :     }
    1685                 :          0 :     return true;
    1686                 :            : }
    1687                 :            : 
    1688                 :          0 : bool SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    1689                 :            : {
    1690      [ #  #  # ]:          0 :     switch ( nWhichId )
    1691                 :            :     {
    1692                 :            :     case FIELD_PROP_PAR1:
    1693                 :          0 :         rAny >>= aCond;
    1694                 :          0 :         break;
    1695                 :            :     case FIELD_PROP_BOOL1:
    1696                 :          0 :         bIsHidden = *(sal_Bool*)rAny.getValue();
    1697                 :          0 :         break;
    1698                 :            : 
    1699                 :            :     default:
    1700                 :            :         OSL_FAIL("illegal property");
    1701                 :            :     }
    1702                 :          0 :     return true;
    1703                 :            : }
    1704                 :            : 
    1705                 :            : /*--------------------------------------------------------------------
    1706                 :            :     Beschreibung: Bedingung setzen
    1707                 :            :  --------------------------------------------------------------------*/
    1708                 :            : 
    1709                 :          0 : void SwHiddenParaField::SetPar1(const rtl::OUString& rStr)
    1710                 :            : {
    1711                 :          0 :     aCond = rStr;
    1712                 :          0 : }
    1713                 :            : 
    1714                 :          0 : const rtl::OUString& SwHiddenParaField::GetPar1() const
    1715                 :            : {
    1716                 :          0 :     return aCond;
    1717                 :            : }
    1718                 :            : 
    1719                 :            : /*--------------------------------------------------------------------
    1720                 :            :     Beschreibung: PostIt
    1721                 :            :  --------------------------------------------------------------------*/
    1722                 :            : 
    1723                 :       1549 : SwPostItFieldType::SwPostItFieldType(SwDoc *pDoc)
    1724                 :       1549 :     : SwFieldType( RES_POSTITFLD ),mpDoc(pDoc)
    1725                 :       1549 : {}
    1726                 :            : 
    1727                 :          0 : SwFieldType* SwPostItFieldType::Copy() const
    1728                 :            : {
    1729         [ #  # ]:          0 :     return new SwPostItFieldType(mpDoc);
    1730                 :            : }
    1731                 :            : 
    1732                 :            : 
    1733                 :            : /*--------------------------------------------------------------------
    1734                 :            :     Beschreibung: SwPostItFieldType
    1735                 :            :  --------------------------------------------------------------------*/
    1736                 :            : 
    1737                 :        135 : SwPostItField::SwPostItField( SwPostItFieldType* pT,
    1738                 :            :         const String& rAuthor, const String& rTxt, const String& rInitials, const String& rName, const DateTime& rDateTime )
    1739 [ +  - ][ +  - ]:        135 :     : SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), sInitials( rInitials ), sName( rName ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0)
         [ +  - ][ +  - ]
                 [ +  - ]
    1740                 :            : {
    1741                 :        135 : }
    1742                 :            : 
    1743                 :            : 
    1744                 :        132 : SwPostItField::~SwPostItField()
    1745                 :            : {
    1746         [ +  + ]:        132 :     if ( m_pTextObject )
    1747                 :            :     {
    1748         [ +  - ]:          6 :         m_pTextObject->DisposeEditSource();
    1749                 :          6 :         m_pTextObject->release();
    1750                 :            :     }
    1751         [ -  + ]:        261 : }
    1752                 :            : 
    1753                 :            : 
    1754                 :         27 : String SwPostItField::Expand() const
    1755                 :            : {
    1756                 :         27 :     return aEmptyStr;
    1757                 :            : }
    1758                 :            : 
    1759                 :            : 
    1760                 :          0 : String SwPostItField::GetDescription() const
    1761                 :            : {
    1762         [ #  # ]:          0 :     return SW_RES(STR_NOTE);
    1763                 :            : }
    1764                 :            : 
    1765                 :            : 
    1766                 :        108 : SwField* SwPostItField::Copy() const
    1767                 :            : {
    1768                 :        108 :     SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor, sTxt, sInitials, sName,
    1769 [ +  - ][ +  - ]:        108 :                                 aDateTime);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1770         [ +  + ]:        108 :     if (mpText)
    1771         [ +  - ]:         72 :         pRet->SetTextObject( new OutlinerParaObject(*mpText) );
    1772                 :        108 :     return pRet;
    1773                 :            : }
    1774                 :            : /*--------------------------------------------------------------------
    1775                 :            :     Beschreibung: Author setzen
    1776                 :            :  --------------------------------------------------------------------*/
    1777                 :            : 
    1778                 :          0 : void SwPostItField::SetPar1(const rtl::OUString& rStr)
    1779                 :            : {
    1780                 :          0 :     sAuthor = rStr;
    1781                 :          0 : }
    1782                 :            : 
    1783                 :         63 : const rtl::OUString& SwPostItField::GetPar1() const
    1784                 :            : {
    1785                 :         63 :     return sAuthor;
    1786                 :            : }
    1787                 :            : 
    1788                 :            : /*--------------------------------------------------------------------
    1789                 :            :     Beschreibung: Text fuers PostIt setzen
    1790                 :            :  --------------------------------------------------------------------*/
    1791                 :            : 
    1792                 :         18 : void SwPostItField::SetPar2(const rtl::OUString& rStr)
    1793                 :            : {
    1794                 :         18 :     sTxt = rStr;
    1795                 :         18 : }
    1796                 :            : 
    1797                 :         18 : rtl::OUString SwPostItField::GetPar2() const
    1798                 :            : {
    1799                 :         18 :         return sTxt;
    1800                 :            : }
    1801                 :            : 
    1802                 :          6 : const rtl::OUString& SwPostItField::GetInitials() const
    1803                 :            : {
    1804                 :          6 :     return sInitials;
    1805                 :            : }
    1806                 :            : 
    1807                 :         12 : void SwPostItField::SetName(const rtl::OUString& rName)
    1808                 :            : {
    1809                 :         12 :     sName = rName;
    1810                 :         12 : }
    1811                 :            : 
    1812                 :         36 : const rtl::OUString& SwPostItField::GetName() const
    1813                 :            : {
    1814                 :         36 :     return sName;
    1815                 :            : }
    1816                 :            : 
    1817                 :         36 : const OutlinerParaObject* SwPostItField::GetTextObject() const
    1818                 :            : {
    1819                 :         36 :     return mpText;
    1820                 :            : }
    1821                 :            : 
    1822                 :         90 : void SwPostItField::SetTextObject( OutlinerParaObject* pText )
    1823                 :            : {
    1824         [ -  + ]:         90 :     delete mpText;
    1825                 :         90 :     mpText = pText;
    1826                 :         90 : }
    1827                 :            : 
    1828                 :          3 : sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
    1829                 :            : {
    1830         [ -  + ]:          3 :     return (mpText) ? mpText->Count() : 1;
    1831                 :            : }
    1832                 :            : 
    1833                 :         69 : bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    1834                 :            : {
    1835   [ +  +  +  +  :         69 :     switch( nWhichId )
             +  -  +  - ]
    1836                 :            :     {
    1837                 :            :     case FIELD_PROP_PAR1:
    1838         [ +  - ]:          9 :         rAny <<= OUString(sAuthor);
    1839                 :          9 :         break;
    1840                 :            :     case FIELD_PROP_PAR2:
    1841                 :            :         {
    1842         [ +  - ]:          6 :         rAny <<= OUString(sTxt);
    1843                 :          6 :         break;
    1844                 :            :         }
    1845                 :            :     case FIELD_PROP_PAR3:
    1846         [ +  - ]:         18 :         rAny <<= OUString(sInitials);
    1847                 :         18 :         break;
    1848                 :            :     case FIELD_PROP_PAR4:
    1849         [ +  - ]:         18 :         rAny <<= OUString(sName);
    1850                 :         18 :         break;
    1851                 :            :     case FIELD_PROP_TEXT:
    1852                 :            :         {
    1853         [ +  + ]:          9 :             if ( !m_pTextObject )
    1854                 :            :             {
    1855                 :          6 :                 SwPostItFieldType* pGetType = (SwPostItFieldType*)GetTyp();
    1856                 :          6 :                 SwDoc* pDoc = pGetType->GetDoc();
    1857 [ +  - ][ +  - ]:          6 :                 SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc );
    1858         [ +  - ]:          6 :                 const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj );
    1859                 :          6 :                 m_pTextObject->acquire();
    1860                 :            :             }
    1861                 :            : 
    1862         [ +  + ]:          9 :             if ( mpText )
    1863         [ +  - ]:          3 :                 m_pTextObject->SetText( *mpText );
    1864                 :            :             else
    1865 [ +  - ][ +  - ]:          6 :                 m_pTextObject->SetString( sTxt );
                 [ +  - ]
    1866                 :            : 
    1867 [ +  - ][ +  - ]:          9 :             uno::Reference < text::XText > xText( m_pTextObject );
    1868         [ +  - ]:          9 :             rAny <<= xText;
    1869                 :          9 :             break;
    1870                 :            :         }
    1871                 :            :     case FIELD_PROP_DATE:
    1872                 :            :         {
    1873                 :          0 :             util::Date aSetDate;
    1874                 :          0 :             aSetDate.Day = aDateTime.GetDay();
    1875                 :          0 :             aSetDate.Month = aDateTime.GetMonth();
    1876                 :          0 :             aSetDate.Year = aDateTime.GetYear();
    1877         [ #  # ]:          0 :             rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
    1878                 :            :         }
    1879                 :          0 :         break;
    1880                 :            :     case FIELD_PROP_DATE_TIME:
    1881                 :            :         {
    1882                 :          9 :                 util::DateTime DateTimeValue;
    1883                 :          9 :                 DateTimeValue.HundredthSeconds = aDateTime.Get100Sec();
    1884                 :          9 :                 DateTimeValue.Seconds = aDateTime.GetSec();
    1885                 :          9 :                 DateTimeValue.Minutes = aDateTime.GetMin();
    1886                 :          9 :                 DateTimeValue.Hours = aDateTime.GetHour();
    1887                 :          9 :                 DateTimeValue.Day = aDateTime.GetDay();
    1888                 :          9 :                 DateTimeValue.Month = aDateTime.GetMonth();
    1889                 :          9 :                 DateTimeValue.Year = aDateTime.GetYear();
    1890         [ +  - ]:          9 :                 rAny <<= DateTimeValue;
    1891                 :            :         }
    1892                 :          9 :         break;
    1893                 :            :     default:
    1894                 :            :         OSL_FAIL("illegal property");
    1895                 :            :     }
    1896                 :         69 :     return true;
    1897                 :            : }
    1898                 :            : 
    1899                 :          0 : bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    1900                 :            : {
    1901   [ #  #  #  #  :          0 :     switch( nWhichId )
             #  #  #  # ]
    1902                 :            :     {
    1903                 :            :     case FIELD_PROP_PAR1:
    1904                 :          0 :         rAny >>= sAuthor;
    1905                 :          0 :         break;
    1906                 :            :     case FIELD_PROP_PAR2:
    1907                 :          0 :         rAny >>= sTxt;
    1908                 :            :         //#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
    1909         [ #  # ]:          0 :         if (mpText)
    1910                 :            :         {
    1911         [ #  # ]:          0 :             delete mpText;
    1912                 :          0 :             mpText = 0;
    1913                 :            :         }
    1914                 :          0 :         break;
    1915                 :            :     case FIELD_PROP_PAR3:
    1916                 :          0 :         rAny >>= sInitials;
    1917                 :          0 :         break;
    1918                 :            :     case FIELD_PROP_PAR4:
    1919                 :          0 :         rAny >>= sName;
    1920                 :          0 :         break;
    1921                 :            :     case FIELD_PROP_TEXT:
    1922                 :            :         OSL_FAIL("Not implemented!");
    1923                 :          0 :         break;
    1924                 :            :     case FIELD_PROP_DATE:
    1925         [ #  # ]:          0 :         if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
    1926                 :            :         {
    1927                 :          0 :             util::Date aSetDate = *(util::Date*)rAny.getValue();
    1928         [ #  # ]:          0 :             aDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
    1929                 :            :         }
    1930                 :          0 :         break;
    1931                 :            :     case FIELD_PROP_DATE_TIME:
    1932                 :            :     {
    1933                 :          0 :         util::DateTime aDateTimeValue;
    1934 [ #  # ][ #  # ]:          0 :         if(!(rAny >>= aDateTimeValue))
    1935                 :          0 :             return sal_False;
    1936         [ #  # ]:          0 :         aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
    1937         [ #  # ]:          0 :         aDateTime.SetSec(aDateTimeValue.Seconds);
    1938         [ #  # ]:          0 :         aDateTime.SetMin(aDateTimeValue.Minutes);
    1939         [ #  # ]:          0 :         aDateTime.SetHour(aDateTimeValue.Hours);
    1940         [ #  # ]:          0 :         aDateTime.SetDay(aDateTimeValue.Day);
    1941         [ #  # ]:          0 :         aDateTime.SetMonth(aDateTimeValue.Month);
    1942         [ #  # ]:          0 :         aDateTime.SetYear(aDateTimeValue.Year);
    1943                 :            :     }
    1944                 :          0 :     break;
    1945                 :            :     default:
    1946                 :            :         OSL_FAIL("illegal property");
    1947                 :            :     }
    1948                 :          0 :     return true;
    1949                 :            : }
    1950                 :            : /*--------------------------------------------------------------------
    1951                 :            :     Beschreibung: DokumentinfoFields
    1952                 :            :  --------------------------------------------------------------------*/
    1953                 :            : 
    1954                 :       1549 : SwExtUserFieldType::SwExtUserFieldType()
    1955         [ +  - ]:       1549 :     : SwFieldType( RES_EXTUSERFLD )
    1956                 :            : {
    1957                 :       1549 : }
    1958                 :            : 
    1959                 :          0 : SwFieldType* SwExtUserFieldType::Copy() const
    1960                 :            : {
    1961         [ #  # ]:          0 :     SwExtUserFieldType* pTyp = new SwExtUserFieldType;
    1962                 :          0 :     return pTyp;
    1963                 :            : }
    1964                 :            : 
    1965                 :          0 : String SwExtUserFieldType::Expand(sal_uInt16 nSub, sal_uInt32 ) const
    1966                 :            : {
    1967                 :          0 :     String aRet;
    1968                 :          0 :     sal_uInt16 nRet = USHRT_MAX;
    1969   [ #  #  #  #  :          0 :     switch(nSub)
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    1970                 :            :     {
    1971                 :          0 :     case EU_FIRSTNAME:      nRet = USER_OPT_FIRSTNAME; break;
    1972                 :          0 :     case EU_NAME:           nRet = USER_OPT_LASTNAME;  break;
    1973                 :          0 :     case EU_SHORTCUT:       nRet = USER_OPT_ID; break;
    1974                 :            : 
    1975                 :          0 :     case EU_COMPANY:        nRet = USER_OPT_COMPANY;        break;
    1976                 :          0 :     case EU_STREET:         nRet = USER_OPT_STREET;         break;
    1977                 :          0 :     case EU_TITLE:          nRet = USER_OPT_TITLE;          break;
    1978                 :          0 :     case EU_POSITION:       nRet = USER_OPT_POSITION;       break;
    1979                 :          0 :     case EU_PHONE_PRIVATE:  nRet = USER_OPT_TELEPHONEHOME;    break;
    1980                 :          0 :     case EU_PHONE_COMPANY:  nRet = USER_OPT_TELEPHONEWORK;    break;
    1981                 :          0 :     case EU_FAX:            nRet = USER_OPT_FAX;            break;
    1982                 :          0 :     case EU_EMAIL:          nRet = USER_OPT_EMAIL;          break;
    1983                 :          0 :     case EU_COUNTRY:        nRet = USER_OPT_COUNTRY;        break;
    1984                 :          0 :     case EU_ZIP:            nRet = USER_OPT_ZIP;            break;
    1985                 :          0 :     case EU_CITY:           nRet = USER_OPT_CITY;           break;
    1986                 :          0 :     case EU_STATE:          nRet = USER_OPT_STATE;          break;
    1987                 :          0 :     case EU_FATHERSNAME:    nRet = USER_OPT_FATHERSNAME;    break;
    1988                 :          0 :     case EU_APARTMENT:      nRet = USER_OPT_APARTMENT;      break;
    1989                 :            :     default:             OSL_ENSURE( !this, "Field unknown");
    1990                 :            :     }
    1991         [ #  # ]:          0 :     if( USHRT_MAX != nRet )
    1992                 :            :     {
    1993 [ #  # ][ #  # ]:          0 :         SvtUserOptions&  rUserOpt = SW_MOD()->GetUserOptions();
    1994 [ #  # ][ #  # ]:          0 :         aRet = rUserOpt.GetToken( nRet );
    1995                 :            :     }
    1996                 :          0 :     return aRet;
    1997                 :            : }
    1998                 :            : 
    1999                 :          0 : SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal_uInt32 nFmt) :
    2000         [ #  # ]:          0 :     SwField(pTyp, nFmt), nType(nSubTyp)
    2001                 :            : {
    2002 [ #  # ][ #  # ]:          0 :     aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
                 [ #  # ]
    2003                 :          0 : }
    2004                 :            : 
    2005                 :          0 : String SwExtUserField::Expand() const
    2006                 :            : {
    2007         [ #  # ]:          0 :     if (!IsFixed())
    2008         [ #  # ]:          0 :         ((SwExtUserField*)this)->aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
    2009                 :            : 
    2010                 :          0 :     return aContent;
    2011                 :            : }
    2012                 :            : 
    2013                 :          0 : SwField* SwExtUserField::Copy() const
    2014                 :            : {
    2015         [ #  # ]:          0 :     SwExtUserField* pFld = new SwExtUserField((SwExtUserFieldType*)GetTyp(), nType, GetFormat());
    2016                 :          0 :     pFld->SetExpansion(aContent);
    2017                 :            : 
    2018                 :          0 :     return pFld;
    2019                 :            : }
    2020                 :            : 
    2021                 :          0 : sal_uInt16 SwExtUserField::GetSubType() const
    2022                 :            : {
    2023                 :          0 :     return nType;
    2024                 :            : }
    2025                 :            : 
    2026                 :          0 : void SwExtUserField::SetSubType(sal_uInt16 nSub)
    2027                 :            : {
    2028                 :          0 :     nType = nSub;
    2029                 :          0 : }
    2030                 :            : 
    2031                 :          0 : bool SwExtUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    2032                 :            : {
    2033   [ #  #  #  # ]:          0 :     switch( nWhichId )
    2034                 :            :     {
    2035                 :            :     case FIELD_PROP_PAR1:
    2036         [ #  # ]:          0 :         rAny <<= OUString(aContent);
    2037                 :          0 :         break;
    2038                 :            : 
    2039                 :            :     case FIELD_PROP_USHORT1:
    2040                 :            :         {
    2041                 :          0 :             sal_Int16 nTmp = nType;
    2042         [ #  # ]:          0 :             rAny <<= nTmp;
    2043                 :            :         }
    2044                 :          0 :         break;
    2045                 :            :     case FIELD_PROP_BOOL1:
    2046                 :            :         {
    2047         [ #  # ]:          0 :             sal_Bool bTmp = IsFixed();
    2048         [ #  # ]:          0 :             rAny.setValue(&bTmp, ::getBooleanCppuType());
    2049                 :            :         }
    2050                 :          0 :         break;
    2051                 :            :     default:
    2052                 :            :         OSL_FAIL("illegal property");
    2053                 :            :     }
    2054                 :          0 :     return true;
    2055                 :            : }
    2056                 :            : 
    2057                 :          0 : bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    2058                 :            : {
    2059   [ #  #  #  # ]:          0 :     switch( nWhichId )
    2060                 :            :     {
    2061                 :            :     case FIELD_PROP_PAR1:
    2062                 :          0 :         ::GetString( rAny, aContent );
    2063                 :          0 :         break;
    2064                 :            : 
    2065                 :            :     case FIELD_PROP_USHORT1:
    2066                 :            :         {
    2067                 :          0 :             sal_Int16 nTmp = 0;
    2068                 :          0 :             rAny >>= nTmp;
    2069                 :          0 :             nType = nTmp;
    2070                 :            :         }
    2071                 :          0 :         break;
    2072                 :            :     case FIELD_PROP_BOOL1:
    2073         [ #  # ]:          0 :         if( *(sal_Bool*)rAny.getValue() )
    2074                 :          0 :             SetFormat(GetFormat() | AF_FIXED);
    2075                 :            :         else
    2076                 :          0 :             SetFormat(GetFormat() & ~AF_FIXED);
    2077                 :          0 :         break;
    2078                 :            :     default:
    2079                 :            :         OSL_FAIL("illegal property");
    2080                 :            :     }
    2081                 :          0 :     return true;
    2082                 :            : }
    2083                 :            : //-------------------------------------------------------------------------
    2084                 :            : 
    2085                 :            : /*--------------------------------------------------------------------
    2086                 :            :     Beschreibung: Relatives Seitennummern - Feld
    2087                 :            :  --------------------------------------------------------------------*/
    2088                 :            : 
    2089                 :       1549 : SwRefPageSetFieldType::SwRefPageSetFieldType()
    2090                 :       1549 :     : SwFieldType( RES_REFPAGESETFLD )
    2091                 :            : {
    2092                 :       1549 : }
    2093                 :            : 
    2094                 :          0 : SwFieldType* SwRefPageSetFieldType::Copy() const
    2095                 :            : {
    2096         [ #  # ]:          0 :     return new SwRefPageSetFieldType;
    2097                 :            : }
    2098                 :            : 
    2099                 :            : // ueberlagert, weil es nichts zum Updaten gibt!
    2100                 :          0 : void SwRefPageSetFieldType::Modify( const SfxPoolItem*, const SfxPoolItem * )
    2101                 :            : {
    2102                 :          0 : }
    2103                 :            : 
    2104                 :            : /*--------------------------------------------------------------------
    2105                 :            :     Beschreibung: Relative Seitennummerierung
    2106                 :            :  --------------------------------------------------------------------*/
    2107                 :            : 
    2108                 :          0 : SwRefPageSetField::SwRefPageSetField( SwRefPageSetFieldType* pTyp,
    2109                 :            :                     short nOff, sal_Bool bFlag )
    2110                 :          0 :     : SwField( pTyp ), nOffset( nOff ), bOn( bFlag )
    2111                 :            : {
    2112                 :          0 : }
    2113                 :            : 
    2114                 :          0 : String SwRefPageSetField::Expand() const
    2115                 :            : {
    2116                 :          0 :     return aEmptyStr;
    2117                 :            : }
    2118                 :            : 
    2119                 :          0 : SwField* SwRefPageSetField::Copy() const
    2120                 :            : {
    2121         [ #  # ]:          0 :     return new SwRefPageSetField( (SwRefPageSetFieldType*)GetTyp(), nOffset, bOn );
    2122                 :            : }
    2123                 :            : 
    2124                 :          0 : rtl::OUString SwRefPageSetField::GetPar2() const
    2125                 :            : {
    2126                 :          0 :     return rtl::OUString::valueOf(static_cast<sal_Int32>(GetOffset()));
    2127                 :            : }
    2128                 :            : 
    2129                 :          0 : void SwRefPageSetField::SetPar2(const rtl::OUString& rStr)
    2130                 :            : {
    2131                 :          0 :     SetOffset( (short) rStr.toInt32() );
    2132                 :          0 : }
    2133                 :            : 
    2134                 :          0 : bool SwRefPageSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    2135                 :            : {
    2136      [ #  #  # ]:          0 :     switch( nWhichId )
    2137                 :            :     {
    2138                 :            :     case FIELD_PROP_BOOL1:
    2139                 :          0 :         rAny.setValue(&bOn, ::getBooleanCppuType());
    2140                 :          0 :         break;
    2141                 :            :     case FIELD_PROP_USHORT1:
    2142         [ #  # ]:          0 :         rAny <<= (sal_Int16)nOffset;
    2143                 :          0 :         break;
    2144                 :            :     default:
    2145                 :            :         OSL_FAIL("illegal property");
    2146                 :            :     }
    2147                 :          0 :     return true;
    2148                 :            : }
    2149                 :            : 
    2150                 :          0 : bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    2151                 :            : {
    2152      [ #  #  # ]:          0 :     switch( nWhichId )
    2153                 :            :     {
    2154                 :            :     case FIELD_PROP_BOOL1:
    2155                 :          0 :         bOn = *(sal_Bool*)rAny.getValue();
    2156                 :          0 :         break;
    2157                 :            :     case FIELD_PROP_USHORT1:
    2158                 :          0 :         rAny >>=nOffset;
    2159                 :          0 :         break;
    2160                 :            :     default:
    2161                 :            :         OSL_FAIL("illegal property");
    2162                 :            :     }
    2163                 :          0 :     return true;
    2164                 :            : }
    2165                 :            : /*--------------------------------------------------------------------
    2166                 :            :     Beschreibung: relatives Seitennummern - Abfrage Feld
    2167                 :            :  --------------------------------------------------------------------*/
    2168                 :            : 
    2169                 :       1549 : SwRefPageGetFieldType::SwRefPageGetFieldType( SwDoc* pDc )
    2170                 :       1549 :     : SwFieldType( RES_REFPAGEGETFLD ), pDoc( pDc ), nNumberingType( SVX_NUM_ARABIC )
    2171                 :            : {
    2172                 :       1549 : }
    2173                 :            : 
    2174                 :          0 : SwFieldType* SwRefPageGetFieldType::Copy() const
    2175                 :            : {
    2176         [ #  # ]:          0 :     SwRefPageGetFieldType* pNew = new SwRefPageGetFieldType( pDoc );
    2177                 :          0 :     pNew->nNumberingType = nNumberingType;
    2178                 :          0 :     return pNew;
    2179                 :            : }
    2180                 :            : 
    2181                 :       1598 : void SwRefPageGetFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
    2182                 :            : {
    2183                 :            :     // Update auf alle GetReferenz-Felder
    2184 [ +  + ][ +  - ]:       1598 :     if( !pNew && !pOld && GetDepends() )
         [ -  + ][ -  + ]
    2185                 :            :     {
    2186                 :            :         // sammel erstmal alle SetPageRefFelder ein.
    2187         [ #  # ]:          0 :         _SetGetExpFlds aTmpLst;
    2188 [ #  # ][ #  # ]:          0 :         if( MakeSetList( aTmpLst ) )
    2189                 :            :         {
    2190         [ #  # ]:          0 :             SwIterator<SwFmtFld,SwFieldType> aIter( *this );
    2191 [ #  # ][ #  # ]:          0 :             for ( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
                 [ #  # ]
    2192                 :            :                     // nur die GetRef-Felder Updaten
    2193         [ #  # ]:          0 :                     if( pFmtFld->GetTxtFld() )
    2194 [ #  # ][ #  # ]:          0 :                         UpdateField( pFmtFld->GetTxtFld(), aTmpLst );
    2195         [ #  # ]:          0 :         }
    2196                 :            :     }
    2197                 :            : 
    2198                 :            :     // weiter an die Text-Felder, diese "Expandieren" den Text
    2199                 :       1598 :     NotifyClients( pOld, pNew );
    2200                 :       1598 : }
    2201                 :            : 
    2202                 :          0 : sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
    2203                 :            : {
    2204 [ #  # ][ #  # ]:          0 :     SwIterator<SwFmtFld,SwFieldType> aIter(*pDoc->GetSysFldType( RES_REFPAGESETFLD));
    2205 [ #  # ][ #  # ]:          0 :     for ( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
                 [ #  # ]
    2206                 :            :     {
    2207                 :            :             // nur die GetRef-Felder Updaten
    2208                 :          0 :             const SwTxtFld* pTFld = pFmtFld->GetTxtFld();
    2209         [ #  # ]:          0 :             if( pTFld )
    2210                 :            :             {
    2211                 :          0 :                 const SwTxtNode& rTxtNd = pTFld->GetTxtNode();
    2212                 :            : 
    2213                 :            :                 // immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
    2214                 :          0 :                 Point aPt;
    2215 [ #  # ][ #  # ]:          0 :                 const SwCntntFrm* pFrm = rTxtNd.getLayoutFrm( rTxtNd.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
    2216                 :            : 
    2217                 :            :                 _SetGetExpFld* pNew;
    2218                 :            : 
    2219 [ #  # ][ #  # ]:          0 :                 if( !pFrm ||
         [ #  # ][ #  # ]
    2220         [ #  # ]:          0 :                      pFrm->IsInDocBody() ||
    2221                 :            :                     // #i31868#
    2222                 :            :                     // Check if pFrm is not yet connected to the layout.
    2223         [ #  # ]:          0 :                     !pFrm->FindPageFrm() )
    2224                 :            :                 {
    2225                 :            :                     // einen sdbcx::Index fuers bestimmen vom TextNode anlegen
    2226         [ #  # ]:          0 :                     SwNodeIndex aIdx( rTxtNd );
    2227 [ #  # ][ #  # ]:          0 :                     pNew = new _SetGetExpFld( aIdx, pTFld );
                 [ #  # ]
    2228                 :            :                 }
    2229                 :            :                 else
    2230                 :            :                 {
    2231                 :            :                     // einen sdbcx::Index fuers bestimmen vom TextNode anlegen
    2232 [ #  # ][ #  # ]:          0 :                     SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() );
    2233         [ #  # ]:          0 :                     bool const bResult = GetBodyTxtNode( *pDoc, aPos, *pFrm );
    2234                 :            :                     OSL_ENSURE(bResult, "where is the Field?");
    2235                 :            :                     (void) bResult; // unused in non-debug
    2236                 :            :                     pNew = new _SetGetExpFld( aPos.nNode, pTFld,
    2237 [ #  # ][ #  # ]:          0 :                                                 &aPos.nContent );
                 [ #  # ]
    2238                 :            :                 }
    2239                 :            : 
    2240 [ #  # ][ #  # ]:          0 :                 if( !rTmpLst.insert( pNew ).second)
    2241                 :          0 :                     delete pNew;
    2242                 :            :             }
    2243                 :            :     }
    2244                 :            : 
    2245         [ #  # ]:          0 :     return rTmpLst.size();
    2246                 :            : }
    2247                 :            : 
    2248                 :          0 : void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld,
    2249                 :            :                                         _SetGetExpFlds& rSetList )
    2250                 :            : {
    2251                 :          0 :     SwRefPageGetField* pGetFld = (SwRefPageGetField*)pTxtFld->GetFld().GetFld();
    2252                 :          0 :     pGetFld->SetText( aEmptyStr );
    2253                 :            : 
    2254                 :            :     // dann suche mal das richtige RefPageSet-Field
    2255                 :          0 :     SwTxtNode* pTxtNode = (SwTxtNode*)&pTxtFld->GetTxtNode();
    2256         [ #  # ]:          0 :     if( pTxtNode->StartOfSectionIndex() >
    2257                 :          0 :         pDoc->GetNodes().GetEndOfExtras().GetIndex() )
    2258                 :            :     {
    2259         [ #  # ]:          0 :         SwNodeIndex aIdx( *pTxtNode );
    2260         [ #  # ]:          0 :         _SetGetExpFld aEndFld( aIdx, pTxtFld );
    2261                 :            : 
    2262         [ #  # ]:          0 :         _SetGetExpFlds::const_iterator itLast = rSetList.lower_bound( &aEndFld );
    2263                 :            : 
    2264 [ #  # ][ #  # ]:          0 :         if( itLast != rSetList.begin() )
    2265                 :            :         {
    2266                 :          0 :             --itLast;
    2267                 :          0 :             const SwTxtFld* pRefTxtFld = (*itLast)->GetFld();
    2268                 :            :             const SwRefPageSetField* pSetFld =
    2269                 :          0 :                         (SwRefPageSetField*)pRefTxtFld->GetFld().GetFld();
    2270         [ #  # ]:          0 :             if( pSetFld->IsOn() )
    2271                 :            :             {
    2272                 :            :                 // dann bestimme mal den entsp. Offset
    2273                 :          0 :                 Point aPt;
    2274 [ #  # ][ #  # ]:          0 :                 const SwCntntFrm* pFrm = pTxtNode->getLayoutFrm( pTxtNode->GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
    2275 [ #  # ][ #  # ]:          0 :                 const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().getLayoutFrm( pRefTxtFld->GetTxtNode().GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
    2276                 :          0 :                 const SwPageFrm* pPgFrm = 0;
    2277                 :            :                 sal_uInt16 nDiff = ( pFrm && pRefFrm )
    2278                 :          0 :                         ?   (pPgFrm = pFrm->FindPageFrm())->GetPhyPageNum() -
    2279         [ #  # ]:          0 :                             pRefFrm->FindPageFrm()->GetPhyPageNum() + 1
    2280 [ #  # ][ #  # ]:          0 :                         : 1;
                 [ #  # ]
    2281                 :            : 
    2282                 :          0 :                 sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat()
    2283                 :            :                         ? ( !pPgFrm
    2284                 :            :                                 ? (sal_uInt32)SVX_NUM_ARABIC
    2285                 :          0 :                                 : pPgFrm->GetPageDesc()->GetNumType().GetNumberingType() )
    2286 [ #  # ][ #  # ]:          0 :                         : pGetFld->GetFormat();
    2287                 :          0 :                 short nPageNum = static_cast<short>(Max(0, pSetFld->GetOffset() + (short)nDiff));
    2288 [ #  # ][ #  # ]:          0 :                 pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
                 [ #  # ]
    2289                 :            :             }
    2290         [ #  # ]:          0 :         }
    2291                 :            :     }
    2292                 :            :     // dann die Formatierung anstossen
    2293                 :          0 :     ((SwFmtFld&)pTxtFld->GetFld()).ModifyNotification( 0, 0 );
    2294                 :          0 : }
    2295                 :            : 
    2296                 :            : /*--------------------------------------------------------------------
    2297                 :            :     Beschreibung: Relative Seitennummerierung Abfragen
    2298                 :            :  --------------------------------------------------------------------*/
    2299                 :            : 
    2300                 :          0 : SwRefPageGetField::SwRefPageGetField( SwRefPageGetFieldType* pTyp,
    2301                 :            :                                     sal_uInt32 nFmt )
    2302         [ #  # ]:          0 :     : SwField( pTyp, nFmt )
    2303                 :            : {
    2304                 :          0 : }
    2305                 :            : 
    2306                 :          0 : String SwRefPageGetField::Expand() const
    2307                 :            : {
    2308                 :          0 :     return sTxt;
    2309                 :            : }
    2310                 :            : 
    2311                 :          0 : SwField* SwRefPageGetField::Copy() const
    2312                 :            : {
    2313                 :            :     SwRefPageGetField* pCpy = new SwRefPageGetField(
    2314         [ #  # ]:          0 :                         (SwRefPageGetFieldType*)GetTyp(), GetFormat() );
    2315                 :          0 :     pCpy->SetText( sTxt );
    2316                 :          0 :     return pCpy;
    2317                 :            : }
    2318                 :            : 
    2319                 :          0 : void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm,
    2320                 :            :                                         const SwTxtFld* pFld )
    2321                 :            : {
    2322                 :            :     // nur Felder in Footer, Header, FootNote, Flys
    2323                 :          0 :     SwTxtNode* pTxtNode = (SwTxtNode*)&pFld->GetTxtNode();
    2324                 :          0 :     SwRefPageGetFieldType* pGetType = (SwRefPageGetFieldType*)GetTyp();
    2325                 :          0 :     SwDoc* pDoc = pGetType->GetDoc();
    2326         [ #  # ]:          0 :     if( pFld->GetTxtNode().StartOfSectionIndex() >
    2327         [ #  # ]:          0 :         pDoc->GetNodes().GetEndOfExtras().GetIndex() )
    2328                 :            :         return;
    2329                 :            : 
    2330         [ #  # ]:          0 :     sTxt.Erase();
    2331                 :            : 
    2332                 :            :     OSL_ENSURE( !pFrm->IsInDocBody(), "Flag ist nicht richtig, Frame steht im DocBody" );
    2333                 :            : 
    2334                 :            :     // sammel erstmal alle SetPageRefFelder ein.
    2335         [ #  # ]:          0 :     _SetGetExpFlds aTmpLst;
    2336 [ #  # ][ #  # ]:          0 :     if( !pGetType->MakeSetList( aTmpLst ) )
    2337                 :            :         return ;
    2338                 :            : 
    2339                 :            :     // einen sdbcx::Index fuers bestimmen vom TextNode anlegen
    2340 [ #  # ][ #  # ]:          0 :     SwPosition aPos( SwNodeIndex( pDoc->GetNodes() ) );
         [ #  # ][ #  # ]
    2341         [ #  # ]:          0 :     pTxtNode = (SwTxtNode*) GetBodyTxtNode( *pDoc, aPos, *pFrm );
    2342                 :            : 
    2343                 :            :     // Wenn kein Layout vorhanden, kommt es in Kopf und Fusszeilen dazu
    2344                 :            :     // das ChangeExpansion uebers Layout-Formatieren aufgerufen wird
    2345                 :            :     // aber kein TxtNode vorhanden ist
    2346                 :            :     //
    2347         [ #  # ]:          0 :     if(!pTxtNode)
    2348                 :            :         return;
    2349                 :            : 
    2350         [ #  # ]:          0 :     _SetGetExpFld aEndFld( aPos.nNode, pFld, &aPos.nContent );
    2351                 :            : 
    2352         [ #  # ]:          0 :     _SetGetExpFlds::const_iterator itLast = aTmpLst.lower_bound( &aEndFld );
    2353                 :            : 
    2354 [ #  # ][ #  # ]:          0 :     if( itLast == aTmpLst.begin() )
    2355                 :            :         return;        // es gibt kein entsprechendes Set - Feld vor mir
    2356                 :          0 :     --itLast;
    2357                 :            : 
    2358                 :          0 :     const SwTxtFld* pRefTxtFld = (*itLast)->GetFld();
    2359                 :            :     const SwRefPageSetField* pSetFld =
    2360                 :          0 :                         (SwRefPageSetField*)pRefTxtFld->GetFld().GetFld();
    2361                 :          0 :     Point aPt;
    2362 [ #  # ][ #  # ]:          0 :     const SwCntntFrm* pRefFrm = pRefTxtFld ? pRefTxtFld->GetTxtNode().getLayoutFrm( pFrm->getRootFrm(), &aPt, 0, sal_False ) : 0;
    2363 [ #  # ][ #  # ]:          0 :     if( pSetFld->IsOn() && pRefFrm )
                 [ #  # ]
    2364                 :            :     {
    2365                 :            :         // dann bestimme mal den entsp. Offset
    2366         [ #  # ]:          0 :         const SwPageFrm* pPgFrm = pFrm->FindPageFrm();
    2367                 :          0 :         sal_uInt16 nDiff = pPgFrm->GetPhyPageNum() -
    2368         [ #  # ]:          0 :                             pRefFrm->FindPageFrm()->GetPhyPageNum() + 1;
    2369                 :            : 
    2370                 :          0 :         SwRefPageGetField* pGetFld = (SwRefPageGetField*)pFld->GetFld().GetFld();
    2371                 :          0 :         sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat()
    2372                 :          0 :                             ? pPgFrm->GetPageDesc()->GetNumType().GetNumberingType()
    2373         [ #  # ]:          0 :                             : pGetFld->GetFormat();
    2374                 :          0 :         short nPageNum = static_cast<short>(Max(0, pSetFld->GetOffset() + (short)nDiff ));
    2375 [ #  # ][ #  # ]:          0 :         pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
                 [ #  # ]
    2376 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
    2377                 :            : }
    2378                 :            : 
    2379                 :          0 : bool SwRefPageGetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    2380                 :            : {
    2381      [ #  #  # ]:          0 :     switch( nWhichId )
    2382                 :            :     {
    2383                 :            :         case FIELD_PROP_USHORT1:
    2384         [ #  # ]:          0 :             rAny <<= (sal_Int16)GetFormat();
    2385                 :          0 :         break;
    2386                 :            :         case FIELD_PROP_PAR1:
    2387         [ #  # ]:          0 :             rAny <<= OUString(sTxt);
    2388                 :          0 :         break;
    2389                 :            :         default:
    2390                 :            :             OSL_FAIL("illegal property");
    2391                 :            :     }
    2392                 :          0 :     return true;
    2393                 :            : }
    2394                 :            : 
    2395                 :          0 : bool SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    2396                 :            : {
    2397      [ #  #  # ]:          0 :     switch( nWhichId )
    2398                 :            :     {
    2399                 :            :         case FIELD_PROP_USHORT1:
    2400                 :            :         {
    2401                 :          0 :             sal_Int16 nSet = 0;
    2402                 :          0 :             rAny >>= nSet;
    2403         [ #  # ]:          0 :             if(nSet <= SVX_NUM_PAGEDESC )
    2404                 :          0 :                 SetFormat(nSet);
    2405                 :            :             else {
    2406                 :            :             }
    2407                 :            :         }
    2408                 :          0 :         break;
    2409                 :            :         case FIELD_PROP_PAR1:
    2410                 :            :         {
    2411                 :          0 :             OUString sTmp;
    2412                 :          0 :             rAny >>= sTmp;
    2413         [ #  # ]:          0 :             sTxt = sTmp;
    2414                 :            :         }
    2415                 :          0 :         break;
    2416                 :            :     default:
    2417                 :            :         OSL_FAIL("illegal property");
    2418                 :            :     }
    2419                 :          0 :     return true;
    2420                 :            : }
    2421                 :            : 
    2422                 :            : /*--------------------------------------------------------------------
    2423                 :            :     Beschreibung: Feld zum Anspringen und Editieren
    2424                 :            :  --------------------------------------------------------------------*/
    2425                 :            : 
    2426                 :       1549 : SwJumpEditFieldType::SwJumpEditFieldType( SwDoc* pD )
    2427         [ +  - ]:       1549 :     : SwFieldType( RES_JUMPEDITFLD ), pDoc( pD ), aDep( this, 0 )
    2428                 :            : {
    2429                 :       1549 : }
    2430                 :            : 
    2431                 :          0 : SwFieldType* SwJumpEditFieldType::Copy() const
    2432                 :            : {
    2433         [ #  # ]:          0 :     return new SwJumpEditFieldType( pDoc );
    2434                 :            : }
    2435                 :            : 
    2436                 :          7 : SwCharFmt* SwJumpEditFieldType::GetCharFmt()
    2437                 :            : {
    2438                 :          7 :     SwCharFmt* pFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_JUMPEDIT );
    2439                 :            : 
    2440                 :            :     // noch nicht registriert ?
    2441         [ +  + ]:          7 :     if( !aDep.GetRegisteredIn() )
    2442                 :          1 :         pFmt->Add( &aDep );     // anmelden
    2443                 :            : 
    2444                 :          7 :     return pFmt;
    2445                 :            : }
    2446                 :            : 
    2447                 :         78 : SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, sal_uInt32 nForm,
    2448                 :            :                                 const String& rTxt, const String& rHelp )
    2449 [ +  - ][ +  - ]:         78 :     : SwField( pTyp, nForm ), sTxt( rTxt ), sHelp( rHelp )
    2450                 :            : {
    2451                 :         78 : }
    2452                 :            : 
    2453                 :         21 : String SwJumpEditField::Expand() const
    2454                 :            : {
    2455         [ +  - ]:         42 :     return rtl::OUStringBuffer().append('<').
    2456 [ +  - ][ +  - ]:         42 :         append(sTxt).append('>').makeStringAndClear();
         [ +  - ][ +  - ]
    2457                 :            : }
    2458                 :            : 
    2459                 :         64 : SwField* SwJumpEditField::Copy() const
    2460                 :            : {
    2461                 :        128 :     return new SwJumpEditField( (SwJumpEditFieldType*)GetTyp(), GetFormat(),
    2462 [ +  - ][ +  - ]:         64 :                                 sTxt, sHelp );
         [ +  - ][ +  - ]
    2463                 :            : }
    2464                 :            : 
    2465                 :            : // Platzhalter-Text
    2466                 :            : 
    2467                 :          0 : const rtl::OUString& SwJumpEditField::GetPar1() const
    2468                 :            : {
    2469                 :          0 :     return sTxt;
    2470                 :            : }
    2471                 :            : 
    2472                 :          0 : void SwJumpEditField::SetPar1(const rtl::OUString& rStr)
    2473                 :            : {
    2474                 :          0 :     sTxt = rStr;
    2475                 :          0 : }
    2476                 :            : 
    2477                 :            : // HinweisText
    2478                 :            : 
    2479                 :          0 : rtl::OUString SwJumpEditField::GetPar2() const
    2480                 :            : {
    2481                 :          0 :     return sHelp;
    2482                 :            : }
    2483                 :            : 
    2484                 :          0 : void SwJumpEditField::SetPar2(const rtl::OUString& rStr)
    2485                 :            : {
    2486                 :          0 :     sHelp = rStr;
    2487                 :          0 : }
    2488                 :            : 
    2489                 :          0 : bool SwJumpEditField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
    2490                 :            : {
    2491   [ #  #  #  # ]:          0 :     switch( nWhichId )
    2492                 :            :     {
    2493                 :            :     case FIELD_PROP_USHORT1:
    2494                 :            :         {
    2495                 :            :             sal_Int16 nRet;
    2496   [ #  #  #  #  :          0 :             switch( GetFormat() )
                      # ]
    2497                 :            :             {
    2498                 :          0 :             case JE_FMT_TABLE:  nRet = text::PlaceholderType::TABLE; break;
    2499                 :          0 :             case JE_FMT_FRAME:  nRet = text::PlaceholderType::TEXTFRAME; break;
    2500                 :          0 :             case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
    2501                 :          0 :             case JE_FMT_OLE:    nRet = text::PlaceholderType::OBJECT; break;
    2502                 :            :             default:
    2503                 :          0 :                 nRet = text::PlaceholderType::TEXT; break;
    2504                 :            :             }
    2505         [ #  # ]:          0 :             rAny <<= nRet;
    2506                 :            :         }
    2507                 :          0 :         break;
    2508                 :            :     case FIELD_PROP_PAR1 :
    2509         [ #  # ]:          0 :         rAny <<= OUString(sHelp);
    2510                 :          0 :         break;
    2511                 :            :     case FIELD_PROP_PAR2 :
    2512         [ #  # ]:          0 :          rAny <<= OUString(sTxt);
    2513                 :          0 :          break;
    2514                 :            :     default:
    2515                 :            :         OSL_FAIL("illegal property");
    2516                 :            :     }
    2517                 :          0 :     return true;
    2518                 :            : }
    2519                 :            : 
    2520                 :          0 : bool SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
    2521                 :            : {
    2522   [ #  #  #  # ]:          0 :     switch( nWhichId )
    2523                 :            :     {
    2524                 :            :     case FIELD_PROP_USHORT1:
    2525                 :            :         {
    2526                 :            :             //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
    2527                 :            :             //              called with a int32 value! But normally we need
    2528                 :            :             //              here only a int16
    2529                 :          0 :             sal_Int32 nSet = 0;
    2530                 :          0 :             rAny >>= nSet;
    2531   [ #  #  #  #  :          0 :             switch( nSet )
                   #  # ]
    2532                 :            :             {
    2533                 :          0 :                 case text::PlaceholderType::TEXT     : SetFormat(JE_FMT_TEXT); break;
    2534                 :          0 :                 case text::PlaceholderType::TABLE    : SetFormat(JE_FMT_TABLE); break;
    2535                 :          0 :                 case text::PlaceholderType::TEXTFRAME: SetFormat(JE_FMT_FRAME); break;
    2536                 :          0 :                 case text::PlaceholderType::GRAPHIC  : SetFormat(JE_FMT_GRAPHIC); break;
    2537                 :          0 :                 case text::PlaceholderType::OBJECT   : SetFormat(JE_FMT_OLE); break;
    2538                 :            :             }
    2539                 :            :         }
    2540                 :          0 :         break;
    2541                 :            :     case FIELD_PROP_PAR1 :
    2542                 :          0 :         rAny >>= sHelp;
    2543                 :          0 :         break;
    2544                 :            :     case FIELD_PROP_PAR2 :
    2545                 :          0 :          rAny >>= sTxt;
    2546                 :          0 :          break;
    2547                 :            :     default:
    2548                 :            :         OSL_FAIL("illegal property");
    2549                 :            :     }
    2550                 :          0 :     return true;
    2551                 :            : }
    2552                 :            : 
    2553                 :            : 
    2554                 :            : /*--------------------------------------------------------------------
    2555                 :            :     Beschreibung: Combined Character Fieldtype / Field
    2556                 :            :  --------------------------------------------------------------------*/
    2557                 :            : 
    2558                 :       1549 : SwCombinedCharFieldType::SwCombinedCharFieldType()
    2559                 :       1549 :     : SwFieldType( RES_COMBINED_CHARS )
    2560                 :            : {
    2561                 :       1549 : }
    2562                 :            : 
    2563                 :          0 : SwFieldType* SwCombinedCharFieldType::Copy() const
    2564                 :            : {
    2565         [ #  # ]:          0 :     return new SwCombinedCharFieldType;
    2566                 :            : }
    2567                 :            : 
    2568                 :            : /* --------------------------------------------------------------------*/
    2569                 :            : 
    2570                 :          0 : SwCombinedCharField::SwCombinedCharField( SwCombinedCharFieldType* pFTyp,
    2571                 :            :                                             const String& rChars )
    2572                 :            :     : SwField( pFTyp, 0 ),
    2573 [ #  # ][ #  # ]:          0 :     sCharacters( rChars.Copy( 0, MAX_COMBINED_CHARACTERS ))
                 [ #  # ]
    2574                 :            : {
    2575                 :          0 : }
    2576                 :            : 
    2577                 :          0 : String  SwCombinedCharField::Expand() const
    2578                 :            : {
    2579                 :          0 :     return sCharacters;
    2580                 :            : }
    2581                 :            : 
    2582                 :          0 : SwField* SwCombinedCharField::Copy() const
    2583                 :            : {
    2584                 :          0 :     return new SwCombinedCharField( (SwCombinedCharFieldType*)GetTyp(),
    2585 [ #  # ][ #  # ]:          0 :                                         sCharacters );
    2586                 :            : }
    2587                 :            : 
    2588                 :          0 : const rtl::OUString& SwCombinedCharField::GetPar1() const
    2589                 :            : {
    2590                 :          0 :     return sCharacters;
    2591                 :            : }
    2592                 :            : 
    2593                 :          0 : void SwCombinedCharField::SetPar1(const rtl::OUString& rStr)
    2594                 :            : {
    2595         [ #  # ]:          0 :     sCharacters = rStr.copy(0, std::min<sal_Int32>(rStr.getLength(), MAX_COMBINED_CHARACTERS));
    2596                 :          0 : }
    2597                 :            : 
    2598                 :          0 : bool SwCombinedCharField::QueryValue( uno::Any& rAny,
    2599                 :            :                                         sal_uInt16 nWhichId ) const
    2600                 :            : {
    2601         [ #  # ]:          0 :     switch( nWhichId )
    2602                 :            :     {
    2603                 :            :     case FIELD_PROP_PAR1:
    2604         [ #  # ]:          0 :         rAny <<= rtl::OUString( sCharacters );
    2605                 :          0 :         break;
    2606                 :            :     default:
    2607                 :            :         OSL_FAIL("illegal property");
    2608                 :            :     }
    2609                 :          0 :     return true;
    2610                 :            : }
    2611                 :            : 
    2612                 :          0 : bool SwCombinedCharField::PutValue( const uno::Any& rAny,
    2613                 :            :                                         sal_uInt16 nWhichId )
    2614                 :            : {
    2615         [ #  # ]:          0 :     switch( nWhichId )
    2616                 :            :     {
    2617                 :            :         case FIELD_PROP_PAR1:
    2618                 :            :         {
    2619                 :          0 :             rtl::OUString sTmp;
    2620                 :          0 :             rAny >>= sTmp;
    2621         [ #  # ]:          0 :             SetPar1(sTmp);
    2622                 :            :         }
    2623                 :          0 :         break;
    2624                 :            :         default:
    2625                 :            :             OSL_FAIL("illegal property");
    2626                 :            :     }
    2627                 :          0 :     return true;
    2628                 :            : }
    2629                 :            : 
    2630                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10