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