From 1bef45b2295af8837e637342df350ba7a9c3c850 Mon Sep 17 00:00:00 2001
From: Janit Anjaria <janit92@gmail.com>
Date: Fri, 19 Apr 2013 02:00:09 +0530
Subject: [PATCH] fdo#62096: Replaced some OUString 'compareTo' with '=='

I have just followed the instructions and using grep replaced all the .compareTo() calls with == operator.
---
 svx/source/fmcomp/fmgridif.cxx |   44 ++++++++++++++++++++--------------------
 svx/source/fmcomp/gridcell.cxx |    2 +-
 svx/source/fmcomp/gridctrl.cxx |    2 +-
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 5c5b6cb..c24fcd6 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1912,7 +1912,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
 
     sal_Bool bVoid = !Value.hasValue();
 
-    if ( 0 == PropertyName.compareTo( FM_PROP_TEXTLINECOLOR ) )
+    if ( PropertyName == ( FM_PROP_TEXTLINECOLOR ) )
     {
         ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::comphelper::getINT32( Value ) );
         if (bVoid)
@@ -1944,21 +1944,21 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
         if (isDesignMode())
             pGrid->Invalidate();
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_FONTEMPHASISMARK ) )
+    else if ( PropertyName == ( FM_PROP_FONTEMPHASISMARK ) )
     {
         Font aGridFont = pGrid->GetControlFont();
         sal_Int16 nValue = ::comphelper::getINT16(Value);
         aGridFont.SetEmphasisMark( nValue );
         pGrid->SetControlFont( aGridFont );
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_FONTRELIEF ) )
+    else if ( PropertyName == ( FM_PROP_FONTRELIEF ) )
     {
         Font aGridFont = pGrid->GetControlFont();
         sal_Int16 nValue = ::comphelper::getINT16(Value);
         aGridFont.SetRelief( (FontRelief)nValue );
         pGrid->SetControlFont( aGridFont );
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_HELPURL ) )
+    else if ( PropertyName == ( FM_PROP_HELPURL ) )
     {
         ::rtl::OUString sHelpURL;
         OSL_VERIFY( Value >>= sHelpURL );
@@ -1967,11 +1967,11 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
             sHelpURL = aHID.GetURLPath();
         pGrid->SetHelpId( rtl::OUStringToOString( sHelpURL, RTL_TEXTENCODING_UTF8 ) );
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_DISPLAYSYNCHRON ) )
+    else if ( PropertyName == ( FM_PROP_DISPLAYSYNCHRON ) )
     {
         pGrid->setDisplaySynchron(::comphelper::getBOOL(Value));
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_CURSORCOLOR ) )
+    else if ( PropertyName == ( FM_PROP_CURSORCOLOR ) )
     {
         if (bVoid)
             pGrid->SetCursorColor(COL_TRANSPARENT);
@@ -1980,13 +1980,13 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
         if (isDesignMode())
             pGrid->Invalidate();
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_ALWAYSSHOWCURSOR ) )
+    else if ( PropertyName == ( FM_PROP_ALWAYSSHOWCURSOR ) )
     {
         pGrid->EnablePermanentCursor(::comphelper::getBOOL(Value));
         if (isDesignMode())
             pGrid->Invalidate();
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_FONT ) )
+    else if ( PropertyName == ( FM_PROP_FONT ) )
     {
         if ( bVoid )
             pGrid->SetControlFont( Font() );
@@ -2020,7 +2020,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
             }
         }
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_BACKGROUNDCOLOR ) )
+    else if ( PropertyName == ( FM_PROP_BACKGROUNDCOLOR ) )
     {
         if ( bVoid )
         {
@@ -2033,7 +2033,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
             pGrid->SetControlBackground( aColor );
         }
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_TEXTCOLOR ) )
+    else if ( PropertyName == ( FM_PROP_TEXTCOLOR ) )
     {
         if ( bVoid )
         {
@@ -2046,7 +2046,7 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
             pGrid->SetControlForeground( aColor );
         }
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_ROWHEIGHT ) )
+    else if ( PropertyName == ( FM_PROP_ROWHEIGHT ) )
     {
         sal_Int32 nLogHeight(0);
         if (Value >>= nLogHeight)
@@ -2059,19 +2059,19 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V
         else if (bVoid)
             pGrid->SetDataRowHeight(0);
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_HASNAVIGATION ) )
+    else if ( PropertyName == ( FM_PROP_HASNAVIGATION ) )
     {
         sal_Bool bValue( sal_True );
         OSL_VERIFY( Value >>= bValue );
         pGrid->EnableNavigationBar( bValue );
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_RECORDMARKER ) )
+    else if ( PropertyName == ( FM_PROP_RECORDMARKER ) )
     {
         sal_Bool bValue( sal_True );
         OSL_VERIFY( Value >>= bValue );
         pGrid->EnableHandle( bValue );
     }
