[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Mon Feb 4 17:30:24 PST 2013


 sc/source/ui/unoobj/scdetect.cxx |   47 ++++++++++++++++++---------------------
 sc/source/ui/unoobj/scdetect.hxx |   42 +++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 46 deletions(-)

New commits:
commit 3a959c78e996d5eb6125184dc76c33c8f2a25db3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Feb 4 20:30:21 2013 -0500

    More clean-ups with ScFilterDetect.
    
    Change-Id: I754958ebb889fc661108e26038491b23fd391c34

diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 45c4666..a871e51 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -807,7 +807,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
     {
         // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
         lDescriptor.realloc( nPropertyCount + 1 );
-        lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream"));
+        lDescriptor[nPropertyCount].Name = "InputStream";
         lDescriptor[nPropertyCount].Value <<= xStream;
         nPropertyCount++;
     }
@@ -816,7 +816,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
     {
         // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
         lDescriptor.realloc( nPropertyCount + 1 );
-        lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCBContent"));
+        lDescriptor[nPropertyCount].Name = "UCBContent";
         lDescriptor[nPropertyCount].Value <<= xContent;
         nPropertyCount++;
     }
@@ -826,7 +826,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
         if ( nIndexOfReadOnlyFlag == -1 )
         {
             lDescriptor.realloc( nPropertyCount + 1 );
-            lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+            lDescriptor[nPropertyCount].Name = "ReadOnly";
             lDescriptor[nPropertyCount].Value <<= bReadOnly;
             nPropertyCount++;
         }
@@ -837,7 +837,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
     if ( !bRepairPackage && bRepairAllowed )
     {
         lDescriptor.realloc( nPropertyCount + 1 );
-        lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage"));
+        lDescriptor[nPropertyCount].Name = "RepairPackage";
         lDescriptor[nPropertyCount].Value <<= bRepairAllowed;
         nPropertyCount++;
 
@@ -851,7 +851,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
         if ( nIndexOfTemplateFlag == -1 )
         {
             lDescriptor.realloc( nPropertyCount + 1 );
-            lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
+            lDescriptor[nPropertyCount].Name = "AsTemplate";
             lDescriptor[nPropertyCount].Value <<= bOpenAsTemplate;
             nPropertyCount++;
         }
@@ -865,7 +865,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
         if ( nIndexOfDocumentTitle == -1 )
         {
             lDescriptor.realloc( nPropertyCount + 1 );
-            lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle"));
+            lDescriptor[nPropertyCount].Name = "DocumentTitle";
             lDescriptor[nPropertyCount].Value <<= aDocumentTitle;
             nPropertyCount++;
         }
@@ -878,7 +878,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
         if ( nIndexOfFilterName == -1 )
         {
             lDescriptor.realloc( nPropertyCount + 1 );
-            lDescriptor[nPropertyCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName"));
+            lDescriptor[nPropertyCount].Name = "FilterName";
             lDescriptor[nPropertyCount].Value <<= rtl::OUString(pFilter->GetName());
             nPropertyCount++;
         }
@@ -893,17 +893,16 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
     return aTypeName;
 }
 
-/* XServiceInfo */
-rtl::OUString SAL_CALL ScFilterDetect::getImplementationName() throw( UNORUNTIMEEXCEPTION )
+OUString SAL_CALL ScFilterDetect::getImplementationName() throw (uno::RuntimeException)
 {
     return impl_getStaticImplementationName();
 }
-                                                                                                                                \
-/* XServiceInfo */
-sal_Bool SAL_CALL ScFilterDetect::supportsService( const rtl::OUString& sServiceName ) throw( UNORUNTIMEEXCEPTION )
+
+sal_Bool ScFilterDetect::supportsService( const OUString& sServiceName )
+    throw (uno::RuntimeException)
 {
-    UNOSEQUENCE< rtl::OUString > seqServiceNames(getSupportedServiceNames());
-    const rtl::OUString*         pArray          = seqServiceNames.getConstArray();
+    uno::Sequence<OUString> seqServiceNames(getSupportedServiceNames());
+    const OUString* pArray = seqServiceNames.getConstArray();
     for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
     {
         if ( pArray[nCounter] == sServiceName )
@@ -914,28 +913,26 @@ sal_Bool SAL_CALL ScFilterDetect::supportsService( const rtl::OUString& sService
     return false ;
 }
 
-/* XServiceInfo */
-UNOSEQUENCE< rtl::OUString > SAL_CALL ScFilterDetect::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION )
+com::sun::star::uno::Sequence<OUString> ScFilterDetect::getSupportedServiceNames()
+    throw (uno::RuntimeException)
 {
     return impl_getStaticSupportedServiceNames();
 }
 
-/* Helper for XServiceInfo */
-UNOSEQUENCE< rtl::OUString > ScFilterDetect::impl_getStaticSupportedServiceNames()
+uno::Sequence<OUString> ScFilterDetect::impl_getStaticSupportedServiceNames()
 {
-    UNOSEQUENCE< rtl::OUString > seqServiceNames( 1 );
-    seqServiceNames.getArray() [0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ExtendedTypeDetection"  ));
-    return seqServiceNames ;
+    uno::Sequence<OUString> seqServiceNames(1);
+    seqServiceNames.getArray()[0] = "com.sun.star.frame.ExtendedTypeDetection";
+    return seqServiceNames;
 }
 
-/* Helper for XServiceInfo */
 OUString ScFilterDetect::impl_getStaticImplementationName()
 {
-    return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.calc.FormatDetector" ));
+    return OUString("com.sun.star.comp.calc.FormatDetector");
 }
 
-/* Helper for registry */
-UNOREFERENCE< UNOXINTERFACE > SAL_CALL ScFilterDetect::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION )
+uno::Reference<uno::XInterface> ScFilterDetect::impl_createInstance(
+    const uno::Reference<lang::XMultiServiceFactory>& xServiceManager ) throw (uno::Exception)
 {
     return static_cast< cppu::OWeakObject * >(
         new ScFilterDetect( xServiceManager ) );
diff --git a/sc/source/ui/unoobj/scdetect.hxx b/sc/source/ui/unoobj/scdetect.hxx
index 4986885..8faeef7 100644
--- a/sc/source/ui/unoobj/scdetect.hxx
+++ b/sc/source/ui/unoobj/scdetect.hxx
@@ -20,7 +20,6 @@
 #ifndef _SC_TYPEDETECT_HXX
 #define _SC_TYPEDETECT_HXX
 
-#include <rtl/ustring.hxx>
 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/uno/Reference.h>
@@ -30,39 +29,40 @@
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <cppuhelper/factory.hxx>
 
-namespace com
-{
-    namespace sun
-    {
-        namespace star
-        {
-            namespace lang
-            {
-                class XMultiServiceFactory;
-            }
-            namespace beans
-            {
-                struct PropertyValue;
-            }
-        }
-    }
-}
-
+#include <rtl/ustring.hxx>
 #include <sfx2/sfxuno.hxx>
 
+namespace com { namespace sun { namespace star {
+    namespace lang { class XMultiServiceFactory; }
+    namespace beans { struct PropertyValue; }
+}}}
+
+
 class ScFilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
 {
 public:
     ScFilterDetect( const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xFactory );
     virtual ~ScFilterDetect();
 
-    SFX_DECL_XSERVICEINFO_NOFACTORY
+    /* XServiceInfo */
+    virtual OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
+    virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& sServiceName ) throw( com::sun::star::uno::RuntimeException );
+    virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException );
+
+    /* Helper for XServiceInfo */
+    static com::sun::star::uno::Sequence<OUString> impl_getStaticSupportedServiceNames();
+    static OUString impl_getStaticImplementationName();
+
+    /* Helper for registry */
+    static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+        impl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager )
+            throw (com::sun::star::uno::Exception);
 
     //----------------------------------------------------------------------------------
     // XExtendedFilterDetect
     //----------------------------------------------------------------------------------
     virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& lDescriptor )
-        throw(com::sun::star::uno::RuntimeException);
+        throw (com::sun::star::uno::RuntimeException);
 };
 
 #endif


More information about the Libreoffice-commits mailing list