rework to avoid coverity#1371205 Missing move assignment operator

Change-Id: I117fa0891e8cd1bf339bded93a7ee19d799caf9f
This commit is contained in:
Caolán McNamara
2016-10-26 21:33:31 +01:00
parent 424c7fb6ca
commit c484c353ef

View File

@@ -867,40 +867,20 @@ namespace accessibility
return pValues[a].Name < pValues[b].Name;
}
};
}
OUString AccessibleEditableTextPara::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
namespace
{
OUString GetFieldTypeNameFromField(EFieldInfo &ree)
{
OUString strFldType;
SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
//For field object info
sal_Int32 nParaIndex = GetParagraphIndex();
sal_Int32 nAllFieldLen = 0;
sal_Int32 nField = rCacheTF.GetFieldCount(nParaIndex), nFoundFieldIndex = -1;
EFieldInfo ree;
sal_Int32 reeBegin, reeEnd;
sal_Int32 nFieldType = -1;
for(sal_Int32 j = 0; j < nField; j++)
{
ree = rCacheTF.GetFieldInfo(nParaIndex, j);
reeBegin = ree.aPosition.nIndex + nAllFieldLen;
reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1);
if( reeBegin > nIndex )
{
break;
}
if( nIndex >= reeBegin && nIndex < reeEnd )
{
nFoundFieldIndex = j;
break;
}
}
if (nFoundFieldIndex >= 0 && ree.pFieldItem)
if (ree.pFieldItem)
{
// So we get a field, check its type now.
nFieldType = ree.pFieldItem->GetField()->GetClassId() ;
}
switch(nFieldType)
switch (nFieldType)
{
case text::textfield::Type::DATE:
{
@@ -912,8 +892,8 @@ namespace accessibility
else if (pDateField->GetType() == SVXDATETYPE_VAR)
strFldType = "date (variable)";
}
}
break;
}
case text::textfield::Type::PAGE:
strFldType = "page-number";
break;
@@ -938,8 +918,8 @@ namespace accessibility
else if (pTimeField->GetType() == SVXTIMETYPE_VAR)
strFldType = "time (variable)";
}
}
break;
}
case text::textfield::Type::AUTHOR:
strFldType = "author";
break;
@@ -952,6 +932,34 @@ namespace accessibility
}
return strFldType;
}
}
namespace accessibility
{
OUString AccessibleEditableTextPara::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
{
SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
//For field object info
sal_Int32 nParaIndex = GetParagraphIndex();
sal_Int32 nAllFieldLen = 0;
sal_Int32 nField = rCacheTF.GetFieldCount(nParaIndex);
for (sal_Int32 j = 0; j < nField; ++j)
{
EFieldInfo ree = rCacheTF.GetFieldInfo(nParaIndex, j);
sal_Int32 reeBegin = ree.aPosition.nIndex + nAllFieldLen;
sal_Int32 reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1);
if (reeBegin > nIndex)
{
break;
}
if (nIndex >= reeBegin && nIndex < reeEnd)
{
return GetFieldTypeNameFromField(ree);
}
}
return OUString();
}
uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleEditableTextPara::getAccessibleStateSet() throw (uno::RuntimeException, std::exception)
{