[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Jul 2 12:42:45 PDT 2012


 writerfilter/source/filter/ImportFilter.cxx          |   15 +++++-------
 writerfilter/source/filter/RtfFilter.cxx             |    8 +++---
 writerfilter/source/filter/WriterFilterDetection.cxx |   23 +++++++------------
 3 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit dcc030cc8dd21e11da01ed50865da617b689a043
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jul 2 21:42:36 2012 +0200

    writerfilter/filter: kill remaining CONSTASCII madness
    
    Change-Id: I2f51f4709e8f92fd6779e8e59227e82ac335050b

diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index e6f0c26..4aa61ce 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -50,7 +50,7 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
     if( m_xSrcDoc.is() )
     {
         uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
-        uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.DocxExport" ))), uno::UNO_QUERY_THROW);
+        uno::Reference< uno::XInterface > xIfc( xMSF->createInstance("com.sun.star.comp.Writer.DocxExport"), uno::UNO_QUERY_THROW);
         if (!xIfc.is())
             return sal_False;
         uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW);
@@ -122,7 +122,7 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
         oox::StorageRef xVbaPrjStrg( new ::oox::ole::OleStorage( m_xContext, pVBAProjectStream->getDocumentStream(), false ) );
         if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
         {
-            ::oox::ole::VbaProject aVbaProject( m_xContext, xModel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Writer" ) ) );
+            ::oox::ole::VbaProject aVbaProject( m_xContext, xModel, "Writer" );
             uno::Reference< frame::XFrame > xFrame = aMediaDesc.getUnpackedValueOrDefault(  MediaDescriptor::PROP_FRAME(), uno::Reference< frame::XFrame > () );
 
             // if no XFrame try fallback to what we can glean from the Model
@@ -170,10 +170,9 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >&
 
    // Set some compatibility options that are valid for all the formats
    uno::Reference< lang::XMultiServiceFactory > xFactory( xDoc, uno::UNO_QUERY );
-   uno::Reference< beans::XPropertySet > xSettings( xFactory->createInstance(
-               rtl::OUString::createFromAscii( "com.sun.star.document.Settings" ) ), uno::UNO_QUERY );
+   uno::Reference< beans::XPropertySet > xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY );
 
-   xSettings->setPropertyValue( rtl::OUString::createFromAscii( "UnbreakableNumberings" ), uno::makeAny( sal_True ) );
+   xSettings->setPropertyValue( "UnbreakableNumberings", uno::makeAny( sal_True ) );
 }
 
 void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
@@ -206,7 +205,7 @@ void WriterFilter::initialize( const uno::Sequence< uno::Any >& aArguments ) thr
 
 OUString WriterFilter_getImplementationName () throw (uno::RuntimeException)
 {
-   return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WriterFilter" ) );
+   return OUString ( "com.sun.star.comp.Writer.WriterFilter" );
 }
 
 #define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
@@ -223,8 +222,8 @@ uno::Sequence< OUString > WriterFilter_getSupportedServiceNames(  ) throw (uno::
 {
    uno::Sequence < OUString > aRet(2);
    OUString* pArray = aRet.getArray();
-   pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
-   pArray[1] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+   pArray[0] =  SERVICE_NAME1;
+   pArray[1] =  SERVICE_NAME2;
    return aRet;
 }
 #undef SERVICE_NAME1
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index fb0f9c0..28c3823 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -49,7 +49,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
     if( m_xSrcDoc.is() )
     {
         uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
-        uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfExport" ))), uno::UNO_QUERY_THROW);
+        uno::Reference< uno::XInterface > xIfc( xMSF->createInstance("com.sun.star.comp.Writer.RtfExport"), uno::UNO_QUERY_THROW);
         if (!xIfc.is())
             return sal_False;
         uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW);
@@ -151,15 +151,15 @@ uno::Sequence< OUString > RtfFilter::getSupportedServiceNames(  ) throw (uno::Ru
 
 OUString RtfFilter_getImplementationName () throw (uno::RuntimeException)
 {
-   return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfFilter" ) );
+   return OUString ( "com.sun.star.comp.Writer.RtfFilter" );
 }
 
 uno::Sequence< OUString > RtfFilter_getSupportedServiceNames(  ) throw (uno::RuntimeException)
 {
    uno::Sequence < OUString > aRet(2);
    OUString* pArray = aRet.getArray();
-   pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
-   pArray[1] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+   pArray[0] =  SERVICE_NAME1;
+   pArray[1] =  SERVICE_NAME2;
    return aRet;
 }
 #undef SERVICE_NAME1
diff --git a/writerfilter/source/filter/WriterFilterDetection.cxx b/writerfilter/source/filter/WriterFilterDetection.cxx
index 1242a68..926c7c0 100644
--- a/writerfilter/source/filter/WriterFilterDetection.cxx
+++ b/writerfilter/source/filter/WriterFilterDetection.cxx
@@ -57,7 +57,7 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
     bool bWord = false;
     sal_Int32 nPropertyCount = rDescriptor.getLength();
     const beans::PropertyValue* pValues = rDescriptor.getConstArray();
-    rtl::OUString sURL;
+    OUString sURL;
     uno::Reference < io::XStream > xStream;
     uno::Reference < io::XInputStream > xInputStream;
     for( sal_Int32 nProperty = 0; nProperty < nPropertyCount; ++nProperty )
@@ -71,8 +71,8 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
         else if ( pValues[nProperty].Name == "InputStream" )
             pValues[nProperty].Value >>= xInputStream;
     }
-    bool bBinary = sTypeName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "writer_MS_Word_97" )) ||
-                   sTypeName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "writer_MS_Word_97_Vorlage" ));
+    bool bBinary = sTypeName == "writer_MS_Word_97" ||
+                   sTypeName == "writer_MS_Word_97_Vorlage";
 
     try
     {
@@ -84,12 +84,8 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
             {
                 SotStorageRef xStg = new SotStorage( pStream, sal_False );
 
-                bool bTable2 = xStg->IsContained( rtl::OUString("1Table"));
-                SotStorageStreamRef xRef =
-
-                    xStg->OpenSotStream(rtl::OUString("WordDocument"),
-
-                            STREAM_STD_READ | STREAM_NOCREATE );
+                bool bTable2 = xStg->IsContained(OUString("1Table"));
+                SotStorageStreamRef xRef = xStg->OpenSotStream(OUString("WordDocument"), STREAM_STD_READ | STREAM_NOCREATE );
 
                 if(bTable2 && xStg.Is())
                 {
@@ -111,16 +107,15 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
                                             sURL, embed::ElementModes::READ );
             if( xDocStorage.is() )
             {
-                uno::Sequence< ::rtl::OUString > aNames = xDocStorage->getElementNames();
-                const ::rtl::OUString* pNames = aNames.getConstArray();
+                uno::Sequence< OUString > aNames = xDocStorage->getElementNames();
+                const OUString* pNames = aNames.getConstArray();
                 for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
                 {
                     if ( pNames[nName] == "word" )
                     {
                         bWord = true;
                         if( sTypeName.isEmpty() )
-                            sTypeName = ::rtl::OUString(
-                                    RTL_CONSTASCII_STRINGPARAM( "writer_MS_Word_2007" ), RTL_TEXTENCODING_ASCII_US);
+                            sTypeName = "writer_MS_Word_2007";
                         break;
                     }
                 }
@@ -132,7 +127,7 @@ OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& r
         OSL_FAIL("exception while opening storage");
     }
     if( !bWord )
-        sTypeName = ::rtl::OUString();
+        sTypeName = OUString();
    return sTypeName;
 }
 


More information about the Libreoffice-commits mailing list