Kaydet (Commit) 4420650b authored tarafından Matteo Casalin's avatar Matteo Casalin

xub_StrLen/unsigned to sal_Int32

Change-Id: I6d89f19ef2ee3aa83f3e74a416c41cd42dd448fa
üst 8a4c4520
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const; virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ); virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
static xub_StrLen GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, unsigned nHint = 0); static sal_Int32 GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, sal_Int32 nHint = 0);
// #i82544# // #i82544#
void SetLateInitialization() { bLateInitialization = true;} void SetLateInitialization() { bLateInitialization = true;}
}; };
......
...@@ -866,13 +866,13 @@ void SwGetExpField::SetValue( const double& rAny ) ...@@ -866,13 +866,13 @@ void SwGetExpField::SetValue( const double& rAny )
* @param nHint search starting position after the current field (or 0 if default) * @param nHint search starting position after the current field (or 0 if default)
* @return * @return
*/ */
xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, unsigned nHint) sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc, sal_Int32 nHint)
{ {
// //
const SwTxtFld* pTxtFld = rFmt.GetTxtFld(); const SwTxtFld* pTxtFld = rFmt.GetTxtFld();
const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
// //
xub_StrLen nRet = nHint ? nHint : *pTxtFld->GetStart() + 1; sal_Int32 nRet = nHint ? nHint : *pTxtFld->GetStart() + 1;
OUString sNodeText = rTxtNode.GetTxt(); OUString sNodeText = rTxtNode.GetTxt();
if(nRet<sNodeText.getLength()) if(nRet<sNodeText.getLength())
......
...@@ -285,14 +285,13 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) ...@@ -285,14 +285,13 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
return ; return ;
} }
// where is the category name (e.g. "Illustration")? // where is the category name (e.g. "Illustration")?
OUString const Text = pTxtNd->GetTxt(); OUString const sText = pTxtNd->GetTxt();
unsigned const nCatStart = Text.indexOf(sSetRefName); const sal_Int32 nCatStart = sText.indexOf(sSetRefName);
unsigned const nCatEnd = nCatStart == unsigned(-1) ? const bool bHasCat = nCatStart>=0;
unsigned(-1) : nCatStart + sSetRefName.getLength(); const sal_Int32 nCatEnd = bHasCat ? nCatStart + sSetRefName.getLength() : -1;
bool const bHasCat = nCatStart != unsigned(-1);
// length of the referenced text // length of the referenced text
unsigned const nLen = Text.getLength(); const sal_Int32 nLen = sText.getLength();
// which format? // which format?
switch( GetFormat() ) switch( GetFormat() )
...@@ -303,7 +302,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) ...@@ -303,7 +302,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
case REF_ONLYSEQNO: case REF_ONLYSEQNO:
{ {
// needed part of Text // needed part of Text
unsigned nStart, nEnd; sal_Int32 nStart;
sal_Int32 nEnd;
switch( nSubType ) switch( nSubType )
{ {
...@@ -329,7 +329,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) ...@@ -329,7 +329,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
pTxtNd->GetTxtAttrForCharAt(nNumStart, RES_TXTATR_FIELD) pTxtNd->GetTxtAttrForCharAt(nNumStart, RES_TXTATR_FIELD)
) { ) {
// start searching from nFrom // start searching from nFrom
unsigned const nFrom = bHasCat ? const sal_Int32 nFrom = bHasCat ?
std::max<unsigned>(nNumStart + 1, nCatEnd) : nNumStart + 1; std::max<unsigned>(nNumStart + 1, nCatEnd) : nNumStart + 1;
nStart = SwGetExpField::GetReferenceTextPos( nStart = SwGetExpField::GetReferenceTextPos(
pTxtAttr->GetFmtFld(), *pDoc, nFrom pTxtAttr->GetFmtFld(), *pDoc, nFrom
...@@ -345,7 +345,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) ...@@ -345,7 +345,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
// "Numbering" // "Numbering"
case REF_ONLYSEQNO: case REF_ONLYSEQNO:
nStart = nNumStart; nStart = nNumStart;
nEnd = std::min<unsigned>(nStart + 1, nLen); nEnd = std::min(nStart + 1, nLen);
break; break;
// "Reference" (whole Text) // "Reference" (whole Text)
......
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