summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/numfmt.cxx6
-rw-r--r--include/svx/numfmtsh.hxx2
-rw-r--r--svx/source/items/numfmtsh.cxx14
3 files changed, 10 insertions, 12 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 5552c3a017bd..3212d48d8d05 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -1272,7 +1272,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
std::vector<OUString> a2EntryList;
sal_uInt16 nCatLbSelPos = 0;
short nFmtLbSelPos = SELPOS_NONE;
- xub_StrLen nErrPos=0;
+ sal_Int32 nErrPos=0;
pNumFmtShell->SetCurCurrencyEntry(NULL);
bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
@@ -1309,7 +1309,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
a2EntryList);
if(bDeleted) a2EntryList.clear();
m_pEdFormat->GrabFocus();
- m_pEdFormat->SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
+ m_pEdFormat->SetSelection( Selection( 0, SELECTION_MAX ) );
nReturn |= nReturnOneArea;
}
else
@@ -1345,7 +1345,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
else // syntax error
{
m_pEdFormat->GrabFocus();
- m_pEdFormat->SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
+ m_pEdFormat->SetSelection( Selection( nErrPos == -1 ? SELECTION_MAX : nErrPos, SELECTION_MAX ) );
}
EditHdl_Impl(m_pEdFormat);
nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged));
diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx
index d80a3dd3f7d7..6755aef97469 100644
--- a/include/svx/numfmtsh.hxx
+++ b/include/svx/numfmtsh.hxx
@@ -104,7 +104,7 @@ public:
Color*& rpFontColor );
bool AddFormat( OUString& rFormat,
- xub_StrLen& rErrPos,
+ sal_Int32& rErrPos,
sal_uInt16& rCatLbSelPos,
short& rFmtSelPos,
std::vector<OUString>& rFmtEntries );
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index a5f717383570..118ff9a1b765 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -225,7 +225,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
}
// -----------------------------------------------------------------------
-bool SvxNumberFormatShell::AddFormat( OUString& rFormat, xub_StrLen& rErrPos,
+bool SvxNumberFormatShell::AddFormat( OUString& rFormat, sal_Int32& rErrPos,
sal_uInt16& rCatLbSelPos, short& rFmtSelPos,
std::vector<OUString>& rFmtEntries )
{
@@ -247,13 +247,11 @@ bool SvxNumberFormatShell::AddFormat( OUString& rFormat, xub_StrLen& rErrPos,
}
else // neues Format
{
- OUString sTemp(rFormat);
sal_Int32 nPos;
- bInserted = pFormatter->PutEntry( sTemp, nPos,
+ bInserted = pFormatter->PutEntry( rFormat, nPos,
nCurCategory, nAddKey,
eCurLanguage );
- rErrPos = (nPos >= 0) ? (xub_StrLen)nPos : 0xFFFF;
- rFormat = sTemp;
+ rErrPos = (nPos >= 0) ? nPos : -1;
if (bInserted)
{
@@ -342,15 +340,15 @@ void SvxNumberFormatShell::MakeFormat( OUString& rFormat,
{
if( aCurrencyFormatList.size() > static_cast<size_t>(nCurrencyPos) )
{
- xub_StrLen rErrPos=0;
+ sal_Int32 rErrPos=0;
std::vector<OUString> aFmtEList;
sal_uInt32 nFound = pFormatter->TestNewString( aCurrencyFormatList[nCurrencyPos], eCurLanguage );
if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
- sal_uInt16 rCatLbSelPos=0;
- short rFmtSelPos=0;
+ sal_uInt16 rCatLbSelPos =0;
+ short rFmtSelPos = 0;
AddFormat( aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos,
rFmtSelPos,aFmtEList);
}