LCOV - code coverage report
Current view: top level - sw/source/ui/envelp - label1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 550 0.0 %
Date: 2012-08-25 Functions: 0 64 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 <vcl/waitobj.hxx>
      30                 :            : #include <rtl/ustring.hxx>
      31                 :            : #include <com/sun/star/uno/Sequence.h>
      32                 :            : #include <swtypes.hxx>
      33                 :            : #include <wrtsh.hxx>
      34                 :            : #include <initui.hxx>
      35                 :            : #include <labimp.hxx>
      36                 :            : #include <labfmt.hxx>
      37                 :            : #include <labprt.hxx>
      38                 :            : #include <unotools.hxx>
      39                 :            : #include <dbmgr.hxx>
      40                 :            : #include "uitool.hxx"
      41                 :            : #include <cmdid.h>
      42                 :            : #include <helpid.h>
      43                 :            : #include <globals.hrc>
      44                 :            : #include <label.hrc>
      45                 :            : 
      46                 :            : //impl in envimg.cxx
      47                 :            : extern SW_DLLPUBLIC String MakeSender();
      48                 :            : 
      49                 :            : 
      50                 :          0 : void SwLabRec::SetFromItem( const SwLabItem& rItem )
      51                 :            : {
      52                 :          0 :     lHDist  = rItem.lHDist;
      53                 :          0 :     lVDist  = rItem.lVDist;
      54                 :          0 :     lWidth  = rItem.lWidth;
      55                 :          0 :     lHeight = rItem.lHeight;
      56                 :          0 :     lLeft   = rItem.lLeft;
      57                 :          0 :     lUpper  = rItem.lUpper;
      58                 :          0 :     nCols   = rItem.nCols;
      59                 :          0 :     nRows   = rItem.nRows;
      60                 :          0 :     lPWidth  = rItem.lPWidth;
      61                 :          0 :     lPHeight = rItem.lPHeight;
      62                 :          0 :     bCont   = rItem.bCont;
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : void SwLabRec::FillItem( SwLabItem& rItem ) const
      66                 :            : {
      67                 :          0 :     rItem.lHDist  = lHDist;
      68                 :          0 :     rItem.lVDist  = lVDist;
      69                 :          0 :     rItem.lWidth  = lWidth;
      70                 :          0 :     rItem.lHeight = lHeight;
      71                 :          0 :     rItem.lLeft   = lLeft;
      72                 :          0 :     rItem.lUpper  = lUpper;
      73                 :          0 :     rItem.nCols   = nCols;
      74                 :          0 :     rItem.lPWidth  = lPWidth;
      75                 :          0 :     rItem.lPHeight = lPHeight;
      76                 :          0 :     rItem.nRows   = nRows;
      77                 :          0 : }
      78                 :            : 
      79                 :          0 : void SwLabDlg::_ReplaceGroup( const String &rMake )
      80                 :            : {
      81                 :            :     // Remove old entries
      82                 :          0 :     pRecs->erase(pRecs->begin() + 1, pRecs->end());
      83                 :          0 :     aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
      84                 :          0 :     aLstGroup = rMake;
      85                 :          0 : }
      86                 :            : 
      87                 :          0 : void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
      88                 :            : {
      89                 :          0 :     if (nId == TP_LAB_LAB)
      90                 :            :     {
      91                 :          0 :         if(m_bLabel)
      92                 :            :         {
      93                 :          0 :             ((SwLabPage*)&rPage)->SetNewDBMgr(pNewDBMgr);
      94                 :          0 :             ((SwLabPage*)&rPage)->InitDatabaseBox();
      95                 :            :         }
      96                 :            :         else
      97                 :          0 :             ((SwLabPage*)&rPage)->SetToBusinessCard();
      98                 :            :     }
      99                 :          0 :     else if (nId == TP_LAB_PRT)
     100                 :          0 :         pPrtPage = (SwLabPrtPage*)&rPage;
     101                 :          0 : }
     102                 :            : 
     103                 :          0 : SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
     104                 :            :                                 SwNewDBMgr* pDBMgr, sal_Bool bLabel) :
     105                 :            :     SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ),
     106                 :            :     pNewDBMgr(pDBMgr),
     107                 :            :     pPrtPage(0),
     108                 :            :     aTypeIds( 50, 10 ),
     109                 :          0 :     pRecs   ( new SwLabRecs() ),
     110                 :            :     sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)),
     111                 :            :     sFormat(SW_RES(ST_FIRSTPAGE_LAB)),
     112                 :            :     sMedium(SW_RES(ST_FIRSTPAGE_BC)),
     113                 :          0 :     m_bLabel(bLabel)
     114                 :            : {
     115                 :          0 :     WaitObject aWait( pParent );
     116                 :            : 
     117                 :          0 :     FreeResource();
     118                 :            : 
     119                 :          0 :     GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC)));
     120                 :          0 :     GetOKButton().SetHelpId(HID_LABEL_INSERT);
     121                 :          0 :     GetOKButton().SetHelpText(aEmptyStr);   // in order for generated help text to get used
     122                 :            : 
     123                 :          0 :     AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage   ::Create, 0, sal_False, 0);
     124                 :          0 :     AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0);
     125                 :          0 :     AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0);
     126                 :          0 :     AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0);
     127                 :          0 :     AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 );
     128                 :          0 :     AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0);
     129                 :            : 
     130                 :            : 
     131                 :          0 :     if(m_bLabel)
     132                 :            :     {
     133                 :          0 :         RemoveTabPage(TP_BUSINESS_DATA);
     134                 :          0 :         RemoveTabPage(TP_PRIVATE_DATA);
     135                 :          0 :         RemoveTabPage(TP_VISITING_CARDS);
     136                 :            :     }
     137                 :            :     else
     138                 :            :     {
     139                 :          0 :         SetText(sBusinessCardDlg);
     140                 :            :     }
     141                 :            :     // Read user label from writer.cfg
     142                 :          0 :     SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL ));
     143                 :          0 :     SwLabRec* pRec = new SwLabRec;
     144                 :          0 :     const String aTmp( SW_RES( STR_CUSTOM ) );
     145                 :          0 :     pRec->aMake   = pRec->aType = aTmp;
     146                 :          0 :     pRec->SetFromItem( aItem );
     147                 :            : 
     148                 :          0 :     sal_Bool bDouble = sal_False;
     149                 :            : 
     150                 :          0 :     for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->size(); nRecPos++)
     151                 :            :     {
     152                 :          0 :         if (pRec->aMake == (*pRecs)[nRecPos]->aMake &&
     153                 :          0 :             pRec->aType == (*pRecs)[nRecPos]->aType)
     154                 :            :         {
     155                 :          0 :             bDouble = sal_True;
     156                 :          0 :             break;
     157                 :            :         }
     158                 :            :     }
     159                 :            : 
     160                 :          0 :     if (!bDouble)
     161                 :          0 :         pRecs->insert( pRecs->begin(), pRec );
     162                 :            : 
     163                 :          0 :     sal_uInt16 nLstGroup = 0;
     164                 :          0 :     const ::com::sun::star::uno::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
     165                 :          0 :     const rtl::OUString* pMan = rMan.getConstArray();
     166                 :          0 :     for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
     167                 :            :     {
     168                 :          0 :         aMakes.push_back(pMan[nMan]);
     169                 :          0 :         if ( pMan[nMan] == aItem.aLstMake )
     170                 :          0 :             nLstGroup = (sal_uInt16) nMan;
     171                 :            :     }
     172                 :            : 
     173                 :          0 :     if ( !aMakes.empty() )
     174                 :          0 :         _ReplaceGroup( aMakes[nLstGroup] );
     175                 :            : 
     176                 :          0 :     if (pExampleSet)
     177                 :          0 :         pExampleSet->Put(aItem);
     178                 :          0 : }
     179                 :            : 
     180                 :          0 : SwLabDlg::~SwLabDlg()
     181                 :            : {
     182                 :          0 :     delete pRecs;
     183                 :          0 : }
     184                 :            : 
     185                 :          0 : void SwLabDlg::GetLabItem(SwLabItem &rItem)
     186                 :            : {
     187                 :          0 :     const SwLabItem& rActItem = (const SwLabItem&)GetExampleSet()->Get(FN_LABEL);
     188                 :          0 :     const SwLabItem& rOldItem = (const SwLabItem&)GetInputSetImpl()->Get(FN_LABEL);
     189                 :            : 
     190                 :          0 :     if (rActItem != rOldItem)
     191                 :            :     {
     192                 :            :         // Was already "put" with (hopefully) correct content
     193                 :          0 :         rItem = rActItem;
     194                 :            :     }
     195                 :            :     else
     196                 :            :     {
     197                 :          0 :         rItem = rOldItem;
     198                 :            : 
     199                 :            :         // In rItem there are only settings defined by users.
     200                 :            :         // Therefore get the real settings directly from Record
     201                 :          0 :         SwLabRec* pRec = GetRecord(rItem.aType, rItem.bCont);
     202                 :          0 :         pRec->FillItem( rItem );
     203                 :            :     }
     204                 :          0 : }
     205                 :            : 
     206                 :          0 : SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
     207                 :            : {
     208                 :          0 :     SwLabRec* pRec = NULL;
     209                 :          0 :     sal_Bool bFound = sal_False;
     210                 :          0 :     String sCustom(SW_RES(STR_CUSTOM));
     211                 :            : 
     212                 :          0 :     const sal_uInt16 nCount = Recs().size();
     213                 :          0 :     for (sal_uInt16 i = 0; i < nCount; i++)
     214                 :            :     {
     215                 :          0 :         pRec = Recs()[i];
     216                 :          0 :         if (pRec->aType != sCustom &&
     217                 :          0 :             rRecName == pRec->aType && bCont == pRec->bCont)
     218                 :            :         {
     219                 :          0 :             bFound = sal_True;
     220                 :          0 :             break;
     221                 :            :         }
     222                 :            :     }
     223                 :          0 :     if (!bFound)    // User defined
     224                 :          0 :         pRec = Recs()[0];
     225                 :            : 
     226                 :          0 :     return(pRec);
     227                 :            : }
     228                 :            : 
     229                 :          0 : Printer *SwLabDlg::GetPrt()
     230                 :            : {
     231                 :          0 :     if (pPrtPage)
     232                 :          0 :         return (pPrtPage->GetPrt());
     233                 :            :     else
     234                 :          0 :         return (NULL);
     235                 :            : }
     236                 :            : 
     237                 :          0 : SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) :
     238                 :            :     SfxTabPage(pParent, SW_RES(TP_LAB_LAB), rSet),
     239                 :            :     pNewDBMgr(NULL),
     240                 :          0 :     aItem          ((const SwLabItem&) rSet.Get(FN_LABEL)),
     241                 :            : 
     242                 :            :     aWritingFL     (this, SW_RES(FL_WRITING)),
     243                 :            :     aWritingText   (this, SW_RES(TXT_WRITING)),
     244                 :            :     aAddrBox       (this, SW_RES(BOX_ADDR   )),
     245                 :            :     aWritingEdit   (this, SW_RES(EDT_WRITING)),
     246                 :            :     aDatabaseFT    (this, SW_RES(FT_DATABASE)),
     247                 :            :     aDatabaseLB    (this, SW_RES(LB_DATABASE)),
     248                 :            :     aTableFT       (this, SW_RES(FT_TABLE   )),
     249                 :            :     aTableLB       (this, SW_RES(LB_TABLE   )),
     250                 :            :     aInsertBT      (this, SW_RES(BTN_INSERT )),
     251                 :            :     aDBFieldFT     (this, SW_RES(FT_DBFIELD )),
     252                 :            :     aDBFieldLB     (this, SW_RES(LB_DBFIELD )),
     253                 :            :     aFormatFL      (this, SW_RES(FL_FORMAT )),
     254                 :            :     aContButton    (this, SW_RES(BTN_CONT   )),
     255                 :            :     aSheetButton   (this, SW_RES(BTN_SHEET  )),
     256                 :            :     aMakeText      (this, SW_RES(TXT_MAKE   )),
     257                 :            :     aMakeBox       (this, SW_RES(BOX_MAKE   )),
     258                 :            :     aTypeText      (this, SW_RES(TXT_TYPE   )),
     259                 :            :     aTypeBox       (this, SW_RES(BOX_TYPE   )),
     260                 :            :     aHiddenSortTypeBox(this, WB_SORT|WB_HIDE),
     261                 :          0 :     aFormatInfo    (this, SW_RES(INF_FORMAT ))
     262                 :            :    {
     263                 :          0 :     WaitObject aWait( pParent );
     264                 :            : 
     265                 :          0 :     FreeResource();
     266                 :          0 :     SetExchangeSupport();
     267                 :            : 
     268                 :            : 
     269                 :            :     // Install handlers
     270                 :          0 :     aAddrBox       .SetClickHdl (LINK(this, SwLabPage, AddrHdl         ));
     271                 :          0 :     aDatabaseLB    .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl     ));
     272                 :          0 :     aTableLB       .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl     ));
     273                 :          0 :     aInsertBT      .SetClickHdl (LINK(this, SwLabPage, FieldHdl        ));
     274                 :          0 :     aContButton    .SetClickHdl (LINK(this, SwLabPage, PageHdl         ));
     275                 :          0 :     aSheetButton   .SetClickHdl (LINK(this, SwLabPage, PageHdl         ));
     276                 :          0 :     aMakeBox       .SetSelectHdl(LINK(this, SwLabPage, MakeHdl         ));
     277                 :          0 :     aTypeBox       .SetSelectHdl(LINK(this, SwLabPage, TypeHdl         ));
     278                 :            : 
     279                 :          0 :     InitDatabaseBox();
     280                 :            : 
     281                 :          0 :     size_t nLstGroup = 0;
     282                 :            : 
     283                 :          0 :     const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().size();
     284                 :          0 :     for(size_t i = 0; i < nCount; ++i)
     285                 :            :     {
     286                 :          0 :         rtl::OUString& rStr = GetParent()->Makes()[i];
     287                 :          0 :         aMakeBox.InsertEntry( rStr );
     288                 :            : 
     289                 :          0 :         if ( rStr == aItem.aLstMake)
     290                 :          0 :             nLstGroup = i;
     291                 :            :     }
     292                 :            : 
     293                 :          0 :     aMakeBox.SelectEntryPos( nLstGroup );
     294                 :          0 :     aMakeBox.GetSelectHdl().Call( &aMakeBox );
     295                 :          0 : }
     296                 :            : 
     297                 :          0 : SwLabPage::~SwLabPage()
     298                 :            : {
     299                 :          0 : }
     300                 :            : 
     301                 :          0 : void lcl_ChgYPos(Window& rWin, long nDiff)
     302                 :            : {
     303                 :          0 :     Point aTempPos(rWin.GetPosPixel());
     304                 :          0 :     aTempPos.Y() += nDiff;
     305                 :          0 :     rWin.SetPosPixel(aTempPos);
     306                 :          0 : }
     307                 :            : 
     308                 :          0 : void SwLabPage::SetToBusinessCard()
     309                 :            : {
     310                 :          0 :     SetHelpId(HID_BUSINESS_FMT_PAGE);
     311                 :          0 :     aContButton.SetHelpId(HID_BUSINESS_FMT_PAGE_CONT);
     312                 :          0 :     aSheetButton.SetHelpId(HID_BUSINESS_FMT_PAGE_SHEET);
     313                 :          0 :     aMakeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_BRAND);
     314                 :          0 :     aTypeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_TYPE);
     315                 :          0 :     m_bLabel = sal_False;
     316                 :          0 :     aWritingText.Hide();
     317                 :          0 :     aAddrBox.Hide();
     318                 :          0 :     aWritingEdit.Hide();
     319                 :          0 :     aDatabaseFT.Hide();
     320                 :          0 :     aDatabaseLB.Hide();
     321                 :          0 :     aTableFT.Hide();
     322                 :          0 :     aTableLB.Hide();
     323                 :          0 :     aInsertBT.Hide();
     324                 :          0 :     aDBFieldFT.Hide();
     325                 :          0 :     aDBFieldLB.Hide();
     326                 :          0 :     aWritingFL.Hide();
     327                 :            : 
     328                 :            :     //resize the form
     329                 :          0 :     Point aFLPos(aWritingFL.GetPosPixel());
     330                 :          0 :     long nDiffPos = aFormatFL.GetPosPixel().Y() - aFLPos.Y();
     331                 :          0 :     Size aFLSz(aFormatFL.GetSizePixel());
     332                 :          0 :     aFormatFL.SetPosSizePixel(aFLPos, aFLSz);
     333                 :            : 
     334                 :            :     // move all controls up
     335                 :          0 :     lcl_ChgYPos(aContButton, -nDiffPos);
     336                 :          0 :     lcl_ChgYPos(aSheetButton, -nDiffPos);
     337                 :          0 :     lcl_ChgYPos(aMakeText, -nDiffPos);
     338                 :            : 
     339                 :          0 :     lcl_ChgYPos(aTypeText, -nDiffPos);
     340                 :          0 :     lcl_ChgYPos(aFormatInfo, -nDiffPos);
     341                 :            : 
     342                 :          0 :     Size aTmpSz(3, 3);
     343                 :          0 :     aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
     344                 :            : 
     345                 :          0 :     lcl_ChgYPos(aMakeBox, - nDiffPos);
     346                 :          0 :     Point aLBPos(aMakeBox.GetPosPixel());
     347                 :          0 :     aLBPos.Y() += aMakeBox.GetSizePixel().Height() + aTmpSz.Height();
     348                 :          0 :     aTypeBox.SetPosPixel(aLBPos);
     349                 :          0 : };
     350                 :            : 
     351                 :          0 : IMPL_LINK_NOARG(SwLabPage, AddrHdl)
     352                 :            : {
     353                 :          0 :     String aWriting;
     354                 :            : 
     355                 :          0 :     if ( aAddrBox.IsChecked() )
     356                 :          0 :         aWriting = convertLineEnd(MakeSender(), GetSystemLineEnd());
     357                 :            : 
     358                 :          0 :     aWritingEdit.SetText( aWriting );
     359                 :          0 :     aWritingEdit.GrabFocus();
     360                 :          0 :     return 0;
     361                 :            : }
     362                 :            : 
     363                 :          0 : IMPL_LINK( SwLabPage, DatabaseHdl, ListBox *, pListBox )
     364                 :            : {
     365                 :          0 :     sActDBName = aDatabaseLB.GetSelectEntry();
     366                 :            : 
     367                 :          0 :     WaitObject aObj( GetParent() );
     368                 :            : 
     369                 :          0 :     if (pListBox == &aDatabaseLB)
     370                 :          0 :         GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName);
     371                 :            : 
     372                 :          0 :     GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, aTableLB.GetSelectEntry());
     373                 :          0 :     return 0;
     374                 :            : }
     375                 :            : 
     376                 :          0 : IMPL_LINK_NOARG(SwLabPage, FieldHdl)
     377                 :            : {
     378                 :          0 :     rtl::OUStringBuffer aStr;
     379                 :          0 :     aStr.append('<');
     380                 :          0 :     aStr.append(aDatabaseLB.GetSelectEntry());
     381                 :          0 :     aStr.append('.');
     382                 :          0 :     aStr.append(aTableLB.GetSelectEntry());
     383                 :          0 :     aStr.append('.');
     384                 :          0 :     aStr.append(aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1');
     385                 :          0 :     aStr.append('.');
     386                 :          0 :     aStr.append(aDBFieldLB.GetSelectEntry());
     387                 :          0 :     aStr.append('>');
     388                 :          0 :     aWritingEdit.ReplaceSelected(aStr.makeStringAndClear());
     389                 :          0 :     Selection aSel = aWritingEdit.GetSelection();
     390                 :          0 :     aWritingEdit.GrabFocus();
     391                 :          0 :     aWritingEdit.SetSelection(aSel);
     392                 :          0 :     return 0;
     393                 :            : }
     394                 :            : 
     395                 :          0 : IMPL_LINK_NOARG_INLINE_START(SwLabPage, PageHdl)
     396                 :            : {
     397                 :          0 :     aMakeBox.GetSelectHdl().Call( &aMakeBox );
     398                 :          0 :     return 0;
     399                 :            : }
     400                 :          0 : IMPL_LINK_NOARG_INLINE_END(SwLabPage, PageHdl)
     401                 :            : 
     402                 :          0 : IMPL_LINK_NOARG(SwLabPage, MakeHdl)
     403                 :            : {
     404                 :          0 :     WaitObject aWait( GetParent() );
     405                 :            : 
     406                 :          0 :     aTypeBox.Clear();
     407                 :          0 :     aHiddenSortTypeBox.Clear();
     408                 :          0 :     GetParent()->TypeIds().clear();
     409                 :            : 
     410                 :          0 :     const String aMake = aMakeBox.GetSelectEntry();
     411                 :          0 :     GetParent()->ReplaceGroup( aMake );
     412                 :          0 :     aItem.aLstMake = aMake;
     413                 :            : 
     414                 :          0 :     const sal_Bool   bCont    = aContButton.IsChecked();
     415                 :          0 :     const sal_uInt16 nCount   = GetParent()->Recs().size();
     416                 :          0 :           sal_uInt16 nLstType = 0;
     417                 :            : 
     418                 :          0 :     const String sCustom(SW_RES(STR_CUSTOM));
     419                 :            :     //insert the entries into the sorted list box
     420                 :          0 :     for ( sal_uInt16 i = 0; i < nCount; ++i )
     421                 :            :     {
     422                 :          0 :         const String aType ( GetParent()->Recs()[i]->aType );
     423                 :          0 :         sal_Bool bInsert = sal_False;
     424                 :          0 :         if ( GetParent()->Recs()[i]->aType == sCustom )
     425                 :            :         {
     426                 :          0 :             bInsert = sal_True;
     427                 :          0 :             aTypeBox.InsertEntry(aType );
     428                 :            :         }
     429                 :          0 :         else if ( GetParent()->Recs()[i]->bCont == bCont )
     430                 :            :         {
     431                 :          0 :             if ( aHiddenSortTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
     432                 :            :             {
     433                 :          0 :                 bInsert = sal_True;
     434                 :          0 :                 aHiddenSortTypeBox.InsertEntry( aType );
     435                 :            :             }
     436                 :            :         }
     437                 :          0 :         if(bInsert)
     438                 :            :         {
     439                 :          0 :             GetParent()->TypeIds().push_back(i);
     440                 :          0 :             if ( !nLstType && aType == String(aItem.aLstType) )
     441                 :          0 :                 nLstType = GetParent()->TypeIds().size();
     442                 :            :         }
     443                 :          0 :     }
     444                 :          0 :     for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++)
     445                 :            :     {
     446                 :          0 :         aTypeBox.InsertEntry(aHiddenSortTypeBox.GetEntry(nEntry));
     447                 :            :     }
     448                 :          0 :     if (nLstType)
     449                 :          0 :         aTypeBox.SelectEntry(aItem.aLstType);
     450                 :            :     else
     451                 :          0 :         aTypeBox.SelectEntryPos(0);
     452                 :          0 :     aTypeBox.GetSelectHdl().Call( &aTypeBox );
     453                 :          0 :     return 0;
     454                 :            : }
     455                 :            : 
     456                 :          0 : IMPL_LINK_NOARG_INLINE_START(SwLabPage, TypeHdl)
     457                 :            : {
     458                 :          0 :     DisplayFormat();
     459                 :          0 :     aItem.aType = aTypeBox.GetSelectEntry();
     460                 :          0 :     return 0;
     461                 :            : }
     462                 :          0 : IMPL_LINK_NOARG_INLINE_END(SwLabPage, TypeHdl)
     463                 :            : 
     464                 :          0 : void SwLabPage::DisplayFormat()
     465                 :            : {
     466                 :          0 :     MetricField aField(this, WinBits(0));
     467                 :          0 :     FieldUnit aMetric = ::GetDfltMetric(sal_False);
     468                 :          0 :     SetMetric(aField, aMetric);
     469                 :          0 :     aField.SetDecimalDigits(2);
     470                 :          0 :     aField.SetMin         (0);
     471                 :          0 :     aField.SetMax         (LONG_MAX);
     472                 :            : 
     473                 :          0 :     SwLabRec* pRec = GetSelectedEntryPos();
     474                 :          0 :     aItem.aLstType = pRec->aType;
     475                 :          0 :     SETFLDVAL(aField, pRec->lWidth);
     476                 :          0 :     aField.Reformat();
     477                 :          0 :     const String aWString = aField.GetText();
     478                 :            : 
     479                 :          0 :     SETFLDVAL(aField, pRec->lHeight);
     480                 :          0 :     aField.Reformat();
     481                 :            : 
     482                 :          0 :     String aText = pRec->aType;
     483                 :          0 :     aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
     484                 :          0 :     aText += aWString;
     485                 :          0 :     aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
     486                 :          0 :     aText += aField.GetText();
     487                 :          0 :     aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" ("));
     488                 :          0 :     aText += String::CreateFromInt32( pRec->nCols );
     489                 :          0 :     aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
     490                 :          0 :     aText += String::CreateFromInt32( pRec->nRows );
     491                 :          0 :     aText += ')';
     492                 :          0 :     aFormatInfo.SetText(aText);
     493                 :          0 : }
     494                 :            : 
     495                 :          0 : SwLabRec* SwLabPage::GetSelectedEntryPos()
     496                 :            : {
     497                 :          0 :     String sSelEntry(aTypeBox.GetSelectEntry());
     498                 :            : 
     499                 :          0 :     return GetParent()->GetRecord(sSelEntry, aContButton.IsChecked());
     500                 :            : }
     501                 :            : 
     502                 :          0 : void SwLabPage::InitDatabaseBox()
     503                 :            : {
     504                 :          0 :     if( GetNewDBMgr() )
     505                 :            :     {
     506                 :          0 :         aDatabaseLB.Clear();
     507                 :          0 :         ::com::sun::star::uno::Sequence<rtl::OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames();
     508                 :          0 :         const rtl::OUString* pDataNames = aDataNames.getConstArray();
     509                 :          0 :         for (long i = 0; i < aDataNames.getLength(); i++)
     510                 :          0 :             aDatabaseLB.InsertEntry(pDataNames[i]);
     511                 :          0 :         String sDBName = sActDBName.GetToken( 0, DB_DELIM );
     512                 :          0 :         String sTableName = sActDBName.GetToken( 1, DB_DELIM );
     513                 :          0 :         aDatabaseLB.SelectEntry(sDBName);
     514                 :          0 :         if( sDBName.Len() && GetNewDBMgr()->GetTableNames(&aTableLB, sDBName))
     515                 :            :         {
     516                 :          0 :             aTableLB.SelectEntry(sTableName);
     517                 :          0 :             GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, sTableName);
     518                 :            :         }
     519                 :            :         else
     520                 :          0 :             aDBFieldLB.Clear();
     521                 :            :     }
     522                 :          0 : }
     523                 :            : 
     524                 :          0 : SfxTabPage* SwLabPage::Create(Window* pParent, const SfxItemSet& rSet)
     525                 :            : {
     526                 :          0 :     return new SwLabPage(pParent, rSet);
     527                 :            : }
     528                 :            : 
     529                 :          0 : void SwLabPage::ActivatePage(const SfxItemSet& rSet)
     530                 :            : {
     531                 :          0 :     Reset( rSet );
     532                 :          0 : }
     533                 :            : 
     534                 :          0 : int SwLabPage::DeactivatePage(SfxItemSet* _pSet)
     535                 :            : {
     536                 :          0 :     if (_pSet)
     537                 :          0 :         FillItemSet(*_pSet);
     538                 :            : 
     539                 :          0 :     return sal_True;
     540                 :            : }
     541                 :            : 
     542                 :          0 : void SwLabPage::FillItem(SwLabItem& rItem)
     543                 :            : {
     544                 :          0 :     rItem.bAddr    = aAddrBox.IsChecked();
     545                 :          0 :     rItem.aWriting = aWritingEdit.GetText();
     546                 :          0 :     rItem.bCont    = aContButton.IsChecked();
     547                 :          0 :     rItem.aMake    = aMakeBox.GetSelectEntry();
     548                 :          0 :     rItem.aType    = aTypeBox.GetSelectEntry();
     549                 :          0 :     rItem.sDBName  = sActDBName;
     550                 :            : 
     551                 :          0 :     SwLabRec* pRec = GetSelectedEntryPos();
     552                 :          0 :     pRec->FillItem( rItem );
     553                 :            : 
     554                 :          0 :     rItem.aLstMake = aMakeBox.GetSelectEntry();
     555                 :          0 :     rItem.aLstType = aTypeBox.GetSelectEntry();
     556                 :          0 : }
     557                 :            : 
     558                 :          0 : sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet)
     559                 :            : {
     560                 :          0 :     FillItem( aItem );
     561                 :          0 :     rSet.Put( aItem );
     562                 :            : 
     563                 :          0 :     return sal_True;
     564                 :            : }
     565                 :            : 
     566                 :          0 : void SwLabPage::Reset(const SfxItemSet& rSet)
     567                 :            : {
     568                 :          0 :     aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
     569                 :          0 :     String sDBName  = aItem.sDBName;
     570                 :            : 
     571                 :          0 :     String aWriting(convertLineEnd(aItem.aWriting, GetSystemLineEnd()));
     572                 :            : 
     573                 :          0 :     aAddrBox    .Check      ( aItem.bAddr );
     574                 :          0 :     aWritingEdit.SetText    ( aWriting );
     575                 :            : 
     576                 :          0 :     for(std::vector<rtl::OUString>::const_iterator i = GetParent()->Makes().begin(); i != GetParent()->Makes().end(); ++i)
     577                 :            :     {
     578                 :          0 :         if(aMakeBox.GetEntryPos(String(*i)) == LISTBOX_ENTRY_NOTFOUND)
     579                 :          0 :             aMakeBox.InsertEntry(*i);
     580                 :            :     }
     581                 :            : 
     582                 :          0 :     aMakeBox    .SelectEntry( aItem.aMake );
     583                 :            :     //save the current type
     584                 :          0 :     String sType(aItem.aType);
     585                 :          0 :     aMakeBox.GetSelectHdl().Call( &aMakeBox );
     586                 :          0 :     aItem.aType = sType;
     587                 :            :     //#102806# a newly added make may not be in the type ListBox already
     588                 :          0 :     if (aTypeBox.GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && !aItem.aMake.isEmpty())
     589                 :          0 :         GetParent()->UpdateGroup( aItem.aMake );
     590                 :          0 :     if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND)
     591                 :            :     {
     592                 :          0 :         aTypeBox.SelectEntry(aItem.aType);
     593                 :          0 :         aTypeBox.GetSelectHdl().Call(&aTypeBox);
     594                 :            :     }
     595                 :          0 :     if (aDatabaseLB.GetEntryPos(sDBName) != LISTBOX_ENTRY_NOTFOUND)
     596                 :            :     {
     597                 :          0 :         aDatabaseLB.SelectEntry(sDBName);
     598                 :          0 :         aDatabaseLB.GetSelectHdl().Call(&aDatabaseLB);
     599                 :            :     }
     600                 :            : 
     601                 :          0 :     if (aItem.bCont)
     602                 :          0 :         aContButton .Check();
     603                 :            :     else
     604                 :          0 :         aSheetButton.Check();
     605                 :          0 : }
     606                 :            : 
     607                 :          0 : void SwVisitingCardPage::ClearUserData()
     608                 :            : {
     609                 :          0 :     SvLBoxEntry* pEntry = aAutoTextLB.First();
     610                 :          0 :     while(pEntry)
     611                 :            :     {
     612                 :          0 :         delete (String*)pEntry->GetUserData();
     613                 :          0 :         pEntry = aAutoTextLB.Next(pEntry);
     614                 :            :     }
     615                 :          0 : }
     616                 :            : 
     617                 :          0 : void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt,
     618                 :            :                 const rtl::OUString* pNames, const rtl::OUString* pValues )
     619                 :            : {
     620                 :          0 :     for( sal_uInt32 i = 0; i < nCnt; ++i )
     621                 :            :     {
     622                 :          0 :         SvLBoxEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] );
     623                 :          0 :         pEntry->SetUserData( new String( pValues[ i ] ));
     624                 :            :     }
     625                 :          0 : }
     626                 :            : 
     627                 :          0 : SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) :
     628                 :            :     SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet),
     629                 :            :     aContentFL(this,        SW_RES( FL_CONTENT           )),
     630                 :            :     aAutoTextLB(this,       SW_RES( LB_AUTO_TEXT            )),
     631                 :            :     aAutoTextGroupFT(this,  SW_RES( FT_AUTO_TEXT_GROUP  )),
     632                 :            :     aAutoTextGroupLB(this,  SW_RES( LB_AUTO_TEXT_GROUP  )),
     633                 :            :     aExampleWIN(this,       SW_RES( WIN_EXAMPLE         )),
     634                 :            :     sVisCardGroup(SW_RES(ST_VISCARD_GROUP)),
     635                 :          0 :     pExampleFrame(0)
     636                 :            : {
     637                 :          0 :     FreeResource();
     638                 :          0 :     aAutoTextLB.SetStyle( aAutoTextLB.GetStyle() | WB_HSCROLL );
     639                 :          0 :     aAutoTextLB.SetSpaceBetweenEntries(0);
     640                 :          0 :     aAutoTextLB.SetSelectionMode( SINGLE_SELECTION );
     641                 :          0 :     aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT);
     642                 :            : 
     643                 :          0 :     SetExchangeSupport();
     644                 :          0 :     aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
     645                 :          0 :     aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
     646                 :            : 
     647                 :          0 :     aExampleWIN.Hide();
     648                 :            : 
     649                 :          0 :     aAutoTextLB.Show();
     650                 :          0 :     aAutoTextGroupFT.Show();
     651                 :          0 :     aAutoTextGroupLB.Show();
     652                 :          0 :     InitFrameControl();
     653                 :          0 : }
     654                 :            : 
     655                 :          0 : SwVisitingCardPage::~SwVisitingCardPage()
     656                 :            : {
     657                 :          0 :     for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++)
     658                 :          0 :         delete (String*)aAutoTextGroupLB.GetEntryData( i );
     659                 :          0 :     _xAutoText = 0;
     660                 :            : 
     661                 :          0 :     ClearUserData();
     662                 :          0 :     delete pExampleFrame;
     663                 :          0 : }
     664                 :            : 
     665                 :          0 : SfxTabPage* SwVisitingCardPage::Create(Window* pParent, const SfxItemSet& rSet)
     666                 :            : {
     667                 :          0 :     return new SwVisitingCardPage(pParent, rSet);
     668                 :            : }
     669                 :            : 
     670                 :          0 : void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
     671                 :            : {
     672                 :          0 :     Reset( rSet );
     673                 :          0 :     UpdateFields();
     674                 :          0 : }
     675                 :            : 
     676                 :          0 : int  SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet)
     677                 :            : {
     678                 :          0 :     if (_pSet)
     679                 :          0 :         FillItemSet(*_pSet);
     680                 :          0 :     return LEAVE_PAGE;
     681                 :            : }
     682                 :            : 
     683                 :          0 : sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet)
     684                 :            : {
     685                 :            :     String* pGroup = (String*)aAutoTextGroupLB.GetEntryData(
     686                 :          0 :                                     aAutoTextGroupLB.GetSelectEntryPos());
     687                 :            :     OSL_ENSURE(pGroup, "no group selected?");
     688                 :            : 
     689                 :          0 :     if(pGroup)
     690                 :          0 :         aLabItem.sGlossaryGroup = *pGroup;
     691                 :            : 
     692                 :          0 :     SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
     693                 :          0 :     if(pSelEntry)
     694                 :          0 :         aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData();
     695                 :          0 :     rSet.Put(aLabItem);
     696                 :          0 :     return sal_True;
     697                 :            : }
     698                 :            : 
     699                 :          0 : void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
     700                 :            : {
     701                 :          0 :     SvLBoxEntry* pEntry = rAutoTextLB.First();
     702                 :          0 :     while(pEntry)
     703                 :            :     {
     704                 :          0 :         if(*(String*)pEntry->GetUserData() == rBlockName)
     705                 :            :         {
     706                 :          0 :             rAutoTextLB.Select(pEntry);
     707                 :          0 :             rAutoTextLB.MakeVisible(pEntry);
     708                 :          0 :             break;
     709                 :            :         }
     710                 :          0 :         pEntry = rAutoTextLB.Next(pEntry);
     711                 :            :     }
     712                 :          0 : }
     713                 :            : 
     714                 :          0 : sal_Bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
     715                 :            : {
     716                 :          0 :     SvLBoxEntry* pEntry = rAutoTextLB.First();
     717                 :          0 :     while(pEntry)
     718                 :            :     {
     719                 :          0 :         if(*(String*)pEntry->GetUserData() == rBlockName)
     720                 :            :         {
     721                 :          0 :             rAutoTextLB.Select(pEntry);
     722                 :          0 :             return sal_True;
     723                 :            :         }
     724                 :          0 :         pEntry = rAutoTextLB.Next(pEntry);
     725                 :            :     }
     726                 :          0 :     return sal_False;
     727                 :            : }
     728                 :            : 
     729                 :          0 : void SwVisitingCardPage::Reset(const SfxItemSet& rSet)
     730                 :            : {
     731                 :          0 :     aLabItem = (const SwLabItem&) rSet.Get(FN_LABEL);
     732                 :            : 
     733                 :          0 :     sal_Bool bFound = sal_False;
     734                 :            :     sal_uInt16 i;
     735                 :          0 :     for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
     736                 :          0 :         if( String(aLabItem.sGlossaryGroup) ==
     737                 :          0 :             *(String*)aAutoTextGroupLB.GetEntryData( i ))
     738                 :            :         {
     739                 :          0 :             bFound = sal_True;
     740                 :          0 :             break;
     741                 :            :         }
     742                 :            : 
     743                 :          0 :     if(!bFound)
     744                 :            :     {
     745                 :            :         // initially search for a group starting with "crd" which is the name of the
     746                 :            :         // business card AutoTexts
     747                 :          0 :         for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
     748                 :          0 :             if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") )
     749                 :            :             {
     750                 :          0 :                 bFound = sal_True;
     751                 :          0 :                 break;
     752                 :            :             }
     753                 :            :     }
     754                 :          0 :     if(bFound)
     755                 :            :     {
     756                 :          0 :         if(aAutoTextGroupLB.GetSelectEntryPos() != i)
     757                 :            :         {
     758                 :          0 :             aAutoTextGroupLB.SelectEntryPos(i);
     759                 :          0 :             AutoTextSelectHdl(&aAutoTextGroupLB);
     760                 :            :         }
     761                 :          0 :         if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName))
     762                 :            :         {
     763                 :          0 :             SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
     764                 :          0 :             if( pSelEntry &&
     765                 :          0 :                 *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName))
     766                 :            :             {
     767                 :          0 :                 lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName);
     768                 :          0 :                 AutoTextSelectHdl(&aAutoTextLB);
     769                 :            :             }
     770                 :            :         }
     771                 :            :     }
     772                 :          0 : }
     773                 :            : 
     774                 :          0 : SwPrivateDataPage::SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet) :
     775                 :            :     SfxTabPage(pParent, SW_RES(TP_PRIVATE_DATA), rSet),
     776                 :            :     aDataFL             (this, SW_RES( FL_DATA       )),
     777                 :            : 
     778                 :            :     aNameFT             (this, SW_RES( FT_NAME       )),
     779                 :            :     aFirstNameED        (this, SW_RES( ED_FIRSTNAME )),
     780                 :            :     aNameED             (this, SW_RES( ED_NAME      )),
     781                 :            :     aShortCutED         (this, SW_RES( ED_SHORTCUT  )),
     782                 :            : 
     783                 :            :     aName2FT            (this, SW_RES( FT_NAME_2     )),
     784                 :            :     aFirstName2ED       (this, SW_RES( ED_FIRSTNAME_2)),
     785                 :            :     aName2ED            (this, SW_RES( ED_NAME_2        )),
     786                 :            :     aShortCut2ED        (this, SW_RES( ED_SHORTCUT_2    )),
     787                 :            : 
     788                 :            :     aStreetFT           (this, SW_RES( FT_STREET     )),
     789                 :            :     aStreetED           (this, SW_RES( ED_STREET        )),
     790                 :            :     aZipCityFT          (this, SW_RES( FT_ZIPCITY   )),
     791                 :            :     aZipED              (this, SW_RES( ED_ZIP       )),
     792                 :            :     aCityED             (this, SW_RES( ED_CITY      )),
     793                 :            :     aCountryStateFT     (this, SW_RES( FT_COUNTRYSTATE )),
     794                 :            :     aCountryED          (this, SW_RES( ED_COUNTRY   )),
     795                 :            :     aStateED            (this, SW_RES( ED_STATE     )),
     796                 :            :     aTitleProfessionFT  (this, SW_RES( FT_TITLEPROF )),
     797                 :            :     aTitleED            (this, SW_RES( ED_TITLE     )),
     798                 :            :     aProfessionED       (this, SW_RES( ED_PROFESSION )),
     799                 :            :     aPhoneFT            (this, SW_RES( FT_PHONE_MOBILE  )),
     800                 :            :     aPhoneED            (this, SW_RES( ED_PHONE     )),
     801                 :            :     aMobilePhoneED      (this, SW_RES( ED_MOBILE        )),
     802                 :            :     aFaxFT              (this, SW_RES( FT_FAX       )),
     803                 :            :     aFaxED              (this, SW_RES( ED_FAX       )),
     804                 :            :     aWWWMailFT          (this, SW_RES( FT_WWWMAIL   )),
     805                 :            :     aHomePageED         (this, SW_RES( ED_WWW       )),
     806                 :          0 :     aMailED             (this, SW_RES( ED_MAIL      ))
     807                 :            : {
     808                 :          0 :     FreeResource();
     809                 :          0 :     SetExchangeSupport();
     810                 :          0 : }
     811                 :            : 
     812                 :          0 : SwPrivateDataPage::~SwPrivateDataPage()
     813                 :            : {
     814                 :          0 : }
     815                 :            : 
     816                 :          0 : SfxTabPage* SwPrivateDataPage::Create(Window* pParent, const SfxItemSet& rSet)
     817                 :            : {
     818                 :          0 :     return new SwPrivateDataPage(pParent, rSet);
     819                 :            : }
     820                 :            : 
     821                 :          0 : void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
     822                 :            : {
     823                 :          0 :     Reset(rSet);
     824                 :          0 : }
     825                 :            : 
     826                 :          0 : int  SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet)
     827                 :            : {
     828                 :          0 :     if (_pSet)
     829                 :          0 :         FillItemSet(*_pSet);
     830                 :          0 :     return LEAVE_PAGE;
     831                 :            : }
     832                 :            : 
     833                 :          0 : sal_Bool SwPrivateDataPage::FillItemSet(SfxItemSet& rSet)
     834                 :            : {
     835                 :            : 
     836                 :          0 :     SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
     837                 :          0 :     aItem.aPrivFirstName = aFirstNameED .GetText();
     838                 :          0 :     aItem.aPrivName      = aNameED      .GetText(  );
     839                 :          0 :     aItem.aPrivShortCut  = aShortCutED  .GetText(  );
     840                 :          0 :     aItem.aPrivFirstName2 = aFirstName2ED   .GetText();
     841                 :          0 :     aItem.aPrivName2     = aName2ED     .GetText(  );
     842                 :          0 :     aItem.aPrivShortCut2 = aShortCut2ED .GetText(  );
     843                 :          0 :     aItem.aPrivStreet    = aStreetED    .GetText(  );
     844                 :          0 :     aItem.aPrivZip       = aZipED       .GetText(  );
     845                 :          0 :     aItem.aPrivCity      = aCityED      .GetText(  );
     846                 :          0 :     aItem.aPrivCountry   = aCountryED   .GetText(  );
     847                 :          0 :     aItem.aPrivState     = aStateED     .GetText(  );
     848                 :          0 :     aItem.aPrivTitle     = aTitleED     .GetText(  );
     849                 :          0 :     aItem.aPrivProfession= aProfessionED.GetText(   );
     850                 :          0 :     aItem.aPrivPhone     = aPhoneED     .GetText(  );
     851                 :          0 :     aItem.aPrivMobile    = aMobilePhoneED.GetText(  );
     852                 :          0 :     aItem.aPrivFax       = aFaxED       .GetText(  );
     853                 :          0 :     aItem.aPrivWWW       = aHomePageED  .GetText(  );
     854                 :          0 :     aItem.aPrivMail      = aMailED      .GetText(  );
     855                 :            : 
     856                 :          0 :     rSet.Put(aItem);
     857                 :          0 :     return sal_True;
     858                 :            : }
     859                 :            : 
     860                 :          0 : void SwPrivateDataPage::Reset(const SfxItemSet& rSet)
     861                 :            : {
     862                 :          0 :     const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
     863                 :          0 :     aFirstNameED.SetText(aItem.aPrivFirstName);
     864                 :          0 :     aNameED     .SetText(aItem.aPrivName);
     865                 :          0 :     aShortCutED .SetText(aItem.aPrivShortCut);
     866                 :          0 :     aFirstName2ED.SetText(aItem.aPrivFirstName2);
     867                 :          0 :     aName2ED     .SetText(aItem.aPrivName2);
     868                 :          0 :     aShortCut2ED .SetText(aItem.aPrivShortCut2);
     869                 :          0 :     aStreetED   .SetText(aItem.aPrivStreet);
     870                 :          0 :     aZipED      .SetText(aItem.aPrivZip);
     871                 :          0 :     aCityED     .SetText(aItem.aPrivCity);
     872                 :          0 :     aCountryED  .SetText(aItem.aPrivCountry);
     873                 :          0 :     aStateED    .SetText(aItem.aPrivState);
     874                 :          0 :     aTitleED    .SetText(aItem.aPrivTitle);
     875                 :          0 :     aProfessionED.SetText(aItem.aPrivProfession);
     876                 :          0 :     aPhoneED    .SetText(aItem.aPrivPhone);
     877                 :          0 :     aMobilePhoneED.SetText(aItem.aPrivMobile);
     878                 :          0 :     aFaxED      .SetText(aItem.aPrivFax);
     879                 :          0 :     aHomePageED .SetText(aItem.aPrivWWW);
     880                 :          0 :     aMailED     .SetText(aItem.aPrivMail);
     881                 :          0 : }
     882                 :            : 
     883                 :          0 : SwBusinessDataPage::SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet) :
     884                 :            :     SfxTabPage(pParent, SW_RES(TP_BUSINESS_DATA), rSet),
     885                 :            :     aDataFL             (this, SW_RES( FL_DATA       )),
     886                 :            :     aCompanyFT          (this, SW_RES( FT_COMP      )),
     887                 :            :     aCompanyED          (this, SW_RES( ED_COMP      )),
     888                 :            :     aCompanyExtFT       (this, SW_RES( FT_COMP_EXT  )),
     889                 :            :     aCompanyExtED       (this, SW_RES( ED_COMP_EXT  )),
     890                 :            :     aSloganFT           (this, SW_RES( FT_SLOGAN        )),
     891                 :            :     aSloganED           (this, SW_RES( ED_SLOGAN        )),
     892                 :            :     aStreetFT           (this, SW_RES( FT_STREET        )),
     893                 :            :     aStreetED           (this, SW_RES( ED_STREET        )),
     894                 :            :     aZipCityFT          (this, SW_RES( FT_ZIPCITY   )),
     895                 :            :     aZipED              (this, SW_RES( ED_ZIP       )),
     896                 :            :     aCityED             (this, SW_RES( ED_CITY      )),
     897                 :            :     aCountryStateFT     (this, SW_RES( FT_COUNTRYSTATE  )),
     898                 :            :     aCountryED          (this, SW_RES( ED_COUNTRY   )),
     899                 :            :     aStateED            (this, SW_RES( ED_STATE     )),
     900                 :            :     aPositionFT         (this, SW_RES( FT_POSITION  )),
     901                 :            :     aPositionED         (this, SW_RES( ED_POSITION  )),
     902                 :            :     aPhoneFT            (this, SW_RES( FT_PHONE_MOBILE  )),
     903                 :            :     aPhoneED            (this, SW_RES( ED_PHONE     )),
     904                 :            :     aMobilePhoneED      (this, SW_RES( ED_MOBILE        )),
     905                 :            :     aFaxFT              (this, SW_RES( FT_FAX       )),
     906                 :            :     aFaxED              (this, SW_RES( ED_FAX       )),
     907                 :            :     aWWWMailFT          (this, SW_RES( FT_WWWMAIL   )),
     908                 :            :     aHomePageED         (this, SW_RES( ED_WWW       )),
     909                 :          0 :     aMailED             (this, SW_RES( ED_MAIL      ))
     910                 :            : {
     911                 :          0 :     FreeResource();
     912                 :          0 :     SetExchangeSupport();
     913                 :          0 : }
     914                 :            : 
     915                 :            : 
     916                 :          0 : SwBusinessDataPage::~SwBusinessDataPage()
     917                 :            : {
     918                 :          0 : }
     919                 :            : 
     920                 :          0 : SfxTabPage* SwBusinessDataPage::Create(Window* pParent, const SfxItemSet& rSet)
     921                 :            : {
     922                 :          0 :     return new SwBusinessDataPage(pParent, rSet);
     923                 :            : }
     924                 :            : 
     925                 :          0 : void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet)
     926                 :            : {
     927                 :          0 :     Reset(rSet);
     928                 :          0 : }
     929                 :            : 
     930                 :          0 : int  SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet)
     931                 :            : {
     932                 :          0 :     if (_pSet)
     933                 :          0 :         FillItemSet(*_pSet);
     934                 :          0 :     return LEAVE_PAGE;
     935                 :            : }
     936                 :            : 
     937                 :          0 : sal_Bool SwBusinessDataPage::FillItemSet(SfxItemSet& rSet)
     938                 :            : {
     939                 :          0 :     SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
     940                 :            : 
     941                 :          0 :     aItem.aCompCompany   = aCompanyED      .GetText();
     942                 :          0 :     aItem.aCompCompanyExt= aCompanyExtED   .GetText();
     943                 :          0 :     aItem.aCompSlogan    = aSloganED       .GetText();
     944                 :          0 :     aItem.aCompStreet    = aStreetED       .GetText();
     945                 :          0 :     aItem.aCompZip       = aZipED          .GetText();
     946                 :          0 :     aItem.aCompCity      = aCityED         .GetText();
     947                 :          0 :     aItem.aCompCountry   = aCountryED      .GetText();
     948                 :          0 :     aItem.aCompState     = aStateED        .GetText();
     949                 :          0 :     aItem.aCompPosition  = aPositionED     .GetText();
     950                 :          0 :     aItem.aCompPhone     = aPhoneED        .GetText();
     951                 :          0 :     aItem.aCompMobile    = aMobilePhoneED  .GetText();
     952                 :          0 :     aItem.aCompFax       = aFaxED          .GetText();
     953                 :          0 :     aItem.aCompWWW       = aHomePageED     .GetText();
     954                 :          0 :     aItem.aCompMail      = aMailED         .GetText();
     955                 :            : 
     956                 :          0 :     rSet.Put(aItem);
     957                 :          0 :     return sal_True;
     958                 :            : }
     959                 :            : 
     960                 :          0 : void SwBusinessDataPage::Reset(const SfxItemSet& rSet)
     961                 :            : {
     962                 :          0 :     const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
     963                 :          0 :     aCompanyED      .SetText(aItem.aCompCompany);
     964                 :          0 :     aCompanyExtED   .SetText(aItem.aCompCompanyExt);
     965                 :          0 :     aSloganED       .SetText(aItem.aCompSlogan);
     966                 :          0 :     aStreetED       .SetText(aItem.aCompStreet);
     967                 :          0 :     aZipED          .SetText(aItem.aCompZip);
     968                 :          0 :     aCityED         .SetText(aItem.aCompCity);
     969                 :          0 :     aCountryED      .SetText(aItem.aCompCountry);
     970                 :          0 :     aStateED        .SetText(aItem.aCompState);
     971                 :          0 :     aPositionED     .SetText(aItem.aCompPosition);
     972                 :          0 :     aPhoneED        .SetText(aItem.aCompPhone);
     973                 :          0 :     aMobilePhoneED  .SetText(aItem.aCompMobile);
     974                 :          0 :     aFaxED          .SetText(aItem.aCompFax);
     975                 :          0 :     aHomePageED     .SetText(aItem.aCompWWW);
     976                 :          0 :     aMailED         .SetText(aItem.aCompMail);
     977                 :          0 : }
     978                 :            : 
     979                 :            : 
     980                 :            : 
     981                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10