-    else if ( 0 == PropertyName.compareTo( FM_PROP_ENABLED ) )
+    else if ( PropertyName == ( FM_PROP_ENABLED ) )
     {
         sal_Bool bValue( sal_True );
         OSL_VERIFY( Value >>= bValue );
@@ -2125,37 +2125,37 @@ Any FmXGridPeer::getProperty( const ::rtl::OUString& _rPropertyName ) throw( Run
         FmGridControl* pGrid = (FmGridControl*) GetWindow();
         Window* pDataWindow  = &pGrid->GetDataWindow();
 
-        if ( 0 == _rPropertyName.compareTo( FM_PROP_NAME ) )
+        if ( _rPropertyName == ( FM_PROP_NAME ) )
         {
             Font aFont = pDataWindow->GetControlFont();
             aProp <<= ImplCreateFontDescriptor( aFont );
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_TEXTCOLOR ) )
+        else if ( _rPropertyName == ( FM_PROP_TEXTCOLOR ) )
         {
             aProp <<= (sal_Int32)pDataWindow->GetControlForeground().GetColor();
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_BACKGROUNDCOLOR ) )
+        else if ( _rPropertyName == ( FM_PROP_BACKGROUNDCOLOR ) )
         {
             aProp <<= (sal_Int32)pDataWindow->GetControlBackground().GetColor();
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_ROWHEIGHT ) )
+        else if ( _rPropertyName == ( FM_PROP_ROWHEIGHT ) )
         {
             sal_Int32 nPixelHeight = pGrid->GetDataRowHeight();
             // take the zoom factor into account
             nPixelHeight = pGrid->CalcReverseZoom(nPixelHeight);
             aProp <<= (sal_Int32)pGrid->PixelToLogic(Point(0,nPixelHeight),MAP_10TH_MM).Y();
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_HASNAVIGATION ) )
+        else if ( _rPropertyName == ( FM_PROP_HASNAVIGATION ) )
         {
             sal_Bool bHasNavBar = pGrid->HasNavigationBar();
             aProp <<= (sal_Bool)bHasNavBar;
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_RECORDMARKER ) )
+        else if ( _rPropertyName == ( FM_PROP_RECORDMARKER ) )
         {
             sal_Bool bHasHandle = pGrid->HasHandle();
             aProp <<= (sal_Bool)bHasHandle;
         }
-        else if ( 0 == _rPropertyName.compareTo( FM_PROP_ENABLED ) )
+        else if ( _rPropertyName == ( FM_PROP_ENABLED ) )
         {
             aProp <<= (sal_Bool)pDataWindow->IsEnabled();
         }
@@ -2936,7 +2936,7 @@ IMPL_LINK(FmXGridPeer, OnExecuteGridSlot, void*, pSlot)
             if (m_pDispatchers[i].is())
             {
                 // commit any changes done so far, if it's not the undoRecord URL
-                if ( 0 == pUrls->Complete.compareTo( FMURL_RECORD_UNDO ) || commit() )
+                if ( pUrls->Complete == ( FMURL_RECORD_UNDO ) || commit() )
                     m_pDispatchers[i]->dispatch(*pUrls, Sequence< PropertyValue>());
 
                 return 1;   // handled
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 0281ed3..d88557b 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1485,7 +1485,7 @@ CellControllerRef DbFormattedField::CreateController() const
 //------------------------------------------------------------------------------
 void DbFormattedField::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw( RuntimeException )
 {
-    if (_rEvent.PropertyName.compareTo(FM_PROP_FORMATKEY) == COMPARE_EQUAL)
+    if (_rEvent.PropertyName == (FM_PROP_FORMATKEY) )
     {
         sal_Int32 nNewKey = _rEvent.NewValue.hasValue() ? ::comphelper::getINT32(_rEvent.NewValue) : 0;
         m_nKeyType = comphelper::getNumberFormatType(m_xSupplier->getNumberFormats(), nNewKey);
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index d6434e1..fe86e52 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2771,7 +2771,7 @@ void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) th
     SolarMutexGuard aGuard;
     // prop "IsModified" changed ?
     // during update don't care about the modified state
-    if (!IsUpdating() && evt.PropertyName.compareTo(FM_PROP_ISMODIFIED) == COMPARE_EQUAL)
+    if (!IsUpdating() && evt.PropertyName == (FM_PROP_ISMODIFIED) )
     {
         Reference< XPropertySet > xSource(evt.Source, UNO_QUERY);
         DBG_ASSERT( xSource.is(), "DbGridControl::DataSourcePropertyChanged: invalid event source!" );
-- 
1.7.10.4

