update dev300-m58
[ooovba.git] / sw / source / ui / fldui / fldvar.cxx
blob0c3a3e070a7c28ca4de28bb272652a86a7da4135
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fldvar.cxx,v $
10 * $Revision: 1.21 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
35 #endif
38 #include <swtypes.hxx>
39 #include <sfx2/linkmgr.hxx>
40 #include <usrfld.hxx>
41 #include <docufld.hxx>
42 #include <expfld.hxx>
43 #include <ddefld.hxx>
44 #ifndef _VIEW_HXX
45 #include <view.hxx>
46 #endif
47 #include <wrtsh.hxx>
48 #include <doc.hxx>
49 #include <docary.hxx>
50 #include <swmodule.hxx>
51 #ifndef _FLDVAR_HXX
52 #include <fldvar.hxx>
53 #endif
54 #include <calc.hxx>
55 #include <svtools/zformat.hxx>
56 #ifndef _GLOBALS_HRC
57 #include <globals.hrc>
58 #endif
59 #ifndef _FLDUI_HRC
60 #include <fldui.hrc>
61 #endif
62 #ifndef _FLDTDLG_HRC
63 #include <fldtdlg.hrc>
64 #endif
66 #define USER_DATA_VERSION_1 "1"
67 #define USER_DATA_VERSION USER_DATA_VERSION_1
68 /*--------------------------------------------------------------------
69 Beschreibung:
70 --------------------------------------------------------------------*/
72 SwFldVarPage::SwFldVarPage(Window* pParent, const SfxItemSet& rCoreSet ) :
73 SwFldPage ( pParent, SW_RES( TP_FLD_VAR ), rCoreSet ),
74 aTypeFT (this, SW_RES(FT_VARTYPE)),
75 aTypeLB (this, SW_RES(LB_VARTYPE)),
76 aSelectionFT (this, SW_RES(FT_VARSELECTION)),
77 aSelectionLB (this, SW_RES(LB_VARSELECTION)),
78 aNameFT (this, SW_RES(FT_VARNAME)),
79 aNameED (this, SW_RES(ED_VARNAME)),
80 aValueFT (this, SW_RES(FT_VARVALUE)),
81 aValueED (this, SW_RES(ED_VARVALUE)),
82 aFormatFT (this, SW_RES(FT_VARFORMAT)),
83 aNumFormatLB (this, SW_RES(LB_VARNUMFORMAT)),
84 aFormatLB (this, SW_RES(LB_VARFORMAT)),
85 aChapterHeaderFT(this, SW_RES(FT_VARCHAPTERHEADER)),
86 aChapterLevelFT (this, SW_RES(FT_VARCHAPTERLEVEL)),
87 aChapterLevelLB (this, SW_RES(LB_VARCHAPTERLEVEL)),
88 aInvisibleCB (this, SW_RES(CB_VARINVISIBLE)),
89 aSeparatorFT (this, SW_RES(FT_VARSEPARATOR)),
90 aSeparatorED (this, SW_RES(ED_VARSEPARATOR)),
91 aNewDelTBX (this, SW_RES(TBX_VARNEWDEL)),
92 bInit (TRUE)
94 FreeResource();
96 aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() );
98 long nDelta = ( aValueED.GetSizePixel().Height() -
99 aNewDelTBX.GetSizePixel().Height() ) / 2;
100 Point aNewPnt = aNewDelTBX.GetPosPixel();
101 aNewPnt.Y() += nDelta;
102 aNewDelTBX.SetPosPixel( aNewPnt );
104 sOldValueFT = aValueFT.GetText();
105 sOldNameFT = aNameFT.GetText();
107 for (USHORT i = 1; i <= MAXLEVEL; i++)
108 aChapterLevelLB.InsertEntry(String::CreateFromInt32(i));
110 aChapterLevelLB.SelectEntryPos(0);
111 //enable 'active' language selection
112 aNumFormatLB.SetShowLanguageControl(TRUE);
115 /*--------------------------------------------------------------------
116 Beschreibung:
117 --------------------------------------------------------------------*/
119 SwFldVarPage::~SwFldVarPage()
123 /*--------------------------------------------------------------------
124 Beschreibung:
125 --------------------------------------------------------------------*/
127 void SwFldVarPage::Reset(const SfxItemSet& )
129 SavePos(&aTypeLB);
131 Init(); // Allgemeine initialisierung
133 aTypeLB.SetUpdateMode(FALSE);
134 aTypeLB.Clear();
136 USHORT nPos, nTypeId;
138 if (!IsFldEdit())
140 // TypeListBox initialisieren
141 const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
143 for (short i = rRg.nStart; i < rRg.nEnd; ++i)
145 nTypeId = GetFldMgr().GetTypeId(i);
146 nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
147 aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
150 else
152 SwField* pCurField = GetCurField();
153 nTypeId = pCurField->GetTypeId();
154 if (nTypeId == TYP_SETINPFLD)
155 nTypeId = TYP_INPUTFLD;
156 nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
157 aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
158 aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
159 SwWrtShell *pSh = GetWrtShell();
160 if(!pSh)
161 pSh = ::GetActiveWrtShell();
162 if(pSh)
164 const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
165 if(pFormat)
166 aNumFormatLB.SetLanguage(pFormat->GetLanguage());
170 // alte Pos selektieren
171 RestorePos(&aTypeLB);
173 aTypeLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
174 aTypeLB.SetSelectHdl (LINK(this, SwFldVarPage, TypeHdl));
175 aSelectionLB.SetSelectHdl (LINK(this, SwFldVarPage, SubTypeHdl));
176 aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
177 aFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
178 aNumFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
179 aNameED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
180 aValueED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
181 aNewDelTBX.SetClickHdl (LINK(this, SwFldVarPage, TBClickHdl));
182 aChapterLevelLB.SetSelectHdl (LINK(this, SwFldVarPage, ChapterHdl));
183 aSeparatorED.SetModifyHdl (LINK(this, SwFldVarPage, SeparatorHdl));
185 if( !IsRefresh() )
187 String sUserData = GetUserData();
188 if(!IsRefresh() && sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
190 String sVal = sUserData.GetToken(1, ';');
191 USHORT nVal = (USHORT)sVal.ToInt32();
192 if( USHRT_MAX != nVal )
194 for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
195 if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
197 aTypeLB.SelectEntryPos(i);
198 break;
203 TypeHdl(0);
205 aTypeLB.SetUpdateMode(TRUE);
207 if (IsFldEdit())
209 aSelectionLB.SaveValue();
210 aFormatLB.SaveValue();
211 nOldFormat = aNumFormatLB.GetFormat();
212 aNameED.SaveValue();
213 aValueED.SaveValue();
214 aInvisibleCB.SaveValue();
215 aChapterLevelLB.SaveValue();
216 aSeparatorED.SaveValue();
220 /*--------------------------------------------------------------------
221 Beschreibung:
222 --------------------------------------------------------------------*/
224 IMPL_LINK( SwFldVarPage, TypeHdl, ListBox *, EMPTYARG )
226 // Alte ListBoxPos sichern
227 const USHORT nOld = GetTypeSel();
229 // Aktuelle ListBoxPos
230 SetTypeSel(aTypeLB.GetSelectEntryPos());
232 if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
234 SetTypeSel(0);
235 aTypeLB.SelectEntryPos(0);
238 if (nOld != GetTypeSel() || nOld == LISTBOX_ENTRY_NOTFOUND)
240 bInit = TRUE;
241 if (nOld != LISTBOX_ENTRY_NOTFOUND)
243 aNameED.SetText(aEmptyStr);
244 aValueED.SetText(aEmptyStr);
247 aValueED.SetDropEnable(FALSE);
248 UpdateSubType(); // Auswahl-Listboxen initialisieren
251 bInit = FALSE;
253 return 0;
256 /*--------------------------------------------------------------------
257 Beschreibung:
258 --------------------------------------------------------------------*/
260 IMPL_LINK( SwFldVarPage, SubTypeHdl, ListBox *, pBox )
262 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
263 USHORT nSelPos = aSelectionLB.GetSelectEntryPos();
265 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
266 nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
268 if (IsFldEdit() && (!pBox || bInit))
270 if (nTypeId != TYP_FORMELFLD)
271 aNameED.SetText(GetFldMgr().GetCurFldPar1());
273 aValueED.SetText(GetFldMgr().GetCurFldPar2());
276 if (aNameFT.GetText() != sOldNameFT)
277 aNameFT.SetText(sOldNameFT);
278 if (aValueFT.GetText() != sOldValueFT)
279 aValueFT.SetText(sOldValueFT);
281 aNumFormatLB.SetUpdateMode(FALSE);
282 aFormatLB.SetUpdateMode(FALSE);
283 FillFormatLB(nTypeId);
285 USHORT nSize = aFormatLB.GetEntryCount();
287 BOOL bValue = FALSE, bName = FALSE, bNumFmt = FALSE,
288 bInvisible = FALSE, bSeparator = FALSE, bChapterLevel = FALSE;
289 BOOL bFormat = nSize != 0;
291 switch (nTypeId)
293 case TYP_USERFLD:
295 // Benutzertyp aendern oder anlegen
296 SwUserFieldType* pType = (SwUserFieldType*)
297 GetFldMgr().GetFldType(RES_USERFLD, nSelPos);
299 if (pType)
301 if (!IsFldEdit())
303 if (pBox || (bInit && !IsRefresh())) // Nur bei Interaktion mit Maus
305 aNameED.SetText(pType->GetName());
307 if (pType->GetType() == UF_STRING)
309 aValueED.SetText(pType->GetContent());
310 aNumFormatLB.SelectEntryPos(0);
312 else
313 aValueED.SetText(pType->GetContent());
314 // aValueED.SetText(pType->GetContent(aNumFormatLB.GetFormat()));
317 else
318 aValueED.SetText(pType->GetContent());
320 else
322 if (pBox) // Nur bei Interaktion mit Maus
324 aNameED.SetText(aEmptyStr);
325 aValueED.SetText(aEmptyStr);
328 bValue = bName = bNumFmt = bInvisible = TRUE;
330 aValueED.SetDropEnable(TRUE);
331 break;
334 case TYP_SETFLD:
335 bValue = TRUE;
337 bNumFmt = bInvisible = TRUE;
339 if (!IsFldDlgHtmlMode())
340 bName = TRUE;
341 else
343 aNumFormatLB.Clear();
344 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
345 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
346 aNumFormatLB.SelectEntryPos(0);
348 // gibt es ein entprechendes SetField
349 if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
351 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
353 String sName(aSelectionLB.GetSelectEntry());
354 aNameED.SetText(sName);
356 if (!IsFldDlgHtmlMode())
358 SwWrtShell *pSh = GetWrtShell();
359 if(!pSh)
360 pSh = ::GetActiveWrtShell();
361 if(pSh)
363 SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
364 pSh->GetFldType(RES_SETEXPFLD, sName);
366 if (pSetTyp && pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING)
367 aNumFormatLB.SelectEntryPos(0); // Textuell
372 if (IsFldEdit())
374 // GetFormula fuehrt bei Datumsformaten zu Problemen,
375 // da nur der numerische Wert ohne Formatierung returned wird.
376 // Muss aber verwendet werden, da sonst bei GetPar2 nur der vom
377 // Kalkulator errechnete Wert angezeigt werden wuerde
378 // (statt test2 = test + 1)
379 aValueED.SetText(((SwSetExpField*)GetCurField())->GetFormula());
381 aValueED.SetDropEnable(TRUE);
382 break;
384 case TYP_FORMELFLD:
386 bValue = TRUE;
387 bNumFmt = TRUE;
388 aValueFT.SetText(SW_RESSTR(STR_FORMULA));
389 aValueED.SetDropEnable(TRUE);
391 break;
393 case TYP_GETFLD:
395 if (!IsFldEdit())
397 aNameED.SetText(aEmptyStr);
398 aValueED.SetText(aEmptyStr);
401 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
403 String sName(aSelectionLB.GetSelectEntry());
404 if (!IsFldEdit())
405 aNameED.SetText(sName);
407 // gibt es ein entprechendes SetField
408 SwWrtShell *pSh = GetWrtShell();
409 if(!pSh)
410 pSh = ::GetActiveWrtShell();
411 if(pSh)
413 SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
414 pSh->GetFldType(RES_SETEXPFLD, sName);
416 if(pSetTyp)
418 if (pSetTyp->GetType() & nsSwGetSetExpType::GSE_STRING) // Textuell?
419 bFormat = TRUE;
420 else // Numerisch
421 bNumFmt = TRUE;
425 else
426 bFormat = FALSE;
428 EnableInsert(bFormat|bNumFmt);
430 break;
432 case TYP_INPUTFLD:
433 aValueFT.SetText(SW_RESSTR(STR_PROMPT));
435 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
437 bValue = bNumFmt = TRUE;
439 String sName;
441 sName = aSelectionLB.GetSelectEntry();
442 aNameED.SetText( sName );
444 // User- oder SetField ?
445 USHORT nInpType = 0;
446 nInpType = static_cast< USHORT >(GetFldMgr().GetFldType(RES_USERFLD, sName) ? 0 : TYP_SETINPFLD);
448 if (nInpType) // SETEXPFLD
450 // gibt es ein entprechendes SetField
451 SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
452 GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
454 if(pSetTyp)
456 if (pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING) // Textuell?
458 aNumFormatLB.Clear();
460 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_TEXT), 0);
461 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
462 aNumFormatLB.SelectEntryPos(0);
465 if (IsFldEdit() && (!pBox || bInit) )
466 aValueED.SetText(((SwSetExpField*)GetCurField())->GetPromptText());
468 else // USERFLD
469 bFormat = bNumFmt = FALSE;
471 break;
473 case TYP_DDEFLD:
474 aValueFT.SetText(SW_RESSTR(STR_DDE_CMD));
476 if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
478 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
480 SwDDEFieldType* pType =
481 (SwDDEFieldType*) GetFldMgr().GetFldType(RES_DDEFLD, nSelPos);
483 if(pType)
485 aNameED.SetText(pType->GetName());
487 //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
488 // Namen haben! Wird hier noch nicht beachtet
489 String sCmd( pType->GetCmd() );
490 USHORT nTmpPos = sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ' );
491 sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ', nTmpPos );
493 aValueED.SetText( sCmd );
494 aFormatLB.SelectEntryPos(pType->GetType());
498 bName = bValue = TRUE;
499 break;
501 case TYP_SEQFLD:
503 // aNumRB.Check(TRUE);
504 bName = bValue = bSeparator = bChapterLevel = TRUE;
506 SwFieldType* pFldTyp;
507 if( IsFldEdit() )
508 pFldTyp = GetCurField()->GetTyp();
509 else
511 String sFldTypeName( aSelectionLB.GetEntry( nSelPos ));
512 if( sFldTypeName.Len() )
513 pFldTyp = GetFldMgr().GetFldType( RES_SETEXPFLD,
514 sFldTypeName );
515 else
516 pFldTyp = 0;
519 if( IsFldEdit() )
520 aValueED.SetText( ((SwSetExpField*)GetCurField())->
521 GetFormula() );
523 if( IsFldEdit() || pBox ) // Nur bei Interaktion mit Maus
524 aNameED.SetText( aSelectionLB.GetSelectEntry() );
526 if( pFldTyp )
528 BYTE nLevel = ((SwSetExpFieldType*)pFldTyp)->GetOutlineLvl();
529 if( 0x7f == nLevel )
530 aChapterLevelLB.SelectEntryPos( 0 );
531 else
532 aChapterLevelLB.SelectEntryPos( nLevel + 1 );
533 String sDelim = ((SwSetExpFieldType*)pFldTyp)->GetDelimiter();
534 aSeparatorED.SetText( sDelim );
535 ChapterHdl();
538 break;
540 case TYP_SETREFPAGEFLD:
542 bValue = FALSE;
543 aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
545 if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
546 aNameED.SetText(aEmptyStr);
548 if (nSelPos != 0 && nSelPos != LISTBOX_ENTRY_NOTFOUND)
550 bValue = TRUE; // SubType OFF - kennt keinen Offset
551 if (IsFldEdit())
552 aValueED.SetText(String::CreateFromInt32(((SwRefPageSetField*)GetCurField())->GetOffset()));
555 break;
557 case TYP_GETREFPAGEFLD:
558 aNameED.SetText(aEmptyStr);
559 aValueED.SetText(aEmptyStr);
560 break;
563 aNumFormatLB.Show(bNumFmt);
564 aFormatLB.Show(!bNumFmt);
566 if (IsFldEdit())
567 bName = FALSE;
569 aFormatLB.Enable(bFormat);
570 aFormatFT.Enable(bFormat|bNumFmt);
571 aNameFT.Enable(bName);
572 aNameED.Enable(bName);
573 aValueFT.Enable(bValue);
574 aValueED.Enable(bValue);
576 Size aSz(aFormatLB.GetSizePixel());
578 if (bChapterLevel)
579 aSz.Height() = aFormatLB.LogicToPixel(Size(1, 94), MAP_APPFONT).Height();
580 else
581 aSz.Height() = aFormatLB.LogicToPixel(Size(1, 123), MAP_APPFONT).Height();
583 aFormatLB.SetSizePixel(aSz);
585 aInvisibleCB.Show(!bSeparator);
586 aSeparatorFT.Show(bSeparator);
587 aSeparatorED.Show(bSeparator);
588 aChapterHeaderFT.Show(bChapterLevel);
589 aChapterLevelFT.Show(bChapterLevel);
590 aChapterLevelLB.Show(bChapterLevel);
591 aInvisibleCB.Enable(bInvisible);
593 ModifyHdl(); // Anwenden/Einfuegen/Loeschen Status update
595 aNumFormatLB.SetUpdateMode(TRUE);
596 aFormatLB.SetUpdateMode(TRUE);
598 if(aSelectionLB.IsCallAddSelection())
600 nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
602 switch (nTypeId)
604 case TYP_FORMELFLD:
606 nSelPos = aSelectionLB.GetSelectEntryPos();
608 if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
609 nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
611 if (nSelPos != LISTBOX_ENTRY_NOTFOUND && pBox && !bInit)
613 aValueED.ReplaceSelected(aSelectionLB.GetSelectEntry());
614 ModifyHdl();
617 break;
619 aSelectionLB.ResetCallAddSelection();
621 return 0;
624 /*--------------------------------------------------------------------
625 Beschreibung: Typen in der SelectionBox erneuern
626 --------------------------------------------------------------------*/
628 void SwFldVarPage::UpdateSubType()
630 String sOldSel;
631 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
633 SetSelectionSel(aSelectionLB.GetSelectEntryPos());
634 if(GetSelectionSel() != LISTBOX_ENTRY_NOTFOUND)
635 sOldSel = aSelectionLB.GetEntry(GetSelectionSel());
637 // Auswahl-Listbox fuellen
638 aSelectionLB.SetUpdateMode(FALSE);
639 aSelectionLB.Clear();
641 SvStringsDtor aList;
642 GetFldMgr().GetSubTypes(nTypeId, aList);
643 USHORT nCount = aList.Count();
644 USHORT nPos;
646 for (USHORT i = 0; i < nCount; ++i)
648 if (nTypeId != TYP_INPUTFLD || i)
650 if (!IsFldEdit())
652 nPos = aSelectionLB.InsertEntry(*aList[i]);
653 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
655 else
657 BOOL bInsert = FALSE;
659 switch (nTypeId)
661 case TYP_INPUTFLD:
662 if (*aList[i] == GetCurField()->GetPar1())
663 bInsert = TRUE;
664 break;
666 case TYP_FORMELFLD:
667 bInsert = TRUE;
668 break;
670 case TYP_GETFLD:
671 if (*aList[i] == ((SwFormulaField*)GetCurField())->GetFormula())
672 bInsert = TRUE;
673 break;
675 case TYP_SETFLD:
676 case TYP_USERFLD:
677 if (*aList[i] == GetCurField()->GetTyp()->GetName())
679 bInsert = TRUE;
680 if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)
681 aInvisibleCB.Check();
683 break;
685 case TYP_SETREFPAGEFLD:
686 if ((((SwRefPageSetField*)GetCurField())->IsOn() && i) ||
687 (!((SwRefPageSetField*)GetCurField())->IsOn() && !i))
688 sOldSel = *aList[i];
690 // Alle Eintr?ge zur Auswahl zulassen:
691 nPos = aSelectionLB.InsertEntry(*aList[i]);
692 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
693 break;
695 default:
696 if (*aList[i] == GetCurField()->GetPar1())
697 bInsert = TRUE;
698 break;
700 if (bInsert)
702 nPos = aSelectionLB.InsertEntry(*aList[i]);
703 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
704 if (nTypeId != TYP_FORMELFLD)
705 break;
711 BOOL bEnable = aSelectionLB.GetEntryCount() != 0;
712 ListBox *pLB = 0;
714 if (bEnable)
716 aSelectionLB.SelectEntry(sOldSel);
717 if (!aSelectionLB.GetSelectEntryCount())
719 aSelectionLB.SelectEntryPos(0);
720 pLB = &aSelectionLB; // Alle Controls neu initialisieren
724 aSelectionLB.Enable( bEnable );
725 aSelectionFT.Enable( bEnable );
727 SubTypeHdl(pLB);
728 aSelectionLB.SetUpdateMode(TRUE);
731 /*--------------------------------------------------------------------
732 Beschreibung:
733 --------------------------------------------------------------------*/
735 USHORT SwFldVarPage::FillFormatLB(USHORT nTypeId)
737 String sOldSel, sOldNumSel;
738 ULONG nOldNumFormat = 0;
740 USHORT nFormatSel = aFormatLB.GetSelectEntryPos();
741 if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
742 sOldSel = aFormatLB.GetEntry(nFormatSel);
744 USHORT nNumFormatSel = aNumFormatLB.GetSelectEntryPos();
745 if (nNumFormatSel != LISTBOX_ENTRY_NOTFOUND)
747 sOldNumSel = aNumFormatLB.GetEntry(nNumFormatSel);
748 nOldNumFormat = aNumFormatLB.GetFormat();
751 // Format-Listbox fuellen
752 aFormatLB.Clear();
753 aNumFormatLB.Clear();
754 BOOL bSpecialFmt = FALSE;
756 if( TYP_GETREFPAGEFLD != nTypeId )
758 if (IsFldEdit())
760 bSpecialFmt = GetCurField()->GetFormat() == SAL_MAX_UINT32;
762 if (!bSpecialFmt)
764 aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
765 sOldNumSel = aEmptyStr;
767 else
768 if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
769 aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
771 else
773 if (nOldNumFormat && nOldNumFormat != ULONG_MAX)
774 aNumFormatLB.SetDefFormat(nOldNumFormat);
775 else
776 aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
780 switch (nTypeId)
782 case TYP_USERFLD:
784 if (!IsFldEdit() || bSpecialFmt)
786 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_MARK_TEXT), 0);
787 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
788 nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_CMD), 1);
789 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
792 break;
794 case TYP_SETFLD:
796 if (!IsFldEdit() || bSpecialFmt)
798 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
799 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
802 break;
804 case TYP_FORMELFLD:
806 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
807 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
809 break;
811 case TYP_GETFLD:
813 USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
814 aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
816 break;
819 if (IsFldEdit() && bSpecialFmt)
821 if (nTypeId == TYP_USERFLD && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
822 aNumFormatLB.SelectEntryPos(1);
823 else
824 aNumFormatLB.SelectEntryPos(0);
826 else
828 if (!nOldNumFormat && (nNumFormatSel = aNumFormatLB.GetEntryPos(sOldNumSel)) != LISTBOX_ENTRY_NOTFOUND)
829 aNumFormatLB.SelectEntryPos(nNumFormatSel);
830 else if (nOldNumFormat && nOldNumFormat == ULONG_MAX)
831 aNumFormatLB.SelectEntry(sOldSel);
834 USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
836 for (USHORT i = 0; i < nSize; i++)
838 USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
839 USHORT nFldId = GetFldMgr().GetFormatId( nTypeId, i );
840 aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(nFldId) );
841 if (IsFldEdit() && nFldId == GetCurField()->GetFormat())
842 aFormatLB.SelectEntryPos( nPos );
845 if (nSize && (!IsFldEdit() || !aFormatLB.GetSelectEntryCount()))
847 aFormatLB.SelectEntry(sOldSel);
849 if (!aFormatLB.GetSelectEntryCount())
851 aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_PAGEDESC));
852 if (!aFormatLB.GetSelectEntryCount())
854 aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_ARABIC));
855 if (!aFormatLB.GetSelectEntryCount())
856 aFormatLB.SelectEntryPos(0);
861 return nSize;
864 /*--------------------------------------------------------------------
865 Beschreibung: Modify
866 --------------------------------------------------------------------*/
868 IMPL_LINK( SwFldVarPage, ModifyHdl, Edit *, EMPTYARG )
870 String sValue(aValueED.GetText());
871 BOOL bHasValue = sValue.Len() != 0;
872 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
873 BOOL bInsert = FALSE, bApply = FALSE, bDelete = FALSE;
875 String sName( aNameED.GetText() );
876 xub_StrLen nLen = sName.Len();
878 switch( nTypeId )
880 case TYP_DDEFLD:
881 case TYP_USERFLD:
882 case TYP_SETFLD:
883 case TYP_SEQFLD:
884 SwCalc::IsValidVarName( sName, &sName );
885 if( sName.Len() != nLen )
887 nLen = sName.Len();
888 Selection aSel(aNameED.GetSelection());
889 aNameED.SetText( sName );
890 aNameED.SetSelection( aSel ); // Cursorpos restaurieren
892 break;
896 // Buttons ueberpruefen
897 switch (nTypeId)
899 case TYP_DDEFLD:
900 if( nLen )
902 // Gibts schon einen entsprechenden Type
903 bInsert = bApply = TRUE;
905 SwFieldType* pType = GetFldMgr().GetFldType(RES_DDEFLD, sName);
907 SwWrtShell *pSh = GetWrtShell();
908 if(!pSh)
909 pSh = ::GetActiveWrtShell();
910 if(pSh && pType)
911 bDelete = !pSh->IsUsed( *pType );
913 break;
915 case TYP_USERFLD:
916 if( nLen )
918 // Gibts schon einen entsprechenden Type
919 SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, sName);
921 SwWrtShell *pSh = GetWrtShell();
922 if(!pSh)
923 pSh = ::GetActiveWrtShell();
924 if(pSh && pType)
925 bDelete = !pSh->IsUsed( *pType );
927 pType = GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
928 if (!pType) // Kein Namenskonflikt mit Variablen
930 // Benutzerfelder duerfen auch ohne Inhalt eingefuegt werden!
931 // Bug #56845
932 bInsert = bApply = TRUE;
935 break;
937 default:
938 bInsert = TRUE;
940 if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD)
942 SwSetExpFieldType* pFldType = (SwSetExpFieldType*)
943 GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
945 if (pFldType)
948 SwWrtShell *pSh = GetWrtShell();
949 if(!pSh)
950 pSh = ::GetActiveWrtShell();
951 if(pSh)
953 const SwFldTypes* p = pSh->GetDoc()->GetFldTypes();
954 USHORT i;
956 for (i = 0; i < INIT_FLDTYPES; i++)
958 SwFieldType* pType = (*p)[ i ];
959 if (pType == pFldType)
960 break;
963 if (i >= INIT_FLDTYPES && !pSh->IsUsed(*pFldType))
964 bDelete = TRUE;
966 if (nTypeId == TYP_SEQFLD && !(pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
967 bInsert = FALSE;
969 if (nTypeId == TYP_SETFLD && (pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
970 bInsert = FALSE;
973 if (GetFldMgr().GetFldType(RES_USERFLD, sName))
974 bInsert = FALSE;
977 if( !nLen && ( nTypeId == TYP_SETFLD ||
978 (!IsFldEdit() && nTypeId == TYP_GETFLD ) ) )
979 bInsert = FALSE;
981 if( (nTypeId == TYP_SETFLD || nTypeId == TYP_FORMELFLD) &&
982 !bHasValue )
983 bInsert = FALSE;
984 break;
987 aNewDelTBX.EnableItem(BT_VARAPPLY, bApply);
988 aNewDelTBX.EnableItem(BT_VARDELETE, bDelete);
989 EnableInsert(bInsert);
991 return 0;
994 /*--------------------------------------------------------------------
995 Beschreibung:
996 --------------------------------------------------------------------*/
998 IMPL_LINK( SwFldVarPage, TBClickHdl, ToolBox *, pBox )
1000 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
1002 switch (pBox->GetCurItemId())
1004 case BT_VARDELETE:
1006 if( nTypeId == TYP_USERFLD )
1007 GetFldMgr().RemoveFldType(RES_USERFLD, aSelectionLB.GetSelectEntry());
1008 else
1010 USHORT nWhich;
1012 switch(nTypeId)
1014 case TYP_SETFLD:
1015 case TYP_SEQFLD:
1016 nWhich = RES_SETEXPFLD;
1017 break;
1018 default:
1019 nWhich = RES_DDEFLD;
1020 break;
1023 GetFldMgr().RemoveFldType(nWhich, aSelectionLB.GetSelectEntry());
1026 UpdateSubType();
1027 SwWrtShell *pSh = GetWrtShell();
1028 if(!pSh)
1029 pSh = ::GetActiveWrtShell();
1030 if(pSh)
1032 pSh->SetModified();
1035 break;
1037 case BT_VARAPPLY:
1039 String sName(aNameED.GetText()), sValue(aValueED.GetText());
1040 SwFieldType* pType = 0;
1041 USHORT nId = 0;
1042 USHORT nNumFormatPos = aNumFormatLB.GetSelectEntryPos();
1044 switch (nTypeId)
1046 case TYP_USERFLD: nId = RES_USERFLD; break;
1047 case TYP_DDEFLD: nId = RES_DDEFLD; break;
1048 case TYP_SETFLD: nId = RES_SETEXPFLD;break;
1050 pType = GetFldMgr().GetFldType(nId, sName);
1052 ULONG nFormat = aFormatLB.GetSelectEntryPos();
1053 if (nFormat != LISTBOX_ENTRY_NOTFOUND)
1054 nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
1056 if (pType) // Aendern
1058 SwWrtShell *pSh = GetWrtShell();
1059 if(!pSh)
1060 pSh = ::GetActiveWrtShell();
1061 if(pSh)
1063 pSh->StartAllAction();
1065 if (nTypeId == TYP_USERFLD)
1067 if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
1069 ULONG nFmt = nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat();
1070 if (nFmt)
1071 { // Sprache auf Office-Sprache umstellen, da String im Office
1072 // Format vom Kalkulator erwartet wird und so in den Dlg
1073 // eingegeben werden sollte
1074 nFmt = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFmt);
1076 ((SwUserFieldType*)pType)->SetContent(aValueED.GetText(), nFmt);
1077 ((SwUserFieldType*)pType)->SetType(
1078 nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR );
1081 else
1083 if (nFormat != LISTBOX_ENTRY_NOTFOUND)
1085 //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
1086 // Namen haben! Wird hier noch nicht beachtet.
1087 USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
1088 sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
1089 ((SwDDEFieldType*)pType)->SetCmd(sValue);
1090 ((SwDDEFieldType*)pType)->SetType((USHORT)nFormat);
1093 pType->UpdateFlds();
1095 pSh->EndAllAction();
1098 else // Neu
1100 if(nTypeId == TYP_USERFLD)
1102 SwWrtShell *pSh = GetWrtShell();
1103 if(!pSh)
1104 pSh = ::GetActiveWrtShell();
1105 if(pSh)
1107 SwUserFieldType aType( pSh->GetDoc(), sName );
1109 if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
1111 aType.SetType(nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
1112 aType.SetContent( sValue, nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat() );
1113 aSelectionLB.InsertEntry(sName);
1114 aSelectionLB.SelectEntry(sName);
1115 GetFldMgr().InsertFldType( aType ); // Userfld Neu
1119 else
1121 if (nFormat != LISTBOX_ENTRY_NOTFOUND)
1123 //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
1124 // Namen haben! Wird hier noch nicht beachtet.
1125 USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
1126 sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
1128 SwDDEFieldType aType(sName, sValue, (USHORT)nFormat);
1129 aSelectionLB.InsertEntry(sName);
1130 aSelectionLB.SelectEntry(sName);
1131 GetFldMgr().InsertFldType(aType); // DDE-Feld Neu
1135 if (IsFldEdit())
1136 GetFldMgr().GetCurFld(); // FieldManager Updaten
1138 UpdateSubType();
1140 break;
1143 return TRUE;
1146 /*--------------------------------------------------------------------
1147 Beschreibung:
1148 --------------------------------------------------------------------*/
1150 IMPL_LINK( SwFldVarPage, ChapterHdl, ListBox *, EMPTYARG )
1152 BOOL bEnable = aChapterLevelLB.GetSelectEntryPos() != 0;
1154 aSeparatorED.Enable(bEnable);
1155 aSeparatorFT.Enable(bEnable);
1156 SeparatorHdl();
1158 return 0;
1161 /*--------------------------------------------------------------------
1162 Beschreibung:
1163 --------------------------------------------------------------------*/
1165 IMPL_LINK( SwFldVarPage, SeparatorHdl, Edit *, EMPTYARG )
1167 BOOL bEnable = aSeparatorED.GetText().Len() != 0 ||
1168 aChapterLevelLB.GetSelectEntryPos() == 0;
1169 EnableInsert(bEnable);
1171 return 0;
1174 /*--------------------------------------------------------------------
1175 Beschreibung:
1176 --------------------------------------------------------------------*/
1178 BOOL SwFldVarPage::FillItemSet(SfxItemSet& )
1180 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
1182 String aVal(aValueED.GetText());
1183 String aName(aNameED.GetText());
1185 USHORT nSubType = aSelectionLB.GetSelectEntryPos();
1186 if(nSubType == LISTBOX_ENTRY_NOTFOUND)
1187 nSubType = 0;
1188 else
1189 nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSubType);
1191 ULONG nFormat;
1193 if (!aNumFormatLB.IsVisible())
1195 nFormat = aFormatLB.GetSelectEntryPos();
1197 if(nFormat == LISTBOX_ENTRY_NOTFOUND)
1198 nFormat = 0;
1199 else
1200 nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
1202 else
1204 nFormat = aNumFormatLB.GetFormat();
1206 if (nFormat && nFormat != ULONG_MAX && aNumFormatLB.IsAutomaticLanguage())
1208 // Sprache auf Office-Sprache umstellen, da String im Office-
1209 // Format vom Kalkulator erwartet wird und so in den Dlg
1210 // eingegeben werden sollte
1211 SwWrtShell *pSh = GetWrtShell();
1212 if(!pSh)
1213 pSh = ::GetActiveWrtShell();
1214 if(pSh)
1216 nFormat = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFormat);
1220 sal_Unicode cSeparator = ' ';
1221 switch (nTypeId)
1223 case TYP_USERFLD:
1225 nSubType = (nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR;
1227 if (nFormat == ULONG_MAX && aNumFormatLB.GetSelectEntry() == SW_RESSTR(FMT_USERVAR_CMD))
1228 nSubType |= nsSwExtendedSubType::SUB_CMD;
1230 if (aInvisibleCB.IsChecked())
1231 nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
1232 break;
1234 case TYP_FORMELFLD:
1236 nSubType = nsSwGetSetExpType::GSE_FORMULA;
1237 if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
1238 nSubType |= nsSwExtendedSubType::SUB_CMD;
1239 break;
1241 case TYP_GETFLD:
1243 nSubType &= 0xff00;
1244 if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
1245 nSubType |= nsSwExtendedSubType::SUB_CMD;
1246 break;
1248 case TYP_INPUTFLD:
1250 SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, aName);
1251 nSubType = static_cast< USHORT >((nSubType & 0xff00) | ((pType) ? INP_USR : INP_VAR));
1252 break;
1255 case TYP_SETFLD:
1257 if (IsFldDlgHtmlMode())
1259 nSubType = 0x0100;
1260 nSubType = (nSubType & 0xff00) | nsSwGetSetExpType::GSE_STRING;
1262 else
1263 nSubType = (nSubType & 0xff00) | ((nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
1265 if (aInvisibleCB.IsChecked())
1266 nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
1267 break;
1269 case TYP_SEQFLD:
1271 // nSubType = nsSwGetSetExpType::GSE_SEQ; // nsSwGetSetExpType::GSE_SEQ wird im Fldmgr fest gesetzt, kann also entfallen
1272 nSubType = aChapterLevelLB.GetSelectEntryPos();
1273 if (nSubType == 0)
1274 nSubType = 0x7f;
1275 else
1277 nSubType--;
1278 String sSeparator(aSeparatorED.GetText().GetChar(0));
1279 cSeparator = sSeparator.Len() ? sSeparator.GetChar(0) : ' ';
1280 //nSubType |= (USHORT)(((BYTE)) << 8);
1282 break;
1284 case TYP_GETREFPAGEFLD:
1285 if( SVX_NUM_CHAR_SPECIAL == nFormat )
1286 aVal = aValueED.GetText();
1287 break;
1290 if (!IsFldEdit() ||
1291 aNameED.GetSavedValue() != aNameED.GetText() ||
1292 aValueED.GetSavedValue() != aValueED.GetText() ||
1293 aSelectionLB.GetSavedValue() != aSelectionLB.GetSelectEntryPos() ||
1294 aFormatLB.GetSavedValue() != aFormatLB.GetSelectEntryPos() ||
1295 nOldFormat != aNumFormatLB.GetFormat() ||
1296 aInvisibleCB.GetState() != aInvisibleCB.GetSavedValue() ||
1297 aChapterLevelLB.GetSavedValue() != aChapterLevelLB.GetSelectEntryPos() ||
1298 aSeparatorED.GetSavedValue() != aSeparatorED.GetText())
1300 InsertFld( nTypeId, nSubType, aName, aVal, nFormat,
1301 cSeparator, aNumFormatLB.IsAutomaticLanguage() );
1304 UpdateSubType();
1306 return FALSE;
1310 /*--------------------------------------------------------------------
1311 Beschreibung:
1312 --------------------------------------------------------------------*/
1314 SfxTabPage* SwFldVarPage::Create( Window* pParent,
1315 const SfxItemSet& rAttrSet )
1317 return ( new SwFldVarPage( pParent, rAttrSet ) );
1320 /*--------------------------------------------------------------------
1321 Beschreibung:
1322 --------------------------------------------------------------------*/
1324 USHORT SwFldVarPage::GetGroup()
1326 return GRP_VAR;
1329 /*--------------------------------------------------------------------
1330 Beschreibung:
1331 --------------------------------------------------------------------*/
1333 SelectionListBox::SelectionListBox( SwFldVarPage* pDialog, const ResId& rResId ) :
1334 ListBox (pDialog, rResId),
1335 pDlg (pDialog),
1336 bCallAddSelection(FALSE)
1340 /*--------------------------------------------------------------------
1341 Beschreibung:
1342 --------------------------------------------------------------------*/
1344 long SelectionListBox::PreNotify( NotifyEvent& rNEvt )
1346 long nHandled = ListBox::PreNotify( rNEvt );
1347 //BOOL bAddSel = FALSE;
1348 if ( rNEvt.GetType() == EVENT_KEYUP )
1350 const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
1351 const KeyCode aKeyCode = pKEvt->GetKeyCode();
1352 const USHORT nModifier = aKeyCode.GetModifier();
1353 if( aKeyCode.GetCode() == KEY_SPACE && !nModifier)
1354 // bAddSel = TRUE;
1355 bCallAddSelection = TRUE;
1357 if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
1359 const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
1361 if (pMEvt && (pMEvt->IsMod1() || pMEvt->IsMod2())) // Alt oder Ctrl
1362 //bAddSel = TRUE;
1363 bCallAddSelection = TRUE;
1366 // if (bAddSel)
1367 // pDlg->AddSelection(this);
1369 return nHandled;
1371 /* -----------------12.01.99 11:14-------------------
1373 * --------------------------------------------------*/
1374 void SwFldVarPage::FillUserData()
1376 String sData(String::CreateFromAscii(USER_DATA_VERSION));
1377 sData += ';';
1378 USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
1379 if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
1380 nTypeSel = USHRT_MAX;
1381 else
1382 nTypeSel = (USHORT)(ULONG)aTypeLB.GetEntryData( nTypeSel );
1383 sData += String::CreateFromInt32( nTypeSel );
1384 SetUserData(sData);