diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-04 11:43:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-04 11:52:34 +0200 |
commit | cc25f70ef1e9fa7637b4bfd332ebdc33844a41c2 (patch) | |
tree | 76fe846c5b4ec24faa6ee53d34c49554eac3d4a8 | |
parent | adc20c3937f3119d39af5a0c8e4a439d8127fe63 (diff) |
compareTo -> equals
convert OUString::compareTo usage to equals to startsWith where it
is more appropriate
Change-Id: I6f5b5b7942429c0099ad082ba4984fd18e422121
36 files changed, 133 insertions, 140 deletions
diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx index d44c06c7c1ec..da01d4f4e35f 100644 --- a/framework/source/fwe/xml/xmlnamespaces.cxx +++ b/framework/source/fwe/xml/xmlnamespaces.cxx @@ -47,7 +47,7 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue sal_Int32 nXMLNamespaceLength = m_aXMLAttributeNamespace.getLength(); // delete preceding "xmlns" - if ( aNamespaceName.compareTo( m_aXMLAttributeNamespace, nXMLNamespaceLength ) == 0 ) + if ( aNamespaceName.startsWith( m_aXMLAttributeNamespace ) ) { if ( aNamespaceName.getLength() == nXMLNamespaceLength ) { diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java index 27a97ec40345..1e3fd149ee12 100644 --- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java +++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java @@ -125,7 +125,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor // XJobExecutor public void trigger(String sEvent) { - if ( sEvent.compareTo( "execute" ) == 0 ) { + if ( sEvent.equals( "execute" ) ) { try { createDialog(); } diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java index f4f3b7cf6a95..0653ee11055d 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java @@ -150,12 +150,12 @@ public class ProtocolHandlerAddon { /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { + if ( aURL.Path.equals( "Function1" ) ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) xRet = this; } return xRet; @@ -177,17 +177,17 @@ public class ProtocolHandlerAddon { public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path.equals( "Function1" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) { showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example"); } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java index 101540ee748f..7b20bb4e56a6 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java @@ -75,7 +75,7 @@ public class Desk sFile = lArguments[i].substring(5); } - ViewContainer.mbInplace = (sMode.compareTo("inplace")==0); + ViewContainer.mbInplace = sMode.equals("inplace"); // Connect to remote office. OfficeConnect.createConnection(); diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java index 0fb4ecb6c578..b72f30ac755c 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java @@ -390,7 +390,7 @@ public class DocumentView extends JFrame String sCommand = aEvent.getActionCommand(); // open any file from disk - if( sCommand.compareTo(COMMAND_OPEN) == 0 ) + if( sCommand.equals(COMMAND_OPEN) ) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,true); if(sURL!=null) @@ -399,14 +399,14 @@ public class DocumentView extends JFrame else // save current document - if( sCommand.compareTo(COMMAND_SAVE) == 0 ) + if( sCommand.equals(COMMAND_SAVE) ) { DocumentView.this.save(); } else // export current document to html - if( sCommand.compareTo(COMMAND_EXPORT) == 0 ) + if( sCommand.equals(COMMAND_EXPORT)) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,false); if(sURL!=null) @@ -415,7 +415,7 @@ public class DocumentView extends JFrame else // exit application - if( sCommand.compareTo(COMMAND_EXIT) == 0 ) + if( sCommand.equals(COMMAND_EXIT) ) { // This will force deleting of this and // all other currently opened views automatically! diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java index 43f98d232d83..2f9b8e153bee 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java @@ -958,7 +958,7 @@ public class FunctionHelper { com.sun.star.frame.XFrame xFrame = (com.sun.star.frame.XFrame)AnyConverter.toObject(new com.sun.star.uno.Type(com.sun.star.frame.XFrame.class), xContainer.getByIndex(i)); sName = new String(BASEFRAMENAME+mnViewCount); - while(sName.compareTo(xFrame.getName())==0) + while(sName.equals(xFrame.getName())) { ++mnViewCount; sName = new String(BASEFRAMENAME+mnViewCount); diff --git a/odk/examples/java/Inspector/InspectorAddon.java b/odk/examples/java/Inspector/InspectorAddon.java index 6ca6c4260438..b32bde1d2dfc 100644 --- a/odk/examples/java/Inspector/InspectorAddon.java +++ b/odk/examples/java/Inspector/InspectorAddon.java @@ -72,8 +72,8 @@ public class InspectorAddon { public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ) { - if ( aURL.Path.compareTo( "inspect" ) == 0 ){ + if ( aURL.Protocol.equals("org.openoffice.Office.addon.Inspector:") ) { + if ( aURL.Path.equals( "inspect" ) ){ // Todo: Check if the frame is already administered (use hashtable) xRet = new Dispatcher(m_xFrame); } @@ -114,7 +114,7 @@ public class InspectorAddon { // XDispatch public void dispatch( /*IN*/com.sun.star.util.URL _aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { try{ - if ( _aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ){ + if ( _aURL.Protocol.equals("org.openoffice.Office.addon.Inspector:") ){ if ( _aURL.Path.equals("inspect")){ Object oUnoInspectObject = xModel; com.sun.star.lang.XMultiComponentFactory xMCF = m_xContext.getServiceManager(); diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java index 00bc253cb703..518ab913e674 100644 --- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java +++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java @@ -151,12 +151,12 @@ public class ProtocolHandlerAddon { /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { + if ( aURL.Path.equals( "Function1" ) ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) xRet = this; } return xRet; @@ -178,17 +178,17 @@ public class ProtocolHandlerAddon { public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path.equals( "Function1" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) { showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example"); } diff --git a/odk/examples/java/Spreadsheet/EuroAdaption.java b/odk/examples/java/Spreadsheet/EuroAdaption.java index 8168aee4f1a4..fddaaf16b3a7 100644 --- a/odk/examples/java/Spreadsheet/EuroAdaption.java +++ b/odk/examples/java/Spreadsheet/EuroAdaption.java @@ -189,7 +189,7 @@ public class EuroAdaption { // change the numberformat only on cellranges with a // currency numberformat if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) && - ( sCurrencySymbol.compareTo( sOldSymbol ) == 0 ) ) { + ( sCurrencySymbol.equals( sOldSymbol ) ) ) { boolean bThousandSep = AnyConverter.toBoolean( xFormat.getPropertyValue("ThousandsSeparator")); boolean bNegativeRed = AnyConverter.toBoolean( diff --git a/odk/examples/java/Text/StyleInitialization.java b/odk/examples/java/Text/StyleInitialization.java index 5acf7559d673..f743c471e5ed 100644 --- a/odk/examples/java/Text/StyleInitialization.java +++ b/odk/examples/java/Text/StyleInitialization.java @@ -206,7 +206,7 @@ public class StyleInitialization { sFontname = sFontname.toLowerCase(); // if the style use the font 'Albany', apply it to the current paragraph - if( sFontname.compareTo("albany") == 0 ) { + if( sFontname.equals("albany") ) { // create a property set from the current paragraph, to change the paragraph style xPropertySet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xTextRange ); diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8b664c75647c..93afb641ba10 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -249,12 +249,12 @@ HashedEntry::~HashedEntry() inline bool HashedEntry::operator ==( const HashedEntry& rRef ) const { - return mnHashCode == rRef.mnHashCode && maName.reverseCompareTo( rRef.maName ) == 0; + return mnHashCode == rRef.mnHashCode && maName == rRef.maName; } inline bool HashedEntry::operator !=( const HashedEntry& rRef ) const { - return mnHashCode != rRef.mnHashCode || maName.reverseCompareTo( rRef.maName ) != 0; + return mnHashCode != rRef.mnHashCode || maName != rRef.maName; } inline bool HashedEntry::operator <( const HashedEntry& rRef ) const @@ -2468,7 +2468,7 @@ bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTit while ( nIndex < nEnd ) { SortingData_Impl* pData = maContent[ nIndex ]; - if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 ) + if ( pData->GetLowerTitle().startsWith( rTitle ) ) return true; nIndex += 1; } @@ -2479,7 +2479,7 @@ bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTit while ( nIndex < nEnd && nIndex <= nStart ) { SortingData_Impl* pData = maContent[ nIndex ]; - if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 ) + if ( pData->GetLowerTitle().startsWith( rTitle ) ) return true; nIndex += 1; } diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index c800c6c4db04..6141fae75de2 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -537,7 +537,7 @@ void SvtFileViewWindow_Impl::OpenFolder( const OUString& rURL ) { sal_Int32 nSampFoldLen = aSamplesFolderURL.getLength(); aFileView.EnableNameReplacing( - nSampFoldLen && rURL.compareTo( aSamplesFolderURL, nSampFoldLen ) == 0 ); + nSampFoldLen && rURL.startsWith( aSamplesFolderURL ) ); aFileView.Initialize( rURL, "", NULL ); } aNewFolderLink.Call( this ); diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 93e8c2df55ae..c9d70c9d9c62 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -883,8 +883,7 @@ int HTMLParser::_GetNextRawToken() { if( !bReadComment ) { - if( aTok.compareTo( OOO_STRING_SVTOOLS_HTML_comment, 3 ) - == 0 ) + if( aTok.startsWith( OOO_STRING_SVTOOLS_HTML_comment ) ) { bReadComment = true; } @@ -893,9 +892,9 @@ int HTMLParser::_GetNextRawToken() // A script has to end with "</SCRIPT>". But // ">" is optional for security reasons bDone = bOffState && - 0 == ( bReadScript - ? aTok.compareTo(OOO_STRING_SVTOOLS_HTML_script) - : aTok.compareTo(aEndToken) ); + ( bReadScript + ? aTok.equals(OOO_STRING_SVTOOLS_HTML_script) + : aTok.equals(aEndToken) ); } } if( bReadComment && '>'==nNextCh && aTok.endsWith( "--" ) ) @@ -908,13 +907,11 @@ int HTMLParser::_GetNextRawToken() { // Style sheets can be closed by </STYLE>, </HEAD> or <BODY> if( bOffState ) - bDone = aTok.compareTo(OOO_STRING_SVTOOLS_HTML_style) - == 0 || - aTok.compareTo(OOO_STRING_SVTOOLS_HTML_head) - == 0; + bDone = aTok.equals(OOO_STRING_SVTOOLS_HTML_style) || + aTok.equals(OOO_STRING_SVTOOLS_HTML_head); else bDone = - aTok.compareTo(OOO_STRING_SVTOOLS_HTML_body) == 0; + aTok.equals(OOO_STRING_SVTOOLS_HTML_body); } if( bDone ) @@ -1958,7 +1955,7 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL ) bool bFound = false; - if( rURL.compareTo( OOO_STRING_SVTOOLS_HTML_internal_gopher,16) == 0 ) + if( rURL.startsWith( OOO_STRING_SVTOOLS_HTML_internal_gopher ) ) { OUString aName( rURL.copy(16) ); switch( aName[0] ) @@ -1986,7 +1983,7 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL ) break; } } - else if( rURL.compareTo( OOO_STRING_SVTOOLS_HTML_internal_icon,14) == 0 ) + else if( rURL.startsWith( OOO_STRING_SVTOOLS_HTML_internal_icon ) ) { OUString aName( rURL.copy(14) ); switch( aName[0] ) diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index ff5bad3abe54..21a08a108d6c 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2244,13 +2244,13 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, { PropertyValue& rValue = pValues[i]; - if (rValue.Name.compareTo( ChangeAttr.Name )==0) + if (rValue.Name == ChangeAttr.Name ) { rValue.Value = ChangeAttr.Value; continue; } - if (rValue.Name.compareTo( ChangeAttrColor.Name )==0) + if (rValue.Name == ChangeAttrColor.Name ) { rValue.Value = ChangeAttrColor.Value; continue; diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 6faafb969f0d..6d7bdcb7f7bb 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -625,11 +625,10 @@ BaseContent::createNewContent( if ( Info.Type.isEmpty() ) return Reference< XContent >(); - bool bFolder - = ( Info.Type.compareTo( m_pMyShell->FolderContentType ) == 0 ); + bool bFolder = Info.Type == m_pMyShell->FolderContentType; if ( !bFolder ) { - if ( Info.Type.compareTo( m_pMyShell->FileContentType ) != 0 ) + if ( Info.Type != m_pMyShell->FileContentType ) { // Neither folder nor file to create! return Reference< XContent >(); diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index ea12bf72d97f..2d074c927ac9 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -166,7 +166,7 @@ namespace fileaccess { || ( ( dstL > srcL ) && - ( srcUnqPath.compareTo( dstUnqPath, srcL ) == 0 ) + dstUnqPath.startsWith(srcUnqPath) && ( dstUnqPath[ srcL ] == slash ) ) ); diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index adba80d8fae0..2d5acc09d595 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -563,7 +563,7 @@ void Content::queryChildren( ContentRefList& rChildren ) OUString aChildURL = xChild->getIdentifier()->getContentIdentifier(); // Is aURL a prefix of aChildURL? - if ( ( aChildURL.getLength() > nLen ) && ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + if ( ( aChildURL.getLength() > nLen ) && aChildURL.startsWith( aURL ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx index 8f82888d124f..68f2e1d340cd 100644 --- a/ucb/source/ucp/gvfs/gvfs_content.cxx +++ b/ucb/source/ucp/gvfs/gvfs_content.cxx @@ -896,7 +896,7 @@ void Content::queryChildren( ContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) { + ( aChildURL.startsWith( aURL ) ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx index e541288dc411..9a00a14a2f76 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx @@ -814,7 +814,7 @@ void HierarchyContent::queryChildren( HierarchyContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + ( aChildURL.startsWith( aURL ) ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); @@ -1621,8 +1621,7 @@ void HierarchyContent::transfer( if ( rInfo.SourceURL.getLength() <= aId.getLength() ) { - if ( aId.compareTo( - rInfo.SourceURL, rInfo.SourceURL.getLength() ) == 0 ) + if ( aId.startsWith( rInfo.SourceURL ) ) { uno::Any aProps = uno::makeAny(beans::PropertyValue( diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index 2b85a29025ec..288525bdefd5 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -1839,8 +1839,7 @@ void Content::transfer( if ( rInfo.SourceURL.getLength() <= aId.getLength() ) { - if ( aId.compareTo( - rInfo.SourceURL, rInfo.SourceURL.getLength() ) == 0 ) + if ( aId.startsWith( rInfo.SourceURL ) ) { uno::Any aProps = uno::makeAny(beans::PropertyValue( @@ -2193,7 +2192,7 @@ void Content::queryChildren( ContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + ( aChildURL.startsWith( aURL ) ) ) { if ( aChildURL.indexOf( '/', nLen ) == -1 ) { diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index 5b3b0420c310..6a2676b62a77 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -799,7 +799,7 @@ void Content::queryChildren( ContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + ( aChildURL.startsWith( aURL ) ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); @@ -1985,8 +1985,7 @@ void Content::transfer( if ( rInfo.SourceURL.getLength() <= aId.getLength() ) { - if ( aId.compareTo( - rInfo.SourceURL, rInfo.SourceURL.getLength() ) == 0 ) + if ( aId.startsWith( rInfo.SourceURL ) ) { uno::Any aProps = uno::makeAny(beans::PropertyValue( diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index f67c85240b80..fe49180627da 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -2240,7 +2240,7 @@ void Content::queryChildren( ContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + ( aChildURL.startsWith( aURL ) ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index cf1a55e601b1..b783e166a52a 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -2367,7 +2367,7 @@ void Content::queryChildren( ContentRefList& rChildren ) // Is aURL a prefix of aChildURL? if ( ( aChildURL.getLength() > nLen ) && - ( aChildURL.compareTo( aURL, nLen ) == 0 ) ) + ( aChildURL.startsWith( aURL ) ) ) { sal_Int32 nPos = nLen; nPos = aChildURL.indexOf( '/', nPos ); diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx index 42d1da160110..1777dab117fd 100644 --- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -428,12 +428,12 @@ void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options) ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin(); while (iter != options.protocolCmdMap.end()) { - o << " if ( aURL.Protocol.compareTo(\"" << (*iter).first - << "\") == 0 )\n {\n"; + o << " if ( aURL.Protocol.equals(\"" << (*iter).first + << "\") )\n {\n"; for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { - o << " if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n" + o << " if ( aURL.Path.equals(\"" << (*i) << "\") )\n" " {\n // add your own code here\n" " return;\n }\n"; } @@ -465,12 +465,12 @@ void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & opt ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin(); while (iter != options.protocolCmdMap.end()) { - o << " if ( aURL.Protocol.compareTo(\"" << (*iter).first - << "\") == 0 )\n {\n"; + o << " if ( aURL.Protocol.equals(\"" << (*iter).first + << "\") )\n {\n"; for (std::vector< OString >::const_iterator i = (*iter).second.begin(); i != (*iter).second.end(); ++i) { - o << " if ( aURL.Path.compareTo(\"" << (*i) << "\") == 0 )\n" + o << " if ( aURL.Path.equals(\"" << (*i) << "\") )\n" " return this;\n"; } diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx index ae4f77c049f2..73d33fc93a9e 100644 --- a/unotools/source/config/configpaths.cxx +++ b/unotools/source/config/configpaths.cxx @@ -190,7 +190,7 @@ sal_Int32 lcl_findPrefixEnd(OUString const& _sNestedPath, OUString const& _sPref if (_sNestedPath.getLength() > nPrefixLength) { bIsPrefix = _sNestedPath[nPrefixLength] == '/' && - _sNestedPath.compareTo(_sPrefixPath,nPrefixLength) == 0; + _sNestedPath.startsWith(_sPrefixPath); ++nPrefixLength; } else if (_sNestedPath.getLength() == nPrefixLength) diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx index 054c3c9e9449..4d30994ee61b 100644 --- a/winaccessibility/source/UAccCOM/AccEditableText.cxx +++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx @@ -261,56 +261,56 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B */ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny) { - if(ouName.compareTo(L"CharBackColor") == 0 || - ouName.compareTo(L"CharColor") == 0 || - ouName.compareTo(L"ParaAdjust") == 0 || - ouName.compareTo(L"ParaFirstLineIndent") == 0 || - ouName.compareTo(L"ParaLeftMargin") == 0 || - ouName.compareTo(L"ParaRightMargin") == 0 || - ouName.compareTo(L"ParaTopMargin") == 0 || - ouName.compareTo(L"ParaBottomMargin") == 0 || - ouName.compareTo(L"CharFontPitch") == 0) + if(ouName.equals(L"CharBackColor") || + ouName.equals(L"CharColor") || + ouName.equals(L"ParaAdjust") || + ouName.equals(L"ParaFirstLineIndent") || + ouName.equals(L"ParaLeftMargin") || + ouName.equals(L"ParaRightMargin") || + ouName.equals(L"ParaTopMargin") || + ouName.equals(L"ParaBottomMargin") || + ouName.equals(L"CharFontPitch") ) { // Convert to int. // NOTE: CharFontPitch is not implemented in java file. sal_Int32 nValue = ouValue.toInt32(); rAny.setValue(&nValue, cppu::UnoType<sal_Int32>::get()); } - else if(ouName.compareTo(L"CharShadowed") == 0 || - ouName.compareTo(L"CharContoured") == 0) + else if(ouName.equals(L"CharShadowed") || + ouName.equals(L"CharContoured") ) { // Convert to boolean. boolean nValue = (boolean)ouValue.toBoolean(); rAny.setValue(&nValue, cppu::UnoType<sal_Bool>::get() ); } - else if(ouName.compareTo(L"CharEscapement") == 0 || - ouName.compareTo(L"CharStrikeout") == 0 || - ouName.compareTo(L"CharUnderline") == 0 || - ouName.compareTo(L"CharFontPitch") == 0) + else if(ouName.equals(L"CharEscapement") || + ouName.equals(L"CharStrikeout") || + ouName.equals(L"CharUnderline") || + ouName.equals(L"CharFontPitch") ) { // Convert to short. short nValue = (short)ouValue.toInt32(); rAny.setValue(&nValue, cppu::UnoType<short>::get()); } - else if(ouName.compareTo(L"CharHeight") == 0 || - ouName.compareTo(L"CharWeight") == 0) + else if(ouName.equals(L"CharHeight") || + ouName.equals(L"CharWeight") ) { // Convert to float. float fValue = ouValue.toFloat(); rAny.setValue(&fValue, cppu::UnoType<float>::get()); } - else if(ouName.compareTo(L"CharFontName") == 0) + else if(ouName.equals(L"CharFontName") ) { // Convert to string. rAny.setValue(&ouValue, cppu::UnoType<rtl::OUString>::get()); } - else if(ouName.compareTo(L"CharPosture") == 0) + else if(ouName.equals(L"CharPosture") ) { // Convert to FontSlant. ::com::sun::star::awt::FontSlant fontSlant = (::com::sun::star::awt::FontSlant)ouValue.toInt32(); rAny.setValue(&fontSlant, cppu::UnoType<com::sun::star::awt::FontSlant>::get()); } - else if(ouName.compareTo(L"ParaTabStops") == 0) + else if(ouName.equals(L"ParaTabStops") ) { // Convert to the Sequence with TabStop element. @@ -420,7 +420,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const : // Assign to Any object. rAny.setValue(&seqTabStop, getCppuType((Sequence< ::com::sun::star::style::TabStop >*)0)); } - else if(ouName.compareTo(L"ParaLineSpacing") == 0) + else if(ouName.equals(L"ParaLineSpacing") ) { // Parse value string. ::com::sun::star::style::LineSpacing lineSpacing; diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index 5436983d9167..11656babb1fb 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -200,7 +200,7 @@ public class JavaTools int retvalue = -1; for (int i = 0; i < FieldLen; i++) { - if (SearchList[i].compareTo(SearchString) == 0) + if (SearchList[i].equals(SearchString)) { retvalue = i; break; @@ -217,7 +217,7 @@ public class JavaTools { for (int i = StartIndex; i < FieldLen; i++) { - if (SearchList[i].compareTo(SearchString) == 0) + if (SearchList[i].equals(SearchString)) { retvalue = i; break; @@ -238,7 +238,7 @@ public class JavaTools { if (SearchList[i][0] != null) { - if (SearchList[i][0].compareTo(SearchString) == 0) + if (SearchList[i][0].equals(SearchString)) { retvalue = i; break; diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java index f990142eae61..4445937f1506 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -69,7 +69,7 @@ public class CallFormWizard { try { - if (sEvent.compareTo(PropertyNames.START) == 0) + if (sEvent.equals(PropertyNames.START)) { FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext ); CurFormWizard.start(); diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index 315e763d7503..204fe281dd66 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -74,7 +74,7 @@ public class CallQueryWizard { try { - if (sEvent.compareTo(PropertyNames.START) == 0) + if (sEvent.equals(PropertyNames.START)) { QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext ); Command = CurQueryWizard.start(); diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index af9623c4f526..9ac3ac3f324d 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -82,7 +82,7 @@ public class CallReportWizard { try { - if (sEvent.compareTo(PropertyNames.START) == 0) + if (sEvent.equals(PropertyNames.START)) { if (!bWizardstartedalready) { @@ -91,7 +91,7 @@ public class CallReportWizard } bWizardstartedalready = false; } - else if (sEvent.compareTo("fill") == 0) + else if (sEvent.equals("fill")) { Dataimport CurDataimport = new Dataimport(xmultiservicefactory); if (m_wizardContext != null) diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index c092d0f416ab..0674ff72d301 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -76,7 +76,7 @@ public class CallTableWizard { try { - if ( sEvent.compareTo(PropertyNames.START) == 0 ) + if ( sEvent.equals(PropertyNames.START) ) { TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext ); Command = CurTableWizard.startTableWizard(); diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java index b1ebdc5407ea..c9225dff8e6b 100644 --- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java +++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java @@ -55,7 +55,7 @@ public class TextStyleHandler for (int i = 0; i < PropCount; i++) { CurOptionName = StyleOptions[i].Name; - StyleOptions[i].Value = Boolean.valueOf((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0)); + StyleOptions[i].Value = Boolean.valueOf(CurOptionName.equals(OptionString) || CurOptionName.equals("OverwriteStyles")); } xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions); } diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 35773d796740..5b45c82ab571 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -568,10 +568,10 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream) beans::StringPair aPair = aSeq[i]; // Need to resolve only customxml files from document relationships. // Skipping other files. - if (aPair.Second.compareTo(sCustomType) == 0 || - aPair.Second.compareTo(sCustomTypeStrict) == 0) + if (aPair.Second == sCustomType || + aPair.Second == sCustomTypeStrict) bFound = true; - else if(aPair.First.compareTo(sTarget) == 0 && bFound) + else if(aPair.First == sTarget && bFound) { // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl // to ensure customxml target is visited in lcl_getTarget. @@ -644,26 +644,26 @@ void OOXMLDocumentImpl::resolveGlossaryStream(Stream & /*rStream*/) OOXMLStream::StreamType_t nType(OOXMLStream::UNKNOWN); bool bFound = true; - if(gType.compareTo(sSettingsType) == 0 || - gType.compareTo(sSettingsTypeStrict) == 0) + if(gType == sSettingsType || + gType == sSettingsTypeStrict) { nType = OOXMLStream::SETTINGS; contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"; } - else if(gType.compareTo(sStylesType) == 0 || - gType.compareTo(sStylesTypeStrict) == 0) + else if(gType == sStylesType || + gType == sStylesTypeStrict) { nType = OOXMLStream::STYLES; contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"; } - else if(gType.compareTo(sWebSettings) == 0 || - gType.compareTo(sWebSettingsStrict) == 0) + else if(gType == sWebSettings || + gType == sWebSettingsStrict) { nType = OOXMLStream::WEBSETTINGS; contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"; } - else if(gType.compareTo(sFonttableType) == 0 || - gType.compareTo(sFonttableTypeStrict) == 0) + else if(gType == sFonttableType || + gType == sFonttableTypeStrict) { nType = OOXMLStream::FONTTABLE; contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"; @@ -735,24 +735,24 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(OOXMLStream::Pointer_t pStream) for (sal_Int32 i = 0; i < aSeq.getLength(); i++) { beans::StringPair aPair = aSeq[i]; - if (aPair.Second.compareTo(sChartType) == 0 || - aPair.Second.compareTo(sChartTypeStrict) == 0) + if (aPair.Second == sChartType || + aPair.Second == sChartTypeStrict) { bFound = true; } - else if(aPair.Second.compareTo(sFootersType) == 0 || - aPair.Second.compareTo(sFootersTypeStrict) == 0) + else if(aPair.Second == sFootersType || + aPair.Second == sFootersTypeStrict) { bHeaderFooterFound = true; streamType = OOXMLStream::FOOTER; } - else if(aPair.Second.compareTo(sHeaderType) == 0 || - aPair.Second.compareTo(sHeaderTypeStrict) == 0) + else if(aPair.Second == sHeaderType || + aPair.Second == sHeaderTypeStrict) { bHeaderFooterFound = true; streamType = OOXMLStream::HEADER; } - else if(aPair.First.compareTo(sTarget) == 0 && ( bFound || bHeaderFooterFound )) + else if(aPair.First == sTarget && ( bFound || bHeaderFooterFound )) { // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl // to ensure chart.xml target is visited in lcl_getTarget. @@ -823,10 +823,10 @@ void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream) beans::StringPair aPair = aSeq[i]; // Need to resolve only ActiveX files from document relationships. // Skipping other files. - if (aPair.Second.compareTo(sCustomType) == 0 || - aPair.Second.compareTo(sCustomTypeStrict) == 0) + if (aPair.Second == sCustomType || + aPair.Second == sCustomTypeStrict) bFound = true; - else if(aPair.First.compareTo(sTarget) == 0 && bFound) + else if(aPair.First == sTarget && bFound) { // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl // to ensure ActiveX.xml target is visited in lcl_getTarget. diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 759762a58021..f107924e26a1 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -287,21 +287,21 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess> { const beans::StringPair &rPair = rSeq[i]; - if (rPair.First.compareTo(sType) == 0 && - ( rPair.Second.compareTo(sStreamType) == 0 || - rPair.Second.compareTo(sStreamTypeStrict) == 0)) + if (rPair.First == sType && + ( rPair.Second == sStreamType || + rPair.Second == sStreamTypeStrict )) bFound = true; - else if(rPair.First.compareTo(sType) == 0 && - ((rPair.Second.compareTo(sOleObjectType) == 0 || - rPair.Second.compareTo(sOleObjectTypeStrict) == 0) && + else if(rPair.First == sType && + ((rPair.Second == sOleObjectType || + rPair.Second == sOleObjectTypeStrict) && nStreamType == EMBEDDINGS)) { bFound = true; } - else if (rPair.First.compareTo(sId) == 0 && - rPair.Second.compareTo(rId) == 0) + else if (rPair.First == sId && + rPair.Second == rId) bFound = true; - else if (rPair.First.compareTo(sTarget) == 0) + else if (rPair.First == sTarget) { // checking item[n].xml or activex[n].xml is not visited already. if(customTarget != rPair.Second && (sStreamType == sCustomType || sStreamType == sActiveXType || sStreamType == sChartType || sStreamType == sFooterType || sStreamType == sHeaderType)) @@ -313,8 +313,8 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess> sMyTarget = rPair.Second; } } - else if (rPair.First.compareTo(sTargetMode) == 0 && - rPair.Second.compareTo(sExternal) == 0) + else if (rPair.First == sTargetMode && + rPair.Second == sExternal) bExternalTarget = true; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index b45fd3e7e768..a4c7c1d31382 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -759,7 +759,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) // provided by picw and pich. OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8)); const char aURLBegin[] = "vnd.sun.star.GraphicObject:"; - if (aURLBS.compareTo(aURLBegin, RTL_CONSTASCII_LENGTH(aURLBegin)) == 0) + if (aURLBS.startsWith(aURLBegin)) { Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic(); Size aSize(aGraphic.GetPrefSize()); diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java index ad76fcdbc2c6..2f4897da1f65 100644 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ b/xmerge/source/bridge/java/XMergeBridge.java @@ -157,10 +157,10 @@ public class XMergeBridge { { try{ - if (pValue[i].Name.compareTo("InputStream")==0){ + if (pValue[i].Name.equals("InputStream")){ xis=(com.sun.star.io.XInputStream)AnyConverter.toObject(new Type(com.sun.star.io.XInputStream.class), pValue[i].Value); } - if (pValue[i].Name.compareTo("FileName")==0){ + if (pValue[i].Name.equals("FileName")){ sFileName=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); } @@ -234,15 +234,15 @@ public class XMergeBridge { try{ - if (pValue[i].Name.compareTo("OutputStream")==0){ + if (pValue[i].Name.equals("OutputStream")){ xos=(com.sun.star.io.XOutputStream)AnyConverter.toObject(new Type(com.sun.star.io.XOutputStream.class), pValue[i].Value); } - if (pValue[i].Name.compareTo("FileName")==0){ + if (pValue[i].Name.equals("FileName")){ sFileName=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); } - if (pValue[i].Name.compareTo("URL")==0){ + if (pValue[i].Name.equals("URL")){ sURL=(String)AnyConverter.toObject(new Type(java.lang.String.class), pValue[i].Value); } } |