Kaydet (Commit) 038e4b3b authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Noel Grandin

Use hasElements to check Sequence emptiness in sax..sdext

Similar to clang-tidy readability-container-size-empty

Change-Id: If6a567708d3c59355d54933fad23c85195846624
Reviewed-on: https://gerrit.libreoffice.org/71763
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7bc6a718
......@@ -61,7 +61,7 @@ void AttributesTest::test()
xAttributeList->clear();
CPPUNIT_ASSERT( !xAttributeList->hasAttribute(1) );
CPPUNIT_ASSERT_EQUAL( sal_Int32(0), xAttributeList->getFastAttributes().getLength() );
CPPUNIT_ASSERT( !xAttributeList->getFastAttributes().hasElements() );
xAttributeList->addUnknown("c", "c");
CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xAttributeList->getUnknownAttributes().getLength() );
}
......
......@@ -372,7 +372,7 @@ void SAL_CALL
SaxExpatParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments)
{
// possible arguments: a string "DoSmeplease"
if (rArguments.getLength())
if (rArguments.hasElements())
{
OUString str;
if ((rArguments[0] >>= str) && "DoSmeplease" == str)
......
......@@ -59,7 +59,7 @@ sal_Int32 XMLFile2UTFConverter::readAndConvert( Sequence<sal_Int8> &seq , sal_In
if( ! m_bStarted && nRead )
{
// ensure that enough data is available to parse encoding
if( seqStart.getLength() )
if( seqStart.hasElements() )
{
// prefix with what we had so far.
sal_Int32 nLength = seq.getLength();
......@@ -382,7 +382,7 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> &
const sal_Int8 *pbSource = seqText.getConstArray();
std::unique_ptr<sal_Int8[]> pbTempMem;
if( m_seqSource.getLength() ) {
if( m_seqSource.hasElements() ) {
// put old rest and new byte sequence into one array
pbTempMem.reset(new sal_Int8[ nSourceSize ]);
memcpy( pbTempMem.get() , m_seqSource.getConstArray() , m_seqSource.getLength() );
......@@ -450,7 +450,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource ,
{
std::unique_ptr<sal_Unicode[]> puTempMem;
if( m_seqSource.getLength() ) {
if( m_seqSource.hasElements() ) {
// For surrogates !
// put old rest and new byte sequence into one array
// In general when surrogates are used, they should be rarely
......
......@@ -1334,7 +1334,7 @@ FastSaxParser::~FastSaxParser()
void SAL_CALL
FastSaxParser::initialize(css::uno::Sequence< css::uno::Any > const& rArguments)
{
if (rArguments.getLength())
if (rArguments.hasElements())
{
OUString str;
if ( rArguments[0] >>= str )
......
......@@ -296,7 +296,7 @@ SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new Namespace
void SAL_CALL SaxLegacyFastParser::initialize(Sequence< Any > const& rArguments )
{
if (rArguments.getLength())
if (rArguments.hasElements())
{
Reference< XFastTokenHandler > xTokenHandler;
OUString str;
......
......@@ -255,15 +255,15 @@ namespace sax_fastparser {
{
if( HAS_NAMESPACE( nElement ) ) {
auto const Namespace(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement)));
assert(Namespace.getLength() != 0);
assert(Namespace.hasElements());
writeBytes(Namespace);
writeBytes(sColon, N_CHARS(sColon));
auto const Element(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement)));
assert(Element.getLength() != 0);
assert(Element.hasElements());
writeBytes(Element);
} else {
auto const Element(mxFastTokenHandler->getUTF8Identifier(nElement));
assert(Element.getLength() != 0);
assert(Element.hasElements());
writeBytes(Element);
}
}
......
......@@ -1134,7 +1134,7 @@ public:
{ aProtectPass = rPass; }
const css::uno::Sequence< sal_Int8 >& GetProtection() const
{ return aProtectPass; }
bool IsProtected() const { return aProtectPass.getLength() != 0; }
bool IsProtected() const { return aProtectPass.hasElements(); }
// If time stamps of actions of this
// ChangeTrack and a second one are to be
......
......@@ -361,7 +361,7 @@ std::vector<OUString> getChartRangeRepresentations(const SdrOle2Obj& rChartObj)
}
Sequence<Reference<chart2::data::XLabeledDataSequence> > xDataSeqs = xDataSource->getDataSequences();
if (!xDataSeqs.getLength())
if (!xDataSeqs.hasElements())
{
cout << "There should be at least one data sequences." << endl;
return aRangeReps;
......
......@@ -1342,7 +1342,7 @@ void ScDPOutput::GetPositionData(const ScAddress& rPos, DataPilotTablePositionDa
break;
const uno::Sequence<sheet::MemberResult> rSequence = pColFields[nField].maResult;
if (rSequence.getLength() == 0)
if (!rSequence.hasElements())
break;
const sheet::MemberResult* pArray = rSequence.getConstArray();
......@@ -1371,7 +1371,7 @@ void ScDPOutput::GetPositionData(const ScAddress& rPos, DataPilotTablePositionDa
break;
const uno::Sequence<sheet::MemberResult> rSequence = pRowFields[nField].maResult;
if (rSequence.getLength() == 0)
if (!rSequence.hasElements())
break;
const sheet::MemberResult* pArray = rSequence.getConstArray();
......
......@@ -1325,7 +1325,7 @@ void ScDPResultMember::FillMemberResults(
// IsVisible() test is in ScDPResultDimension::FillMemberResults
// (not on data layout dimension)
if (!pSequences->getLength())
if (!pSequences->hasElements())
// empty sequence. Bail out.
return;
......
......@@ -126,7 +126,7 @@ OUString ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber)
}
uno::Sequence< OUString > aSuffixes = xOrdinalSuffix->getOrdinalSuffix( nNumber,
ScGlobal::pLocaleData->getLanguageTag().getLocale());
if ( aSuffixes.getLength() > 0 )
if ( aSuffixes.hasElements() )
return aSuffixes[0];
else
return OUString();
......
......@@ -180,7 +180,7 @@ Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText
Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(
const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash)
{
if (!rPassHash.getLength() || eHash == PASSHASH_UNSPECIFIED)
if (!rPassHash.hasElements() || eHash == PASSHASH_UNSPECIFIED)
return rPassHash;
// TODO: Right now, we only support double-hash by SHA1.
......@@ -227,7 +227,7 @@ bool ScTableProtectionImpl::isProtectedWithPass() const
if (!mbProtected)
return false;
return !maPassText.isEmpty() || maPassHash.getLength() || maPasswordHash.hasPassword();
return !maPassText.isEmpty() || maPassHash.hasElements() || maPasswordHash.hasPassword();
}
void ScTableProtectionImpl::setProtected(bool bProtected)
......
......@@ -210,7 +210,7 @@ ScUserList::ScUserList()
for ( sal_Int32 j = 0; j < xCalendars.getLength(); ++j )
{
xCal = xCalendars[j].Days;
if ( xCal.getLength() )
if ( xCal.hasElements() )
{
OUStringBuffer aDayShortBuf, aDayLongBuf;
sal_Int32 i;
......@@ -242,7 +242,7 @@ ScUserList::ScUserList()
}
xCal = xCalendars[j].Months;
if ( xCal.getLength() )
if ( xCal.hasElements() )
{
OUStringBuffer aMonthShortBuf, aMonthLongBuf;
sal_Int32 i;
......
......@@ -2749,7 +2749,7 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData )
// tdf#114168 If IntervalCount is 5, then enable automatic minor calculation.
// During import, if minorUnit is set and majorUnit not, then it is impossible
// to calculate IntervalCount.
const bool bAutoMinor = bLogScale || bAutoMajor || (rSubIncrementSeq.getLength() < 1) ||
const bool bAutoMinor = bLogScale || bAutoMajor || !rSubIncrementSeq.hasElements() ||
lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount ) || (nCount < 1) || (nCount == 5);
if( maData.mfMajorStep && !bAutoMinor )
......@@ -3090,7 +3090,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal
if( xCoordSysCont.is() )
{
Sequence< Reference< XCoordinateSystem > > aCoordSysSeq = xCoordSysCont->getCoordinateSystems();
if( aCoordSysSeq.getLength() > 0 )
if( aCoordSysSeq.hasElements() )
{
/* Process first coordinate system only. Import filter puts all
chart types into one coordinate system. */
......
......@@ -832,7 +832,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference<
OUString aDefText;
if( aCtrlProp.GetProperty( aStringList, "StringItemList" ) &&
aCtrlProp.GetProperty( aDefText, "Text" ) &&
aStringList.getLength() && !aDefText.isEmpty() )
aStringList.hasElements() && !aDefText.isEmpty() )
{
const OUString* pBegin = aStringList.getConstArray();
const OUString* pEnd = pBegin + aStringList.getLength();
......
......@@ -301,11 +301,8 @@ bool XclExpRoot::IsDocumentEncrypted() const
if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE))
return true;
if ( GetEncryptionData().getLength() > 0 )
// Password is entered directly into the save dialog.
return true;
return false;
// Whether password is entered directly into the save dialog.
return GetEncryptionData().hasElements();
}
uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUString& aPass )
......
......@@ -3643,7 +3643,7 @@ void XclImpChAxesSet::Convert( Reference< XDiagram > const & xDiagram ) const
{
Reference< XCoordinateSystemContainer > xCoordSystemCont( xDiagram, UNO_QUERY_THROW );
Sequence< Reference< XCoordinateSystem > > aCoordSystems = xCoordSystemCont->getCoordinateSystems();
if( aCoordSystems.getLength() == 0 )
if( !aCoordSystems.hasElements() )
xCoordSystemCont->addCoordinateSystem( xCoordSystem );
}
catch( Exception& )
......@@ -3730,7 +3730,7 @@ Reference< XCoordinateSystem > XclImpChAxesSet::CreateCoordSystem( Reference< XD
{
Sequence< Reference< XCoordinateSystem > > aCoordSystems = xCoordSystemCont->getCoordinateSystems();
OSL_ENSURE( aCoordSystems.getLength() <= 1, "XclImpChAxesSet::CreateCoordSystem - too many existing coordinate systems" );
if( aCoordSystems.getLength() > 0 )
if( aCoordSystems.hasElements() )
xCoordSystem = aCoordSystems[ 0 ];
}
......
......@@ -64,8 +64,8 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const
::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
{
o_rEncryptionData = OnVerifyPassword( rPassword );
mnError = o_rEncryptionData.getLength() ? ERRCODE_NONE : ERRCODE_ABORT;
return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword;
mnError = o_rEncryptionData.hasElements() ? ERRCODE_NONE : ERRCODE_ABORT;
return o_rEncryptionData.hasElements() ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword;
}
::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData )
......@@ -173,7 +173,7 @@ bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N
{
maEncryptionData.realloc( 0 );
if( rEncryptionData.getLength() )
if( rEncryptionData.hasElements() )
{
// init codec
maCodec.InitCodec( rEncryptionData );
......@@ -182,7 +182,7 @@ bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N
maEncryptionData = rEncryptionData;
}
return maEncryptionData.getLength();
return maEncryptionData.hasElements();
}
void XclImpBiff5Decrypter::OnUpdate( std::size_t /*nOldStrmPos*/, std::size_t nNewStrmPos, sal_uInt16 nRecSize )
......@@ -273,7 +273,7 @@ bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N
{
maEncryptionData.realloc( 0 );
if( rEncryptionData.getLength() )
if( rEncryptionData.hasElements() )
{
// init codec
mpCodec->InitCodec( rEncryptionData );
......@@ -282,7 +282,7 @@ bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N
maEncryptionData = rEncryptionData;
}
return maEncryptionData.getLength();
return maEncryptionData.hasElements();
}
void XclImpBiff8Decrypter::OnUpdate( std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 /*nRecSize*/ )
......
......@@ -119,7 +119,7 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S
rMedium.GetItemSet()->ClearItem( SID_PASSWORD );
rMedium.GetItemSet()->ClearItem( SID_ENCRYPTIONDATA );
if( !bIsDefaultPassword && (aEncryptionData.getLength() > 0) )
if( !bIsDefaultPassword && aEncryptionData.hasElements() )
rMedium.GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) );
return aEncryptionData;
......
......@@ -191,7 +191,7 @@ bool IsValidObject( const XclObj& rObj )
return false;
uno::Sequence<uno::Reference<chart2::XCoordinateSystem> > xCooSysSeq = xCooSysContainer->getCoordinateSystems();
if (!xCooSysSeq.getLength())
if (!xCooSysSeq.hasElements())
return false;
for (sal_Int32 nCooSys = 0; nCooSys < xCooSysSeq.getLength(); ++nCooSys)
......@@ -201,7 +201,7 @@ bool IsValidObject( const XclObj& rObj )
return false;
uno::Sequence<uno::Reference<chart2::XChartType> > xChartTypeSeq = xChartTypeCont->getChartTypes();
if (!xChartTypeSeq.getLength())
if (!xChartTypeSeq.hasElements())
// No chart type. Not good.
return false;
}
......
......@@ -802,7 +802,7 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc)
SetNewCell(static_cast<ScMyContentAction*>(rxAction.get()));
}
aActions.clear();
if (aProtect.getLength())
if (aProtect.hasElements())
pTrack->SetProtection(aProtect);
else if (pDoc->GetChangeTrack() && pDoc->GetChangeTrack()->IsProtected())
pTrack->SetProtection(pDoc->GetChangeTrack()->GetProtection());
......
......@@ -3414,7 +3414,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
uno::Sequence< OUString > aRepresentations(
xReceiver->getUsedRangeRepresentations());
SvXMLAttributeList* pAttrList = nullptr;
if(aRepresentations.getLength())
if(aRepresentations.hasElements())
{
// add the ranges used by the chart to the shape
// element to be able to start listening after
......
......@@ -1101,7 +1101,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
{
uno::Sequence<sal_Int8> aPass;
::comphelper::Base64::decode(aPass, sKey);
if (aPass.getLength())
if (aPass.hasElements())
{
if (pDoc->GetChangeTrack())
pDoc->GetChangeTrack()->SetProtection(aPass);
......@@ -1371,7 +1371,7 @@ void ScXMLImport::SetStyleToRanges()
// store first cell of first range for each style, once per sheet
uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
pStyle->ApplyCondFormat(aAddresses);
if ( aAddresses.getLength() > 0 )
if ( aAddresses.hasElements() )
{
const table::CellRangeAddress& rRange = aAddresses[0];
if ( rRange.Sheet != pStyle->GetLastSheet() )
......
......@@ -155,7 +155,7 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo
// set Base URL
uno::Reference< beans::XPropertySet > xInfoSet;
if( aArgs.getLength() > 0 )
if( aArgs.hasElements() )
aArgs.getConstArray()[0] >>= xInfoSet;
OSL_ENSURE( xInfoSet.is(), "missing property set" );
if( xInfoSet.is() )
......@@ -650,7 +650,7 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC
// set Base URL
uno::Reference< beans::XPropertySet > xInfoSet;
if( aArgs.getLength() > 0 )
if( aArgs.hasElements() )
aArgs.getConstArray()[0] >>= xInfoSet;
OSL_ENSURE( xInfoSet.is(), "missing property set" );
if( xInfoSet.is() )
......
......@@ -2318,7 +2318,7 @@ css::uno::Sequence< css::uno::Any >
if ( bSuccess )
{
uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
if ( aSeq.getLength() )
if ( aSeq.hasElements() )
{
return aSeq;
}
......
......@@ -124,7 +124,7 @@ void ScDocShell::InitItems()
{
// set forbidden characters if necessary
uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales();
if (aLocales.getLength())
if (aLocales.hasElements())
{
std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable(
SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext()));
......
......@@ -337,7 +337,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
// get available solver implementations
//! sort by descriptions?
ScSolverUtil::GetImplementations( maImplNames, maDescriptions );
sal_Int32 nImplCount = maImplNames.getLength();
bool bImplHasElements = maImplNames.hasElements();
const ScOptSolverSave* pOldData = mpDocShell->GetSolverSaveData();
if ( pOldData )
......@@ -359,7 +359,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) )
aCursorStr = rCursorPos.Format(ScRefFlags::ADDR_ABS, nullptr, mrDoc.GetAddressConvention());
m_xEdObjectiveCell->SetRefString( aCursorStr );
if ( nImplCount > 0 )
if ( bImplHasElements )
maEngine = maImplNames[0]; // use first implementation
}
ShowConditions();
......@@ -769,7 +769,7 @@ bool ScOptSolverDlg::FindTimeout( sal_Int32& rTimeout )
{
bool bFound = false;
if ( !maProperties.getLength() )
if ( !maProperties.hasElements() )
maProperties = ScSolverUtil::GetDefaults( maEngine ); // get property defaults from component
sal_Int32 nPropCount = maProperties.getLength();
......
......@@ -101,7 +101,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent,
if ( nSelect >= 0 ) // select in list box
m_xLbEngine->set_active(nSelect);
if ( !maProperties.getLength() )
if ( !maProperties.hasElements() )
ReadFromComponent(); // fill maProperties from component (using maEngine)
FillListBox(); // using maProperties
}
......
......@@ -5051,7 +5051,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
if ( rTokens.getLength() )
if ( rTokens.hasElements() )
{
if ( ScTableSheetObj::getImplementation( static_cast<cppu::OWeakObject*>(this) ) )
{
......
......@@ -1521,7 +1521,7 @@ ScChart2DataProvider::createDataSource(
}
uno::Reference< chart2::data::XLabeledDataSequence > xChartSeries = lcl_createLabeledDataSequenceFromTokens(
std::move(aValueTokens), std::move(aLabelTokens), m_pDocument, this, m_bIncludeHiddenCells ); //ownership of pointers is transferred!
if ( xChartSeries.is() && xChartSeries->getValues().is() && xChartSeries->getValues()->getData().getLength() )
if ( xChartSeries.is() && xChartSeries->getValues().is() && xChartSeries->getValues()->getData().hasElements() )
{
aSeqs.push_back( xChartSeries );
}
......@@ -2031,7 +2031,7 @@ uno::Reference< sheet::XRangeSelection > SAL_CALL ScChart2DataProvider::getRange
sal_Bool SAL_CALL ScChart2DataProvider::createDataSequenceByFormulaTokensPossible(
const Sequence<sheet::FormulaToken>& aTokens )
{
if (aTokens.getLength() <= 0)
if (!aTokens.hasElements())
return false;
ScTokenArray aCode;
......@@ -2089,7 +2089,7 @@ ScChart2DataProvider::createDataSequenceByFormulaTokens(
const Sequence<sheet::FormulaToken>& aTokens )
{
uno::Reference<chart2::data::XDataSequence> xResult;
if (aTokens.getLength() <= 0)
if (!aTokens.hasElements())
return xResult;
ScTokenArray aCode;
......@@ -2875,7 +2875,7 @@ uno::Sequence< uno::Any> SAL_CALL ScChart2DataSequence::getData()
BuildDataCache();
if (!m_aMixedDataCache.getLength())
if (!m_aMixedDataCache.hasElements())
{
// Build a cache for the 1st time...
......
......@@ -2886,7 +2886,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstanceWithArguments
SolarMutexGuard aGuard;
uno::Reference<uno::XInterface> xInt(create(ServiceSpecifier, &aArgs));
if ( aArgs.getLength() )
if ( aArgs.hasElements() )
{
// used only for cell value binding so far - it can be initialized after creating
......
......@@ -214,14 +214,14 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
if ( !aData.maPosStr.isEmpty() )
pCoreEntry->SetSrcString( aData.maPosStr );
if ( aData.maTokens1.getLength() )
if ( aData.maTokens1.hasElements() )
{
ScTokenArray aTokenArray;
if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens1) )
pCoreEntry->SetFormula1(aTokenArray);
}
if ( aData.maTokens2.getLength() )
if ( aData.maTokens2.hasElements() )
{
ScTokenArray aTokenArray;
if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens2) )
......@@ -634,14 +634,14 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc,
pRet->SetIgnoreBlank(bIgnoreBlank);
pRet->SetListType(nShowList);
if ( aTokens1.getLength() )
if ( aTokens1.hasElements() )
{
ScTokenArray aTokenArray;
if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens1) )
pRet->SetFormula1(aTokenArray);
}
if ( aTokens2.getLength() )
if ( aTokens2.hasElements() )
{
ScTokenArray aTokenArray;
if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens2) )
......
......@@ -1592,7 +1592,7 @@ sal_Bool SAL_CALL ScExternalDocLinkObj::hasElements()
SolarMutexGuard aGuard;
// #i116940# be consistent with getByName: count only table names which have a cache already
return ( getElementNames().getLength() > 0 );
return getElementNames().hasElements();
}
sal_Int32 SAL_CALL ScExternalDocLinkObj::getTokenIndex()
......
......@@ -93,7 +93,7 @@ SCTAB lclGetTabFromArgs( const uno::Sequence< uno::Any >& rArgs, sal_Int32 nInde
if( xRanges.is() )
{
uno::Sequence< table::CellRangeAddress > aRangeAddresses = xRanges->getRangeAddresses();
if( aRangeAddresses.getLength() > 0 )
if( aRangeAddresses.hasElements() )
return aRangeAddresses[ 0 ].Sheet;
}
......
......@@ -44,7 +44,7 @@ ScVbaGlobals::ScVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Referen
uno::Sequence< beans::PropertyValue > aInitArgs( aArgs.getLength() + 1 );
aInitArgs[ 0 ].Name = "Application";
aInitArgs[ 0 ].Value <<= getApplication();
if ( aArgs.getLength() > 0 )
if ( aArgs.hasElements() )
{
aInitArgs[ 1 ].Name = "ExcelDocumentContext";
aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
......
......@@ -135,7 +135,7 @@ public:
css::uno::Sequence< OUString > getServiceNames() override
{
static css::uno::Sequence< OUString > aServiceNames;
if ( aServiceNames.getLength() == 0 )
if ( !aServiceNames.hasElements() )
{
aServiceNames.realloc( 1 );
aServiceNames[ 0 ] = "ooo.vba.excel.XTitle";
......
......@@ -198,7 +198,7 @@ ScVbaWorkbook::getFileFormat( )
void
ScVbaWorkbook::init()
{
if ( !ColorData.getLength() )
if ( !ColorData.hasElements() )
ResetColors();
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY );
if ( xModel.is() )
......
......@@ -656,7 +656,7 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
// so the source knows it will be used for a link
uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SotClipboardFormatId::LINK, OUString());
if (!aSequence.getLength())
if (!aSequence.hasElements())
{
OSL_FAIL("DDE Data not found.");
return false;
......
......@@ -186,7 +186,7 @@ void ScXMLSourceDlg::SelectSourceFile()
return;
uno::Sequence<OUString> aFiles = xFilePicker->getSelectedFiles();
if (!aFiles.getLength())
if (!aFiles.hasElements())
return;
// There should only be one file returned from the file picker.
......
......@@ -224,7 +224,7 @@ namespace basprov
if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
if ( m_caller.hasElements() && m_caller[ 0 ].hasValue() )
{
SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
unoToSbxValue( xCallerVar.get(), m_caller[ 0 ] );
......
......@@ -76,7 +76,7 @@ void SAL_CALL ScriptProtocolHandler::initialize(
// first argument contains a reference to the frame (may be empty or the desktop,
// but usually it's a "real" frame)
if ( aArguments.getLength() && !( aArguments[ 0 ] >>= m_xFrame ) )
if ( aArguments.hasElements() && !( aArguments[ 0 ] >>= m_xFrame ) )
{
OUString temp = "ScriptProtocolHandler::initialize: could not extract reference to the frame";
throw RuntimeException( temp );
......@@ -183,7 +183,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
Sequence< Any > outArgs( 0 );
Sequence< sal_Int16 > outIndex;
if ( lArgs.getLength() > 0 )
if ( lArgs.hasElements() )
{
int argCount = 0;
for ( int index = 0; index < lArgs.getLength(); index++ )
......@@ -226,7 +226,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
// given name/signature
std::rethrow_exception(aFirstCaughtException);
if ( inArgs.getLength() == 0 )
if ( !inArgs.hasElements() )
// no chance to retry if we can't strip more in-args
std::rethrow_exception(aFirstCaughtException);
......
......@@ -148,7 +148,7 @@ ProviderCache::populateCache()
Sequence< OUString > serviceNames = xServiceInfo->getSupportedServiceNames();
if ( serviceNames.getLength() > 0 )
if ( serviceNames.hasElements() )
{
for ( sal_Int32 index = 0; index < serviceNames.getLength(); index++ )
{
......
......@@ -86,12 +86,12 @@ static const sal_Int32 DELIMLEN = strlen(DELIM);
static bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
{
return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
return params.hasElements() && ( params[ 0 ] >>= evt );
}
static bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
{
return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
return params.hasElements() && ( params[ 0 ] >>= evt );
}
static Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
......@@ -890,7 +890,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet )
{
aArguments = evt.Arguments;
}
if ( aArguments.getLength() )
if ( aArguments.hasElements() )
{
// call basic event handlers for event
......
......@@ -836,7 +836,7 @@ bool PPTWriter::ImplCreateDocument()
if ( aXCont.is() )
{
css::uno::Sequence< OUString> aNameSeq( aXCont->getElementNames() );
if ( aNameSeq.getLength() )
if ( aNameSeq.hasElements() )
{
mpPptEscherEx->OpenContainer( EPP_NamedShows );