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