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