summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-11-05 11:32:52 +0200
committerNoel Grandin <noel@peralex.com>2013-11-11 12:58:12 +0200
commitef90021abe3735fba57145598fd7c3d359d2718e (patch)
tree9da3ef32700774f56e0225ea28f3bc4ceaffe80c /sw
parent0a9ef5a18e148c7a5c9a088e153a7873d1564841 (diff)
convert OUString !compareToAscii to equalsAscii
Convert code like if( ! aStr.compareToAscii("XXX") ) to if( aStr.equalsAscii("XXX") ) which is both clearer and faster. Change-Id: I267511bccab52f5225b291acbfa4e388b5a5302b
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/findtxt.cxx7
-rw-r--r--sw/source/core/fields/authfld.cxx2
-rw-r--r--sw/source/core/unocore/unoframe.cxx13
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx2
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx6
-rw-r--r--sw/source/ui/uno/unodispatch.cxx24
-rw-r--r--sw/source/ui/uno/unotxvw.cxx14
7 files changed, 33 insertions, 35 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 2770ab1ea13b..69013f8c4deb 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -231,10 +231,9 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
const bool bRegSearch = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
const bool bChkEmptyPara = bRegSearch && 2 == rSearchOpt.searchString.getLength() &&
- ( !rSearchOpt.searchString.compareToAscii( "^$" ) ||
- !rSearchOpt.searchString.compareToAscii( "$^" ) );
- const bool bChkParaEnd = bRegSearch && 1 == rSearchOpt.searchString.getLength() &&
- !rSearchOpt.searchString.compareToAscii( "$" );
+ ( rSearchOpt.searchString.equalsAscii( "^$" ) ||
+ rSearchOpt.searchString.equalsAscii( "$^" ) );
+ const bool bChkParaEnd = bRegSearch && rSearchOpt.searchString.equalsAscii( "$" );
// LanguageType eLastLang = 0;
while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly ) ))
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 3f3e1af3bc67..ff6ec0cad661 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -652,7 +652,7 @@ bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
static sal_Int16 lcl_Find(const OUString& rFieldName)
{
for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
- if(!rFieldName.compareToAscii(aFieldNames[i]))
+ if(rFieldName.equalsAscii(aFieldNames[i]))
return i;
return -1;
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 35157a2bef29..9d8290189843 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -815,18 +815,17 @@ OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException )
sal_Bool SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException )
{
- return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")||
- !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
- !rServiceName.compareToAscii("com.sun.star.document.LinkTarget");
+ return rServiceName.equalsAscii("com.sun.star.text.BaseFrame") ||
+ rServiceName.equalsAscii("com.sun.star.text.TextContent") ||
+ rServiceName.equalsAscii("com.sun.star.document.LinkTarget");
}
uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
{
uno::Sequence< OUString > aRet(3);
- OUString* pArray = aRet.getArray();
- pArray[0] = "com.sun.star.text.BaseFrame";
- pArray[1] = "com.sun.star.text.TextContent";
- pArray[2] = "com.sun.star.document.LinkTarget";
+ aRet[0] = "com.sun.star.text.BaseFrame";
+ aRet[1] = "com.sun.star.text.TextContent";
+ aRet[2] = "com.sun.star.document.LinkTarget";
return aRet;
}
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 39230e634044..0cb63637327d 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -123,7 +123,7 @@ static OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet>& xSourceProp
else if(aInfo[nInfo].Name == "CharSet")
aInfo[nInfo].Value >>= sCharSet;
}
- if(!sCharSet.compareToAscii( cUTF8 ))
+ if(sCharSet.equalsAscii( cUTF8 ))
{
sURL = sDBURL.copy(10);
//#i97577# at this point the 'URL' can also be a file name!
diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx
index fb7646c68774..97200ec5edd7 100644
--- a/sw/source/ui/dbui/mailmergehelper.cxx
+++ b/sw/source/ui/dbui/mailmergehelper.cxx
@@ -657,11 +657,11 @@ uno::Any SwConnectionContext::getValueByName( const OUString& rName )
throw (uno::RuntimeException)
{
uno::Any aRet;
- if( !rName.compareToAscii( "ServerName" ))
+ if( rName.equalsAscii( "ServerName" ))
aRet <<= m_sMailServer;
- else if( !rName.compareToAscii( "Port" ))
+ else if( rName.equalsAscii( "Port" ))
aRet <<= (sal_Int32) m_nPort;
- else if( !rName.compareToAscii( "ConnectionType" ))
+ else if( rName.equalsAscii( "ConnectionType" ))
aRet <<= m_sConnectionType;
return aRet;
}
diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx
index 6af22e9a214e..0df0f8f8fcb3 100644
--- a/sw/source/ui/uno/unodispatch.cxx
+++ b/sw/source/ui/uno/unodispatch.cxx
@@ -71,10 +71,10 @@ uno::Reference< frame::XDispatch > SwXDispatchProviderInterceptor::queryDispatch
// create some dispatch ...
if(m_pView && aURL.Complete.startsWith(".uno:DataSourceBrowser/"))
{
- if(!aURL.Complete.compareToAscii(cURLFormLetter) ||
- !aURL.Complete.compareToAscii(cURLInsertContent) ||
- !aURL.Complete.compareToAscii(cURLInsertColumns)||
- !aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ if(aURL.Complete.equalsAscii(cURLFormLetter) ||
+ aURL.Complete.equalsAscii(cURLInsertContent) ||
+ aURL.Complete.equalsAscii(cURLInsertColumns)||
+ aURL.Complete.equalsAscii(cURLDocumentDataSource))
{
if(!m_xDispatch.is())
m_xDispatch = new SwXDispatch(*m_pView);
@@ -209,17 +209,17 @@ void SwXDispatch::dispatch(
throw uno::RuntimeException();
SwWrtShell& rSh = m_pView->GetWrtShell();
SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
- if(!aURL.Complete.compareToAscii(cURLInsertContent))
+ if(aURL.Complete.equalsAscii(cURLInsertContent))
{
::svx::ODataAccessDescriptor aDescriptor(aArgs);
SwMergeDescriptor aMergeDesc( DBMGR_MERGE, rSh, aDescriptor );
pNewDBMgr->MergeNew(aMergeDesc);
}
- else if(!aURL.Complete.compareToAscii(cURLInsertColumns))
+ else if(aURL.Complete.equalsAscii(cURLInsertColumns))
{
pNewDBMgr->InsertText(rSh, aArgs);
}
- else if(!aURL.Complete.compareToAscii(cURLFormLetter))
+ else if(aURL.Complete.equalsAscii(cURLFormLetter))
{
SfxUsrAnyItem aDBProperties(FN_PARAM_DATABASE_PROPERTIES, uno::makeAny(aArgs));
m_pView->GetViewFrame()->GetDispatcher()->Execute(
@@ -227,11 +227,11 @@ void SwXDispatch::dispatch(
SFX_CALLMODE_ASYNCHRON,
&aDBProperties, 0L);
}
- else if(!aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ else if(aURL.Complete.equalsAscii(cURLDocumentDataSource))
{
OSL_FAIL("SwXDispatch::dispatch: this URL is not to be dispatched!");
}
- else if(!aURL.Complete.compareToAscii(cInternalDBChangeNotification))
+ else if(aURL.Complete.equalsAscii(cInternalDBChangeNotification))
{
frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = sal_True;
@@ -250,7 +250,7 @@ void SwXDispatch::dispatch(
for(aListIter = m_aListenerList.begin(); aListIter != m_aListenerList.end(); ++aListIter)
{
StatusStruct_Impl aStatus = *aListIter;
- if(!aStatus.aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ if(aStatus.aURL.Complete.equalsAscii(cURLDocumentDataSource))
{
aEvent.FeatureURL = aStatus.aURL;
aStatus.xListener->statusChanged( aEvent );
@@ -280,7 +280,7 @@ void SwXDispatch::addStatusListener(
aEvent.FeatureURL = aURL;
// one of the URLs requires a special state ....
- if (!aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ if (aURL.Complete.equalsAscii(cURLDocumentDataSource))
{
const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc();
@@ -352,7 +352,7 @@ void SwXDispatch::selectionChanged( const lang::EventObject& ) throw(uno::Runti
{
StatusStruct_Impl aStatus = *aListIter;
aEvent.FeatureURL = aStatus.aURL;
- if (0 != aStatus.aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ if (!aStatus.aURL.Complete.equalsAscii(cURLDocumentDataSource))
// the document's data source does not depend on the selection, so it's state does not change here
aStatus.xListener->statusChanged( aEvent );
}
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index cdb761759147..f6565e76bb96 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -1698,13 +1698,13 @@ OUString SwXTextViewCursor::getImplementationName(void) throw( RuntimeException
sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
- return !rServiceName.compareToAscii("com.sun.star.text.TextViewCursor") ||
- !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
- !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
- !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
- !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
- !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
- !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex");
+ return rServiceName.equalsAscii("com.sun.star.text.TextViewCursor") ||
+ rServiceName.equalsAscii("com.sun.star.style.CharacterProperties") ||
+ rServiceName.equalsAscii("com.sun.star.style.CharacterPropertiesAsian") ||
+ rServiceName.equalsAscii("com.sun.star.style.CharacterPropertiesComplex") ||
+ rServiceName.equalsAscii("com.sun.star.style.ParagraphProperties") ||
+ rServiceName.equalsAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ rServiceName.equalsAscii("com.sun.star.style.ParagraphPropertiesComplex");
}
Sequence< OUString > SwXTextViewCursor::getSupportedServiceNames(void) throw( RuntimeException )