2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 18:09:40 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-16 21:54:43 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
2004-08-23 07:51:02 +00:00
|
|
|
#ifdef SW_DLLIMPLEMENTATION
|
|
|
|
#undef SW_DLLIMPLEMENTATION
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <vcl/waitobj.hxx>
|
2001-11-14 15:34:12 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
#include <com/sun/star/uno/Sequence.h>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <swtypes.hxx>
|
|
|
|
#include <wrtsh.hxx>
|
|
|
|
#include <initui.hxx>
|
|
|
|
#include <labimp.hxx>
|
|
|
|
#include <labfmt.hxx>
|
|
|
|
#include <labprt.hxx>
|
|
|
|
#include <unotools.hxx>
|
|
|
|
#include <dbmgr.hxx>
|
2004-03-17 11:19:36 +00:00
|
|
|
#include "uitool.hxx"
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <cmdid.h>
|
|
|
|
#include <helpid.h>
|
|
|
|
#include <globals.hrc>
|
|
|
|
#include <label.hrc>
|
2000-10-06 12:41:54 +00:00
|
|
|
|
2007-09-27 10:42:56 +00:00
|
|
|
//impl in envimg.cxx
|
|
|
|
extern SW_DLLPUBLIC String MakeSender();
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
SV_IMPL_PTRARR( SwLabRecs, SwLabRec* );
|
|
|
|
|
2001-11-14 15:34:12 +00:00
|
|
|
void SwLabRec::SetFromItem( const SwLabItem& rItem )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
lHDist = rItem.lHDist;
|
|
|
|
lVDist = rItem.lVDist;
|
|
|
|
lWidth = rItem.lWidth;
|
|
|
|
lHeight = rItem.lHeight;
|
|
|
|
lLeft = rItem.lLeft;
|
|
|
|
lUpper = rItem.lUpper;
|
|
|
|
nCols = rItem.nCols;
|
|
|
|
nRows = rItem.nRows;
|
|
|
|
bCont = rItem.bCont;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2001-11-14 15:34:12 +00:00
|
|
|
void SwLabRec::FillItem( SwLabItem& rItem ) const
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
rItem.lHDist = lHDist;
|
|
|
|
rItem.lVDist = lVDist;
|
|
|
|
rItem.lWidth = lWidth;
|
|
|
|
rItem.lHeight = lHeight;
|
|
|
|
rItem.lLeft = lLeft;
|
|
|
|
rItem.lUpper = lUpper;
|
|
|
|
rItem.nCols = nCols;
|
|
|
|
rItem.nRows = nRows;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2002-09-09 07:42:38 +00:00
|
|
|
void SwLabDlg::_ReplaceGroup( const String &rMake )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2010-10-20 15:36:15 +01:00
|
|
|
// Remove old entries
|
2000-09-18 16:15:01 +00:00
|
|
|
pRecs->Remove( 1, pRecs->Count() - 1 );
|
2001-11-14 15:34:12 +00:00
|
|
|
aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
|
2000-09-18 16:15:01 +00:00
|
|
|
aLstGroup = rMake;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
|
|
|
|
{
|
|
|
|
if (nId == TP_LAB_LAB)
|
|
|
|
{
|
|
|
|
if(m_bLabel)
|
|
|
|
{
|
|
|
|
((SwLabPage*)&rPage)->SetNewDBMgr(pNewDBMgr);
|
|
|
|
((SwLabPage*)&rPage)->InitDatabaseBox();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
((SwLabPage*)&rPage)->SetToBusinessCard();
|
|
|
|
}
|
|
|
|
else if (nId == TP_LAB_PRT)
|
|
|
|
pPrtPage = (SwLabPrtPage*)&rPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
|
|
|
|
SwNewDBMgr* pDBMgr, sal_Bool bLabel) :
|
|
|
|
SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ),
|
2007-09-27 10:42:56 +00:00
|
|
|
pNewDBMgr(pDBMgr),
|
|
|
|
pPrtPage(0),
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
aTypeIds( 50, 10 ),
|
|
|
|
aMakes ( 5, 0 ),
|
2007-09-27 10:42:56 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
pRecs ( new SwLabRecs() ),
|
2007-09-27 10:42:56 +00:00
|
|
|
sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)),
|
|
|
|
sFormat(SW_RES(ST_FIRSTPAGE_LAB)),
|
|
|
|
sMedium(SW_RES(ST_FIRSTPAGE_BC)),
|
2000-09-18 16:15:01 +00:00
|
|
|
m_bLabel(bLabel)
|
|
|
|
{
|
|
|
|
WaitObject aWait( pParent );
|
|
|
|
|
|
|
|
FreeResource();
|
|
|
|
|
|
|
|
GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC)));
|
|
|
|
GetOKButton().SetHelpId(HID_LABEL_INSERT);
|
|
|
|
GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
|
|
|
|
|
|
|
|
AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage ::Create, 0, sal_False, 0);
|
|
|
|
AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0);
|
|
|
|
AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0);
|
|
|
|
AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0);
|
|
|
|
AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 );
|
|
|
|
AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if(m_bLabel)
|
|
|
|
{
|
|
|
|
RemoveTabPage(TP_BUSINESS_DATA);
|
|
|
|
RemoveTabPage(TP_PRIVATE_DATA);
|
|
|
|
RemoveTabPage(TP_VISITING_CARDS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetText(sBusinessCardDlg);
|
|
|
|
}
|
2010-10-20 15:36:15 +01:00
|
|
|
// Read user label from writer.cfg
|
2001-04-26 18:45:44 +00:00
|
|
|
SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL ));
|
2000-09-18 16:15:01 +00:00
|
|
|
SwLabRec* pRec = new SwLabRec;
|
|
|
|
const String aTmp( SW_RES( STR_CUSTOM ) );
|
|
|
|
pRec->aMake = pRec->aType = aTmp;
|
2001-11-14 15:34:12 +00:00
|
|
|
pRec->SetFromItem( aItem );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
sal_Bool bDouble = sal_False;
|
|
|
|
|
|
|
|
for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++)
|
|
|
|
{
|
|
|
|
if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake &&
|
|
|
|
pRec->aType == pRecs->GetObject(nRecPos)->aType)
|
|
|
|
{
|
|
|
|
bDouble = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bDouble)
|
|
|
|
pRecs->C40_INSERT( SwLabRec, pRec, 0 );
|
|
|
|
|
|
|
|
sal_uInt16 nLstGroup = 0;
|
2001-11-14 15:34:12 +00:00
|
|
|
const UNO_NMSPC::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
|
|
|
|
const rtl::OUString* pMan = rMan.getConstArray();
|
2001-01-15 13:05:11 +00:00
|
|
|
for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-01-15 13:05:11 +00:00
|
|
|
aMakes.Insert( new String(pMan[nMan]), aMakes.Count() );
|
|
|
|
if ( pMan[nMan] == aItem.aLstMake )
|
2001-11-14 15:34:12 +00:00
|
|
|
nLstGroup = (sal_uInt16) nMan;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2001-01-15 13:05:11 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( aMakes.Count() )
|
2002-09-09 07:42:38 +00:00
|
|
|
_ReplaceGroup( *aMakes[nLstGroup] );
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
if (pExampleSet)
|
|
|
|
pExampleSet->Put(aItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabDlg::~SwLabDlg()
|
|
|
|
{
|
|
|
|
delete pRecs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabDlg::GetLabItem(SwLabItem &rItem)
|
|
|
|
{
|
|
|
|
const SwLabItem& rActItem = (const SwLabItem&)GetExampleSet()->Get(FN_LABEL);
|
|
|
|
const SwLabItem& rOldItem = (const SwLabItem&)GetInputSetImpl()->Get(FN_LABEL);
|
|
|
|
|
|
|
|
if (rActItem != rOldItem)
|
2010-10-20 15:36:15 +01:00
|
|
|
{
|
|
|
|
// Wurde schon mal mit (hoffentlich) korrektem Inhalt "geputtet"
|
2000-09-18 16:15:01 +00:00
|
|
|
rItem = rActItem;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rItem = rOldItem;
|
|
|
|
|
2010-10-20 15:36:15 +01:00
|
|
|
// In rItem there are only settings defined by users.
|
|
|
|
// Therefore get the real settings directly from Record
|
2000-09-18 16:15:01 +00:00
|
|
|
SwLabRec* pRec = GetRecord(rItem.aType, rItem.bCont);
|
2001-11-14 15:34:12 +00:00
|
|
|
pRec->FillItem( rItem );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
|
|
|
|
{
|
|
|
|
SwLabRec* pRec = NULL;
|
|
|
|
sal_Bool bFound = sal_False;
|
|
|
|
String sCustom(SW_RES(STR_CUSTOM));
|
|
|
|
|
|
|
|
const sal_uInt16 nCount = Recs().Count();
|
|
|
|
for (sal_uInt16 i = 0; i < nCount; i++)
|
|
|
|
{
|
|
|
|
pRec = Recs()[i];
|
|
|
|
if (pRec->aType != sCustom &&
|
|
|
|
rRecName == pRec->aType && bCont == pRec->bCont)
|
|
|
|
{
|
|
|
|
bFound = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-10-20 15:36:15 +01:00
|
|
|
if (!bFound) // User defined
|
2000-09-18 16:15:01 +00:00
|
|
|
pRec = Recs()[0];
|
|
|
|
|
|
|
|
return(pRec);
|
|
|
|
}
|
|
|
|
|
|
|
|
Printer *SwLabDlg::GetPrt()
|
|
|
|
{
|
|
|
|
if (pPrtPage)
|
|
|
|
return (pPrtPage->GetPrt());
|
|
|
|
else
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) :
|
|
|
|
SfxTabPage(pParent, SW_RES(TP_LAB_LAB), rSet),
|
|
|
|
pNewDBMgr(NULL),
|
|
|
|
aItem ((const SwLabItem&) rSet.Get(FN_LABEL)),
|
|
|
|
|
|
|
|
aWritingText (this, SW_RES(TXT_WRITING)),
|
|
|
|
aAddrBox (this, SW_RES(BOX_ADDR )),
|
|
|
|
aWritingEdit (this, SW_RES(EDT_WRITING)),
|
|
|
|
aDatabaseFT (this, SW_RES(FT_DATABASE)),
|
|
|
|
aDatabaseLB (this, SW_RES(LB_DATABASE)),
|
|
|
|
aTableFT (this, SW_RES(FT_TABLE )),
|
|
|
|
aTableLB (this, SW_RES(LB_TABLE )),
|
|
|
|
aInsertBT (this, SW_RES(BTN_INSERT )),
|
|
|
|
aDBFieldFT (this, SW_RES(FT_DBFIELD )),
|
|
|
|
aDBFieldLB (this, SW_RES(LB_DBFIELD )),
|
2001-06-01 10:04:53 +00:00
|
|
|
aWritingFL (this, SW_RES(FL_WRITING)),
|
2000-09-18 16:15:01 +00:00
|
|
|
aContButton (this, SW_RES(BTN_CONT )),
|
|
|
|
aSheetButton (this, SW_RES(BTN_SHEET )),
|
|
|
|
aMakeText (this, SW_RES(TXT_MAKE )),
|
|
|
|
aMakeBox (this, SW_RES(BOX_MAKE )),
|
|
|
|
aTypeText (this, SW_RES(TXT_TYPE )),
|
|
|
|
aTypeBox (this, SW_RES(BOX_TYPE )),
|
2001-07-02 08:44:44 +00:00
|
|
|
aHiddenSortTypeBox(this, WB_SORT|WB_HIDE),
|
2000-09-18 16:15:01 +00:00
|
|
|
aFormatInfo (this, SW_RES(INF_FORMAT )),
|
2001-06-01 10:04:53 +00:00
|
|
|
aFormatFL (this, SW_RES(FL_FORMAT ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
WaitObject aWait( pParent );
|
|
|
|
|
|
|
|
FreeResource();
|
|
|
|
SetExchangeSupport();
|
|
|
|
|
|
|
|
|
2010-10-20 15:36:15 +01:00
|
|
|
// Install handlers
|
2000-09-18 16:15:01 +00:00
|
|
|
aAddrBox .SetClickHdl (LINK(this, SwLabPage, AddrHdl ));
|
|
|
|
aDatabaseLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
|
|
|
|
aTableLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
|
|
|
|
aInsertBT .SetClickHdl (LINK(this, SwLabPage, FieldHdl ));
|
|
|
|
aContButton .SetClickHdl (LINK(this, SwLabPage, PageHdl ));
|
|
|
|
aSheetButton .SetClickHdl (LINK(this, SwLabPage, PageHdl ));
|
|
|
|
aMakeBox .SetSelectHdl(LINK(this, SwLabPage, MakeHdl ));
|
|
|
|
aTypeBox .SetSelectHdl(LINK(this, SwLabPage, TypeHdl ));
|
|
|
|
|
|
|
|
InitDatabaseBox();
|
|
|
|
|
|
|
|
sal_uInt16 nLstGroup = 0;
|
|
|
|
|
|
|
|
const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
|
|
|
|
for (sal_uInt16 i = 0; i < nCount; ++i)
|
|
|
|
{
|
|
|
|
String &rStr = *GetParent()->Makes()[i];
|
|
|
|
aMakeBox.InsertEntry( rStr );
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-26 10:55:45 +00:00
|
|
|
if ( rStr == String(aItem.aLstMake) )
|
2000-09-18 16:15:01 +00:00
|
|
|
nLstGroup = i;
|
|
|
|
}
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
aMakeBox.SelectEntryPos( nLstGroup );
|
|
|
|
aMakeBox.GetSelectHdl().Call( &aMakeBox );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabPage::~SwLabPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_ChgYPos(Window& rWin, long nDiff)
|
|
|
|
{
|
|
|
|
Point aTempPos(rWin.GetPosPixel());
|
|
|
|
aTempPos.Y() += nDiff;
|
|
|
|
rWin.SetPosPixel(aTempPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabPage::SetToBusinessCard()
|
|
|
|
{
|
2001-09-14 13:53:53 +00:00
|
|
|
SetHelpId(HID_BUSINESS_FMT_PAGE);
|
2001-09-28 08:32:33 +00:00
|
|
|
aContButton.SetHelpId(HID_BUSINESS_FMT_PAGE_CONT);
|
|
|
|
aSheetButton.SetHelpId(HID_BUSINESS_FMT_PAGE_SHEET);
|
|
|
|
aMakeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_BRAND);
|
|
|
|
aTypeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_TYPE);
|
2000-09-18 16:15:01 +00:00
|
|
|
m_bLabel = sal_False;
|
|
|
|
aWritingText.Hide();
|
|
|
|
aAddrBox.Hide();
|
|
|
|
aWritingEdit.Hide();
|
|
|
|
aDatabaseFT.Hide();
|
|
|
|
aDatabaseLB.Hide();
|
|
|
|
aTableFT.Hide();
|
|
|
|
aTableLB.Hide();
|
|
|
|
aInsertBT.Hide();
|
|
|
|
aDBFieldFT.Hide();
|
|
|
|
aDBFieldLB.Hide();
|
2001-06-01 10:04:53 +00:00
|
|
|
aWritingFL.Hide();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
//resize the form
|
2001-06-01 10:04:53 +00:00
|
|
|
Point aFLPos(aWritingFL.GetPosPixel());
|
|
|
|
long nDiffPos = aFormatFL.GetPosPixel().Y() - aFLPos.Y();
|
|
|
|
Size aFLSz(aFormatFL.GetSizePixel());
|
|
|
|
aFormatFL.SetPosSizePixel(aFLPos, aFLSz);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
// move all controls up
|
|
|
|
lcl_ChgYPos(aContButton, -nDiffPos);
|
|
|
|
lcl_ChgYPos(aSheetButton, -nDiffPos);
|
|
|
|
lcl_ChgYPos(aMakeText, -nDiffPos);
|
|
|
|
|
|
|
|
lcl_ChgYPos(aTypeText, -nDiffPos);
|
|
|
|
lcl_ChgYPos(aFormatInfo, -nDiffPos);
|
|
|
|
|
|
|
|
Size aTmpSz(3, 3);
|
|
|
|
aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
|
|
|
|
|
|
|
|
lcl_ChgYPos(aMakeBox, - nDiffPos);
|
|
|
|
Point aLBPos(aMakeBox.GetPosPixel());
|
|
|
|
aLBPos.Y() += aMakeBox.GetSizePixel().Height() + aTmpSz.Height();
|
|
|
|
aTypeBox.SetPosPixel(aLBPos);
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPL_LINK( SwLabPage, AddrHdl, Button *, EMPTYARG )
|
|
|
|
{
|
|
|
|
String aWriting;
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( aAddrBox.IsChecked() )
|
|
|
|
aWriting = MakeSender();
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
aWritingEdit.SetText( aWriting.ConvertLineEnd() );
|
|
|
|
aWritingEdit.GrabFocus();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( SwLabPage, DatabaseHdl, ListBox *, pListBox )
|
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
sActDBName = aDatabaseLB.GetSelectEntry();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
WaitObject aObj( GetParent() );
|
|
|
|
|
|
|
|
if (pListBox == &aDatabaseLB)
|
|
|
|
GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName);
|
2010-10-20 15:36:15 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, aTableLB.GetSelectEntry());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( SwLabPage, FieldHdl, Button *, EMPTYARG )
|
|
|
|
{
|
|
|
|
String aStr ( '<' );
|
|
|
|
aStr += aDatabaseLB.GetSelectEntry();
|
|
|
|
aStr += '.';
|
|
|
|
aStr += aTableLB.GetSelectEntry();
|
|
|
|
aStr += '.';
|
2001-07-20 11:49:57 +00:00
|
|
|
aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1';
|
|
|
|
aStr += '.';
|
2000-09-18 16:15:01 +00:00
|
|
|
aStr += aDBFieldLB.GetSelectEntry();
|
|
|
|
aStr += '>';
|
|
|
|
aWritingEdit.ReplaceSelected(aStr);
|
|
|
|
Selection aSel = aWritingEdit.GetSelection();
|
|
|
|
aWritingEdit.GrabFocus();
|
|
|
|
aWritingEdit.SetSelection(aSel);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK_INLINE_START( SwLabPage, PageHdl, Button *, EMPTYARG )
|
|
|
|
{
|
|
|
|
aMakeBox.GetSelectHdl().Call( &aMakeBox );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
IMPL_LINK_INLINE_END( SwLabPage, PageHdl, Button *, EMPTYARG )
|
|
|
|
|
|
|
|
IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG )
|
|
|
|
{
|
|
|
|
WaitObject aWait( GetParent() );
|
|
|
|
|
|
|
|
aTypeBox.Clear();
|
2001-07-02 08:44:44 +00:00
|
|
|
aHiddenSortTypeBox.Clear();
|
2000-09-18 16:15:01 +00:00
|
|
|
GetParent()->TypeIds().Remove( 0, GetParent()->TypeIds().Count() );
|
|
|
|
|
|
|
|
const String aMake = aMakeBox.GetSelectEntry();
|
2002-09-09 07:42:38 +00:00
|
|
|
GetParent()->ReplaceGroup( aMake );
|
2000-09-18 16:15:01 +00:00
|
|
|
aItem.aLstMake = aMake;
|
|
|
|
|
|
|
|
const sal_Bool bCont = aContButton.IsChecked();
|
|
|
|
const sal_uInt16 nCount = GetParent()->Recs().Count();
|
|
|
|
sal_uInt16 nLstType = 0;
|
|
|
|
|
2001-07-02 08:44:44 +00:00
|
|
|
const String sCustom(SW_RES(STR_CUSTOM));
|
|
|
|
//insert the entries into the sorted list box
|
2000-09-18 16:15:01 +00:00
|
|
|
for ( sal_uInt16 i = 0; i < nCount; ++i )
|
|
|
|
{
|
2001-07-02 08:44:44 +00:00
|
|
|
const String aType ( GetParent()->Recs()[i]->aType );
|
|
|
|
BOOL bInsert = FALSE;
|
|
|
|
if ( GetParent()->Recs()[i]->aType == sCustom )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-07-02 08:44:44 +00:00
|
|
|
bInsert = TRUE;
|
|
|
|
aTypeBox.InsertEntry(aType );
|
|
|
|
}
|
|
|
|
else if ( GetParent()->Recs()[i]->bCont == bCont )
|
|
|
|
{
|
|
|
|
if ( aHiddenSortTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-07-02 08:44:44 +00:00
|
|
|
bInsert = TRUE;
|
|
|
|
aHiddenSortTypeBox.InsertEntry( aType );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-02 08:44:44 +00:00
|
|
|
if(bInsert)
|
|
|
|
{
|
|
|
|
GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count());
|
|
|
|
if ( !nLstType && aType == String(aItem.aLstType) )
|
|
|
|
nLstType = GetParent()->TypeIds().Count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++)
|
|
|
|
{
|
|
|
|
aTypeBox.InsertEntry(aHiddenSortTypeBox.GetEntry(nEntry));
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
if (nLstType)
|
|
|
|
aTypeBox.SelectEntry(aItem.aLstType);
|
|
|
|
else
|
|
|
|
aTypeBox.SelectEntryPos(0);
|
|
|
|
aTypeBox.GetSelectHdl().Call( &aTypeBox );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK_INLINE_START( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
|
|
|
|
{
|
|
|
|
DisplayFormat();
|
|
|
|
aItem.aType = aTypeBox.GetSelectEntry();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
IMPL_LINK_INLINE_END( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
|
|
|
|
|
|
|
|
void SwLabPage::DisplayFormat()
|
|
|
|
{
|
|
|
|
MetricField aField(this, WinBits(0));
|
2004-03-17 11:19:36 +00:00
|
|
|
FieldUnit aMetric = ::GetDfltMetric(FALSE);
|
|
|
|
SetMetric(aField, aMetric);
|
2000-09-18 16:15:01 +00:00
|
|
|
aField.SetDecimalDigits(2);
|
|
|
|
aField.SetMin (0);
|
|
|
|
aField.SetMax (LONG_MAX);
|
|
|
|
|
|
|
|
SwLabRec* pRec = GetSelectedEntryPos();
|
|
|
|
aItem.aLstType = pRec->aType;
|
|
|
|
SETFLDVAL(aField, pRec->lWidth);
|
|
|
|
aField.Reformat();
|
|
|
|
const String aWString = aField.GetText();
|
|
|
|
|
|
|
|
SETFLDVAL(aField, pRec->lHeight);
|
|
|
|
aField.Reformat();
|
|
|
|
|
|
|
|
String aText = pRec->aType;
|
|
|
|
aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
|
|
|
|
aText += aWString;
|
|
|
|
aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
|
|
|
|
aText += aField.GetText();
|
|
|
|
aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" ("));
|
|
|
|
aText += String::CreateFromInt32( pRec->nCols );
|
|
|
|
aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
|
|
|
|
aText += String::CreateFromInt32( pRec->nRows );
|
|
|
|
aText += ')';
|
|
|
|
aFormatInfo.SetText(aText);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwLabRec* SwLabPage::GetSelectedEntryPos()
|
|
|
|
{
|
|
|
|
String sSelEntry(aTypeBox.GetSelectEntry());
|
|
|
|
|
|
|
|
return GetParent()->GetRecord(sSelEntry, aContButton.IsChecked());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabPage::InitDatabaseBox()
|
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
if( GetNewDBMgr() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
aDatabaseLB.Clear();
|
2001-11-14 15:34:12 +00:00
|
|
|
UNO_NMSPC::Sequence<rtl::OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames();
|
|
|
|
const rtl::OUString* pDataNames = aDataNames.getConstArray();
|
2000-09-18 16:15:01 +00:00
|
|
|
for (long i = 0; i < aDataNames.getLength(); i++)
|
|
|
|
aDatabaseLB.InsertEntry(pDataNames[i]);
|
|
|
|
String sDBName = sActDBName.GetToken( 0, DB_DELIM );
|
|
|
|
String sTableName = sActDBName.GetToken( 1, DB_DELIM );
|
|
|
|
aDatabaseLB.SelectEntry(sDBName);
|
2004-11-09 11:56:22 +00:00
|
|
|
if( sDBName.Len() && GetNewDBMgr()->GetTableNames(&aTableLB, sDBName))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
aTableLB.SelectEntry(sTableName);
|
|
|
|
GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, sTableName);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aDBFieldLB.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SwLabPage::Create(Window* pParent, const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
return new SwLabPage(pParent, rSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabPage::ActivatePage(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
Reset( rSet );
|
|
|
|
}
|
2010-10-10 04:21:45 -05:00
|
|
|
|
2007-09-27 10:42:56 +00:00
|
|
|
int SwLabPage::DeactivatePage(SfxItemSet* _pSet)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 10:42:56 +00:00
|
|
|
if (_pSet)
|
|
|
|
FillItemSet(*_pSet);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabPage::FillItem(SwLabItem& rItem)
|
|
|
|
{
|
|
|
|
rItem.bAddr = aAddrBox.IsChecked();
|
|
|
|
rItem.aWriting = aWritingEdit.GetText();
|
|
|
|
rItem.bCont = aContButton.IsChecked();
|
|
|
|
rItem.aMake = aMakeBox.GetSelectEntry();
|
|
|
|
rItem.aType = aTypeBox.GetSelectEntry();
|
|
|
|
rItem.sDBName = sActDBName;
|
|
|
|
|
|
|
|
SwLabRec* pRec = GetSelectedEntryPos();
|
2001-11-14 15:34:12 +00:00
|
|
|
pRec->FillItem( rItem );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
rItem.aLstMake = aMakeBox.GetSelectEntry();
|
|
|
|
rItem.aLstType = aTypeBox.GetSelectEntry();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
FillItem( aItem );
|
|
|
|
rSet.Put( aItem );
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwLabPage::Reset(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
|
|
|
|
String sDBName = aItem.sDBName;
|
|
|
|
|
|
|
|
String aWriting( aItem.aWriting );
|
|
|
|
|
|
|
|
aAddrBox .Check ( aItem.bAddr );
|
|
|
|
aWritingEdit.SetText ( aWriting.ConvertLineEnd() );
|
|
|
|
|
2001-01-24 08:06:54 +00:00
|
|
|
const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
|
|
|
|
for (sal_uInt16 i = 0; i < nCount; ++i)
|
|
|
|
{
|
|
|
|
String &rStr = *GetParent()->Makes()[i];
|
|
|
|
if(aMakeBox.GetEntryPos(String(rStr)) == LISTBOX_ENTRY_NOTFOUND)
|
|
|
|
aMakeBox.InsertEntry( rStr );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
aMakeBox .SelectEntry( aItem.aMake );
|
|
|
|
//save the current type
|
|
|
|
String sType(aItem.aType);
|
|
|
|
aMakeBox.GetSelectHdl().Call( &aMakeBox );
|
|
|
|
aItem.aType = sType;
|
2002-09-09 07:42:38 +00:00
|
|
|
//#102806# a newly added make may not be in the type ListBox already
|
|
|
|
if (aTypeBox.GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && aItem.aMake.getLength())
|
|
|
|
GetParent()->UpdateGroup( aItem.aMake );
|
2000-09-26 10:55:45 +00:00
|
|
|
if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
aTypeBox.SelectEntry(aItem.aType);
|
|
|
|
aTypeBox.GetSelectHdl().Call(&aTypeBox);
|
|
|
|
}
|
|
|
|
if (aDatabaseLB.GetEntryPos(sDBName) != LISTBOX_ENTRY_NOTFOUND)
|
|
|
|
{
|
|
|
|
aDatabaseLB.SelectEntry(sDBName);
|
|
|
|
aDatabaseLB.GetSelectHdl().Call(&aDatabaseLB);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aItem.bCont)
|
|
|
|
aContButton .Check();
|
|
|
|
else
|
|
|
|
aSheetButton.Check();
|
|
|
|
}
|
2001-04-26 18:45:44 +00:00
|
|
|
|
2001-11-14 15:34:12 +00:00
|
|
|
void SwVisitingCardPage::ClearUserData()
|
2001-04-26 18:45:44 +00:00
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
SvLBoxEntry* pEntry = aAutoTextLB.First();
|
2001-04-26 18:45:44 +00:00
|
|
|
while(pEntry)
|
|
|
|
{
|
|
|
|
delete (String*)pEntry->GetUserData();
|
2001-11-14 15:34:12 +00:00
|
|
|
pEntry = aAutoTextLB.Next(pEntry);
|
2001-04-26 18:45:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-14 15:34:12 +00:00
|
|
|
void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt,
|
|
|
|
const rtl::OUString* pNames, const rtl::OUString* pValues )
|
2001-04-26 18:45:44 +00:00
|
|
|
{
|
|
|
|
for( sal_uInt32 i = 0; i < nCnt; ++i )
|
|
|
|
{
|
2001-11-14 15:34:12 +00:00
|
|
|
SvLBoxEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] );
|
2001-04-26 18:45:44 +00:00
|
|
|
pEntry->SetUserData( new String( pValues[ i ] ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) :
|
|
|
|
SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet),
|
2007-04-26 08:08:15 +00:00
|
|
|
aAutoTextLB(this, SW_RES( LB_AUTO_TEXT )),
|
|
|
|
aAutoTextGroupFT(this, SW_RES( FT_AUTO_TEXT_GROUP )),
|
|
|
|
aAutoTextGroupLB(this, SW_RES( LB_AUTO_TEXT_GROUP )),
|
|
|
|
aContentFL(this, SW_RES( FL_CONTENT )),
|
|
|
|
aExampleWIN(this, SW_RES( WIN_EXAMPLE )),
|
|
|
|
sVisCardGroup(SW_RES(ST_VISCARD_GROUP)),
|
2001-04-26 18:45:44 +00:00
|
|
|
pExampleFrame(0)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
aAutoTextLB.SetWindowBits( WB_HSCROLL );
|
|
|
|
aAutoTextLB.SetSpaceBetweenEntries(0);
|
|
|
|
aAutoTextLB.SetSelectionMode( SINGLE_SELECTION );
|
|
|
|
aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT);
|
|
|
|
|
|
|
|
SetExchangeSupport();
|
|
|
|
aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
|
|
|
|
aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
|
|
|
|
|
2001-04-26 18:45:44 +00:00
|
|
|
aExampleWIN.Hide();
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
aAutoTextLB.Show();
|
|
|
|
aAutoTextGroupFT.Show();
|
|
|
|
aAutoTextGroupLB.Show();
|
|
|
|
InitFrameControl();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwVisitingCardPage::~SwVisitingCardPage()
|
|
|
|
{
|
|
|
|
for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++)
|
|
|
|
delete (String*)aAutoTextGroupLB.GetEntryData( i );
|
|
|
|
_xAutoText = 0;
|
2001-04-26 18:45:44 +00:00
|
|
|
|
2001-11-14 15:34:12 +00:00
|
|
|
ClearUserData();
|
2000-09-18 16:15:01 +00:00
|
|
|
delete pExampleFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SwVisitingCardPage::Create(Window* pParent, const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
return new SwVisitingCardPage(pParent, rSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
Reset( rSet );
|
|
|
|
UpdateFields();
|
|
|
|
}
|
|
|
|
|
2007-09-27 10:42:56 +00:00
|
|
|
int SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 10:42:56 +00:00
|
|
|
if (_pSet)
|
|
|
|
FillItemSet(*_pSet);
|
2000-09-18 16:15:01 +00:00
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
String* pGroup = (String*)aAutoTextGroupLB.GetEntryData(
|
|
|
|
aAutoTextGroupLB.GetSelectEntryPos());
|
2010-10-20 15:36:15 +01:00
|
|
|
OSL_ENSURE(pGroup, "no group selected?");
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
if(pGroup)
|
|
|
|
aLabItem.sGlossaryGroup = *pGroup;
|
|
|
|
|
|
|
|
SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
|
|
|
|
if(pSelEntry)
|
|
|
|
aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData();
|
|
|
|
rSet.Put(aLabItem);
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
|
|
|
|
{
|
|
|
|
SvLBoxEntry* pEntry = rAutoTextLB.First();
|
|
|
|
while(pEntry)
|
|
|
|
{
|
|
|
|
if(*(String*)pEntry->GetUserData() == rBlockName)
|
|
|
|
{
|
|
|
|
rAutoTextLB.Select(pEntry);
|
|
|
|
rAutoTextLB.MakeVisible(pEntry);
|
2001-04-26 18:45:44 +00:00
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
pEntry = rAutoTextLB.Next(pEntry);
|
|
|
|
}
|
|
|
|
}
|
2010-10-10 04:21:45 -05:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
sal_Bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
|
|
|
|
{
|
|
|
|
SvLBoxEntry* pEntry = rAutoTextLB.First();
|
|
|
|
while(pEntry)
|
|
|
|
{
|
|
|
|
if(*(String*)pEntry->GetUserData() == rBlockName)
|
|
|
|
{
|
|
|
|
rAutoTextLB.Select(pEntry);
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
pEntry = rAutoTextLB.Next(pEntry);
|
|
|
|
}
|
|
|
|
return sal_False;
|
|
|
|
}
|
2001-04-26 18:45:44 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
void SwVisitingCardPage::Reset(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
aLabItem = (const SwLabItem&) rSet.Get(FN_LABEL);
|
|
|
|
|
|
|
|
sal_Bool bFound = sal_False;
|
2003-05-22 07:47:05 +00:00
|
|
|
sal_uInt16 i;
|
|
|
|
for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
|
2001-11-14 15:34:12 +00:00
|
|
|
if( String(aLabItem.sGlossaryGroup) ==
|
|
|
|
*(String*)aAutoTextGroupLB.GetEntryData( i ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
bFound = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-05-22 07:47:05 +00:00
|
|
|
if(!bFound)
|
|
|
|
{
|
|
|
|
// initially search for a group starting with "crd" which is the name of the
|
|
|
|
// business card AutoTexts
|
|
|
|
for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
|
|
|
|
if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") )
|
|
|
|
{
|
|
|
|
bFound = sal_True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
if(bFound)
|
|
|
|
{
|
|
|
|
if(aAutoTextGroupLB.GetSelectEntryPos() != i)
|
|
|
|
{
|
|
|
|
aAutoTextGroupLB.SelectEntryPos(i);
|
|
|
|
AutoTextSelectHdl(&aAutoTextGroupLB);
|
|
|
|
}
|
|
|
|
if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName))
|
|
|
|
{
|
|
|
|
SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
|
|
|
|
if( pSelEntry &&
|
2000-09-26 10:55:45 +00:00
|
|
|
*(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName);
|
|
|
|
AutoTextSelectHdl(&aAutoTextLB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwPrivateDataPage::SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet) :
|
|
|
|
SfxTabPage(pParent, SW_RES(TP_PRIVATE_DATA), rSet),
|
2007-04-26 08:08:15 +00:00
|
|
|
aDataFL (this, SW_RES( FL_DATA )),
|
2007-09-27 10:42:56 +00:00
|
|
|
|
|
|
|
aNameFT (this, SW_RES( FT_NAME )),
|
2007-04-26 08:08:15 +00:00
|
|
|
aFirstNameED (this, SW_RES( ED_FIRSTNAME )),
|
|
|
|
aNameED (this, SW_RES( ED_NAME )),
|
|
|
|
aShortCutED (this, SW_RES( ED_SHORTCUT )),
|
2007-09-27 10:42:56 +00:00
|
|
|
|
|
|
|
aName2FT (this, SW_RES( FT_NAME_2 )),
|
2007-04-26 08:08:15 +00:00
|
|
|
aFirstName2ED (this, SW_RES( ED_FIRSTNAME_2)),
|
|
|
|
aName2ED (this, SW_RES( ED_NAME_2 )),
|
|
|
|
aShortCut2ED (this, SW_RES( ED_SHORTCUT_2 )),
|
2007-09-27 10:42:56 +00:00
|
|
|
|
|
|
|
aStreetFT (this, SW_RES( FT_STREET )),
|
2007-04-26 08:08:15 +00:00
|
|
|
aStreetED (this, SW_RES( ED_STREET )),
|
|
|
|
aZipCityFT (this, SW_RES( FT_ZIPCITY )),
|
|
|
|
aZipED (this, SW_RES( ED_ZIP )),
|
|
|
|
aCityED (this, SW_RES( ED_CITY )),
|
|
|
|
aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )),
|
|
|
|
aCountryED (this, SW_RES( ED_COUNTRY )),
|
|
|
|
aStateED (this, SW_RES( ED_STATE )),
|
|
|
|
aTitleProfessionFT (this, SW_RES( FT_TITLEPROF )),
|
|
|
|
aTitleED (this, SW_RES( ED_TITLE )),
|
2007-09-27 10:42:56 +00:00
|
|
|
aProfessionED (this, SW_RES( ED_PROFESSION )),
|
2007-04-26 08:08:15 +00:00
|
|
|
aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )),
|
|
|
|
aPhoneED (this, SW_RES( ED_PHONE )),
|
|
|
|
aMobilePhoneED (this, SW_RES( ED_MOBILE )),
|
|
|
|
aFaxFT (this, SW_RES( FT_FAX )),
|
|
|
|
aFaxED (this, SW_RES( ED_FAX )),
|
|
|
|
aWWWMailFT (this, SW_RES( FT_WWWMAIL )),
|
|
|
|
aHomePageED (this, SW_RES( ED_WWW )),
|
|
|
|
aMailED (this, SW_RES( ED_MAIL ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
SetExchangeSupport();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwPrivateDataPage::~SwPrivateDataPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SwPrivateDataPage::Create(Window* pParent, const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
return new SwPrivateDataPage(pParent, rSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
Reset(rSet);
|
|
|
|
}
|
|
|
|
|
2007-09-27 10:42:56 +00:00
|
|
|
int SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 10:42:56 +00:00
|
|
|
if (_pSet)
|
|
|
|
FillItemSet(*_pSet);
|
2000-09-18 16:15:01 +00:00
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwPrivateDataPage::FillItemSet(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
|
|
|
|
SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
|
|
|
|
aItem.aPrivFirstName = aFirstNameED .GetText();
|
|
|
|
aItem.aPrivName = aNameED .GetText( );
|
|
|
|
aItem.aPrivShortCut = aShortCutED .GetText( );
|
|
|
|
aItem.aPrivFirstName2 = aFirstName2ED .GetText();
|
|
|
|
aItem.aPrivName2 = aName2ED .GetText( );
|
|
|
|
aItem.aPrivShortCut2 = aShortCut2ED .GetText( );
|
|
|
|
aItem.aPrivStreet = aStreetED .GetText( );
|
|
|
|
aItem.aPrivZip = aZipED .GetText( );
|
|
|
|
aItem.aPrivCity = aCityED .GetText( );
|
|
|
|
aItem.aPrivCountry = aCountryED .GetText( );
|
|
|
|
aItem.aPrivState = aStateED .GetText( );
|
|
|
|
aItem.aPrivTitle = aTitleED .GetText( );
|
|
|
|
aItem.aPrivProfession= aProfessionED.GetText( );
|
|
|
|
aItem.aPrivPhone = aPhoneED .GetText( );
|
|
|
|
aItem.aPrivMobile = aMobilePhoneED.GetText( );
|
|
|
|
aItem.aPrivFax = aFaxED .GetText( );
|
|
|
|
aItem.aPrivWWW = aHomePageED .GetText( );
|
|
|
|
aItem.aPrivMail = aMailED .GetText( );
|
|
|
|
|
|
|
|
rSet.Put(aItem);
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwPrivateDataPage::Reset(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
|
|
|
|
aFirstNameED.SetText(aItem.aPrivFirstName);
|
|
|
|
aNameED .SetText(aItem.aPrivName);
|
|
|
|
aShortCutED .SetText(aItem.aPrivShortCut);
|
|
|
|
aFirstName2ED.SetText(aItem.aPrivFirstName2);
|
|
|
|
aName2ED .SetText(aItem.aPrivName2);
|
|
|
|
aShortCut2ED .SetText(aItem.aPrivShortCut2);
|
|
|
|
aStreetED .SetText(aItem.aPrivStreet);
|
|
|
|
aZipED .SetText(aItem.aPrivZip);
|
|
|
|
aCityED .SetText(aItem.aPrivCity);
|
|
|
|
aCountryED .SetText(aItem.aPrivCountry);
|
|
|
|
aStateED .SetText(aItem.aPrivState);
|
|
|
|
aTitleED .SetText(aItem.aPrivTitle);
|
|
|
|
aProfessionED.SetText(aItem.aPrivProfession);
|
|
|
|
aPhoneED .SetText(aItem.aPrivPhone);
|
|
|
|
aMobilePhoneED.SetText(aItem.aPrivMobile);
|
|
|
|
aFaxED .SetText(aItem.aPrivFax);
|
|
|
|
aHomePageED .SetText(aItem.aPrivWWW);
|
|
|
|
aMailED .SetText(aItem.aPrivMail);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwBusinessDataPage::SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet) :
|
|
|
|
SfxTabPage(pParent, SW_RES(TP_BUSINESS_DATA), rSet),
|
2007-04-26 08:08:15 +00:00
|
|
|
aDataFL (this, SW_RES( FL_DATA )),
|
|
|
|
aCompanyFT (this, SW_RES( FT_COMP )),
|
|
|
|
aCompanyED (this, SW_RES( ED_COMP )),
|
|
|
|
aCompanyExtFT (this, SW_RES( FT_COMP_EXT )),
|
|
|
|
aCompanyExtED (this, SW_RES( ED_COMP_EXT )),
|
|
|
|
aSloganFT (this, SW_RES( FT_SLOGAN )),
|
|
|
|
aSloganED (this, SW_RES( ED_SLOGAN )),
|
|
|
|
aStreetFT (this, SW_RES( FT_STREET )),
|
|
|
|
aStreetED (this, SW_RES( ED_STREET )),
|
|
|
|
aZipCityFT (this, SW_RES( FT_ZIPCITY )),
|
|
|
|
aZipED (this, SW_RES( ED_ZIP )),
|
|
|
|
aCityED (this, SW_RES( ED_CITY )),
|
|
|
|
aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )),
|
|
|
|
aCountryED (this, SW_RES( ED_COUNTRY )),
|
|
|
|
aStateED (this, SW_RES( ED_STATE )),
|
|
|
|
aPositionFT (this, SW_RES( FT_POSITION )),
|
|
|
|
aPositionED (this, SW_RES( ED_POSITION )),
|
|
|
|
aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )),
|
|
|
|
aPhoneED (this, SW_RES( ED_PHONE )),
|
|
|
|
aMobilePhoneED (this, SW_RES( ED_MOBILE )),
|
|
|
|
aFaxFT (this, SW_RES( FT_FAX )),
|
|
|
|
aFaxED (this, SW_RES( ED_FAX )),
|
|
|
|
aWWWMailFT (this, SW_RES( FT_WWWMAIL )),
|
|
|
|
aHomePageED (this, SW_RES( ED_WWW )),
|
|
|
|
aMailED (this, SW_RES( ED_MAIL ))
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
SetExchangeSupport();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwBusinessDataPage::~SwBusinessDataPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SwBusinessDataPage::Create(Window* pParent, const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
return new SwBusinessDataPage(pParent, rSet);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
Reset(rSet);
|
|
|
|
}
|
|
|
|
|
2007-09-27 10:42:56 +00:00
|
|
|
int SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 10:42:56 +00:00
|
|
|
if (_pSet)
|
|
|
|
FillItemSet(*_pSet);
|
2000-09-18 16:15:01 +00:00
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SwBusinessDataPage::FillItemSet(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
|
|
|
|
|
|
|
|
aItem.aCompCompany = aCompanyED .GetText();
|
|
|
|
aItem.aCompCompanyExt= aCompanyExtED .GetText();
|
|
|
|
aItem.aCompSlogan = aSloganED .GetText();
|
|
|
|
aItem.aCompStreet = aStreetED .GetText();
|
|
|
|
aItem.aCompZip = aZipED .GetText();
|
|
|
|
aItem.aCompCity = aCityED .GetText();
|
|
|
|
aItem.aCompCountry = aCountryED .GetText();
|
|
|
|
aItem.aCompState = aStateED .GetText();
|
|
|
|
aItem.aCompPosition = aPositionED .GetText();
|
|
|
|
aItem.aCompPhone = aPhoneED .GetText();
|
|
|
|
aItem.aCompMobile = aMobilePhoneED .GetText();
|
|
|
|
aItem.aCompFax = aFaxED .GetText();
|
|
|
|
aItem.aCompWWW = aHomePageED .GetText();
|
|
|
|
aItem.aCompMail = aMailED .GetText();
|
|
|
|
|
|
|
|
rSet.Put(aItem);
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwBusinessDataPage::Reset(const SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
|
|
|
|
aCompanyED .SetText(aItem.aCompCompany);
|
|
|
|
aCompanyExtED .SetText(aItem.aCompCompanyExt);
|
|
|
|
aSloganED .SetText(aItem.aCompSlogan);
|
|
|
|
aStreetED .SetText(aItem.aCompStreet);
|
|
|
|
aZipED .SetText(aItem.aCompZip);
|
|
|
|
aCityED .SetText(aItem.aCompCity);
|
|
|
|
aCountryED .SetText(aItem.aCompCountry);
|
|
|
|
aStateED .SetText(aItem.aCompState);
|
|
|
|
aPositionED .SetText(aItem.aCompPosition);
|
|
|
|
aPhoneED .SetText(aItem.aCompPhone);
|
|
|
|
aMobilePhoneED .SetText(aItem.aCompMobile);
|
|
|
|
aFaxED .SetText(aItem.aCompFax);
|
|
|
|
aHomePageED .SetText(aItem.aCompWWW);
|
|
|
|
aMailED .SetText(aItem.aCompMail);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|