summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/inc/verifyinput.hxx6
-rw-r--r--canvas/source/directx/dx_config.cxx2
-rw-r--r--canvas/source/directx/dx_surfacebitmap.cxx2
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx25
-rw-r--r--editeng/source/accessibility/AccessibleStaticTextBase.cxx23
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx59
-rw-r--r--scripting/source/dlgprov/dlgevtatt.hxx1
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx7
8 files changed, 53 insertions, 72 deletions
diff --git a/canvas/inc/verifyinput.hxx b/canvas/inc/verifyinput.hxx
index b37468ebbe24..7dd956c92882 100644
--- a/canvas/inc/verifyinput.hxx
+++ b/canvas/inc/verifyinput.hxx
@@ -360,10 +360,8 @@ namespace canvas
const css::uno::Reference< css::uno::XInterface >& xIf,
::sal_Int16 nArgPos )
{
- const SequenceContent* pCurr = rSequence.getConstArray();
- const SequenceContent* pEnd = pCurr + rSequence.getLength();
- while( pCurr != pEnd )
- verifyInput( *pCurr++, pStr, xIf, nArgPos );
+ for (auto& element : rSequence)
+ verifyInput(element, pStr, xIf, nArgPos);
}
/// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones)
diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx
index c1d9020845a2..643877659edd 100644
--- a/canvas/source/directx/dx_config.cxx
+++ b/canvas/source/directx/dx_config.cxx
@@ -48,7 +48,7 @@ namespace dxcanvas
uno::Sequence< uno::Any > aProps( GetProperties( { "DeviceDenylist" } ));
uno::Sequence< sal_Int32 > aValues;
- if( aProps.getLength() > 0 &&
+ if (aProps.hasElements() &&
(aProps[0] >>= aValues) )
{
const sal_Int32* pValues = aValues.getConstArray();
diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx
index 5a3992eea221..c425af2911ce 100644
--- a/canvas/source/directx/dx_surfacebitmap.cxx
+++ b/canvas/source/directx/dx_surfacebitmap.cxx
@@ -542,7 +542,7 @@ namespace dxcanvas
if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
throw uno::RuntimeException("failed to lock directx surface to surface memory");
- sal_uInt8 const *pSrc = reinterpret_cast<sal_uInt8 const *>(data.getConstArray());
+ auto* pSrc = data.getConstArray();
sal_uInt8 *pDst = (static_cast<BYTE *>(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1;
sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
for(sal_uInt32 y=0; y<nHeight; ++y)
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 1ab756832ad7..da13332d9ad4 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -796,11 +796,14 @@ namespace accessibility
struct IndexCompare
{
- const PropertyValue* pValues;
- explicit IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+ const uno::Sequence<beans::PropertyValue>& m_rValues;
+ explicit IndexCompare(const uno::Sequence<beans::PropertyValue>& rValues)
+ : m_rValues(rValues)
+ {
+ }
bool operator() ( sal_Int32 a, sal_Int32 b ) const
{
- return pValues[a].Name < pValues[b].Name;
+ return m_rValues[a].Name < m_rValues[b].Name;
}
};
@@ -1228,19 +1231,13 @@ namespace accessibility
//sort property values
// build sorted index array
sal_Int32 nLength = aRes.getLength();
- const beans::PropertyValue* pPairs = aRes.getConstArray();
- std::unique_ptr<sal_Int32[]> pIndices(new sal_Int32[nLength]);
- sal_Int32 i = 0;
- for( i = 0; i < nLength; i++ )
- pIndices[i] = i;
- std::sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+ std::vector<sal_Int32> indices(nLength);
+ std::iota(indices.begin(), indices.end(), 0);
+ std::sort(indices.begin(), indices.end(), IndexCompare(aRes));
// create sorted sequences according to index array
uno::Sequence<beans::PropertyValue> aNewValues( nLength );
- beans::PropertyValue* pNewValues = aNewValues.getArray();
- for( i = 0; i < nLength; i++ )
- {
- pNewValues[i] = pPairs[pIndices[i]];
- }
+ std::transform(indices.begin(), indices.end(), aNewValues.getArray(),
+ [&aRes](sal_Int32 index) { return aRes[index]; });
return aNewValues;
}
diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 262c52781e0d..7d22150e1503 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -903,13 +903,9 @@ namespace accessibility
for ( const auto& rDefAttr : aDefAttrVec )
{
- const beans::PropertyValue* pItr = aSeq.getConstArray();
- const beans::PropertyValue* pEnd = pItr + aSeq.getLength();
- const beans::PropertyValue* pFind = std::find_if( pItr, pEnd, PropertyValueEqualFunctor(rDefAttr) );
- if ( pFind != pEnd )
- {
- aIntersectionVec.push_back( *pFind );
- }
+ auto it = std::find_if(aSeq.begin(), aSeq.end(), PropertyValueEqualFunctor(rDefAttr));
+ if (it != aSeq.end())
+ aIntersectionVec.push_back(*it);
}
aDefAttrVec.swap( aIntersectionVec );
@@ -937,16 +933,13 @@ namespace accessibility
uno::Sequence< beans::PropertyValue > aIntersectionSeq = getDefaultAttributes( RequestedAttributes );
PropertyValueVector aDiffVec;
- const beans::PropertyValue* pDefAttr = aDefAttrSeq.getConstArray();
- const sal_Int32 nLength = aDefAttrSeq.getLength();
- for ( sal_Int32 i = 0; i < nLength; ++i )
+ for (auto& defAttr : aDefAttrSeq)
{
- const beans::PropertyValue* pItr = aIntersectionSeq.getConstArray();
- const beans::PropertyValue* pEnd = pItr + aIntersectionSeq.getLength();
- bool bNone = std::none_of( pItr, pEnd, PropertyValueEqualFunctor( pDefAttr[i] ) );
- if ( bNone && pDefAttr[i].Handle != 0)
+ bool bNone = std::none_of(aIntersectionSeq.begin(), aIntersectionSeq.end(),
+ PropertyValueEqualFunctor(defAttr));
+ if (bNone && defAttr.Handle != 0)
{
- aDiffVec.push_back( pDefAttr[i] );
+ aDiffVec.push_back(defAttr);
}
}
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 6facf2e75dbd..53c2e5b67406 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -281,37 +281,33 @@ namespace dlgprov
// We know that we have to do with instances of XControl.
// Otherwise this is not the right implementation for
// XScriptEventsAttacher and we have to give up.
- Reference< XControl > xControl( rObject, UNO_QUERY );
- Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
- Reference< XDialog > xDialog( xControl, UNO_QUERY );
- if ( !xControl.is() )
- throw IllegalArgumentException();
-
- // get XEventsSupplier from control model
- Reference< XControlModel > xControlModel = xControl->getModel();
- Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
- attachEventsToControl( xControl, xEventsSupplier, Helper );
- if ( mbUseFakeVBAEvents )
- {
- xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
- Any newHelper(xControl );
- attachEventsToControl( xControl, xEventsSupplier, newHelper );
- }
- if ( xControlContainer.is() && !xDialog.is() )
- {
- Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
- sal_Int32 nControlCount = aControls.getLength();
-
- Sequence< Reference< XInterface > > aObjects( nControlCount );
- Reference< XInterface >* pObjects2 = aObjects.getArray();
- const Reference< XControl >* pControls = aControls.getConstArray();
+ nestedAttachEvents(rObject.query<XControl>(), Helper, sDialogCodeName);
+ }
+ }
- for ( sal_Int32 i2 = 0; i2 < nControlCount; ++i2 )
- {
- pObjects2[i2].set( pControls[i2], UNO_QUERY );
- }
- nestedAttachEvents( aObjects, Helper, sDialogCodeName );
- }
+ void DialogEventsAttacherImpl::nestedAttachEvents(
+ const css::uno::Reference<css::awt::XControl>& xControl, const css::uno::Any& Helper,
+ OUString& sDialogCodeName)
+ {
+ if (!xControl.is())
+ throw IllegalArgumentException();
+ Reference<XControlContainer> xControlContainer(xControl, UNO_QUERY);
+ Reference<XDialog> xDialog(xControl, UNO_QUERY);
+
+ // get XEventsSupplier from control model
+ Reference<XControlModel> xControlModel = xControl->getModel();
+ Reference<XScriptEventsSupplier> xEventsSupplier(xControlModel, UNO_QUERY);
+ attachEventsToControl(xControl, xEventsSupplier, Helper);
+ if (mbUseFakeVBAEvents)
+ {
+ xEventsSupplier.set(getFakeVbaEventsSupplier(xControl, sDialogCodeName));
+ Any newHelper(xControl);
+ attachEventsToControl(xControl, xEventsSupplier, newHelper);
+ }
+ if (xControlContainer.is() && !xDialog.is())
+ {
+ for (auto& xChildControl : xControlContainer->getControls())
+ nestedAttachEvents(xChildControl, Helper, sDialogCodeName);
}
}
@@ -527,8 +523,7 @@ namespace dlgprov
{
OUString aMethodName = aScriptEvent.ScriptCode.copy( strlen("vnd.sun.star.UNO:") );
- const Any* pArguments = aScriptEvent.Arguments.getConstArray();
- Any aEventObject = pArguments[0];
+ Any aEventObject = aScriptEvent.Arguments[0];
bool bHandled = false;
if( m_xHandler.is() )
diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx
index 62a131de03a9..73e15ebb4566 100644
--- a/scripting/source/dlgprov/dlgevtatt.hxx
+++ b/scripting/source/dlgprov/dlgevtatt.hxx
@@ -54,6 +54,7 @@ namespace dlgprov
css::uno::Reference< css::script::XScriptListener > const & getScriptListenerForKey( const OUString& sScriptName );
css::uno::Reference< css::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const css::uno::Reference< css::awt::XControl>& xControl, OUString const & sCodeName );
void nestedAttachEvents( const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& Objects, const css::uno::Any& Helper, OUString& sDialogCodeName );
+ void nestedAttachEvents( const css::uno::Reference< css::awt::XControl >& xControl, const css::uno::Any& Helper, OUString& sDialogCodeName );
void attachEventsToControl( const css::uno::Reference< css::awt::XControl>& xControl, const css::uno::Reference< css::script::XScriptEventsSupplier >& events, const css::uno::Any& Helper );
public:
DialogEventsAttacherImpl( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 32e85900d440..bf499982ac7a 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -440,15 +440,12 @@ namespace dlgprov
return;
Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
- const Reference< XControl >* pControls = aControls.getConstArray();
sal_Int32 nControlCount = aControls.getLength();
Sequence< Reference< XInterface > > aObjects( nControlCount + 1 );
Reference< XInterface >* pObjects = aObjects.getArray();
- for ( sal_Int32 i = 0; i < nControlCount; ++i )
- {
- pObjects[i].set( pControls[i], UNO_QUERY );
- }
+ std::transform(aControls.begin(), aControls.end(), pObjects,
+ [](auto& xControl) { return xControl.template query<XInterface>(); });
// also add the dialog control itself to the sequence
pObjects[nControlCount].set( rxControl, UNO_QUERY );