include/sfx2/docfac.hxx    |    6 +++---
 sfx2/source/doc/docfac.cxx |   16 ++++++----------
 2 files changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 2cdca5d32e0b2d1efb9241e4e03e15b20f28363b
Author: Matteo Casalin <matteo.casa...@yahoo.com>
Date:   Fri Mar 17 15:13:41 2017 +0100

    SfxObjectFactory: directly store factory name as OUString
    
    Change-Id: I0779be1e4b344124514115c6645394d26ac09c36
    Reviewed-on: https://gerrit.libreoffice.org/35375
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com>

diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx
index 2658eaa07e6c..f1b73f424281 100644
--- a/include/sfx2/docfac.hxx
+++ b/include/sfx2/docfac.hxx
@@ -43,18 +43,18 @@ typedef void (*SfxVoidFunc)();
 class SFX2_DLLPUBLIC SfxObjectFactory
 {
 private:
-    const char*             pShortName;
+    const OUString          m_sFactoryName;
     std::unique_ptr<SfxObjectFactory_Impl> pImpl;      // Additional Data
     SfxObjectShellFlags     nFlags;
 
 public:
-    SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, 
const char* pShortName );
+    SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, 
const OUString& sFactoryName );
     ~SfxObjectFactory();
 
     const SvGlobalName& GetClassId() const;
     SfxObjectShellFlags GetFlags() { return nFlags; }
     OUString        GetFactoryURL() const;  // shortcut for 
"private:factory/GetShortName()"
-    OUString        GetFactoryName() const { return 
OUString::createFromAscii(pShortName); }
+    OUString        GetFactoryName() const { return m_sFactoryName; }
     OUString        GetModuleName() const;
     SfxFilterContainer *GetFilterContainer() const;
 
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index 20ebfbcfc0fa..cfe4e5fdac7b 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -85,15 +85,14 @@ SfxObjectFactory::SfxObjectFactory
 (
     const SvGlobalName&     rName,
     SfxObjectShellFlags     nFlagsP,
-    const char*             pName
-) :    pShortName( pName ),
+    const OUString&         sName
+) :    m_sFactoryName( sName ),
        pImpl( new SfxObjectFactory_Impl ),
        nFlags( nFlagsP )
 {
-    pImpl->pFilterContainer = new SfxFilterContainer( 
OUString::createFromAscii( pName ) );
+    pImpl->pFilterContainer = new SfxFilterContainer( m_sFactoryName );
 
-    OUString aShortName( OUString::createFromAscii( pShortName ) );
-    aShortName = aShortName.toAsciiLowerCase();
+    const OUString aShortName( m_sFactoryName.toAsciiLowerCase() );
     pImpl->aClassName = rName;
     if ( aShortName == "swriter" )
         pImpl->pNameResId = new SfxResId( STR_DOCTYPENAME_SW );
@@ -307,7 +306,7 @@ OUString SfxObjectFactory::GetStandardTemplate( const 
OUString& rServiceName )
 std::shared_ptr<const SfxFilter> SfxObjectFactory::GetTemplateFilter() const
 {
     sal_uInt16 nVersion=0;
-    SfxFilterMatcher aMatcher ( OUString::createFromAscii( pShortName ) );
+    SfxFilterMatcher aMatcher ( m_sFactoryName );
     SfxFilterMatcherIter aIter( aMatcher );
     std::shared_ptr<const SfxFilter> pFilter;
     std::shared_ptr<const SfxFilter> pTemp = aIter.First();
@@ -342,10 +341,7 @@ const SvGlobalName& SfxObjectFactory::GetClassId() const
 
 OUString SfxObjectFactory::GetFactoryURL() const
 {
-    OUStringBuffer aURLComposer;
-    aURLComposer.append("private:factory/");
-    aURLComposer.appendAscii(pShortName);
-    return aURLComposer.makeStringAndClear();
+    return "private:factory/" + m_sFactoryName;
 }
 
 OUString SfxObjectFactory::GetModuleName() const
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to