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