summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-21 09:13:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-21 12:52:36 +0200
commit09c757cbdd3f973c97151203d8ff522141102da7 (patch)
treed1424cd2d3698965f847dc161c282ce1d00f9a94 /vcl
parent22a4b7e621cbb6cab1d82d57c370e3cf33b4e74e (diff)
use for-range on Sequence in testtools..xmloff
Change-Id: I05b02a2f8b4b9091c7de0f7e98409d5b608ed250 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94610 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/qt5/Qt5Tools.hxx4
-rw-r--r--vcl/osx/OSXTransferable.cxx4
-rw-r--r--vcl/osx/a11ytextattributeswrapper.mm3
-rw-r--r--vcl/osx/a11ywrapper.mm10
-rw-r--r--vcl/osx/printaccessoryview.mm14
-rw-r--r--vcl/osx/salprn.cxx6
-rw-r--r--vcl/qt5/Qt5AccessibleWidget.cxx21
-rw-r--r--vcl/source/window/NotebookBarAddonsMerger.cxx38
8 files changed, 49 insertions, 51 deletions
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index 88a85f89be55..1b58750ecbf9 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -91,9 +91,9 @@ Qt::DropAction getPreferredDropAction(sal_Int8 dragOperation);
inline QList<int> toQList(const css::uno::Sequence<sal_Int32>& aSequence)
{
QList<int> aList;
- for (sal_Int32 i = 0; i < aSequence.getLength(); i++)
+ for (sal_Int32 i : aSequence)
{
- aList.append(aSequence[i]);
+ aList.append(i);
}
return aList;
}
diff --git a/vcl/osx/OSXTransferable.cxx b/vcl/osx/OSXTransferable.cxx
index 426b618c95bd..77417f3c29bb 100644
--- a/vcl/osx/OSXTransferable.cxx
+++ b/vcl/osx/OSXTransferable.cxx
@@ -143,8 +143,8 @@ Sequence< DataFlavor > SAL_CALL OSXTransferable::getTransferDataFlavors( )
sal_Bool SAL_CALL OSXTransferable::isDataFlavorSupported(const DataFlavor& aFlavor)
{
- for (sal_Int32 i = 0; i < mFlavorList.getLength(); i++)
- if (compareDataFlavors(aFlavor, mFlavorList[i]))
+ for (const DataFlavor& rFlavor : mFlavorList)
+ if (compareDataFlavors(aFlavor, rFlavor))
return true;
return false;
diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm
index 28489268f4ee..433906d7d9b3 100644
--- a/vcl/osx/a11ytextattributeswrapper.mm
+++ b/vcl/osx/a11ytextattributeswrapper.mm
@@ -212,8 +212,7 @@ using namespace ::com::sun::star::uno;
sal_Int32 underlineColor = 0;
bool underlineHasColor = false;
// add attributes to string
- for ( int attrIndex = 0; attrIndex < attributes.getLength(); attrIndex++ ) {
- PropertyValue property = attributes [ attrIndex ];
+ for ( const PropertyValue& property : attributes ) {
// TODO: NSAccessibilityMisspelledTextAttribute, NSAccessibilityAttachmentTextAttribute, NSAccessibilityLinkTextAttribute
// NSAccessibilityStrikethroughColorTextAttribute is unsupported by UNP-API
if ( property.Value.hasValue() ) {
diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm
index ec09d61b479b..d3a42058dca9 100644
--- a/vcl/osx/a11ywrapper.mm
+++ b/vcl/osx/a11ywrapper.mm
@@ -315,8 +315,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet();
AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF );
if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) {
- for ( int index = 0; index < relationMemberOf.TargetSet.getLength(); index++ ) {
- Reference < XAccessible > rMateAccessible( relationMemberOf.TargetSet[index], UNO_QUERY );
+ for ( const auto& i : relationMemberOf.TargetSet ) {
+ Reference < XAccessible > rMateAccessible( i, UNO_QUERY );
if ( rMateAccessible.is() ) {
Reference< XAccessibleContext > rMateAccessibleContext( rMateAccessible -> getAccessibleContext() );
if ( rMateAccessibleContext.is() ) {
@@ -1046,11 +1046,13 @@ static Reference < XAccessibleContext > hitTestRunner ( css::awt::Point point,
if ( relationSet.is() && relationSet -> containsRelation ( AccessibleRelationType::SUB_WINDOW_OF )) {
// we have a valid relation to the parent element
AccessibleRelation relation = relationSet -> getRelationByType ( AccessibleRelationType::SUB_WINDOW_OF );
- for ( int i = 0; i < relation.TargetSet.getLength() && !hitChild.is(); i++ ) {
- Reference < XAccessible > rxAccessible ( relation.TargetSet [ i ], UNO_QUERY );
+ for ( const auto & i : relation.TargetSet ) {
+ Reference < XAccessible > rxAccessible ( i, UNO_QUERY );
if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) {
// hit test for children of parent
hitChild = hitTestRunner ( hitPoint, rxAccessible -> getAccessibleContext() );
+ if (hitChild.is())
+ break;
}
}
}
diff --git a/vcl/osx/printaccessoryview.mm b/vcl/osx/printaccessoryview.mm
index c6490ee36f68..932b65dd3609 100644
--- a/vcl/osx/printaccessoryview.mm
+++ b/vcl/osx/printaccessoryview.mm
@@ -1006,19 +1006,18 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf
// prepend a "selection" checkbox if the properties have such a selection in PrintContent
bool bAddSelectionCheckBox = false, bSelectionBoxEnabled = false, bSelectionBoxChecked = false;
- for( int i = 0; i < rOptions.getLength(); i++ )
+ for( const PropertyValue & prop : rOptions )
{
Sequence< beans::PropertyValue > aOptProp;
- rOptions[i].Value >>= aOptProp;
+ prop.Value >>= aOptProp;
OUString aCtrlType;
OUString aPropertyName;
Sequence< OUString > aChoices;
Sequence< sal_Bool > aChoicesDisabled;
sal_Int32 aSelectionChecked = 0;
- for( int n = 0; n < aOptProp.getLength(); n++ )
+ for( const beans::PropertyValue& rEntry : aOptProp )
{
- const beans::PropertyValue& rEntry( aOptProp[ n ] );
if( rEntry.Name == "ControlType" )
{
rEntry.Value >>= aCtrlType;
@@ -1051,10 +1050,10 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf
}
}
- for( int i = 0; i < rOptions.getLength(); i++ )
+ for( const PropertyValue & prop : rOptions )
{
Sequence< beans::PropertyValue > aOptProp;
- rOptions[i].Value >>= aOptProp;
+ prop.Value >>= aOptProp;
// extract ui element
OUString aCtrlType;
@@ -1067,9 +1066,8 @@ static void addEdit( NSView* pCurParent, long rCurX, long& rCurY, long nAttachOf
long nAttachOffset = 0;
bool bIgnore = false;
- for( int n = 0; n < aOptProp.getLength(); n++ )
+ for( const beans::PropertyValue& rEntry : aOptProp )
{
- const beans::PropertyValue& rEntry( aOptProp[ n ] );
if( rEntry.Name == "Text" )
{
rEntry.Value >>= aText;
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 9831bd24bd06..a1e5a0908b3b 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -334,12 +334,12 @@ static Size getPageSize( vcl::PrinterController const & i_rController, sal_Int32
{
Size aPageSize;
uno::Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) );
- for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty )
+ for( const PropertyValue & pv : aPageParms )
{
- if ( aPageParms[ nProperty ].Name == "PageSize" )
+ if ( pv.Name == "PageSize" )
{
awt::Size aSize;
- aPageParms[ nProperty].Value >>= aSize;
+ pv.Value >>= aSize;
aPageSize.setWidth( aSize.Width );
aPageSize.setHeight( aSize.Height );
break;
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 0ffdf102a10a..829e7e3a818d 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -848,26 +848,25 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf
return QString();
}
- Sequence<PropertyValue> attribs = xText->getCharacterAttributes(offset, Sequence<OUString>());
- const PropertyValue* pValues = attribs.getConstArray();
+ const Sequence<PropertyValue> attribs
+ = xText->getCharacterAttributes(offset, Sequence<OUString>());
OUString aRet;
- for (sal_Int32 i = 0; i < attribs.getLength(); i++)
+ for (PropertyValue const& prop : attribs)
{
- if (pValues[i].Name == "CharFontName")
+ if (prop.Name == "CharFontName")
{
- aRet += "font-family:" + *o3tl::doAccess<OUString>(pValues[i].Value) + ";";
+ aRet += "font-family:" + *o3tl::doAccess<OUString>(prop.Value) + ";";
continue;
}
- if (pValues[i].Name == "CharHeight")
+ if (prop.Name == "CharHeight")
{
- aRet += "font-size:" + OUString::number(*o3tl::doAccess<double>(pValues[i].Value))
- + "pt;";
+ aRet += "font-size:" + OUString::number(*o3tl::doAccess<double>(prop.Value)) + "pt;";
continue;
}
- if (pValues[i].Name == "CharWeight")
+ if (prop.Name == "CharWeight")
{
- aRet += "font-weight:"
- + lcl_convertFontWeight(*o3tl::doAccess<double>(pValues[i].Value)) + ";";
+ aRet += "font-weight:" + lcl_convertFontWeight(*o3tl::doAccess<double>(prop.Value))
+ + ";";
continue;
}
}
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx
index 689f26dbaf6d..9d6bf3dd98ea 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -43,24 +43,24 @@ static const char MERGE_NOTEBOOKBAR_STYLE[] = "Style";
static void GetAddonNotebookBarItem(const css::uno::Sequence<css::beans::PropertyValue>& pExtension,
AddonNotebookBarItem& aAddonNotebookBarItem)
{
- for (int nIdx = 0; nIdx < pExtension.getLength(); nIdx++)
+ for (const auto& i : pExtension)
{
- if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_URL)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sCommandURL;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_TITLE)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sLabel;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_IMAGEID)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sImageIdentifier;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_CONTEXT)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sContext;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_TARGET)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sTarget;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_CONTROLTYPE)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sControlType;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_WIDTH)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.nWidth;
- else if (pExtension[nIdx].Name == MERGE_NOTEBOOKBAR_STYLE)
- pExtension[nIdx].Value >>= aAddonNotebookBarItem.sStyle;
+ if (i.Name == MERGE_NOTEBOOKBAR_URL)
+ i.Value >>= aAddonNotebookBarItem.sCommandURL;
+ else if (i.Name == MERGE_NOTEBOOKBAR_TITLE)
+ i.Value >>= aAddonNotebookBarItem.sLabel;
+ else if (i.Name == MERGE_NOTEBOOKBAR_IMAGEID)
+ i.Value >>= aAddonNotebookBarItem.sImageIdentifier;
+ else if (i.Name == MERGE_NOTEBOOKBAR_CONTEXT)
+ i.Value >>= aAddonNotebookBarItem.sContext;
+ else if (i.Name == MERGE_NOTEBOOKBAR_TARGET)
+ i.Value >>= aAddonNotebookBarItem.sTarget;
+ else if (i.Name == MERGE_NOTEBOOKBAR_CONTROLTYPE)
+ i.Value >>= aAddonNotebookBarItem.sControlType;
+ else if (i.Name == MERGE_NOTEBOOKBAR_WIDTH)
+ i.Value >>= aAddonNotebookBarItem.nWidth;
+ else if (i.Name == MERGE_NOTEBOOKBAR_STYLE)
+ i.Value >>= aAddonNotebookBarItem.sStyle;
}
}
@@ -124,7 +124,8 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons(
{
aExtension = aNotebookBarAddonsItem.aAddonValues[nIdx];
- for (int nSecIdx = 0; nSecIdx < aExtension.getLength(); nSecIdx++)
+ for (const css::uno::Sequence<css::beans::PropertyValue>& pExtension :
+ std::as_const(aExtension))
{
VclPtr<vcl::Window> pOptionalParent;
pOptionalParent = VclPtr<OptionalBox>::Create(pParent);
@@ -139,7 +140,6 @@ void NotebookBarAddonsMerger::MergeNotebookBarAddons(
pFunction(pNotebookbarToolBox, pOptionalParent, rMap);
AddonNotebookBarItem aAddonNotebookBarItem;
- const css::uno::Sequence<css::beans::PropertyValue> pExtension = aExtension[nSecIdx];
GetAddonNotebookBarItem(pExtension, aAddonNotebookBarItem);
CreateNotebookBarToolBox(pNotebookbarToolBox, m_xFrame, aAddonNotebookBarItem,