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_extensions.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/form/ListSourceType.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
40*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
41*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
42*cdf0e10cSrcweir #include "general.hxx"
43*cdf0e10cSrcweir #include "sections.hrc"
44*cdf0e10cSrcweir #include "bibresid.hxx"
45*cdf0e10cSrcweir #include "datman.hxx"
46*cdf0e10cSrcweir #include "bibconfig.hxx"
47*cdf0e10cSrcweir #include "bibprop.hrc"
48*cdf0e10cSrcweir #include "bib.hrc"
49*cdf0e10cSrcweir #include "bibmod.hxx"
50*cdf0e10cSrcweir #include "bibtools.hxx"
51*cdf0e10cSrcweir #include "bibliography.hrc"
52*cdf0e10cSrcweir #include <tools/debug.hxx>
53*cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
54*cdf0e10cSrcweir #include <vcl/svapp.hxx>
55*cdf0e10cSrcweir #include <vcl/i18nhelp.hxx>
56*cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
57*cdf0e10cSrcweir #include <algorithm>
58*cdf0e10cSrcweir #include <functional>
59*cdf0e10cSrcweir #include <vector>
60*cdf0e10cSrcweir #include <tools/urlobj.hxx>
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir using namespace ::com::sun::star;
63*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
64*cdf0e10cSrcweir using namespace ::com::sun::star::form;
65*cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
66*cdf0e10cSrcweir using namespace ::rtl;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #define C2U(cChar) OUString::createFromAscii(cChar)
69*cdf0e10cSrcweir #define C2S(cChar) String::CreateFromAscii(cChar)
70*cdf0e10cSrcweir #define DISTANCE_CONTROL_TO_FIXEDTEXT 5
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir ::Point lcl_MovePoint(const FixedText& rFixedText)
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir 	::Point aRet(rFixedText.GetPosPixel());
75*cdf0e10cSrcweir 	aRet.X() += rFixedText.GetSizePixel().Width();
76*cdf0e10cSrcweir     aRet.X() += DISTANCE_CONTROL_TO_FIXEDTEXT;
77*cdf0e10cSrcweir 	return aRet;
78*cdf0e10cSrcweir }
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir //-----------------------------------------------------------------------------
81*cdf0e10cSrcweir OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos )
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir 	BibConfig* pBibConfig = BibModul::GetConfig();
84*cdf0e10cSrcweir 	OUString sRet = pBibConfig->GetDefColumnName(nIndexPos);
85*cdf0e10cSrcweir 	if(pMapping)
86*cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
87*cdf0e10cSrcweir 		{
88*cdf0e10cSrcweir 			if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet)
89*cdf0e10cSrcweir 			{
90*cdf0e10cSrcweir 				sRet = pMapping->aColumnPairs[i].sRealColumnName;
91*cdf0e10cSrcweir 				break;
92*cdf0e10cSrcweir 			}
93*cdf0e10cSrcweir 		}
94*cdf0e10cSrcweir 	return sRet;
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir /* -----------------------------04.01.00 10:54--------------------------------
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
99*cdf0e10cSrcweir class BibPosListener	:public cppu::WeakImplHelper1 <sdbc::XRowSetListener>
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir 	BibGeneralPage* 	pParentPage;
102*cdf0e10cSrcweir public:
103*cdf0e10cSrcweir 	BibPosListener(BibGeneralPage* pParent);
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	//XPositioningListener
106*cdf0e10cSrcweir 	virtual void SAL_CALL cursorMoved(const lang::EventObject& event) throw( uno::RuntimeException );
107*cdf0e10cSrcweir 	virtual void SAL_CALL rowChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ }
108*cdf0e10cSrcweir 	virtual void SAL_CALL rowSetChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	//XEventListener
111*cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( uno::RuntimeException );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir };
114*cdf0e10cSrcweir /* -----------------------------04.01.00 10:57--------------------------------
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
117*cdf0e10cSrcweir BibPosListener::BibPosListener(BibGeneralPage* pParent) :
118*cdf0e10cSrcweir 	pParentPage(pParent)
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir }
121*cdf0e10cSrcweir /* -----------------------------04.01.00 10:57--------------------------------
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
124*cdf0e10cSrcweir void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno::RuntimeException )
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 	try
127*cdf0e10cSrcweir 	{
128*cdf0e10cSrcweir 		uno::Reference< form::XBoundComponent >  xLstBox = pParentPage->GetTypeListBoxModel();
129*cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet >  xPropSet(xLstBox, UNO_QUERY);
130*cdf0e10cSrcweir 		if(xPropSet.is())
131*cdf0e10cSrcweir 		{
132*cdf0e10cSrcweir 			BibConfig* pBibConfig = BibModul::GetConfig();
133*cdf0e10cSrcweir 			BibDataManager* pDatMan = pParentPage->GetDataManager();
134*cdf0e10cSrcweir 			BibDBDescriptor aDesc;
135*cdf0e10cSrcweir 			aDesc.sDataSource = pDatMan->getActiveDataSource();
136*cdf0e10cSrcweir 			aDesc.sTableOrQuery = pDatMan->getActiveDataTable();
137*cdf0e10cSrcweir 			aDesc.nCommandType = CommandType::TABLE;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 			const Mapping* pMapping = pBibConfig->GetMapping(aDesc);
140*cdf0e10cSrcweir 			OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS);
141*cdf0e10cSrcweir 			if(pMapping)
142*cdf0e10cSrcweir 			{
143*cdf0e10cSrcweir 				for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
144*cdf0e10cSrcweir 				{
145*cdf0e10cSrcweir 					if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping)
146*cdf0e10cSrcweir 					{
147*cdf0e10cSrcweir 						sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
148*cdf0e10cSrcweir 						break;
149*cdf0e10cSrcweir 					}
150*cdf0e10cSrcweir 				}
151*cdf0e10cSrcweir 			}
152*cdf0e10cSrcweir 			rtl::OUString uTypeMapping = sTypeMapping;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 			uno::Reference< form::XForm >  xForm = pDatMan->getForm();
155*cdf0e10cSrcweir 			uno::Reference< sdbcx::XColumnsSupplier >  xSupplyCols(xForm, UNO_QUERY);
156*cdf0e10cSrcweir 			uno::Reference< container::XNameAccess >  xValueAcc;
157*cdf0e10cSrcweir 			if (xSupplyCols.is())
158*cdf0e10cSrcweir 				xValueAcc = xSupplyCols->getColumns();
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 			sal_Int16 nTempVal = -1;
161*cdf0e10cSrcweir 			if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping))
162*cdf0e10cSrcweir 			{
163*cdf0e10cSrcweir 				uno::Any aVal = xValueAcc->getByName(uTypeMapping);
164*cdf0e10cSrcweir 				uno::Reference< uno::XInterface >  xInt = *(uno::Reference< uno::XInterface > *)aVal.getValue();
165*cdf0e10cSrcweir 				uno::Reference< sdb::XColumn >	xCol(xInt, UNO_QUERY);
166*cdf0e10cSrcweir 				DBG_ASSERT(xCol.is(), "BibPosListener::positioned : invalid column (no sdb::XColumn) !");
167*cdf0e10cSrcweir 				if (xCol.is())
168*cdf0e10cSrcweir 				{
169*cdf0e10cSrcweir 					nTempVal = xCol->getShort();
170*cdf0e10cSrcweir 					// getShort returns zero if the value is not a number
171*cdf0e10cSrcweir 					if (!nTempVal || xCol->wasNull())
172*cdf0e10cSrcweir 					{
173*cdf0e10cSrcweir 						rtl::OUString sTempVal = xCol->getString();
174*cdf0e10cSrcweir 						if(sTempVal != rtl::OUString('0'))
175*cdf0e10cSrcweir 							nTempVal = -1;
176*cdf0e10cSrcweir 					}
177*cdf0e10cSrcweir 				}
178*cdf0e10cSrcweir 			}
179*cdf0e10cSrcweir 			if(nTempVal < 0 || nTempVal >= TYPE_COUNT)
180*cdf0e10cSrcweir 			{
181*cdf0e10cSrcweir 				uno::Any aSel;
182*cdf0e10cSrcweir 				uno::Sequence<sal_Int16> aSelSeq(1);
183*cdf0e10cSrcweir 				sal_Int16* pArr = aSelSeq.getArray();
184*cdf0e10cSrcweir 				pArr[0] = TYPE_COUNT;
185*cdf0e10cSrcweir 				aSel.setValue(&aSelSeq, ::getCppuType((Sequence<sal_Int16>*)0));
186*cdf0e10cSrcweir 				xPropSet->setPropertyValue(C2U("SelectedItems"), aSel);
187*cdf0e10cSrcweir 			}
188*cdf0e10cSrcweir 		}
189*cdf0e10cSrcweir 	}
190*cdf0e10cSrcweir 	catch(Exception& rEx)
191*cdf0e10cSrcweir 	{
192*cdf0e10cSrcweir 		(void) rEx;	// make compiler happy
193*cdf0e10cSrcweir         DBG_ERROR("BibPosListener::positioned: something went wrong !");
194*cdf0e10cSrcweir 	}
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir /* -----------------------------04.01.00 11:28--------------------------------
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
199*cdf0e10cSrcweir void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException )
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir /* -----------------16.11.99 13:06-------------------
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir  --------------------------------------------------*/
206*cdf0e10cSrcweir BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan):
207*cdf0e10cSrcweir 	BibTabPage(pParent,BibResId(RID_TP_GENERAL)),
208*cdf0e10cSrcweir 	aControlParentWin(this, WB_DIALOGCONTROL),
209*cdf0e10cSrcweir 	aIdentifierFT(&aControlParentWin,	BibResId(FT_IDENTIFIER 	)),
210*cdf0e10cSrcweir 	aAuthTypeFT(&aControlParentWin, 	BibResId(FT_AUTHTYPE		)),
211*cdf0e10cSrcweir 	aYearFT(&aControlParentWin, 		BibResId(FT_YEAR			)),
212*cdf0e10cSrcweir 	aAuthorFT(&aControlParentWin,		BibResId(FT_AUTHOR 		)),
213*cdf0e10cSrcweir 	aTitleFT(&aControlParentWin,		BibResId(FT_TITLE			)),
214*cdf0e10cSrcweir 	aPublisherFT(&aControlParentWin,	BibResId(FT_PUBLISHER		)),
215*cdf0e10cSrcweir 	aAddressFT(&aControlParentWin,		BibResId(FT_ADDRESS		)),
216*cdf0e10cSrcweir 	aISBNFT(&aControlParentWin, 		BibResId(FT_ISBN			)),
217*cdf0e10cSrcweir 	aChapterFT(&aControlParentWin,		BibResId(FT_CHAPTER		)),
218*cdf0e10cSrcweir 	aPagesFT(&aControlParentWin,		BibResId(FT_PAGE			)),
219*cdf0e10cSrcweir     aFirstFL(&aControlParentWin,        BibResId(FL_1        )),
220*cdf0e10cSrcweir 	aEditorFT(&aControlParentWin,		BibResId(FT_EDITOR 		)),
221*cdf0e10cSrcweir 	aEditionFT(&aControlParentWin,		BibResId(FT_EDITION		)),
222*cdf0e10cSrcweir 	aBooktitleFT(&aControlParentWin,	BibResId(FT_BOOKTITLE		)),
223*cdf0e10cSrcweir 	aVolumeFT(&aControlParentWin,		BibResId(FT_VOLUME 		)),
224*cdf0e10cSrcweir 	aHowpublishedFT(&aControlParentWin, BibResId(FT_HOWPUBLISHED	)),
225*cdf0e10cSrcweir 	aOrganizationsFT(&aControlParentWin,BibResId(FT_ORGANIZATION	)),
226*cdf0e10cSrcweir 	aInstitutionFT(&aControlParentWin,	BibResId(FT_INSTITUTION	)),
227*cdf0e10cSrcweir 	aSchoolFT(&aControlParentWin,		BibResId(FT_SCHOOL 		)),
228*cdf0e10cSrcweir 	aReportTypeFT(&aControlParentWin,	BibResId(FT_REPORT 		)),
229*cdf0e10cSrcweir 	aMonthFT(&aControlParentWin,		BibResId(FT_MONTH			)),
230*cdf0e10cSrcweir     aSecondFL(&aControlParentWin,       BibResId(FL_2        )),
231*cdf0e10cSrcweir 	aJournalFT(&aControlParentWin,		BibResId(FT_JOURNAL		)),
232*cdf0e10cSrcweir 	aNumberFT(&aControlParentWin,		BibResId(FT_NUMBER 		)),
233*cdf0e10cSrcweir 	aSeriesFT(&aControlParentWin,		BibResId(FT_SERIES 		)),
234*cdf0e10cSrcweir 	aAnnoteFT(&aControlParentWin,		BibResId(FT_ANNOTE 		)),
235*cdf0e10cSrcweir 	aNoteFT(&aControlParentWin, 		BibResId(FT_NOTE			)),
236*cdf0e10cSrcweir 	aURLFT(&aControlParentWin,			BibResId(FT_URL			)),
237*cdf0e10cSrcweir     aThirdFL(&aControlParentWin,        BibResId(FL_3        )),
238*cdf0e10cSrcweir 	aCustom1FT(&aControlParentWin,		BibResId(FT_CUSTOM1		)),
239*cdf0e10cSrcweir 	aCustom2FT(&aControlParentWin,		BibResId(FT_CUSTOM2		)),
240*cdf0e10cSrcweir 	aCustom3FT(&aControlParentWin,		BibResId(FT_CUSTOM3		)),
241*cdf0e10cSrcweir 	aCustom4FT(&aControlParentWin,		BibResId(FT_CUSTOM4		)),
242*cdf0e10cSrcweir 	aCustom5FT(&aControlParentWin,		BibResId(FT_CUSTOM5		)),
243*cdf0e10cSrcweir 	aHoriScroll(this, WB_HORZ),
244*cdf0e10cSrcweir 	aVertScroll(this, WB_VERT),
245*cdf0e10cSrcweir 	sErrorPrefix(BibResId(ST_ERROR_PREFIX)),
246*cdf0e10cSrcweir 	pDatMan(pMan)
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir 	aControlParentWin.Show();
249*cdf0e10cSrcweir 	aControlParentWin.SetHelpId(HID_BIB_CONTROL_PARENT);
250*cdf0e10cSrcweir 	aStdSize = GetOutputSizePixel();
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 	aBibTypeArr[0] = String(BibResId(ST_TYPE_ARTICLE));
253*cdf0e10cSrcweir 	aBibTypeArr[1] = String(BibResId(ST_TYPE_BOOK));
254*cdf0e10cSrcweir 	aBibTypeArr[2] = String(BibResId(ST_TYPE_BOOKLET));
255*cdf0e10cSrcweir 	aBibTypeArr[3] = String(BibResId(ST_TYPE_CONFERENCE));
256*cdf0e10cSrcweir 	aBibTypeArr[4] = String(BibResId(ST_TYPE_INBOOK	));
257*cdf0e10cSrcweir 	aBibTypeArr[5] = String(BibResId(ST_TYPE_INCOLLECTION));
258*cdf0e10cSrcweir 	aBibTypeArr[6] = String(BibResId(ST_TYPE_INPROCEEDINGS));
259*cdf0e10cSrcweir 	aBibTypeArr[7] = String(BibResId(ST_TYPE_JOURNAL	   ));
260*cdf0e10cSrcweir 	aBibTypeArr[8] = String(BibResId(ST_TYPE_MANUAL	   ));
261*cdf0e10cSrcweir 	aBibTypeArr[9] = String(BibResId(ST_TYPE_MASTERSTHESIS));
262*cdf0e10cSrcweir 	aBibTypeArr[10] = String(BibResId(ST_TYPE_MISC 		));
263*cdf0e10cSrcweir 	aBibTypeArr[11] = String(BibResId(ST_TYPE_PHDTHESIS	));
264*cdf0e10cSrcweir 	aBibTypeArr[12] = String(BibResId(ST_TYPE_PROCEEDINGS	));
265*cdf0e10cSrcweir 	aBibTypeArr[13] = String(BibResId(ST_TYPE_TECHREPORT	));
266*cdf0e10cSrcweir 	aBibTypeArr[14] = String(BibResId(ST_TYPE_UNPUBLISHED	));
267*cdf0e10cSrcweir 	aBibTypeArr[15] = String(BibResId(ST_TYPE_EMAIL		));
268*cdf0e10cSrcweir 	aBibTypeArr[16] = String(BibResId(ST_TYPE_WWW			));
269*cdf0e10cSrcweir 	aBibTypeArr[17] = String(BibResId(ST_TYPE_CUSTOM1		));
270*cdf0e10cSrcweir 	aBibTypeArr[18] = String(BibResId(ST_TYPE_CUSTOM2		));
271*cdf0e10cSrcweir 	aBibTypeArr[19] = String(BibResId(ST_TYPE_CUSTOM3		));
272*cdf0e10cSrcweir 	aBibTypeArr[20] = String(BibResId(ST_TYPE_CUSTOM4		));
273*cdf0e10cSrcweir 	aBibTypeArr[21] = String(BibResId(ST_TYPE_CUSTOM5		));
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	FreeResource();
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	InitFixedTexts();
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	aBasePos = aIdentifierFT.GetPosPixel();
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	sal_Int16* pMap = nFT2CtrlMap;
282*cdf0e10cSrcweir 	for( sal_uInt16 i = 0 ; i < FIELD_COUNT ; ++i, ++pMap )
283*cdf0e10cSrcweir 	{
284*cdf0e10cSrcweir 		aControls[ i ] = 0;
285*cdf0e10cSrcweir 		*pMap = -1;
286*cdf0e10cSrcweir 	}
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	AdjustScrollbars();
289*cdf0e10cSrcweir 	Link aScrollLnk(LINK(this, BibGeneralPage, ScrollHdl));
290*cdf0e10cSrcweir 	aHoriScroll.SetScrollHdl( aScrollLnk );
291*cdf0e10cSrcweir 	aVertScroll.SetScrollHdl( aScrollLnk );
292*cdf0e10cSrcweir 	aHoriScroll.SetLineSize(10);
293*cdf0e10cSrcweir 	aVertScroll.SetLineSize(10);
294*cdf0e10cSrcweir 	aHoriScroll.SetPageSize( aIdentifierFT.GetSizePixel().Width());
295*cdf0e10cSrcweir 	aVertScroll.SetPageSize(
296*cdf0e10cSrcweir 		aPublisherFT.GetPosPixel().Y() - aIdentifierFT.GetPosPixel().Y());
297*cdf0e10cSrcweir 	aHoriScroll.Show();
298*cdf0e10cSrcweir 	aVertScroll.Show();
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 	BibConfig* pBibConfig = BibModul::GetConfig();
301*cdf0e10cSrcweir 	BibDBDescriptor aDesc;
302*cdf0e10cSrcweir 	aDesc.sDataSource = pDatMan->getActiveDataSource();
303*cdf0e10cSrcweir 	aDesc.sTableOrQuery = pDatMan->getActiveDataTable();
304*cdf0e10cSrcweir 	aDesc.nCommandType = CommandType::TABLE;
305*cdf0e10cSrcweir 	const Mapping* pMapping = pBibConfig->GetMapping(aDesc);
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 	xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin);
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 	xMgr = comphelper::getProcessServiceFactory();
310*cdf0e10cSrcweir     // the control should be a bit smaller than the fixed text
311*cdf0e10cSrcweir     Size aControlSize(aIdentifierFT.GetSizePixel());
312*cdf0e10cSrcweir     aControlSize.Width() = aControlSize.Width() * 8 / 10;
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, IDENTIFIER_POS ), lcl_MovePoint( aIdentifierFT ),
315*cdf0e10cSrcweir         aControlSize, sTableErrorString, aIdentifierFT.GetText(),
316*cdf0e10cSrcweir 		HID_BIB_IDENTIFIER_POS, 0 );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	sTypeColumnName = lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS);
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir     AddControlWithError( sTypeColumnName, lcl_MovePoint(aAuthTypeFT ), aControlSize, sTableErrorString,
321*cdf0e10cSrcweir 		aAuthTypeFT.GetText(), HID_BIB_AUTHORITYTYPE_POS, 1 );
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 	::Point aYearPos = lcl_MovePoint(aYearFT);
324*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, YEAR_POS ), aYearPos,
325*cdf0e10cSrcweir         aControlSize, sTableErrorString, aYearFT.GetText(), HID_BIB_YEAR_POS, 4 );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName(pMapping, AUTHOR_POS), lcl_MovePoint(aAuthorFT),
328*cdf0e10cSrcweir         aControlSize, sTableErrorString, aAuthorFT.GetText(), HID_BIB_AUTHOR_POS, 2 );
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	::Point aTitlePos( lcl_MovePoint( aTitleFT ) );
331*cdf0e10cSrcweir 	::Size aTitleSize = aTitleFT.GetSizePixel();
332*cdf0e10cSrcweir     aTitleSize.Width() = aYearPos.X() + aControlSize.Width() - aTitlePos.X();
333*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName(pMapping, TITLE_POS), aTitlePos, aTitleSize, sTableErrorString,
334*cdf0e10cSrcweir 		aTitleFT.GetText(), HID_BIB_TITLE_POS, 22 );
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, PUBLISHER_POS ), lcl_MovePoint( aPublisherFT),
337*cdf0e10cSrcweir         aControlSize, sTableErrorString, aPublisherFT.GetText(), HID_BIB_PUBLISHER_POS, 5 );
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, ADDRESS_POS ), lcl_MovePoint( aAddressFT ),
340*cdf0e10cSrcweir         aControlSize, sTableErrorString, aAddressFT.GetText(), HID_BIB_ADDRESS_POS, 7 );
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, ISBN_POS ), lcl_MovePoint( aISBNFT ),
343*cdf0e10cSrcweir         aControlSize, sTableErrorString, aISBNFT.GetText(), HID_BIB_ISBN_POS, 6 );
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, CHAPTER_POS ), lcl_MovePoint(aChapterFT),
346*cdf0e10cSrcweir         aControlSize, sTableErrorString, aChapterFT.GetText(), HID_BIB_CHAPTER_POS, 10 );
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, PAGES_POS ), lcl_MovePoint( aPagesFT ),
349*cdf0e10cSrcweir         aControlSize, sTableErrorString, aPagesFT.GetText(), HID_BIB_PAGES_POS, 19 );
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, EDITOR_POS ), lcl_MovePoint( aEditorFT ),
352*cdf0e10cSrcweir         aControlSize, sTableErrorString, aEditorFT.GetText(), HID_BIB_EDITOR_POS, 12 );
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, EDITION_POS ), lcl_MovePoint(aEditionFT),
355*cdf0e10cSrcweir         aControlSize, sTableErrorString, aEditionFT.GetText(), HID_BIB_EDITION_POS, 11 );
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName(pMapping, BOOKTITLE_POS), lcl_MovePoint(aBooktitleFT),
358*cdf0e10cSrcweir         aControlSize, sTableErrorString, aBooktitleFT.GetText(), HID_BIB_BOOKTITLE_POS, 9 );
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, VOLUME_POS ), lcl_MovePoint( aVolumeFT ),
361*cdf0e10cSrcweir         aControlSize, sTableErrorString, aVolumeFT.GetText(), HID_BIB_VOLUME_POS, 24 );
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, HOWPUBLISHED_POS ), lcl_MovePoint( aHowpublishedFT ),
364*cdf0e10cSrcweir         aControlSize, sTableErrorString, aHowpublishedFT.GetText(), HID_BIB_HOWPUBLISHED_POS, 13 );
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, ORGANIZATIONS_POS ), lcl_MovePoint( aOrganizationsFT ),
367*cdf0e10cSrcweir         aControlSize, sTableErrorString, aOrganizationsFT.GetText(), HID_BIB_ORGANIZATIONS_POS, 18 );
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, INSTITUTION_POS ), lcl_MovePoint( aInstitutionFT ),
370*cdf0e10cSrcweir         aControlSize, sTableErrorString, aInstitutionFT.GetText(), HID_BIB_INSTITUTION_POS, 14 );
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, SCHOOL_POS ), lcl_MovePoint( aSchoolFT ),
373*cdf0e10cSrcweir         aControlSize, sTableErrorString, aSchoolFT.GetText(), HID_BIB_SCHOOL_POS, 20 );
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, REPORTTYPE_POS ), lcl_MovePoint( aReportTypeFT ),
376*cdf0e10cSrcweir         aControlSize, sTableErrorString, aReportTypeFT.GetText(), HID_BIB_REPORTTYPE_POS, 23 );
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, MONTH_POS ), lcl_MovePoint( aMonthFT ),
379*cdf0e10cSrcweir         aControlSize, sTableErrorString, aMonthFT.GetText(), HID_BIB_MONTH_POS, 3 );
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, JOURNAL_POS ), lcl_MovePoint( aJournalFT ),
382*cdf0e10cSrcweir         aControlSize, sTableErrorString, aJournalFT.GetText(), HID_BIB_JOURNAL_POS, 15 );
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, NUMBER_POS ), lcl_MovePoint( aNumberFT ),
385*cdf0e10cSrcweir         aControlSize, sTableErrorString, aNumberFT.GetText(), HID_BIB_NUMBER_POS, 17 );
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, SERIES_POS ), lcl_MovePoint( aSeriesFT ),
388*cdf0e10cSrcweir         aControlSize, sTableErrorString, aSeriesFT.GetText(), HID_BIB_SERIES_POS, 21 );
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, ANNOTE_POS ), lcl_MovePoint( aAnnoteFT ),
391*cdf0e10cSrcweir         aControlSize, sTableErrorString, aAnnoteFT.GetText(), HID_BIB_ANNOTE_POS, 8 );
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, NOTE_POS ), lcl_MovePoint( aNoteFT ),
394*cdf0e10cSrcweir         aControlSize, sTableErrorString, aNoteFT.GetText(), HID_BIB_NOTE_POS, 16 );
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, URL_POS ), lcl_MovePoint( aURLFT ),
397*cdf0e10cSrcweir         aControlSize, sTableErrorString, aURLFT.GetText(), HID_BIB_URL_POS, 25 );
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 	AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM1_POS ), lcl_MovePoint( aCustom1FT ),
400*cdf0e10cSrcweir         aControlSize, sTableErrorString, aCustom1FT.GetText(), HID_BIB_CUSTOM1_POS, 26 );
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM2_POS ), lcl_MovePoint( aCustom2FT ),
403*cdf0e10cSrcweir         aControlSize, sTableErrorString, aCustom2FT.GetText(), HID_BIB_CUSTOM2_POS, 27 );
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM3_POS ), lcl_MovePoint( aCustom3FT ),
406*cdf0e10cSrcweir         aControlSize, sTableErrorString, aCustom3FT.GetText(), HID_BIB_CUSTOM3_POS, 28 );
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM4_POS ), lcl_MovePoint( aCustom4FT ),
409*cdf0e10cSrcweir         aControlSize, sTableErrorString, aCustom4FT.GetText(), HID_BIB_CUSTOM4_POS, 29 );
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir     AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM5_POS ), lcl_MovePoint( aCustom5FT ),
412*cdf0e10cSrcweir         aControlSize, sTableErrorString, aCustom5FT.GetText(), HID_BIB_CUSTOM5_POS, 30 );
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir 	xPosListener = new BibPosListener(this);
415*cdf0e10cSrcweir 	uno::Reference< sdbc::XRowSet >  xRowSet(pDatMan->getForm(), UNO_QUERY);
416*cdf0e10cSrcweir 	if(xRowSet.is())
417*cdf0e10cSrcweir 		xRowSet->addRowSetListener(xPosListener);
418*cdf0e10cSrcweir     uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController();
419*cdf0e10cSrcweir     xFormCtrl->setContainer(xCtrlContnr);
420*cdf0e10cSrcweir 	xFormCtrl->activateTabOrder();
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 	if(sTableErrorString.Len())
423*cdf0e10cSrcweir 		sTableErrorString.Insert(sErrorPrefix, 0);
424*cdf0e10cSrcweir }
425*cdf0e10cSrcweir //-----------------------------------------------------------------------------
426*cdf0e10cSrcweir BibGeneralPage::~BibGeneralPage()
427*cdf0e10cSrcweir {
428*cdf0e10cSrcweir 	if (pDatMan && xPosListener.is())
429*cdf0e10cSrcweir 	{
430*cdf0e10cSrcweir 		uno::Reference< sdbc::XRowSet >  xRowSet(pDatMan->getForm(), UNO_QUERY);
431*cdf0e10cSrcweir 		if(xRowSet.is())
432*cdf0e10cSrcweir 			xRowSet->removeRowSetListener(xPosListener);
433*cdf0e10cSrcweir 	}
434*cdf0e10cSrcweir }
435*cdf0e10cSrcweir  /* -----------------------------14.04.00 13:11--------------------------------
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir   ---------------------------------------------------------------------------*/
438*cdf0e10cSrcweir  void BibGeneralPage::RemoveListeners()
439*cdf0e10cSrcweir  {
440*cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
441*cdf0e10cSrcweir 	{
442*cdf0e10cSrcweir 		if(aControls[i].is())
443*cdf0e10cSrcweir 		{
444*cdf0e10cSrcweir 			uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
445*cdf0e10cSrcweir 			xCtrWin->removeFocusListener( this );
446*cdf0e10cSrcweir 			aControls[i] = 0;
447*cdf0e10cSrcweir 		}
448*cdf0e10cSrcweir 	}
449*cdf0e10cSrcweir  }
450*cdf0e10cSrcweir /* -----------------------------21.01.00 17:05--------------------------------
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
453*cdf0e10cSrcweir void BibGeneralPage::CommitActiveControl()
454*cdf0e10cSrcweir {
455*cdf0e10cSrcweir     uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController();
456*cdf0e10cSrcweir     uno::Reference< awt::XControl >  xCurr = xFormCtrl->getCurrentControl();
457*cdf0e10cSrcweir 	if(xCurr.is())
458*cdf0e10cSrcweir 	{
459*cdf0e10cSrcweir 		uno::Reference< awt::XControlModel >  xModel = xCurr->getModel();
460*cdf0e10cSrcweir 		uno::Reference< form::XBoundComponent >  xBound(xModel, UNO_QUERY);
461*cdf0e10cSrcweir 		if(xBound.is())
462*cdf0e10cSrcweir 			xBound->commit();
463*cdf0e10cSrcweir 	}
464*cdf0e10cSrcweir }
465*cdf0e10cSrcweir //-----------------------------------------------------------------------------
466*cdf0e10cSrcweir void BibGeneralPage::AddControlWithError( const OUString& rColumnName, const ::Point& rPos, const ::Size& rSize,
467*cdf0e10cSrcweir 								String& rErrorString, String aColumnUIName, const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray )
468*cdf0e10cSrcweir {
469*cdf0e10cSrcweir 	// adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 	sal_Int16									nIndex = -1;
472*cdf0e10cSrcweir 	uno::Reference< awt::XControlModel >	xTmp = AddXControl(rColumnName, rPos, rSize, sHelpId, nIndex );
473*cdf0e10cSrcweir 	if( xTmp.is() )
474*cdf0e10cSrcweir 	{
475*cdf0e10cSrcweir 		DBG_ASSERT( nIndexInFTArray < FIELD_COUNT, "*BibGeneralPage::AddControlWithError(): wrong array index!" );
476*cdf0e10cSrcweir 		DBG_ASSERT( nFT2CtrlMap[ nIndexInFTArray ] < 0, "+BibGeneralPage::AddControlWithError(): index already in use!" );
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir 		nFT2CtrlMap[ nIndexInFTArray ] = nIndex;
479*cdf0e10cSrcweir 	}
480*cdf0e10cSrcweir 	else
481*cdf0e10cSrcweir 	{
482*cdf0e10cSrcweir 		if( rErrorString.Len() )
483*cdf0e10cSrcweir 			rErrorString += '\n';
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 		rErrorString += MnemonicGenerator::EraseAllMnemonicChars( aColumnUIName );
486*cdf0e10cSrcweir 	}
487*cdf0e10cSrcweir }
488*cdf0e10cSrcweir //-----------------------------------------------------------------------------
489*cdf0e10cSrcweir uno::Reference< awt::XControlModel >  BibGeneralPage::AddXControl(
490*cdf0e10cSrcweir 		const String& rName,
491*cdf0e10cSrcweir 		::Point rPos, ::Size rSize, const rtl::OString& sHelpId, sal_Int16& rIndex )
492*cdf0e10cSrcweir {
493*cdf0e10cSrcweir 	uno::Reference< awt::XControlModel >  xCtrModel;
494*cdf0e10cSrcweir 	try
495*cdf0e10cSrcweir 	{
496*cdf0e10cSrcweir 		sal_Bool bTypeListBox = sTypeColumnName == rName;
497*cdf0e10cSrcweir 		xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox);
498*cdf0e10cSrcweir 		if ( xCtrModel.is() && xMgr.is())
499*cdf0e10cSrcweir 		{
500*cdf0e10cSrcweir 			uno::Reference< beans::XPropertySet >  xPropSet( xCtrModel, UNO_QUERY );
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 			if( xPropSet.is())
503*cdf0e10cSrcweir 			{
504*cdf0e10cSrcweir 				uno::Reference< beans::XPropertySetInfo >  xPropInfo = xPropSet->getPropertySetInfo();
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir 				uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") );
507*cdf0e10cSrcweir 				rtl::OUString aControlName;
508*cdf0e10cSrcweir 				aAny >>= aControlName;
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir 				rtl::OUString uProp(C2U("HelpURL"));
511*cdf0e10cSrcweir 				if(xPropInfo->hasPropertyByName(uProp))
512*cdf0e10cSrcweir 				{
513*cdf0e10cSrcweir 			        ::rtl::OUString sId = ::rtl::OUString::createFromAscii( INET_HID_SCHEME );
514*cdf0e10cSrcweir                     DBG_ASSERT( INetURLObject( rtl::OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" );
515*cdf0e10cSrcweir 			        sId += ::rtl::OUString( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 );
516*cdf0e10cSrcweir 			        xPropSet->setPropertyValue( uProp, makeAny( sId ) );
517*cdf0e10cSrcweir 				}
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 				if(bTypeListBox)
520*cdf0e10cSrcweir 				{
521*cdf0e10cSrcweir 					//uno::Reference< beans::XPropertySet >  xPropSet(xControl, UNO_QUERY);
522*cdf0e10cSrcweir 					aAny <<= (sal_Int16)1;
523*cdf0e10cSrcweir 					xPropSet->setPropertyValue(C2U("BoundColumn"), aAny);
524*cdf0e10cSrcweir 					ListSourceType eSet = ListSourceType_VALUELIST;
525*cdf0e10cSrcweir 					aAny.setValue( &eSet, ::getCppuType((const ListSourceType*)0) );
526*cdf0e10cSrcweir 					xPropSet->setPropertyValue(C2U("ListSourceType"), aAny);
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 					uno::Sequence<rtl::OUString> aListSource(TYPE_COUNT);
529*cdf0e10cSrcweir 					rtl::OUString* pListSourceArr = aListSource.getArray();
530*cdf0e10cSrcweir 					//pListSourceArr[0] = C2U("select TypeName, TypeIndex from TypeNms");
531*cdf0e10cSrcweir 					for(sal_uInt16 i = 0; i < TYPE_COUNT; i++)
532*cdf0e10cSrcweir 						pListSourceArr[i] = String::CreateFromInt32(i);
533*cdf0e10cSrcweir 					aAny.setValue(&aListSource, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir 					xPropSet->setPropertyValue(C2U("ListSource"), aAny);
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir 					uno::Sequence<rtl::OUString> aValues(TYPE_COUNT + 1);
538*cdf0e10cSrcweir 					rtl::OUString* pValuesArr = aValues.getArray();
539*cdf0e10cSrcweir 					for(sal_uInt16 j = 0; j < TYPE_COUNT; j++)
540*cdf0e10cSrcweir 						pValuesArr[j]  = aBibTypeArr[j];
541*cdf0e10cSrcweir 					// empty string if an invalid value no values is set
542*cdf0e10cSrcweir 					pValuesArr[TYPE_COUNT] = rtl::OUString();
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir 					aAny.setValue(&aValues, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir 					xPropSet->setPropertyValue(C2U("StringItemList"), aAny);
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir 					sal_Bool bTrue = sal_True;
549*cdf0e10cSrcweir 					aAny.setValue( &bTrue, ::getBooleanCppuType() );
550*cdf0e10cSrcweir 					xPropSet->setPropertyValue( C2U("Dropdown"), aAny );
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir 					aControlName = C2U("com.sun.star.form.control.ListBox");
553*cdf0e10cSrcweir 					xLBModel = Reference< form::XBoundComponent >(xCtrModel, UNO_QUERY);
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir 				}
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir 				uno::Reference< awt::XControl >  xControl(xMgr->createInstance( aControlName ), UNO_QUERY );
558*cdf0e10cSrcweir 				if ( xControl.is() )
559*cdf0e10cSrcweir 				{
560*cdf0e10cSrcweir 					xControl->setModel( xCtrModel);
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 					// Peer als Child zu dem FrameWindow
563*cdf0e10cSrcweir 					xCtrlContnr->addControl(rName, xControl);
564*cdf0e10cSrcweir 					uno::Reference< awt::XWindow >	xCtrWin(xControl, UNO_QUERY );
565*cdf0e10cSrcweir 					xCtrWin->addFocusListener( this );
566*cdf0e10cSrcweir 					rIndex = -1;	// -> implies, that not found
567*cdf0e10cSrcweir 					for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
568*cdf0e10cSrcweir 						if(!aControls[i].is())
569*cdf0e10cSrcweir 						{
570*cdf0e10cSrcweir 							aControls[i] = xCtrWin;
571*cdf0e10cSrcweir 							rIndex = sal_Int16( i );
572*cdf0e10cSrcweir 							break;
573*cdf0e10cSrcweir 						}
574*cdf0e10cSrcweir 					xCtrWin->setVisible( sal_True );
575*cdf0e10cSrcweir 					xControl->setDesignMode( sal_True );
576*cdf0e10cSrcweir 						// initially switch on the desing mode - switch it off _after_ loading the form
577*cdf0e10cSrcweir 						// 17.10.2001 - 93107 - frank.schoenheit@sun.com
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir 					xCtrWin->setPosSize(rPos.X(), rPos.Y(), rSize.Width(),
580*cdf0e10cSrcweir 						rSize.Height(), awt::PosSize::POSSIZE);
581*cdf0e10cSrcweir 				}
582*cdf0e10cSrcweir 			}
583*cdf0e10cSrcweir 		}
584*cdf0e10cSrcweir 	}
585*cdf0e10cSrcweir 	catch(Exception& rEx)
586*cdf0e10cSrcweir 	{
587*cdf0e10cSrcweir 		(void) rEx;	// make compiler happy
588*cdf0e10cSrcweir         DBG_ERROR("BibGeneralPage::AddXControl: something went wrong !");
589*cdf0e10cSrcweir 	}
590*cdf0e10cSrcweir 	return xCtrModel;
591*cdf0e10cSrcweir }
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir void BibGeneralPage::AdjustScrollbars()
594*cdf0e10cSrcweir {
595*cdf0e10cSrcweir 	long nVertScrollWidth = aVertScroll.GetSizePixel().Width();
596*cdf0e10cSrcweir 	long nHoriScrollHeight = aHoriScroll.GetSizePixel().Height();
597*cdf0e10cSrcweir 	::Size aOutSize(GetOutputSizePixel());
598*cdf0e10cSrcweir 	sal_Bool bHoriVisible = aOutSize.Width() <= aStdSize.Width();
599*cdf0e10cSrcweir 	sal_Bool bVertVisible = (aOutSize.Height()-(bHoriVisible ? nHoriScrollHeight : 0)) <= (aStdSize.Height());
600*cdf0e10cSrcweir 	aHoriScroll.Show(bHoriVisible);
601*cdf0e10cSrcweir 	aVertScroll.Show(bVertVisible);
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir 	if(bHoriVisible)
604*cdf0e10cSrcweir 	{
605*cdf0e10cSrcweir 		::Size aHoriSize(aOutSize.Width() - (bVertVisible ? nVertScrollWidth : 0),
606*cdf0e10cSrcweir 						nHoriScrollHeight);
607*cdf0e10cSrcweir 		aHoriScroll.SetSizePixel(aHoriSize);
608*cdf0e10cSrcweir 		aHoriScroll.SetRange( Range(0, aStdSize.Width()));
609*cdf0e10cSrcweir 		aHoriScroll.SetVisibleSize( aHoriSize.Width()  - (bVertVisible ? nVertScrollWidth : 0));
610*cdf0e10cSrcweir 	}
611*cdf0e10cSrcweir 	if(bVertVisible)
612*cdf0e10cSrcweir 	{
613*cdf0e10cSrcweir 		::Size aVertSize(nHoriScrollHeight, aOutSize.Height() -
614*cdf0e10cSrcweir 											(bHoriVisible ? nHoriScrollHeight : 0));
615*cdf0e10cSrcweir 		aVertScroll.SetSizePixel(aVertSize);
616*cdf0e10cSrcweir 		aVertScroll.SetRange( Range(0, aStdSize.Height()));
617*cdf0e10cSrcweir 		aVertScroll.SetVisibleSize( aVertSize.Height() );
618*cdf0e10cSrcweir 	}
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir 	::Size aSize(8, 8);
621*cdf0e10cSrcweir 	aSize = LogicToPixel(aSize, MapMode(MAP_APPFONT));
622*cdf0e10cSrcweir 	::Size aScrollSize(aOutSize.Width() - aSize.Height(), aSize.Height());
623*cdf0e10cSrcweir 	::Point aScrollPos(0, aOutSize.Height() - aSize.Height());
624*cdf0e10cSrcweir 	aHoriScroll.SetPosSizePixel(aScrollPos, aScrollSize);
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 	aScrollPos.X() = aOutSize.Width() - aSize.Width();
627*cdf0e10cSrcweir 	aScrollPos.Y() = 0;
628*cdf0e10cSrcweir 	aScrollSize.Width() = aSize.Width();
629*cdf0e10cSrcweir 	aScrollSize.Height() = aOutSize.Height() - aSize.Height();
630*cdf0e10cSrcweir 	aVertScroll.SetPosSizePixel(aScrollPos, aScrollSize);
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir 	::Size aControlParentWinSz(aOutSize);
633*cdf0e10cSrcweir 	if(bHoriVisible)
634*cdf0e10cSrcweir 		aControlParentWinSz.Height() -=  aSize.Height();
635*cdf0e10cSrcweir 	if(bVertVisible)
636*cdf0e10cSrcweir 		aControlParentWinSz.Width() -=	aSize.Width();
637*cdf0e10cSrcweir 	aControlParentWin.SetSizePixel(aControlParentWinSz);
638*cdf0e10cSrcweir }
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir void BibGeneralPage::Resize()
641*cdf0e10cSrcweir {
642*cdf0e10cSrcweir 	AdjustScrollbars();
643*cdf0e10cSrcweir 	ScrollHdl(&aVertScroll);
644*cdf0e10cSrcweir 	ScrollHdl(&aHoriScroll);
645*cdf0e10cSrcweir 	Window::Resize();
646*cdf0e10cSrcweir }
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir void BibGeneralPage::InitFixedTexts( void )
649*cdf0e10cSrcweir {
650*cdf0e10cSrcweir 	String		aFixedStrings[ FIELD_COUNT ] =
651*cdf0e10cSrcweir 	{
652*cdf0e10cSrcweir 		String( BibResId( ST_IDENTIFIER		) ),
653*cdf0e10cSrcweir 		String( BibResId( ST_AUTHTYPE		) ),
654*cdf0e10cSrcweir 		String( BibResId( ST_AUTHOR			) ),
655*cdf0e10cSrcweir 		String( BibResId( ST_TITLE			) ),
656*cdf0e10cSrcweir 		String( BibResId( ST_MONTH			) ),
657*cdf0e10cSrcweir 		String( BibResId( ST_YEAR 			) ),
658*cdf0e10cSrcweir 		String( BibResId( ST_ISBN 			) ),
659*cdf0e10cSrcweir 		String( BibResId( ST_BOOKTITLE		) ),
660*cdf0e10cSrcweir 		String( BibResId( ST_CHAPTER		) ),
661*cdf0e10cSrcweir 		String( BibResId( ST_EDITION		) ),
662*cdf0e10cSrcweir 		String( BibResId( ST_EDITOR			) ),
663*cdf0e10cSrcweir 		String( BibResId( ST_HOWPUBLISHED	) ),
664*cdf0e10cSrcweir 		String( BibResId( ST_INSTITUTION	) ),
665*cdf0e10cSrcweir 		String( BibResId( ST_JOURNAL		) ),
666*cdf0e10cSrcweir 		String( BibResId( ST_NOTE 			) ),
667*cdf0e10cSrcweir 		String( BibResId( ST_ANNOTE			) ),
668*cdf0e10cSrcweir 		String( BibResId( ST_NUMBER			) ),
669*cdf0e10cSrcweir 		String( BibResId( ST_ORGANIZATION	) ),
670*cdf0e10cSrcweir 		String( BibResId( ST_PAGE 			) ),
671*cdf0e10cSrcweir 		String( BibResId( ST_PUBLISHER		) ),
672*cdf0e10cSrcweir 		String( BibResId( ST_ADDRESS		) ),
673*cdf0e10cSrcweir 		String( BibResId( ST_SCHOOL			) ),
674*cdf0e10cSrcweir 		String( BibResId( ST_SERIES			) ),
675*cdf0e10cSrcweir 		String( BibResId( ST_REPORT			) ),
676*cdf0e10cSrcweir 		String( BibResId( ST_VOLUME			) ),
677*cdf0e10cSrcweir 		String( BibResId( ST_URL			) ),
678*cdf0e10cSrcweir 		String( BibResId( ST_CUSTOM1		) ),
679*cdf0e10cSrcweir 		String( BibResId( ST_CUSTOM2		) ),
680*cdf0e10cSrcweir 		String( BibResId( ST_CUSTOM3		) ),
681*cdf0e10cSrcweir 		String( BibResId( ST_CUSTOM4		) ),
682*cdf0e10cSrcweir 		String( BibResId( ST_CUSTOM5		) )
683*cdf0e10cSrcweir 	};
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 	aFixedTexts[0] = &aIdentifierFT;
686*cdf0e10cSrcweir 	aFixedTexts[1] = &aAuthTypeFT;
687*cdf0e10cSrcweir 	aFixedTexts[2] = &aAuthorFT;
688*cdf0e10cSrcweir 	aFixedTexts[3] = &aTitleFT;
689*cdf0e10cSrcweir 	aFixedTexts[4] = &aMonthFT;
690*cdf0e10cSrcweir 	aFixedTexts[5] = &aYearFT;
691*cdf0e10cSrcweir 	aFixedTexts[6] = &aISBNFT;
692*cdf0e10cSrcweir 	aFixedTexts[7] = &aBooktitleFT;
693*cdf0e10cSrcweir 	aFixedTexts[8] = &aChapterFT;
694*cdf0e10cSrcweir 	aFixedTexts[9] = &aEditionFT;
695*cdf0e10cSrcweir 	aFixedTexts[10] = &aEditorFT;
696*cdf0e10cSrcweir 	aFixedTexts[11] = &aHowpublishedFT;
697*cdf0e10cSrcweir 	aFixedTexts[12] = &aInstitutionFT;
698*cdf0e10cSrcweir 	aFixedTexts[13] = &aJournalFT;
699*cdf0e10cSrcweir 	aFixedTexts[14] = &aNoteFT;
700*cdf0e10cSrcweir 	aFixedTexts[15] = &aAnnoteFT;
701*cdf0e10cSrcweir 	aFixedTexts[16] = &aNumberFT;
702*cdf0e10cSrcweir 	aFixedTexts[17] = &aOrganizationsFT;
703*cdf0e10cSrcweir 	aFixedTexts[18] = &aPagesFT;
704*cdf0e10cSrcweir 	aFixedTexts[19] = &aPublisherFT;
705*cdf0e10cSrcweir 	aFixedTexts[20] = &aAddressFT;
706*cdf0e10cSrcweir 	aFixedTexts[21] = &aSchoolFT;
707*cdf0e10cSrcweir 	aFixedTexts[22] = &aSeriesFT;
708*cdf0e10cSrcweir 	aFixedTexts[23] = &aReportTypeFT;
709*cdf0e10cSrcweir 	aFixedTexts[24] = &aVolumeFT;
710*cdf0e10cSrcweir 	aFixedTexts[25] = &aURLFT;
711*cdf0e10cSrcweir 	aFixedTexts[26] = &aCustom1FT;
712*cdf0e10cSrcweir 	aFixedTexts[27] = &aCustom2FT;
713*cdf0e10cSrcweir 	aFixedTexts[28] = &aCustom3FT;
714*cdf0e10cSrcweir 	aFixedTexts[29] = &aCustom4FT;
715*cdf0e10cSrcweir 	aFixedTexts[30] = &aCustom5FT;
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir 	int					i;
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 	MnemonicGenerator	aMnemonicGenerator;
720*cdf0e10cSrcweir 	// init mnemonics, first register all strings
721*cdf0e10cSrcweir 	for( i = 0 ; i < FIELD_COUNT ; ++i )
722*cdf0e10cSrcweir 		aMnemonicGenerator.RegisterMnemonic( aFixedStrings[ i ] );
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 	// ... then get all strings
725*cdf0e10cSrcweir 	for( i = 0 ; i < FIELD_COUNT ; ++i )
726*cdf0e10cSrcweir 		aMnemonicGenerator.CreateMnemonic( aFixedStrings[ i ] );
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir 	// set texts
729*cdf0e10cSrcweir 	for( i = 0 ; i < FIELD_COUNT ; ++i )
730*cdf0e10cSrcweir 		aFixedTexts[ i ]->SetText( aFixedStrings[ i ] );
731*cdf0e10cSrcweir }
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir IMPL_LINK(BibGeneralPage, ScrollHdl, ScrollBar*, pScroll)
734*cdf0e10cSrcweir {
735*cdf0e10cSrcweir 	sal_Bool bVertical = &aVertScroll == pScroll;
736*cdf0e10cSrcweir 	long nOffset = 0;
737*cdf0e10cSrcweir 	long nCurrentOffset = 0;
738*cdf0e10cSrcweir 	if(bVertical)
739*cdf0e10cSrcweir 		nCurrentOffset = aFixedTexts[0]->GetPosPixel().Y() - aBasePos.Y();
740*cdf0e10cSrcweir 	else
741*cdf0e10cSrcweir 		nCurrentOffset = aFixedTexts[0]->GetPosPixel().X() - aBasePos.X();
742*cdf0e10cSrcweir 	nOffset = pScroll->IsVisible() ? pScroll->GetThumbPos() + nCurrentOffset : nCurrentOffset;;
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < FIELD_COUNT; i++)
745*cdf0e10cSrcweir 	{
746*cdf0e10cSrcweir 		::Point aPos = aFixedTexts[i]->GetPosPixel();
747*cdf0e10cSrcweir 		if(bVertical)
748*cdf0e10cSrcweir 			aPos.Y() -= nOffset;
749*cdf0e10cSrcweir 		else
750*cdf0e10cSrcweir 			aPos.X() -= nOffset;
751*cdf0e10cSrcweir 		aFixedTexts[i]->SetPosPixel(aPos);
752*cdf0e10cSrcweir 		if(aControls[i].is())
753*cdf0e10cSrcweir 		{
754*cdf0e10cSrcweir 			awt::Rectangle aRect = aControls[i]->getPosSize();
755*cdf0e10cSrcweir 			long nX = aRect.X;
756*cdf0e10cSrcweir 			long nY = aRect.Y;
757*cdf0e10cSrcweir 			if(bVertical)
758*cdf0e10cSrcweir 				nY -= nOffset;
759*cdf0e10cSrcweir 			else
760*cdf0e10cSrcweir 				nX -= nOffset;
761*cdf0e10cSrcweir 			aControls[i]->setPosSize(nX, nY, 0, 0, awt::PosSize::POS);
762*cdf0e10cSrcweir 		}
763*cdf0e10cSrcweir 	}
764*cdf0e10cSrcweir 	return 0;
765*cdf0e10cSrcweir }
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) throw( uno::RuntimeException )
768*cdf0e10cSrcweir {
769*cdf0e10cSrcweir 	Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY );
770*cdf0e10cSrcweir 	if(xCtrWin.is())
771*cdf0e10cSrcweir 	{
772*cdf0e10cSrcweir 		::Size aOutSize = aControlParentWin.GetOutputSizePixel();
773*cdf0e10cSrcweir 		awt::Rectangle aRect = xCtrWin->getPosSize();
774*cdf0e10cSrcweir 		long nX = aRect.X;
775*cdf0e10cSrcweir 		if(nX < 0)
776*cdf0e10cSrcweir 		{
777*cdf0e10cSrcweir 			// left of the visible area
778*cdf0e10cSrcweir 			aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX);
779*cdf0e10cSrcweir 			ScrollHdl(&aHoriScroll);
780*cdf0e10cSrcweir 		}
781*cdf0e10cSrcweir 		else if(nX > aOutSize.Width())
782*cdf0e10cSrcweir 		{
783*cdf0e10cSrcweir 			// right of the visible area
784*cdf0e10cSrcweir 			aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX - aOutSize.Width() + aFixedTexts[0]->GetSizePixel().Width());
785*cdf0e10cSrcweir 			ScrollHdl(&aHoriScroll);
786*cdf0e10cSrcweir 		}
787*cdf0e10cSrcweir 		long nY = aRect.Y;
788*cdf0e10cSrcweir 		if(nY < 0)
789*cdf0e10cSrcweir 		{
790*cdf0e10cSrcweir 			// below the visible area
791*cdf0e10cSrcweir 			aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY);
792*cdf0e10cSrcweir 			ScrollHdl(&aVertScroll);
793*cdf0e10cSrcweir 		}
794*cdf0e10cSrcweir 		else if(nY > aOutSize.Height())
795*cdf0e10cSrcweir 		{
796*cdf0e10cSrcweir 			// over the visible area
797*cdf0e10cSrcweir 			aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY - aOutSize.Height()+ aFixedTexts[0]->GetSizePixel().Height());
798*cdf0e10cSrcweir 			ScrollHdl(&aVertScroll);
799*cdf0e10cSrcweir 		}
800*cdf0e10cSrcweir 	}
801*cdf0e10cSrcweir }
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeException )
804*cdf0e10cSrcweir {
805*cdf0e10cSrcweir 	CommitActiveControl();
806*cdf0e10cSrcweir }
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir void BibGeneralPage::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException )
809*cdf0e10cSrcweir {
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir void BibGeneralPage::GetFocus()
813*cdf0e10cSrcweir {
814*cdf0e10cSrcweir 	Reference< awt::XWindow >*	pxControl = aControls;
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 	for( int i = FIELD_COUNT ; i ; --i, ++pxControl )
817*cdf0e10cSrcweir 	{
818*cdf0e10cSrcweir 		if( pxControl->is() )
819*cdf0e10cSrcweir 		{
820*cdf0e10cSrcweir 			( *pxControl )->setFocus();
821*cdf0e10cSrcweir 			return;
822*cdf0e10cSrcweir 		}
823*cdf0e10cSrcweir 	}
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 	// fallback
826*cdf0e10cSrcweir 	aControlParentWin.GrabFocus();
827*cdf0e10cSrcweir }
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent )
830*cdf0e10cSrcweir {
831*cdf0e10cSrcweir 	DBG_ASSERT( KEY_MOD2 == rKeyEvent.GetKeyCode().GetModifier(), "+BibGeneralPage::HandleShortCutKey(): this is not for me!" );
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir     const vcl::I18nHelper&		rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
834*cdf0e10cSrcweir 	const xub_Unicode			c = rKeyEvent.GetCharCode();
835*cdf0e10cSrcweir 	sal_Bool						bHandled = sal_False;
836*cdf0e10cSrcweir 
837*cdf0e10cSrcweir 	sal_Int16					i;
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir 	typedef std::vector< sal_Int16 >	sal_Int16_vector;
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir 	sal_Int16_vector::size_type	nFocused = 0xFFFF;	// index of focused in vector, no one focused initial
842*cdf0e10cSrcweir 	DBG_ASSERT( nFocused > 0, "*BibGeneralPage::HandleShortCutKey(): size_type works not as expected!" );
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir 	sal_Int16_vector			aMatchList;
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir 	for( i = 0 ; i < FIELD_COUNT ; ++i )
847*cdf0e10cSrcweir 	{
848*cdf0e10cSrcweir 		if( rI18nHelper.MatchMnemonic( aFixedTexts[ i ]->GetText(), c ) )
849*cdf0e10cSrcweir 		{
850*cdf0e10cSrcweir 			bHandled = sal_True;
851*cdf0e10cSrcweir 			sal_Int16			nCtrlIndex = nFT2CtrlMap[ i ];
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir 			if( nCtrlIndex >= 0 )
854*cdf0e10cSrcweir 			{	// store index of control
855*cdf0e10cSrcweir 				DBG_ASSERT( aControls[ nCtrlIndex ].is(), "-BibGeneralPage::HandleShortCutKey(): valid index and no control?" );
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir 				uno::Reference< awt::XControl >  xControl( aControls[ nCtrlIndex ], UNO_QUERY );
858*cdf0e10cSrcweir 				DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control wich is not a control!" );
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 				Window*			pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() );
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir 				if( pWindow )
863*cdf0e10cSrcweir 				{
864*cdf0e10cSrcweir 					aMatchList.push_back( nCtrlIndex );
865*cdf0e10cSrcweir 					if( pWindow->HasChildPathFocus() )
866*cdf0e10cSrcweir 					{	// save focused control
867*cdf0e10cSrcweir 						DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" );
868*cdf0e10cSrcweir 						DBG_ASSERT( aMatchList.size() > 0, "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" );
869*cdf0e10cSrcweir 						nFocused = aMatchList.size() - 1;
870*cdf0e10cSrcweir 					}
871*cdf0e10cSrcweir 				}
872*cdf0e10cSrcweir 			}
873*cdf0e10cSrcweir 		}
874*cdf0e10cSrcweir 	}
875*cdf0e10cSrcweir 
876*cdf0e10cSrcweir 	if( bHandled )
877*cdf0e10cSrcweir 	{
878*cdf0e10cSrcweir 		DBG_ASSERT( aMatchList.size() > 0, "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." );
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 		if( nFocused >= ( aMatchList.size() - 1 ) )
881*cdf0e10cSrcweir 			// >=... includes 0xFFFF
882*cdf0e10cSrcweir 			// no one or last focused, take first
883*cdf0e10cSrcweir 			nFocused = 0;
884*cdf0e10cSrcweir 		else
885*cdf0e10cSrcweir 			// take next one
886*cdf0e10cSrcweir 			nFocused++;
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir 		aControls[ aMatchList[ nFocused ] ]->setFocus();
889*cdf0e10cSrcweir 	}
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir 	return bHandled;
892*cdf0e10cSrcweir }
893