LCOV - code coverage report
Current view: top level - sw/source/ui/fldui - flddinf.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 228 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <sfx2/request.hxx>
      30                 :            : #include <sfx2/frame.hxx>
      31                 :            : #include <vcl/svapp.hxx>
      32                 :            : #include <svl/zforlist.hxx>
      33                 :            : #include <svl/zformat.hxx>
      34                 :            : 
      35                 :            : #include <helpid.h>
      36                 :            : #include <swtypes.hxx>
      37                 :            : #include <globals.hrc>
      38                 :            : #include <fldbas.hxx>
      39                 :            : #include <docufld.hxx>
      40                 :            : #include <wrtsh.hxx>
      41                 :            : 
      42                 :            : #include <fldui.hrc>
      43                 :            : 
      44                 :            : #include <fldtdlg.hrc>
      45                 :            : #include <flddinf.hxx>
      46                 :            : #include <swmodule.hxx>
      47                 :            : #include <view.hxx>
      48                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      49                 :            : #include <com/sun/star/util/Time.hpp>
      50                 :            : #include <com/sun/star/util/DateTime.hpp>
      51                 :            : #include <com/sun/star/util/Date.hpp>
      52                 :            : 
      53                 :            : #define USER_DATA_VERSION_1 "1"
      54                 :            : #define USER_DATA_VERSION USER_DATA_VERSION_1
      55                 :            : 
      56                 :            : using namespace nsSwDocInfoSubType;
      57                 :            : using namespace com::sun::star;
      58                 :            : 
      59                 :          0 : SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
      60                 :            :     SwFldPage( pWindow, SW_RES( TP_FLD_DOKINF ), rCoreSet ),
      61                 :            : 
      62                 :            :     aTypeFT     (this, SW_RES(FT_DOKINFTYPE)),
      63                 :            :     aTypeTLB    (this, SW_RES(TLB_DOKINFTYPE)),
      64                 :            :     aSelectionFT(this, SW_RES(FT_DOKINFSELECTION)),
      65                 :            :     aSelectionLB(this, SW_RES(LB_DOKINFSELECTION)),
      66                 :            :     aFormatFT   (this, SW_RES(FT_DOKINFFORMAT)),
      67                 :            :     aFormatLB   (this, SW_RES(LB_DOKINFFORMAT)),
      68                 :            :     aFixedCB    (this, SW_RES(CB_DOKINFFIXEDCONTENT)),
      69                 :            : 
      70                 :            :     pSelEntry   (0),
      71                 :          0 :     aInfoStr    (SW_RES(STR_DOKINF_INFO))
      72                 :            : {
      73                 :          0 :     FreeResource();
      74                 :            : 
      75                 :          0 :     aTypeTLB.SetHelpId(HID_FIELD_DINF_TYPE);
      76                 :          0 :     aTypeTLB.SetSelectionMode(SINGLE_SELECTION);
      77                 :          0 :     aTypeTLB.SetStyle(aTypeTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
      78                 :            :     // Don't set font, so that the control's font is adobted!
      79                 :            :     // Otherwise at wrong font bug to OV.
      80                 :          0 :     aTypeTLB.SetSpaceBetweenEntries(0);
      81                 :            : 
      82                 :          0 :     aTypeTLB.SetNodeDefaultImages();
      83                 :            :     //enable 'active' language selection
      84                 :          0 :     aFormatLB.SetShowLanguageControl(sal_True);
      85                 :            : 
      86                 :          0 :     SFX_ITEMSET_ARG( &rCoreSet, pItem, SfxUnoAnyItem, SID_DOCINFO, sal_False );
      87                 :          0 :     if ( pItem )
      88                 :          0 :         pItem->GetValue() >>= xCustomPropertySet;
      89                 :          0 : }
      90                 :            : 
      91                 :          0 : SwFldDokInfPage::~SwFldDokInfPage()
      92                 :            : {
      93                 :          0 : }
      94                 :            : 
      95                 :          0 : void SwFldDokInfPage::Reset(const SfxItemSet& )
      96                 :            : {
      97                 :          0 :     Init(); // general initialisation
      98                 :            : 
      99                 :            :     // initialise TypeListBox
     100                 :          0 :     aTypeTLB.SetUpdateMode(sal_False);
     101                 :          0 :     aTypeTLB.Clear();
     102                 :          0 :     pSelEntry = 0;
     103                 :            : 
     104                 :            :     // display SubTypes in TypeLB
     105                 :          0 :     sal_uInt16 nTypeId = TYP_DOCINFOFLD;
     106                 :          0 :     SvLBoxEntry* pEntry = 0;
     107                 :            : 
     108                 :          0 :     SvLBoxEntry* pInfo = 0;
     109                 :            : 
     110                 :          0 :     sal_uInt16 nSubType = USHRT_MAX;
     111                 :          0 :     if (IsFldEdit())
     112                 :            :     {
     113                 :          0 :         const SwField* pCurField = GetCurField();
     114                 :          0 :         nSubType = ((SwDocInfoField*)pCurField)->GetSubType() & 0xff;
     115                 :          0 :         if( nSubType == DI_CUSTOM )
     116                 :            :         {
     117                 :          0 :             m_sOldCustomFieldName = static_cast<const SwDocInfoField*>(pCurField)->GetName();
     118                 :            :         }
     119                 :          0 :         aFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
     120                 :          0 :         SwWrtShell *pSh = GetWrtShell();
     121                 :          0 :         if(pSh)
     122                 :            :         {
     123                 :          0 :             const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
     124                 :          0 :             if(pFormat)
     125                 :          0 :                 aFormatLB.SetLanguage(pFormat->GetLanguage());
     126                 :            :         }
     127                 :            :     }
     128                 :            : 
     129                 :          0 :     sal_uInt16 nSelEntryData = USHRT_MAX;
     130                 :          0 :     String sUserData = GetUserData();
     131                 :          0 :     if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
     132                 :            :     {
     133                 :          0 :         String sVal = sUserData.GetToken(1, ';');
     134                 :          0 :         nSelEntryData = static_cast< sal_uInt16 >(sVal.ToInt32());
     135                 :            :     }
     136                 :            : 
     137                 :          0 :     std::vector<rtl::OUString> aLst;
     138                 :          0 :     GetFldMgr().GetSubTypes(nTypeId, aLst);
     139                 :          0 :     for(size_t i = 0; i < aLst.size(); ++i)
     140                 :            :     {
     141                 :          0 :         if (!IsFldEdit() || nSubType == i)
     142                 :            :         {
     143                 :          0 :             if (DI_CUSTOM == i)
     144                 :            :             {
     145                 :          0 :                 if(xCustomPropertySet.is() )
     146                 :            :                 {
     147                 :          0 :                     uno::Reference< beans::XPropertySetInfo > xSetInfo = xCustomPropertySet->getPropertySetInfo();
     148                 :          0 :                     const uno::Sequence< beans::Property > rProperties = xSetInfo->getProperties();
     149                 :            : 
     150                 :          0 :                     if( rProperties.getLength() )
     151                 :            :                     {
     152                 :          0 :                         pInfo = aTypeTLB.InsertEntry( String(SW_RES( STR_CUSTOM )) );
     153                 :          0 :                         pInfo->SetUserData(reinterpret_cast<void*>(USHRT_MAX));
     154                 :            : 
     155                 :          0 :                         for (sal_Int32 n=0; n < rProperties.getLength(); n++)
     156                 :            :                         {
     157                 :          0 :                             rtl::OUString sEntry = rProperties[n].Name;
     158                 :          0 :                             pEntry = aTypeTLB.InsertEntry(sEntry, pInfo);
     159                 :          0 :                             if(m_sOldCustomFieldName.equals( sEntry ))
     160                 :            :                             {
     161                 :          0 :                                 pSelEntry = pEntry;
     162                 :          0 :                                 aTypeTLB.Expand( pInfo );
     163                 :            :                             }
     164                 :          0 :                             pEntry->SetUserData(reinterpret_cast<void*>(i));
     165                 :          0 :                         }
     166                 :          0 :                     }
     167                 :            :                 }
     168                 :            :             }
     169                 :            :             else
     170                 :            :             {
     171                 :          0 :                 if (!(IsFldDlgHtmlMode() && (i == DI_EDIT || i == DI_THEMA || i == DI_PRINT)))
     172                 :            :                 {
     173                 :          0 :                     pEntry = aTypeTLB.InsertEntry(aLst[i]);
     174                 :          0 :                     pEntry->SetUserData(reinterpret_cast<void*>(i));
     175                 :            :                 }
     176                 :            :             }
     177                 :          0 :             if(nSelEntryData == i)
     178                 :          0 :                 pSelEntry = pEntry;
     179                 :            :         }
     180                 :            :     }
     181                 :            : 
     182                 :            :     // select old Pos
     183                 :          0 :     if (pSelEntry != 0)
     184                 :            :     {
     185                 :          0 :         aTypeTLB.Select(pSelEntry);
     186                 :          0 :         nSubType = (sal_uInt16)(sal_uLong)pSelEntry->GetUserData();
     187                 :            :     }
     188                 :          0 :     else if ( aTypeTLB.GetEntry(0) )
     189                 :            :     {
     190                 :          0 :         pSelEntry = aTypeTLB.GetEntry(0);
     191                 :          0 :         nSubType = (sal_uInt16)(sal_uLong)pSelEntry->GetUserData();
     192                 :            :     }
     193                 :            : 
     194                 :          0 :     FillSelectionLB(nSubType);
     195                 :          0 :     if ( pSelEntry )
     196                 :          0 :         TypeHdl();
     197                 :            : 
     198                 :          0 :     aTypeTLB.SetUpdateMode(sal_True);
     199                 :          0 :     aTypeTLB.SetSelectHdl(LINK(this, SwFldDokInfPage, TypeHdl));
     200                 :          0 :     aTypeTLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
     201                 :          0 :     aSelectionLB.SetSelectHdl(LINK(this, SwFldDokInfPage, SubTypeHdl));
     202                 :          0 :     aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
     203                 :          0 :     aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
     204                 :            : 
     205                 :          0 :     if (IsFldEdit())
     206                 :            :     {
     207                 :          0 :         nOldSel = aSelectionLB.GetSelectEntryPos();
     208                 :          0 :         nOldFormat = GetCurField()->GetFormat();
     209                 :          0 :         aFixedCB.SaveValue();
     210                 :          0 :     }
     211                 :          0 : }
     212                 :            : 
     213                 :          0 : IMPL_LINK_NOARG(SwFldDokInfPage, TypeHdl)
     214                 :            : {
     215                 :            :     // save old ListBoxPos
     216                 :          0 :     SvLBoxEntry* pOldEntry = pSelEntry;
     217                 :            : 
     218                 :            :     // current ListBoxPos
     219                 :          0 :     pSelEntry = aTypeTLB.FirstSelected();
     220                 :            : 
     221                 :          0 :     if(!pSelEntry)
     222                 :            :     {
     223                 :          0 :         pSelEntry = aTypeTLB.GetEntry(0);
     224                 :          0 :         aTypeTLB.Select(pSelEntry);
     225                 :            :     }
     226                 :            :     else
     227                 :            : 
     228                 :          0 :     if (pOldEntry != pSelEntry)
     229                 :          0 :         FillSelectionLB((sal_uInt16)(sal_uLong)pSelEntry->GetUserData());
     230                 :            : 
     231                 :          0 :     SubTypeHdl();
     232                 :            : 
     233                 :          0 :     return 0;
     234                 :            : }
     235                 :            : 
     236                 :          0 : IMPL_LINK_NOARG(SwFldDokInfPage, SubTypeHdl)
     237                 :            : {
     238                 :          0 :     sal_uInt16 nSubType = (sal_uInt16)(sal_uLong)pSelEntry->GetUserData();
     239                 :          0 :     sal_uInt16 nPos = aSelectionLB.GetSelectEntryPos();
     240                 :            :     sal_uInt16 nExtSubType;
     241                 :          0 :     sal_uInt16 nNewType = 0;
     242                 :            : 
     243                 :          0 :     if (nSubType != DI_EDIT)
     244                 :            :     {
     245                 :          0 :         if (nPos == LISTBOX_ENTRY_NOTFOUND)
     246                 :            :         {
     247                 :          0 :             if (!aSelectionLB.GetEntryCount())
     248                 :            :             {
     249                 :          0 :                 aFormatLB.Clear();
     250                 :          0 :                 aFormatLB.Enable(sal_False);
     251                 :          0 :                 aFormatFT.Enable(sal_False);
     252                 :          0 :                 if( nSubType == DI_CUSTOM )
     253                 :            :                 {
     254                 :            :                     //find out which type the custom field has - for a start set to DATE format
     255                 :          0 :                     ::rtl::OUString sName = aTypeTLB.GetEntryText(pSelEntry);
     256                 :            :                     try
     257                 :            :                     {
     258                 :          0 :                         uno::Any aVal = xCustomPropertySet->getPropertyValue( sName );
     259                 :          0 :                         const uno::Type& rValueType = aVal.getValueType();
     260                 :          0 :                         if( rValueType == ::getCppuType( (util::DateTime*)0 ))
     261                 :            :                         {
     262                 :          0 :                             nNewType = NUMBERFORMAT_DATETIME;
     263                 :            :                         }
     264                 :          0 :                         else if( rValueType == ::getCppuType( (util::Date*)0 ))
     265                 :            :                         {
     266                 :          0 :                             nNewType = NUMBERFORMAT_DATE;
     267                 :            :                         }
     268                 :          0 :                         else if( rValueType == ::getCppuType( (util::Time*)0 ))
     269                 :            :                         {
     270                 :          0 :                             nNewType = NUMBERFORMAT_TIME;
     271                 :          0 :                         }
     272                 :            :                     }
     273                 :          0 :                     catch( const uno::Exception& )
     274                 :            :                     {
     275                 :          0 :                     }
     276                 :            :                 }
     277                 :            :                 else
     278                 :          0 :                     return 0;
     279                 :            :             }
     280                 :          0 :             nPos = 0;
     281                 :            :         }
     282                 :            : 
     283                 :          0 :         nExtSubType = (sal_uInt16)(sal_uLong)aSelectionLB.GetEntryData(nPos);
     284                 :            :     }
     285                 :            :     else
     286                 :          0 :         nExtSubType = DI_SUB_TIME;
     287                 :            : 
     288                 :          0 :     sal_uInt16 nOldType = 0;
     289                 :          0 :     sal_Bool bEnable = sal_False;
     290                 :          0 :     sal_Bool bOneArea = sal_False;
     291                 :            : 
     292                 :          0 :     if (aFormatLB.IsEnabled())
     293                 :          0 :         nOldType = aFormatLB.GetFormatType();
     294                 :            : 
     295                 :          0 :     switch (nExtSubType)
     296                 :            :     {
     297                 :            :         case DI_SUB_AUTHOR:
     298                 :          0 :             break;
     299                 :            : 
     300                 :            :         case DI_SUB_DATE:
     301                 :          0 :             nNewType = NUMBERFORMAT_DATE;
     302                 :          0 :             bOneArea = sal_True;
     303                 :          0 :             break;
     304                 :            : 
     305                 :            :         case DI_SUB_TIME:
     306                 :          0 :             nNewType = NUMBERFORMAT_TIME;
     307                 :          0 :             bOneArea = sal_True;
     308                 :          0 :             break;
     309                 :            :     }
     310                 :          0 :     if (!nNewType)
     311                 :            :     {
     312                 :          0 :         aFormatLB.Clear();
     313                 :            :     }
     314                 :            :     else
     315                 :            :     {
     316                 :          0 :         if (nOldType != nNewType)
     317                 :            :         {
     318                 :          0 :             aFormatLB.SetFormatType(nNewType);
     319                 :          0 :             aFormatLB.SetOneArea(bOneArea);
     320                 :            :         }
     321                 :          0 :         bEnable = sal_True;
     322                 :            :     }
     323                 :            : 
     324                 :          0 :     sal_uLong nFormat = IsFldEdit() ? ((SwDocInfoField*)GetCurField())->GetFormat() : 0;
     325                 :            : 
     326                 :          0 :     sal_uInt16 nOldSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
     327                 :            : 
     328                 :          0 :     if (IsFldEdit())
     329                 :            :     {
     330                 :          0 :         nPos = aSelectionLB.GetSelectEntryPos();
     331                 :          0 :         if (nPos != LISTBOX_ENTRY_NOTFOUND )
     332                 :            :         {
     333                 :          0 :             nSubType = (sal_uInt16)(sal_uLong)aSelectionLB.GetEntryData(nPos);
     334                 :            : 
     335                 :          0 :             nOldSubType &= ~DI_SUB_FIXED;
     336                 :          0 :             if (nOldSubType == nSubType)
     337                 :            :             {
     338                 :          0 :                 if (!nFormat && (nNewType == NUMBERFORMAT_DATE || nNewType == NUMBERFORMAT_TIME))
     339                 :            :                 {
     340                 :          0 :                     SwWrtShell *pSh = GetWrtShell();
     341                 :          0 :                     if(pSh)
     342                 :            :                     {
     343                 :          0 :                         SvNumberFormatter* pFormatter = pSh->GetNumberFormatter();
     344                 :          0 :                         LanguageType eLang = aFormatLB.GetCurLanguage();
     345                 :          0 :                         if (nNewType == NUMBERFORMAT_DATE)
     346                 :          0 :                             nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang);
     347                 :          0 :                         else if (nNewType == NUMBERFORMAT_TIME)
     348                 :          0 :                             nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang);
     349                 :            :                     }
     350                 :            :                 }
     351                 :          0 :                 aFormatLB.SetDefFormat(nFormat);
     352                 :            :             }
     353                 :            :         }
     354                 :          0 :         else if( (nSubType == DI_CUSTOM)  && (nNewType != 0) )
     355                 :            :         {
     356                 :          0 :             aFormatLB.SetDefFormat(nFormat);
     357                 :            :         }
     358                 :            :     }
     359                 :            : 
     360                 :          0 :     aFormatLB.Enable(bEnable);
     361                 :          0 :     aFormatFT.Enable(bEnable);
     362                 :            : 
     363                 :          0 :     if (bEnable && aFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
     364                 :            :     {
     365                 :          0 :         aFormatLB.SelectEntryPos(0);
     366                 :            :     }
     367                 :            : 
     368                 :          0 :     return 0;
     369                 :            : }
     370                 :            : 
     371                 :          0 : sal_uInt16 SwFldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
     372                 :            : {
     373                 :            :     // fill Format-Listbox
     374                 :          0 :     sal_uInt16 nTypeId = TYP_DOCINFOFLD;
     375                 :            : 
     376                 :          0 :     EnableInsert(nSubType != USHRT_MAX);
     377                 :            : 
     378                 :          0 :     if (nSubType == USHRT_MAX)  // Info-Text
     379                 :          0 :         nSubType = DI_SUBTYPE_BEGIN;
     380                 :            : 
     381                 :          0 :     aSelectionLB.Clear();
     382                 :            : 
     383                 :          0 :     sal_uInt16 nSize = 0;
     384                 :          0 :     sal_uInt16 nSelPos = USHRT_MAX;
     385                 :          0 :     sal_uInt16 nExtSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
     386                 :            : 
     387                 :          0 :     if (IsFldEdit())
     388                 :            :     {
     389                 :          0 :         aFixedCB.Check((nExtSubType & DI_SUB_FIXED) != 0);
     390                 :          0 :         nExtSubType = ((nExtSubType & ~DI_SUB_FIXED) >> 8) - 1;
     391                 :            :     }
     392                 :            : 
     393                 :          0 :     if (nSubType < DI_CREATE || nSubType == DI_DOCNO || nSubType == DI_EDIT|| nSubType == DI_CUSTOM )
     394                 :            :     {
     395                 :            :         // Format Box is empty for Title and Time
     396                 :            :     }
     397                 :            :     else
     398                 :            :     {
     399                 :          0 :         nSize = GetFldMgr().GetFormatCount(nTypeId, sal_False, IsFldDlgHtmlMode());
     400                 :          0 :         for (sal_uInt16 i = 0; i < nSize; i++)
     401                 :            :         {
     402                 :          0 :             sal_uInt16 nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
     403                 :          0 :             aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId(nTypeId, i)));
     404                 :          0 :             if (IsFldEdit() && i == nExtSubType)
     405                 :          0 :                 nSelPos = nPos;
     406                 :            :         }
     407                 :            :     }
     408                 :            : 
     409                 :          0 :     sal_Bool bEnable = nSize != 0;
     410                 :            : 
     411                 :          0 :     if (nSize)
     412                 :            :     {
     413                 :          0 :         if (!aSelectionLB.GetSelectEntryCount())
     414                 :          0 :             aSelectionLB.SelectEntryPos(nSelPos == USHRT_MAX ? 0 : nSelPos);
     415                 :            : 
     416                 :          0 :         bEnable = sal_True;
     417                 :            :     }
     418                 :            : 
     419                 :          0 :     aSelectionFT.Enable(bEnable);
     420                 :          0 :     aSelectionLB.Enable(bEnable);
     421                 :            : 
     422                 :          0 :     return nSize;
     423                 :            : }
     424                 :            : 
     425                 :          0 : sal_Bool SwFldDokInfPage::FillItemSet(SfxItemSet& )
     426                 :            : {
     427                 :          0 :     if (!pSelEntry || (sal_uInt16)(sal_uLong)pSelEntry->GetUserData() == USHRT_MAX)
     428                 :          0 :         return sal_False;
     429                 :            : 
     430                 :          0 :     sal_uInt16 nTypeId = TYP_DOCINFOFLD;
     431                 :          0 :     sal_uInt16 nSubType = (sal_uInt16)(sal_uLong)pSelEntry->GetUserData();
     432                 :            : 
     433                 :          0 :     sal_uLong nFormat = 0;
     434                 :            : 
     435                 :          0 :     sal_uInt16 nPos = aSelectionLB.GetSelectEntryPos();
     436                 :            : 
     437                 :          0 :     ::rtl::OUString aName;
     438                 :          0 :     if (DI_CUSTOM == nSubType)
     439                 :          0 :         aName = aTypeTLB.GetEntryText(pSelEntry);
     440                 :            : 
     441                 :          0 :     if (nPos != LISTBOX_ENTRY_NOTFOUND)
     442                 :          0 :         nSubType |= (sal_uInt16)(sal_uLong)aSelectionLB.GetEntryData(nPos);
     443                 :            : 
     444                 :          0 :     if (aFixedCB.IsChecked())
     445                 :          0 :         nSubType |= DI_SUB_FIXED;
     446                 :            : 
     447                 :          0 :     nPos = aFormatLB.GetSelectEntryPos();
     448                 :          0 :     if(nPos != LISTBOX_ENTRY_NOTFOUND)
     449                 :          0 :         nFormat = aFormatLB.GetFormat();
     450                 :            : 
     451                 :          0 :     if (!IsFldEdit() || nOldSel != aSelectionLB.GetSelectEntryPos() ||
     452                 :          0 :         nOldFormat != nFormat || aFixedCB.GetState() != aFixedCB.GetSavedValue()
     453                 :          0 :         || (DI_CUSTOM == nSubType && !aName.equals( m_sOldCustomFieldName )))
     454                 :            :     {
     455                 :            :         InsertFld(nTypeId, nSubType, aName, aEmptyStr, nFormat,
     456                 :          0 :                 ' ', aFormatLB.IsAutomaticLanguage());
     457                 :            :     }
     458                 :            : 
     459                 :          0 :     return sal_False;
     460                 :            : }
     461                 :            : 
     462                 :          0 : SfxTabPage* SwFldDokInfPage::Create(    Window* pParent,
     463                 :            :                         const SfxItemSet& rAttrSet )
     464                 :            : {
     465                 :          0 :     return ( new SwFldDokInfPage( pParent, rAttrSet ) );
     466                 :            : }
     467                 :            : 
     468                 :          0 : sal_uInt16 SwFldDokInfPage::GetGroup()
     469                 :            : {
     470                 :          0 :     return GRP_REG;
     471                 :            : }
     472                 :            : 
     473                 :          0 : void    SwFldDokInfPage::FillUserData()
     474                 :            : {
     475                 :          0 :     String sData(rtl::OUString(USER_DATA_VERSION));
     476                 :          0 :     sData += ';';
     477                 :          0 :     SvLBoxEntry* pEntry = aTypeTLB.FirstSelected();
     478                 :          0 :     sal_uInt16 nTypeSel = pEntry ? sal::static_int_cast< sal_uInt16 >(reinterpret_cast< sal_uIntPtr >(pEntry->GetUserData())) : USHRT_MAX;
     479                 :          0 :     sData += String::CreateFromInt32( nTypeSel );
     480                 :          0 :     SetUserData(sData);
     481                 :          0 : }
     482                 :            : 
     483                 :            : 
     484                 :            : 
     485                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10