summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/control')
-rwxr-xr-x[-rw-r--r--]vcl/source/control/edit.cxx8
-rw-r--r--vcl/source/control/field.cxx48
2 files changed, 48 insertions, 8 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index c0e7b352642c..786b190069c4 100644..100755
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2861,6 +2861,14 @@ Size Edit::CalcMinimumSize() const
return aSize;
}
+Size Edit::GetMinimumEditSize()
+{
+ Window* pDefWin = ImplGetDefaultWindow();
+ Edit aEdit( pDefWin, WB_BORDER );
+ Size aSize( aEdit.CalcMinimumSize() );
+ return aSize;
+}
+
// -----------------------------------------------------------------------
Size Edit::GetOptimalSize(WindowSizeType eType) const
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 090aa2a84163..6c2b06783984 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -224,6 +224,42 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue,
return TRUE;
}
+static void ImplUpdateSeparatorString( String& io_rText,
+ const String& rOldDecSep, const String& rNewDecSep,
+ const String& rOldThSep, const String& rNewThSep )
+{
+ rtl::OUStringBuffer aBuf( io_rText.Len() );
+ xub_StrLen nIndexDec = 0, nIndexTh = 0, nIndex = 0;
+
+ const sal_Unicode* pBuffer = io_rText.GetBuffer();
+ while( nIndex != STRING_NOTFOUND )
+ {
+ nIndexDec = io_rText.Search( rOldDecSep, nIndex );
+ nIndexTh = io_rText.Search( rOldThSep, nIndex );
+ if( (nIndexTh != STRING_NOTFOUND && nIndexDec != STRING_NOTFOUND && nIndexTh < nIndexDec )
+ || (nIndexTh != STRING_NOTFOUND && nIndexDec == STRING_NOTFOUND)
+ )
+ {
+ aBuf.append( pBuffer + nIndex, nIndexTh - nIndex );
+ aBuf.append( rNewThSep );
+ nIndex = nIndexTh + rOldThSep.Len();
+ }
+ else if( nIndexDec != STRING_NOTFOUND )
+ {
+ aBuf.append( pBuffer + nIndex, nIndexDec - nIndex );
+ aBuf.append( rNewDecSep );
+ nIndex = nIndexDec + rOldDecSep.Len();
+ }
+ else
+ {
+ aBuf.append( pBuffer + nIndex );
+ nIndex = STRING_NOTFOUND;
+ }
+ }
+
+ io_rText = aBuf.makeStringAndClear();
+}
+
static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDecSep,
const String& rOldThSep, const String& rNewThSep,
Edit* pEdit )
@@ -236,10 +272,7 @@ static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDe
BOOL bUpdateMode = pEdit->IsUpdateMode();
pEdit->SetUpdateMode( FALSE );
String aText = pEdit->GetText();
- if( bChangeDec )
- aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep );
- if( bChangeTh )
- aText.SearchAndReplaceAll( rNewThSep, rOldThSep );
+ ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep );
pEdit->SetText( aText );
ComboBox* pCombo = dynamic_cast<ComboBox*>(pEdit);
@@ -250,12 +283,11 @@ static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDe
for ( USHORT i=0; i < nEntryCount; i++ )
{
aText = pCombo->GetEntry( i );
- if( bChangeDec )
- aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep );
- if( bChangeTh )
- aText.SearchAndReplaceAll( rNewThSep, rOldThSep );
+ void* pEntryData = pCombo->GetEntryData( i );
+ ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep );
pCombo->RemoveEntry( i );
pCombo->InsertEntry( aText, i );
+ pCombo->SetEntryData( i, pEntryData );
}
}
if( bUpdateMode )