merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / fldui / flddok.cxx
blobfa4b55af69f35016aa95a358bf89c50eadafe1a3
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: flddok.cxx,v $
10 * $Revision: 1.15 $
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 <vcl/svapp.hxx>
39 #include <flddat.hxx>
40 #include <docufld.hxx>
41 #ifndef _GLOBALS_HRC
42 #include <globals.hrc>
43 #endif
44 #include <chpfld.hxx>
45 #ifndef _FLDTDLG_HRC
46 #include <fldtdlg.hrc>
47 #endif
48 #ifndef _FLDUI_HRC
49 #include <fldui.hrc>
50 #endif
51 #ifndef _FLDDOK_HXX
52 #include <flddok.hxx>
53 #endif
54 #include <swmodule.hxx>
55 #ifndef _VIEW_HXX
56 #include <view.hxx>
57 #endif
58 #include <wrtsh.hxx>
59 #include <svtools/zformat.hxx>
61 #include <index.hrc>
63 #define USER_DATA_VERSION_1 "1"
64 #define USER_DATA_VERSION USER_DATA_VERSION_1
66 /*--------------------------------------------------------------------
67 Beschreibung:
68 --------------------------------------------------------------------*/
70 SwFldDokPage::SwFldDokPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
71 SwFldPage( pWindow, SW_RES( TP_FLD_DOK ), rCoreSet ),
73 aTypeFT (this, SW_RES(FT_DOKTYPE)),
74 aTypeLB (this, SW_RES(LB_DOKTYPE)),
75 aSelectionFT (this, SW_RES(FT_DOKSELECTION)),
76 aSelectionLB (this, SW_RES(LB_DOKSELECTION)),
77 aValueFT (this, SW_RES(FT_DOKVALUE)),
78 aValueED (this, SW_RES(ED_DOKVALUE)),
79 aLevelED (this, SW_RES(ED_DOKLEVEL)),
80 aDateOffsetED (this, SW_RES(ED_DOKDATEOFF)),
82 aFormatFT (this, SW_RES(FT_DOKFORMAT)),
83 aFormatLB (this, SW_RES(LB_DOKFORMAT)),
84 aNumFormatLB (this, SW_RES(LB_DOKNUMFORMAT)),
85 aFixedCB (this, SW_RES(CB_DOKFIXEDCONTENT)),
87 sDateOffset (SW_RES(STR_DOKDATEOFF)),
88 sTimeOffset (SW_RES(STR_DOKTIMEOFF)),
89 aRootOpened (SW_RES(BMP_DOKROOT_OPENED)),
90 aRootClosed (SW_RES(BMP_DOKROOT_CLOSED))
92 FreeResource();
94 aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
95 aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
96 aNumFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, NumFormatHdl));
98 aLevelED.SetMax(MAXLEVEL);
99 aDateOffsetED.SetMin(LONG_MIN);
100 aDateOffsetED.SetMax(LONG_MAX);
101 //enable 'active' language selection
102 aNumFormatLB.SetShowLanguageControl(TRUE);
105 /*--------------------------------------------------------------------
106 Beschreibung:
107 --------------------------------------------------------------------*/
109 __EXPORT SwFldDokPage::~SwFldDokPage()
113 /*--------------------------------------------------------------------
114 Beschreibung:
115 --------------------------------------------------------------------*/
117 void __EXPORT SwFldDokPage::Reset(const SfxItemSet& )
119 SavePos(&aTypeLB);
120 Init(); // Allgemeine initialisierung
122 // TypeListBox initialisieren
123 const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
125 aTypeLB.SetUpdateMode(FALSE);
126 aTypeLB.Clear();
128 USHORT nPos, nTypeId;
129 BOOL bPage = FALSE;
131 if (!IsFldEdit())
133 // Typ-Listbox fuellen
134 for(short i = rRg.nStart; i < rRg.nEnd; ++i)
136 nTypeId = GetFldMgr().GetTypeId(i);
138 switch (nTypeId)
140 case TYP_PREVPAGEFLD:
141 case TYP_NEXTPAGEFLD:
142 case TYP_PAGENUMBERFLD:
143 if (!bPage)
145 nPos = aTypeLB.InsertEntry(SW_RESSTR(FMT_REF_PAGE));
146 aTypeLB.SetEntryData(nPos, (void*)USHRT_MAX);
147 bPage = TRUE;
149 break;
151 default:
152 nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
153 aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
154 break;
158 else
160 const SwField* pCurField = GetCurField();
161 nTypeId = pCurField->GetTypeId();
162 if (nTypeId == TYP_FIXDATEFLD)
163 nTypeId = TYP_DATEFLD;
164 if (nTypeId == TYP_FIXTIMEFLD)
165 nTypeId = TYP_TIMEFLD;
166 nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
167 aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
168 aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
169 SwWrtShell *pSh = GetWrtShell();
170 if(!pSh)
171 pSh = ::GetActiveWrtShell();
172 if(pSh)
174 const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
175 if(pFormat)
176 aNumFormatLB.SetLanguage(pFormat->GetLanguage());
180 // alte Pos selektieren
181 RestorePos(&aTypeLB);
183 aTypeLB.SetUpdateMode(TRUE);
184 aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
185 aTypeLB.SetSelectHdl(LINK(this, SwFldDokPage, TypeHdl));
186 aFormatLB.SetSelectHdl(LINK(this, SwFldDokPage, FormatHdl));
188 if( !IsRefresh() )
190 String sUserData = GetUserData();
191 if( sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1 ))
193 String sVal = sUserData.GetToken(1, ';');
194 USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
195 if(nVal != USHRT_MAX)
197 for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
198 if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
200 aTypeLB.SelectEntryPos(i);
201 break;
206 TypeHdl(0);
208 if (IsFldEdit())
210 nOldSel = aSelectionLB.GetSelectEntryPos();
211 nOldFormat = GetCurField()->GetFormat();
212 aFixedCB.SaveValue();
213 aValueED.SaveValue();
214 aLevelED.SaveValue();
215 aDateOffsetED.SaveValue();
219 /*--------------------------------------------------------------------
220 Beschreibung:
221 --------------------------------------------------------------------*/
223 IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
225 // Alte ListBoxPos sichern
226 const USHORT nOld = GetTypeSel();
228 // Aktuelle ListBoxPos
229 SetTypeSel(aTypeLB.GetSelectEntryPos());
231 if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
233 SetTypeSel(0);
234 aTypeLB.SelectEntryPos(0);
237 USHORT nCount;
239 if (nOld != GetTypeSel())
241 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
243 // Auswahl-Listbox fuellen
244 aSelectionLB.Clear();
246 if (nTypeId != USHRT_MAX)
248 SvStringsDtor aLst;
249 GetFldMgr().GetSubTypes(nTypeId, aLst);
251 if (nTypeId != TYP_AUTHORFLD)
252 nCount = aLst.Count();
253 else
254 nCount = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
256 USHORT nPos;
258 for (USHORT i = 0; i < nCount; ++i)
260 if (!IsFldEdit())
262 if (nTypeId != TYP_AUTHORFLD)
263 nPos = aSelectionLB.InsertEntry(*aLst[i]);
264 else
265 nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
267 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
269 else
271 BOOL bInsert = FALSE;
273 switch (nTypeId)
275 case TYP_DATEFLD:
276 case TYP_TIMEFLD:
277 nPos = aSelectionLB.InsertEntry(*aLst[i]);
278 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
279 if (((SwDateTimeField*)GetCurField())->IsFixed() && !i)
280 aSelectionLB.SelectEntryPos(nPos);
281 if (!((SwDateTimeField*)GetCurField())->IsFixed() && i)
282 aSelectionLB.SelectEntryPos(nPos);
283 break;
285 case TYP_EXTUSERFLD:
286 case TYP_DOCSTATFLD:
287 nPos = aSelectionLB.InsertEntry(*aLst[i]);
288 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
289 if (GetCurField()->GetSubType() == i)
290 aSelectionLB.SelectEntryPos(nPos);
291 break;
293 case TYP_AUTHORFLD:
295 String sFmt(GetFldMgr().GetFormatStr(nTypeId, i));
296 nPos = aSelectionLB.InsertEntry(sFmt);
297 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
298 aSelectionLB.SelectEntry(GetFldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
299 break;
302 default:
303 if (*aLst[i] == GetCurField()->GetPar1())
304 bInsert = TRUE;
305 break;
307 if (bInsert)
309 nPos = aSelectionLB.InsertEntry(*aLst[i]);
310 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
311 break;
315 aSelectionLB.SetSelectHdl(Link());
317 else
319 AddSubType(TYP_PAGENUMBERFLD);
320 AddSubType(TYP_PREVPAGEFLD);
321 AddSubType(TYP_NEXTPAGEFLD);
322 nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(0);
323 nCount = 3;
324 aSelectionLB.SetSelectHdl(LINK(this, SwFldDokPage, SubTypeHdl));
327 BOOL bEnable = nCount != 0;
329 if (bEnable && !aSelectionLB.GetSelectEntryCount())
330 aSelectionLB.SelectEntryPos(0);
332 aSelectionLB.Enable( bEnable );
333 aSelectionFT.Enable( bEnable );
335 // Format-Listbox fuellen
336 USHORT nSize = FillFormatLB(nTypeId);
338 BOOL bValue = FALSE, bLevel = FALSE, bNumFmt = FALSE, bOffset = FALSE;
339 BOOL bFormat = nSize != 0;
340 BOOL bOneArea = FALSE;
341 BOOL bFixed = FALSE;
342 USHORT nFmtType = 0;
344 switch (nTypeId)
346 case TYP_DATEFLD:
347 bFormat = bNumFmt = bOneArea = bOffset = TRUE;
349 nFmtType = NUMBERFORMAT_DATE;
350 aValueFT.SetText(sDateOffset);
351 aDateOffsetED.SetFirst(-31); // Ein Monat
352 aDateOffsetED.SetLast(31);
354 if (IsFldEdit())
355 aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() / 24 / 60);
356 break;
358 case TYP_TIMEFLD:
359 bFormat = bNumFmt = bOneArea = bOffset = TRUE;
361 nFmtType = NUMBERFORMAT_TIME;
362 aValueFT.SetText(sTimeOffset);
363 aDateOffsetED.SetFirst(-1440); // Ein Tag
364 aDateOffsetED.SetLast(1440);
366 if (IsFldEdit())
367 aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() );
368 break;
370 case TYP_PREVPAGEFLD:
371 case TYP_NEXTPAGEFLD:
372 if (IsFldEdit())
374 USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
375 aFormatLB.GetSelectEntryPos() );
376 String sOldTxt(aValueFT.GetText());
378 if(SVX_NUM_CHAR_SPECIAL != nTmp)
380 INT32 nOff = GetCurField()->GetPar2().ToInt32();
381 if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
382 aValueED.SetText(
383 String::CreateFromInt32(nOff - 1) );
384 else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
385 aValueED.SetText(
386 String::CreateFromInt32(nOff + 1) );
387 else
388 aValueED.SetText(aEmptyStr);
390 else
391 aValueED.SetText(((SwPageNumberField*)GetCurField())->GetUserString());
393 bValue = TRUE;
394 break;
396 case TYP_CHAPTERFLD:
397 aValueFT.SetText(SW_RESSTR(STR_LEVEL));
398 if (IsFldEdit())
399 aLevelED.SetText(String::CreateFromInt32(((SwChapterField*)GetCurField())->GetLevel() + 1));
400 bLevel = TRUE;
401 break;
403 case TYP_PAGENUMBERFLD:
404 aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
405 if (IsFldEdit())
406 aValueED.SetText(GetCurField()->GetPar2());
407 bValue = TRUE;
408 break;
410 case TYP_EXTUSERFLD:
411 case TYP_AUTHORFLD:
412 case TYP_FILENAMEFLD:
413 bFixed = TRUE;
414 break;
416 default:
417 break;
420 if (bNumFmt)
422 if (IsFldEdit())
424 aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
426 if (aNumFormatLB.GetFormatType() == (NUMBERFORMAT_DATE|NUMBERFORMAT_TIME))
428 // Format-Typ immer einstellen, da sonst bei kombinierten Datum/Zeitformaten
429 // beide Formate gleichzeitig angezeigt werden wuerden
430 aNumFormatLB.SetFormatType(0);
431 aNumFormatLB.SetFormatType(nFmtType);
432 // Nochmal richtiges Format einstellen
433 aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
436 else
437 aNumFormatLB.SetFormatType(nFmtType);
439 aNumFormatLB.SetOneArea(bOneArea);
442 aFormatLB.Show(!bNumFmt);
443 aNumFormatLB.Show(bNumFmt);
445 Size aSz(aFormatLB.GetSizePixel());
447 if (bValue | bLevel | bOffset)
448 aSz.Height() = aFormatLB.LogicToPixel(Size(1, 137), MAP_APPFONT).Height();
449 else
450 aSz.Height() = aFormatLB.LogicToPixel(Size(1, 152), MAP_APPFONT).Height();
452 aValueFT.Show(bValue | bLevel | bOffset);
453 aValueED.Show(bValue);
454 aLevelED.Show(bLevel);
455 aDateOffsetED.Show(bOffset);
456 aFixedCB.Show(!bValue && !bLevel && !bOffset);
458 aFormatLB.SetSizePixel(aSz);
459 aNumFormatLB.SetSizePixel(aSz);
461 aFormatLB.Enable(bFormat);
462 aFormatFT.Enable(bFormat);
463 aFixedCB.Enable(bFixed);
465 if (IsFldEdit())
466 aFixedCB.Check( static_cast< BOOL >(((GetCurField()->GetFormat() & AF_FIXED) != 0) & bFixed));
468 if (aNumFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
469 aNumFormatLB.SelectEntryPos(0);
470 aValueFT.Enable(bValue | bLevel | bOffset);
471 aValueED.Enable(bValue);
474 return 0;
477 /*--------------------------------------------------------------------
478 Beschreibung:
479 --------------------------------------------------------------------*/
481 void SwFldDokPage::AddSubType(USHORT nTypeId)
483 USHORT nPos = aSelectionLB.InsertEntry(SwFieldType::GetTypeStr(nTypeId));
484 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
487 /*--------------------------------------------------------------------
488 Beschreibung:
489 --------------------------------------------------------------------*/
491 IMPL_LINK( SwFldDokPage, SubTypeHdl, ListBox *, EMPTYARG )
493 USHORT nPos = aSelectionLB.GetSelectEntryPos();
494 if(nPos == LISTBOX_ENTRY_NOTFOUND)
495 nPos = 0;
497 USHORT nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
498 FillFormatLB(nTypeId);
500 USHORT nTextRes = 0;
501 switch (nTypeId)
503 case TYP_CHAPTERFLD:
504 nTextRes = STR_LEVEL;
505 break;
507 case TYP_PREVPAGEFLD:
508 case TYP_NEXTPAGEFLD:
509 nTextRes = SVX_NUM_CHAR_SPECIAL == (USHORT)(ULONG)aFormatLB.GetEntryData(
510 aFormatLB.GetSelectEntryPos() )
511 ? STR_VALUE : STR_OFFSET;
512 break;
514 case TYP_PAGENUMBERFLD:
515 nTextRes = STR_OFFSET;
516 break;
519 if( nTextRes )
520 aValueFT.SetText( SW_RESSTR( nTextRes ));
522 return 0;
525 /*--------------------------------------------------------------------
526 Beschreibung:
527 --------------------------------------------------------------------*/
529 USHORT SwFldDokPage::FillFormatLB(USHORT nTypeId)
531 // Format-Listbox fuellen
532 aFormatLB.Clear();
534 if (nTypeId == TYP_AUTHORFLD)
535 return aFormatLB.GetEntryCount();
537 USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
539 for( USHORT i = 0; i < nSize; ++i )
541 USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
542 USHORT nFmtId = GetFldMgr().GetFormatId( nTypeId, i );
543 aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>( nFmtId ));
544 if (IsFldEdit() && nFmtId == (GetCurField()->GetFormat() & ~AF_FIXED))
545 aFormatLB.SelectEntryPos( nPos );
548 if( nSize && !aFormatLB.GetSelectEntryCount() )
550 aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_PAGEDESC) );
551 if( !aFormatLB.GetSelectEntryCount() )
553 aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_ARABIC) );
554 if( !aFormatLB.GetSelectEntryCount() )
555 aFormatLB.SelectEntryPos( 0 );
559 FormatHdl();
561 return nSize;
564 /*--------------------------------------------------------------------
565 Beschreibung:
566 --------------------------------------------------------------------*/
568 IMPL_LINK( SwFldDokPage, FormatHdl, ListBox *, EMPTYARG )
570 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
572 if (nTypeId == USHRT_MAX)
574 USHORT nPos = aSelectionLB.GetSelectEntryPos();
575 if(nPos == LISTBOX_ENTRY_NOTFOUND)
576 nPos = 0;
578 nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
581 if (nTypeId == TYP_NEXTPAGEFLD || nTypeId == TYP_PREVPAGEFLD)
583 // Prev/Next - PageNumFelder Sonderbehandlung:
584 USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
585 aFormatLB.GetSelectEntryPos() );
586 String sOldTxt( aValueFT.GetText() );
587 String sNewTxt( SW_RES( SVX_NUM_CHAR_SPECIAL == nTmp ? STR_VALUE
588 : STR_OFFSET ));
590 if( sOldTxt != sNewTxt )
591 aValueFT.SetText( sNewTxt );
593 if (sOldTxt != aValueFT.GetText())
594 aValueED.SetText( aEmptyStr );
597 return 0;
600 /*--------------------------------------------------------------------
601 Beschreibung:
602 --------------------------------------------------------------------*/
604 BOOL __EXPORT SwFldDokPage::FillItemSet(SfxItemSet& )
606 BOOL bPage = FALSE;
607 USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
609 if (nTypeId == USHRT_MAX)
611 USHORT nPos = aSelectionLB.GetSelectEntryPos();
612 if(nPos == LISTBOX_ENTRY_NOTFOUND)
613 nPos = 0;
614 nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
615 bPage = TRUE;
618 String aVal(aValueED.GetText());
619 ULONG nFormat = 0;
620 USHORT nSubType = 0;
622 if (aFormatLB.IsEnabled())
624 USHORT nPos = aFormatLB.GetSelectEntryPos();
625 if(nPos != LISTBOX_ENTRY_NOTFOUND)
626 nFormat = (USHORT)(ULONG)aFormatLB.GetEntryData(nPos);
629 if (aSelectionLB.IsEnabled())
631 USHORT nPos = aSelectionLB.GetSelectEntryPos();
632 if(nPos != LISTBOX_ENTRY_NOTFOUND)
633 nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
636 switch (nTypeId)
638 case TYP_AUTHORFLD:
639 nFormat = nSubType;
640 nSubType = 0;
641 // kein break!
642 case TYP_EXTUSERFLD:
643 nFormat |= aFixedCB.IsChecked() ? AF_FIXED : 0;
644 break;
646 case TYP_FILENAMEFLD:
647 nFormat |= aFixedCB.IsChecked() ? FF_FIXED : 0;
648 break;
650 case TYP_DATEFLD:
651 case TYP_TIMEFLD:
653 nFormat = aNumFormatLB.GetFormat();
654 long nVal = static_cast< long >(aDateOffsetED.GetValue());
655 if (nTypeId == TYP_DATEFLD)
656 aVal = String::CreateFromInt32(nVal * 60 * 24);
657 else
658 aVal = String::CreateFromInt32(nVal);
659 break;
662 case TYP_NEXTPAGEFLD:
663 case TYP_PREVPAGEFLD:
664 case TYP_PAGENUMBERFLD:
665 case TYP_GETREFPAGEFLD:
667 if( SVX_NUM_CHAR_SPECIAL != nFormat &&
668 (TYP_PREVPAGEFLD == nTypeId || TYP_NEXTPAGEFLD == nTypeId))
670 INT32 nVal = aValueED.GetText().ToInt32();
671 aVal = String::CreateFromInt32(nVal);
673 break;
676 case TYP_CHAPTERFLD:
677 aVal = aLevelED.GetText();
678 break;
680 default:
681 break;
684 if (!IsFldEdit() ||
685 nOldSel != aSelectionLB.GetSelectEntryPos() ||
686 nOldFormat != nFormat ||
687 aFixedCB.GetState() != aFixedCB.GetSavedValue() ||
688 aValueED.GetText() != aValueED.GetSavedValue() ||
689 aLevelED.GetText() != aLevelED.GetSavedValue() ||
690 aDateOffsetED.GetText() != aDateOffsetED.GetSavedValue())
692 InsertFld( nTypeId, nSubType, aEmptyStr, aVal, nFormat, ' ', aNumFormatLB.IsAutomaticLanguage() );
695 return FALSE;
698 /*--------------------------------------------------------------------
699 Beschreibung:
700 --------------------------------------------------------------------*/
702 SfxTabPage* __EXPORT SwFldDokPage::Create( Window* pParent,
703 const SfxItemSet& rAttrSet )
705 return ( new SwFldDokPage( pParent, rAttrSet ) );
708 /*--------------------------------------------------------------------
709 Beschreibung:
710 --------------------------------------------------------------------*/
712 USHORT SwFldDokPage::GetGroup()
714 return GRP_DOC;
717 /* -----------------12.01.99 10:09-------------------
719 * --------------------------------------------------*/
720 void SwFldDokPage::FillUserData()
722 String sData( String::CreateFromAscii(
723 RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
724 sData += ';';
725 USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
726 if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
727 nTypeSel = USHRT_MAX;
728 else
729 nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
730 sData += String::CreateFromInt32( nTypeSel );
731 SetUserData(sData);