diff options
author | Noel Grandin <noel@peralex.com> | 2013-11-05 14:39:55 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-11-11 12:58:13 +0200 |
commit | fcd1637d5101b9142e6808edfb77b01122857901 (patch) | |
tree | 5fd09f97de80cf2a9481bd55a798015db35f1d0c /sc/source/filter | |
parent | ef90021abe3735fba57145598fd7c3d359d2718e (diff) |
convert OUString compareToAscii == 0 to equalsAscii
Convert code like
aStr.compareToAscii("XXX") == 0
to
aStr.equalsAscii("XXX")
which is both easier to read and faster.
Change-Id: I448abf58f2fa0e7715dba53f8e8825ca0587c83f
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/xml/xmldrani.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlfilti.cxx | 24 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 46 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlsorti.cxx | 2 |
4 files changed, 37 insertions, 37 deletions
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index 97483e3d6433..9478b0ca73a5 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -860,7 +860,7 @@ ScXMLSortGroupsContext::ScXMLSortGroupsContext( ScXMLImport& rImport, if (sValue.getLength() > 8) { OUString sTemp = sValue.copy(0, 8); - if (sTemp.compareToAscii(SC_USERLIST) == 0) + if (sTemp.equalsAscii(SC_USERLIST)) { pDatabaseRangeContext->SetSubTotalsEnabledUserList(true); sTemp = sValue.copy(8); diff --git a/sc/source/filter/xml/xmlfilti.cxx b/sc/source/filter/xml/xmlfilti.cxx index 6e8f88b1c286..34327eb29a65 100644 --- a/sc/source/filter/xml/xmlfilti.cxx +++ b/sc/source/filter/xml/xmlfilti.cxx @@ -387,9 +387,9 @@ void ScXMLConditionContext::GetOperator( rParam.bRegExp = true; rEntry.eOp = SC_NOT_EQUAL; } - else if (aOpStr.compareToAscii("=") == 0) + else if (aOpStr.equalsAscii("=")) rEntry.eOp = SC_EQUAL; - else if (aOpStr.compareToAscii("!=") == 0) + else if (aOpStr.equalsAscii("!=")) rEntry.eOp = SC_NOT_EQUAL; else if (IsXMLToken(aOpStr, XML_BOTTOM_PERCENT)) rEntry.eOp = SC_BOTPERC; @@ -397,13 +397,13 @@ void ScXMLConditionContext::GetOperator( rEntry.eOp = SC_BOTVAL; else if (IsXMLToken(aOpStr, XML_EMPTY)) rEntry.SetQueryByEmpty(); - else if (aOpStr.compareToAscii(">") == 0) + else if (aOpStr.equalsAscii(">")) rEntry.eOp = SC_GREATER; - else if (aOpStr.compareToAscii(">=") == 0) + else if (aOpStr.equalsAscii(">=")) rEntry.eOp = SC_GREATER_EQUAL; - else if (aOpStr.compareToAscii("<") == 0) + else if (aOpStr.equalsAscii("<")) rEntry.eOp = SC_LESS; - else if (aOpStr.compareToAscii("<=") == 0) + else if (aOpStr.equalsAscii("<=")) rEntry.eOp = SC_LESS_EQUAL; else if (IsXMLToken(aOpStr, XML_NOEMPTY)) rEntry.SetQueryByNonEmpty(); @@ -827,21 +827,21 @@ void ScXMLDPConditionContext::getOperatorXML( bUseRegularExpressions = true; aFilterOperator = SC_NOT_EQUAL; } - else if (sTempOperator.compareToAscii("=") == 0) + else if (sTempOperator.equalsAscii("=")) aFilterOperator = SC_EQUAL; - else if (sTempOperator.compareToAscii("!=") == 0) + else if (sTempOperator.equalsAscii("!=")) aFilterOperator = SC_NOT_EQUAL; else if (IsXMLToken(sTempOperator, XML_BOTTOM_PERCENT)) aFilterOperator = SC_BOTPERC; else if (IsXMLToken(sTempOperator, XML_BOTTOM_VALUES)) aFilterOperator = SC_BOTVAL; - else if (sTempOperator.compareToAscii(">") == 0) + else if (sTempOperator.equalsAscii(">")) aFilterOperator = SC_GREATER; - else if (sTempOperator.compareToAscii(">=") == 0) + else if (sTempOperator.equalsAscii(">=")) aFilterOperator = SC_GREATER_EQUAL; - else if (sTempOperator.compareToAscii("<") == 0) + else if (sTempOperator.equalsAscii("<")) aFilterOperator = SC_LESS; - else if (sTempOperator.compareToAscii("<=") == 0) + else if (sTempOperator.equalsAscii("<=")) aFilterOperator = SC_LESS_EQUAL; else if (IsXMLToken(sTempOperator, XML_TOP_PERCENT)) aFilterOperator = SC_TOPPERC; diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 2c0f1b56c4f8..0999c04596bf 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2444,20 +2444,20 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque for (sal_Int32 i = 0; i < nCount; ++i) { OUString sName(rChangeProps[i].Name); - if (sName.compareToAscii("ShowChanges") == 0) + if (sName.equalsAscii("ShowChanges")) pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowAcceptedChanges") == 0) + else if (sName.equalsAscii("ShowAcceptedChanges")) pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowRejectedChanges") == 0) + else if (sName.equalsAscii("ShowRejectedChanges")) pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowChangesByDatetime") == 0) + else if (sName.equalsAscii("ShowChangesByDatetime")) pViewSettings->SetHasDate(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowChangesByDatetimeMode") == 0) + else if (sName.equalsAscii("ShowChangesByDatetimeMode")) { if (rChangeProps[i].Value >>= nTemp16) pViewSettings->SetTheDateMode(ScChgsDateMode(nTemp16)); } - else if (sName.compareToAscii("ShowChangesByDatetimeFirstDatetime") == 0) + else if (sName.equalsAscii("ShowChangesByDatetimeFirstDatetime")) { util::DateTime aDateTime; if (rChangeProps[i].Value >>= aDateTime) @@ -2467,7 +2467,7 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque pViewSettings->SetTheFirstDateTime(aCoreDateTime); } } - else if (sName.compareToAscii("ShowChangesByDatetimeSecondDatetime") == 0) + else if (sName.equalsAscii("ShowChangesByDatetimeSecondDatetime")) { util::DateTime aDateTime; if (rChangeProps[i].Value >>= aDateTime) @@ -2477,9 +2477,9 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque pViewSettings->SetTheLastDateTime(aCoreDateTime); } } - else if (sName.compareToAscii("ShowChangesByAuthor") == 0) + else if (sName.equalsAscii("ShowChangesByAuthor")) pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowChangesByAuthorName") == 0) + else if (sName.equalsAscii("ShowChangesByAuthorName")) { OUString sOUName; if (rChangeProps[i].Value >>= sOUName) @@ -2488,9 +2488,9 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque pViewSettings->SetTheAuthorToShow(sAuthorName); } } - else if (sName.compareToAscii("ShowChangesByComment") == 0) + else if (sName.equalsAscii("ShowChangesByComment")) pViewSettings->SetHasComment(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowChangesByCommentText") == 0) + else if (sName.equalsAscii("ShowChangesByCommentText")) { OUString sOUComment; if (rChangeProps[i].Value >>= sOUComment) @@ -2499,9 +2499,9 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque pViewSettings->SetTheComment(sComment); } } - else if (sName.compareToAscii("ShowChangesByRanges") == 0) + else if (sName.equalsAscii("ShowChangesByRanges")) pViewSettings->SetHasRange(::cppu::any2bool(rChangeProps[i].Value)); - else if (sName.compareToAscii("ShowChangesByRangesList") == 0) + else if (sName.equalsAscii("ShowChangesByRangesList")) { OUString sRanges; if ((rChangeProps[i].Value >>= sRanges) && !sRanges.isEmpty()) @@ -2528,15 +2528,15 @@ void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aVi for (sal_Int32 i = 0; i < nCount; ++i) { OUString sName(aViewProps[i].Name); - if (sName.compareToAscii("VisibleAreaHeight") == 0) + if (sName.equalsAscii("VisibleAreaHeight")) aViewProps[i].Value >>= nHeight; - else if (sName.compareToAscii("VisibleAreaLeft") == 0) + else if (sName.equalsAscii("VisibleAreaLeft")) aViewProps[i].Value >>= nLeft; - else if (sName.compareToAscii("VisibleAreaTop") == 0) + else if (sName.equalsAscii("VisibleAreaTop")) aViewProps[i].Value >>= nTop; - else if (sName.compareToAscii("VisibleAreaWidth") == 0) + else if (sName.equalsAscii("VisibleAreaWidth")) aViewProps[i].Value >>= nWidth; - else if (sName.compareToAscii("TrackedChangesViewSettings") == 0) + else if (sName.equalsAscii("TrackedChangesViewSettings")) { uno::Sequence<beans::PropertyValue> aChangeProps; if(aViewProps[i].Value >>= aChangeProps) @@ -3025,13 +3025,13 @@ sal_Int32 ScXMLImport::GetRangeType(const OUString sRangeType) const if ((i == sRangeType.getLength()) || (sRangeType[i] == ' ')) { OUString sTemp = sBuffer.makeStringAndClear(); - if (sTemp.compareToAscii(SC_REPEAT_COLUMN) == 0) + if (sTemp.equalsAscii(SC_REPEAT_COLUMN)) nRangeType |= sheet::NamedRangeFlag::COLUMN_HEADER; - else if (sTemp.compareToAscii(SC_REPEAT_ROW) == 0) + else if (sTemp.equalsAscii(SC_REPEAT_ROW)) nRangeType |= sheet::NamedRangeFlag::ROW_HEADER; - else if (sTemp.compareToAscii(SC_FILTER) == 0) + else if (sTemp.equalsAscii(SC_FILTER)) nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA; - else if (sTemp.compareToAscii(SC_PRINT_RANGE) == 0) + else if (sTemp.equalsAscii(SC_PRINT_RANGE)) nRangeType |= sheet::NamedRangeFlag::PRINT_AREA; } else if (i < sRangeType.getLength()) @@ -3219,7 +3219,7 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE for (sal_Int32 i = 0; i < nCount; ++i) { OUString sName(aSeq[i].Name); - if (sName.compareToAscii(SC_ACTIVETABLE) == 0) + if (sName.equalsAscii(SC_ACTIVETABLE)) { OUString sValue; if(aSeq[i].Value >>= sValue) diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx index 175966f1e759..7792ec09fa9a 100644 --- a/sc/source/filter/xml/xmlsorti.cxx +++ b/sc/source/filter/xml/xmlsorti.cxx @@ -179,7 +179,7 @@ void ScXMLSortContext::AddSortField(const OUString& sFieldNumber, const OUString if (sDataType.getLength() > 8) { OUString sTemp = sDataType.copy(0, 8); - if (sTemp.compareToAscii(SC_USERLIST) == 0) + if (sTemp.equalsAscii(SC_USERLIST)) { bEnabledUserList = true; sTemp = sDataType.copy(8); |