Kaydet (Commit) 9083e8d1 authored tarafından Noel Grandin's avatar Noel Grandin

convert SvxNumberFormatShell::AddFormat from xub_Strlen to sal_Int32

And make the return code be -1 for error.

Change-Id: I17d066180a604208f0ad689d5dffb77d126c256b
üst 63947810
...@@ -1272,7 +1272,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) ...@@ -1272,7 +1272,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
std::vector<OUString> a2EntryList; std::vector<OUString> a2EntryList;
sal_uInt16 nCatLbSelPos = 0; sal_uInt16 nCatLbSelPos = 0;
short nFmtLbSelPos = SELPOS_NONE; short nFmtLbSelPos = SELPOS_NONE;
xub_StrLen nErrPos=0; sal_Int32 nErrPos=0;
pNumFmtShell->SetCurCurrencyEntry(NULL); pNumFmtShell->SetCurCurrencyEntry(NULL);
bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos, bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
...@@ -1309,7 +1309,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) ...@@ -1309,7 +1309,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
a2EntryList); a2EntryList);
if(bDeleted) a2EntryList.clear(); if(bDeleted) a2EntryList.clear();
m_pEdFormat->GrabFocus(); m_pEdFormat->GrabFocus();
m_pEdFormat->SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); m_pEdFormat->SetSelection( Selection( 0, SELECTION_MAX ) );
nReturn |= nReturnOneArea; nReturn |= nReturnOneArea;
} }
else else
...@@ -1345,7 +1345,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) ...@@ -1345,7 +1345,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
else // syntax error else // syntax error
{ {
m_pEdFormat->GrabFocus(); 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); EditHdl_Impl(m_pEdFormat);
nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged)); nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged));
......
...@@ -104,7 +104,7 @@ public: ...@@ -104,7 +104,7 @@ public:
Color*& rpFontColor ); Color*& rpFontColor );
bool AddFormat( OUString& rFormat, bool AddFormat( OUString& rFormat,
xub_StrLen& rErrPos, sal_Int32& rErrPos,
sal_uInt16& rCatLbSelPos, sal_uInt16& rCatLbSelPos,
short& rFmtSelPos, short& rFmtSelPos,
std::vector<OUString>& rFmtEntries ); std::vector<OUString>& rFmtEntries );
......
...@@ -225,7 +225,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, ...@@ -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, sal_uInt16& rCatLbSelPos, short& rFmtSelPos,
std::vector<OUString>& rFmtEntries ) std::vector<OUString>& rFmtEntries )
{ {
...@@ -247,13 +247,11 @@ bool SvxNumberFormatShell::AddFormat( OUString& rFormat, xub_StrLen& rErrPos, ...@@ -247,13 +247,11 @@ bool SvxNumberFormatShell::AddFormat( OUString& rFormat, xub_StrLen& rErrPos,
} }
else // neues Format else // neues Format
{ {
OUString sTemp(rFormat);
sal_Int32 nPos; sal_Int32 nPos;
bInserted = pFormatter->PutEntry( sTemp, nPos, bInserted = pFormatter->PutEntry( rFormat, nPos,
nCurCategory, nAddKey, nCurCategory, nAddKey,
eCurLanguage ); eCurLanguage );
rErrPos = (nPos >= 0) ? (xub_StrLen)nPos : 0xFFFF; rErrPos = (nPos >= 0) ? nPos : -1;
rFormat = sTemp;
if (bInserted) if (bInserted)
{ {
...@@ -342,15 +340,15 @@ void SvxNumberFormatShell::MakeFormat( OUString& rFormat, ...@@ -342,15 +340,15 @@ void SvxNumberFormatShell::MakeFormat( OUString& rFormat,
{ {
if( aCurrencyFormatList.size() > static_cast<size_t>(nCurrencyPos) ) if( aCurrencyFormatList.size() > static_cast<size_t>(nCurrencyPos) )
{ {
xub_StrLen rErrPos=0; sal_Int32 rErrPos=0;
std::vector<OUString> aFmtEList; std::vector<OUString> aFmtEList;
sal_uInt32 nFound = pFormatter->TestNewString( aCurrencyFormatList[nCurrencyPos], eCurLanguage ); sal_uInt32 nFound = pFormatter->TestNewString( aCurrencyFormatList[nCurrencyPos], eCurLanguage );
if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND ) if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND )
{ {
sal_uInt16 rCatLbSelPos=0; sal_uInt16 rCatLbSelPos =0;
short rFmtSelPos=0; short rFmtSelPos = 0;
AddFormat( aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos, AddFormat( aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos,
rFmtSelPos,aFmtEList); rFmtSelPos,aFmtEList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment