vcl: Use appropriate OUString functions on string constants

Change-Id: I169624820cd7d25eab18a6b90482e075ebfebcc6
This commit is contained in:
Stephan Bergmann 2014-12-18 17:58:17 +01:00
parent 11f2099904
commit 9de415945a
13 changed files with 37 additions and 37 deletions

View File

@ -364,8 +364,8 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
// try to parse the font name and decide whether it might be a
// japanese font. Who invented this PITA ?
OUString aPSNameLastToken( aPSName.copy( aPSName.lastIndexOf( '-' )+1 ) );
if( aPSNameLastToken.equalsAscii( "H" ) ||
aPSNameLastToken.equalsAscii( "V" ) )
if( aPSNameLastToken == "H" ||
aPSNameLastToken == "V" )
{
static const char* pEncs[] =
{

View File

@ -857,7 +857,7 @@ void PrinterJob::writeJobPatch( osl::File* pFile, const JobData& rJobData )
{
const PPDValue* pVal = pKey->getValue( i );
patch_order.push_back( pVal->m_aOption.toInt32() );
if( patch_order.back() == 0 && ! pVal->m_aOption.equalsAscii( "0" ) )
if( patch_order.back() == 0 && pVal->m_aOption != "0" )
{
WritePS( pFile, "% Warning: left out JobPatchFile option \"" );
OString aOption = OUStringToOString( pVal->m_aOption, RTL_TEXTENCODING_ASCII_US );

View File

@ -341,11 +341,11 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
{
const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
if( pKey->isUIKey() &&
! pKey->getKey().equalsAscii( "PageSize" ) &&
! pKey->getKey().equalsAscii( "InputSlot" ) &&
! pKey->getKey().equalsAscii( "PageRegion" ) &&
! pKey->getKey().equalsAscii( "Duplex" )
if( pKey->isUIKey() &&
pKey->getKey() != "PageSize" &&
pKey->getKey() != "InputSlot" &&
pKey->getKey() != "PageRegion" &&
pKey->getKey() != "Duplex"
)
{
OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );

View File

@ -46,7 +46,7 @@ static void sendEmptyCommit( SalFrame* pFrame )
SalExtTextInputEvent aEmptyEv;
aEmptyEv.mnTime = 0;
aEmptyEv.mpTextAttr = 0;
aEmptyEv.maText = "";
aEmptyEv.maText.clear();
aEmptyEv.mnCursorPos = 0;
aEmptyEv.mnCursorFlags = 0;
aEmptyEv.mbOnlyCursor = False;

View File

@ -970,7 +970,7 @@ OUString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
aStrMap += aKeyName;
}
else
aStrMap = "";
aStrMap.clear();
}
else if (!aCustomKeyName.isEmpty())
{
@ -981,7 +981,7 @@ OUString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
aStrMap += aCustomKeyName;
}
else
aStrMap = "";
aStrMap.clear();
return aStrMap;
}

View File

@ -821,7 +821,7 @@ bool WMAdaptor::getNetWmName()
}
// if this is metacity, check for version to enable a legacy workaround
if( m_aWMName.equalsAscii( "Metacity" ) )
if( m_aWMName == "Metacity" )
{
int nVersionMajor = 0, nVersionMinor = 0;
Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
@ -890,7 +890,7 @@ bool WMAdaptor::getWMshouldSwitchWorkspace() const
OUString( "ShouldSwitchWorkspace" ) ) );
if( aSetting.isEmpty() )
{
if( m_aWMName.equalsAscii( "awesome" ) )
if( m_aWMName == "awesome" )
{
pWMA->m_bWMshouldSwitchWorkspace = false;
}

View File

@ -613,9 +613,9 @@ bool SelectionManager::convertData(
aFlavor.MimeType = convertTypeFromNative( nType, nSelection, rFormat );
sal_Int32 nIndex = 0;
if( aFlavor.MimeType.getToken( 0, ';', nIndex ).equalsAscii( "text/plain" ) )
if( aFlavor.MimeType.getToken( 0, ';', nIndex ) == "text/plain" )
{
if( aFlavor.MimeType.getToken( 0, ';', nIndex ).equalsAscii( "charset=utf-16" ) )
if( aFlavor.MimeType.getToken( 0, ';', nIndex ) == "charset=utf-16" )
aFlavor.DataType = cppu::UnoType<OUString>::get();
else
aFlavor.DataType = getCppuType( (Sequence< sal_Int8 >*)0 );
@ -1323,18 +1323,18 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
{
OUString aToken(pFlavors->MimeType.getToken( 0, ';', nIndex ));
// omit text/plain;charset=unicode since it is not well defined
if( aToken.equalsAscii( "charset=unicode" ) )
if( aToken == "charset=unicode" )
{
pAtoms++;
continue;
}
bHaveText = true;
if( aToken.equalsAscii( "charset=utf-16" ) )
if( aToken == "charset=utf-16" )
{
bHaveUTF16 = true;
pFlavors->DataType = cppu::UnoType<OUString>::get();
}
else if( aToken.equalsAscii( "charset=utf-8" ) )
else if( aToken == "charset=utf-8" )
{
aUTF8Type = *pAtoms;
}

View File

@ -70,7 +70,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
m_nSelectionTimeout( 3 )
{
Sequence< OUString > aKeys( 1 );
aKeys.getArray()[0] = OUString( SELECTION_PROPERTY );
aKeys.getArray()[0] = SELECTION_PROPERTY;
Sequence< Any > aValues = GetProperties( aKeys );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );

View File

@ -1071,7 +1071,7 @@ void PPDParser::parse( ::std::list< OString >& rLines )
{
// handle main key translations of form:
// *ll_CC.Translation MainKeyword/translated text: ""
if( aUniKey.equalsAscii( "Translation" ) )
if( aUniKey == "Translation" )
{
m_pTranslator->insertKey( aOption, aOptionTranslation, aTransLocale );
}
@ -1692,7 +1692,7 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
// None / False and the default can always be set, but be careful !
// setting them might influence constrained values
if( pNewValue->m_aOption.equalsAscii( "None" ) || pNewValue->m_aOption.equalsAscii( "False" ) ||
if( pNewValue->m_aOption == "None" || pNewValue->m_aOption == "False" ||
pNewValue == pKey->getDefaultValue() )
return true;
@ -1727,8 +1727,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
continue; // this should not happen, PPD broken
if( pKeyOption == pNewValue &&
! pOtherKeyOption->m_aOption.equalsAscii( "None" ) &&
! pOtherKeyOption->m_aOption.equalsAscii( "False" ) )
pOtherKeyOption->m_aOption != "None" &&
pOtherKeyOption->m_aOption != "False" )
{
// check if the other value can be reset and
// do so if possible
@ -1741,8 +1741,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
else if( pOtherKeyOption )
{
if( getValue( pOtherKey ) == pOtherKeyOption &&
! pNewValue->m_aOption.equalsAscii( "None" ) &&
! pNewValue->m_aOption.equalsAscii( "False" ) )
pNewValue->m_aOption != "None" &&
pNewValue->m_aOption != "False" )
return false;
}
else
@ -1754,10 +1754,10 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
else
{
const PPDValue* pOtherValue = getValue( pOtherKey );
if( ! pOtherValue->m_aOption.equalsAscii( "None" ) &&
! pOtherValue->m_aOption.equalsAscii( "False" ) &&
! pNewValue->m_aOption.equalsAscii( "None" ) &&
! pNewValue->m_aOption.equalsAscii( "False" ) )
if( pOtherValue->m_aOption != "None" &&
pOtherValue->m_aOption != "False" &&
pNewValue->m_aOption != "None" &&
pNewValue->m_aOption != "False" )
return false;
}
}

View File

@ -618,7 +618,7 @@ bool PrinterInfoManager::writePrinterConfig()
while( nIndex != -1 && ! bAutoQueue )
{
OUString aToken( it->second.m_aInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
if( aToken.equalsAscii( "autoqueue" ) )
if( aToken == "autoqueue" )
bAutoQueue = true;
}
if( bAutoQueue )

View File

@ -1035,7 +1035,7 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon )
else
{
const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
if( rWM.equalsAscii( "KWin" ) ) // assume KDE is running
if( rWM == "KWin" ) // assume KDE is running
iconSize = 48;
static bool bGnomeIconSize = false;
static bool bGnomeChecked = false;
@ -3384,7 +3384,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
{
// ReflectionX in Windows mode changes focus while mouse is grabbed
if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii( "ReflectionX Windows" ) )
if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName() == "ReflectionX Windows" )
return 1;
/* ignore focusout resulting from keyboard grabs
@ -4072,7 +4072,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
/* another workaround for sawfish: if a transient window for the same parent is shown
* sawfish does not set the focus to it. Applies only for click to focus mode.
*/
if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii( "Sawfish" ) )
if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName() == "Sawfish" )
{
// don't set the focus into the IME status window
// since this will lead to a parent loss of focus, close status,

View File

@ -1808,7 +1808,7 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
static const char aStarDot[] = "*.";
OUString aTokens;
bool bAllGlob = rType.equalsAscii( "*.*" ) || rType.equalsAscii( "*" );
bool bAllGlob = rType == "*.*" || rType == "*";
if (bAllGlob)
gtk_file_filter_add_pattern( filter, "*" );
else

View File

@ -1158,7 +1158,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XSetWMHints( pDisplay, aWindow, pHints );
XFree( pHints );
if (GetGtkSalData()->GetGtkDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii("compiz"))
if (GetGtkSalData()->GetGtkDisplay()->getWMAdaptor()->getWindowManagerName() == "compiz")
return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
@ -4028,7 +4028,7 @@ void GtkSalFrame::IMHandler::sendEmptyCommit()
SalExtTextInputEvent aEmptyEv;
aEmptyEv.mnTime = 0;
aEmptyEv.mpTextAttr = 0;
aEmptyEv.maText = "";
aEmptyEv.maText.clear();
aEmptyEv.mnCursorPos = 0;
aEmptyEv.mnCursorFlags = 0;
aEmptyEv.mbOnlyCursor = False;
@ -4263,7 +4263,7 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
if( ! aDel.isDeleted() )
{
// reset input event
pThis->m_aInputEvent.maText = "";
pThis->m_aInputEvent.maText.clear();
pThis->m_aInputEvent.mnCursorPos = 0;
pThis->updateIMSpotLocation();
}