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