summaryrefslogtreecommitdiff
path: root/xmlscript/source/xmldlg_imexp
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-05-09 15:17:26 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-09 18:21:59 +0200
commitfac093e5e63bd53bae3de552fedba927bd5c4561 (patch)
tree7b921dc813a6d6e0df55ef6d15edabb76e52bd40 /xmlscript/source/xmldlg_imexp
parent2479ab8b788ca000f2e979d0858de8d05de8e858 (diff)
Simplify Sequence iterations in xmlscript, xmlsecurity
Use range-based loops or replace with comphelper or STL functions Change-Id: I3d63811caf80c87a9d560087e1f0d933ebcc0d55 Reviewed-on: https://gerrit.libreoffice.org/72040 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlscript/source/xmldlg_imexp')
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx19
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx5
2 files changed, 9 insertions, 15 deletions
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 186dc6923f61..cf0a13e39235 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -318,11 +318,10 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
{
ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
- OUString const * pItemValues = itemValues.getConstArray();
- for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ for ( const auto& rItemValue : itemValues )
{
ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
- item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
+ item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
popup->addSubElement( item );
}
@@ -366,12 +365,10 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
{
ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
- OUString const * pItemValues = itemValues.getConstArray();
- sal_Int32 nPos;
- for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ for ( const auto& rItemValue : itemValues )
{
ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
- item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
+ item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
popup->addSubElement( item );
}
@@ -379,7 +376,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
if (readProp( "SelectedItems" ) >>= selected)
{
sal_Int16 const * pSelected = selected.getConstArray();
- for ( nPos = selected.getLength(); nPos--; )
+ for ( sal_Int32 nPos = selected.getLength(); nPos--; )
{
ElementDescriptor * item = static_cast< ElementDescriptor * >(
popup->getSubElement( pSelected[ nPos ] ).get() );
@@ -1090,14 +1087,12 @@ void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
if ( !xDialogModel.is() )
return; // #TODO throw???
Sequence< OUString > aElements( xDialogModel->getElementNames() );
- OUString const * pElements = aElements.getConstArray();
ElementDescriptor * pRadioGroup = nullptr;
- sal_Int32 nPos;
- for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
+ for ( const auto& rElement : aElements )
{
- Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
+ Any aControlModel( xDialogModel->getByName( rElement ) );
Reference< beans::XPropertySet > xProps;
OSL_VERIFY( aControlModel >>= xProps );
if (! xProps.is())
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 9341952eef35..eca2feb26fa0 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -1152,11 +1152,10 @@ void ElementDescriptor::readEvents()
if (xEvents.is())
{
Sequence< OUString > aNames( xEvents->getElementNames() );
- OUString const * pNames = aNames.getConstArray();
- for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); ++nPos )
+ for ( const auto& rName : aNames )
{
script::ScriptEventDescriptor descr;
- if (xEvents->getByName( pNames[ nPos ] ) >>= descr)
+ if (xEvents->getByName( rName ) >>= descr)
{
SAL_WARN_IF( descr.ListenerType.isEmpty() ||
descr.EventMethod.isEmpty() ||