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