diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-02 22:56:03 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-03 10:08:31 +0200 |
commit | f20810f7829d9f3b7167df316e1303810b746366 (patch) | |
tree | 8a6eb44060c5b4134c24d794e2af3b02b557d885 /svx | |
parent | f1ba393af4f08f8502906c9221f8b6f1be2a7bad (diff) |
Use hasElements to check Sequence emptiness in sfx2..svx
Similar to clang-tidy readability-container-size-empty
Change-Id: Icabd773f3b924d465b33e8581175f1fcf70c282e
Reviewed-on: https://gerrit.libreoffice.org/71704
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 13 | ||||
-rw-r--r-- | svx/source/dialog/rubydialog.cxx | 4 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/databaselocationinput.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmexch.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmscriptingenv.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmtextcontrolshell.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 6 | ||||
-rw-r--r-- | svx/source/form/formcontroller.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/formfeaturedispatcher.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 2 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 2 | ||||
-rw-r--r-- | svx/source/items/customshapeitem.cxx | 2 | ||||
-rw-r--r-- | svx/source/mnuctrls/smarttagmenu.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/line/LineWidthPopup.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingControl.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 | ||||
-rw-r--r-- | svx/source/unodraw/unomod.cxx | 2 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 2 |
21 files changed, 35 insertions, 38 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 5ea15a0c73da..61a02c5044cd 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -631,7 +631,7 @@ void EnhancedCustomShape2d::SetPathSize( sal_Int32 nIndex ) sal_Int32 nWidth = 0; sal_Int32 nHeight = 0; - if ( seqSubViewSize.getLength() && nIndex < seqSubViewSize.getLength() ) { + if ( seqSubViewSize.hasElements() && nIndex < seqSubViewSize.getLength() ) { nWidth = seqSubViewSize[ nIndex ].Width; nHeight = seqSubViewSize[ nIndex ].Height; SAL_INFO( @@ -1094,10 +1094,9 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n tools::Rectangle EnhancedCustomShape2d::GetTextRect() const { - sal_Int32 nIndex, nSize = seqTextFrames.getLength(); - if ( !nSize ) + if ( !seqTextFrames.hasElements() ) return aLogicRect; - nIndex = 0; + sal_Int32 nIndex = 0; Point aTopLeft( GetPoint( seqTextFrames[ nIndex ].TopLeft, !bOOXMLShape, true ) ); Point aBottomRight( GetPoint( seqTextFrames[ nIndex ].BottomRight, !bOOXMLShape, true ) ); if ( bFlipH ) @@ -2561,9 +2560,7 @@ void EnhancedCustomShape2d::AdaptObjColor( SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) { - const sal_Int32 nCoordSize(seqCoordinates.getLength()); - - if ( !nCoordSize ) + if ( !seqCoordinates.hasElements() ) { return nullptr; } @@ -2748,7 +2745,7 @@ SdrObject* EnhancedCustomShape2d::CreateObject( bool bLineGeometryNeededOnly ) void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj ) { - if ( pObj && seqGluePoints.getLength() ) + if ( pObj && seqGluePoints.hasElements() ) { sal_uInt32 i, nCount = seqGluePoints.getLength(); for ( i = 0; i < nCount; i++ ) diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 1e24f853b039..7856b12e8687 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -183,7 +183,7 @@ void SvxRubyData_Impl::disposing(const EventObject&) void SvxRubyData_Impl::AssertOneEntry() { //create one entry - if (!aRubyValues.getLength()) + if (!aRubyValues.hasElements()) { aRubyValues.realloc(1); Sequence<PropertyValue>& rValues = aRubyValues.getArray()[0]; @@ -521,7 +521,7 @@ IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, weld::ScrolledWindow&, rScroll, void) IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl, weld::Button&, void) { const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); - if (!aRubyValues.getLength()) + if (!aRubyValues.hasElements()) { AssertOneEntry(); PositionHdl_Impl(*m_xPositionLB); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 85e26dbfe79e..b6dd17200d63 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -2550,7 +2550,7 @@ void DbListBox::SetList(const Any& rItems) pField->InsertEntry(*pStrings); m_rColumn.getModel()->getPropertyValue(FM_PROP_VALUE_SEQ) >>= m_aValueList; - m_bBound = m_aValueList.getLength() > 0; + m_bBound = m_aValueList.hasElements(); // tell the grid control that this controller is invalid and has to be re-initialized invalidatedController(); @@ -2636,7 +2636,7 @@ void DbListBox::updateFromModel( Reference< XPropertySet > _rxModel ) _rxModel->getPropertyValue( FM_PROP_SELECT_SEQ ) >>= aSelection; sal_Int16 nSelection = -1; - if ( aSelection.getLength() > 0 ) + if ( aSelection.hasElements() ) nSelection = aSelection[ 0 ]; ListBox* pListBox = static_cast< ListBox* >( m_pWindow.get() ); diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx index 40332f8b6053..96093e8134ca 100644 --- a/svx/source/form/databaselocationinput.cxx +++ b/svx/source/form/databaselocationinput.cxx @@ -184,9 +184,9 @@ namespace svx } // ensure we have at least one extension - OSL_ENSURE( m_aFilterExtensions.getLength(), + OSL_ENSURE( m_aFilterExtensions.hasElements(), "DatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow: unable to determine the file extension(s)!" ); - if ( m_aFilterExtensions.getLength() == 0 ) + if ( !m_aFilterExtensions.hasElements() ) { m_aFilterExtensions.realloc(1); m_aFilterExtensions[0] = "*.odb"; diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx index fd9c1ee677b2..ad3c2e8427f7 100644 --- a/svx/source/form/fmexch.cxx +++ b/svx/source/form/fmexch.cxx @@ -161,13 +161,13 @@ namespace svxform DataFlavorEx aFlavor; - if ( m_aHiddenControlModels.getLength() ) + if ( m_aHiddenControlModels.hasElements() ) { if ( lcl_fillDataFlavorEx( OControlExchange::getHiddenControlModelsFormatId(), aFlavor ) ) m_aCurrentFormats.push_back( aFlavor ); } - if ( m_xFormsRoot.is() && m_aControlPaths.getLength() ) + if ( m_xFormsRoot.is() && m_aControlPaths.hasElements() ) { if ( lcl_fillDataFlavorEx( OControlExchange::getControlPathFormatId(), aFlavor ) ) m_aCurrentFormats.push_back( aFlavor ); @@ -300,10 +300,10 @@ namespace svxform if (m_pFocusEntry && !m_aSelectedEntries.empty()) AddFormat(getFieldExchangeFormatId()); - if (m_aControlPaths.getLength()) + if (m_aControlPaths.hasElements()) AddFormat(getControlPathFormatId()); - if (m_aHiddenControlModels.getLength()) + if (m_aHiddenControlModels.hasElements()) AddFormat(getHiddenControlModelsFormatId()); } diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 4ee984b79b9c..22e77a5f28fa 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -284,7 +284,7 @@ void FmFormObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) xNewParent->insertByIndex(xNewParent->getCount(), makeAny(xMeAsFormComp)); // transfer the events - if (aNewEvents.getLength()) + if (aNewEvents.hasElements()) { try { diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx index 00b0d6ec95ac..27260c0381ea 100644 --- a/svx/source/form/fmscriptingenv.cxx +++ b/svx/source/form/fmscriptingenv.cxx @@ -965,7 +965,7 @@ namespace svxform Sequence< Any > aOutArgs; EventObject aEvent; Any aCaller; - if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) ) + if ( _rArguments.hasElements() && ( _rArguments[ 0 ] >>= aEvent ) ) { try { diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 9398f1dca662..2c64c1442e57 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -358,7 +358,7 @@ namespace if (!xEventManager.is()) return; // nothing to do - if (!rTransferIfAvailable.getLength()) + if (!rTransferIfAvailable.hasElements()) return; // nothing to do // check for the index of the model within its parent @@ -1203,7 +1203,7 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference<XFormCompon // transfer script events // (do this _after_ SetUnoControlModel as we need the new (implicitly created) control) - if (aOldScripts.getLength()) + if (aOldScripts.hasElements()) { // find the control for the model Reference<XControlContainer> xControlContainer(getControlContainerForView_Lock()); diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 5e0addf5542a..0076a59b36e5 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -384,7 +384,7 @@ namespace svx Sequence< PropertyValue > aComplexState; if ( _rUnoState >>= aComplexState ) { - if ( !aComplexState.getLength() ) + if ( !aComplexState.hasElements() ) _rSet.InvalidateItem( nWhich ); else { @@ -692,7 +692,7 @@ namespace svx { // these are no UNO slots, they need special handling since TransformItems cannot // handle them - DBG_ASSERT( aArgs.getLength() == 0, "FmTextControlShell::executeAttributeDialog: these are no UNO slots - are they?" ); + DBG_ASSERT( !aArgs.hasElements(), "FmTextControlShell::executeAttributeDialog: these are no UNO slots - are they?" ); const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>( pModifiedItem ); DBG_ASSERT( pBoolItem, "FmTextControlShell::executeAttributeDialog: no bool item?!" ); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 505efe757f13..bcb52c652096 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -843,7 +843,7 @@ static Reference< XControl > lcl_firstFocussableControl( const Sequence< Referen } } - if ( !xReturn.is() && _rControls.getLength() ) + if ( !xReturn.is() && _rControls.hasElements() ) xReturn = _rControls[0]; return xReturn; @@ -935,7 +935,7 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) // go for the first control of the controller Sequence< Reference< XControl > > aControls( xTabController->getControls() ); - if ( aControls.getLength() == 0 ) + if ( !aControls.hasElements() ) { Reference< XElementAccess > xFormElementAccess( xForm, UNO_QUERY_THROW ); if (xFormElementAccess->hasElements() && pPage && m_pView) @@ -947,7 +947,7 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) // trigger the creation itself, so we must hack this ... lcl_ensureControlsOfFormExist_nothrow( *pPage, *m_pView, *pWindow, xForm ); aControls = xTabController->getControls(); - OSL_ENSURE( aControls.getLength(), "FmXFormView::OnAutoFocus: no controls at all!" ); + OSL_ENSURE( aControls.hasElements(), "FmXFormView::OnAutoFocus: no controls at all!" ); } } diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index a5dc8c9073f1..d94ab3f765f1 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -4031,7 +4031,7 @@ void SAL_CALL FormController::invalidateAllFeatures( ) Sequence< sal_Int16 > aInterceptedFeatures( comphelper::mapKeysToSequence(m_aFeatureDispatchers) ); aGuard.clear(); - if ( aInterceptedFeatures.getLength() ) + if ( aInterceptedFeatures.hasElements() ) invalidateFeatures( aInterceptedFeatures ); } diff --git a/svx/source/form/formfeaturedispatcher.cxx b/svx/source/form/formfeaturedispatcher.cxx index 62b1d4635dbc..50faf597c463 100644 --- a/svx/source/form/formfeaturedispatcher.cxx +++ b/svx/source/form/formfeaturedispatcher.cxx @@ -135,7 +135,7 @@ namespace svx try { - if ( !_rArguments.getLength() ) + if ( !_rArguments.hasElements() ) { xFormOperations->execute( nFormFeature ); } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index cd641a0bd9de..1884b7a03f09 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1104,7 +1104,7 @@ namespace svxform makeAny( Reference< XForm >( xCurrentChild, UNO_QUERY ) ) ); } - if (aEvts.getLength()) + if (aEvts.hasElements()) { xManager.set(xContainer, UNO_QUERY); if (xManager.is()) diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 8aa991a74084..e3f80b010d25 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -191,7 +191,7 @@ void SAL_CALL GalleryThemePopup::statusChanged( { mpBackgroundPopup->InsertItem( 1, sItem ); } - else if ( ( rEvent.State >>= sItems ) && sItems.getLength() ) + else if ( ( rEvent.State >>= sItems ) && sItems.hasElements() ) { const OUString *pStr = sItems.getConstArray(); const OUString *pEnd = pStr + sItems.getLength(); diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index 329c2f09b7e0..61814a2cd586 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -201,7 +201,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName ) { - if ( aPropSeq.getLength() ) + if ( aPropSeq.hasElements() ) { PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) ); if ( aHashIter != aPropHashMap.end() ) diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx index 9a912c49912a..72187d9273ec 100644 --- a/svx/source/mnuctrls/smarttagmenu.cxx +++ b/svx/source/mnuctrls/smarttagmenu.cxx @@ -127,7 +127,7 @@ void SmartTagMenuController::FillMenu() const css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > >& rActionComponents = rActionComponentsSequence[i]; const css::uno::Sequence< sal_Int32 >& rActionIndices = rActionIndicesSequence[i]; - if ( 0 == rActionComponents.getLength() || 0 == rActionIndices.getLength() ) + if ( !rActionComponents.hasElements() || !rActionIndices.hasElements() ) continue; // Ask first entry for the smart tag type caption diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx index d8cc86bf57e7..abcefb0fe231 100644 --- a/svx/source/sidebar/line/LineWidthPopup.cxx +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -174,7 +174,7 @@ void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, MapUnit eMapUni { css::uno::Sequence <css::beans::NamedValue> aSeq = aWinOpt.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx index fbfc077c32ae..e4a75085bce8 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -113,7 +113,7 @@ void TextCharacterSpacingControl::Initialize() { css::uno::Sequence<css::beans::NamedValue> aSeq = aWinOpt.GetUserData(); OUString aTmp; - if(aSeq.getLength()) + if(aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData(aTmp); diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 8d21bbb518ee..a8457ef07700 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -1381,7 +1381,7 @@ css::uno::Sequence< OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNa // XInitialization void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { - if ( aArguments.getLength() ) + if ( aArguments.hasElements() ) aArguments[0] >>= m_xFrame; } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 30b545846808..ebfde724a6b7 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -299,7 +299,7 @@ void SAL_CALL SvxUnoDrawingModel::release() throw ( ) // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawingModel::getTypes( ) { - if( maTypeSequence.getLength() == 0 ) + if( !maTypeSequence.hasElements() ) { maTypeSequence = comphelper::concatSequences( SfxBaseModel::getTypes(), uno::Sequence { diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index b1a2a4b699fa..202d9ff8135c 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -1030,7 +1030,7 @@ void SAL_CALL SvXMLGraphicImportExportHelper::initialize( const Sequence< Any >& aArguments ) { Reference< embed::XStorage > xStorage; - if( aArguments.getLength() > 0 ) + if( aArguments.hasElements() ) aArguments[0] >>= xStorage; rtl::Reference<SvXMLGraphicHelper> pHelper( SvXMLGraphicHelper::Create( xStorage, m_eGraphicHelperMode )); |