From 8a78020b4ead30627a021a0d604c558488565ffe Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Wed, 18 Apr 2012 18:06:49 -0300 Subject: More RTL_CONSTASCII cleanups --- sd/qa/unit/filters-test.cxx | 9 ++--- sd/source/filter/eppt/eppt.cxx | 4 +- sd/source/filter/eppt/pptexanimations.cxx | 24 +++++------ sd/source/filter/eppt/pptx-text.cxx | 67 +++++++++++++++---------------- 4 files changed, 51 insertions(+), 53 deletions(-) (limited to 'sd') diff --git a/sd/qa/unit/filters-test.cxx b/sd/qa/unit/filters-test.cxx index 1936280e3b48..b6afb39bf339 100644 --- a/sd/qa/unit/filters-test.cxx +++ b/sd/qa/unit/filters-test.cxx @@ -113,7 +113,7 @@ FileFormat aFileFormats[] = { rtl::OUString(), pFmt->nFormatType, nFormat, rtl::OUString::createFromAscii( pFmt->pTypeName ), 0, rtl::OUString(), rtl::OUString(), /* userdata */ - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sdraw*")) ); + rtl::OUString("private:factory/sdraw*") ); aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(); @@ -176,9 +176,9 @@ bool SdFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL void SdFiltersTest::testCVEs() { - testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS PowerPoint 97")), + testDir(rtl::OUString("MS PowerPoint 97"), getURLFromSrc("/sd/qa/unit/data/ppt/"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdfilt"))); + rtl::OUString("sdfilt")); } SdFiltersTest::SdFiltersTest() @@ -192,8 +192,7 @@ void SdFiltersTest::setUp() // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, // which is a private symbol to us, gets called m_xDrawComponent = - getMultiServiceFactory()->createInstance(rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.PresentationDocument"))); + getMultiServiceFactory()->createInstance("com.sun.star.comp.Draw.PresentationDocument"); CPPUNIT_ASSERT_MESSAGE("no impress component!", m_xDrawComponent.is()); } diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 72bc751fa80b..d041683c61eb 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -122,7 +122,7 @@ void PPTWriter::exportPPTPre( const std::vector< com::sun::star::beans::Property if ( !mpPicStrm ) mpPicStrm = mrStg->OpenSotStream( rtl::OUString( "Pictures" ) ); - const String sBaseURI( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ); + const rtl::OUString sBaseURI( "BaseURI" ); std::vector< com::sun::star::beans::PropertyValue >::const_iterator aIter( rMediaData.begin() ); while( aIter != rMediaData.end() ) { @@ -1310,7 +1310,7 @@ void PPTWriter::ImplWriteOLE( ) aOleExport.ExportOLEObject( xObj, *xTempStorage ); //TODO/MBA: testing - String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) ); + rtl::OUString aPersistStream( SVEXT_PERSIST_STREAM ); SvMemoryStream aStream; SvStorageRef xCleanStorage( new SvStorage( sal_False, aStream ) ); xTempStorage->CopyTo( xCleanStorage ); diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index 9ffc748c8526..a2edb89f6a0a 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -1414,10 +1414,10 @@ void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnim Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const rtl::OUString& rAttributeName ) { rtl::OUString aDest; - if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "X" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Y" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Height" ) ) + if ( rAttributeName == "X" + || rAttributeName == "Y" + || rAttributeName == "Width" + || rAttributeName == "Height" ) { rtl::OUString aStr; @@ -1427,20 +1427,20 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const rtl:: aDest += aStr; } } - else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Rotate" ) ) // "r" or "style.rotation" ? - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SkewX" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Opacity" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharHeight" ) ) + else if ( rAttributeName == "Rotate" // "r" or "style.rotation" ? + || rAttributeName == "SkewX" + || rAttributeName == "Opacity" + || rAttributeName == "CharHeight" ) { double fNumber = 0.0; if ( rSourceValue >>= fNumber ) aDest += rtl::OUString::valueOf( fNumber ); } - else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Color" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillColor" ) ) // "Fillcolor" or "FillColor" ? - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineColor" ) ) - || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharColor" ) ) + else if ( rAttributeName == "Color" + || rAttributeName == "FillColor" // "Fillcolor" or "FillColor" ? + || rAttributeName == "LineColor" + || rAttributeName == "CharColor" ) { sal_Int32 nColor = 0; diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 915e97b6eddb..a22081ea0234 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -489,8 +489,8 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com ::com::sun::star::uno::Any aAny; if ( GetPropertyValue( aAny, rXPropSet, rtl::OUString( "TextPortionType" ), sal_True ) ) { - String aTextFieldType( *(::rtl::OUString*)aAny.getValue() ); - if ( aTextFieldType == String( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) ) + rtl::OUString aTextFieldType( *(::rtl::OUString*)aAny.getValue() ); + if ( aTextFieldType == "TextField" ) { if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) ) { @@ -503,8 +503,8 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY ); if ( xFieldPropSet.is() ) { - String aFieldKind( aXTextField->getPresentation( sal_True ) ); - if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) ) + rtl::OUString aFieldKind( aXTextField->getPresentation( sal_True ) ); + if ( aFieldKind == "Date" ) { if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True ) { @@ -532,21 +532,21 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com } } } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ) + else if ( aFieldKind == "URL" ) { if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "URL" ) ), sal_True ) rURL = String( *(::rtl::OUString*)aAny.getValue() ); nRetValue = 4 << 28; } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Page" ) ) ) + else if ( aFieldKind == "Page" ) { nRetValue = 3 << 28 | 0x800000; } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ) + else if ( aFieldKind == "Pages" ) { } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) ) + else if ( aFieldKind == "Time" ) { if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True ) { @@ -562,15 +562,15 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com } } } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) ) + else if ( aFieldKind == "File" ) { } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) ) + else if ( aFieldKind == "Table" ) { } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtTime" ) ) ) + else if ( aFieldKind == "ExtTime" ) { if ( GetPropertyValue( aAny, xFieldPropSet, rtl::OUString( "IsFix" ) ), sal_True ) { @@ -598,23 +598,23 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com } } } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtFile" ) ) ) + else if ( aFieldKind == "ExtFile" ) { } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ) ) + else if ( aFieldKind == "Author" ) { } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "DateTime" ) ) ) + else if ( aFieldKind == "DateTime" ) { nRetValue = 5 << 28 | 0x800000; } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Header" ) ) ) + else if ( aFieldKind == "Header" ) { nRetValue = 6 << 28 | 0x800000; } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Footer" ) ) ) + else if ( aFieldKind == "Footer" ) { nRetValue = 7 << 28 | 0x800000; } @@ -747,19 +747,19 @@ void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) } // from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact -static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName) +static void lcl_SubstituteBullet(rtl::OUString& rNumStr, rtl_TextEncoding& rChrSet, rtl::OUString& rFontName) { - sal_Unicode cChar = rNumStr.GetChar(0); + sal_Unicode cChar = rNumStr[0]; StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont(); - String sFont = pConvert->ConvertChar(cChar); + rtl::OUString sFont = pConvert->ConvertChar(cChar); delete pConvert; - if (sFont.Len()) + if (!sFont.isEmpty()) { - rNumStr = static_cast< sal_Unicode >(cChar | 0xF000); + rNumStr = rtl::OUString(static_cast< sal_Unicode >(cChar | 0xF000)); rFontName = sFont; rChrSet = RTL_TEXTENCODING_SYMBOL; } - else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) ) + else if ( (rNumStr[0] < 0xE000 || rNumStr[0] > 0xF8FF) ) { /* Ok we can't fit into a known windows unicode font, but @@ -777,8 +777,8 @@ static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, Str in our private area, so give up and show a standard bullet symbol */ - rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings")); - rNumStr = static_cast< sal_Unicode >(0x6C); + rFontName = "Wingdings"; + rNumStr = rtl::OUString(static_cast< sal_Unicode >(0x6C)); } } @@ -831,9 +831,9 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 nHorzAdjust = *( (sal_Int16*)pValue ); else if ( aPropName == "BulletChar" ) { - String aString( *( (String*)pValue ) ); - if ( aString.Len() ) - cBulletId = aString.GetChar( 0 ); + rtl::OUString aString( *( (::rtl::OUString*)pValue ) ); + if ( !aString.isEmpty() ) + cBulletId = aString[ 0 ]; } else if ( aPropName == "BulletFont" ) { @@ -885,8 +885,8 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 sSuffix = ( *(::rtl::OUString*)pValue ); #ifdef DBG_UTIL else if ( ! ( - ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SymbolTextDistance" ) ) ) - || ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Graphic" ) ) ) ) ) + ( aPropName == "SymbolTextDistance" ) + || ( aPropName == "Graphic" ) ) ) { OSL_FAIL( "Unbekanntes Property" ); } @@ -929,15 +929,14 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 case SVX_NUM_CHAR_SPECIAL : // Bullet { - if ( aFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("starsymbol")) || - aFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("opensymbol")) ) + if ( aFontDesc.Name.equals("starsymbol") || aFontDesc.Name.equals("opensymbol") ) { - String sFontName = aFontDesc.Name; - String sNumStr = cBulletId; + rtl::OUString sFontName(aFontDesc.Name); + rtl::OUString sNumStr(cBulletId); rtl_TextEncoding eChrSet = aFontDesc.CharSet; lcl_SubstituteBullet(sNumStr,eChrSet,sFontName); aFontDesc.Name = sFontName; - cBulletId = sNumStr.GetChar( 0 ); + cBulletId = sNumStr[ 0 ]; aFontDesc.CharSet = eChrSet; } -- cgit