1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FieldDescControl.cxx,v $
10 * $Revision: 1.49.68.1 $
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_dbaccess.hxx"
34 #define ITEMID_HORJUSTIFY SID_ATTR_ALIGN_HOR_JUSTIFY
35 #define ITEMID_VERJUSTIFY SID_ATTR_ALIGN_VER_JUSTIFY
36 //#define ITEMID_ORIENTATION SID_ATTR_ALIGN_ORIENTATION
37 #define ITEMID_LINEBREAK SID_ATTR_ALIGN_LINEBREAK
38 #define ITEMID_MARGIN SID_ATTR_ALIGN_MARGIN
40 #include "FieldDescControl.hxx"
41 #include "FieldControls.hxx"
42 #include <tools/debug.hxx>
43 #include <tools/diagnose_ex.h>
44 #include "TableDesignHelpBar.hxx"
45 #include <vcl/scrbar.hxx>
46 #include <vcl/button.hxx>
47 #include <vcl/svapp.hxx>
48 #include <vcl/fixed.hxx>
49 #include <vcl/msgbox.hxx>
51 #include "FieldDescriptions.hxx"
52 #include "dlgattr.hxx"
53 #include <svx/numfmtsh.hxx>
54 #include <svx/svxids.hrc>
55 #include <svx/algitem.hxx>
56 #include <svtools/itempool.hxx>
57 #define _ZFORLIST_DECLARE_TABLE // ohne das bekomme ich einen Compiler-Fehler in <svtools/zforlist.hxx>
58 #include <svtools/zforlist.hxx>
59 #include <svtools/rngitem.hxx>
60 #include <svtools/intitem.hxx>
61 #include <svtools/numuno.hxx>
62 #include <svtools/transfer.hxx>
63 #include <com/sun/star/lang/XUnoTunnel.hpp>
64 #include <com/sun/star/util/NumberFormat.hpp>
65 #include <com/sun/star/util/XNumberFormatPreviewer.hpp>
66 #include <com/sun/star/util/XNumberFormatTypes.hpp>
67 #include <com/sun/star/beans/XPropertySet.hpp>
68 #include "QEnumTypes.hxx"
69 #include "dbaccess_helpid.hrc"
70 #include <connectivity/dbtools.hxx>
71 #include <connectivity/dbconversion.hxx>
72 #include <comphelper/numbers.hxx>
73 #include "UITools.hxx"
75 #include "dbu_control.hrc"
76 #include "dbu_tbl.hrc"
79 using namespace dbaui
;
80 using namespace dbtools
;
81 using namespace ::com::sun::star::uno
;
82 using namespace ::com::sun::star::beans
;
83 using namespace ::com::sun::star::lang
;
84 using namespace ::com::sun::star::sdbc
;
85 using namespace ::com::sun::star::util
;
87 //==================================================================
89 // fuer die Controls auf der OFieldDescGenPage
90 #define CONTROL_SPACING_X 18 // 6
91 #define CONTROL_SPACING_Y 4
92 #define CONTROL_WIDTH_1 160 // 100
93 #define CONTROL_WIDTH_2 100 // 60
94 #define CONTROL_WIDTH_3 250
95 #define CONTROL_WIDTH_4 (CONTROL_WIDTH_3 - 20 - 5)
97 #define SBA_DEF_RANGEFORMAT (100 + 143) // RangeItem
98 #define SBA_DEF_FMTVALUE (100 + 144) // SfxULONG, Format
99 #define SBA_ATTR_ALIGN_HOR_JUSTIFY (100 + 145) // SvxHorJustifyItem
101 #define HSCROLL_STEP 20
106 // -----------------------------------------------------------------------------
107 double checkDoubleForDateFormat(double _nValue
,sal_Int32 _nFormatKey
,const Reference
< ::com::sun::star::util::XNumberFormatter
>& _xNumberFormatter
)
109 double nValue
= _nValue
;
110 sal_Int32 nNumberFormat
= ::comphelper::getNumberFormatType(_xNumberFormatter
,_nFormatKey
);
111 if( (nNumberFormat
& ::com::sun::star::util::NumberFormat::DATE
) == ::com::sun::star::util::NumberFormat::DATE
112 || (nNumberFormat
& ::com::sun::star::util::NumberFormat::DATETIME
) == ::com::sun::star::util::NumberFormat::DATETIME
)
114 nValue
= DBTypeConversion::toStandardDbDate(DBTypeConversion::getNULLDate(_xNumberFormatter
->getNumberFormatsSupplier()),nValue
);
119 // -----------------------------------------------------------------------------
120 template< typename T1
, typename T2
> void lcl_HideAndDeleteControl(short& _nPos
,T1
** _pControl
,T2
** _pControlText
)
125 (*_pControl
)->Hide();
126 (*_pControlText
)->Hide();
128 delete *_pControlText
;
130 (*_pControlText
) = NULL
;
136 //==================================================================
137 // class OFieldDescControl
138 //==================================================================
140 DBG_NAME(OFieldDescControl
)
142 //==================================================================
143 OFieldDescControl::OFieldDescControl( Window
* pParent
, const ResId
& rResId
, OTableDesignHelpBar
* pHelpBar
)
144 :TabPage( pParent
, rResId
)
146 ,pLastFocusWindow(NULL
)
147 ,m_pActFocusWindow(NULL
)
150 ,pAutoIncrementText(NULL
)
156 ,pBoolDefaultText(NULL
)
157 ,m_pColumnNameText(NULL
)
159 ,m_pAutoIncrementValueText(NULL
)
162 ,pAutoIncrement(NULL
)
171 ,m_pAutoIncrementValue(NULL
)
173 ,m_pVertScroll( NULL
)
174 ,m_pHorzScroll( NULL
)
178 ,aYes(ModuleRes(STR_VALUE_YES
))
179 ,aNo(ModuleRes(STR_VALUE_NO
))
183 ,nDelayedGrabFocusEvent(0)
185 ,m_bRightAligned(false)
186 ,pActFieldDescr(NULL
)
188 DBG_CTOR(OFieldDescControl
,NULL
);
192 //------------------------------------------------------------------------------
193 OFieldDescControl::OFieldDescControl( Window
* pParent
, OTableDesignHelpBar
* pHelpBar
)
194 :TabPage( pParent
, WB_3DLOOK
| WB_DIALOGCONTROL
)
196 ,pLastFocusWindow(NULL
)
197 ,m_pActFocusWindow(NULL
)
200 ,pAutoIncrementText(NULL
)
206 ,pBoolDefaultText(NULL
)
207 ,m_pColumnNameText(NULL
)
209 ,m_pAutoIncrementValueText(NULL
)
212 ,pAutoIncrement(NULL
)
221 ,m_pAutoIncrementValue(NULL
)
223 ,m_pVertScroll( NULL
)
224 ,m_pHorzScroll( NULL
)
228 ,aYes(ModuleRes(STR_VALUE_YES
))
229 ,aNo(ModuleRes(STR_VALUE_NO
))
233 ,nDelayedGrabFocusEvent(0)
235 ,m_bRightAligned(false)
236 ,pActFieldDescr(NULL
)
238 DBG_CTOR(OFieldDescControl
,NULL
);
241 // -----------------------------------------------------------------------------
242 void OFieldDescControl::Contruct()
244 m_pVertScroll
= new ScrollBar(this, WB_VSCROLL
| WB_REPEAT
| WB_DRAG
);
245 m_pHorzScroll
= new ScrollBar(this, WB_HSCROLL
| WB_REPEAT
| WB_DRAG
);
246 m_pVertScroll
->SetScrollHdl(LINK(this, OFieldDescControl
, OnScroll
));
247 m_pHorzScroll
->SetScrollHdl(LINK(this, OFieldDescControl
, OnScroll
));
248 m_pVertScroll
->Show();
249 m_pHorzScroll
->Show();
251 m_pVertScroll
->EnableClipSiblings();
252 m_pHorzScroll
->EnableClipSiblings();
254 m_pVertScroll
->SetLineSize(1);
255 m_pVertScroll
->SetPageSize(1);
256 m_pHorzScroll
->SetLineSize(1);
257 m_pHorzScroll
->SetPageSize(1);
259 m_nOldVThumb
= m_nOldHThumb
= 0;
262 //------------------------------------------------------------------------------
263 OFieldDescControl::~OFieldDescControl()
265 DBG_DTOR(OFieldDescControl
,NULL
);
268 ::std::auto_ptr
<Window
> aTemp(m_pVertScroll
);
269 m_pVertScroll
= NULL
;
272 ::std::auto_ptr
<Window
> aTemp(m_pHorzScroll
);
273 m_pHorzScroll
= NULL
;
276 ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow
));
277 pLastFocusWindow
= NULL
;
279 //////////////////////////////////////////////////////////////////////
281 DeactivateAggregate( tpDefault
);
282 DeactivateAggregate( tpRequired
);
283 DeactivateAggregate( tpTextLen
);
284 DeactivateAggregate( tpNumType
);
285 DeactivateAggregate( tpScale
);
286 DeactivateAggregate( tpLength
);
287 DeactivateAggregate( tpFormat
);
288 DeactivateAggregate( tpAutoIncrement
);
289 DeactivateAggregate( tpBoolDefault
);
290 DeactivateAggregate( tpColumnName
);
291 DeactivateAggregate( tpType
);
292 DeactivateAggregate( tpAutoIncrementValue
);
294 if(nDelayedGrabFocusEvent
)
295 Application::RemoveUserEvent(nDelayedGrabFocusEvent
);
298 //------------------------------------------------------------------------------
299 String
OFieldDescControl::BoolStringPersistent(const String
& rUIString
) const
301 static String
aZero('0');
302 static String
aOne('1');
304 if (rUIString
== aNo
)
306 if (rUIString
== aYes
)
311 //------------------------------------------------------------------------------
312 String
OFieldDescControl::BoolStringUI(const String
& rPersistentString
) const
314 static String
aZero('0');
315 static String
aOne('1');
316 static String
aNone(ModuleRes(STR_VALUE_NONE
));
318 // FS - 66161 - 14.05.1999 - aeltere Versionen haben eventuell einen sprachabhaengigen String als Default gespeichert
319 if (rPersistentString
.Equals(aYes
) || rPersistentString
.Equals(aNo
))
320 return rPersistentString
;
322 if (rPersistentString
== aZero
)
324 if (rPersistentString
== aOne
)
330 //------------------------------------------------------------------------------
331 void OFieldDescControl::Init()
333 Reference
< ::com::sun::star::util::XNumberFormatter
> xFormatter
= GetFormatter();
334 ::dbaui::setEvalDateFormatForFormatter(xFormatter
);
337 //------------------------------------------------------------------------------
338 IMPL_LINK(OFieldDescControl
, OnScroll
, ScrollBar
*, /*pBar*/)
340 ScrollAllAggregates();
343 // -----------------------------------------------------------------------------
346 void getMaxXPosition(Window
* _pWindow
,long& _rnMaxXPosition
)
350 long nTemp
= _pWindow
->GetSizePixel().Width() + _pWindow
->GetPosPixel().X();
351 _rnMaxXPosition
= ::std::max(_rnMaxXPosition
, nTemp
);
355 //------------------------------------------------------------------------------
356 void OFieldDescControl::CheckScrollBars()
358 // ein paar Berechnungen zur neuen Position der ScrollBars
359 Size szOverallSize
= GetSizePixel();
360 long nHScrollHeight
= m_pHorzScroll
->GetSizePixel().Height();
361 long nVScrollWidth
= m_pVertScroll
->GetSizePixel().Width();
363 long nNewHWidth
= szOverallSize
.Width() - nVScrollWidth
;
364 long nNewVHeight
= szOverallSize
.Height() - nHScrollHeight
;
366 sal_Bool
bNeedHScrollBar(sal_False
), bNeedVScrollBar(sal_False
);
368 // die Bereiche anpassen
369 // brauche ich ScrollBars eigentlich ?
371 long lMaxXPosition
= 0;
372 Control
* ppAggregates
[] = { pRequired
, pNumType
, pAutoIncrement
, pDefault
, pTextLen
, pLength
, pScale
, pFormat
, m_pColumnName
, m_pType
,m_pAutoIncrementValue
};
373 for (sal_uInt16 i
=0; i
<sizeof(ppAggregates
)/sizeof(ppAggregates
[0]); ++i
)
374 getMaxXPosition(ppAggregates
[i
],lMaxXPosition
);
377 lMaxXPosition
+= m_pHorzScroll
->GetThumbPos() * HSCROLL_STEP
;
379 long lMaxXAvailable
= szOverallSize
.Width();
380 bNeedHScrollBar
= lMaxXPosition
> lMaxXAvailable
;
381 // aendert sich vielleicht noch
384 // wieviel Controls habe ich
385 sal_uInt16 nActive
= CountActiveAggregates();
386 // welches ist das letzte, was ganz drauf passt ?
387 sal_uInt16 nLastVisible
;
388 const sal_Int32 nControlHeight
= GetMaxControlHeight();
389 const sal_Int32 nControl_Spacing_y
= LogicToPixel(Size(0, CONTROL_SPACING_Y
),MAP_APPFONT
).Height();
391 nLastVisible
= static_cast<sal_uInt16
>((szOverallSize
.Height() - nControl_Spacing_y
- nHScrollHeight
) / (nControl_Spacing_y
+ nControlHeight
));
393 nLastVisible
= static_cast<sal_uInt16
>((szOverallSize
.Height() - nControl_Spacing_y
) / (nControl_Spacing_y
+ nControlHeight
));
394 bNeedVScrollBar
= nActive
>nLastVisible
;
398 // in die urspruengliche Berechnung von lMaxXAvailable ist nicht mit eingegangen, dass ich eine VScrollBar habe, also muss ich
400 lMaxXAvailable
-= nVScrollWidth
;
401 if (!bNeedHScrollBar
&& (lMaxXPosition
> lMaxXAvailable
))
403 // durch die vertikale brauche ich jetzt ploetzlich doch eine horizontale
404 bNeedHScrollBar
= sal_True
;
405 // nLastVisible anpassen
406 nLastVisible
= static_cast<sal_uInt16
>((szOverallSize
.Height() - nControl_Spacing_y
- nHScrollHeight
) / (nControl_Spacing_y
+ nControlHeight
));
407 // bNeedVScrollBar aendert sich nicht : es ist schon auf sal_True und nLastVisible wird hoechstens kleiner
411 // jetzt kann ich sie wirklich positionieren und ihre Parameter setzen
414 m_pVertScroll
->Show();
415 m_pVertScroll
->SetRangeMax(nActive
- nLastVisible
);
416 // m_pVertScroll->SetThumbPos(0);
418 m_pVertScroll
->SetPosSizePixel( Point(nNewHWidth
, 0), Size(nVScrollWidth
, szOverallSize
.Height()) );
422 m_pVertScroll
->Hide();
423 m_pVertScroll
->SetRangeMax(0);
424 m_pVertScroll
->SetThumbPos(0);
429 m_pHorzScroll
->Show();
430 m_pHorzScroll
->SetRangeMax((lMaxXPosition
- lMaxXAvailable
+ HSCROLL_STEP
- 1 )/HSCROLL_STEP
);
431 // m_pHorzScroll->SetThumbPos(0);
433 m_pHorzScroll
->SetPosSizePixel( Point(0, nNewVHeight
), Size(bNeedVScrollBar
? nNewHWidth
: szOverallSize
.Width(), nHScrollHeight
) );
437 m_pHorzScroll
->Hide();
438 m_pHorzScroll
->SetRangeMax(0);
439 m_pHorzScroll
->SetThumbPos(0);
443 //------------------------------------------------------------------------------
444 void OFieldDescControl::Resize()
447 ScrollAllAggregates();
450 //------------------------------------------------------------------------------
451 inline void OFieldDescControl::ScrollAggregate(Control
* pText
, Control
* pInput
, Control
* pButton
, long nDeltaX
, long nDeltaY
)
455 pText
->SetPosPixel(pText
->GetPosPixel() + Point(nDeltaX
, nDeltaY
));
456 pInput
->SetPosPixel(pInput
->GetPosPixel() + Point(nDeltaX
, nDeltaY
));
458 pButton
->SetPosPixel(pButton
->GetPosPixel() + Point(nDeltaX
, nDeltaY
));
461 //------------------------------------------------------------------------------
462 void OFieldDescControl::ScrollAllAggregates()
464 long nDeltaX
= 0, nDeltaY
= 0;
465 if (m_nOldHThumb
!= m_pHorzScroll
->GetThumbPos())
467 nDeltaX
= (m_nOldHThumb
- m_pHorzScroll
->GetThumbPos()) * HSCROLL_STEP
;
468 m_nOldHThumb
= m_pHorzScroll
->GetThumbPos();
471 if (m_nOldVThumb
!= m_pVertScroll
->GetThumbPos())
473 const sal_Int32 nControlHeight
= GetMaxControlHeight();
474 const sal_Int32 nControl_Spacing_y
= LogicToPixel(Size(0, CONTROL_SPACING_Y
),MAP_APPFONT
).Height();
475 nDeltaY
= (m_nOldVThumb
- m_pVertScroll
->GetThumbPos()) * (nControl_Spacing_y
+ nControlHeight
);
476 m_nOldVThumb
= m_pVertScroll
->GetThumbPos();
479 if (nDeltaX
|| nDeltaY
)
481 Control
* ppAggregates
[] = { pRequired
, pNumType
482 , pAutoIncrement
, pDefault
484 , pScale
, m_pColumnName
485 , m_pType
, m_pAutoIncrementValue
};
486 Control
* ppAggregatesText
[] = { pRequiredText
, pNumTypeText
487 , pAutoIncrementText
, pDefaultText
488 , pTextLenText
, pLengthText
489 , pScaleText
, m_pColumnNameText
490 , m_pTypeText
, m_pAutoIncrementValueText
};
491 OSL_ENSURE(sizeof(ppAggregates
)/sizeof(ppAggregates
[0]) == sizeof(ppAggregatesText
)/sizeof(ppAggregatesText
[0]),"Lists are not identical!");
493 for (sal_uInt16 i
=0; i
<sizeof(ppAggregates
)/sizeof(ppAggregates
[0]); ++i
)
494 ScrollAggregate(ppAggregatesText
[i
],ppAggregates
[i
],NULL
,nDeltaX
, nDeltaY
);
496 ScrollAggregate(pFormatText
,pFormatSample
,pFormat
,nDeltaX
, nDeltaY
);
500 //------------------------------------------------------------------------------
501 sal_uInt16
OFieldDescControl::CountActiveAggregates() const
503 Control
* ppAggregates
[] = { pRequired
, pNumType
, pAutoIncrement
, pDefault
, pTextLen
, pLength
, pScale
, pFormat
, m_pColumnName
, m_pType
,m_pAutoIncrementValue
};
504 sal_uInt16 nVisibleAggregates
= 0;
505 for (sal_uInt16 i
=0; i
<sizeof(ppAggregates
)/sizeof(ppAggregates
[0]); ++i
)
507 ++nVisibleAggregates
;
508 return nVisibleAggregates
;
510 //------------------------------------------------------------------------------
511 sal_Int32
OFieldDescControl::GetMaxControlHeight() const
514 Control
* ppAggregates
[] = { pRequired
, pNumType
, pAutoIncrement
, pDefault
, pTextLen
, pLength
, pScale
, pFormat
, m_pColumnName
, m_pType
,m_pAutoIncrementValue
};
515 for (sal_uInt16 i
=0; i
<sizeof(ppAggregates
)/sizeof(ppAggregates
[0]); ++i
)
517 if ( ppAggregates
[i
] )
519 const Size
aTemp( ppAggregates
[i
]->GetOptimalSize(WINDOWSIZE_PREFERRED
) );
520 if ( aTemp
.Height() > aHeight
.Height() )
521 aHeight
.Height() = aTemp
.Height();
522 } // if ( ppAggregates[i] )
525 return aHeight
.Height();
527 //------------------------------------------------------------------------------
528 void OFieldDescControl::SetReadOnly( sal_Bool bReadOnly
)
530 DBG_CHKTHIS(OFieldDescControl
,NULL
);
531 //////////////////////////////////////////////////////////////////////
532 // Controls enablen/disablen
533 Control
* ppAggregates
[] = { pRequired
, pNumType
534 , pAutoIncrement
, pDefault
536 , pScale
, m_pColumnName
537 , m_pType
, m_pAutoIncrementValue
539 Control
* ppAggregatesText
[] = { pRequiredText
, pNumTypeText
540 , pAutoIncrementText
, pDefaultText
541 , pTextLenText
, pLengthText
542 , pScaleText
, m_pColumnNameText
543 , m_pTypeText
, m_pAutoIncrementValueText
546 OSL_ENSURE(sizeof(ppAggregates
)/sizeof(ppAggregates
[0]) == sizeof(ppAggregatesText
)/sizeof(ppAggregatesText
[0]),"Lists are not identical!");
548 for (sal_uInt16 i
=0; i
<sizeof(ppAggregates
)/sizeof(ppAggregates
[0]); ++i
)
550 if ( ppAggregatesText
[i
] )
551 ppAggregatesText
[i
]->Enable( !bReadOnly
);
552 if ( ppAggregates
[i
] )
553 ppAggregates
[i
]->Enable( !bReadOnly
);
557 //------------------------------------------------------------------------------
558 String
OFieldDescControl::GetControlText( sal_uInt16 nControlId
)
560 DBG_CHKTHIS(OFieldDescControl
,NULL
);
561 //////////////////////////////////////////////////////////////////////
562 // Texte der Controls auslesen
565 case FIELD_PROPERTY_BOOL_DEFAULT
:
567 return pBoolDefault
->GetSelectEntry();
569 case FIELD_PROPERTY_DEFAULT
:
571 return pDefault
->GetText();
573 case FIELD_PROPERTY_REQUIRED
:
575 return pRequired
->GetSelectEntry();
577 case FIELD_PROPERTY_TEXTLEN
:
579 return String::CreateFromInt64(pTextLen
->GetValue());
580 case FIELD_PROPERTY_NUMTYPE
:
582 return pNumType
->GetSelectEntry();
584 case FIELD_PROPERTY_AUTOINC
:
586 return pAutoIncrement
->GetSelectEntry();
588 case FIELD_PROPERTY_LENGTH
:
590 return pLength
->GetText();
592 case FIELD_PROPERTY_SCALE
:
594 return pScale
->GetText();
596 case FIELD_PROPERTY_FORMAT
:
598 return pFormatSample
->GetText();
600 case FIELD_PRPOERTY_COLUMNNAME
:
602 return m_pColumnName
->GetText();
603 case FIELD_PRPOERTY_TYPE
:
605 return m_pType
->GetSelectEntry();
607 case FIELD_PRPOERTY_AUTOINCREMENT
:
608 if(m_pAutoIncrementValue
)
609 return m_pAutoIncrementValue
->GetText();
615 //------------------------------------------------------------------------------
616 void OFieldDescControl::SetControlText( sal_uInt16 nControlId
, const String
& rText
)
618 DBG_CHKTHIS(OFieldDescControl
,NULL
);
619 //////////////////////////////////////////////////////////////////////
620 // Texte der Controls setzen
623 case FIELD_PROPERTY_BOOL_DEFAULT
:
626 String sOld
= pBoolDefault
->GetSelectEntry();
627 pBoolDefault
->SelectEntry(rText
);
628 if (!sOld
.Equals(rText
))
629 LINK(this, OFieldDescControl
, ChangeHdl
).Call(pBoolDefault
);
632 case FIELD_PROPERTY_DEFAULT
:
635 pDefault
->SetText(rText
);
636 UpdateFormatSample(pActFieldDescr
);
640 case FIELD_PROPERTY_REQUIRED
:
642 pRequired
->SelectEntry(rText
);
646 case FIELD_PROPERTY_TEXTLEN
:
648 pTextLen
->SetText(rText
);
651 case FIELD_PROPERTY_NUMTYPE
:
653 pNumType
->SelectEntry(rText
);
656 case FIELD_PROPERTY_AUTOINC
:
659 String sOld
= pAutoIncrement
->GetSelectEntry();
660 pAutoIncrement
->SelectEntry(rText
);
661 if (!sOld
.Equals(rText
))
662 LINK(this, OFieldDescControl
, ChangeHdl
).Call(pAutoIncrement
);
666 case FIELD_PROPERTY_LENGTH
:
668 pLength
->SetText(rText
);
671 case FIELD_PROPERTY_SCALE
:
673 pScale
->SetText(rText
);
676 case FIELD_PROPERTY_FORMAT
:
678 UpdateFormatSample(pActFieldDescr
);
680 case FIELD_PRPOERTY_COLUMNNAME
:
682 m_pColumnName
->SetText(rText
);
684 case FIELD_PRPOERTY_TYPE
:
686 m_pType
->SelectEntry(rText
);
688 case FIELD_PRPOERTY_AUTOINCREMENT
:
689 if(m_pAutoIncrementValue
)
690 m_pAutoIncrementValue
->SetText(rText
);
695 //------------------------------------------------------------------------
696 IMPL_LINK( OFieldDescControl
, FormatClickHdl
, Button
*, /*pButton*/ )
698 DBG_CHKTHIS(OFieldDescControl
,NULL
);
699 //////////////////////////////////////////////////////////////////////
700 // Temporaere Column erzeugen, mit der Datenaustausch mit Dialog erfolgt
701 if( !pActFieldDescr
)
704 sal_Int32
nOldFormatKey(pActFieldDescr
->GetFormatKey());
705 SvxCellHorJustify rOldJustify
= pActFieldDescr
->GetHorJustify();
706 Reference
< XNumberFormatsSupplier
> xSupplier
= GetFormatter()->getNumberFormatsSupplier();
707 SvNumberFormatsSupplierObj
* pSupplierImpl
= SvNumberFormatsSupplierObj::getImplementation( xSupplier
);
709 SvNumberFormatter
* pFormatter
= pSupplierImpl
->GetNumberFormatter();
711 if(::dbaui::callColumnFormatDialog(this,pFormatter
,pActFieldDescr
->GetType(),nOldFormatKey
,rOldJustify
,nFlags
,sal_True
))
713 sal_Bool bModified
= sal_False
;
714 if(nOldFormatKey
!= pActFieldDescr
->GetFormatKey())
716 pActFieldDescr
->SetFormatKey( nOldFormatKey
);
717 bModified
= sal_True
;
719 if(rOldJustify
!= pActFieldDescr
->GetHorJustify())
721 pActFieldDescr
->SetHorJustify( rOldJustify
);
722 bModified
= sal_True
;
727 SetModified(sal_True
);
728 UpdateFormatSample(pActFieldDescr
);
734 // -----------------------------------------------------------------------
735 void OFieldDescControl::SetModified(sal_Bool
/*bModified*/)
738 //------------------------------------------------------------------------
739 IMPL_LINK( OFieldDescControl
, ChangeHdl
, ListBox
*, pListBox
)
741 DBG_CHKTHIS(OFieldDescControl
,NULL
);
742 if ( !pActFieldDescr
)
745 if ( pListBox
->GetSavedValue() != pListBox
->GetSelectEntryPos() )
746 SetModified(sal_True
);
748 // Sonderbehandlund f"ur Bool Felder
749 if(pListBox
== pRequired
&& pBoolDefault
)
751 // wenn pRequired auf sal_True gesetzt ist, dann darf das sal_Bool Feld nicht den Eintrag <<keiner>> besitzen
752 String sDef
= BoolStringUI(::comphelper::getString(pActFieldDescr
->GetControlDefault()));
754 if(pRequired
->GetSelectEntryPos() == 0) // JA
756 pBoolDefault
->RemoveEntry(String(ModuleRes(STR_VALUE_NONE
)));
757 if (!sDef
.Equals(aYes
) && !sDef
.Equals(aNo
))
758 pBoolDefault
->SelectEntryPos(1); // nein als Default
760 pBoolDefault
->SelectEntry(sDef
);
762 else if(pBoolDefault
->GetEntryCount() < 3)
764 pBoolDefault
->InsertEntry(String(ModuleRes(STR_VALUE_NONE
)));
765 pBoolDefault
->SelectEntry(sDef
);
769 // nur fuer AutoIncrement eine Sonderbehandlung
770 if (pListBox
== pAutoIncrement
)
772 if(pListBox
->GetSelectEntryPos() == 1)
774 DeactivateAggregate( tpAutoIncrementValue
);
775 if(pActFieldDescr
->IsPrimaryKey())
776 DeactivateAggregate( tpRequired
);
777 else if( pActFieldDescr
->getTypeInfo()->bNullable
)
779 ActivateAggregate( tpRequired
);
782 if( pActFieldDescr
->IsNullable() )
783 pRequired
->SelectEntryPos( 1 ); // no
785 pRequired
->SelectEntryPos( 0 ); // yes
788 ActivateAggregate( tpDefault
);
792 DeactivateAggregate( tpRequired
);
793 DeactivateAggregate( tpDefault
);
794 ActivateAggregate( tpAutoIncrementValue
);
796 // und jetzt alle nach oben schieben
800 if(pListBox
== m_pType
)
802 TOTypeInfoSP pTypeInfo
= getTypeInfo(m_pType
->GetSelectEntryPos());
803 pActFieldDescr
->FillFromTypeInfo(pTypeInfo
,sal_True
,sal_False
); // SetType(pTypeInfo);
805 DisplayData(pActFieldDescr
);
806 CellModified(-1, m_pType
->GetPos());
811 //------------------------------------------------------------------------------
812 // alle Control neu anordnen, so dass sie in fester Reihenfolge und wirklich
813 // OBEN auf der DescriptionPage stehen
814 void OFieldDescControl::ArrangeAggregates()
816 DBG_CHKTHIS(OFieldDescControl
,NULL
);
817 // die Beschreibung eines Controls
818 struct AGGREGATE_DESCRIPTION
820 Control
* pctrlInputControl
; // das eigentliche Control zur Eingabe
821 Control
* pctrlTextControl
; // das Label dazu
822 USHORT nPosSizeArgument
; // das zweite Argument fuer SetPosSize
824 AGGREGATE_DESCRIPTION adAggregates
[] = {
825 { m_pColumnName
, m_pColumnNameText
, 1},
826 { m_pType
, m_pTypeText
, 1},
827 { pAutoIncrement
, pAutoIncrementText
, 1 },
828 { m_pAutoIncrementValue
, m_pAutoIncrementValueText
, 3 },
829 { pNumType
, pNumTypeText
, 1 },
830 { pRequired
, pRequiredText
, 1 },
831 { pTextLen
, pTextLenText
, 1 },
832 { pLength
, pLengthText
, 1 },
833 { pScale
, pScaleText
, 1 },
834 { pDefault
, pDefaultText
, 3 },
835 { pFormatSample
, pFormatText
, 4 },
836 { pBoolDefault
, pBoolDefaultText
, 1 },
840 for (size_t i
=0; i
<sizeof(adAggregates
)/sizeof(adAggregates
[0]); i
++)
842 if (adAggregates
[i
].pctrlTextControl
)
844 nMaxWidth
= ::std::max
<long>(OutputDevice::GetTextWidth(adAggregates
[i
].pctrlTextControl
->GetText()),nMaxWidth
);
848 OSL_ENSURE(nMaxWidth
!= 0,"Invalid width!");
851 int nCurrentControlPos
= 0;
852 Control
* pZOrderPredecessor
= NULL
;
853 for (size_t i
=0; i
<sizeof(adAggregates
)/sizeof(adAggregates
[0]); i
++)
855 if (adAggregates
[i
].pctrlInputControl
)
857 SetPosSize(&adAggregates
[i
].pctrlTextControl
, nCurrentControlPos
, 0);
858 SetPosSize(&adAggregates
[i
].pctrlInputControl
, nCurrentControlPos
, adAggregates
[i
].nPosSizeArgument
);
860 // die Z-Order so, dass die Controls auch wirklich in derselben Reihenfolge durchwandert werden koennen, in der sie
861 // hier angeordnet wurden
862 adAggregates
[i
].pctrlTextControl
->SetZOrder(pZOrderPredecessor
, pZOrderPredecessor
? WINDOW_ZORDER_BEHIND
: WINDOW_ZORDER_FIRST
);
863 adAggregates
[i
].pctrlInputControl
->SetZOrder(adAggregates
[i
].pctrlTextControl
, WINDOW_ZORDER_BEHIND
);
864 pZOrderPredecessor
= adAggregates
[i
].pctrlInputControl
;
866 if (adAggregates
[i
].pctrlInputControl
== pFormatSample
)
868 pFormat
->SetZOrder(pZOrderPredecessor
, WINDOW_ZORDER_BEHIND
);
869 pZOrderPredecessor
= pFormat
;
872 ++nCurrentControlPos
;
876 // eine Sonderbehandlung fuer die Format-Controls
879 Point
ptSamplePos(pFormatSample
->GetPosPixel());
880 Size
szSampleSize(pFormatSample
->GetSizePixel());
881 pFormat
->SetPosPixel(Point(ptSamplePos
.X() + szSampleSize
.Width() + 5, ptSamplePos
.Y()));
884 // als letztes noch die ScrollBars in der ZOrder ganz nach oben
885 m_pVertScroll
->SetZOrder(NULL
, WINDOW_ZORDER_FIRST
);
886 m_pHorzScroll
->SetZOrder(NULL
, WINDOW_ZORDER_FIRST
);
889 //------------------------------------------------------------------------------
890 void OFieldDescControl::ActivateAggregate( EControlType eType
)
892 DBG_CHKTHIS(OFieldDescControl
,NULL
);
893 //////////////////////////////////////////////////////////////////////
901 pDefaultText
= CreateText(STR_DEFAULT_VALUE
);
902 pDefault
= new OPropEditCtrl( this, STR_HELP_DEFAULT_VALUE
, FIELD_PROPERTY_DEFAULT
, WB_BORDER
);
903 InitializeControl(pDefault
,HID_TAB_ENT_DEFAULT
,false);
905 case tpAutoIncrementValue
:
906 if( m_pAutoIncrementValue
|| !isAutoIncrementValueEnabled() )
909 m_pAutoIncrementValueText
= CreateText(STR_AUTOINCREMENT_VALUE
);
910 m_pAutoIncrementValue
= new OPropEditCtrl( this, STR_HELP_AUTOINCREMENT_VALUE
, FIELD_PRPOERTY_AUTOINCREMENT
, WB_BORDER
);
911 m_pAutoIncrementValue
->SetText( getAutoIncrementValue() );
912 InitializeControl(m_pAutoIncrementValue
,HID_TAB_AUTOINCREMENTVALUE
,false);
919 Reference
< XDatabaseMetaData
> xMetaData
= getMetaData();
921 if(xMetaData
.is() && xMetaData
->supportsNonNullableColumns())
924 pRequiredText
= CreateText(STR_FIELD_REQUIRED
);
925 pRequired
= new OPropListBoxCtrl( this, STR_HELP_FIELD_REQUIRED
, FIELD_PROPERTY_REQUIRED
, WB_DROPDOWN
);
927 pRequired
->InsertEntry( aYes
);
928 pRequired
->InsertEntry( aNo
);
929 pRequired
->SelectEntryPos(1);
931 InitializeControl(pRequired
,HID_TAB_ENT_REQUIRED
,true);
935 case tpAutoIncrement
:
940 pAutoIncrementText
= CreateText(STR_FIELD_AUTOINCREMENT
);
941 pAutoIncrement
= new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT
, FIELD_PROPERTY_AUTOINC
, WB_DROPDOWN
);
942 pAutoIncrement
->InsertEntry( aYes
);
943 pAutoIncrement
->InsertEntry( aNo
);
944 pAutoIncrement
->SelectEntryPos(0);
945 InitializeControl(pAutoIncrement
,HID_TAB_ENT_AUTOINCREMENT
,true);
952 pTextLenText
= CreateText(STR_TEXT_LENGTH
);
953 pTextLen
= CreateNumericControl(STR_HELP_TEXT_LENGTH
, FIELD_PROPERTY_TEXTLEN
,HID_TAB_ENT_TEXT_LEN
);
960 m_pTypeText
= CreateText(STR_TAB_FIELD_DATATYPE
);
961 m_pType
= new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT
, FIELD_PRPOERTY_TYPE
, WB_DROPDOWN
);
962 m_pType
->SetDropDownLineCount(20);
964 const OTypeInfoMap
* pTypeInfo
= getTypeInfo();
965 OTypeInfoMap::const_iterator aIter
= pTypeInfo
->begin();
966 OTypeInfoMap::const_iterator aEnd
= pTypeInfo
->end();
967 for(;aIter
!= aEnd
;++aIter
)
968 m_pType
->InsertEntry( aIter
->second
->aUIName
);
970 m_pType
->SelectEntryPos(0);
971 InitializeControl(m_pType
,HID_TAB_ENT_TYPE
,true);
978 sal_uInt32 nMax
= EDIT_NOLIMIT
;
979 ::rtl::OUString aTmpString
;
982 Reference
< XDatabaseMetaData
> xMetaData
= getMetaData();
983 if ( xMetaData
.is() )
985 nMax
= xMetaData
->getMaxColumnNameLength();
986 aTmpString
= xMetaData
->getExtraNameCharacters();
991 DBG_UNHANDLED_EXCEPTION();
993 m_pColumnNameText
= CreateText(STR_TAB_FIELD_NAME
);
994 m_pColumnName
= new OPropColumnEditCtrl( this,
996 STR_HELP_DEFAULT_VALUE
,
997 FIELD_PRPOERTY_COLUMNNAME
,
999 m_pColumnName
->SetMaxTextLen(xub_StrLen( nMax
? nMax
: EDIT_NOLIMIT
));
1000 m_pColumnName
->setCheck( isSQL92CheckEnabled(getConnection()) );
1003 InitializeControl(m_pColumnName
,HID_TAB_ENT_COLUMNNAME
,false);
1009 pNumTypeText
= CreateText(STR_NUMERIC_TYPE
);
1011 pNumType
= new OPropListBoxCtrl( this, STR_HELP_NUMERIC_TYPE
, FIELD_PROPERTY_NUMTYPE
, WB_DROPDOWN
);
1012 pNumType
->SetDropDownLineCount(5);
1014 pNumType
->InsertEntry( String::CreateFromAscii("Byte") );
1015 pNumType
->InsertEntry( String::CreateFromAscii("SmallInt") );
1016 pNumType
->InsertEntry( String::CreateFromAscii("Integer") );
1017 pNumType
->InsertEntry( String::CreateFromAscii("Single") );
1018 pNumType
->InsertEntry( String::CreateFromAscii("Double") );
1019 pNumType
->SelectEntryPos(2);
1020 InitializeControl(pNumType
,HID_TAB_ENT_NUMTYP
,true);
1027 pLengthText
= CreateText(STR_LENGTH
);
1028 pLength
= CreateNumericControl(STR_HELP_LENGTH
, FIELD_PROPERTY_LENGTH
,HID_TAB_ENT_LEN
);
1035 pScaleText
= CreateText(STR_SCALE
);
1036 pScale
= CreateNumericControl(STR_HELP_SCALE
, FIELD_PROPERTY_SCALE
,HID_TAB_ENT_SCALE
);
1043 pFormatText
= CreateText(STR_FORMAT
);
1045 pFormatSample
= new OPropEditCtrl( this, STR_HELP_FORMAT_CODE
, -1, WB_BORDER
);
1046 pFormatSample
->SetReadOnly(sal_True
);
1047 pFormatSample
->Enable(sal_False
);
1048 InitializeControl(pFormatSample
,HID_TAB_ENT_FORMAT_SAMPLE
,false);
1050 pFormat
= new PushButton( this, ModuleRes(PB_FORMAT
) );
1051 const sal_Int32 nControlHeight
= GetMaxControlHeight();
1052 pFormat
->SetSizePixel(Size(nControlHeight
, nControlHeight
));
1053 pFormat
->SetClickHdl( LINK( this, OFieldDescControl
, FormatClickHdl
) );
1054 InitializeControl(pFormat
,HID_TAB_ENT_FORMAT
,false);
1057 UpdateFormatSample(pActFieldDescr
);
1064 pBoolDefaultText
= CreateText(STR_DEFAULT_VALUE
);
1065 pBoolDefault
= new OPropListBoxCtrl( this, STR_HELP_BOOL_DEFAULT
, FIELD_PROPERTY_BOOL_DEFAULT
, WB_DROPDOWN
);
1066 pBoolDefault
->SetDropDownLineCount(3);
1067 pBoolDefault
->InsertEntry(String(ModuleRes(STR_VALUE_NONE
)));
1068 pBoolDefault
->InsertEntry(aYes
);
1069 pBoolDefault
->InsertEntry(aNo
);
1071 InitializeControl(pBoolDefault
,HID_TAB_ENT_BOOL_DEFAULT
,false);
1075 // -----------------------------------------------------------------------------
1076 void OFieldDescControl::InitializeControl(Control
* _pControl
,ULONG _nHelpId
,bool _bAddChangeHandler
)
1078 _pControl
->SetHelpId(_nHelpId
);
1079 if ( _bAddChangeHandler
)
1080 ((OPropListBoxCtrl
*)_pControl
)->SetSelectHdl(LINK(this,OFieldDescControl
,ChangeHdl
));
1082 _pControl
->SetGetFocusHdl(LINK(this, OFieldDescControl
, OnControlFocusGot
));
1083 _pControl
->SetLoseFocusHdl(LINK(this, OFieldDescControl
, OnControlFocusLost
));
1084 _pControl
->EnableClipSiblings();
1086 // -----------------------------------------------------------------------------
1087 FixedText
* OFieldDescControl::CreateText(USHORT _nTextRes
)
1089 FixedText
* pFixedText
= new FixedText( this );
1090 pFixedText
->SetText( ModuleRes(_nTextRes
) );
1091 pFixedText
->EnableClipSiblings();
1094 // -----------------------------------------------------------------------------
1095 OPropNumericEditCtrl
* OFieldDescControl::CreateNumericControl(USHORT _nHelpStr
,short _nProperty
,ULONG _nHelpId
)
1097 OPropNumericEditCtrl
* pControl
= new OPropNumericEditCtrl( this, _nHelpStr
, _nProperty
, WB_BORDER
);
1098 pControl
->SetDecimalDigits(0);
1099 pControl
->SetMin(0);
1100 pControl
->SetMax(0x7FFFFFFF); // soll draussen geaendert werden, wenn noetig
1101 pControl
->SetStrictFormat(TRUE
);
1103 InitializeControl(pControl
,_nHelpId
,false);
1107 //------------------------------------------------------------------------------
1108 void OFieldDescControl::DeactivateAggregate( EControlType eType
)
1110 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1111 pLastFocusWindow
= NULL
;
1112 //////////////////////////////////////////////////////////////////////
1113 // Controls zerstoeren
1117 lcl_HideAndDeleteControl(m_nPos
,&pDefault
,&pDefaultText
);
1120 case tpAutoIncrementValue
:
1121 lcl_HideAndDeleteControl(m_nPos
,&m_pAutoIncrementValue
,&m_pAutoIncrementValueText
);
1125 lcl_HideAndDeleteControl(m_nPos
,&m_pColumnName
,&m_pColumnNameText
);
1129 lcl_HideAndDeleteControl(m_nPos
,&m_pType
,&m_pTypeText
);
1132 case tpAutoIncrement
:
1133 lcl_HideAndDeleteControl(m_nPos
,&pAutoIncrement
,&pAutoIncrementText
);
1137 lcl_HideAndDeleteControl(m_nPos
,&pRequired
,&pRequiredText
);
1141 lcl_HideAndDeleteControl(m_nPos
,&pTextLen
,&pTextLenText
);
1145 lcl_HideAndDeleteControl(m_nPos
,&pNumType
,&pNumTypeText
);
1149 lcl_HideAndDeleteControl(m_nPos
,&pLength
,&pLengthText
);
1153 lcl_HideAndDeleteControl(m_nPos
,&pScale
,&pScaleText
);
1157 // TODO: we have to check if we have to increment m_nPos again
1158 lcl_HideAndDeleteControl(m_nPos
,&pFormat
,&pFormatText
);
1159 if ( pFormatSample
)
1161 pFormatSample
->Hide();
1162 delete pFormatSample
;
1163 pFormatSample
= NULL
;
1167 lcl_HideAndDeleteControl(m_nPos
,&pBoolDefault
,&pBoolDefaultText
);
1172 //------------------------------------------------------------------------------
1173 void OFieldDescControl::SetPosSize( Control
** ppControl
, long nRow
, sal_uInt16 nCol
)
1175 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1177 //////////////////////////////////////////////////////////////////////
1178 // Groesse ermitteln
1179 const sal_Int32 nControlHeight
= GetMaxControlHeight();
1180 Size
aSize(0,nControlHeight
);
1181 if ( isRightAligned() && nCol
)
1182 aSize
.Width() = LogicToPixel(Size(m_nWidth
, 0),MAP_APPFONT
).Width();
1189 aSize
.Width() = CONTROL_WIDTH_1
;
1192 aSize
.Width() = CONTROL_WIDTH_2
;
1195 aSize
.Width() = CONTROL_WIDTH_3
;
1198 aSize
.Width() = CONTROL_WIDTH_4
;
1204 //////////////////////////////////////////////////////////////////////
1205 // Position ermitteln
1216 if ( isRightAligned() )
1218 Size aOwnSize
= GetSizePixel();
1219 aPosition
.X() = aOwnSize
.Width() - aSize
.Width();
1222 aPosition
.X() = CONTROL_WIDTH_1
+ CONTROL_SPACING_X
;
1228 (*ppControl
)->SetSizePixel( aSize
);
1229 aSize
= (*ppControl
)->GetSizePixel( );
1231 const sal_Int32 nControl_Spacing_y
= LogicToPixel(Size(0, CONTROL_SPACING_Y
),MAP_APPFONT
).Height();
1232 aPosition
.Y() += ((nRow
+1)*nControl_Spacing_y
) +
1233 (nRow
*nControlHeight
);
1235 //////////////////////////////////////////////////////////////////////
1237 (*ppControl
)->SetPosSizePixel( aPosition
, aSize
);
1238 aSize
= (*ppControl
)->GetSizePixel();
1240 (*ppControl
)->Show();
1242 //------------------------------------------------------------------------------
1243 void OFieldDescControl::DisplayData(OFieldDescription
* pFieldDescr
)
1245 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1246 pActFieldDescr
= pFieldDescr
;
1249 DeactivateAggregate( tpDefault
);
1250 DeactivateAggregate( tpRequired
);
1251 DeactivateAggregate( tpTextLen
);
1252 DeactivateAggregate( tpNumType
);
1253 DeactivateAggregate( tpScale
);
1254 DeactivateAggregate( tpLength
);
1255 DeactivateAggregate( tpFormat
);
1256 DeactivateAggregate( tpAutoIncrement
);
1257 DeactivateAggregate( tpBoolDefault
);
1258 DeactivateAggregate( tpColumnName
);
1259 DeactivateAggregate( tpType
);
1260 DeactivateAggregate( tpAutoIncrementValue
);
1261 m_pPreviousType
= TOTypeInfoSP();
1262 //////////////////////////////////////////////////////////////////////
1263 // Zeiger des gespeicherten Focus zuruecksetzen
1264 pLastFocusWindow
= NULL
;
1267 ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow
));
1268 m_bAdded
= sal_False
;
1275 ::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::AddWindow
));
1276 m_bAdded
= sal_True
;
1279 TOTypeInfoSP pFieldType
;
1281 pFieldType
= pFieldDescr
->getTypeInfo();
1283 ActivateAggregate( tpColumnName
);
1284 ActivateAggregate( tpType
);
1286 OSL_ENSURE(pFieldType
.get(),"We need a type information here!");
1287 //////////////////////////////////////////////////////////////////////
1288 // Wenn sich der Typ geaendert hat, Controls austauschen
1289 if( m_pPreviousType
!= pFieldType
)
1291 //////////////////////////////////////////////////////////////////////
1292 // Zeiger des gespeicherten Focus zuruecksetzen
1293 pLastFocusWindow
= NULL
;
1295 //////////////////////////////////////////////////////////////////////
1296 // Controls, die nicht mehr angezeigt werden duerfen
1297 DeactivateAggregate( tpNumType
);
1299 //////////////////////////////////////////////////////////////////////
1300 // determine which controls we should show and which not
1302 // 1. the required control
1303 if ( pFieldType
->bNullable
)
1304 ActivateAggregate( tpRequired
);
1306 DeactivateAggregate( tpRequired
);
1308 // 2. the autoincrement
1309 if ( pFieldType
->bAutoIncrement
)
1311 DeactivateAggregate( tpRequired
);
1312 DeactivateAggregate( tpDefault
);
1313 ActivateAggregate( tpAutoIncrement
);
1314 ActivateAggregate( tpAutoIncrementValue
);
1318 DeactivateAggregate( tpAutoIncrement
);
1319 DeactivateAggregate( tpAutoIncrementValue
);
1320 if(pFieldType
->bNullable
)
1321 ActivateAggregate( tpRequired
);
1323 DeactivateAggregate( tpRequired
);
1324 ActivateAggregate( tpDefault
);
1326 // 3. the scale and precision
1327 if (pFieldType
->nPrecision
)
1329 ActivateAggregate( tpLength
);
1330 pLength
->SetMax(::std::max
<sal_Int32
>(pFieldType
->nPrecision
,pFieldDescr
->GetPrecision()));
1331 pLength
->SetSpecialReadOnly(pFieldType
->aCreateParams
.getLength()==0);
1334 DeactivateAggregate( tpLength
);
1336 if (pFieldType
->nMaximumScale
)
1338 ActivateAggregate( tpScale
);
1339 pScale
->SetMax(::std::max
<sal_Int32
>(pFieldType
->nMaximumScale
,pFieldDescr
->GetScale()));
1340 pScale
->SetMin(pFieldType
->nMinimumScale
);
1341 static const ::rtl::OUString
s_sPRECISION(RTL_CONSTASCII_USTRINGPARAM("PRECISION"));
1342 pScale
->SetSpecialReadOnly(pFieldType
->aCreateParams
.getLength() == 0 || pFieldType
->aCreateParams
== s_sPRECISION
);
1345 DeactivateAggregate( tpScale
);
1347 // and now look for type specific things
1348 switch( pFieldType
->nType
)
1350 case DataType::CHAR
:
1351 case DataType::VARCHAR
:
1352 case DataType::LONGVARCHAR
:
1353 DeactivateAggregate( tpLength
);
1354 DeactivateAggregate( tpBoolDefault
);
1356 ActivateAggregate( tpDefault
);
1357 ActivateAggregate( tpFormat
);
1358 if (pFieldType
->nPrecision
)
1360 ActivateAggregate( tpTextLen
);
1361 pTextLen
->SetMax(::std::max
<sal_Int32
>(pFieldType
->nPrecision
,pFieldDescr
->GetPrecision()));
1362 pTextLen
->SetSpecialReadOnly(pFieldType
->aCreateParams
.getLength()==0);
1365 DeactivateAggregate( tpTextLen
);
1367 case DataType::DATE
:
1368 case DataType::TIME
:
1369 case DataType::TIMESTAMP
:
1370 DeactivateAggregate( tpLength
); // we don't need a length for date types
1371 DeactivateAggregate( tpTextLen
);
1372 DeactivateAggregate( tpBoolDefault
);
1374 ActivateAggregate( tpDefault
);
1375 ActivateAggregate( tpFormat
);
1378 case DataType::BOOLEAN
:
1379 DeactivateAggregate( tpTextLen
);
1380 DeactivateAggregate( tpFormat
);
1381 DeactivateAggregate( tpDefault
);
1383 ActivateAggregate( tpBoolDefault
);
1385 case DataType::DECIMAL
:
1386 case DataType::NUMERIC
:
1387 case DataType::BIGINT
:
1388 case DataType::FLOAT
:
1389 case DataType::DOUBLE
:
1390 case DataType::TINYINT
:
1391 case DataType::SMALLINT
:
1392 case DataType::INTEGER
:
1393 case DataType::REAL
:
1394 DeactivateAggregate( tpTextLen
);
1395 DeactivateAggregate( tpBoolDefault
);
1397 ActivateAggregate( tpFormat
);
1399 case DataType::BINARY
:
1400 case DataType::VARBINARY
:
1401 DeactivateAggregate( tpDefault
);
1402 DeactivateAggregate( tpRequired
);
1403 DeactivateAggregate( tpTextLen
);
1404 DeactivateAggregate( tpBoolDefault
);
1406 ActivateAggregate( tpFormat
);
1408 case DataType::LONGVARBINARY
:
1409 case DataType::SQLNULL
:
1410 case DataType::OBJECT
:
1411 case DataType::DISTINCT
:
1412 case DataType::STRUCT
:
1413 case DataType::ARRAY
:
1414 case DataType::BLOB
:
1415 case DataType::CLOB
:
1417 case DataType::OTHER
:
1418 DeactivateAggregate( tpFormat
);
1419 DeactivateAggregate( tpTextLen
);
1420 DeactivateAggregate( tpBoolDefault
);
1424 OSL_ENSURE(0,"Unknown type");
1426 m_pPreviousType
= pFieldType
;
1430 if(pFieldDescr
->IsPrimaryKey())
1432 DeactivateAggregate( tpRequired
);
1434 else if ( !pAutoIncrement
&& pFieldType
.get() )
1436 if ( pFieldType
->bNullable
)
1437 ActivateAggregate( tpRequired
);
1439 DeactivateAggregate( tpRequired
);
1442 //////////////////////////////////////////////////////////////////////
1443 // Controls initialisieren
1444 if( pAutoIncrement
)
1446 if ( pFieldDescr
->IsAutoIncrement() )
1448 pAutoIncrement
->SelectEntryPos( 0 ); // yes
1449 ActivateAggregate( tpAutoIncrementValue
);
1450 if ( m_pAutoIncrementValue
)
1451 m_pAutoIncrementValue
->SetText(pFieldDescr
->GetAutoIncrementValue());
1452 DeactivateAggregate( tpRequired
);
1453 DeactivateAggregate( tpDefault
);
1457 // disable autoincrement value because it should only be visible when autoincrement is to true
1458 DeactivateAggregate( tpAutoIncrementValue
);
1459 pAutoIncrement
->SelectEntryPos( 1 ); // no
1460 ActivateAggregate( tpDefault
);
1461 // hat Auswirkungen auf pRequired
1462 if(!pFieldDescr
->IsPrimaryKey())
1463 ActivateAggregate( tpRequired
);
1469 pDefault
->SetText( getControlDefault(pFieldDescr
) );
1470 pDefault
->ClearModifyFlag();
1475 // wenn pRequired auf sal_True gesetzt ist, dann darf das sal_Bool Feld nicht den Eintrag <<keiner>> besitzen
1476 String sDef
= BoolStringUI(::comphelper::getString(pFieldDescr
->GetControlDefault()));
1478 // sicher stellen das <<keiner>> nur vorhanden ist, wenn das Feld NULL sein darf
1479 if ( ( pFieldType
.get() && !pFieldType
->bNullable
) || !pFieldDescr
->IsNullable() )
1481 pFieldDescr
->SetIsNullable(ColumnValue::NO_NULLS
); // der Typ sagt das
1483 pBoolDefault
->RemoveEntry(String(ModuleRes(STR_VALUE_NONE
)));
1484 if ( !sDef
.Equals(aYes
) && !sDef
.Equals(aNo
) )
1485 pBoolDefault
->SelectEntryPos(1); // nein als Default
1487 pBoolDefault
->SelectEntry(sDef
);
1489 pFieldDescr
->SetControlDefault(makeAny(::rtl::OUString(BoolStringPersistent(pBoolDefault
->GetSelectEntry()))));
1491 else if(pBoolDefault
->GetEntryCount() < 3)
1493 pBoolDefault
->InsertEntry(String(ModuleRes(STR_VALUE_NONE
)));
1494 pBoolDefault
->SelectEntry(sDef
);
1497 pBoolDefault
->SelectEntry(sDef
);
1502 if( pFieldDescr
->IsNullable() )
1503 pRequired
->SelectEntryPos( 1 ); // no
1505 pRequired
->SelectEntryPos( 0 ); // yes
1510 pTextLen
->SetText( String::CreateFromInt32(pFieldDescr
->GetPrecision()) );
1511 pTextLen
->ClearModifyFlag();
1516 OSL_ENSURE(sal_False
, "OFieldDescControl::DisplayData: invalid num type!");
1520 pLength
->SetText( String::CreateFromInt32(pFieldDescr
->GetPrecision()) );
1523 pScale
->SetText( String::CreateFromInt32(pFieldDescr
->GetScale()) );
1526 UpdateFormatSample(pFieldDescr
);
1529 m_pColumnName
->SetText(pFieldDescr
->GetName());
1533 USHORT nPos
= pFieldType
.get() ? m_pType
->GetEntryPos(String(pFieldDescr
->getTypeInfo()->aUIName
)) : LISTBOX_ENTRY_NOTFOUND
;
1534 if(nPos
== LISTBOX_ENTRY_NOTFOUND
)
1536 const OTypeInfoMap
* pMap
= getTypeInfo();
1537 OTypeInfoMap::const_iterator aIter
= pMap
->find(pFieldType
.get() ? pFieldDescr
->getTypeInfo()->nType
: pFieldDescr
->GetType());
1538 if(aIter
== pMap
->end() && !pMap
->empty())
1540 aIter
= pMap
->begin();
1541 if(pFieldDescr
->GetPrecision() > aIter
->second
->nPrecision
)
1542 pFieldDescr
->SetPrecision(aIter
->second
->nPrecision
);
1543 if(pFieldDescr
->GetScale() > aIter
->second
->nMaximumScale
)
1544 pFieldDescr
->SetScale(0);
1545 if(!aIter
->second
->bNullable
&& pFieldDescr
->IsNullable())
1546 pFieldDescr
->SetIsNullable(ColumnValue::NO_NULLS
);
1547 if(!aIter
->second
->bAutoIncrement
&& pFieldDescr
->IsAutoIncrement())
1548 pFieldDescr
->SetAutoIncrement(sal_False
);
1550 if ( aIter
!= pMap
->end() )
1552 pFieldDescr
->SetType(aIter
->second
);
1555 m_pType
->SelectEntry(pFieldDescr
->getTypeInfo()->aUIName
);
1559 //////////////////////////////////////////////////////////////////////
1560 // Controls Enablen/Disablen
1561 sal_Bool
bRead(IsReadOnly());
1564 ArrangeAggregates();
1566 ScrollAllAggregates();
1568 SetReadOnly( bRead
);
1570 //------------------------------------------------------------------------
1571 IMPL_LINK(OFieldDescControl
, DelayedGrabFocus
, Control
**, ppControl
)
1573 nDelayedGrabFocusEvent
= 0;
1575 (*ppControl
)->GrabFocus();
1580 //------------------------------------------------------------------------------
1581 IMPL_LINK(OFieldDescControl
, OnControlFocusGot
, Control
*, pControl
)
1584 OPropNumericEditCtrl
* pNumeric
= dynamic_cast< OPropNumericEditCtrl
* >( pControl
);
1587 pNumeric
->SaveValue();
1588 strHelpText
= pNumeric
->GetHelp();
1591 OPropColumnEditCtrl
* pColumn
= dynamic_cast< OPropColumnEditCtrl
* >( pControl
);
1594 pColumn
->SaveValue();
1595 strHelpText
= pColumn
->GetHelp();
1598 OPropEditCtrl
* pEdit
= dynamic_cast< OPropEditCtrl
* >( pControl
);
1602 strHelpText
= pEdit
->GetHelp();
1605 OPropListBoxCtrl
* pListBox
= dynamic_cast< OPropListBoxCtrl
* >( pControl
);
1608 pListBox
->SaveValue();
1609 strHelpText
= pListBox
->GetHelp();
1612 if (pControl
== pFormat
)
1613 strHelpText
=String(ModuleRes(STR_HELP_FORMAT_BUTTON
));
1615 if (strHelpText
.Len() && (pHelp
!= NULL
))
1616 pHelp
->SetHelpText(strHelpText
);
1618 m_pActFocusWindow
= pControl
;
1623 //------------------------------------------------------------------------------
1624 IMPL_LINK(OFieldDescControl
, OnControlFocusLost
, Control
*, pControl
)
1626 if ((pControl
== pLength
) || (pControl
== pTextLen
) || (pControl
== pScale
))
1628 OPropNumericEditCtrl
* pConverted
= (OPropNumericEditCtrl
*)pControl
;
1629 if (pConverted
->IsModified())
1630 CellModified(-1, pConverted
->GetPos());
1632 if(pControl
== m_pColumnName
)
1634 OPropColumnEditCtrl
* pConverted
= (OPropColumnEditCtrl
*)pControl
;
1635 if (pConverted
->IsModified())
1636 CellModified(-1, pConverted
->GetPos());
1638 else if ((pControl
== pDefault
) || (pControl
== pFormatSample
) || (pControl
== m_pAutoIncrementValue
) )
1640 OPropEditCtrl
* pConverted
= (OPropEditCtrl
*)pControl
;
1641 if (pConverted
->IsModified())
1642 CellModified(-1, pConverted
->GetPos());
1644 else if ((pControl
== pRequired
) || (pControl
== pNumType
) || (pControl
== pAutoIncrement
) || (pControl
== pBoolDefault
) || (pControl
== m_pType
))
1646 OPropListBoxCtrl
* pConverted
= (OPropListBoxCtrl
*)pControl
;
1647 if (pConverted
->IsModified())
1648 CellModified(-1, pConverted
->GetPos());
1651 if (pControl
== pDefault
)
1652 UpdateFormatSample(pActFieldDescr
);
1654 implFocusLost(pControl
);
1658 //------------------------------------------------------------------------------
1659 void OFieldDescControl::SaveData( OFieldDescription
* pFieldDescr
)
1661 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1665 //////////////////////////////////////////////////////////////////////
1666 // Controls auslesen
1667 ::rtl::OUString sDefault
;
1670 if ( pDefault
->GetSavedValue() != pDefault
->GetText() )
1671 sDefault
= pDefault
->GetText();
1673 else if (pBoolDefault
)
1675 sDefault
= BoolStringPersistent(pBoolDefault
->GetSelectEntry());
1678 if ( sDefault
.getLength() )
1680 sal_uInt32 nFormatKey
;
1683 if ( isTextFormat(pFieldDescr
,nFormatKey
) || pBoolDefault
)
1685 pFieldDescr
->SetControlDefault(makeAny(sDefault
));
1691 double nValue
= GetFormatter()->convertStringToNumber(nFormatKey
,sDefault
);
1692 nValue
= checkDoubleForDateFormat(nValue
,nFormatKey
,GetFormatter());
1693 pFieldDescr
->SetControlDefault(makeAny(nValue
));
1695 catch(const Exception
&)
1697 if ( sDefault
.getLength() )
1698 pFieldDescr
->SetControlDefault(makeAny(sDefault
));
1700 pFieldDescr
->SetControlDefault(Any());
1704 catch(const Exception
&)
1707 } // if ( sDefault.getLength() )
1709 pFieldDescr
->SetControlDefault(Any());
1711 if((pRequired
&& pRequired
->GetSelectEntryPos() == 0) || pFieldDescr
->IsPrimaryKey() || (pBoolDefault
&& pBoolDefault
->GetEntryCount() == 2)) // yes
1712 pFieldDescr
->SetIsNullable( ColumnValue::NO_NULLS
);
1714 pFieldDescr
->SetIsNullable( ColumnValue::NULLABLE
);
1716 if ( pAutoIncrement
)
1717 pFieldDescr
->SetAutoIncrement( pAutoIncrement
->GetSelectEntryPos() == 0 );
1720 pFieldDescr
->SetPrecision( static_cast<sal_Int32
>(pTextLen
->GetValue()) );
1722 pFieldDescr
->SetPrecision( static_cast<sal_Int32
>(pLength
->GetValue()) );
1724 pFieldDescr
->SetScale( static_cast<sal_Int32
>(pScale
->GetValue()) );
1727 pFieldDescr
->SetName(m_pColumnName
->GetText());
1729 if ( m_pAutoIncrementValue
&& isAutoIncrementValueEnabled() )
1730 pFieldDescr
->SetAutoIncrementValue(m_pAutoIncrementValue
->GetText());
1733 //------------------------------------------------------------------------------
1734 void OFieldDescControl::UpdateFormatSample(OFieldDescription
* pFieldDescr
)
1736 if ( pFieldDescr
&& pFormatSample
)
1737 pFormatSample
->SetText(getControlDefault(pFieldDescr
,sal_False
));
1740 //------------------------------------------------------------------------------
1741 void OFieldDescControl::GetFocus()
1743 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1744 //////////////////////////////////////////////////////////////////////
1745 // Setzt den Focus auf das zuletzt aktive Control
1746 TabPage::GetFocus();
1747 if( pLastFocusWindow
)
1749 pLastFocusWindow
->GrabFocus();
1750 pLastFocusWindow
= NULL
;
1754 //------------------------------------------------------------------------------
1755 void OFieldDescControl::implFocusLost(Window
* _pWhich
)
1757 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1758 DBG_ASSERT(!_pWhich
|| IsChild(_pWhich
), "OFieldDescControl::implFocusLost : invalid window !");
1760 //////////////////////////////////////////////////////////////////////
1761 // Das aktive Control merken
1762 if (!pLastFocusWindow
)
1763 pLastFocusWindow
= _pWhich
;
1765 //////////////////////////////////////////////////////////////////////
1766 // HelpText zuruecksetzen
1767 if (pHelp
&& !pHelp
->HasChildPathFocus())
1768 pHelp
->SetHelpText( String() );
1771 //------------------------------------------------------------------------------
1772 void OFieldDescControl::LoseFocus()
1774 DBG_CHKTHIS(OFieldDescControl
,NULL
);
1776 implFocusLost(NULL
);
1778 TabPage::LoseFocus();
1780 // -----------------------------------------------------------------------------
1781 sal_Bool
OFieldDescControl::isCopyAllowed()
1783 sal_Bool bAllowed
= (m_pActFocusWindow
!= NULL
) &&
1784 (m_pActFocusWindow
== pDefault
|| m_pActFocusWindow
== pFormatSample
||
1785 m_pActFocusWindow
== pTextLen
|| m_pActFocusWindow
== pLength
||
1786 m_pActFocusWindow
== pScale
|| m_pActFocusWindow
== m_pColumnName
||
1787 m_pActFocusWindow
== m_pAutoIncrementValue
) &&
1788 static_cast<Edit
*>(m_pActFocusWindow
)->GetSelected().Len() != 0;
1792 // -----------------------------------------------------------------------------
1793 sal_Bool
OFieldDescControl::isCutAllowed()
1795 sal_Bool bAllowed
= (m_pActFocusWindow
!= NULL
) &&
1796 (m_pActFocusWindow
== pDefault
|| m_pActFocusWindow
== pFormatSample
||
1797 m_pActFocusWindow
== pTextLen
|| m_pActFocusWindow
== pLength
||
1798 m_pActFocusWindow
== pScale
|| m_pActFocusWindow
== m_pColumnName
||
1799 m_pActFocusWindow
== m_pAutoIncrementValue
) &&
1800 static_cast<Edit
*>(m_pActFocusWindow
)->GetSelected().Len() != 0;
1803 // -----------------------------------------------------------------------------
1804 sal_Bool
OFieldDescControl::isPasteAllowed()
1806 sal_Bool bAllowed
= (m_pActFocusWindow
!= NULL
) &&
1807 (m_pActFocusWindow
== pDefault
|| m_pActFocusWindow
== pFormatSample
||
1808 m_pActFocusWindow
== pTextLen
|| m_pActFocusWindow
== pLength
||
1809 m_pActFocusWindow
== pScale
|| m_pActFocusWindow
== m_pColumnName
||
1810 m_pActFocusWindow
== m_pAutoIncrementValue
);
1813 TransferableDataHelper
aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
1814 bAllowed
= aTransferData
.HasFormat(SOT_FORMAT_STRING
);
1818 // -----------------------------------------------------------------------------
1819 void OFieldDescControl::cut()
1822 static_cast<Edit
*>(m_pActFocusWindow
)->Cut();
1824 // -----------------------------------------------------------------------------
1825 void OFieldDescControl::copy()
1827 if(isCopyAllowed()) // this only checks if the focus window is valid
1828 static_cast<Edit
*>(m_pActFocusWindow
)->Copy();
1830 // -----------------------------------------------------------------------------
1831 void OFieldDescControl::paste()
1833 if(m_pActFocusWindow
) // this only checks if the focus window is valid
1834 static_cast<Edit
*>(m_pActFocusWindow
)->Paste();
1836 // -----------------------------------------------------------------------------
1837 sal_Bool
OFieldDescControl::isTextFormat(const OFieldDescription
* _pFieldDescr
,sal_uInt32
& _nFormatKey
) const
1839 _nFormatKey
= _pFieldDescr
->GetFormatKey();
1840 sal_Bool bTextFormat
= sal_True
;
1846 Reference
< ::com::sun::star::util::XNumberFormatTypes
> xNumberTypes(GetFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY
);
1847 OSL_ENSURE(xNumberTypes
.is(),"XNumberFormatTypes is null!");
1849 _nFormatKey
= ::dbtools::getDefaultNumberFormat( _pFieldDescr
->GetType(),
1850 _pFieldDescr
->GetScale(),
1851 _pFieldDescr
->IsCurrency(),
1855 sal_Int32 nNumberFormat
= ::comphelper::getNumberFormatType(GetFormatter(),_nFormatKey
);
1856 bTextFormat
= (nNumberFormat
== ::com::sun::star::util::NumberFormat::TEXT
);
1858 catch(const Exception
&)
1865 // -----------------------------------------------------------------------------
1866 String
OFieldDescControl::getControlDefault( const OFieldDescription
* _pFieldDescr
,sal_Bool _bCheck
) const
1868 ::rtl::OUString sDefault
;
1869 sal_Bool bCheck
= !_bCheck
|| _pFieldDescr
->GetControlDefault().hasValue();
1872 sal_uInt32 nFormatKey
;
1873 sal_Bool bTextFormat
= sal_False
;
1874 double nValue
= 0.0;
1878 bTextFormat
= isTextFormat(_pFieldDescr
,nFormatKey
);
1879 if ( _pFieldDescr
->GetControlDefault() >>= sDefault
)
1883 if ( sDefault
.getLength() )
1887 nValue
= GetFormatter()->convertStringToNumber(nFormatKey
,sDefault
);
1889 catch(const Exception
&)
1891 return ::rtl::OUString(); // return empty string for format example
1897 _pFieldDescr
->GetControlDefault() >>= nValue
;
1900 Reference
< ::com::sun::star::util::XNumberFormatter
> xNumberFormatter
= GetFormatter();
1901 Reference
<XPropertySet
> xFormSet
= xNumberFormatter
->getNumberFormatsSupplier()->getNumberFormats()->getByKey(nFormatKey
);
1902 OSL_ENSURE(xFormSet
.is(),"XPropertySet is null!");
1903 ::rtl::OUString sFormat
;
1904 xFormSet
->getPropertyValue(::rtl::OUString::createFromAscii("FormatString")) >>= sFormat
;
1909 ::comphelper::getNumberFormatProperty(xNumberFormatter
,nFormatKey
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Locale"))) >>= aLocale
;
1911 sal_Int32 nNumberFormat
= ::comphelper::getNumberFormatType(xNumberFormatter
,nFormatKey
);
1912 if( (nNumberFormat
& ::com::sun::star::util::NumberFormat::DATE
) == ::com::sun::star::util::NumberFormat::DATE
1913 || (nNumberFormat
& ::com::sun::star::util::NumberFormat::DATETIME
) == ::com::sun::star::util::NumberFormat::DATETIME
)
1915 nValue
= DBTypeConversion::toNullDate(DBTypeConversion::getNULLDate(xNumberFormatter
->getNumberFormatsSupplier()),nValue
);
1920 Reference
< ::com::sun::star::util::XNumberFormatPreviewer
> xPreViewer(xNumberFormatter
,UNO_QUERY
);
1921 OSL_ENSURE(xPreViewer
.is(),"XNumberFormatPreviewer is null!");
1922 sDefault
= xPreViewer
->convertNumberToPreviewString(sFormat
,nValue
,aLocale
,sal_True
);
1924 else if ( !_bCheck
|| (sDefault
.getLength() != 0) )
1925 sDefault
= xNumberFormatter
->formatString(nFormatKey
,(sDefault
.getLength() != 0 )? sDefault
: sFormat
);
1927 catch(const Exception
&)
1935 // -----------------------------------------------------------------------------