xref: /aoo42x/main/sw/source/ui/envelp/label1.cxx (revision 737f4475)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
27cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <vcl/waitobj.hxx>
32cdf0e10cSrcweir #include <rtl/ustring.hxx>
33cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
34cdf0e10cSrcweir #include <swtypes.hxx>
35cdf0e10cSrcweir #include <wrtsh.hxx>
36cdf0e10cSrcweir #include <initui.hxx>
37cdf0e10cSrcweir #include <labimp.hxx>
38cdf0e10cSrcweir #include <labfmt.hxx>
39cdf0e10cSrcweir #include <labprt.hxx>
40cdf0e10cSrcweir #include <unotools.hxx>
41cdf0e10cSrcweir #ifndef _DBMGR_HXX
42cdf0e10cSrcweir #include <dbmgr.hxx>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include "uitool.hxx"
45cdf0e10cSrcweir #ifndef _CMDID_H
46cdf0e10cSrcweir #include <cmdid.h>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _HELPID_H
49cdf0e10cSrcweir #include <helpid.h>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _GLOBALS_HRC
52cdf0e10cSrcweir #include <globals.hrc>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _LABEL_HRC
55cdf0e10cSrcweir #include <label.hrc>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //impl in envimg.cxx
59cdf0e10cSrcweir extern SW_DLLPUBLIC String MakeSender();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir SV_IMPL_PTRARR( SwLabRecs, SwLabRec* );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir void SwLabRec::SetFromItem( const SwLabItem& rItem )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	lHDist  = rItem.lHDist;
67cdf0e10cSrcweir 	lVDist  = rItem.lVDist;
68cdf0e10cSrcweir 	lWidth  = rItem.lWidth;
69cdf0e10cSrcweir 	lHeight = rItem.lHeight;
70cdf0e10cSrcweir 	lLeft   = rItem.lLeft;
71cdf0e10cSrcweir 	lUpper  = rItem.lUpper;
72cdf0e10cSrcweir 	nCols   = rItem.nCols;
73cdf0e10cSrcweir 	nRows   = rItem.nRows;
74*737f4475STsutomu Uchino 	lPaperWidth  = rItem.lPaperWidth;
75*737f4475STsutomu Uchino 	lPaperHeight = rItem.lPaperHeight;
76cdf0e10cSrcweir 	bCont   = rItem.bCont;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir void SwLabRec::FillItem( SwLabItem& rItem ) const
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	rItem.lHDist  = lHDist;
82cdf0e10cSrcweir 	rItem.lVDist  = lVDist;
83cdf0e10cSrcweir 	rItem.lWidth  = lWidth;
84cdf0e10cSrcweir 	rItem.lHeight = lHeight;
85cdf0e10cSrcweir 	rItem.lLeft   = lLeft;
86cdf0e10cSrcweir 	rItem.lUpper  = lUpper;
87cdf0e10cSrcweir 	rItem.nCols   = nCols;
88cdf0e10cSrcweir 	rItem.nRows   = nRows;
89*737f4475STsutomu Uchino 	rItem.lPaperWidth  = lPaperWidth;
90*737f4475STsutomu Uchino 	rItem.lPaperHeight = lPaperHeight;
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir // --------------------------------------------------------------------------
94cdf0e10cSrcweir void SwLabDlg::_ReplaceGroup( const String &rMake )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	//Die alten Eintraege vernichten.
97cdf0e10cSrcweir 	pRecs->Remove( 1, pRecs->Count() - 1 );
98cdf0e10cSrcweir 	aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
99cdf0e10cSrcweir 	aLstGroup = rMake;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // --------------------------------------------------------------------------
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	if (nId == TP_LAB_LAB)
109cdf0e10cSrcweir 	{
110cdf0e10cSrcweir 		if(m_bLabel)
111cdf0e10cSrcweir 		{
112cdf0e10cSrcweir 			((SwLabPage*)&rPage)->SetNewDBMgr(pNewDBMgr);
113cdf0e10cSrcweir 			((SwLabPage*)&rPage)->InitDatabaseBox();
114cdf0e10cSrcweir 		}
115cdf0e10cSrcweir 		else
116cdf0e10cSrcweir 			((SwLabPage*)&rPage)->SetToBusinessCard();
117cdf0e10cSrcweir 	}
118cdf0e10cSrcweir 	else if (nId == TP_LAB_PRT)
119cdf0e10cSrcweir 		pPrtPage = (SwLabPrtPage*)&rPage;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir // --------------------------------------------------------------------------
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
126cdf0e10cSrcweir SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
127cdf0e10cSrcweir 								SwNewDBMgr* pDBMgr, sal_Bool bLabel) :
128cdf0e10cSrcweir 	SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ),
129cdf0e10cSrcweir     pNewDBMgr(pDBMgr),
130cdf0e10cSrcweir     pPrtPage(0),
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     aTypeIds( 50, 10 ),
133cdf0e10cSrcweir     aMakes  (  5,  0 ),
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     pRecs   ( new SwLabRecs() ),
136cdf0e10cSrcweir     sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)),
137cdf0e10cSrcweir     sFormat(SW_RES(ST_FIRSTPAGE_LAB)),
138cdf0e10cSrcweir     sMedium(SW_RES(ST_FIRSTPAGE_BC)),
139cdf0e10cSrcweir 	m_bLabel(bLabel)
140cdf0e10cSrcweir {
141cdf0e10cSrcweir 	WaitObject aWait( pParent );
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	FreeResource();
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC)));
146cdf0e10cSrcweir 	GetOKButton().SetHelpId(HID_LABEL_INSERT);
147cdf0e10cSrcweir 	GetOKButton().SetHelpText(aEmptyStr);	// Damit generierter Hilfetext verwendet wird
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage   ::Create, 0, sal_False, 0);
150cdf0e10cSrcweir 	AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0);
151cdf0e10cSrcweir 	AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0);
152cdf0e10cSrcweir 	AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0);
153cdf0e10cSrcweir 	AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 );
154cdf0e10cSrcweir 	AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	if(m_bLabel)
158cdf0e10cSrcweir 	{
159cdf0e10cSrcweir 		RemoveTabPage(TP_BUSINESS_DATA);
160cdf0e10cSrcweir 		RemoveTabPage(TP_PRIVATE_DATA);
161cdf0e10cSrcweir 		RemoveTabPage(TP_VISITING_CARDS);
162cdf0e10cSrcweir 	}
163cdf0e10cSrcweir 	else
164cdf0e10cSrcweir 	{
165cdf0e10cSrcweir 		SetText(sBusinessCardDlg);
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir 	// Benutzer-Etikette aus writer.cfg lesen
168cdf0e10cSrcweir 	SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL ));
169cdf0e10cSrcweir 	SwLabRec* pRec = new SwLabRec;
170cdf0e10cSrcweir 	const String aTmp( SW_RES( STR_CUSTOM ) );
171cdf0e10cSrcweir 	pRec->aMake   = pRec->aType = aTmp;
172cdf0e10cSrcweir 	pRec->SetFromItem( aItem );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	sal_Bool bDouble = sal_False;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++)
177cdf0e10cSrcweir 	{
178cdf0e10cSrcweir 		if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake &&
179cdf0e10cSrcweir 			pRec->aType == pRecs->GetObject(nRecPos)->aType)
180cdf0e10cSrcweir 		{
181cdf0e10cSrcweir 			bDouble = sal_True;
182cdf0e10cSrcweir 			break;
183cdf0e10cSrcweir 		}
184cdf0e10cSrcweir 	}
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	if (!bDouble)
187cdf0e10cSrcweir 		pRecs->C40_INSERT( SwLabRec, pRec, 0 );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	sal_uInt16 nLstGroup = 0;
190cdf0e10cSrcweir 	const UNO_NMSPC::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
191cdf0e10cSrcweir 	const rtl::OUString* pMan = rMan.getConstArray();
192cdf0e10cSrcweir 	for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir 		aMakes.Insert( new String(pMan[nMan]), aMakes.Count() );
195cdf0e10cSrcweir 		if ( pMan[nMan] == aItem.aLstMake )
196cdf0e10cSrcweir 			nLstGroup = (sal_uInt16) nMan;
197cdf0e10cSrcweir 	}
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	if ( aMakes.Count() )
200cdf0e10cSrcweir         _ReplaceGroup( *aMakes[nLstGroup] );
201cdf0e10cSrcweir 	if (pExampleSet)
202cdf0e10cSrcweir 		pExampleSet->Put(aItem);
203cdf0e10cSrcweir }
204cdf0e10cSrcweir 
205cdf0e10cSrcweir // --------------------------------------------------------------------------
206cdf0e10cSrcweir 
207cdf0e10cSrcweir SwLabDlg::~SwLabDlg()
208cdf0e10cSrcweir {
209cdf0e10cSrcweir 	delete pRecs;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir // --------------------------------------------------------------------------
212cdf0e10cSrcweir 
213cdf0e10cSrcweir void SwLabDlg::GetLabItem(SwLabItem &rItem)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	const SwLabItem& rActItem = (const SwLabItem&)GetExampleSet()->Get(FN_LABEL);
216cdf0e10cSrcweir 	const SwLabItem& rOldItem = (const SwLabItem&)GetInputSetImpl()->Get(FN_LABEL);
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	if (rActItem != rOldItem)
219cdf0e10cSrcweir 	{	// Wurde schon mal mit (hoffentlich) korrektem Inhalt "geputtet"
220cdf0e10cSrcweir 		rItem = rActItem;
221cdf0e10cSrcweir 	}
222cdf0e10cSrcweir 	else
223cdf0e10cSrcweir 	{
224cdf0e10cSrcweir 		rItem = rOldItem;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 		// Im rItem stehen (vom Namen mal abgesehen) immer nur die
227cdf0e10cSrcweir 		// benutzerdefinierbaren Einstellungen. Daher richtige Werte
228cdf0e10cSrcweir 		// direkt aus dem Record besorgen:
229cdf0e10cSrcweir 		SwLabRec* pRec = GetRecord(rItem.aType, rItem.bCont);
230cdf0e10cSrcweir 		pRec->FillItem( rItem );
231cdf0e10cSrcweir 	}
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir // --------------------------------------------------------------------------
235cdf0e10cSrcweir 
236cdf0e10cSrcweir SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
237cdf0e10cSrcweir {
238cdf0e10cSrcweir 	SwLabRec* pRec = NULL;
239cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
240cdf0e10cSrcweir 	String sCustom(SW_RES(STR_CUSTOM));
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	const sal_uInt16 nCount = Recs().Count();
243cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < nCount; i++)
244cdf0e10cSrcweir 	{
245cdf0e10cSrcweir 		pRec = Recs()[i];
246cdf0e10cSrcweir 		if (pRec->aType != sCustom &&
247cdf0e10cSrcweir 			rRecName == pRec->aType && bCont == pRec->bCont)
248cdf0e10cSrcweir 		{
249cdf0e10cSrcweir 			bFound = sal_True;
250cdf0e10cSrcweir 			break;
251cdf0e10cSrcweir 		}
252cdf0e10cSrcweir 	}
253cdf0e10cSrcweir 	if (!bFound)	// Benutzerdefiniert
254cdf0e10cSrcweir 		pRec = Recs()[0];
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	return(pRec);
257cdf0e10cSrcweir }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir // --------------------------------------------------------------------------
260cdf0e10cSrcweir 
261cdf0e10cSrcweir Printer *SwLabDlg::GetPrt()
262cdf0e10cSrcweir {
263cdf0e10cSrcweir 	if (pPrtPage)
264cdf0e10cSrcweir 		return (pPrtPage->GetPrt());
265cdf0e10cSrcweir 	else
266cdf0e10cSrcweir 		return (NULL);
267cdf0e10cSrcweir }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir // --------------------------------------------------------------------------
270cdf0e10cSrcweir SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) :
271cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES(TP_LAB_LAB), rSet),
272cdf0e10cSrcweir 	pNewDBMgr(NULL),
273cdf0e10cSrcweir 	aItem		   ((const SwLabItem&) rSet.Get(FN_LABEL)),
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     aWritingFL     (this, SW_RES(FL_WRITING)),
276cdf0e10cSrcweir 	aWritingText   (this, SW_RES(TXT_WRITING)),
277cdf0e10cSrcweir 	aAddrBox	   (this, SW_RES(BOX_ADDR   )),
278cdf0e10cSrcweir 	aWritingEdit   (this, SW_RES(EDT_WRITING)),
279cdf0e10cSrcweir 	aDatabaseFT    (this, SW_RES(FT_DATABASE)),
280cdf0e10cSrcweir 	aDatabaseLB    (this, SW_RES(LB_DATABASE)),
281cdf0e10cSrcweir 	aTableFT       (this, SW_RES(FT_TABLE   )),
282cdf0e10cSrcweir 	aTableLB       (this, SW_RES(LB_TABLE   )),
283cdf0e10cSrcweir 	aInsertBT      (this, SW_RES(BTN_INSERT )),
284cdf0e10cSrcweir 	aDBFieldFT     (this, SW_RES(FT_DBFIELD )),
285cdf0e10cSrcweir 	aDBFieldLB     (this, SW_RES(LB_DBFIELD )),
286cdf0e10cSrcweir 	aFormatFL      (this, SW_RES(FL_FORMAT )),
287cdf0e10cSrcweir     aContButton    (this, SW_RES(BTN_CONT   )),
288cdf0e10cSrcweir 	aSheetButton   (this, SW_RES(BTN_SHEET  )),
289cdf0e10cSrcweir 	aMakeText	   (this, SW_RES(TXT_MAKE   )),
290cdf0e10cSrcweir 	aMakeBox	   (this, SW_RES(BOX_MAKE   )),
291cdf0e10cSrcweir 	aTypeText	   (this, SW_RES(TXT_TYPE   )),
292cdf0e10cSrcweir 	aTypeBox	   (this, SW_RES(BOX_TYPE   )),
293cdf0e10cSrcweir     aHiddenSortTypeBox(this, WB_SORT|WB_HIDE),
294cdf0e10cSrcweir 	aFormatInfo    (this, SW_RES(INF_FORMAT ))
295cdf0e10cSrcweir    {
296cdf0e10cSrcweir 	WaitObject aWait( pParent );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 	FreeResource();
299cdf0e10cSrcweir 	SetExchangeSupport();
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	// Handler installieren
303cdf0e10cSrcweir 	aAddrBox	   .SetClickHdl (LINK(this, SwLabPage, AddrHdl		   ));
304cdf0e10cSrcweir 	aDatabaseLB    .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl	   ));
305cdf0e10cSrcweir 	aTableLB       .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl	   ));
306cdf0e10cSrcweir 	aInsertBT      .SetClickHdl	(LINK(this, SwLabPage, FieldHdl		   ));
307cdf0e10cSrcweir 	aContButton    .SetClickHdl (LINK(this, SwLabPage, PageHdl		   ));
308cdf0e10cSrcweir 	aSheetButton   .SetClickHdl (LINK(this, SwLabPage, PageHdl		   ));
309cdf0e10cSrcweir 	aMakeBox	   .SetSelectHdl(LINK(this, SwLabPage, MakeHdl		   ));
310cdf0e10cSrcweir 	aTypeBox	   .SetSelectHdl(LINK(this, SwLabPage, TypeHdl		   ));
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	InitDatabaseBox();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	sal_uInt16 nLstGroup = 0;
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
317cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < nCount; ++i)
318cdf0e10cSrcweir 	{
319cdf0e10cSrcweir 		String &rStr = *GetParent()->Makes()[i];
320cdf0e10cSrcweir 		aMakeBox.InsertEntry( rStr );
321cdf0e10cSrcweir 		if ( rStr == String(aItem.aLstMake) )
322cdf0e10cSrcweir 			nLstGroup = i;
323cdf0e10cSrcweir 	}
324cdf0e10cSrcweir //	Reset(rSet);
325cdf0e10cSrcweir 	aMakeBox.SelectEntryPos( nLstGroup );
326cdf0e10cSrcweir 	aMakeBox.GetSelectHdl().Call( &aMakeBox );
327cdf0e10cSrcweir }
328cdf0e10cSrcweir 
329cdf0e10cSrcweir // --------------------------------------------------------------------------
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 
333cdf0e10cSrcweir SwLabPage::~SwLabPage()
334cdf0e10cSrcweir {
335cdf0e10cSrcweir }
336cdf0e10cSrcweir /* -----------------29.09.99 09:08-------------------
337cdf0e10cSrcweir 
338cdf0e10cSrcweir  --------------------------------------------------*/
339cdf0e10cSrcweir void lcl_ChgYPos(Window& rWin, long nDiff)
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	Point aTempPos(rWin.GetPosPixel());
342cdf0e10cSrcweir 	aTempPos.Y() += nDiff;
343cdf0e10cSrcweir 	rWin.SetPosPixel(aTempPos);
344cdf0e10cSrcweir }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir void SwLabPage::SetToBusinessCard()
347cdf0e10cSrcweir {
348cdf0e10cSrcweir     SetHelpId(HID_BUSINESS_FMT_PAGE);
349cdf0e10cSrcweir     aContButton.SetHelpId(HID_BUSINESS_FMT_PAGE_CONT);
350cdf0e10cSrcweir     aSheetButton.SetHelpId(HID_BUSINESS_FMT_PAGE_SHEET);
351cdf0e10cSrcweir     aMakeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_BRAND);
352cdf0e10cSrcweir     aTypeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_TYPE);
353cdf0e10cSrcweir     m_bLabel = sal_False;
354cdf0e10cSrcweir 	aWritingText.Hide();
355cdf0e10cSrcweir 	aAddrBox.Hide();
356cdf0e10cSrcweir 	aWritingEdit.Hide();
357cdf0e10cSrcweir 	aDatabaseFT.Hide();
358cdf0e10cSrcweir 	aDatabaseLB.Hide();
359cdf0e10cSrcweir 	aTableFT.Hide();
360cdf0e10cSrcweir 	aTableLB.Hide();
361cdf0e10cSrcweir 	aInsertBT.Hide();
362cdf0e10cSrcweir 	aDBFieldFT.Hide();
363cdf0e10cSrcweir 	aDBFieldLB.Hide();
364cdf0e10cSrcweir     aWritingFL.Hide();
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	//resize the form
367cdf0e10cSrcweir     Point aFLPos(aWritingFL.GetPosPixel());
368cdf0e10cSrcweir     long nDiffPos = aFormatFL.GetPosPixel().Y() - aFLPos.Y();
369cdf0e10cSrcweir     Size aFLSz(aFormatFL.GetSizePixel());
370cdf0e10cSrcweir //  aFLSz.Height() += nDiffPos;
371cdf0e10cSrcweir     aFormatFL.SetPosSizePixel(aFLPos, aFLSz);
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 	// move all controls up
374cdf0e10cSrcweir 	lcl_ChgYPos(aContButton, -nDiffPos);
375cdf0e10cSrcweir 	lcl_ChgYPos(aSheetButton, -nDiffPos);
376cdf0e10cSrcweir 	lcl_ChgYPos(aMakeText, -nDiffPos);
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 	lcl_ChgYPos(aTypeText, -nDiffPos);
379cdf0e10cSrcweir 	lcl_ChgYPos(aFormatInfo, -nDiffPos);
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	Size aTmpSz(3, 3);
382cdf0e10cSrcweir 	aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	lcl_ChgYPos(aMakeBox, - nDiffPos);
385cdf0e10cSrcweir 	Point aLBPos(aMakeBox.GetPosPixel());
386cdf0e10cSrcweir 	aLBPos.Y() += aMakeBox.GetSizePixel().Height() + aTmpSz.Height();
387cdf0e10cSrcweir 	aTypeBox.SetPosPixel(aLBPos);
388cdf0e10cSrcweir };
389cdf0e10cSrcweir 
390cdf0e10cSrcweir // --------------------------------------------------------------------------
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 
393cdf0e10cSrcweir IMPL_LINK( SwLabPage, AddrHdl, Button *, EMPTYARG )
394cdf0e10cSrcweir {
395cdf0e10cSrcweir 	String aWriting;
396cdf0e10cSrcweir 	if ( aAddrBox.IsChecked() )
397cdf0e10cSrcweir 		aWriting = MakeSender();
398cdf0e10cSrcweir 	aWritingEdit.SetText( aWriting.ConvertLineEnd() );
399cdf0e10cSrcweir 	aWritingEdit.GrabFocus();
400cdf0e10cSrcweir 	return 0;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir // --------------------------------------------------------------------------
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 
407cdf0e10cSrcweir IMPL_LINK( SwLabPage, DatabaseHdl, ListBox *, pListBox )
408cdf0e10cSrcweir {
409cdf0e10cSrcweir 	sActDBName = aDatabaseLB.GetSelectEntry();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	WaitObject aObj( GetParent() );
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	if (pListBox == &aDatabaseLB)
414cdf0e10cSrcweir 		GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName);
415cdf0e10cSrcweir 	GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, aTableLB.GetSelectEntry());
416cdf0e10cSrcweir 	return 0;
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 
421cdf0e10cSrcweir IMPL_LINK( SwLabPage, FieldHdl, Button *, EMPTYARG )
422cdf0e10cSrcweir {
423cdf0e10cSrcweir 	String aStr ( '<' );
424cdf0e10cSrcweir 	aStr += aDatabaseLB.GetSelectEntry();
425cdf0e10cSrcweir 	aStr += '.';
426cdf0e10cSrcweir 	aStr += aTableLB.GetSelectEntry();
427cdf0e10cSrcweir 	aStr += '.';
428cdf0e10cSrcweir     aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1';
429cdf0e10cSrcweir 	aStr += '.';
430cdf0e10cSrcweir     aStr += aDBFieldLB.GetSelectEntry();
431cdf0e10cSrcweir 	aStr += '>';
432cdf0e10cSrcweir 	aWritingEdit.ReplaceSelected(aStr);
433cdf0e10cSrcweir 	Selection aSel = aWritingEdit.GetSelection();
434cdf0e10cSrcweir 	aWritingEdit.GrabFocus();
435cdf0e10cSrcweir 	aWritingEdit.SetSelection(aSel);
436cdf0e10cSrcweir 	return 0;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir 
439cdf0e10cSrcweir // --------------------------------------------------------------------------
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 
443cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwLabPage, PageHdl, Button *, EMPTYARG )
444cdf0e10cSrcweir {
445cdf0e10cSrcweir 	aMakeBox.GetSelectHdl().Call( &aMakeBox );
446cdf0e10cSrcweir 	return 0;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwLabPage, PageHdl, Button *, EMPTYARG )
449cdf0e10cSrcweir 
450cdf0e10cSrcweir // --------------------------------------------------------------------------
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 
454cdf0e10cSrcweir IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG )
455cdf0e10cSrcweir {
456cdf0e10cSrcweir 	WaitObject aWait( GetParent() );
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	aTypeBox.Clear();
459cdf0e10cSrcweir     aHiddenSortTypeBox.Clear();
460cdf0e10cSrcweir 	GetParent()->TypeIds().Remove( 0, GetParent()->TypeIds().Count() );
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 	const String aMake = aMakeBox.GetSelectEntry();
463cdf0e10cSrcweir     GetParent()->ReplaceGroup( aMake );
464cdf0e10cSrcweir 	aItem.aLstMake = aMake;
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 	const sal_Bool 	 bCont 	  = aContButton.IsChecked();
467cdf0e10cSrcweir 	const sal_uInt16 nCount   = GetParent()->Recs().Count();
468cdf0e10cSrcweir 		  sal_uInt16 nLstType = 0;
469cdf0e10cSrcweir 
470cdf0e10cSrcweir     const String sCustom(SW_RES(STR_CUSTOM));
471cdf0e10cSrcweir     //insert the entries into the sorted list box
472cdf0e10cSrcweir     for ( sal_uInt16 i = 0; i < nCount; ++i )
473cdf0e10cSrcweir 	{
474cdf0e10cSrcweir         const String aType ( GetParent()->Recs()[i]->aType );
475cdf0e10cSrcweir         sal_Bool bInsert = sal_False;
476cdf0e10cSrcweir         if ( GetParent()->Recs()[i]->aType == sCustom )
477cdf0e10cSrcweir         {
478cdf0e10cSrcweir             bInsert = sal_True;
479cdf0e10cSrcweir             aTypeBox.InsertEntry(aType );
480cdf0e10cSrcweir         }
481cdf0e10cSrcweir         else if ( GetParent()->Recs()[i]->bCont == bCont )
482cdf0e10cSrcweir 		{
483cdf0e10cSrcweir             if ( aHiddenSortTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
484cdf0e10cSrcweir 			{
485cdf0e10cSrcweir                 bInsert = sal_True;
486cdf0e10cSrcweir                 aHiddenSortTypeBox.InsertEntry( aType );
487cdf0e10cSrcweir             }
488cdf0e10cSrcweir 		}
489cdf0e10cSrcweir         if(bInsert)
490cdf0e10cSrcweir         {
491cdf0e10cSrcweir             GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count());
492cdf0e10cSrcweir             if ( !nLstType && aType == String(aItem.aLstType) )
493cdf0e10cSrcweir                 nLstType = GetParent()->TypeIds().Count();
494cdf0e10cSrcweir         }
495cdf0e10cSrcweir 	}
496cdf0e10cSrcweir     for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++)
497cdf0e10cSrcweir     {
498cdf0e10cSrcweir         aTypeBox.InsertEntry(aHiddenSortTypeBox.GetEntry(nEntry));
499cdf0e10cSrcweir     }
500cdf0e10cSrcweir 	if (nLstType)
501cdf0e10cSrcweir 		aTypeBox.SelectEntry(aItem.aLstType);
502cdf0e10cSrcweir 	else
503cdf0e10cSrcweir 		aTypeBox.SelectEntryPos(0);
504cdf0e10cSrcweir 	aTypeBox.GetSelectHdl().Call( &aTypeBox );
505cdf0e10cSrcweir 	return 0;
506cdf0e10cSrcweir }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir // --------------------------------------------------------------------------
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 
512cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir 	DisplayFormat();
515cdf0e10cSrcweir 	aItem.aType = aTypeBox.GetSelectEntry();
516cdf0e10cSrcweir 	return 0;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
519cdf0e10cSrcweir 
520cdf0e10cSrcweir // --------------------------------------------------------------------------
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 
524cdf0e10cSrcweir void SwLabPage::DisplayFormat()
525cdf0e10cSrcweir {
526cdf0e10cSrcweir 	MetricField aField(this, WinBits(0));
527cdf0e10cSrcweir     FieldUnit aMetric = ::GetDfltMetric(sal_False);
528cdf0e10cSrcweir     SetMetric(aField, aMetric);
529cdf0e10cSrcweir 	aField.SetDecimalDigits(2);
530cdf0e10cSrcweir 	aField.SetMin		  (0);
531cdf0e10cSrcweir 	aField.SetMax		  (LONG_MAX);
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 	SwLabRec* pRec = GetSelectedEntryPos();
534cdf0e10cSrcweir 	aItem.aLstType = pRec->aType;
535cdf0e10cSrcweir 	SETFLDVAL(aField, pRec->lWidth);
536cdf0e10cSrcweir 	aField.Reformat();
537cdf0e10cSrcweir 	const String aWString = aField.GetText();
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 	SETFLDVAL(aField, pRec->lHeight);
540cdf0e10cSrcweir 	aField.Reformat();
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 	String aText = pRec->aType;
543cdf0e10cSrcweir 	aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
544cdf0e10cSrcweir 	aText += aWString;
545cdf0e10cSrcweir 	aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
546cdf0e10cSrcweir 	aText += aField.GetText();
547cdf0e10cSrcweir 	aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" ("));
548cdf0e10cSrcweir 	aText += String::CreateFromInt32( pRec->nCols );
549cdf0e10cSrcweir 	aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
550cdf0e10cSrcweir 	aText += String::CreateFromInt32( pRec->nRows );
551cdf0e10cSrcweir 	aText += ')';
552cdf0e10cSrcweir 	aFormatInfo.SetText(aText);
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir // --------------------------------------------------------------------------
556cdf0e10cSrcweir 
557cdf0e10cSrcweir SwLabRec* SwLabPage::GetSelectedEntryPos()
558cdf0e10cSrcweir {
559cdf0e10cSrcweir 	String sSelEntry(aTypeBox.GetSelectEntry());
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 	return GetParent()->GetRecord(sSelEntry, aContButton.IsChecked());
562cdf0e10cSrcweir }
563cdf0e10cSrcweir 
564cdf0e10cSrcweir // --------------------------------------------------------------------------
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 
568cdf0e10cSrcweir void SwLabPage::InitDatabaseBox()
569cdf0e10cSrcweir {
570cdf0e10cSrcweir 	if( GetNewDBMgr() )
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 		aDatabaseLB.Clear();
573cdf0e10cSrcweir 		UNO_NMSPC::Sequence<rtl::OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames();
574cdf0e10cSrcweir 		const rtl::OUString* pDataNames = aDataNames.getConstArray();
575cdf0e10cSrcweir 		for (long i = 0; i < aDataNames.getLength(); i++)
576cdf0e10cSrcweir 			aDatabaseLB.InsertEntry(pDataNames[i]);
577cdf0e10cSrcweir 		String sDBName = sActDBName.GetToken( 0, DB_DELIM );
578cdf0e10cSrcweir 		String sTableName = sActDBName.GetToken( 1, DB_DELIM );
579cdf0e10cSrcweir 		aDatabaseLB.SelectEntry(sDBName);
580cdf0e10cSrcweir 		if( sDBName.Len() && GetNewDBMgr()->GetTableNames(&aTableLB, sDBName))
581cdf0e10cSrcweir 		{
582cdf0e10cSrcweir 			aTableLB.SelectEntry(sTableName);
583cdf0e10cSrcweir 			GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, sTableName);
584cdf0e10cSrcweir 		}
585cdf0e10cSrcweir 		else
586cdf0e10cSrcweir 			aDBFieldLB.Clear();
587cdf0e10cSrcweir 	}
588cdf0e10cSrcweir }
589cdf0e10cSrcweir 
590cdf0e10cSrcweir // --------------------------------------------------------------------------
591cdf0e10cSrcweir SfxTabPage* SwLabPage::Create(Window* pParent, const SfxItemSet& rSet)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir 	return new SwLabPage(pParent, rSet);
594cdf0e10cSrcweir }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir // --------------------------------------------------------------------------
597cdf0e10cSrcweir void SwLabPage::ActivatePage(const SfxItemSet& rSet)
598cdf0e10cSrcweir {
599cdf0e10cSrcweir 	Reset( rSet );
600cdf0e10cSrcweir }
601cdf0e10cSrcweir // --------------------------------------------------------------------------
602cdf0e10cSrcweir int SwLabPage::DeactivatePage(SfxItemSet* _pSet)
603cdf0e10cSrcweir {
604cdf0e10cSrcweir     if (_pSet)
605cdf0e10cSrcweir         FillItemSet(*_pSet);
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 	return sal_True;
608cdf0e10cSrcweir }
609cdf0e10cSrcweir 
610cdf0e10cSrcweir // --------------------------------------------------------------------------
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 
613cdf0e10cSrcweir 
614cdf0e10cSrcweir void SwLabPage::FillItem(SwLabItem& rItem)
615cdf0e10cSrcweir {
616cdf0e10cSrcweir 	rItem.bAddr    = aAddrBox.IsChecked();
617cdf0e10cSrcweir 	rItem.aWriting = aWritingEdit.GetText();
618cdf0e10cSrcweir 	rItem.bCont    = aContButton.IsChecked();
619cdf0e10cSrcweir 	rItem.aMake    = aMakeBox.GetSelectEntry();
620cdf0e10cSrcweir 	rItem.aType    = aTypeBox.GetSelectEntry();
621cdf0e10cSrcweir 	rItem.sDBName  = sActDBName;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	SwLabRec* pRec = GetSelectedEntryPos();
624cdf0e10cSrcweir 	pRec->FillItem( rItem );
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 	rItem.aLstMake = aMakeBox.GetSelectEntry();
627cdf0e10cSrcweir 	rItem.aLstType = aTypeBox.GetSelectEntry();
628cdf0e10cSrcweir }
629cdf0e10cSrcweir 
630cdf0e10cSrcweir // --------------------------------------------------------------------------
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 
634cdf0e10cSrcweir sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet)
635cdf0e10cSrcweir {
636cdf0e10cSrcweir 	FillItem( aItem );
637cdf0e10cSrcweir 	rSet.Put( aItem );
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	return sal_True;
640cdf0e10cSrcweir }
641cdf0e10cSrcweir 
642cdf0e10cSrcweir // --------------------------------------------------------------------------
643cdf0e10cSrcweir 
644cdf0e10cSrcweir void SwLabPage::Reset(const SfxItemSet& rSet)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir 	aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
647cdf0e10cSrcweir 	String sDBName  = aItem.sDBName;
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 	String aWriting( aItem.aWriting );
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 	aAddrBox	.Check		( aItem.bAddr );
652cdf0e10cSrcweir 	aWritingEdit.SetText	( aWriting.ConvertLineEnd() );
653cdf0e10cSrcweir 
654cdf0e10cSrcweir 	const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
655cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < nCount; ++i)
656cdf0e10cSrcweir 	{
657cdf0e10cSrcweir 		String &rStr = *GetParent()->Makes()[i];
658cdf0e10cSrcweir 		if(aMakeBox.GetEntryPos(String(rStr)) == LISTBOX_ENTRY_NOTFOUND)
659cdf0e10cSrcweir 			aMakeBox.InsertEntry( rStr );
660cdf0e10cSrcweir 	}
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 
663cdf0e10cSrcweir 	aMakeBox	.SelectEntry( aItem.aMake );
664cdf0e10cSrcweir 	//save the current type
665cdf0e10cSrcweir 	String sType(aItem.aType);
666cdf0e10cSrcweir 	aMakeBox.GetSelectHdl().Call( &aMakeBox );
667cdf0e10cSrcweir 	aItem.aType = sType;
668cdf0e10cSrcweir     //#102806# a newly added make may not be in the type ListBox already
669cdf0e10cSrcweir     if (aTypeBox.GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && aItem.aMake.getLength())
670cdf0e10cSrcweir         GetParent()->UpdateGroup( aItem.aMake );
671cdf0e10cSrcweir     if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND)
672cdf0e10cSrcweir 	{
673cdf0e10cSrcweir 		aTypeBox.SelectEntry(aItem.aType);
674cdf0e10cSrcweir 		aTypeBox.GetSelectHdl().Call(&aTypeBox);
675cdf0e10cSrcweir 	}
676cdf0e10cSrcweir 	if (aDatabaseLB.GetEntryPos(sDBName) != LISTBOX_ENTRY_NOTFOUND)
677cdf0e10cSrcweir 	{
678cdf0e10cSrcweir 		aDatabaseLB.SelectEntry(sDBName);
679cdf0e10cSrcweir 		aDatabaseLB.GetSelectHdl().Call(&aDatabaseLB);
680cdf0e10cSrcweir 	}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 	if (aItem.bCont)
683cdf0e10cSrcweir 		aContButton .Check();
684cdf0e10cSrcweir 	else
685cdf0e10cSrcweir 		aSheetButton.Check();
686cdf0e10cSrcweir }
687cdf0e10cSrcweir 
688cdf0e10cSrcweir /*-- 08.07.99 14:00:02---------------------------------------------------
689cdf0e10cSrcweir 
690cdf0e10cSrcweir   -----------------------------------------------------------------------*/
691cdf0e10cSrcweir //-----------------------------------------------------------------------------
692cdf0e10cSrcweir void SwVisitingCardPage::ClearUserData()
693cdf0e10cSrcweir {
694cdf0e10cSrcweir 	SvLBoxEntry* pEntry = aAutoTextLB.First();
695cdf0e10cSrcweir 	while(pEntry)
696cdf0e10cSrcweir 	{
697cdf0e10cSrcweir 		delete (String*)pEntry->GetUserData();
698cdf0e10cSrcweir 		pEntry = aAutoTextLB.Next(pEntry);
699cdf0e10cSrcweir 	}
700cdf0e10cSrcweir }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir //-----------------------------------------------------------------------------
703cdf0e10cSrcweir 
704cdf0e10cSrcweir void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt,
705cdf0e10cSrcweir 				const rtl::OUString* pNames, const rtl::OUString* pValues )
706cdf0e10cSrcweir {
707cdf0e10cSrcweir 	for( sal_uInt32 i = 0; i < nCnt; ++i )
708cdf0e10cSrcweir 	{
709cdf0e10cSrcweir 		SvLBoxEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] );
710cdf0e10cSrcweir 		pEntry->SetUserData( new String( pValues[ i ] ));
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir }
713cdf0e10cSrcweir 
714cdf0e10cSrcweir //-----------------------------------------------------------------------------
715cdf0e10cSrcweir 
716cdf0e10cSrcweir SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) :
717cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet),
718cdf0e10cSrcweir 	aContentFL(this,        SW_RES( FL_CONTENT           )),
719cdf0e10cSrcweir     aAutoTextLB(this, 		SW_RES( LB_AUTO_TEXT			)),
720cdf0e10cSrcweir 	aAutoTextGroupFT(this, 	SW_RES( FT_AUTO_TEXT_GROUP	)),
721cdf0e10cSrcweir 	aAutoTextGroupLB(this, 	SW_RES( LB_AUTO_TEXT_GROUP	)),
722cdf0e10cSrcweir 	aExampleWIN(this, 		SW_RES( WIN_EXAMPLE			)),
723cdf0e10cSrcweir 	sVisCardGroup(SW_RES(ST_VISCARD_GROUP)),
724cdf0e10cSrcweir 	pExampleFrame(0)
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	FreeResource();
727cdf0e10cSrcweir 	aAutoTextLB.SetStyle( aAutoTextLB.GetStyle() | WB_HSCROLL );
728cdf0e10cSrcweir 	aAutoTextLB.SetSpaceBetweenEntries(0);
729cdf0e10cSrcweir 	aAutoTextLB.SetSelectionMode( SINGLE_SELECTION );
730cdf0e10cSrcweir 	aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT);
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 	SetExchangeSupport();
733cdf0e10cSrcweir 	aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
734cdf0e10cSrcweir 	aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	aExampleWIN.Hide();
737cdf0e10cSrcweir 
738cdf0e10cSrcweir 	aAutoTextLB.Show();
739cdf0e10cSrcweir 	aAutoTextGroupFT.Show();
740cdf0e10cSrcweir 	aAutoTextGroupLB.Show();
741cdf0e10cSrcweir 	InitFrameControl();
742cdf0e10cSrcweir }
743cdf0e10cSrcweir /*-- 08.07.99 14:00:03---------------------------------------------------
744cdf0e10cSrcweir 
745cdf0e10cSrcweir   -----------------------------------------------------------------------*/
746cdf0e10cSrcweir SwVisitingCardPage::~SwVisitingCardPage()
747cdf0e10cSrcweir {
748cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++)
749cdf0e10cSrcweir 		delete (String*)aAutoTextGroupLB.GetEntryData( i );
750cdf0e10cSrcweir 	_xAutoText = 0;
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 	ClearUserData();
753cdf0e10cSrcweir 	delete pExampleFrame;
754cdf0e10cSrcweir }
755cdf0e10cSrcweir /*-- 08.07.99 14:00:03---------------------------------------------------
756cdf0e10cSrcweir 
757cdf0e10cSrcweir   -----------------------------------------------------------------------*/
758cdf0e10cSrcweir SfxTabPage* SwVisitingCardPage::Create(Window* pParent, const SfxItemSet& rSet)
759cdf0e10cSrcweir {
760cdf0e10cSrcweir 	return new SwVisitingCardPage(pParent, rSet);
761cdf0e10cSrcweir }
762cdf0e10cSrcweir /*-- 08.07.99 14:00:03---------------------------------------------------
763cdf0e10cSrcweir 
764cdf0e10cSrcweir   -----------------------------------------------------------------------*/
765cdf0e10cSrcweir void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
766cdf0e10cSrcweir {
767cdf0e10cSrcweir 	Reset( rSet );
768cdf0e10cSrcweir 	UpdateFields();
769cdf0e10cSrcweir }
770cdf0e10cSrcweir /*-- 08.07.99 14:00:04---------------------------------------------------
771cdf0e10cSrcweir 
772cdf0e10cSrcweir   -----------------------------------------------------------------------*/
773cdf0e10cSrcweir int  SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet)
774cdf0e10cSrcweir {
775cdf0e10cSrcweir     if (_pSet)
776cdf0e10cSrcweir         FillItemSet(*_pSet);
777cdf0e10cSrcweir 	return LEAVE_PAGE;
778cdf0e10cSrcweir }
779cdf0e10cSrcweir /*-- 08.07.99 14:00:04---------------------------------------------------
780cdf0e10cSrcweir 
781cdf0e10cSrcweir   -----------------------------------------------------------------------*/
782cdf0e10cSrcweir sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet)
783cdf0e10cSrcweir {
784cdf0e10cSrcweir 	String* pGroup = (String*)aAutoTextGroupLB.GetEntryData(
785cdf0e10cSrcweir 									aAutoTextGroupLB.GetSelectEntryPos());
786cdf0e10cSrcweir 	DBG_ASSERT(pGroup, "no group selected?");
787cdf0e10cSrcweir 	if(pGroup)
788cdf0e10cSrcweir 		aLabItem.sGlossaryGroup = *pGroup;
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 	SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
791cdf0e10cSrcweir 	if(pSelEntry)
792cdf0e10cSrcweir 		aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData();
793cdf0e10cSrcweir 	rSet.Put(aLabItem);
794cdf0e10cSrcweir 	return sal_True;
795cdf0e10cSrcweir }
796cdf0e10cSrcweir /*-- 08.07.99 14:00:05---------------------------------------------------
797cdf0e10cSrcweir 
798cdf0e10cSrcweir   -----------------------------------------------------------------------*/
799cdf0e10cSrcweir void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
800cdf0e10cSrcweir {
801cdf0e10cSrcweir 	SvLBoxEntry* pEntry = rAutoTextLB.First();
802cdf0e10cSrcweir 	while(pEntry)
803cdf0e10cSrcweir 	{
804cdf0e10cSrcweir 		if(*(String*)pEntry->GetUserData() == rBlockName)
805cdf0e10cSrcweir 		{
806cdf0e10cSrcweir 			rAutoTextLB.Select(pEntry);
807cdf0e10cSrcweir 			rAutoTextLB.MakeVisible(pEntry);
808cdf0e10cSrcweir 			break;
809cdf0e10cSrcweir 		}
810cdf0e10cSrcweir 		pEntry = rAutoTextLB.Next(pEntry);
811cdf0e10cSrcweir 	}
812cdf0e10cSrcweir }
813cdf0e10cSrcweir //-----------------------------------------------------------------------------
814cdf0e10cSrcweir sal_Bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
815cdf0e10cSrcweir {
816cdf0e10cSrcweir 	SvLBoxEntry* pEntry = rAutoTextLB.First();
817cdf0e10cSrcweir 	while(pEntry)
818cdf0e10cSrcweir 	{
819cdf0e10cSrcweir 		if(*(String*)pEntry->GetUserData() == rBlockName)
820cdf0e10cSrcweir 		{
821cdf0e10cSrcweir 			rAutoTextLB.Select(pEntry);
822cdf0e10cSrcweir 			return sal_True;
823cdf0e10cSrcweir 		}
824cdf0e10cSrcweir 		pEntry = rAutoTextLB.Next(pEntry);
825cdf0e10cSrcweir 	}
826cdf0e10cSrcweir 	return sal_False;
827cdf0e10cSrcweir }
828cdf0e10cSrcweir 
829cdf0e10cSrcweir //-----------------------------------------------------------------------------
830cdf0e10cSrcweir void SwVisitingCardPage::Reset(const SfxItemSet& rSet)
831cdf0e10cSrcweir {
832cdf0e10cSrcweir 	aLabItem = (const SwLabItem&) rSet.Get(FN_LABEL);
833cdf0e10cSrcweir 
834cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
835cdf0e10cSrcweir     sal_uInt16 i;
836cdf0e10cSrcweir     for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
837cdf0e10cSrcweir 		if( String(aLabItem.sGlossaryGroup) ==
838cdf0e10cSrcweir 			*(String*)aAutoTextGroupLB.GetEntryData( i ))
839cdf0e10cSrcweir 		{
840cdf0e10cSrcweir 			bFound = sal_True;
841cdf0e10cSrcweir 			break;
842cdf0e10cSrcweir 		}
843cdf0e10cSrcweir 
844cdf0e10cSrcweir     if(!bFound)
845cdf0e10cSrcweir     {
846cdf0e10cSrcweir         // initially search for a group starting with "crd" which is the name of the
847cdf0e10cSrcweir         // business card AutoTexts
848cdf0e10cSrcweir         for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
849cdf0e10cSrcweir             if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") )
850cdf0e10cSrcweir             {
851cdf0e10cSrcweir                 bFound = sal_True;
852cdf0e10cSrcweir                 break;
853cdf0e10cSrcweir             }
854cdf0e10cSrcweir     }
855cdf0e10cSrcweir     if(bFound)
856cdf0e10cSrcweir 	{
857cdf0e10cSrcweir 		if(aAutoTextGroupLB.GetSelectEntryPos() != i)
858cdf0e10cSrcweir 		{
859cdf0e10cSrcweir 			aAutoTextGroupLB.SelectEntryPos(i);
860cdf0e10cSrcweir 			AutoTextSelectHdl(&aAutoTextGroupLB);
861cdf0e10cSrcweir 		}
862cdf0e10cSrcweir 		if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName))
863cdf0e10cSrcweir 		{
864cdf0e10cSrcweir 			SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
865cdf0e10cSrcweir 			if( pSelEntry &&
866cdf0e10cSrcweir 				*(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName))
867cdf0e10cSrcweir 			{
868cdf0e10cSrcweir 				lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName);
869cdf0e10cSrcweir 				AutoTextSelectHdl(&aAutoTextLB);
870cdf0e10cSrcweir 			}
871cdf0e10cSrcweir 		}
872cdf0e10cSrcweir 	}
873cdf0e10cSrcweir }
874cdf0e10cSrcweir 
875cdf0e10cSrcweir /* -----------------29.09.99 08:55-------------------
876cdf0e10cSrcweir 
877cdf0e10cSrcweir  --------------------------------------------------*/
878cdf0e10cSrcweir SwPrivateDataPage::SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet) :
879cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES(TP_PRIVATE_DATA), rSet),
880cdf0e10cSrcweir     aDataFL             (this, SW_RES( FL_DATA       )),
881cdf0e10cSrcweir 
882cdf0e10cSrcweir     aNameFT             (this, SW_RES( FT_NAME       )),
883cdf0e10cSrcweir     aFirstNameED        (this, SW_RES( ED_FIRSTNAME )),
884cdf0e10cSrcweir     aNameED             (this, SW_RES( ED_NAME      )),
885cdf0e10cSrcweir     aShortCutED         (this, SW_RES( ED_SHORTCUT  )),
886cdf0e10cSrcweir 
887cdf0e10cSrcweir     aName2FT            (this, SW_RES( FT_NAME_2     )),
888cdf0e10cSrcweir     aFirstName2ED       (this, SW_RES( ED_FIRSTNAME_2)),
889cdf0e10cSrcweir     aName2ED            (this, SW_RES( ED_NAME_2        )),
890cdf0e10cSrcweir     aShortCut2ED        (this, SW_RES( ED_SHORTCUT_2    )),
891cdf0e10cSrcweir 
892cdf0e10cSrcweir     aStreetFT           (this, SW_RES( FT_STREET     )),
893cdf0e10cSrcweir     aStreetED           (this, SW_RES( ED_STREET        )),
894cdf0e10cSrcweir     aZipCityFT          (this, SW_RES( FT_ZIPCITY   )),
895cdf0e10cSrcweir     aZipED              (this, SW_RES( ED_ZIP       )),
896cdf0e10cSrcweir     aCityED             (this, SW_RES( ED_CITY      )),
897cdf0e10cSrcweir     aCountryStateFT     (this, SW_RES( FT_COUNTRYSTATE )),
898cdf0e10cSrcweir     aCountryED          (this, SW_RES( ED_COUNTRY   )),
899cdf0e10cSrcweir     aStateED            (this, SW_RES( ED_STATE     )),
900cdf0e10cSrcweir     aTitleProfessionFT  (this, SW_RES( FT_TITLEPROF )),
901cdf0e10cSrcweir     aTitleED            (this, SW_RES( ED_TITLE     )),
902cdf0e10cSrcweir     aProfessionED       (this, SW_RES( ED_PROFESSION )),
903cdf0e10cSrcweir     aPhoneFT            (this, SW_RES( FT_PHONE_MOBILE  )),
904cdf0e10cSrcweir     aPhoneED            (this, SW_RES( ED_PHONE     )),
905cdf0e10cSrcweir     aMobilePhoneED      (this, SW_RES( ED_MOBILE        )),
906cdf0e10cSrcweir     aFaxFT              (this, SW_RES( FT_FAX       )),
907cdf0e10cSrcweir     aFaxED              (this, SW_RES( ED_FAX       )),
908cdf0e10cSrcweir     aWWWMailFT          (this, SW_RES( FT_WWWMAIL   )),
909cdf0e10cSrcweir     aHomePageED         (this, SW_RES( ED_WWW       )),
910cdf0e10cSrcweir     aMailED             (this, SW_RES( ED_MAIL      ))
911cdf0e10cSrcweir {
912cdf0e10cSrcweir 	FreeResource();
913cdf0e10cSrcweir 	SetExchangeSupport();
914cdf0e10cSrcweir }
915cdf0e10cSrcweir 
916cdf0e10cSrcweir /*-- 29.09.99 08:55:57---------------------------------------------------
917cdf0e10cSrcweir 
918cdf0e10cSrcweir   -----------------------------------------------------------------------*/
919cdf0e10cSrcweir SwPrivateDataPage::~SwPrivateDataPage()
920cdf0e10cSrcweir {
921cdf0e10cSrcweir }
922cdf0e10cSrcweir /*-- 29.09.99 08:55:57---------------------------------------------------
923cdf0e10cSrcweir 
924cdf0e10cSrcweir   -----------------------------------------------------------------------*/
925cdf0e10cSrcweir SfxTabPage* SwPrivateDataPage::Create(Window* pParent, const SfxItemSet& rSet)
926cdf0e10cSrcweir {
927cdf0e10cSrcweir 	return new SwPrivateDataPage(pParent, rSet);
928cdf0e10cSrcweir }
929cdf0e10cSrcweir /*-- 29.09.99 08:55:57---------------------------------------------------
930cdf0e10cSrcweir 
931cdf0e10cSrcweir   -----------------------------------------------------------------------*/
932cdf0e10cSrcweir void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
933cdf0e10cSrcweir {
934cdf0e10cSrcweir 	Reset(rSet);
935cdf0e10cSrcweir }
936cdf0e10cSrcweir /*-- 29.09.99 08:55:58---------------------------------------------------
937cdf0e10cSrcweir 
938cdf0e10cSrcweir   -----------------------------------------------------------------------*/
939cdf0e10cSrcweir int  SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet)
940cdf0e10cSrcweir {
941cdf0e10cSrcweir     if (_pSet)
942cdf0e10cSrcweir         FillItemSet(*_pSet);
943cdf0e10cSrcweir 	return LEAVE_PAGE;
944cdf0e10cSrcweir }
945cdf0e10cSrcweir /*-- 29.09.99 08:55:58---------------------------------------------------
946cdf0e10cSrcweir 
947cdf0e10cSrcweir   -----------------------------------------------------------------------*/
948cdf0e10cSrcweir sal_Bool SwPrivateDataPage::FillItemSet(SfxItemSet& rSet)
949cdf0e10cSrcweir {
950cdf0e10cSrcweir 
951cdf0e10cSrcweir 	SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
952cdf0e10cSrcweir 	aItem.aPrivFirstName = aFirstNameED	.GetText();
953cdf0e10cSrcweir 	aItem.aPrivName		 = aNameED     	.GetText(  );
954cdf0e10cSrcweir 	aItem.aPrivShortCut	 = aShortCutED 	.GetText(  );
955cdf0e10cSrcweir 	aItem.aPrivFirstName2 = aFirstName2ED	.GetText();
956cdf0e10cSrcweir 	aItem.aPrivName2	 = aName2ED     .GetText(  );
957cdf0e10cSrcweir 	aItem.aPrivShortCut2 = aShortCut2ED .GetText(  );
958cdf0e10cSrcweir 	aItem.aPrivStreet	 = aStreetED   	.GetText(  );
959cdf0e10cSrcweir 	aItem.aPrivZip		 = aZipED      	.GetText(  );
960cdf0e10cSrcweir 	aItem.aPrivCity		 = aCityED     	.GetText(  );
961cdf0e10cSrcweir 	aItem.aPrivCountry	 = aCountryED  	.GetText(  );
962cdf0e10cSrcweir 	aItem.aPrivState	 = aStateED    	.GetText(  );
963cdf0e10cSrcweir 	aItem.aPrivTitle	 = aTitleED    	.GetText(  );
964cdf0e10cSrcweir 	aItem.aPrivProfession= aProfessionED.GetText(	);
965cdf0e10cSrcweir 	aItem.aPrivPhone	 = aPhoneED    	.GetText(  );
966cdf0e10cSrcweir 	aItem.aPrivMobile 	 = aMobilePhoneED.GetText(  );
967cdf0e10cSrcweir 	aItem.aPrivFax		 = aFaxED      	.GetText(  );
968cdf0e10cSrcweir 	aItem.aPrivWWW		 = aHomePageED 	.GetText(  );
969cdf0e10cSrcweir 	aItem.aPrivMail		 = aMailED     	.GetText(  );
970cdf0e10cSrcweir 
971cdf0e10cSrcweir 	rSet.Put(aItem);
972cdf0e10cSrcweir 	return sal_True;
973cdf0e10cSrcweir }
974cdf0e10cSrcweir /*-- 29.09.99 08:55:59---------------------------------------------------
975cdf0e10cSrcweir 
976cdf0e10cSrcweir   -----------------------------------------------------------------------*/
977cdf0e10cSrcweir void SwPrivateDataPage::Reset(const SfxItemSet& rSet)
978cdf0e10cSrcweir {
979cdf0e10cSrcweir 	const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
980cdf0e10cSrcweir 	aFirstNameED.SetText(aItem.aPrivFirstName);
981cdf0e10cSrcweir 	aNameED     .SetText(aItem.aPrivName);
982cdf0e10cSrcweir 	aShortCutED .SetText(aItem.aPrivShortCut);
983cdf0e10cSrcweir 	aFirstName2ED.SetText(aItem.aPrivFirstName2);
984cdf0e10cSrcweir 	aName2ED     .SetText(aItem.aPrivName2);
985cdf0e10cSrcweir 	aShortCut2ED .SetText(aItem.aPrivShortCut2);
986cdf0e10cSrcweir 	aStreetED   .SetText(aItem.aPrivStreet);
987cdf0e10cSrcweir 	aZipED      .SetText(aItem.aPrivZip);
988cdf0e10cSrcweir 	aCityED     .SetText(aItem.aPrivCity);
989cdf0e10cSrcweir 	aCountryED  .SetText(aItem.aPrivCountry);
990cdf0e10cSrcweir 	aStateED    .SetText(aItem.aPrivState);
991cdf0e10cSrcweir 	aTitleED    .SetText(aItem.aPrivTitle);
992cdf0e10cSrcweir 	aProfessionED.SetText(aItem.aPrivProfession);
993cdf0e10cSrcweir 	aPhoneED    .SetText(aItem.aPrivPhone);
994cdf0e10cSrcweir 	aMobilePhoneED.SetText(aItem.aPrivMobile);
995cdf0e10cSrcweir 	aFaxED      .SetText(aItem.aPrivFax);
996cdf0e10cSrcweir 	aHomePageED .SetText(aItem.aPrivWWW);
997cdf0e10cSrcweir 	aMailED     .SetText(aItem.aPrivMail);
998cdf0e10cSrcweir }
999cdf0e10cSrcweir /* -----------------29.09.99 08:56-------------------
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir  --------------------------------------------------*/
1002cdf0e10cSrcweir SwBusinessDataPage::SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet) :
1003cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES(TP_BUSINESS_DATA), rSet),
1004cdf0e10cSrcweir     aDataFL             (this, SW_RES( FL_DATA       )),
1005cdf0e10cSrcweir 	aCompanyFT			(this, SW_RES( FT_COMP		)),
1006cdf0e10cSrcweir 	aCompanyED			(this, SW_RES( ED_COMP		)),
1007cdf0e10cSrcweir 	aCompanyExtFT		(this, SW_RES( FT_COMP_EXT	)),
1008cdf0e10cSrcweir 	aCompanyExtED		(this, SW_RES( ED_COMP_EXT	)),
1009cdf0e10cSrcweir 	aSloganFT			(this, SW_RES( FT_SLOGAN		)),
1010cdf0e10cSrcweir 	aSloganED			(this, SW_RES( ED_SLOGAN		)),
1011cdf0e10cSrcweir 	aStreetFT			(this, SW_RES( FT_STREET		)),
1012cdf0e10cSrcweir 	aStreetED			(this, SW_RES( ED_STREET		)),
1013cdf0e10cSrcweir 	aZipCityFT			(this, SW_RES( FT_ZIPCITY	)),
1014cdf0e10cSrcweir 	aZipED				(this, SW_RES( ED_ZIP		)),
1015cdf0e10cSrcweir 	aCityED				(this, SW_RES( ED_CITY		)),
1016cdf0e10cSrcweir 	aCountryStateFT		(this, SW_RES( FT_COUNTRYSTATE	)),
1017cdf0e10cSrcweir 	aCountryED			(this, SW_RES( ED_COUNTRY	)),
1018cdf0e10cSrcweir 	aStateED			(this, SW_RES( ED_STATE		)),
1019cdf0e10cSrcweir 	aPositionFT			(this, SW_RES( FT_POSITION	)),
1020cdf0e10cSrcweir 	aPositionED			(this, SW_RES( ED_POSITION	)),
1021cdf0e10cSrcweir 	aPhoneFT			(this, SW_RES( FT_PHONE_MOBILE	)),
1022cdf0e10cSrcweir 	aPhoneED			(this, SW_RES( ED_PHONE		)),
1023cdf0e10cSrcweir 	aMobilePhoneED		(this, SW_RES( ED_MOBILE		)),
1024cdf0e10cSrcweir 	aFaxFT				(this, SW_RES( FT_FAX		)),
1025cdf0e10cSrcweir 	aFaxED				(this, SW_RES( ED_FAX		)),
1026cdf0e10cSrcweir 	aWWWMailFT			(this, SW_RES( FT_WWWMAIL	)),
1027cdf0e10cSrcweir 	aHomePageED			(this, SW_RES( ED_WWW		)),
1028cdf0e10cSrcweir 	aMailED				(this, SW_RES( ED_MAIL		))
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir 	FreeResource();
1031cdf0e10cSrcweir 	SetExchangeSupport();
1032cdf0e10cSrcweir }
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir /*-- 29.09.99 08:56:06---------------------------------------------------
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1037cdf0e10cSrcweir SwBusinessDataPage::~SwBusinessDataPage()
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir }
1040cdf0e10cSrcweir /*-- 29.09.99 08:56:06---------------------------------------------------
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1043cdf0e10cSrcweir SfxTabPage* SwBusinessDataPage::Create(Window* pParent, const SfxItemSet& rSet)
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir 	return new SwBusinessDataPage(pParent, rSet);
1046cdf0e10cSrcweir }
1047cdf0e10cSrcweir /*-- 29.09.99 08:56:06---------------------------------------------------
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1050cdf0e10cSrcweir void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet)
1051cdf0e10cSrcweir {
1052cdf0e10cSrcweir 	Reset(rSet);
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir /*-- 29.09.99 08:56:06---------------------------------------------------
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1057cdf0e10cSrcweir int  SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet)
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir     if (_pSet)
1060cdf0e10cSrcweir         FillItemSet(*_pSet);
1061cdf0e10cSrcweir 	return LEAVE_PAGE;
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir /*-- 29.09.99 08:56:06---------------------------------------------------
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1066cdf0e10cSrcweir sal_Bool SwBusinessDataPage::FillItemSet(SfxItemSet& rSet)
1067cdf0e10cSrcweir {
1068cdf0e10cSrcweir 	SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 	aItem.aCompCompany	 = aCompanyED	   .GetText();
1071cdf0e10cSrcweir 	aItem.aCompCompanyExt= aCompanyExtED   .GetText();
1072cdf0e10cSrcweir 	aItem.aCompSlogan	 = aSloganED       .GetText();
1073cdf0e10cSrcweir 	aItem.aCompStreet	 = aStreetED       .GetText();
1074cdf0e10cSrcweir 	aItem.aCompZip		 = aZipED          .GetText();
1075cdf0e10cSrcweir 	aItem.aCompCity		 = aCityED         .GetText();
1076cdf0e10cSrcweir 	aItem.aCompCountry	 = aCountryED      .GetText();
1077cdf0e10cSrcweir 	aItem.aCompState	 = aStateED        .GetText();
1078cdf0e10cSrcweir 	aItem.aCompPosition	 = aPositionED     .GetText();
1079cdf0e10cSrcweir 	aItem.aCompPhone	 = aPhoneED        .GetText();
1080cdf0e10cSrcweir 	aItem.aCompMobile	 = aMobilePhoneED  .GetText();
1081cdf0e10cSrcweir 	aItem.aCompFax		 = aFaxED          .GetText();
1082cdf0e10cSrcweir 	aItem.aCompWWW		 = aHomePageED     .GetText();
1083cdf0e10cSrcweir 	aItem.aCompMail		 = aMailED         .GetText();
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir 	rSet.Put(aItem);
1086cdf0e10cSrcweir 	return sal_True;
1087cdf0e10cSrcweir }
1088cdf0e10cSrcweir /*-- 29.09.99 08:56:07---------------------------------------------------
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1091cdf0e10cSrcweir void SwBusinessDataPage::Reset(const SfxItemSet& rSet)
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir 	const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
1094cdf0e10cSrcweir     aCompanyED      .SetText(aItem.aCompCompany);
1095cdf0e10cSrcweir 	aCompanyExtED   .SetText(aItem.aCompCompanyExt);
1096cdf0e10cSrcweir 	aSloganED       .SetText(aItem.aCompSlogan);
1097cdf0e10cSrcweir 	aStreetED       .SetText(aItem.aCompStreet);
1098cdf0e10cSrcweir 	aZipED          .SetText(aItem.aCompZip);
1099cdf0e10cSrcweir 	aCityED         .SetText(aItem.aCompCity);
1100cdf0e10cSrcweir 	aCountryED      .SetText(aItem.aCompCountry);
1101cdf0e10cSrcweir 	aStateED        .SetText(aItem.aCompState);
1102cdf0e10cSrcweir 	aPositionED     .SetText(aItem.aCompPosition);
1103cdf0e10cSrcweir 	aPhoneED        .SetText(aItem.aCompPhone);
1104cdf0e10cSrcweir 	aMobilePhoneED  .SetText(aItem.aCompMobile);
1105cdf0e10cSrcweir 	aFaxED          .SetText(aItem.aCompFax);
1106cdf0e10cSrcweir 	aHomePageED     .SetText(aItem.aCompWWW);
1107cdf0e10cSrcweir 	aMailED         .SetText(aItem.aCompMail);
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir 
1112