summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/a11y
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-06-15 17:13:48 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-18 09:43:08 +0200
commit452a8e4abe0c416d664078baddff67c1561025ec (patch)
tree037f973aebd5e740d97525ff7aa852515762ae0b /vcl/unx/gtk/a11y
parente1eb7cb04a4c30cec238ab0f54d41a6cdc3299c1 (diff)
Simplify Sequence iterations in vcl
Use range-based loops or replace with comphelper or STL functions Change-Id: If046738084c2d13cc1eaea6a03aaf60b63f62767 Reviewed-on: https://gerrit.libreoffice.org/74104 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/gtk/a11y')
-rw-r--r--vcl/unx/gtk/a11y/atkaction.cxx18
-rw-r--r--vcl/unx/gtk/a11y/atktable.cxx4
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx14
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx11
4 files changed, 22 insertions, 25 deletions
diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index aff9cee2d91e..81e743238d84 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -167,22 +167,22 @@ action_wrapper_get_name (AtkAction *action,
static void
appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >& rKeyStrokes)
{
- for( sal_Int32 i = 0; i < rKeyStrokes.getLength(); i++ )
+ for( const auto& rKeyStroke : rKeyStrokes )
{
- if( rKeyStrokes[i].Modifiers & awt::KeyModifier::SHIFT )
+ if( rKeyStroke.Modifiers & awt::KeyModifier::SHIFT )
rBuffer.append("<Shift>");
- if( rKeyStrokes[i].Modifiers & awt::KeyModifier::MOD1 )
+ if( rKeyStroke.Modifiers & awt::KeyModifier::MOD1 )
rBuffer.append("<Control>");
- if( rKeyStrokes[i].Modifiers & awt::KeyModifier::MOD2 )
+ if( rKeyStroke.Modifiers & awt::KeyModifier::MOD2 )
rBuffer.append("<Alt>");
- if( ( rKeyStrokes[i].KeyCode >= awt::Key::A ) && ( rKeyStrokes[i].KeyCode <= awt::Key::Z ) )
- rBuffer.append( static_cast<sal_Char>( 'a' + ( rKeyStrokes[i].KeyCode - awt::Key::A ) ) );
+ if( ( rKeyStroke.KeyCode >= awt::Key::A ) && ( rKeyStroke.KeyCode <= awt::Key::Z ) )
+ rBuffer.append( static_cast<sal_Char>( 'a' + ( rKeyStroke.KeyCode - awt::Key::A ) ) );
else
{
sal_Char c = '\0';
- switch( rKeyStrokes[i].KeyCode )
+ switch( rKeyStroke.KeyCode )
{
case awt::Key::TAB: c = '\t'; break;
case awt::Key::SPACE: c = ' '; break;
@@ -198,7 +198,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
case 0:
break;
default:
- g_warning( "Unmapped KeyCode: %d", rKeyStrokes[i].KeyCode );
+ g_warning( "Unmapped KeyCode: %d", rKeyStroke.KeyCode );
break;
}
@@ -208,7 +208,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
{
// The KeyCode approach did not work, probably a non ascii character
// let's hope that there is a character given in KeyChar.
- rBuffer.append( OUStringToGChar( OUString( rKeyStrokes[i].KeyChar ) ) );
+ rBuffer.append( OUStringToGChar( OUString( rKeyStroke.KeyChar ) ) );
}
}
}
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index 016d697dce59..29ffa48d5b9d 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -20,6 +20,7 @@
#include "atkwrapper.hxx"
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <comphelper/sequence.hxx>
using namespace ::com::sun::star;
@@ -354,8 +355,7 @@ convertToGIntArray( const uno::Sequence< ::sal_Int32 >& aSequence, gint **pSelec
{
*pSelected = g_new( gint, aSequence.getLength() );
- for( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
- (*pSelected) [i] = aSequence[i];
+ *pSelected = comphelper::sequenceToArray(*pSelected, aSequence);
}
return aSequence.getLength();
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index d0d45527055b..6f3a7c5075e0 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -923,22 +923,20 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs )
if( rAny >>= theTabStops)
{
- sal_Int32 indexOfTab = 0;
- sal_Int32 numberOfTabs = theTabStops.getLength();
sal_Unicode lastFillChar = ' ';
- for( ; indexOfTab < numberOfTabs; ++indexOfTab )
+ for( const auto& rTabStop : theTabStops )
{
- bool is_default_tab = (style::TabAlign_DEFAULT == theTabStops[indexOfTab].Alignment);
+ bool is_default_tab = (style::TabAlign_DEFAULT == rTabStop.Alignment);
if( is_default_tab != default_tabs )
continue;
- double fValue = theTabStops[indexOfTab].Position;
+ double fValue = rTabStop.Position;
fValue = fValue * 0.01;
const gchar * tab_align = "";
- switch( theTabStops[indexOfTab].Alignment )
+ switch( rTabStop.Alignment )
{
case style::TabAlign_LEFT :
tab_align = "left ";
@@ -958,9 +956,9 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs )
const gchar * lead_char = "";
- if( theTabStops[indexOfTab].FillChar != lastFillChar )
+ if( rTabStop.FillChar != lastFillChar )
{
- lastFillChar = theTabStops[indexOfTab].FillChar;
+ lastFillChar = rTabStop.FillChar;
switch (lastFillChar)
{
case ' ':
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 63b4cfa04430..0998553bd927 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -504,10 +504,9 @@ atk_object_wrapper_relation_new(const accessibility::AccessibleRelation& rRelati
std::vector<AtkObject*> aTargets;
- for (sal_uInt32 i = 0; i < nTargetCount; ++i)
+ for (const auto& rTarget : rRelation.TargetSet)
{
- uno::Reference< accessibility::XAccessible > xAccessible(
- rRelation.TargetSet[i], uno::UNO_QUERY );
+ uno::Reference< accessibility::XAccessible > xAccessible( rTarget, uno::UNO_QUERY );
aTargets.push_back(atk_object_wrapper_ref(xAccessible));
}
@@ -571,12 +570,12 @@ wrapper_ref_state_set( AtkObject *atk_obj )
{
uno::Sequence< sal_Int16 > aStates = xStateSet->getStates();
- for( sal_Int32 n = 0; n < aStates.getLength(); n++ )
+ for( const auto nState : aStates )
{
// ATK_STATE_LAST_DEFINED is used to check if the state
// is unmapped, do not report it to Atk
- if ( mapAtkState( aStates[n] ) != ATK_STATE_LAST_DEFINED )
- atk_state_set_add_state( pSet, mapAtkState( aStates[n] ) );
+ if ( mapAtkState( nState ) != ATK_STATE_LAST_DEFINED )
+ atk_state_set_add_state( pSet, mapAtkState( nState ) );
}
// We need to emulate FOCUS state for menus, menu-items etc.