summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/XMLAutoTextEventImport.cxx9
-rw-r--r--xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx22
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx21
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx62
-rw-r--r--xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx7
-rw-r--r--xmloff/source/text/XMLTextColumnsExport.cxx10
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.cxx14
-rw-r--r--xmloff/source/text/txtflde.cxx57
-rw-r--r--xmloff/source/text/txtfldi.cxx17
-rw-r--r--xmloff/source/text/txtimp.cxx16
-rw-r--r--xmloff/source/text/txtprhdl.cxx24
11 files changed, 88 insertions, 171 deletions
diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx
index b1059c1ae5c6..385aa707ffd3 100644
--- a/xmloff/source/text/XMLAutoTextEventImport.cxx
+++ b/xmloff/source/text/XMLAutoTextEventImport.cxx
@@ -61,21 +61,20 @@ void XMLAutoTextEventImport::initialize(
{
// The events may come as either an XNameReplace or XEventsSupplier.
- const sal_Int32 nLength = rArguments.getLength();
- for( sal_Int32 i = 0; i < nLength; i++ )
+ for( const auto& rArgument : rArguments )
{
- const Type& rType = rArguments[i].getValueType();
+ const Type& rType = rArgument.getValueType();
if ( rType == cppu::UnoType<XEventsSupplier>::get())
{
Reference<XEventsSupplier> xSupplier;
- rArguments[i] >>= xSupplier;
+ rArgument >>= xSupplier;
DBG_ASSERT(xSupplier.is(), "need XEventsSupplier or XNameReplace");
xEvents = xSupplier->getEvents();
}
else if (rType == cppu::UnoType<XNameReplace>::get())
{
- rArguments[i] >>= xEvents;
+ rArgument >>= xEvents;
DBG_ASSERT(xEvents.is(), "need XEventsSupplier or XNameReplace");
}
}
diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
index b84bc32b38a6..17b3c3d64e14 100644
--- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
+++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
@@ -30,6 +30,7 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/sequence.hxx>
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::uno;
@@ -223,18 +224,8 @@ void XMLIndexBibliographyConfigurationContext::CreateAndInsert(bool)
if( xFactory.is() )
{
Sequence<OUString> aServices = xFactory->getAvailableServiceNames();
- bool bFound(false);
- sal_Int32 i(0);
- sal_Int32 nServiceCount(aServices.getLength());
- while (i < nServiceCount && !bFound)
- {
- if (aServices[i] == gsFieldMaster_Bibliography)
- // here we should use a method which compares in reverse order if available
- bFound = true;
- else
- i++;
- }
- if (bFound)
+ // here we should use a method which compares in reverse order if available
+ if (comphelper::findValue(aServices, gsFieldMaster_Bibliography) != -1)
{
Reference<XInterface> xIfc =
xFactory->createInstance(gsFieldMaster_Bibliography);
@@ -259,12 +250,7 @@ void XMLIndexBibliographyConfigurationContext::CreateAndInsert(bool)
xPropSet->setPropertyValue(gsSortAlgorithm, Any(sAlgorithm));
}
- sal_Int32 nCount = aSortKeys.size();
- Sequence<Sequence<PropertyValue> > aKeysSeq(nCount);
- for(i = 0; i < nCount; i++)
- {
- aKeysSeq[i] = aSortKeys[i];
- }
+ Sequence<Sequence<PropertyValue> > aKeysSeq = comphelper::containerToSequence(aSortKeys);
xPropSet->setPropertyValue(gsSortKeys, Any(aKeysSeq));
}
// else: can't get FieldMaster -> ignore
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 7e21cacd9a88..7a8a7e832df0 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -470,11 +470,8 @@ void XMLRedlineExport::ExportChangeInfo(
{
OUString sComment;
- sal_Int32 nCount = rPropertyValues.getLength();
- for(sal_Int32 i = 0; i < nCount; i++)
+ for(const PropertyValue& rVal : rPropertyValues)
{
- const PropertyValue& rVal = rPropertyValues[i];
-
if( rVal.Name == "RedlineAuthor" )
{
OUString sTmp;
@@ -536,28 +533,26 @@ void XMLRedlineExport::ExportStartOrEndRedline(
Sequence<PropertyValue> aValues;
aAny >>= aValues;
- const PropertyValue* pValues = aValues.getConstArray();
// seek for redline properties
bool bIsCollapsed = false;
bool bIsStart = true;
OUString sId;
bool bIdOK = false; // have we seen an ID?
- sal_Int32 nLength = aValues.getLength();
- for(sal_Int32 i = 0; i < nLength; i++)
+ for(const auto& rValue : aValues)
{
- if (pValues[i].Name == "RedlineIdentifier")
+ if (rValue.Name == "RedlineIdentifier")
{
- pValues[i].Value >>= sId;
+ rValue.Value >>= sId;
bIdOK = true;
}
- else if (pValues[i].Name == "IsCollapsed")
+ else if (rValue.Name == "IsCollapsed")
{
- bIsCollapsed = *o3tl::doAccess<bool>(pValues[i].Value);
+ bIsCollapsed = *o3tl::doAccess<bool>(rValue.Value);
}
- else if (pValues[i].Name == "IsStart")
+ else if (rValue.Name == "IsStart")
{
- bIsStart = *o3tl::doAccess<bool>(pValues[i].Value);
+ bIsStart = *o3tl::doAccess<bool>(rValue.Value);
}
}
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index ed9e9e2e6cae..f01dd7d16879 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -1035,14 +1035,11 @@ bool XMLSectionExport::ExportIndexTemplate(
true, true);
// export sequence
- sal_Int32 nTemplateCount = rValues.getLength();
- for(sal_Int32 nTemplateNo = 0;
- nTemplateNo < nTemplateCount;
- nTemplateNo++)
+ for(auto& rValue : rValues)
{
ExportIndexTemplateElement(
eType, //i90246
- rValues[nTemplateNo]);
+ rValue);
}
}
@@ -1192,11 +1189,10 @@ void XMLSectionExport::ExportIndexTemplateElement(
// token type
enum TemplateTypeEnum nTokenType = TOK_TTYPE_INVALID;
- sal_Int32 nCount = rValues.getLength();
- for(sal_Int32 i = 0; i<nCount; i++)
+ for(const auto& rValue : rValues)
{
TemplateParamEnum nToken;
- if ( SvXMLUnitConverter::convertEnum( nToken, rValues[i].Name,
+ if ( SvXMLUnitConverter::convertEnum( nToken, rValue.Name,
aTemplateParamMap ) )
{
// Only use direct and default values.
@@ -1209,54 +1205,54 @@ void XMLSectionExport::ExportIndexTemplateElement(
case TOK_TPARAM_TOKEN_TYPE:
{
OUString sVal;
- rValues[i].Value >>= sVal;
+ rValue.Value >>= sVal;
SvXMLUnitConverter::convertEnum( nTokenType, sVal, aTemplateTypeMap);
break;
}
case TOK_TPARAM_CHAR_STYLE:
// only valid, if not empty
- rValues[i].Value >>= sCharStyle;
+ rValue.Value >>= sCharStyle;
bCharStyleOK = !sCharStyle.isEmpty();
break;
case TOK_TPARAM_TEXT:
- rValues[i].Value >>= sText;
+ rValue.Value >>= sText;
bTextOK = true;
break;
case TOK_TPARAM_TAB_RIGHT_ALIGNED:
bRightAligned =
- *o3tl::doAccess<bool>(rValues[i].Value);
+ *o3tl::doAccess<bool>(rValue.Value);
break;
case TOK_TPARAM_TAB_POSITION:
- rValues[i].Value >>= nTabPosition;
+ rValue.Value >>= nTabPosition;
bTabPositionOK = true;
break;
// #i21237#
case TOK_TPARAM_TAB_WITH_TAB:
- bWithTabStop = *o3tl::doAccess<bool>(rValues[i].Value);
+ bWithTabStop = *o3tl::doAccess<bool>(rValue.Value);
bWithTabStopOK = true;
break;
case TOK_TPARAM_TAB_FILL_CHAR:
- rValues[i].Value >>= sFillChar;
+ rValue.Value >>= sFillChar;
bFillCharOK = true;
break;
case TOK_TPARAM_CHAPTER_FORMAT:
- rValues[i].Value >>= nChapterFormat;
+ rValue.Value >>= nChapterFormat;
bChapterFormatOK = true;
break;
//---> i53420
case TOK_TPARAM_CHAPTER_LEVEL:
- rValues[i].Value >>= nLevel;
+ rValue.Value >>= nLevel;
bLevelOK = true;
break;
case TOK_TPARAM_BIBLIOGRAPHY_DATA:
- rValues[i].Value >>= nBibliographyData;
+ rValue.Value >>= nBibliographyData;
bBibliographyDataOK = true;
break;
}
@@ -1514,8 +1510,7 @@ void XMLSectionExport::ExportLevelParagraphStyles(
aAny >>= aStyleNames;
// export only if at least one style is contained
- sal_Int32 nNamesCount = aStyleNames.getLength();
- if (nNamesCount > 0)
+ if (aStyleNames.hasElements())
{
// level attribute; we count 1..10; API 0..9
sal_Int32 nLevelPlusOne = nLevel + 1;
@@ -1530,12 +1525,12 @@ void XMLSectionExport::ExportLevelParagraphStyles(
true, true);
// iterate over styles in this level
- for(sal_Int32 nName = 0; nName < nNamesCount; nName++)
+ for(const auto& rStyleName : aStyleNames)
{
// stylename attribute
GetExport().AddAttribute(XML_NAMESPACE_TEXT,
XML_STYLE_NAME,
- GetExport().EncodeStyleName( aStyleNames[nName]) );
+ GetExport().EncodeStyleName(rStyleName) );
// element
SvXMLElementExport aParaStyle(GetExport(),
@@ -1648,16 +1643,10 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
aAny = xPropSet->getPropertyValue(sSortKeys);
Sequence<Sequence<PropertyValue> > aKeys;
aAny >>= aKeys;
- sal_Int32 nKeysCount = aKeys.getLength();
- for(sal_Int32 nKeys = 0; nKeys < nKeysCount; nKeys++)
+ for(Sequence<PropertyValue> & rKey : aKeys)
{
- Sequence<PropertyValue> & rKey = aKeys[nKeys];
-
- sal_Int32 nKeyCount = rKey.getLength();
- for(sal_Int32 nPropertyKey = 0; nPropertyKey < nKeyCount; nPropertyKey++)
+ for(PropertyValue& rValue : rKey)
{
- PropertyValue& rValue = rKey[nPropertyKey];
-
if (rValue.Name == "SortKey")
{
sal_Int16 nKey = 0;
@@ -1817,14 +1806,11 @@ void XMLSectionExport::ExportMasterDocHeadingDummies()
OUString sStyle;
Sequence<PropertyValue> aProperties;
xChapterNumbering->getByIndex( nLevel ) >>= aProperties;
- for( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
- {
- if( aProperties[i].Name == "HeadingStyleName" )
- {
- aProperties[i].Value >>= sStyle;
- break;
- }
- }
+ auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+ [](const PropertyValue& rProp) { return rProp.Name == "HeadingStyleName"; });
+ if (pProp != aProperties.end())
+ pProp->Value >>= sStyle;
+
if( !sStyle.isEmpty() )
{
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
diff --git a/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx b/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx
index 55beb5f027f3..225eb6dcd246 100644
--- a/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx
+++ b/xmloff/source/text/XMLTextCharStyleNamesElementExport.cxx
@@ -54,14 +54,11 @@ XMLTextCharStyleNamesElementExport::XMLTextCharStyleNamesElementExport(
{
aName = rExport.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_TEXT, GetXMLToken(XML_SPAN) );
- sal_Int32 i = nCount;
- const OUString *pName = aNames.getConstArray();
- while( --i )
+ for (const auto& rName : aNames)
{
rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
- rExport.EncodeStyleName( *pName ) );
+ rExport.EncodeStyleName( rName ) );
rExport.StartElement( aName, false );
- ++pName;
}
}
}
diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx
index 84501d2f6653..ff7bb4e4c89d 100644
--- a/xmloff/source/text/XMLTextColumnsExport.cxx
+++ b/xmloff/source/text/XMLTextColumnsExport.cxx
@@ -63,7 +63,6 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
rAny >>= xColumns;
Sequence < TextColumn > aColumns = xColumns->getColumns();
- const TextColumn *pColumns = aColumns.getArray();
sal_Int32 nCount = aColumns.getLength();
OUStringBuffer sValue;
@@ -166,28 +165,27 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
}
}
- while( nCount-- )
+ for (const auto& rColumn : aColumns)
{
// style:rel-width
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
- OUString::number(pColumns->Width) + "*" );
+ OUString::number(rColumn.Width) + "*" );
// fo:margin-left
GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue,
- pColumns->LeftMargin );
+ rColumn.LeftMargin );
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_START_INDENT,
sValue.makeStringAndClear() );
// fo:margin-right
GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue,
- pColumns->RightMargin );
+ rColumn.RightMargin );
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_END_INDENT,
sValue.makeStringAndClear() );
// style:column
SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE, XML_COLUMN,
true, true );
- pColumns++;
}
}
diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx
index 848fae8c9ae5..841711a46e27 100644
--- a/xmloff/source/text/XMLTextNumRuleInfo.cxx
+++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx
@@ -177,17 +177,11 @@ void XMLTextNumRuleInfo::Set(
Sequence<PropertyValue> aProps;
mxNumRules->getByIndex( mnListLevel ) >>= aProps;
- const PropertyValue* pPropArray = aProps.getConstArray();
- sal_Int32 nCount = aProps.getLength();
- for( sal_Int32 i=0; i<nCount; i++ )
+ auto pProp = std::find_if(aProps.begin(), aProps.end(),
+ [](const PropertyValue& rProp) { return rProp.Name == "StartWith"; });
+ if (pProp != aProps.end())
{
- const PropertyValue& rProp = pPropArray[i];
-
- if ( rProp.Name == "StartWith" )
- {
- rProp.Value >>= mnListLevelStartValue;
- break;
- }
+ pProp->Value >>= mnListLevelStartValue;
}
msListLabelString.clear();
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 293362b8ab10..8202d44e995d 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -392,40 +392,28 @@ enum FieldIdEnum XMLTextFieldExport::GetFieldID(
// get service names for rTextField (via XServiceInfo service)
Reference<XServiceInfo> xService(rTextField, UNO_QUERY);
const Sequence<OUString> aServices = xService->getSupportedServiceNames();
- const OUString* pNames = aServices.getConstArray();
- sal_Int32 nCount = aServices.getLength();
OUString sFieldName; // service name postfix of current field
// search for TextField service name
- while( nCount-- )
+ const OUString* pNames = std::find_if(aServices.begin(), aServices.end(),
+ [](const OUString& rName) { return rName.matchIgnoreAsciiCase(gsServicePrefix); });
+ if (pNames != aServices.end())
{
- if (pNames->matchIgnoreAsciiCase(gsServicePrefix))
- {
- // TextField found => postfix is field type!
- sFieldName = pNames->copy(gsServicePrefix.getLength());
- break;
- }
-
- ++pNames;
+ // TextField found => postfix is field type!
+ sFieldName = pNames->copy(gsServicePrefix.getLength());
}
// if this is not a normal text field, check if it's a presentation text field
if( sFieldName.isEmpty() )
{
- const OUString* pNames2 = aServices.getConstArray();
- sal_Int32 nCount2 = aServices.getLength();
// search for TextField service name
- while( nCount2-- )
+ pNames = std::find_if(aServices.begin(), aServices.end(),
+ [](const OUString& rName) { return rName.startsWith(gsPresentationServicePrefix); });
+ if (pNames != aServices.end())
{
- if( pNames2->startsWith(gsPresentationServicePrefix) )
- {
- // TextField found => postfix is field type!
- sFieldName = pNames2->copy(gsPresentationServicePrefix.getLength());
- break;
- }
-
- ++pNames2;
+ // TextField found => postfix is field type!
+ sFieldName = pNames->copy(gsPresentationServicePrefix.getLength());
}
if( !sFieldName.isEmpty() )
@@ -1963,10 +1951,7 @@ void XMLTextFieldExport::ExportFieldDeclarations(
aFieldMasters = xFieldMasterNameAccess->getElementNames();
}
- for(sal_Int32 i=0; i<aFieldMasters.getLength(); i++) {
-
- // get field master name
- OUString sFieldMaster = aFieldMasters[i];
+ for(const OUString& sFieldMaster : aFieldMasters) {
// workaround for #no-bug#
if ( sFieldMaster.startsWithIgnoreAsciiCase(
@@ -2707,13 +2692,12 @@ void XMLTextFieldExport::ProcessBibliographyData(
aAny >>= aValues;
// one attribute per value (unless empty)
- sal_Int32 nLength = aValues.getLength();
- for (sal_Int32 i = 0; i < nLength; i++)
+ for (const auto& rProp : aValues)
{
- if( aValues[i].Name == "BibiliographicType" )
+ if( rProp.Name == "BibiliographicType" )
{
sal_Int16 nTypeId = 0;
- aValues[i].Value >>= nTypeId;
+ rProp.Value >>= nTypeId;
OUStringBuffer sBuf;
if (SvXMLUnitConverter::convertEnum(sBuf, nTypeId,
@@ -2728,12 +2712,12 @@ void XMLTextFieldExport::ProcessBibliographyData(
else
{
OUString sStr;
- aValues[i].Value >>= sStr;
+ rProp.Value >>= sStr;
if (!sStr.isEmpty())
{
rExport.AddAttribute(XML_NAMESPACE_TEXT,
- MapBibliographyFieldName(aValues[i].Name),
+ MapBibliographyFieldName(rProp.Name),
sStr);
}
}
@@ -2762,14 +2746,7 @@ void XMLTextFieldExport::ProcessStringSequence(
const OUString& sSelected )
{
// find selected element
- sal_Int32 nSelected = -1;
- sal_Int32 nLength = rSequence.getLength();
- const OUString* pSequence = rSequence.getConstArray();
- for( sal_Int32 i = 0; i < nLength; i++ )
- {
- if( pSequence[i] == sSelected )
- nSelected = i;
- }
+ sal_Int32 nSelected = comphelper::findValue(rSequence, sSelected);
// delegate to ProcessStringSequence(OUString,sal_Int32)
ProcessStringSequence( rSequence, nSelected );
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index c1b1093a8ad3..ca2324471958 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2490,24 +2490,23 @@ void XMLMacroFieldImportContext::PrepareField(
Sequence<PropertyValue> aValues;
pEvents->GetEventSequence( "OnClick", aValues );
- sal_Int32 nLength = aValues.getLength();
- for( sal_Int32 i = 0; i < nLength; i++ )
+ for( const auto& rValue : aValues )
{
- if ( aValues[i].Name == "ScriptType" )
+ if ( rValue.Name == "ScriptType" )
{
// ignore ScriptType
}
- else if ( aValues[i].Name == "Library" )
+ else if ( rValue.Name == "Library" )
{
- aValues[i].Value >>= sLibraryName;
+ rValue.Value >>= sLibraryName;
}
- else if ( aValues[i].Name == "MacroName" )
+ else if ( rValue.Name == "MacroName" )
{
- aValues[i].Value >>= sMacroName;
+ rValue.Value >>= sMacroName;
}
- if ( aValues[i].Name == "Script" )
+ if ( rValue.Name == "Script" )
{
- aValues[i].Value >>= sScriptURL;
+ rValue.Value >>= sScriptURL;
}
}
}
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index fbb0f733ca3c..a100616f6e74 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1954,16 +1954,14 @@ void XMLTextImportHelper::FindOutlineStyleName( OUString& rStyleName,
Sequence<PropertyValue> aProperties;
m_xImpl->m_xChapterNumbering->getByIndex( nOutlineLevel )
>>= aProperties;
- for( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
+ auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+ [](const PropertyValue& rProp) { return rProp.Name == "HeadingStyleName"; });
+ if (pProp != aProperties.end())
{
- if (aProperties[i].Name == "HeadingStyleName")
- {
- OUString aOutlineStyle;
- aProperties[i].Value >>= aOutlineStyle;
- m_xImpl->m_xOutlineStylesCandidates[nOutlineLevel]
- .push_back( aOutlineStyle );
- break; // early out, if we found it!.
- }
+ OUString aOutlineStyle;
+ pProp->Value >>= aOutlineStyle;
+ m_xImpl->m_xOutlineStylesCandidates[nOutlineLevel]
+ .push_back( aOutlineStyle );
}
}
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 54142972acdc..ca2c6501e320 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -637,25 +637,13 @@ bool XMLTextColumnsPropertyHandler::equals(
Sequence < TextColumn > aColumns1 = xColumns1->getColumns();
Sequence < TextColumn > aColumns2 = xColumns2->getColumns();
- sal_Int32 nCount = aColumns1.getLength();
- if( aColumns2.getLength() != nCount )
- return false;
-
- const TextColumn *pColumns1 = aColumns1.getArray();
- const TextColumn *pColumns2 = aColumns2.getArray();
-
- while( nCount-- )
- {
- if( pColumns1->Width != pColumns2->Width ||
- pColumns1->LeftMargin != pColumns2->LeftMargin ||
- pColumns1->RightMargin != pColumns2->RightMargin )
- return false;
- pColumns1++;
- pColumns2++;
- }
-
- return true;
+ return std::equal(aColumns1.begin(), aColumns1.end(), aColumns2.begin(), aColumns2.end(),
+ [](const TextColumn& a, const TextColumn& b) {
+ return a.Width == b.Width
+ && a.LeftMargin == b.LeftMargin
+ && a.RightMargin == b.RightMargin;
+ });
}
bool XMLTextColumnsPropertyHandler::importXML(