xref: /aoo41x/main/sw/source/ui/index/swuiidxmrk.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
27cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "swuiidxmrk.hxx"
31cdf0e10cSrcweir #include <hintids.hxx>
32cdf0e10cSrcweir #include <helpid.h>
33cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORT
34cdf0e10cSrcweir #include <svl/svstdarr.hxx>
35cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
38cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
39cdf0e10cSrcweir #include <com/sun/star/util/SearchOptions.hpp>
40cdf0e10cSrcweir #include <com/sun/star/util/SearchFlags.hpp>
41cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
42cdf0e10cSrcweir #include <svl/stritem.hxx>
43cdf0e10cSrcweir #include <vcl/msgbox.hxx>
44cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
45cdf0e10cSrcweir #include <svl/eitem.hxx>
46cdf0e10cSrcweir #include <svtools/txtcmp.hxx>
47cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
48cdf0e10cSrcweir #include <svl/itemset.hxx>
49cdf0e10cSrcweir #include <editeng/langitem.hxx>
50cdf0e10cSrcweir #include "editeng/unolingu.hxx"
51cdf0e10cSrcweir #include <swtypes.hxx>
52cdf0e10cSrcweir #include <idxmrk.hxx>
53cdf0e10cSrcweir #include <txttxmrk.hxx>
54cdf0e10cSrcweir #include <wrtsh.hxx>
55cdf0e10cSrcweir #include <view.hxx>
56cdf0e10cSrcweir #include <multmrk.hxx>
57cdf0e10cSrcweir #include <swundo.hxx>               	// fuer Undo-Ids
58cdf0e10cSrcweir #include <cmdid.h>
59cdf0e10cSrcweir #include <index.hrc>
60cdf0e10cSrcweir #include <idxmrk.hrc>
61cdf0e10cSrcweir #include <swmodule.hxx>
62cdf0e10cSrcweir #include <fldmgr.hxx>
63cdf0e10cSrcweir #include <fldbas.hxx>
64cdf0e10cSrcweir #include <utlui.hrc>
65cdf0e10cSrcweir #include <swcont.hxx>
66cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
67cdf0e10cSrcweir #include <ndtxt.hxx>
68cdf0e10cSrcweir #include <breakit.hxx>
69cdf0e10cSrcweir #include <SwRewriter.hxx>
70cdf0e10cSrcweir 
71cdf0e10cSrcweir #include "swuiidxmrk.hxx"
72cdf0e10cSrcweir #include <unomid.h>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir #define POS_CONTENT 0
76cdf0e10cSrcweir #define POS_INDEX   1
77cdf0e10cSrcweir #define POS_USER    2
78cdf0e10cSrcweir 
79cdf0e10cSrcweir static sal_uInt16 nTypePos = 1; // TOX_INDEX as standard
80cdf0e10cSrcweir static sal_uInt16 nKey1Pos = USHRT_MAX;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir static sal_uInt16 nKey2Pos = USHRT_MAX;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir using namespace com::sun::star;
85cdf0e10cSrcweir using namespace com::sun::star::i18n;
86cdf0e10cSrcweir using namespace com::sun::star::lang;
87cdf0e10cSrcweir using namespace com::sun::star::util;
88cdf0e10cSrcweir using namespace com::sun::star::i18n;
89cdf0e10cSrcweir using ::rtl::OUString;
90cdf0e10cSrcweir using namespace ::comphelper;
91cdf0e10cSrcweir using namespace ::com::sun::star;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir /*--------------------------------------------------------------------
94cdf0e10cSrcweir 	 Beschreibung:	Dialog zum Einfuegen einer Verzeichnismarkierung
95cdf0e10cSrcweir  --------------------------------------------------------------------*/
SwIndexMarkDlg(Window * pParent,sal_Bool bNewDlg,const ResId & rResId,sal_Int32 _nOptionsId,SwWrtShell & rWrtShell)96cdf0e10cSrcweir SwIndexMarkDlg::SwIndexMarkDlg(Window *pParent,
97cdf0e10cSrcweir 							   sal_Bool bNewDlg,
98cdf0e10cSrcweir 							   const ResId& rResId,
99cdf0e10cSrcweir                                sal_Int32 _nOptionsId, SwWrtShell& rWrtShell ) :
100cdf0e10cSrcweir 	  Window(pParent, rResId),
101cdf0e10cSrcweir     aIndexFL(this,  SW_RES(FL_INDEX )),
102cdf0e10cSrcweir     aTypeFT (this,  SW_RES(LBL_INDEX    )),
103cdf0e10cSrcweir     aTypeDCB(this,  SW_RES(DCB_INDEX    )),
104cdf0e10cSrcweir 	aNewBT(this, 	SW_RES(BT_NEW 	)),
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     aEntryFT(this,  SW_RES(LBL_ENTRY    )),
107cdf0e10cSrcweir     aEntryED(this,  SW_RES(SL_ENTRY )),
108cdf0e10cSrcweir     aPhoneticFT0(this,  SW_RES(FT_PHONETIC_1 )),
109cdf0e10cSrcweir     aPhoneticED0(this,  SW_RES(ED_PHONETIC_1 )),
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     aKeyFT(this,    SW_RES(LBL_KEY  )),
112cdf0e10cSrcweir     aKeyDCB(this,   SW_RES(DCB_KEY  )),
113cdf0e10cSrcweir     aPhoneticFT1(this,  SW_RES(FT_PHONETIC_2 )),
114cdf0e10cSrcweir     aPhoneticED1(this,  SW_RES(ED_PHONETIC_2 )),
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     aKey2FT(this,   SW_RES(LBL_KEY2 )),
117cdf0e10cSrcweir     aKey2DCB(this,  SW_RES(DCB_KEY2 )),
118cdf0e10cSrcweir     aPhoneticFT2(this,  SW_RES(FT_PHONETIC_3 )),
119cdf0e10cSrcweir     aPhoneticED2(this,  SW_RES(ED_PHONETIC_3 )),
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     aLevelFT(this,  SW_RES(LBL_LEVEL    )),
122cdf0e10cSrcweir     aLevelED(this,  SW_RES(SL_LEVEL )),
123cdf0e10cSrcweir     aMainEntryCB(this, SW_RES(CB_MAIN_ENTRY )),
124cdf0e10cSrcweir     aApplyToAllCB(this,SW_RES(CB_APPLY_TO_ALL)),
125cdf0e10cSrcweir     aSearchCaseSensitiveCB(this,    SW_RES(CB_CASESENSITIVE )),
126cdf0e10cSrcweir     aSearchCaseWordOnlyCB(this,     SW_RES(CB_WORDONLY      )),
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     aOKBT(this,     SW_RES(BT_OK    )),
130cdf0e10cSrcweir     aCancelBT(this, SW_RES(BT_CANCEL )),
131cdf0e10cSrcweir     aHelpBT(this,   SW_RES(BT_HELP   )),
132cdf0e10cSrcweir     aDelBT(this,    SW_RES(BT_DEL   )),
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     aPrevSameBT(this,SW_RES(BT_PREVSAME)),
135cdf0e10cSrcweir     aNextSameBT(this,SW_RES(BT_NXTSAME)),
136cdf0e10cSrcweir     aPrevBT(this,   SW_RES(BT_PREV  )),
137cdf0e10cSrcweir     aNextBT(this,   SW_RES(BT_NXT   )),
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     nOptionsId( _nOptionsId ),
140cdf0e10cSrcweir     bDel(sal_False),
141cdf0e10cSrcweir     bNewMark(bNewDlg),
142cdf0e10cSrcweir     bSelected(sal_False),
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     bPhoneticED0_ChangedByUser(sal_False),
145cdf0e10cSrcweir 	bPhoneticED1_ChangedByUser(sal_False),
146cdf0e10cSrcweir 	bPhoneticED2_ChangedByUser(sal_False),
147cdf0e10cSrcweir     nLangForPhoneticReading(2052),
148cdf0e10cSrcweir     bIsPhoneticReadingEnabled(sal_False),
149cdf0e10cSrcweir     xExtendedIndexEntrySupplier(NULL),
150cdf0e10cSrcweir     pTOXMgr(0),
151cdf0e10cSrcweir     pSh(&rWrtShell)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir 	aNewBT.SetAccessibleRelationMemberOf(&aIndexFL);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	if( SvtCJKOptions().IsCJKFontEnabled() )
156cdf0e10cSrcweir 	{
157cdf0e10cSrcweir 		uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 		xExtendedIndexEntrySupplier =
160cdf0e10cSrcweir             uno::Reference< i18n::XExtendedIndexEntrySupplier > (
161cdf0e10cSrcweir 					xMSF->createInstance( C2U("com.sun.star.i18n.IndexEntrySupplier") ),
162cdf0e10cSrcweir 																		uno::UNO_QUERY );
163cdf0e10cSrcweir 	}
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	SetStyle(GetStyle()|WB_DIALOGCONTROL);
166cdf0e10cSrcweir 	FreeResource();
167cdf0e10cSrcweir 	aOKBT			.SetHelpId(HID_INSERT_IDX_MRK_OK   		);
168cdf0e10cSrcweir 	aCancelBT		.SetHelpId(HID_INSERT_IDX_MRK_CLOSE		);
169cdf0e10cSrcweir 	aDelBT      	.SetHelpId(HID_INSERT_IDX_MRK_DELETE	);
170cdf0e10cSrcweir 	aNewBT      	.SetHelpId(HID_INSERT_IDX_MRK_NEW		);
171cdf0e10cSrcweir 	aPrevBT     	.SetHelpId(HID_INSERT_IDX_MRK_PREV		);
172cdf0e10cSrcweir 	aPrevSameBT 	.SetHelpId(HID_INSERT_IDX_MRK_PREV_SAME	);
173cdf0e10cSrcweir 	aNextBT     	.SetHelpId(HID_INSERT_IDX_MRK_NEXT		);
174cdf0e10cSrcweir 	aNextSameBT 	.SetHelpId(HID_INSERT_IDX_MRK_NEXT_SAME	);
175cdf0e10cSrcweir 	aTypeDCB    	.SetHelpId(HID_INSERT_IDX_MRK_TYPE		);
176cdf0e10cSrcweir 	aEntryED    	.SetHelpId(HID_INSERT_IDX_MRK_ENTRY		);
177cdf0e10cSrcweir 	aKeyDCB     	.SetHelpId(HID_INSERT_IDX_MRK_PRIM_KEY	);
178cdf0e10cSrcweir 	aKey2DCB    	.SetHelpId(HID_INSERT_IDX_MRK_SEC_KEY	);
179cdf0e10cSrcweir 	aLevelED    	.SetHelpId(HID_INSERT_IDX_MRK_LEVEL		);
180cdf0e10cSrcweir 	aMainEntryCB	.SetHelpId(HID_INSERT_IDX_MRK_MAIN_ENTRY);
181cdf0e10cSrcweir 	aApplyToAllCB	.SetHelpId(HID_INSERT_IDX_MRK_APPLY_ALL	);
182cdf0e10cSrcweir 	aPhoneticED0	.SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
183cdf0e10cSrcweir 	aPhoneticED1	.SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
184cdf0e10cSrcweir 	aPhoneticED2	.SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	aSearchCaseSensitiveCB.SetHelpId(	HID_INSERT_IDX_MRK_SRCH_CASESENSITIVE	);
187cdf0e10cSrcweir 	aSearchCaseWordOnlyCB.SetHelpId(	HID_INSERT_IDX_MRK_SRCH_WORDONLY		);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	GetParent()->SetText( SW_RESSTR( bNewMark ? STR_IDXMRK_INSERT : STR_IDXMRK_EDIT));
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	aDelBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 		DelHdl));
193cdf0e10cSrcweir 	aPrevBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 		PrevHdl));
194cdf0e10cSrcweir 	aPrevSameBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 	PrevSameHdl));
195cdf0e10cSrcweir 	aNextBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 		NextHdl));
196cdf0e10cSrcweir 	aNextSameBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 	NextSameHdl));
197cdf0e10cSrcweir 	//aTypeDCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, 	ModifyHdl));
198cdf0e10cSrcweir 	aTypeDCB.SetSelectHdl(LINK(this,SwIndexMarkDlg, 	ModifyHdl));
199cdf0e10cSrcweir 	aKeyDCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, 		KeyDCBModifyHdl));
200cdf0e10cSrcweir 	aKey2DCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, 	KeyDCBModifyHdl));
201cdf0e10cSrcweir 	aOKBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 		InsertHdl));
202cdf0e10cSrcweir 	aCancelBT.SetClickHdl(LINK(this,SwIndexMarkDlg, 	CloseHdl));
203cdf0e10cSrcweir 	aEntryED.SetModifyHdl(LINK(this,SwIndexMarkDlg, 	ModifyHdl));
204cdf0e10cSrcweir 	aNewBT.SetClickHdl(LINK(this, SwIndexMarkDlg,       NewUserIdxHdl));
205cdf0e10cSrcweir 	aApplyToAllCB.SetClickHdl(LINK(this, SwIndexMarkDlg, SearchTypeHdl));
206cdf0e10cSrcweir 	aPhoneticED0.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
207cdf0e10cSrcweir 	aPhoneticED1.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
208cdf0e10cSrcweir 	aPhoneticED2.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	if(bNewMark)
211cdf0e10cSrcweir 	{
212cdf0e10cSrcweir 		aDelBT.Hide();
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		{
215cdf0e10cSrcweir 			ImageList aTempList( SW_RES( IMG_NAVI_ENTRYBMPH ) );
216cdf0e10cSrcweir 			aNewBT.SetModeImage( aTempList.GetImage( SID_SW_START + CONTENT_TYPE_INDEX ), BMP_COLOR_HIGHCONTRAST );
217cdf0e10cSrcweir 		}
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 		{
220cdf0e10cSrcweir 			ImageList aTempList( SW_RES( IMG_NAVI_ENTRYBMP ) );
221cdf0e10cSrcweir 			aNewBT.SetModeImage( aTempList.GetImage( SID_SW_START + CONTENT_TYPE_INDEX ), BMP_COLOR_NORMAL );
222cdf0e10cSrcweir 		}
223cdf0e10cSrcweir 	}
224cdf0e10cSrcweir 	else
225cdf0e10cSrcweir 	{
226cdf0e10cSrcweir 		aNewBT.Hide();
227cdf0e10cSrcweir 		OKButton aTmp(this, WB_HIDE);
228cdf0e10cSrcweir 		aOKBT.SetText( aTmp.GetText() );
229cdf0e10cSrcweir 	}
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     aEntryED.GrabFocus();
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir /*--------------------------------------------------------------------
235cdf0e10cSrcweir 	 Beschreibung:	Controls neu initialisieren mit der aktuellen
236cdf0e10cSrcweir 					Markierung
237cdf0e10cSrcweir  --------------------------------------------------------------------*/
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 
InitControls()240cdf0e10cSrcweir void SwIndexMarkDlg::InitControls()
241cdf0e10cSrcweir {
242cdf0e10cSrcweir 	DBG_ASSERT(pSh && pTOXMgr, "Shell nicht da?");
243cdf0e10cSrcweir 	// Inhalts-Verzeichnis
244cdf0e10cSrcweir 	const SwTOXType* pType = pTOXMgr->GetTOXType(TOX_CONTENT, 0);
245cdf0e10cSrcweir 	ASSERT(pType, "Kein Verzeichnistyp !!");
246cdf0e10cSrcweir 	String sTmpTypeSelection;
247cdf0e10cSrcweir 	if(aTypeDCB.GetSelectEntryCount())
248cdf0e10cSrcweir 		sTmpTypeSelection = aTypeDCB.GetSelectEntry();
249cdf0e10cSrcweir 	aTypeDCB.Clear();
250cdf0e10cSrcweir 	aTypeDCB.InsertEntry(pType->GetTypeName());
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	// Stichwort-Verzeichnis
253cdf0e10cSrcweir 	pType = pTOXMgr->GetTOXType(TOX_INDEX, 0);
254cdf0e10cSrcweir 	ASSERT(pType, "Kein Verzeichnistyp !!");
255cdf0e10cSrcweir 	aTypeDCB.InsertEntry(pType->GetTypeName());
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	// Benutzerverzeichnisse
258cdf0e10cSrcweir 	sal_uInt16 nCount = pSh->GetTOXTypeCount(TOX_USER);
259cdf0e10cSrcweir 	sal_uInt16 i;
260cdf0e10cSrcweir 	for( i = 0; i < nCount; ++i )
261cdf0e10cSrcweir 		aTypeDCB.InsertEntry( pSh->GetTOXType(TOX_USER, i)->GetTypeName() );
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	// KeyWords Primary einlesen
264cdf0e10cSrcweir 	SvStringsSort aArr;
265cdf0e10cSrcweir 	nCount = pSh->GetTOIKeys( TOI_PRIMARY, aArr );
266cdf0e10cSrcweir 	for(i=0; i < nCount; ++i)
267cdf0e10cSrcweir 		aKeyDCB.InsertEntry( *aArr[ i ] );
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	// KeyWords Secondary einlesen
270cdf0e10cSrcweir 	nCount = pSh->GetTOIKeys( TOI_SECONDARY, aArr );
271cdf0e10cSrcweir 	for(i=0; i < nCount; ++i)
272cdf0e10cSrcweir 		aKey2DCB.InsertEntry( *aArr[ i ] );
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	UpdateLanguageDependenciesForPhoneticReading();
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	// Aktueller Eintrag
277cdf0e10cSrcweir 	const SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
278cdf0e10cSrcweir 	if( pMark && !bNewMark)
279cdf0e10cSrcweir 	{
280cdf0e10cSrcweir 		// Controls-Handling
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 		// nur wenn mehr als eins vorhanden
283cdf0e10cSrcweir 		// wenn gleich landet es auf dem gleichen Eintrag
284cdf0e10cSrcweir 		pSh->SttCrsrMove();
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 		const SwTOXMark* pMoveMark;
287cdf0e10cSrcweir 		sal_Bool bShow = sal_False;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_PRV );
290cdf0e10cSrcweir 		if( pMoveMark != pMark )
291cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_NXT ), bShow = sal_True;
292cdf0e10cSrcweir 		aPrevBT.Enable( pMoveMark != pMark );
293cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_NXT );
294cdf0e10cSrcweir 		if( pMoveMark != pMark )
295cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_PRV ), bShow = sal_True;
296cdf0e10cSrcweir 		aNextBT.Enable( pMoveMark != pMark );
297cdf0e10cSrcweir 		if( bShow )
298cdf0e10cSrcweir 		{
299cdf0e10cSrcweir 			aPrevBT.Show();
300cdf0e10cSrcweir 			aNextBT.Show();
301cdf0e10cSrcweir 			bShow = sal_False;
302cdf0e10cSrcweir 		}
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
305cdf0e10cSrcweir 		if( pMoveMark != pMark )
306cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT ), bShow = sal_True;
307cdf0e10cSrcweir 		aPrevSameBT.Enable( pMoveMark != pMark );
308cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
309cdf0e10cSrcweir 		if( pMoveMark != pMark )
310cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV ), bShow = sal_True;
311cdf0e10cSrcweir 		aNextSameBT.Enable( pMoveMark != pMark );
312cdf0e10cSrcweir 		if( bShow )
313cdf0e10cSrcweir 		{
314cdf0e10cSrcweir 			aNextSameBT.Show();
315cdf0e10cSrcweir 			aPrevSameBT.Show();
316cdf0e10cSrcweir 		}
317cdf0e10cSrcweir 		pSh->EndCrsrMove();
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 		aTypeFT.Show();
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 		aTypeDCB.Enable(sal_False);
322cdf0e10cSrcweir 		aTypeFT.Enable(sal_False);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 		UpdateDialog();
325cdf0e10cSrcweir 	}
326cdf0e10cSrcweir 	else
327cdf0e10cSrcweir 	{ 	// aktuelle Selektion (1.Element) anzeigen  ????
328cdf0e10cSrcweir 		sal_uInt16 nCnt = pSh->GetCrsrCnt();
329cdf0e10cSrcweir 		if (nCnt < 2)
330cdf0e10cSrcweir 		{
331cdf0e10cSrcweir 			bSelected = !pSh->HasSelection();
332cdf0e10cSrcweir 			aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
333cdf0e10cSrcweir 			aEntryED.SetText(aOrgStr);
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 			//alle gleichen Eintraege aufzunehmen darf nur im Body und auch da nur
336cdf0e10cSrcweir 			//bei vorhandener einfacher Selektion erlaubt werden
337cdf0e10cSrcweir 			const sal_uInt16 nFrmType = pSh->GetFrmType(0,sal_True);
338cdf0e10cSrcweir 			aApplyToAllCB.Show();
339cdf0e10cSrcweir 			aSearchCaseSensitiveCB.Show();
340cdf0e10cSrcweir 			aSearchCaseWordOnlyCB.Show();
341cdf0e10cSrcweir 			aApplyToAllCB.Enable(0 != aOrgStr.Len() &&
342cdf0e10cSrcweir 				0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY )));
343cdf0e10cSrcweir 			SearchTypeHdl(&aApplyToAllCB);
344cdf0e10cSrcweir 		}
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 		// Verzeichnistyp ist default
347cdf0e10cSrcweir 		if(	sTmpTypeSelection.Len() &&
348cdf0e10cSrcweir 			LISTBOX_ENTRY_NOTFOUND != aTypeDCB.GetEntryPos( sTmpTypeSelection ) )
349cdf0e10cSrcweir             aTypeDCB.SelectEntry(sTmpTypeSelection);
350cdf0e10cSrcweir 		else
351cdf0e10cSrcweir 			aTypeDCB.SelectEntry(aTypeDCB.GetEntry(nTypePos));
352cdf0e10cSrcweir 		ModifyHdl(&aTypeDCB);
353cdf0e10cSrcweir 	}
354cdf0e10cSrcweir }
355cdf0e10cSrcweir 
UpdateLanguageDependenciesForPhoneticReading()356cdf0e10cSrcweir void	SwIndexMarkDlg::UpdateLanguageDependenciesForPhoneticReading()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir 	//no phonetic reading if no global cjk support
359cdf0e10cSrcweir 	if( !xExtendedIndexEntrySupplier.is() )
360cdf0e10cSrcweir 	{
361cdf0e10cSrcweir 		bIsPhoneticReadingEnabled = sal_False;
362cdf0e10cSrcweir 		return;
363cdf0e10cSrcweir 	}
364cdf0e10cSrcweir 	bIsPhoneticReadingEnabled = sal_True;
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	//get the current language
367cdf0e10cSrcweir 	if(!bNewMark) //if dialog is opened to iterate existing marks
368cdf0e10cSrcweir 	{
369cdf0e10cSrcweir 		ASSERT(pTOXMgr, "need TOXMgr")
370cdf0e10cSrcweir 		if(!pTOXMgr)
371cdf0e10cSrcweir 			return;
372cdf0e10cSrcweir 		SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
373cdf0e10cSrcweir 		ASSERT(pMark, "need current SwTOXMark");
374cdf0e10cSrcweir 		if(!pMark)
375cdf0e10cSrcweir 			return;
376cdf0e10cSrcweir 		SwTxtTOXMark* pTxtTOXMark = pMark->GetTxtTOXMark();
377cdf0e10cSrcweir 		ASSERT(pTxtTOXMark, "need current SwTxtTOXMark");
378cdf0e10cSrcweir 		if(!pTxtTOXMark)
379cdf0e10cSrcweir 			return;
380cdf0e10cSrcweir 		const SwTxtNode* pTxtNode = pTxtTOXMark->GetpTxtNd();
381cdf0e10cSrcweir 		ASSERT(pTxtNode, "need current SwTxtNode");
382cdf0e10cSrcweir 		if(!pTxtNode)
383cdf0e10cSrcweir 			return;
384cdf0e10cSrcweir 		xub_StrLen nTextIndex = *pTxtTOXMark->GetStart();
385cdf0e10cSrcweir 		nLangForPhoneticReading = pTxtNode->GetLang( nTextIndex );
386cdf0e10cSrcweir 	}
387cdf0e10cSrcweir 	else //if dialog is opened to create a new mark
388cdf0e10cSrcweir 	{
389cdf0e10cSrcweir 		sal_uInt16 nScriptType = pSh->GetScriptType();
390cdf0e10cSrcweir 		sal_uInt16 nWhich;
391cdf0e10cSrcweir 		switch(nScriptType)
392cdf0e10cSrcweir 		{
393cdf0e10cSrcweir 			case SCRIPTTYPE_ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
394cdf0e10cSrcweir 			case SCRIPTTYPE_COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break;
395cdf0e10cSrcweir 			//case SCRIPTTYPE_LATIN:
396cdf0e10cSrcweir 			default:nWhich = RES_CHRATR_LANGUAGE; break;
397cdf0e10cSrcweir 		}
398cdf0e10cSrcweir         SfxItemSet aLangSet(pSh->GetAttrPool(), nWhich, nWhich);
399cdf0e10cSrcweir         pSh->GetCurAttr(aLangSet);
400cdf0e10cSrcweir         nLangForPhoneticReading = ((const SvxLanguageItem&)aLangSet.Get(nWhich)).GetLanguage();
401cdf0e10cSrcweir 	}
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	/*
404cdf0e10cSrcweir 	//enable phonetic reading dependent on the current language
405cdf0e10cSrcweir 	{
406cdf0e10cSrcweir 		lang::Locale aLocale( SvxCreateLocale( LanguageType( nLangForPhoneticReading ) ) );
407cdf0e10cSrcweir 		bIsPhoneticReadingEnabled = xExtendedIndexEntrySupplier->usePhoneticEntry( aLocale );
408cdf0e10cSrcweir 	}
409cdf0e10cSrcweir 	*/
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
GetDefaultPhoneticReading(const String & rText)412cdf0e10cSrcweir String	SwIndexMarkDlg::GetDefaultPhoneticReading( const String& rText )
413cdf0e10cSrcweir {
414cdf0e10cSrcweir 	if( !bIsPhoneticReadingEnabled )
415cdf0e10cSrcweir 		return aEmptyStr;
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 	lang::Locale aLocale( SvxCreateLocale( LanguageType( nLangForPhoneticReading ) ) );
418cdf0e10cSrcweir 	return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, aLocale);
419cdf0e10cSrcweir }
420cdf0e10cSrcweir 
421cdf0e10cSrcweir /* -----------------07.09.99 10:43-------------------
422cdf0e10cSrcweir 	Change the content of aEntryED if text is selected
423cdf0e10cSrcweir  --------------------------------------------------*/
424cdf0e10cSrcweir 
Activate()425cdf0e10cSrcweir void	SwIndexMarkDlg::Activate()
426cdf0e10cSrcweir {
427cdf0e10cSrcweir 	// aktuelle Selektion (1.Element) anzeigen  ????
428cdf0e10cSrcweir 	if(bNewMark)
429cdf0e10cSrcweir 	{
430cdf0e10cSrcweir 		sal_uInt16 nCnt = pSh->GetCrsrCnt();
431cdf0e10cSrcweir 		if (nCnt < 2)
432cdf0e10cSrcweir 		{
433cdf0e10cSrcweir 			bSelected = !pSh->HasSelection();
434cdf0e10cSrcweir 			aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
435cdf0e10cSrcweir 			aEntryED.SetText(aOrgStr);
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 			//alle gleichen Eintraege aufzunehmen darf nur im Body und auch da nur
438cdf0e10cSrcweir 			//bei vorhandener einfacher Selektion erlaubt werden
439cdf0e10cSrcweir 			const sal_uInt16 nFrmType = pSh->GetFrmType(0,sal_True);
440cdf0e10cSrcweir 			aApplyToAllCB.Show();
441cdf0e10cSrcweir 			aSearchCaseSensitiveCB.Show();
442cdf0e10cSrcweir 			aSearchCaseWordOnlyCB.Show();
443cdf0e10cSrcweir 			aApplyToAllCB.Enable(0 != aOrgStr.Len() &&
444cdf0e10cSrcweir 				0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY )));
445cdf0e10cSrcweir 			SearchTypeHdl(&aApplyToAllCB);
446cdf0e10cSrcweir 		}
447cdf0e10cSrcweir 		ModifyHdl(&aTypeDCB);
448cdf0e10cSrcweir 	}
449cdf0e10cSrcweir }
450cdf0e10cSrcweir 
451cdf0e10cSrcweir /*--------------------------------------------------------------------
452cdf0e10cSrcweir 	 Beschreibung:	Ok-Button auswerten
453cdf0e10cSrcweir  --------------------------------------------------------------------*/
Apply()454cdf0e10cSrcweir void SwIndexMarkDlg::Apply()
455cdf0e10cSrcweir {
456cdf0e10cSrcweir 	InsertUpdate();
457cdf0e10cSrcweir 	if(bSelected)
458cdf0e10cSrcweir 		pSh->ResetSelect(0, sal_False);
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir /*--------------------------------------------------------------------
462cdf0e10cSrcweir 	Beschreibung: Aenderungen uebernehmen
463cdf0e10cSrcweir  --------------------------------------------------------------------*/
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 
InsertUpdate()466cdf0e10cSrcweir void SwIndexMarkDlg::InsertUpdate()
467cdf0e10cSrcweir {
468cdf0e10cSrcweir 	pSh->StartUndo(bDel ? UNDO_INDEX_ENTRY_DELETE : UNDO_INDEX_ENTRY_INSERT);
469cdf0e10cSrcweir 	pSh->StartAllAction();
470cdf0e10cSrcweir 
471cdf0e10cSrcweir     SwRewriter aRewriter;
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 	if( bNewMark )
474cdf0e10cSrcweir     {
475cdf0e10cSrcweir 		InsertMark();
476cdf0e10cSrcweir 
477cdf0e10cSrcweir         if ( pTOXMgr->GetCurTOXMark())
478cdf0e10cSrcweir             aRewriter.AddRule(UNDO_ARG1, pTOXMgr->GetCurTOXMark()->GetText());
479cdf0e10cSrcweir     }
480cdf0e10cSrcweir 	else if( !pSh->HasReadonlySel() )
481cdf0e10cSrcweir 	{
482cdf0e10cSrcweir         if ( pTOXMgr->GetCurTOXMark())
483cdf0e10cSrcweir             aRewriter.AddRule(UNDO_ARG1,
484cdf0e10cSrcweir                               pTOXMgr->GetCurTOXMark()->GetText());
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 		if( bDel )
487cdf0e10cSrcweir 			pTOXMgr->DeleteTOXMark();
488cdf0e10cSrcweir 		else if( pTOXMgr->GetCurTOXMark() )
489cdf0e10cSrcweir 			UpdateMark();
490cdf0e10cSrcweir 	}
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 	pSh->EndAllAction();
493cdf0e10cSrcweir 	pSh->EndUndo(bDel ? UNDO_INDEX_ENTRY_DELETE : UNDO_INDEX_ENTRY_INSERT);
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	if((nTypePos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry())) == LISTBOX_ENTRY_NOTFOUND)
496cdf0e10cSrcweir 		nTypePos = 0;
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 	nKey1Pos = aKeyDCB.GetEntryPos(aKeyDCB.GetText());
499cdf0e10cSrcweir 	nKey2Pos = aKey2DCB.GetEntryPos(aKey2DCB.GetText());
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
502cdf0e10cSrcweir /*--------------------------------------------------------------------
503cdf0e10cSrcweir 	 Beschreibung:	Marke einfuegen
504cdf0e10cSrcweir  --------------------------------------------------------------------*/
lcl_SelectSameStrings(SwWrtShell & rSh,sal_Bool bWordOnly,sal_Bool bCaseSensitive)505cdf0e10cSrcweir static void lcl_SelectSameStrings(SwWrtShell& rSh, sal_Bool bWordOnly, sal_Bool bCaseSensitive)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir 	rSh.Push();
508cdf0e10cSrcweir 
509cdf0e10cSrcweir 	SearchOptions aSearchOpt(
510cdf0e10cSrcweir 						SearchAlgorithms_ABSOLUTE,
511cdf0e10cSrcweir 						( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ),
512cdf0e10cSrcweir 						rSh.GetSelTxt(), OUString(),
513cdf0e10cSrcweir 						SvxCreateLocale( GetAppLanguage() ),
514cdf0e10cSrcweir 						0, 0, 0,
515cdf0e10cSrcweir 						(bCaseSensitive
516cdf0e10cSrcweir 							? 0
517cdf0e10cSrcweir 							: TransliterationModules_IGNORE_CASE) );
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	rSh.ClearMark();
520cdf0e10cSrcweir     sal_Bool bCancel;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	//todo/mba: assuming that notes should not be searched
523cdf0e10cSrcweir 	sal_Bool bSearchInNotes = sal_False;
524cdf0e10cSrcweir     rSh.Find( aSearchOpt,  bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel,
525cdf0e10cSrcweir                         (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY), sal_False );
526cdf0e10cSrcweir }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir 
InsertMark()529cdf0e10cSrcweir void SwIndexMarkDlg::InsertMark()
530cdf0e10cSrcweir {
531cdf0e10cSrcweir 	sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
532cdf0e10cSrcweir 	TOXTypes eType = nPos == POS_CONTENT ? TOX_CONTENT :
533cdf0e10cSrcweir 						nPos == POS_INDEX ? TOX_INDEX : TOX_USER;
534cdf0e10cSrcweir 
535cdf0e10cSrcweir 	SwTOXMarkDescription aDesc(eType);
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 	sal_uInt16 nLevel = (sal_uInt16)aLevelED.Denormalize(aLevelED.GetValue());
538cdf0e10cSrcweir 	switch(nPos)
539cdf0e10cSrcweir 	{
540cdf0e10cSrcweir 		case POS_CONTENT : break;
541cdf0e10cSrcweir 		case POS_INDEX:  	// Stichwortverzeichnismarke
542cdf0e10cSrcweir 		{
543cdf0e10cSrcweir 			UpdateKeyBoxes();
544cdf0e10cSrcweir 			String  aPrim(aKeyDCB.GetText());
545cdf0e10cSrcweir 			String  aSec(aKey2DCB.GetText());
546cdf0e10cSrcweir 			aDesc.SetPrimKey(aPrim);
547cdf0e10cSrcweir 			aDesc.SetSecKey(aSec);
548cdf0e10cSrcweir 			aDesc.SetMainEntry(aMainEntryCB.IsChecked());
549cdf0e10cSrcweir 			aDesc.SetPhoneticReadingOfAltStr(aPhoneticED0.GetText());
550cdf0e10cSrcweir 			aDesc.SetPhoneticReadingOfPrimKey(aPhoneticED1.GetText());
551cdf0e10cSrcweir 			aDesc.SetPhoneticReadingOfSecKey(aPhoneticED2.GetText());
552cdf0e10cSrcweir 		}
553cdf0e10cSrcweir 		break;
554cdf0e10cSrcweir 		default:            // Userdefinedverz.-Marke
555cdf0e10cSrcweir 		{
556cdf0e10cSrcweir 			String aName(aTypeDCB.GetSelectEntry());
557cdf0e10cSrcweir 			aDesc.SetTOUName(aName);
558cdf0e10cSrcweir 		}
559cdf0e10cSrcweir 	}
560cdf0e10cSrcweir 	if (aOrgStr != aEntryED.GetText())
561cdf0e10cSrcweir 		aDesc.SetAltStr(aEntryED.GetText());
562cdf0e10cSrcweir 	sal_Bool bApplyAll = aApplyToAllCB.IsChecked();
563cdf0e10cSrcweir     sal_Bool bWordOnly = aSearchCaseWordOnlyCB.IsChecked();
564cdf0e10cSrcweir 	sal_Bool bCaseSensitive = aSearchCaseSensitiveCB.IsChecked();
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	pSh->StartAllAction();
567cdf0e10cSrcweir 	// hier muessen alle gleichen Strings selektiert werden
568cdf0e10cSrcweir 	// damit der Eintrag auf alle gleichen Strings angewandt wird
569cdf0e10cSrcweir 	if(bApplyAll)
570cdf0e10cSrcweir 	{
571cdf0e10cSrcweir 		lcl_SelectSameStrings(*pSh, bWordOnly, bCaseSensitive);
572cdf0e10cSrcweir 	}
573cdf0e10cSrcweir 	aDesc.SetLevel(nLevel);
574cdf0e10cSrcweir 	SwTOXMgr aMgr(pSh);
575cdf0e10cSrcweir 	aMgr.InsertTOXMark(aDesc);
576cdf0e10cSrcweir 	if(bApplyAll)
577cdf0e10cSrcweir 		pSh->Pop(sal_False);
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	pSh->EndAllAction();
580cdf0e10cSrcweir }
581cdf0e10cSrcweir 
582cdf0e10cSrcweir /*--------------------------------------------------------------------
583cdf0e10cSrcweir 	 Beschreibung:	Marke Updaten
584cdf0e10cSrcweir  --------------------------------------------------------------------*/
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 
UpdateMark()587cdf0e10cSrcweir void SwIndexMarkDlg::UpdateMark()
588cdf0e10cSrcweir {
589cdf0e10cSrcweir 	String 	aAltText(aEntryED.GetText());
590cdf0e10cSrcweir 	String* pAltText = aOrgStr != aEntryED.GetText() ? &aAltText : 0;
591cdf0e10cSrcweir 	//empty alternative texts are not allowed
592cdf0e10cSrcweir 	if(pAltText && !pAltText->Len())
593cdf0e10cSrcweir 		return;
594cdf0e10cSrcweir 
595cdf0e10cSrcweir 	UpdateKeyBoxes();
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 	sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
598cdf0e10cSrcweir 	TOXTypes eType = TOX_USER;
599cdf0e10cSrcweir 	if(POS_CONTENT == nPos)
600cdf0e10cSrcweir 		eType = TOX_CONTENT;
601cdf0e10cSrcweir 	else if(POS_INDEX == nPos)
602cdf0e10cSrcweir 		eType = TOX_INDEX;
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 	SwTOXMarkDescription aDesc(eType);
605cdf0e10cSrcweir     aDesc.SetLevel( static_cast< int >(aLevelED.GetValue()) );
606cdf0e10cSrcweir 	if(pAltText)
607cdf0e10cSrcweir 		aDesc.SetAltStr(*pAltText);
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	String  aPrim(aKeyDCB.GetText());
610cdf0e10cSrcweir 	if(aPrim.Len())
611cdf0e10cSrcweir 		aDesc.SetPrimKey(aPrim);
612cdf0e10cSrcweir 	String  aSec(aKey2DCB.GetText());
613cdf0e10cSrcweir 	if(aSec.Len())
614cdf0e10cSrcweir 		aDesc.SetSecKey(aSec);
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 	if(eType == TOX_INDEX)
617cdf0e10cSrcweir 	{
618cdf0e10cSrcweir 		aDesc.SetPhoneticReadingOfAltStr(aPhoneticED0.GetText());
619cdf0e10cSrcweir 		aDesc.SetPhoneticReadingOfPrimKey(aPhoneticED1.GetText());
620cdf0e10cSrcweir 		aDesc.SetPhoneticReadingOfSecKey(aPhoneticED2.GetText());
621cdf0e10cSrcweir 	}
622cdf0e10cSrcweir 	aDesc.SetMainEntry(aMainEntryCB.IsVisible() && aMainEntryCB.IsChecked());
623cdf0e10cSrcweir 	pTOXMgr->UpdateTOXMark(aDesc);
624cdf0e10cSrcweir }
625cdf0e10cSrcweir 
626cdf0e10cSrcweir /*--------------------------------------------------------------------
627cdf0e10cSrcweir 	Beschreibung: Neue Keys eintragen
628cdf0e10cSrcweir  --------------------------------------------------------------------*/
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 
UpdateKeyBoxes()631cdf0e10cSrcweir void SwIndexMarkDlg::UpdateKeyBoxes()
632cdf0e10cSrcweir {
633cdf0e10cSrcweir 	String aKey(aKeyDCB.GetText());
634cdf0e10cSrcweir 	sal_uInt16 nPos = aKeyDCB.GetEntryPos(aKey);
635cdf0e10cSrcweir 
636cdf0e10cSrcweir 	if(nPos == LISTBOX_ENTRY_NOTFOUND && aKey.Len() > 0)
637cdf0e10cSrcweir 	{	// neuen Key erzeugen
638cdf0e10cSrcweir 		aKeyDCB.InsertEntry(aKey);
639cdf0e10cSrcweir 	}
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	aKey = aKey2DCB.GetText();
642cdf0e10cSrcweir 	nPos = aKey2DCB.GetEntryPos(aKey);
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 	if(nPos == LISTBOX_ENTRY_NOTFOUND && aKey.Len() > 0)
645cdf0e10cSrcweir 	{	// neuen Key erzeugen
646cdf0e10cSrcweir 		aKey2DCB.InsertEntry(aKey);
647cdf0e10cSrcweir 	}
648cdf0e10cSrcweir }
649cdf0e10cSrcweir /* -----------------13.10.99 15:10-------------------
650cdf0e10cSrcweir 
651cdf0e10cSrcweir  --------------------------------------------------*/
652cdf0e10cSrcweir class SwNewUserIdxDlg : public ModalDialog
653cdf0e10cSrcweir {
654cdf0e10cSrcweir 	OKButton 		aOKPB;
655cdf0e10cSrcweir 	CancelButton 	aCancelPB;
656cdf0e10cSrcweir 	HelpButton 		aHelpPB;
657cdf0e10cSrcweir     FixedLine       aNameFL;
658cdf0e10cSrcweir 	FixedText		aNameFT;
659cdf0e10cSrcweir 	Edit			aNameED;
660cdf0e10cSrcweir 
661cdf0e10cSrcweir 	SwIndexMarkDlg*	pDlg;
662cdf0e10cSrcweir 
663cdf0e10cSrcweir 	DECL_LINK( ModifyHdl, Edit*);
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 	public:
SwNewUserIdxDlg(SwIndexMarkDlg * pParent)666cdf0e10cSrcweir 		SwNewUserIdxDlg(SwIndexMarkDlg* pParent) :
667cdf0e10cSrcweir 			ModalDialog(pParent, SW_RES(DLG_NEW_USER_IDX)),
668cdf0e10cSrcweir             aOKPB(this, SW_RES(     PB_OK       )),
669cdf0e10cSrcweir             aCancelPB(this, SW_RES( PB_CANCEL   )),
670cdf0e10cSrcweir             aHelpPB(this, SW_RES(   PB_HELP     )),
671cdf0e10cSrcweir             aNameFL(this, SW_RES(    FL_NAME     )),
672cdf0e10cSrcweir             aNameFT(this, SW_RES(   FT_NAME     )),
673cdf0e10cSrcweir             aNameED(this, SW_RES(    ED_NAME     )),
674cdf0e10cSrcweir             pDlg(pParent)
675cdf0e10cSrcweir 			{
676cdf0e10cSrcweir 				FreeResource();
677cdf0e10cSrcweir 				aNameED.SetModifyHdl(LINK(this, SwNewUserIdxDlg, ModifyHdl));
678cdf0e10cSrcweir 				aOKPB.Enable(sal_False);
679cdf0e10cSrcweir 				aNameED.GrabFocus();
680cdf0e10cSrcweir 			}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 	virtual void	Apply();
GetName()683cdf0e10cSrcweir 	String 	GetName(){return aNameED.GetText();}
684cdf0e10cSrcweir };
Apply()685cdf0e10cSrcweir void SwNewUserIdxDlg::Apply()
686cdf0e10cSrcweir {
687cdf0e10cSrcweir }
688cdf0e10cSrcweir 
IMPL_LINK(SwNewUserIdxDlg,ModifyHdl,Edit *,pEdit)689cdf0e10cSrcweir IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit*, pEdit)
690cdf0e10cSrcweir {
691cdf0e10cSrcweir 	aOKPB.Enable(pEdit->GetText().Len() && !pDlg->IsTOXType(pEdit->GetText()));
692cdf0e10cSrcweir 	return 0;
693cdf0e10cSrcweir }
694cdf0e10cSrcweir 
IMPL_LINK(SwIndexMarkDlg,NewUserIdxHdl,Button *,EMPTYARG)695cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, NewUserIdxHdl, Button*, EMPTYARG)
696cdf0e10cSrcweir {
697cdf0e10cSrcweir 	SwNewUserIdxDlg* pDlg = new SwNewUserIdxDlg(this);
698cdf0e10cSrcweir 	if(RET_OK == pDlg->Execute())
699cdf0e10cSrcweir 	{
700cdf0e10cSrcweir 		String sNewName(pDlg->GetName());
701cdf0e10cSrcweir 		aTypeDCB.InsertEntry(sNewName);
702cdf0e10cSrcweir 		aTypeDCB.SelectEntry(sNewName);
703cdf0e10cSrcweir 	}
704cdf0e10cSrcweir 	delete pDlg;
705cdf0e10cSrcweir 	return 0;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir /* -----------------------------17.01.00 12:18--------------------------------
708cdf0e10cSrcweir 
709cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SwIndexMarkDlg,SearchTypeHdl,CheckBox *,pBox)710cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, SearchTypeHdl, CheckBox*, pBox)
711cdf0e10cSrcweir {
712cdf0e10cSrcweir 	sal_Bool bEnable = pBox->IsChecked() && pBox->IsEnabled();
713cdf0e10cSrcweir 	aSearchCaseWordOnlyCB.Enable(bEnable);
714cdf0e10cSrcweir 	aSearchCaseSensitiveCB.Enable(bEnable);
715cdf0e10cSrcweir 	return 0;
716cdf0e10cSrcweir }
717cdf0e10cSrcweir /* -----------------07.09.99 10:30-------------------
718cdf0e10cSrcweir 
719cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwIndexMarkDlg,InsertHdl,Button *,pButton)720cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, InsertHdl, Button *, pButton )
721cdf0e10cSrcweir {
722cdf0e10cSrcweir 	Apply();
723cdf0e10cSrcweir 	//close the dialog if only one entry is available
724cdf0e10cSrcweir 	if(!bNewMark && !aPrevBT.IsVisible() && !aNextBT.IsVisible())
725cdf0e10cSrcweir 		CloseHdl(pButton);
726cdf0e10cSrcweir 	return 0;
727cdf0e10cSrcweir }
728cdf0e10cSrcweir /* -----------------07.09.99 10:29-------------------
729cdf0e10cSrcweir 
730cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwIndexMarkDlg,CloseHdl,Button *,EMPTYARG)731cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, CloseHdl, Button *, EMPTYARG )
732cdf0e10cSrcweir {
733cdf0e10cSrcweir 	if(bNewMark)
734cdf0e10cSrcweir 	{
735cdf0e10cSrcweir 		sal_uInt16 nSlot = FN_INSERT_IDX_ENTRY_DLG;
736cdf0e10cSrcweir 		SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot,
737cdf0e10cSrcweir 					SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
738cdf0e10cSrcweir 	}
739cdf0e10cSrcweir 	else
740cdf0e10cSrcweir 	{
741cdf0e10cSrcweir 		((SwIndexMarkModalDlg*)GetParent())->EndDialog(RET_CANCEL);
742cdf0e10cSrcweir 	}
743cdf0e10cSrcweir 	return 0;
744cdf0e10cSrcweir }
745cdf0e10cSrcweir /*--------------------------------------------------------------------
746cdf0e10cSrcweir 	 Beschreibung:	VerzeichnisTyp auswaehlen nur bei Einfuegen
747cdf0e10cSrcweir  --------------------------------------------------------------------*/
IMPL_LINK(SwIndexMarkDlg,ModifyHdl,ListBox *,pBox)748cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, ModifyHdl, ListBox *, pBox )
749cdf0e10cSrcweir {
750cdf0e10cSrcweir 	if(&aTypeDCB == pBox)
751cdf0e10cSrcweir 	{
752cdf0e10cSrcweir 		// Verzeichnistyp setzen
753cdf0e10cSrcweir 		sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
754cdf0e10cSrcweir 		sal_Bool bLevelEnable = sal_False,
755cdf0e10cSrcweir 		 	bKeyEnable	  = sal_False,
756cdf0e10cSrcweir 		 	bSetKey2 	  = sal_False,
757cdf0e10cSrcweir 		 	bKey2Enable  = sal_False,
758cdf0e10cSrcweir 			bEntryHasText	= sal_False,
759cdf0e10cSrcweir 			bKey1HasText	= sal_False,
760cdf0e10cSrcweir 			bKey2HasText	= sal_False;
761cdf0e10cSrcweir 		if(nPos == POS_INDEX)
762cdf0e10cSrcweir 		{
763cdf0e10cSrcweir 			if(aEntryED.GetText().Len())
764cdf0e10cSrcweir 				bEntryHasText = sal_True;
765cdf0e10cSrcweir 			aPhoneticED0.SetText(GetDefaultPhoneticReading(aEntryED.GetText()));
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 			bKeyEnable = sal_True;
768cdf0e10cSrcweir 			aKeyDCB.SetText(aKeyDCB.GetEntry(nKey1Pos));
769cdf0e10cSrcweir 			aPhoneticED1.SetText(GetDefaultPhoneticReading(aKeyDCB.GetText()));
770cdf0e10cSrcweir 			if(aKeyDCB.GetText().Len() > 0)
771cdf0e10cSrcweir 			{
772cdf0e10cSrcweir 				bKey1HasText = bSetKey2 = bKey2Enable = sal_True;
773cdf0e10cSrcweir 				aKey2DCB.SetText(aKey2DCB.GetEntry(nKey2Pos));
774cdf0e10cSrcweir 				aPhoneticED2.SetText(GetDefaultPhoneticReading(aKey2DCB.GetText()));
775cdf0e10cSrcweir 				if(aKey2DCB.GetText().Len())
776cdf0e10cSrcweir 					bKey2HasText = sal_True;
777cdf0e10cSrcweir 			}
778cdf0e10cSrcweir 		}
779cdf0e10cSrcweir 		else
780cdf0e10cSrcweir 		{
781cdf0e10cSrcweir 			bLevelEnable = sal_True;
782cdf0e10cSrcweir 			aLevelED.SetMax(MAXLEVEL);
783cdf0e10cSrcweir 			aLevelED.SetValue(aLevelED.Normalize(0));
784cdf0e10cSrcweir 			bSetKey2 = sal_True;
785cdf0e10cSrcweir 		}
786cdf0e10cSrcweir 		aLevelFT.Show(bLevelEnable);
787cdf0e10cSrcweir 		aLevelED.Show(bLevelEnable);
788cdf0e10cSrcweir 		aMainEntryCB.Show(nPos == POS_INDEX);
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 		aKeyFT.Enable(bKeyEnable);
791cdf0e10cSrcweir 		aKeyDCB.Enable(bKeyEnable);
792cdf0e10cSrcweir 		if ( bSetKey2 )
793cdf0e10cSrcweir 		{
794cdf0e10cSrcweir 			aKey2DCB.Enable(bKey2Enable);
795cdf0e10cSrcweir 			aKey2FT.Enable(bKey2Enable);
796cdf0e10cSrcweir 		}
797cdf0e10cSrcweir 		aPhoneticFT0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
798cdf0e10cSrcweir 		aPhoneticED0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
799cdf0e10cSrcweir 		aPhoneticFT1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
800cdf0e10cSrcweir 		aPhoneticED1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
801cdf0e10cSrcweir 		aPhoneticFT2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
802cdf0e10cSrcweir 		aPhoneticED2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
803cdf0e10cSrcweir 	}
804cdf0e10cSrcweir 	else //aEntryED  !!aEntryED is not a ListBox but a Edit
805cdf0e10cSrcweir 	{
806cdf0e10cSrcweir 		sal_Bool bHasText = (aEntryED.GetText().Len()>0);
807cdf0e10cSrcweir 		if(!bHasText)
808cdf0e10cSrcweir 		{
809cdf0e10cSrcweir 			aPhoneticED0.SetText(aEmptyStr);
810cdf0e10cSrcweir 			bPhoneticED0_ChangedByUser = sal_False;
811cdf0e10cSrcweir 		}
812cdf0e10cSrcweir 		else if(!bPhoneticED0_ChangedByUser)
813cdf0e10cSrcweir 			aPhoneticED0.SetText(GetDefaultPhoneticReading(aEntryED.GetText()));
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 		aPhoneticFT0.Enable(bHasText&&bIsPhoneticReadingEnabled);
816cdf0e10cSrcweir 		aPhoneticED0.Enable(bHasText&&bIsPhoneticReadingEnabled);
817cdf0e10cSrcweir 	}
818cdf0e10cSrcweir     aOKBT.Enable(!pSh->HasReadonlySel() &&
819cdf0e10cSrcweir         (aEntryED.GetText().Len() || pSh->GetCrsrCnt(sal_False)));
820cdf0e10cSrcweir 	return 0;
821cdf0e10cSrcweir }
822cdf0e10cSrcweir 
823cdf0e10cSrcweir /*--------------------------------------------------------------------
824cdf0e10cSrcweir 	 Beschreibung:
825cdf0e10cSrcweir  --------------------------------------------------------------------*/
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 
IMPL_LINK_INLINE_START(SwIndexMarkDlg,NextHdl,Button *,EMPTYARG)828cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwIndexMarkDlg, NextHdl, Button *, EMPTYARG )
829cdf0e10cSrcweir {
830cdf0e10cSrcweir 	InsertUpdate();
831cdf0e10cSrcweir 	pTOXMgr->NextTOXMark();
832cdf0e10cSrcweir 	UpdateDialog();
833cdf0e10cSrcweir 	return 0;
834cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwIndexMarkDlg,NextHdl,Button *,EMPTYARG)835cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwIndexMarkDlg, NextHdl, Button *, EMPTYARG )
836cdf0e10cSrcweir 
837cdf0e10cSrcweir 
838cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwIndexMarkDlg, NextSameHdl, Button *, EMPTYARG )
839cdf0e10cSrcweir {
840cdf0e10cSrcweir 	InsertUpdate();
841cdf0e10cSrcweir 	pTOXMgr->NextTOXMark(sal_True);
842cdf0e10cSrcweir 	UpdateDialog();
843cdf0e10cSrcweir 	return 0;
844cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwIndexMarkDlg,NextSameHdl,Button *,EMPTYARG)845cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwIndexMarkDlg, NextSameHdl, Button *, EMPTYARG )
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 
848cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwIndexMarkDlg, PrevHdl, Button *, EMPTYARG )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir 	InsertUpdate();
851cdf0e10cSrcweir 	pTOXMgr->PrevTOXMark();
852cdf0e10cSrcweir 	UpdateDialog();
853cdf0e10cSrcweir 	return 0;
854cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwIndexMarkDlg,PrevHdl,Button *,EMPTYARG)855cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwIndexMarkDlg, PrevHdl, Button *, EMPTYARG )
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 
858cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwIndexMarkDlg, PrevSameHdl, Button *, EMPTYARG )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir 	InsertUpdate();
861cdf0e10cSrcweir 	pTOXMgr->PrevTOXMark(sal_True);
862cdf0e10cSrcweir 	UpdateDialog();
863cdf0e10cSrcweir 
864cdf0e10cSrcweir 	return 0;
865cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwIndexMarkDlg,PrevSameHdl,Button *,EMPTYARG)866cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwIndexMarkDlg, PrevSameHdl, Button *, EMPTYARG )
867cdf0e10cSrcweir 
868cdf0e10cSrcweir 
869cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, DelHdl, Button *, EMPTYARG )
870cdf0e10cSrcweir {
871cdf0e10cSrcweir 	bDel = sal_True;
872cdf0e10cSrcweir 	InsertUpdate();
873cdf0e10cSrcweir 	bDel = sal_False;
874cdf0e10cSrcweir 
875cdf0e10cSrcweir 	if(pTOXMgr->GetCurTOXMark())
876cdf0e10cSrcweir 		UpdateDialog();
877cdf0e10cSrcweir 	else
878cdf0e10cSrcweir 	{
879cdf0e10cSrcweir 		CloseHdl(&aCancelBT);
880cdf0e10cSrcweir 		SfxViewFrame::Current()->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
881cdf0e10cSrcweir 	}
882cdf0e10cSrcweir 	return 0;
883cdf0e10cSrcweir }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir /*--------------------------------------------------------------------
886cdf0e10cSrcweir 	 Beschreibung: Dialoganzeige erneuern
887cdf0e10cSrcweir  --------------------------------------------------------------------*/
888cdf0e10cSrcweir 
889cdf0e10cSrcweir 
UpdateDialog()890cdf0e10cSrcweir void SwIndexMarkDlg::UpdateDialog()
891cdf0e10cSrcweir {
892cdf0e10cSrcweir 	DBG_ASSERT(pSh && pTOXMgr, "Shell nicht da?");
893cdf0e10cSrcweir 	SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
894cdf0e10cSrcweir 	ASSERT(pMark, "Keine aktuelle Markierung");
895cdf0e10cSrcweir 	if(!pMark)
896cdf0e10cSrcweir 		return;
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 	ViewShell::SetCareWin( GetParent() );
899cdf0e10cSrcweir 
900cdf0e10cSrcweir 	aOrgStr = pMark->GetText();
901cdf0e10cSrcweir 	aEntryED.SetText(aOrgStr);
902cdf0e10cSrcweir 
903cdf0e10cSrcweir 	// Verzeichnistyp setzen
904cdf0e10cSrcweir 	sal_Bool bLevelEnable = sal_True,
905cdf0e10cSrcweir 		 bKeyEnable   = sal_False,
906cdf0e10cSrcweir 		 bKey2Enable  = sal_False,
907cdf0e10cSrcweir 		 bEntryHasText	= sal_False,
908cdf0e10cSrcweir 		 bKey1HasText	= sal_False,
909cdf0e10cSrcweir 		 bKey2HasText	= sal_False;
910cdf0e10cSrcweir 
911cdf0e10cSrcweir 	TOXTypes eCurType = pMark->GetTOXType()->GetType();
912cdf0e10cSrcweir 	if(TOX_INDEX == eCurType)
913cdf0e10cSrcweir 	{
914cdf0e10cSrcweir 		bLevelEnable = sal_False;
915cdf0e10cSrcweir 		bKeyEnable = sal_True;
916cdf0e10cSrcweir 		bKey1HasText = bKey2Enable = 0 != pMark->GetPrimaryKey().Len();
917cdf0e10cSrcweir 		bKey2HasText = 0 != pMark->GetSecondaryKey().Len();
918cdf0e10cSrcweir 		bEntryHasText = 0 != pMark->GetText().Len();
919cdf0e10cSrcweir 		aKeyDCB.SetText( pMark->GetPrimaryKey() );
920cdf0e10cSrcweir 		aKey2DCB.SetText( pMark->GetSecondaryKey() );
921cdf0e10cSrcweir 		aPhoneticED0.SetText( pMark->GetTextReading() );
922cdf0e10cSrcweir 		aPhoneticED1.SetText( pMark->GetPrimaryKeyReading() );
923cdf0e10cSrcweir 		aPhoneticED2.SetText( pMark->GetSecondaryKeyReading() );
924cdf0e10cSrcweir 		aMainEntryCB.Check(pMark->IsMainEntry());
925cdf0e10cSrcweir 	}
926cdf0e10cSrcweir 	else if(TOX_CONTENT == eCurType || TOX_USER == eCurType)
927cdf0e10cSrcweir 	{
928cdf0e10cSrcweir 		aLevelED.SetValue(aLevelED.Normalize(pMark->GetLevel()));
929cdf0e10cSrcweir 	}
930cdf0e10cSrcweir 	aKeyFT.Enable(bKeyEnable);
931cdf0e10cSrcweir 	aKeyDCB.Enable(bKeyEnable);
932cdf0e10cSrcweir 	aLevelED.SetMax(MAXLEVEL);
933cdf0e10cSrcweir 	aLevelFT.Show(bLevelEnable);
934cdf0e10cSrcweir 	aLevelED.Show(bLevelEnable);
935cdf0e10cSrcweir 	aMainEntryCB.Show(!bLevelEnable);
936cdf0e10cSrcweir 	aKey2FT.Enable(bKey2Enable);
937cdf0e10cSrcweir 	aKey2DCB.Enable(bKey2Enable);
938cdf0e10cSrcweir 
939cdf0e10cSrcweir 	UpdateLanguageDependenciesForPhoneticReading();
940cdf0e10cSrcweir 	aPhoneticFT0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
941cdf0e10cSrcweir 	aPhoneticED0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
942cdf0e10cSrcweir 	aPhoneticFT1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
943cdf0e10cSrcweir 	aPhoneticED1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
944cdf0e10cSrcweir 	aPhoneticFT2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
945cdf0e10cSrcweir 	aPhoneticED2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
946cdf0e10cSrcweir 
947cdf0e10cSrcweir 	// Verzeichnis-Typ setzen
948cdf0e10cSrcweir 	aTypeDCB.SelectEntry(pMark->GetTOXType()->GetTypeName());
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 	// Next - Prev - Buttons setzen
951cdf0e10cSrcweir 	pSh->SttCrsrMove();
952cdf0e10cSrcweir 	if( aPrevBT.IsVisible() )
953cdf0e10cSrcweir 	{
954cdf0e10cSrcweir 		const SwTOXMark* pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_PRV );
955cdf0e10cSrcweir 		if( pMoveMark != pMark )
956cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
957cdf0e10cSrcweir 		aPrevBT.Enable( pMoveMark != pMark );
958cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_NXT );
959cdf0e10cSrcweir 		if( pMoveMark != pMark )
960cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
961cdf0e10cSrcweir 		aNextBT.Enable( pMoveMark != pMark );
962cdf0e10cSrcweir 	}
963cdf0e10cSrcweir 
964cdf0e10cSrcweir 	if( aPrevSameBT.IsVisible() )
965cdf0e10cSrcweir 	{
966cdf0e10cSrcweir 		const SwTOXMark* pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
967cdf0e10cSrcweir 		if( pMoveMark != pMark )
968cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
969cdf0e10cSrcweir 		aPrevSameBT.Enable( pMoveMark != pMark );
970cdf0e10cSrcweir 		pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
971cdf0e10cSrcweir 		if( pMoveMark != pMark )
972cdf0e10cSrcweir 			pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
973cdf0e10cSrcweir 		aNextSameBT.Enable( pMoveMark != pMark );
974cdf0e10cSrcweir 	}
975cdf0e10cSrcweir 
976cdf0e10cSrcweir 	sal_Bool bEnable = !pSh->HasReadonlySel();
977cdf0e10cSrcweir 	aOKBT.Enable( bEnable );
978cdf0e10cSrcweir 	aDelBT.Enable( bEnable );
979cdf0e10cSrcweir 	aEntryED.SetReadOnly( !bEnable );
980cdf0e10cSrcweir 	aLevelED.SetReadOnly( !bEnable );
981cdf0e10cSrcweir 	aKeyDCB.SetReadOnly( !bEnable );
982cdf0e10cSrcweir 	aKey2DCB.SetReadOnly( !bEnable );
983cdf0e10cSrcweir 
984cdf0e10cSrcweir 	pSh->SelectTxtAttr( RES_TXTATR_TOXMARK, pMark->GetTxtTOXMark() );
985cdf0e10cSrcweir 	// we need the point at the start of the attribut
986cdf0e10cSrcweir 	pSh->SwapPam();
987cdf0e10cSrcweir 
988cdf0e10cSrcweir 	pSh->EndCrsrMove();
989cdf0e10cSrcweir }
990cdf0e10cSrcweir 
991cdf0e10cSrcweir /*--------------------------------------------------------------------
992cdf0e10cSrcweir 	 Remind wether the edit boxes for Phonetic reading are changed manually
993cdf0e10cSrcweir  --------------------------------------------------------------------*/
994cdf0e10cSrcweir 
IMPL_LINK(SwIndexMarkDlg,PhoneticEDModifyHdl,Edit *,pEdit)995cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, PhoneticEDModifyHdl, Edit *, pEdit )
996cdf0e10cSrcweir {
997cdf0e10cSrcweir 	if(&aPhoneticED0 == pEdit)
998cdf0e10cSrcweir 	{
999cdf0e10cSrcweir 		bPhoneticED0_ChangedByUser = pEdit->GetText().Len()>0;
1000cdf0e10cSrcweir 	}
1001cdf0e10cSrcweir 	else if(&aPhoneticED1 == pEdit)
1002cdf0e10cSrcweir 	{
1003cdf0e10cSrcweir 		bPhoneticED1_ChangedByUser = pEdit->GetText().Len()>0;
1004cdf0e10cSrcweir 	}
1005cdf0e10cSrcweir 	else if(&aPhoneticED2 == pEdit)
1006cdf0e10cSrcweir 	{
1007cdf0e10cSrcweir 		bPhoneticED2_ChangedByUser = pEdit->GetText().Len()>0;
1008cdf0e10cSrcweir 	}
1009cdf0e10cSrcweir 	return 0;
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir /*--------------------------------------------------------------------
1013cdf0e10cSrcweir 	 Beschreibung: Enable Disable des 2. Schluessels
1014cdf0e10cSrcweir  --------------------------------------------------------------------*/
1015cdf0e10cSrcweir 
IMPL_LINK(SwIndexMarkDlg,KeyDCBModifyHdl,ComboBox *,pBox)1016cdf0e10cSrcweir IMPL_LINK( SwIndexMarkDlg, KeyDCBModifyHdl, ComboBox *, pBox )
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir 	if(&aKeyDCB == pBox)
1019cdf0e10cSrcweir 	{
1020cdf0e10cSrcweir 		sal_Bool bEnable = pBox->GetText().Len() > 0;
1021cdf0e10cSrcweir 		if(!bEnable)
1022cdf0e10cSrcweir 		{
1023cdf0e10cSrcweir 			aKey2DCB.SetText(aEmptyStr);
1024cdf0e10cSrcweir 			aPhoneticED1.SetText(aEmptyStr);
1025cdf0e10cSrcweir 			aPhoneticED2.SetText(aEmptyStr);
1026cdf0e10cSrcweir 			bPhoneticED1_ChangedByUser = sal_False;
1027cdf0e10cSrcweir 			bPhoneticED2_ChangedByUser = sal_False;
1028cdf0e10cSrcweir 		}
1029cdf0e10cSrcweir 		else
1030cdf0e10cSrcweir 		{
1031cdf0e10cSrcweir 			if(pBox->IsInDropDown())
1032cdf0e10cSrcweir 			{
1033cdf0e10cSrcweir 				//reset bPhoneticED1_ChangedByUser if a completly new string is selected
1034cdf0e10cSrcweir 				bPhoneticED1_ChangedByUser = sal_False;
1035cdf0e10cSrcweir 			}
1036cdf0e10cSrcweir 			if(!bPhoneticED1_ChangedByUser)
1037cdf0e10cSrcweir 				aPhoneticED1.SetText(GetDefaultPhoneticReading(pBox->GetText()));
1038cdf0e10cSrcweir 		}
1039cdf0e10cSrcweir 		aKey2DCB.Enable(bEnable);
1040cdf0e10cSrcweir 		aKey2FT.Enable(bEnable);
1041cdf0e10cSrcweir 	}
1042cdf0e10cSrcweir 	else if(&aKey2DCB == pBox)
1043cdf0e10cSrcweir 	{
1044cdf0e10cSrcweir 		if(!(pBox->GetText().Len()>0))
1045cdf0e10cSrcweir 		{
1046cdf0e10cSrcweir 			aPhoneticED2.SetText(aEmptyStr);
1047cdf0e10cSrcweir 			bPhoneticED2_ChangedByUser = sal_False;
1048cdf0e10cSrcweir 		}
1049cdf0e10cSrcweir 		else
1050cdf0e10cSrcweir 		{
1051cdf0e10cSrcweir 			if(pBox->IsInDropDown())
1052cdf0e10cSrcweir 			{
1053cdf0e10cSrcweir 				//reset bPhoneticED1_ChangedByUser if a completly new string is selected
1054cdf0e10cSrcweir 				bPhoneticED2_ChangedByUser = sal_False;
1055cdf0e10cSrcweir 			}
1056cdf0e10cSrcweir 			if(!bPhoneticED2_ChangedByUser)
1057cdf0e10cSrcweir 				aPhoneticED2.SetText(GetDefaultPhoneticReading(pBox->GetText()));
1058cdf0e10cSrcweir 		}
1059cdf0e10cSrcweir 	}
1060cdf0e10cSrcweir 	sal_Bool	bKey1HasText	= (0 != aKeyDCB.GetText().Len());
1061cdf0e10cSrcweir 	sal_Bool	bKey2HasText	= (0 != aKey2DCB.GetText().Len());
1062cdf0e10cSrcweir 
1063cdf0e10cSrcweir 	aPhoneticFT1.Enable(bKey1HasText&&bIsPhoneticReadingEnabled);
1064cdf0e10cSrcweir 	aPhoneticED1.Enable(bKey1HasText&bIsPhoneticReadingEnabled);
1065cdf0e10cSrcweir 	aPhoneticFT2.Enable(bKey2HasText&bIsPhoneticReadingEnabled);
1066cdf0e10cSrcweir 	aPhoneticED2.Enable(bKey2HasText&bIsPhoneticReadingEnabled);
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir 	return 0;
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir /*-----------------25.02.94 21:19-------------------
1072cdf0e10cSrcweir  dtor ueberladen
1073cdf0e10cSrcweir --------------------------------------------------*/
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir 
~SwIndexMarkDlg()1076cdf0e10cSrcweir SwIndexMarkDlg::~SwIndexMarkDlg()
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir 	delete pTOXMgr;
1079cdf0e10cSrcweir 	ViewShell::SetCareWin( 0 );
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir /* -----------------07.09.99 08:41-------------------
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir  --------------------------------------------------*/
ReInitDlg(SwWrtShell & rWrtShell,SwTOXMark * pCurTOXMark)1084cdf0e10cSrcweir void    SwIndexMarkDlg::ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark* pCurTOXMark)
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir 	pSh = &rWrtShell;
1087cdf0e10cSrcweir 	delete pTOXMgr;
1088cdf0e10cSrcweir 	pTOXMgr = new SwTOXMgr(pSh);
1089cdf0e10cSrcweir     if(pCurTOXMark)
1090cdf0e10cSrcweir     {
1091cdf0e10cSrcweir         for(sal_uInt16 i = 0; i < pTOXMgr->GetTOXMarkCount(); i++)
1092cdf0e10cSrcweir             if(pTOXMgr->GetTOXMark(i) == pCurTOXMark)
1093cdf0e10cSrcweir             {
1094cdf0e10cSrcweir                 pTOXMgr->SetCurTOXMark(i);
1095cdf0e10cSrcweir                 break;
1096cdf0e10cSrcweir             }
1097cdf0e10cSrcweir     }
1098cdf0e10cSrcweir     InitControls();
1099cdf0e10cSrcweir }
1100cdf0e10cSrcweir /* -----------------06.10.99 10:00-------------------
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir  --------------------------------------------------*/
SwIndexMarkFloatDlg(SfxBindings * _pBindings,SfxChildWindow * pChild,Window * pParent,SfxChildWinInfo * pInfo,sal_Bool bNew)1103cdf0e10cSrcweir SwIndexMarkFloatDlg::SwIndexMarkFloatDlg(SfxBindings* _pBindings,
1104cdf0e10cSrcweir 				   				SfxChildWindow* pChild,
1105cdf0e10cSrcweir 				   				Window *pParent,
1106cdf0e10cSrcweir 								SfxChildWinInfo* pInfo,
1107cdf0e10cSrcweir 				   				sal_Bool bNew) :
1108cdf0e10cSrcweir SfxModelessDialog(_pBindings, pChild, pParent, SvtCJKOptions().IsCJKFontEnabled()?SW_RES(DLG_INSIDXMARK_CJK):SW_RES(DLG_INSIDXMARK)),
1109cdf0e10cSrcweir     aDlg(this, bNew, SW_RES(WIN_DLG), SvtCJKOptions().IsCJKFontEnabled()?DLG_INSIDXMARK_CJK:DLG_INSIDXMARK, *::GetActiveWrtShell())
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir 	FreeResource();
1112cdf0e10cSrcweir     aDlg.ReInitDlg(*::GetActiveWrtShell());
1113cdf0e10cSrcweir 	Initialize(pInfo);
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir /* -----------------06.10.99 10:27-------------------
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir  --------------------------------------------------*/
Activate()1118cdf0e10cSrcweir void	SwIndexMarkFloatDlg::Activate()
1119cdf0e10cSrcweir {
1120cdf0e10cSrcweir 	SfxModelessDialog::Activate();
1121cdf0e10cSrcweir 	aDlg.Activate();
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir 
ReInitDlg(SwWrtShell & rWrtShell)1124cdf0e10cSrcweir void SwIndexMarkFloatDlg::ReInitDlg(SwWrtShell& rWrtShell)
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir 	aDlg.ReInitDlg( rWrtShell );
1127cdf0e10cSrcweir }
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir /* -----------------06.10.99 10:35-------------------
1130cdf0e10cSrcweir 
1131cdf0e10cSrcweir  --------------------------------------------------*/
SwIndexMarkModalDlg(Window * pParent,SwWrtShell & rSh,SwTOXMark * pCurTOXMark)1132cdf0e10cSrcweir SwIndexMarkModalDlg::SwIndexMarkModalDlg(Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark) :
1133cdf0e10cSrcweir SvxStandardDialog(pParent, SvtCJKOptions().IsCJKFontEnabled()?SW_RES(DLG_EDIT_IDXMARK_CJK):SW_RES(DLG_EDIT_IDXMARK)),
1134cdf0e10cSrcweir     aDlg(this, sal_False, SW_RES(WIN_DLG), SvtCJKOptions().IsCJKFontEnabled()?DLG_EDIT_IDXMARK_CJK:DLG_EDIT_IDXMARK, rSh)
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir 	FreeResource();
1137cdf0e10cSrcweir     aDlg.ReInitDlg(rSh, pCurTOXMark);
1138cdf0e10cSrcweir }
1139cdf0e10cSrcweir /* -----------------06.10.99 10:46-------------------
1140cdf0e10cSrcweir 
1141cdf0e10cSrcweir  --------------------------------------------------*/
Apply()1142cdf0e10cSrcweir void	SwIndexMarkModalDlg::Apply()
1143cdf0e10cSrcweir {
1144cdf0e10cSrcweir 	aDlg.Apply();
1145cdf0e10cSrcweir }
1146cdf0e10cSrcweir /* -----------------16.09.99 14:19-------------------
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir  --------------------------------------------------*/
1149cdf0e10cSrcweir class SwCreateAuthEntryDlg_Impl : public ModalDialog
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir     FixedLine       aEntriesFL;
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir 	FixedText*		pFixedTexts[AUTH_FIELD_END];
1154cdf0e10cSrcweir 	ListBox*		pTypeListBox;
1155cdf0e10cSrcweir 	ComboBox*		pIdentifierBox;
1156cdf0e10cSrcweir 	Edit*			pEdits[AUTH_FIELD_END];
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir     OKButton        aOKBT;
1159cdf0e10cSrcweir 	CancelButton 	aCancelBT;
1160cdf0e10cSrcweir 	HelpButton 		aHelpBT;
1161cdf0e10cSrcweir 
1162cdf0e10cSrcweir 	Link			aShortNameCheckLink;
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir 	SwWrtShell& 	rWrtSh;
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir 	sal_Bool			m_bNewEntryMode;
1167cdf0e10cSrcweir 	sal_Bool			m_bNameAllowed;
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir 	DECL_LINK(IdentifierHdl, ComboBox*);
1170cdf0e10cSrcweir 	DECL_LINK(ShortNameHdl, Edit*);
1171cdf0e10cSrcweir 	DECL_LINK(EnableHdl, ListBox* pBox);
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir public:
1174cdf0e10cSrcweir 	SwCreateAuthEntryDlg_Impl(Window* pParent,
1175cdf0e10cSrcweir 							const String pFields[],
1176cdf0e10cSrcweir 							SwWrtShell& rSh,
1177cdf0e10cSrcweir 							sal_Bool bNewEntry,
1178cdf0e10cSrcweir 							sal_Bool bCreate);
1179cdf0e10cSrcweir 	~SwCreateAuthEntryDlg_Impl();
1180cdf0e10cSrcweir 
1181cdf0e10cSrcweir 	String			GetEntryText(ToxAuthorityField eField) const;
1182cdf0e10cSrcweir 
SetCheckNameHdl(const Link & rLink)1183cdf0e10cSrcweir 	void			SetCheckNameHdl(const Link& rLink) {aShortNameCheckLink = rLink;}
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir };
1186cdf0e10cSrcweir /*-- 15.09.99 08:43:24---------------------------------------------------
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1189cdf0e10cSrcweir struct TextInfo
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir 	sal_uInt16 nToxField;
1192cdf0e10cSrcweir 	const char* pHelpId;
1193cdf0e10cSrcweir };
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir static const TextInfo aTextInfoArr[] =
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir 	{AUTH_FIELD_IDENTIFIER,      HID_AUTH_FIELD_IDENTIFIER      },
1198cdf0e10cSrcweir 	{AUTH_FIELD_AUTHORITY_TYPE,  HID_AUTH_FIELD_AUTHORITY_TYPE  },
1199cdf0e10cSrcweir 	{AUTH_FIELD_AUTHOR,          HID_AUTH_FIELD_AUTHOR          },
1200cdf0e10cSrcweir 	{AUTH_FIELD_TITLE,           HID_AUTH_FIELD_TITLE           },
1201cdf0e10cSrcweir 	{AUTH_FIELD_YEAR,            HID_AUTH_FIELD_YEAR            },
1202cdf0e10cSrcweir 	{AUTH_FIELD_PUBLISHER,       HID_AUTH_FIELD_PUBLISHER       },
1203cdf0e10cSrcweir 	{AUTH_FIELD_ADDRESS,         HID_AUTH_FIELD_ADDRESS         },
1204cdf0e10cSrcweir 	{AUTH_FIELD_ISBN,            HID_AUTH_FIELD_ISBN            },
1205cdf0e10cSrcweir 	{AUTH_FIELD_CHAPTER,         HID_AUTH_FIELD_CHAPTER         },
1206cdf0e10cSrcweir 	{AUTH_FIELD_PAGES,           HID_AUTH_FIELD_PAGES           },
1207cdf0e10cSrcweir 	{AUTH_FIELD_EDITOR,          HID_AUTH_FIELD_EDITOR          },
1208cdf0e10cSrcweir 	{AUTH_FIELD_EDITION,         HID_AUTH_FIELD_EDITION         },
1209cdf0e10cSrcweir 	{AUTH_FIELD_BOOKTITLE,       HID_AUTH_FIELD_BOOKTITLE       },
1210cdf0e10cSrcweir 	{AUTH_FIELD_VOLUME,          HID_AUTH_FIELD_VOLUME          },
1211cdf0e10cSrcweir 	{AUTH_FIELD_HOWPUBLISHED,    HID_AUTH_FIELD_HOWPUBLISHED    },
1212cdf0e10cSrcweir 	{AUTH_FIELD_ORGANIZATIONS,   HID_AUTH_FIELD_ORGANIZATIONS   },
1213cdf0e10cSrcweir 	{AUTH_FIELD_INSTITUTION,     HID_AUTH_FIELD_INSTITUTION     },
1214cdf0e10cSrcweir 	{AUTH_FIELD_SCHOOL,          HID_AUTH_FIELD_SCHOOL          },
1215cdf0e10cSrcweir 	{AUTH_FIELD_REPORT_TYPE,     HID_AUTH_FIELD_REPORT_TYPE     },
1216cdf0e10cSrcweir 	{AUTH_FIELD_MONTH,           HID_AUTH_FIELD_MONTH           },
1217cdf0e10cSrcweir 	{AUTH_FIELD_JOURNAL,         HID_AUTH_FIELD_JOURNAL         },
1218cdf0e10cSrcweir 	{AUTH_FIELD_NUMBER,          HID_AUTH_FIELD_NUMBER          },
1219cdf0e10cSrcweir 	{AUTH_FIELD_SERIES,          HID_AUTH_FIELD_SERIES          },
1220cdf0e10cSrcweir 	{AUTH_FIELD_ANNOTE,          HID_AUTH_FIELD_ANNOTE          },
1221cdf0e10cSrcweir 	{AUTH_FIELD_NOTE,            HID_AUTH_FIELD_NOTE            },
1222cdf0e10cSrcweir 	{AUTH_FIELD_URL,             HID_AUTH_FIELD_URL             },
1223cdf0e10cSrcweir 	{AUTH_FIELD_CUSTOM1,         HID_AUTH_FIELD_CUSTOM1         },
1224cdf0e10cSrcweir 	{AUTH_FIELD_CUSTOM2,         HID_AUTH_FIELD_CUSTOM2         },
1225cdf0e10cSrcweir 	{AUTH_FIELD_CUSTOM3,         HID_AUTH_FIELD_CUSTOM3         },
1226cdf0e10cSrcweir 	{AUTH_FIELD_CUSTOM4,         HID_AUTH_FIELD_CUSTOM4         },
1227cdf0e10cSrcweir 	{AUTH_FIELD_CUSTOM5,         HID_AUTH_FIELD_CUSTOM5         }
1228cdf0e10cSrcweir };
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir sal_Bool SwAuthMarkDlg::bIsFromComponent = sal_True;
1231cdf0e10cSrcweir 
SwAuthMarkDlg(Window * pParent,const ResId & rResId,sal_Bool bNewDlg)1232cdf0e10cSrcweir SwAuthMarkDlg::SwAuthMarkDlg(  Window *pParent,
1233cdf0e10cSrcweir 							   const ResId& rResId,
1234cdf0e10cSrcweir 							   sal_Bool bNewDlg) :
1235cdf0e10cSrcweir 	Window(pParent, rResId),
1236cdf0e10cSrcweir     aFromComponentRB(   this, ResId(RB_FROMCOMPONENT, *rResId.GetResMgr()   )),
1237cdf0e10cSrcweir     aFromDocContentRB(  this, ResId(RB_FROMDOCCONTENT, *rResId.GetResMgr()  )),
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir     aAuthorFT(  this, ResId(FT_AUTHOR, *rResId.GetResMgr()       )),
1240cdf0e10cSrcweir     aAuthorFI(  this, ResId(FI_AUTHOR, *rResId.GetResMgr()   )),
1241cdf0e10cSrcweir     aTitleFT(   this, ResId(FT_TITLE, *rResId.GetResMgr()    )),
1242cdf0e10cSrcweir     aTitleFI(   this, ResId(FI_TITLE, *rResId.GetResMgr()    )),
1243cdf0e10cSrcweir     aEntryFT(   this, ResId(FT_ENTRY, *rResId.GetResMgr()    )),
1244cdf0e10cSrcweir     aEntryED(   this, ResId(ED_ENTRY, *rResId.GetResMgr()   )),
1245cdf0e10cSrcweir     aEntryLB(   this, ResId(LB_ENTRY, *rResId.GetResMgr()   )),
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir     aEntryFL(   this, ResId(FL_ENTRY, *rResId.GetResMgr()    )),
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir     aOKBT(      this, ResId(PB_OK, *rResId.GetResMgr()       )),
1250cdf0e10cSrcweir     aCancelBT(  this, ResId(PB_CANCEL, *rResId.GetResMgr()  )),
1251cdf0e10cSrcweir     aHelpBT(    this, ResId(PB_HELP, *rResId.GetResMgr()    )),
1252cdf0e10cSrcweir     aCreateEntryPB(this,ResId(PB_CREATEENTRY, *rResId.GetResMgr())),
1253cdf0e10cSrcweir     aEditEntryPB(this,  ResId(PB_EDITENTRY, *rResId.GetResMgr())),
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir     sChangeST(  ResId(ST_CHANGE, *rResId.GetResMgr())),
1256cdf0e10cSrcweir     bNewEntry(bNewDlg),
1257cdf0e10cSrcweir     bBibAccessInitialized(sal_False),
1258cdf0e10cSrcweir 
1259cdf0e10cSrcweir     pSh(0)
1260cdf0e10cSrcweir {
1261cdf0e10cSrcweir 	SetStyle(GetStyle()|WB_DIALOGCONTROL);
1262cdf0e10cSrcweir 	FreeResource();
1263cdf0e10cSrcweir 
1264cdf0e10cSrcweir 	aFromComponentRB.SetHelpId(HID_AUTH_MARK_DLG_FROM_COMP_RB);
1265cdf0e10cSrcweir 	aFromDocContentRB.SetHelpId(HID_AUTH_MARK_DLG_FROM_DOC_RB );
1266cdf0e10cSrcweir 	aEntryED.SetHelpId(HID_AUTH_MARK_DLG_ID_LISTBOX           );
1267cdf0e10cSrcweir 	aEntryLB.SetHelpId(HID_AUTH_MARK_DLG_ID_LISTBOX           );
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir 	aFromComponentRB.Show(bNewEntry);
1270cdf0e10cSrcweir 	aFromDocContentRB.Show(bNewEntry);
1271cdf0e10cSrcweir 	aFromComponentRB.Check(bIsFromComponent);
1272cdf0e10cSrcweir 	aFromDocContentRB.Check(!bIsFromComponent);
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir 	aOKBT		.SetHelpId(HID_INSERT_AUTH_MRK_OK   );
1275cdf0e10cSrcweir 	aCancelBT	.SetHelpId(HID_INSERT_AUTH_MRK_CLOSE);
1276cdf0e10cSrcweir 	aEntryED		.SetHelpId(HID_INSERT_AUTH_MRK_ENTRY		);
1277cdf0e10cSrcweir 	aCreateEntryPB  .SetHelpId(HID_INSERT_AUTH_MRK_CREATE_ENTRY	);
1278cdf0e10cSrcweir 	aEditEntryPB    .SetHelpId(HID_INSERT_AUTH_MRK_EDIT_ENTRY	);
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir 	aOKBT.SetClickHdl(LINK(this,SwAuthMarkDlg, InsertHdl));
1281cdf0e10cSrcweir 	aCancelBT.SetClickHdl(LINK(this,SwAuthMarkDlg, CloseHdl));
1282cdf0e10cSrcweir 	aCreateEntryPB.SetClickHdl(LINK(this,SwAuthMarkDlg, CreateEntryHdl));
1283cdf0e10cSrcweir 	aEditEntryPB.SetClickHdl(LINK(this,SwAuthMarkDlg, CreateEntryHdl));
1284cdf0e10cSrcweir 	aFromComponentRB.SetClickHdl(LINK(this,SwAuthMarkDlg, ChangeSourceHdl));
1285cdf0e10cSrcweir 	aFromDocContentRB.SetClickHdl(LINK(this,SwAuthMarkDlg, ChangeSourceHdl));
1286cdf0e10cSrcweir     aEntryED.SetModifyHdl(LINK(this,SwAuthMarkDlg, EditModifyHdl));
1287cdf0e10cSrcweir 
1288cdf0e10cSrcweir 	GetParent()->SetText(String(SW_RES(
1289cdf0e10cSrcweir 					bNewEntry ? STR_AUTHMRK_INSERT : STR_AUTHMRK_EDIT)));
1290cdf0e10cSrcweir 	aEntryED.Show(!bNewEntry);
1291cdf0e10cSrcweir 	aEntryLB.Show(bNewEntry);
1292cdf0e10cSrcweir 	if(!bNewEntry)
1293cdf0e10cSrcweir 	{
1294cdf0e10cSrcweir 		aOKBT.SetText(sChangeST);
1295cdf0e10cSrcweir 	}
1296cdf0e10cSrcweir 	else
1297cdf0e10cSrcweir 	{
1298cdf0e10cSrcweir 		aEntryLB.SetSelectHdl(LINK(this, SwAuthMarkDlg, CompEntryHdl));
1299cdf0e10cSrcweir 	}
1300cdf0e10cSrcweir }
1301cdf0e10cSrcweir /*-- 15.09.99 08:43:25---------------------------------------------------
1302cdf0e10cSrcweir 
1303cdf0e10cSrcweir   -----------------------------------------------------------------------*/
~SwAuthMarkDlg()1304cdf0e10cSrcweir SwAuthMarkDlg::~SwAuthMarkDlg()
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir }
1307cdf0e10cSrcweir /*-- 15.09.99 08:43:25---------------------------------------------------
1308cdf0e10cSrcweir 
1309cdf0e10cSrcweir   -----------------------------------------------------------------------*/
ReInitDlg(SwWrtShell & rWrtShell)1310cdf0e10cSrcweir void	SwAuthMarkDlg::ReInitDlg(SwWrtShell& rWrtShell)
1311cdf0e10cSrcweir {
1312cdf0e10cSrcweir 	pSh = &rWrtShell;
1313cdf0e10cSrcweir 	InitControls();
1314cdf0e10cSrcweir }
1315cdf0e10cSrcweir /* -----------------15.09.99 08:57-------------------
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,CloseHdl,PushButton *,EMPTYARG)1318cdf0e10cSrcweir IMPL_LINK( SwAuthMarkDlg, CloseHdl, PushButton *, EMPTYARG )
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir 	if(bNewEntry)
1321cdf0e10cSrcweir 	{
1322cdf0e10cSrcweir 		sal_uInt16 nSlot = FN_INSERT_AUTH_ENTRY_DLG;
1323cdf0e10cSrcweir 		SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot,
1324cdf0e10cSrcweir 					SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
1325cdf0e10cSrcweir 	}
1326cdf0e10cSrcweir 	else
1327cdf0e10cSrcweir 	{
1328cdf0e10cSrcweir 		((SwAuthMarkModalDlg*)GetParent())->EndDialog(RET_CANCEL);
1329cdf0e10cSrcweir 	}
1330cdf0e10cSrcweir 	return 0;
1331cdf0e10cSrcweir }
1332cdf0e10cSrcweir /* -----------------06.12.99 13:54-------------------
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir  --------------------------------------------------*/
lcl_FindColumnEntry(const beans::PropertyValue * pFields,sal_Int32 nLen,const String & rColumnTitle)1335cdf0e10cSrcweir static String lcl_FindColumnEntry(const beans::PropertyValue* pFields, sal_Int32 nLen, const String& rColumnTitle)
1336cdf0e10cSrcweir {
1337cdf0e10cSrcweir 	String sRet;
1338cdf0e10cSrcweir 	OUString uColumnTitle = rColumnTitle;
1339cdf0e10cSrcweir     for(sal_uInt16 i = 0; i < nLen; i++)
1340cdf0e10cSrcweir 	{
1341cdf0e10cSrcweir         OUString uTmp;
1342cdf0e10cSrcweir         if(pFields[i].Name == uColumnTitle &&
1343cdf0e10cSrcweir             (pFields[i].Value >>= uTmp))
1344cdf0e10cSrcweir 		{
1345cdf0e10cSrcweir 			sRet = String(uTmp);
1346cdf0e10cSrcweir 			break;
1347cdf0e10cSrcweir 		}
1348cdf0e10cSrcweir 	}
1349cdf0e10cSrcweir 	return sRet;
1350cdf0e10cSrcweir }
1351cdf0e10cSrcweir /* -----------------------------07.12.99 15:39--------------------------------
1352cdf0e10cSrcweir 
1353cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,CompEntryHdl,ListBox *,pBox)1354cdf0e10cSrcweir IMPL_LINK( SwAuthMarkDlg, CompEntryHdl, ListBox*, pBox)
1355cdf0e10cSrcweir {
1356cdf0e10cSrcweir 	String sEntry(pBox->GetSelectEntry());
1357cdf0e10cSrcweir 	if(bIsFromComponent)
1358cdf0e10cSrcweir 	{
1359cdf0e10cSrcweir 		if(xBibAccess.is() && sEntry.Len())
1360cdf0e10cSrcweir 		{
1361cdf0e10cSrcweir 			OUString uEntry(sEntry);
1362cdf0e10cSrcweir 			if(xBibAccess->hasByName(uEntry))
1363cdf0e10cSrcweir 			{
1364cdf0e10cSrcweir 				uno::Any aEntry(xBibAccess->getByName(uEntry));
1365cdf0e10cSrcweir                 uno::Sequence<beans::PropertyValue> aFieldProps;
1366cdf0e10cSrcweir                 if(aEntry >>= aFieldProps)
1367cdf0e10cSrcweir 				{
1368cdf0e10cSrcweir 					const beans::PropertyValue* pProps = aFieldProps.getConstArray();
1369cdf0e10cSrcweir                     for(sal_uInt16 i = 0; i < AUTH_FIELD_END && i < aFieldProps.getLength(); i++)
1370cdf0e10cSrcweir 					{
1371cdf0e10cSrcweir 						m_sFields[i] = lcl_FindColumnEntry(
1372cdf0e10cSrcweir 								pProps, aFieldProps.getLength(), m_sColumnTitles[i]);
1373cdf0e10cSrcweir 					}
1374cdf0e10cSrcweir 				}
1375cdf0e10cSrcweir 			}
1376cdf0e10cSrcweir 		}
1377cdf0e10cSrcweir 	}
1378cdf0e10cSrcweir 	else
1379cdf0e10cSrcweir 	{
1380cdf0e10cSrcweir 		if(sEntry.Len())
1381cdf0e10cSrcweir 		{
1382cdf0e10cSrcweir 			const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1383cdf0e10cSrcweir 										pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
1384cdf0e10cSrcweir 			const SwAuthEntry* 	pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : 0;
1385cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1386cdf0e10cSrcweir 				m_sFields[i] = pEntry ?
1387cdf0e10cSrcweir 							pEntry->GetAuthorField((ToxAuthorityField)i) : aEmptyStr;
1388cdf0e10cSrcweir 		}
1389cdf0e10cSrcweir 	}
1390cdf0e10cSrcweir 	if(!pBox->GetSelectEntry().Len())
1391cdf0e10cSrcweir 	{
1392cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1393cdf0e10cSrcweir 			m_sFields[i] = aEmptyStr;
1394cdf0e10cSrcweir 	}
1395cdf0e10cSrcweir 	aAuthorFI.SetText(m_sFields[AUTH_FIELD_AUTHOR]);
1396cdf0e10cSrcweir 	aTitleFI.SetText(m_sFields[AUTH_FIELD_TITLE]);
1397cdf0e10cSrcweir 	return 0;
1398cdf0e10cSrcweir }
1399cdf0e10cSrcweir 
1400cdf0e10cSrcweir /* -----------------15.09.99 08:57-------------------
1401cdf0e10cSrcweir 
1402cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,InsertHdl,PushButton *,EMPTYARG)1403cdf0e10cSrcweir IMPL_LINK( SwAuthMarkDlg, InsertHdl, PushButton *, EMPTYARG )
1404cdf0e10cSrcweir {
1405cdf0e10cSrcweir 	//insert or update the SwAuthorityField...
1406cdf0e10cSrcweir 	if(pSh)
1407cdf0e10cSrcweir 	{
1408cdf0e10cSrcweir 		sal_Bool bDifferent = sal_False;
1409cdf0e10cSrcweir 		DBG_ASSERT(m_sFields[AUTH_FIELD_IDENTIFIER].Len() , "No Id is set!");
1410cdf0e10cSrcweir 		DBG_ASSERT(m_sFields[AUTH_FIELD_AUTHORITY_TYPE].Len() , "No authority type is set!");
1411cdf0e10cSrcweir 		//check if the entry already exists with different content
1412cdf0e10cSrcweir 		const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1413cdf0e10cSrcweir 										pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
1414cdf0e10cSrcweir 		const SwAuthEntry* 	pEntry = pFType ?
1415cdf0e10cSrcweir 				pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER])
1416cdf0e10cSrcweir 				: 0;
1417cdf0e10cSrcweir 		if(pEntry)
1418cdf0e10cSrcweir 		{
1419cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
1420cdf0e10cSrcweir 				bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i);
1421cdf0e10cSrcweir 			if(bDifferent)
1422cdf0e10cSrcweir 			{
1423cdf0e10cSrcweir 				QueryBox aQuery(this, SW_RES(DLG_CHANGE_AUTH_ENTRY));
1424cdf0e10cSrcweir 				if(RET_YES != aQuery.Execute())
1425cdf0e10cSrcweir 					return 0;
1426cdf0e10cSrcweir 			}
1427cdf0e10cSrcweir 		}
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir 		SwFldMgr aMgr(pSh);
1430cdf0e10cSrcweir 		String sFields;
1431cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1432cdf0e10cSrcweir 		{
1433cdf0e10cSrcweir 			sFields += m_sFields[i];
1434cdf0e10cSrcweir 			sFields += TOX_STYLE_DELIMITER;
1435cdf0e10cSrcweir 		}
1436cdf0e10cSrcweir 		if(bNewEntry)
1437cdf0e10cSrcweir 		{
1438cdf0e10cSrcweir 			if(bDifferent)
1439cdf0e10cSrcweir 			{
1440cdf0e10cSrcweir 				SwAuthEntry aNewData;
1441cdf0e10cSrcweir 				for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1442cdf0e10cSrcweir 					aNewData.SetAuthorField((ToxAuthorityField)i, m_sFields[i]);
1443cdf0e10cSrcweir 				pSh->ChangeAuthorityData(&aNewData);
1444cdf0e10cSrcweir 			}
1445cdf0e10cSrcweir             SwInsertFld_Data aData(TYP_AUTHORITY, 0, sFields, aEmptyStr, 0 );
1446cdf0e10cSrcweir             aMgr.InsertFld( aData );
1447cdf0e10cSrcweir 		}
1448cdf0e10cSrcweir 		else if(aMgr.GetCurFld())
1449cdf0e10cSrcweir 		{
1450cdf0e10cSrcweir 			aMgr.UpdateCurFld(0, sFields, aEmptyStr);
1451cdf0e10cSrcweir 		}
1452cdf0e10cSrcweir 	}
1453cdf0e10cSrcweir 	if(!bNewEntry)
1454cdf0e10cSrcweir 		CloseHdl(0);
1455cdf0e10cSrcweir 	return 0;
1456cdf0e10cSrcweir }
1457cdf0e10cSrcweir /* -----------------17.09.99 13:06-------------------
1458cdf0e10cSrcweir 
1459cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,CreateEntryHdl,PushButton *,pButton)1460cdf0e10cSrcweir IMPL_LINK(SwAuthMarkDlg, CreateEntryHdl, PushButton*, pButton)
1461cdf0e10cSrcweir {
1462cdf0e10cSrcweir 	sal_Bool bCreate = pButton == &aCreateEntryPB;
1463cdf0e10cSrcweir 	String sOldId = m_sCreatedEntry[0];
1464cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1465cdf0e10cSrcweir 		m_sCreatedEntry[i] = bCreate ? aEmptyStr : m_sFields[i];
1466cdf0e10cSrcweir 	SwCreateAuthEntryDlg_Impl aDlg(pButton,
1467cdf0e10cSrcweir 				bCreate ? m_sCreatedEntry : m_sFields,
1468cdf0e10cSrcweir 				*pSh, bNewEntry, bCreate);
1469cdf0e10cSrcweir 	if(bNewEntry)
1470cdf0e10cSrcweir 	{
1471cdf0e10cSrcweir 		aDlg.SetCheckNameHdl(LINK(this, SwAuthMarkDlg, IsEntryAllowedHdl));
1472cdf0e10cSrcweir 	}
1473cdf0e10cSrcweir 	if(RET_OK == aDlg.Execute())
1474cdf0e10cSrcweir 	{
1475cdf0e10cSrcweir 		if(bCreate && sOldId.Len())
1476cdf0e10cSrcweir 		{
1477cdf0e10cSrcweir 			aEntryLB.RemoveEntry(sOldId);
1478cdf0e10cSrcweir 		}
1479cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1480cdf0e10cSrcweir 		{
1481cdf0e10cSrcweir 			m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i);
1482cdf0e10cSrcweir 			m_sCreatedEntry[i] = m_sFields[i];
1483cdf0e10cSrcweir 		}
1484cdf0e10cSrcweir 		if(bNewEntry && !aFromDocContentRB.IsChecked())
1485cdf0e10cSrcweir 		{
1486cdf0e10cSrcweir 			aFromDocContentRB.Check(sal_True);
1487cdf0e10cSrcweir 			ChangeSourceHdl(&aFromDocContentRB);
1488cdf0e10cSrcweir 		}
1489cdf0e10cSrcweir 		if(bCreate)
1490cdf0e10cSrcweir 		{
1491cdf0e10cSrcweir 			DBG_ASSERT(LISTBOX_ENTRY_NOTFOUND ==
1492cdf0e10cSrcweir 						aEntryLB.GetEntryPos(m_sFields[AUTH_FIELD_IDENTIFIER]),
1493cdf0e10cSrcweir 						"entry exists!");
1494cdf0e10cSrcweir 			aEntryLB.InsertEntry(m_sFields[AUTH_FIELD_IDENTIFIER]);
1495cdf0e10cSrcweir 			aEntryLB.SelectEntry(m_sFields[AUTH_FIELD_IDENTIFIER]);
1496cdf0e10cSrcweir 		}
1497cdf0e10cSrcweir 		aEntryED.SetText(m_sFields[AUTH_FIELD_IDENTIFIER]);
1498cdf0e10cSrcweir 		aAuthorFI.SetText(m_sFields[AUTH_FIELD_AUTHOR]);
1499cdf0e10cSrcweir 		aTitleFI.SetText(m_sFields[AUTH_FIELD_TITLE]);
1500cdf0e10cSrcweir         aOKBT.Enable();
1501cdf0e10cSrcweir 	}
1502cdf0e10cSrcweir 	return 0;
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir /* -----------------------------20.12.99 14:26--------------------------------
1505cdf0e10cSrcweir 
1506cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,ChangeSourceHdl,RadioButton *,pButton)1507cdf0e10cSrcweir IMPL_LINK(SwAuthMarkDlg, ChangeSourceHdl, RadioButton*, pButton)
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir 	sal_Bool bFromComp = (pButton == &aFromComponentRB);
1510cdf0e10cSrcweir 	bIsFromComponent = bFromComp;
1511cdf0e10cSrcweir 	aCreateEntryPB.Enable(!bIsFromComponent);
1512cdf0e10cSrcweir 	aEntryLB.Clear();
1513cdf0e10cSrcweir 	if(bIsFromComponent)
1514cdf0e10cSrcweir 	{
1515cdf0e10cSrcweir 		if(!bBibAccessInitialized)
1516cdf0e10cSrcweir 		{
1517cdf0e10cSrcweir  			uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
1518cdf0e10cSrcweir 			xBibAccess = uno::Reference< container::XNameAccess > (
1519cdf0e10cSrcweir 							xMSF->createInstance( C2U("com.sun.star.frame.Bibliography") ),
1520cdf0e10cSrcweir 																		uno::UNO_QUERY );
1521cdf0e10cSrcweir 			uno::Reference< beans::XPropertySet >  xPropSet(xBibAccess, uno::UNO_QUERY);
1522cdf0e10cSrcweir 			OUString uPropName(C2U("BibliographyDataFieldNames"));
1523cdf0e10cSrcweir 			if(xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName(uPropName))
1524cdf0e10cSrcweir 			{
1525cdf0e10cSrcweir 				uno::Any aNames = xPropSet->getPropertyValue(uPropName);
1526cdf0e10cSrcweir                 uno::Sequence<beans::PropertyValue> aSeq;
1527cdf0e10cSrcweir                 if( aNames >>= aSeq)
1528cdf0e10cSrcweir 				{
1529cdf0e10cSrcweir                     const beans::PropertyValue* pArr = aSeq.getConstArray();
1530cdf0e10cSrcweir 					for(sal_uInt16 i = 0; i < aSeq.getLength(); i++)
1531cdf0e10cSrcweir 					{
1532cdf0e10cSrcweir 						String sTitle = pArr[i].Name;
1533cdf0e10cSrcweir 						sal_Int16 nField = 0;
1534cdf0e10cSrcweir 						pArr[i].Value >>= nField;
1535cdf0e10cSrcweir 						if(nField >= 0 && nField < AUTH_FIELD_END)
1536cdf0e10cSrcweir 							m_sColumnTitles[nField] = sTitle;
1537cdf0e10cSrcweir 					}
1538cdf0e10cSrcweir 				}
1539cdf0e10cSrcweir 			}
1540cdf0e10cSrcweir 			bBibAccessInitialized = sal_True;
1541cdf0e10cSrcweir 		}
1542cdf0e10cSrcweir 		if(xBibAccess.is())
1543cdf0e10cSrcweir 		{
1544cdf0e10cSrcweir 			uno::Sequence<OUString> aIdentifiers = xBibAccess->getElementNames();
1545cdf0e10cSrcweir 			const OUString* pNames = aIdentifiers.getConstArray();
1546cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < aIdentifiers.getLength(); i++)
1547cdf0e10cSrcweir 			{
1548cdf0e10cSrcweir 				aEntryLB.InsertEntry(pNames[i]);
1549cdf0e10cSrcweir 			}
1550cdf0e10cSrcweir 		}
1551cdf0e10cSrcweir 	}
1552cdf0e10cSrcweir 	else
1553cdf0e10cSrcweir 	{
1554cdf0e10cSrcweir 		const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1555cdf0e10cSrcweir 									pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
1556cdf0e10cSrcweir 		if(pFType)
1557cdf0e10cSrcweir 		{
1558cdf0e10cSrcweir 			SvStringsDtor aIds;
1559cdf0e10cSrcweir 			pFType->GetAllEntryIdentifiers(	aIds );
1560cdf0e10cSrcweir 			for(sal_uInt16 n = 0; n < aIds.Count(); n++)
1561cdf0e10cSrcweir 				aEntryLB.InsertEntry(*aIds.GetObject(n));
1562cdf0e10cSrcweir 		}
1563cdf0e10cSrcweir 		if(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].Len())
1564cdf0e10cSrcweir 			aEntryLB.InsertEntry(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
1565cdf0e10cSrcweir 	}
1566cdf0e10cSrcweir 	aEntryLB.SelectEntryPos(0);
1567cdf0e10cSrcweir 	CompEntryHdl(&aEntryLB);
1568cdf0e10cSrcweir 	return 0;
1569cdf0e10cSrcweir }
1570cdf0e10cSrcweir /* -----------------15.10.2002 13:16-----------------
1571cdf0e10cSrcweir  *
1572cdf0e10cSrcweir  * --------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,EditModifyHdl,Edit *,pEdit)1573cdf0e10cSrcweir IMPL_LINK(SwAuthMarkDlg, EditModifyHdl, Edit*, pEdit)
1574cdf0e10cSrcweir {
1575cdf0e10cSrcweir     Link aAllowed = LINK(this, SwAuthMarkDlg, IsEntryAllowedHdl);
1576cdf0e10cSrcweir     long nResult = aAllowed.Call(pEdit);
1577cdf0e10cSrcweir     aOKBT.Enable(nResult > 0);
1578cdf0e10cSrcweir     if(nResult)
1579cdf0e10cSrcweir     {
1580cdf0e10cSrcweir         String sEntry(pEdit->GetText());
1581cdf0e10cSrcweir         m_sFields[AUTH_FIELD_IDENTIFIER] = sEntry;
1582cdf0e10cSrcweir         m_sCreatedEntry[AUTH_FIELD_IDENTIFIER] = sEntry;
1583cdf0e10cSrcweir     }
1584cdf0e10cSrcweir     return 0;
1585cdf0e10cSrcweir };
1586cdf0e10cSrcweir /* -----------------------------20.12.99 15:11--------------------------------
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SwAuthMarkDlg,IsEntryAllowedHdl,Edit *,pEdit)1589cdf0e10cSrcweir IMPL_LINK(SwAuthMarkDlg, IsEntryAllowedHdl, Edit*, pEdit)
1590cdf0e10cSrcweir {
1591cdf0e10cSrcweir 	String sEntry = pEdit->GetText();
1592cdf0e10cSrcweir 	sal_Bool bAllowed = sal_False;
1593cdf0e10cSrcweir 	if(sEntry.Len())
1594cdf0e10cSrcweir 	{
1595cdf0e10cSrcweir 		if(aEntryLB.GetEntryPos(sEntry) != LISTBOX_ENTRY_NOTFOUND)
1596cdf0e10cSrcweir 			return 0;
1597cdf0e10cSrcweir 		else if(bIsFromComponent)
1598cdf0e10cSrcweir 		{
1599cdf0e10cSrcweir 			const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1600cdf0e10cSrcweir 										pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
1601cdf0e10cSrcweir 			bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
1602cdf0e10cSrcweir 		}
1603cdf0e10cSrcweir 		else
1604cdf0e10cSrcweir 		{
1605cdf0e10cSrcweir 			bAllowed = !xBibAccess.is() || !xBibAccess->hasByName(sEntry);
1606cdf0e10cSrcweir 		}
1607cdf0e10cSrcweir 	}
1608cdf0e10cSrcweir 	return bAllowed;
1609cdf0e10cSrcweir }
1610cdf0e10cSrcweir /* -----------------21.09.99 14:19-------------------
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir  --------------------------------------------------*/
InitControls()1613cdf0e10cSrcweir void SwAuthMarkDlg::InitControls()
1614cdf0e10cSrcweir {
1615cdf0e10cSrcweir 	DBG_ASSERT(pSh, "Shell nicht da?");
1616cdf0e10cSrcweir 	SwField* pField = pSh->GetCurFld();
1617cdf0e10cSrcweir 	ASSERT(bNewEntry || pField, "Keine aktuelle Markierung");
1618cdf0e10cSrcweir 	if(bNewEntry)
1619cdf0e10cSrcweir 	{
1620cdf0e10cSrcweir 		ChangeSourceHdl(aFromComponentRB.IsChecked() ? &aFromComponentRB : &aFromDocContentRB);
1621cdf0e10cSrcweir 		aCreateEntryPB.Enable(!aFromComponentRB.IsChecked());
1622cdf0e10cSrcweir 		if(!aFromComponentRB.IsChecked() && m_sCreatedEntry[0].Len())
1623cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1624cdf0e10cSrcweir 				m_sFields[i] = m_sCreatedEntry[i];
1625cdf0e10cSrcweir 	}
1626cdf0e10cSrcweir 	if(bNewEntry || !pField || pField->GetTyp()->Which() != RES_AUTHORITY)
1627cdf0e10cSrcweir 		return;
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir 	const SwAuthEntry* pEntry = ((SwAuthorityFieldType*)pField->GetTyp())->
1630cdf0e10cSrcweir             GetEntryByHandle(((SwAuthorityField*)pField)->GetHandle());
1631cdf0e10cSrcweir 
1632cdf0e10cSrcweir 	DBG_ASSERT(pEntry, "No authority entry found");
1633cdf0e10cSrcweir 	if(!pEntry)
1634cdf0e10cSrcweir 		return;
1635cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1636cdf0e10cSrcweir 		m_sFields[i] = pEntry->GetAuthorField((ToxAuthorityField)i);
1637cdf0e10cSrcweir 
1638cdf0e10cSrcweir 	aEntryED.SetText(pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER));
1639cdf0e10cSrcweir 	aAuthorFI.SetText(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR));
1640cdf0e10cSrcweir 	aTitleFI.SetText(pEntry->GetAuthorField(AUTH_FIELD_TITLE));
1641cdf0e10cSrcweir }
1642cdf0e10cSrcweir /* -----------------------------05.09.2002 09:44------------------------------
1643cdf0e10cSrcweir 
1644cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
Activate()1645cdf0e10cSrcweir void    SwAuthMarkDlg::Activate()
1646cdf0e10cSrcweir {
1647cdf0e10cSrcweir     aOKBT.Enable(!pSh->HasReadonlySel());
1648cdf0e10cSrcweir     Window::Activate();
1649cdf0e10cSrcweir }
1650cdf0e10cSrcweir /* -----------------16.09.99 14:27-------------------
1651cdf0e10cSrcweir 
1652cdf0e10cSrcweir  --------------------------------------------------*/
SwCreateAuthEntryDlg_Impl(Window * pParent,const String pFields[],SwWrtShell & rSh,sal_Bool bNewEntry,sal_Bool bCreate)1653cdf0e10cSrcweir SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
1654cdf0e10cSrcweir 		const String pFields[],
1655cdf0e10cSrcweir 		SwWrtShell& rSh,
1656cdf0e10cSrcweir 		sal_Bool bNewEntry,
1657cdf0e10cSrcweir 		sal_Bool bCreate) :
1658cdf0e10cSrcweir 	ModalDialog(pParent, SW_RES(DLG_CREATE_AUTH_ENTRY)),
1659cdf0e10cSrcweir     aEntriesFL(this,    SW_RES(FL_ENTRIES    )),
1660cdf0e10cSrcweir     pTypeListBox(0),
1661cdf0e10cSrcweir     pIdentifierBox(0),
1662cdf0e10cSrcweir     aOKBT(this,         SW_RES(PB_OK         )),
1663cdf0e10cSrcweir     aCancelBT(this,     SW_RES(PB_CANCEL        )),
1664cdf0e10cSrcweir     aHelpBT(this,       SW_RES(PB_HELP      )),
1665cdf0e10cSrcweir     rWrtSh(rSh),
1666cdf0e10cSrcweir 	m_bNewEntryMode(bNewEntry),
1667cdf0e10cSrcweir 	m_bNameAllowed(sal_True)
1668cdf0e10cSrcweir {
1669cdf0e10cSrcweir 	FreeResource();
1670cdf0e10cSrcweir     Point aFLPos(aEntriesFL.GetPosPixel());
1671cdf0e10cSrcweir     Point aTL1(aFLPos);
1672cdf0e10cSrcweir     Size aFLSz(aEntriesFL.GetSizePixel().Width(), GetSizePixel().Height());
1673cdf0e10cSrcweir     long nControlSpace = aFLSz.Width() / 4;
1674cdf0e10cSrcweir 	long nControlWidth = nControlSpace - 2 * aTL1.X();
1675cdf0e10cSrcweir 	aTL1.X() *= 2;
1676cdf0e10cSrcweir 	aTL1.Y() *= 5;
1677cdf0e10cSrcweir 	Point aTR1(aTL1);
1678cdf0e10cSrcweir 	aTR1.X() += nControlSpace;
1679cdf0e10cSrcweir 	Point aTL2(aTR1);
1680cdf0e10cSrcweir 	aTL2.X() += nControlSpace;
1681cdf0e10cSrcweir 	Point aTR2(aTL2);
1682cdf0e10cSrcweir 	aTR2.X() += nControlSpace;
1683cdf0e10cSrcweir     Size aFixedTextSize(aFLSz);
1684cdf0e10cSrcweir 	Size aTmpSz(8,10);
1685cdf0e10cSrcweir 	aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
1686cdf0e10cSrcweir 	aFixedTextSize.Height() = aTmpSz.Width();
1687cdf0e10cSrcweir 	Size aEditSize(aFixedTextSize);
1688cdf0e10cSrcweir     aFixedTextSize.Width() = nControlWidth + aFLPos.X();
1689cdf0e10cSrcweir 	aEditSize.Height() = aTmpSz.Height();
1690cdf0e10cSrcweir 	aEditSize.Width() = nControlWidth;
1691cdf0e10cSrcweir 
1692cdf0e10cSrcweir     sal_uInt16 nOffset = static_cast< sal_uInt16 >(aTmpSz.Width() * 3 / 2);
1693cdf0e10cSrcweir 	sal_Bool bLeft = sal_True;
1694cdf0e10cSrcweir     Window* pRefWindow = 0;
1695cdf0e10cSrcweir     for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1696cdf0e10cSrcweir 	{
1697cdf0e10cSrcweir 		const TextInfo aCurInfo = aTextInfoArr[nIndex];
1698cdf0e10cSrcweir 
1699cdf0e10cSrcweir 		pFixedTexts[nIndex] = new FixedText(this);
1700cdf0e10cSrcweir         if(nIndex)
1701cdf0e10cSrcweir             pFixedTexts[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
1702cdf0e10cSrcweir         else
1703cdf0e10cSrcweir             pFixedTexts[nIndex]->SetZOrder( 0, WINDOW_ZORDER_FIRST );
1704cdf0e10cSrcweir 
1705cdf0e10cSrcweir         pRefWindow = pFixedTexts[nIndex];
1706cdf0e10cSrcweir 
1707cdf0e10cSrcweir 		pFixedTexts[nIndex]->SetSizePixel(aFixedTextSize);
1708cdf0e10cSrcweir 		pFixedTexts[nIndex]->SetPosPixel(bLeft ? aTL1 : aTL2);
1709cdf0e10cSrcweir 		pFixedTexts[nIndex]->SetText(SW_RES(STR_AUTH_FIELD_START + aCurInfo.nToxField));
1710cdf0e10cSrcweir 		pFixedTexts[nIndex]->Show();
1711cdf0e10cSrcweir 		pEdits[nIndex] = 0;
1712cdf0e10cSrcweir 		if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
1713cdf0e10cSrcweir 		{
1714cdf0e10cSrcweir 			pTypeListBox = new ListBox(this, WB_DROPDOWN|WB_BORDER);
1715cdf0e10cSrcweir             pTypeListBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
1716cdf0e10cSrcweir             pRefWindow = pTypeListBox;
1717cdf0e10cSrcweir 			for(sal_uInt16 j = 0; j < AUTH_TYPE_END; j++)
1718cdf0e10cSrcweir 				pTypeListBox->InsertEntry(String(SW_RES(STR_AUTH_TYPE_START + j)));
1719cdf0e10cSrcweir 			if(pFields[aCurInfo.nToxField].Len())
1720cdf0e10cSrcweir 			{
1721cdf0e10cSrcweir                 sal_uInt16 nIndexPos = static_cast< sal_uInt16 >(pFields[aCurInfo.nToxField].ToInt32());
1722cdf0e10cSrcweir 				pTypeListBox->SelectEntryPos(nIndexPos);
1723cdf0e10cSrcweir 			}
1724cdf0e10cSrcweir 			Size aTmp(aEditSize);
1725cdf0e10cSrcweir 			aTmp.Height() *= 4;
1726cdf0e10cSrcweir 			pTypeListBox->SetSizePixel(aTmp);
1727cdf0e10cSrcweir 			pTypeListBox->SetPosPixel(bLeft ? aTR1 : aTR2);
1728cdf0e10cSrcweir 			pTypeListBox->Show();
1729cdf0e10cSrcweir 			pTypeListBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
1730cdf0e10cSrcweir 			pTypeListBox->SetHelpId(aCurInfo.pHelpId);
1731cdf0e10cSrcweir 
1732cdf0e10cSrcweir 		}
1733cdf0e10cSrcweir 		else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
1734cdf0e10cSrcweir 		{
1735cdf0e10cSrcweir             pIdentifierBox = new ComboBox(this, WB_BORDER|WB_DROPDOWN);
1736cdf0e10cSrcweir             pIdentifierBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
1737cdf0e10cSrcweir             pRefWindow = pIdentifierBox;
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir 			pIdentifierBox->SetSelectHdl(LINK(this,
1740cdf0e10cSrcweir 									SwCreateAuthEntryDlg_Impl, IdentifierHdl));
1741cdf0e10cSrcweir 
1742cdf0e10cSrcweir 
1743cdf0e10cSrcweir 			const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1744cdf0e10cSrcweir 										rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
1745cdf0e10cSrcweir 			if(pFType)
1746cdf0e10cSrcweir 			{
1747cdf0e10cSrcweir 				SvStringsDtor aIds;
1748cdf0e10cSrcweir 				pFType->GetAllEntryIdentifiers(	aIds );
1749cdf0e10cSrcweir 				for(sal_uInt16 n = 0; n < aIds.Count(); n++)
1750cdf0e10cSrcweir 					pIdentifierBox->InsertEntry(*aIds.GetObject(n));
1751cdf0e10cSrcweir 			}
1752cdf0e10cSrcweir 			pIdentifierBox->SetText(pFields[aCurInfo.nToxField]);
1753cdf0e10cSrcweir 			Size aTmp(aEditSize);
1754cdf0e10cSrcweir 			aTmp.Height() *= 4;
1755cdf0e10cSrcweir 			pIdentifierBox->SetSizePixel(aTmp);
1756cdf0e10cSrcweir 			pIdentifierBox->SetPosPixel(bLeft ? aTR1 : aTR2);
1757cdf0e10cSrcweir 			pIdentifierBox->Show();
1758cdf0e10cSrcweir 			pIdentifierBox->SetHelpId(aCurInfo.pHelpId);
1759cdf0e10cSrcweir 		}
1760cdf0e10cSrcweir 		else
1761cdf0e10cSrcweir 		{
1762cdf0e10cSrcweir 			pEdits[nIndex] = new Edit(this, WB_BORDER);
1763cdf0e10cSrcweir             pEdits[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
1764cdf0e10cSrcweir             pRefWindow = pEdits[nIndex];
1765cdf0e10cSrcweir             pEdits[nIndex]->SetSizePixel(aEditSize);
1766cdf0e10cSrcweir 			pEdits[nIndex]->SetPosPixel(bLeft ? aTR1 : aTR2);
1767cdf0e10cSrcweir 			pEdits[nIndex]->SetText(pFields[aCurInfo.nToxField]);
1768cdf0e10cSrcweir 			pEdits[nIndex]->Show();
1769cdf0e10cSrcweir 			pEdits[nIndex]->SetHelpId(aCurInfo.pHelpId);
1770cdf0e10cSrcweir 			if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
1771cdf0e10cSrcweir 			{
1772cdf0e10cSrcweir 				pEdits[nIndex]->SetModifyHdl(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
1773cdf0e10cSrcweir 				m_bNameAllowed = pFields[nIndex].Len() > 0;
1774cdf0e10cSrcweir 				if(!bCreate)
1775cdf0e10cSrcweir 				{
1776cdf0e10cSrcweir 					pFixedTexts[nIndex]->Enable(sal_False);
1777cdf0e10cSrcweir 					pEdits[nIndex]->Enable(sal_False);
1778cdf0e10cSrcweir 				}
1779cdf0e10cSrcweir 			}
1780cdf0e10cSrcweir 		}
1781cdf0e10cSrcweir 		if(bLeft)
1782cdf0e10cSrcweir 		{
1783cdf0e10cSrcweir 			aTL1.Y() += nOffset;
1784cdf0e10cSrcweir 			aTR1.Y() += nOffset;
1785cdf0e10cSrcweir 		}
1786cdf0e10cSrcweir 		else
1787cdf0e10cSrcweir 		{
1788cdf0e10cSrcweir 			aTL2.Y() += nOffset;
1789cdf0e10cSrcweir 			aTR2.Y() += nOffset;
1790cdf0e10cSrcweir 		}
1791cdf0e10cSrcweir 		bLeft = !bLeft;
1792cdf0e10cSrcweir 	}
1793cdf0e10cSrcweir 	EnableHdl(pTypeListBox);
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir     long nHeightDiff = - aFLSz.Height();
1796cdf0e10cSrcweir     aFLSz.Height() = aTL1.Y();
1797cdf0e10cSrcweir     nHeightDiff += aFLSz.Height();
1798cdf0e10cSrcweir //    aEntriesFL.SetSizePixel(aFLSz);
1799cdf0e10cSrcweir 	Size aDlgSize(GetSizePixel());
1800cdf0e10cSrcweir 	aDlgSize.Height() += nHeightDiff;
1801cdf0e10cSrcweir     SetSizePixel(aDlgSize);
1802cdf0e10cSrcweir 
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir /* -----------------16.09.99 14:47-------------------
1805cdf0e10cSrcweir 
1806cdf0e10cSrcweir  --------------------------------------------------*/
~SwCreateAuthEntryDlg_Impl()1807cdf0e10cSrcweir SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
1808cdf0e10cSrcweir {
1809cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1810cdf0e10cSrcweir 	{
1811cdf0e10cSrcweir 		delete pFixedTexts[i];
1812cdf0e10cSrcweir 		delete pEdits[i];
1813cdf0e10cSrcweir 	}
1814cdf0e10cSrcweir 	delete pTypeListBox;
1815cdf0e10cSrcweir 	delete pIdentifierBox;
1816cdf0e10cSrcweir }
1817cdf0e10cSrcweir /* -----------------16.09.99 14:27-------------------
1818cdf0e10cSrcweir 
1819cdf0e10cSrcweir  --------------------------------------------------*/
GetEntryText(ToxAuthorityField eField) const1820cdf0e10cSrcweir String	SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
1821cdf0e10cSrcweir {
1822cdf0e10cSrcweir 	String sRet;
1823cdf0e10cSrcweir 	if( AUTH_FIELD_AUTHORITY_TYPE == eField )
1824cdf0e10cSrcweir 	{
1825cdf0e10cSrcweir 		DBG_ASSERT(pTypeListBox, "No ListBox");
1826cdf0e10cSrcweir 		sRet = String::CreateFromInt32(pTypeListBox->GetSelectEntryPos());
1827cdf0e10cSrcweir 	}
1828cdf0e10cSrcweir 	else if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
1829cdf0e10cSrcweir 	{
1830cdf0e10cSrcweir 		DBG_ASSERT(pIdentifierBox, "No ComboBox");
1831cdf0e10cSrcweir 		sRet = pIdentifierBox->GetText();
1832cdf0e10cSrcweir 	}
1833cdf0e10cSrcweir 	else
1834cdf0e10cSrcweir 	{
1835cdf0e10cSrcweir 		for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
1836cdf0e10cSrcweir 		{
1837cdf0e10cSrcweir 			const TextInfo aCurInfo = aTextInfoArr[nIndex];
1838cdf0e10cSrcweir 			if(aCurInfo.nToxField == eField)
1839cdf0e10cSrcweir 			{
1840cdf0e10cSrcweir 				sRet = pEdits[nIndex]->GetText();
1841cdf0e10cSrcweir 				break;
1842cdf0e10cSrcweir 			}
1843cdf0e10cSrcweir 		}
1844cdf0e10cSrcweir 	}
1845cdf0e10cSrcweir 	return sRet;
1846cdf0e10cSrcweir }
1847cdf0e10cSrcweir /* -----------------21.09.99 13:54-------------------
1848cdf0e10cSrcweir 
1849cdf0e10cSrcweir  --------------------------------------------------*/
IMPL_LINK(SwCreateAuthEntryDlg_Impl,IdentifierHdl,ComboBox *,pBox)1850cdf0e10cSrcweir IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox*, pBox)
1851cdf0e10cSrcweir {
1852cdf0e10cSrcweir 	const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
1853cdf0e10cSrcweir 								rWrtSh.GetFldType(RES_AUTHORITY, aEmptyStr);
1854cdf0e10cSrcweir 	if(pFType)
1855cdf0e10cSrcweir 	{
1856cdf0e10cSrcweir 		const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
1857cdf0e10cSrcweir 														pBox->GetText());
1858cdf0e10cSrcweir 		if(pEntry)
1859cdf0e10cSrcweir 		{
1860cdf0e10cSrcweir 			for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
1861cdf0e10cSrcweir 			{
1862cdf0e10cSrcweir 				if(AUTH_FIELD_IDENTIFIER == i)
1863cdf0e10cSrcweir 					continue;
1864cdf0e10cSrcweir 				if(AUTH_FIELD_AUTHORITY_TYPE == i)
1865cdf0e10cSrcweir 					pTypeListBox->SelectEntry(
1866cdf0e10cSrcweir 								pEntry->GetAuthorField((ToxAuthorityField)i));
1867cdf0e10cSrcweir 				else
1868cdf0e10cSrcweir 					pEdits[i]->SetText(
1869cdf0e10cSrcweir 								pEntry->GetAuthorField((ToxAuthorityField)i));
1870cdf0e10cSrcweir 			}
1871cdf0e10cSrcweir 		}
1872cdf0e10cSrcweir 	}
1873cdf0e10cSrcweir 	return 0;
1874cdf0e10cSrcweir }
1875cdf0e10cSrcweir /* -----------------------------20.12.99 15:07--------------------------------
1876cdf0e10cSrcweir 
1877cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1878cdf0e10cSrcweir 
IMPL_LINK(SwCreateAuthEntryDlg_Impl,ShortNameHdl,Edit *,pEdit)1879cdf0e10cSrcweir IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, Edit*, pEdit)
1880cdf0e10cSrcweir {
1881cdf0e10cSrcweir 	if(aShortNameCheckLink.IsSet())
1882cdf0e10cSrcweir 	{
1883cdf0e10cSrcweir 		sal_Bool bEnable = 0 != aShortNameCheckLink.Call(pEdit);
1884cdf0e10cSrcweir 		m_bNameAllowed |= bEnable;
1885cdf0e10cSrcweir 		aOKBT.Enable(pTypeListBox->GetSelectEntryCount() && bEnable);
1886cdf0e10cSrcweir 	}
1887cdf0e10cSrcweir 	return 0;
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir /* -----------------------------20.12.99 15:54--------------------------------
1890cdf0e10cSrcweir 
1891cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SwCreateAuthEntryDlg_Impl,EnableHdl,ListBox *,pBox)1892cdf0e10cSrcweir IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, ListBox*, pBox)
1893cdf0e10cSrcweir {
1894cdf0e10cSrcweir 	aOKBT.Enable(m_bNameAllowed && pBox->GetSelectEntryCount());
1895cdf0e10cSrcweir 	return 0;
1896cdf0e10cSrcweir };
1897cdf0e10cSrcweir /* -----------------06.10.99 10:00-------------------
1898cdf0e10cSrcweir 
1899cdf0e10cSrcweir  --------------------------------------------------*/
SwAuthMarkFloatDlg(SfxBindings * _pBindings,SfxChildWindow * pChild,Window * pParent,SfxChildWinInfo * pInfo,sal_Bool bNew)1900cdf0e10cSrcweir SwAuthMarkFloatDlg::SwAuthMarkFloatDlg(SfxBindings* _pBindings,
1901cdf0e10cSrcweir 				   				SfxChildWindow* pChild,
1902cdf0e10cSrcweir 				   				Window *pParent,
1903cdf0e10cSrcweir 								SfxChildWinInfo* pInfo,
1904cdf0e10cSrcweir 				   				sal_Bool bNew) :
1905cdf0e10cSrcweir     SfxModelessDialog(_pBindings, pChild, pParent, SW_RES(DLG_INSAUTHMARK)),
1906cdf0e10cSrcweir     aDlg(this, SW_RES(WIN_DLG), bNew)
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir 	FreeResource();
1909cdf0e10cSrcweir 	Initialize(pInfo);
1910cdf0e10cSrcweir 	SwWrtShell* pWrtShell = ::GetActiveWrtShell();
1911cdf0e10cSrcweir 	DBG_ASSERT(pWrtShell, "No shell?");
1912cdf0e10cSrcweir 	aDlg.ReInitDlg(*pWrtShell);
1913cdf0e10cSrcweir }
1914cdf0e10cSrcweir /* -----------------06.10.99 10:27-------------------
1915cdf0e10cSrcweir 
1916cdf0e10cSrcweir  --------------------------------------------------*/
Activate()1917cdf0e10cSrcweir void	SwAuthMarkFloatDlg::Activate()
1918cdf0e10cSrcweir {
1919cdf0e10cSrcweir 	SfxModelessDialog::Activate();
1920cdf0e10cSrcweir 	aDlg.Activate();
1921cdf0e10cSrcweir }
1922cdf0e10cSrcweir 
ReInitDlg(SwWrtShell & rWrtShell)1923cdf0e10cSrcweir void SwAuthMarkFloatDlg::ReInitDlg(SwWrtShell& rWrtShell)
1924cdf0e10cSrcweir {
1925cdf0e10cSrcweir 	aDlg.ReInitDlg( rWrtShell );
1926cdf0e10cSrcweir }
1927cdf0e10cSrcweir 
1928cdf0e10cSrcweir /* -----------------06.10.99 10:35-------------------
1929cdf0e10cSrcweir 
1930cdf0e10cSrcweir  --------------------------------------------------*/
SwAuthMarkModalDlg(Window * pParent,SwWrtShell & rSh)1931cdf0e10cSrcweir SwAuthMarkModalDlg::SwAuthMarkModalDlg(Window *pParent, SwWrtShell& rSh) :
1932cdf0e10cSrcweir 	SvxStandardDialog(pParent, SW_RES(DLG_EDIT_AUTHMARK)),
1933cdf0e10cSrcweir 	aDlg(this, SW_RES(WIN_DLG), sal_False)
1934cdf0e10cSrcweir {
1935cdf0e10cSrcweir 	FreeResource();
1936cdf0e10cSrcweir 	aDlg.ReInitDlg(rSh);
1937cdf0e10cSrcweir }
1938cdf0e10cSrcweir /* -----------------06.10.99 10:46-------------------
1939cdf0e10cSrcweir 
1940cdf0e10cSrcweir  --------------------------------------------------*/
Apply()1941cdf0e10cSrcweir void	SwAuthMarkModalDlg::Apply()
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir 	aDlg.InsertHdl(0);
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir 
1946