[Libreoffice-commits] core.git: 2 commits - include/basegfx sc/source sc/workben stoc/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Feb 16 15:00:30 PST 2015


 include/basegfx/color/bcolormodifier.hxx |   15 +++++++--------
 include/basegfx/tools/unopolypolygon.hxx |    6 +++---
 sc/source/ui/unoobj/afmtuno.cxx          |    3 +--
 sc/source/ui/unoobj/appluno.cxx          |    9 +++------
 sc/source/ui/unoobj/funcuno.cxx          |    3 +--
 sc/workben/addin.cxx                     |    3 +--
 stoc/source/typeconv/convert.cxx         |    3 +--
 sw/source/uibase/uno/unoatxt.cxx         |    3 +--
 sw/source/uibase/uno/unomod.cxx          |    3 +--
 9 files changed, 19 insertions(+), 29 deletions(-)

New commits:
commit 52b25c1adf3a70819aea2080b0ad50a14a3c104b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 16 20:47:23 2015 +0000

    we shouldn't need a static ref in these createOneInstance factory helpers
    
    at least not to ensure that they are singletons anyway
    
    Change-Id: I08176afa67ac5f8e4f479b70ca5d71c52d0bb9af

diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 7dc224f..d518965 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -178,8 +178,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScAutoFormatsObj_CreateInstance(
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    static uno::Reference< uno::XInterface > xInst((::cppu::OWeakObject*) new ScAutoFormatsObj);
-    return xInst;
+    return (::cppu::OWeakObject*) new ScAutoFormatsObj;
 }
 
 OUString ScAutoFormatsObj::getImplementationName_Static()
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index d814831..51a9591 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -314,8 +314,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScSpreadsheetSettings_CreateInstance(
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScSpreadsheetSettings());
-    return xInst;
+    return (cppu::OWeakObject*)new ScSpreadsheetSettings();
 }
 
 OUString ScSpreadsheetSettings::getImplementationName_Static()
@@ -602,8 +601,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScRecentFunctionsObj_CreateInstance(
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScRecentFunctionsObj());
-    return xInst;
+    return (cppu::OWeakObject*)new ScRecentFunctionsObj();
 }
 
 OUString ScRecentFunctionsObj::getImplementationName_Static()
@@ -679,8 +677,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScFunctionListObj_CreateInstance(
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScFunctionListObj());
-    return xInst;
+    return (cppu::OWeakObject*)new ScFunctionListObj();
 }
 
 OUString ScFunctionListObj::getImplementationName_Static()
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index aa13e66..6f3b11d 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -205,8 +205,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScFunctionAccess_CreateInstance(
 {
     SolarMutexGuard aGuard;
     ScDLL::Init();
-    static uno::Reference< uno::XInterface > xInst((::cppu::OWeakObject*) new ScFunctionAccess);
-    return xInst;
+    return (::cppu::OWeakObject*) new ScFunctionAccess;
 }
 
 OUString ScFunctionAccess::getImplementationName_Static()
diff --git a/sc/workben/addin.cxx b/sc/workben/addin.cxx
index f5784c5..60089b3 100644
--- a/sc/workben/addin.cxx
+++ b/sc/workben/addin.cxx
@@ -120,8 +120,7 @@ UString ScTestAddIn::getImplementationName_Static()
 uno::Reference<uno::XInterface> ScTestAddIn_CreateInstance(
         const uno::Reference<lang::XMultiServiceFactory>& )
 {
-    static uno::Reference<uno::XInterface> xInst = (cppu::OWeakObject*)new ScTestAddIn();
-    return xInst;
+    return (cppu::OWeakObject*)new ScTestAddIn();
 }
 
 // XAddIn
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index e737f87..544243b 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -917,8 +917,7 @@ Reference< XInterface > SAL_CALL TypeConverter_Impl_CreateInstance(
     SAL_UNUSED_PARAMETER const Reference< XComponentContext > & )
     throw( RuntimeException )
 {
-    static Reference< XInterface > s_ref( (OWeakObject *) new stoc_tcv::TypeConverter_Impl() );
-    return s_ref;
+    return (OWeakObject *) new stoc_tcv::TypeConverter_Impl();
 }
 }
 
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 9b237ff..003e89d 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -65,8 +65,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXAutoTextContainer_createInstance(
     //the module may not be loaded
     SolarMutexGuard aGuard;
     SwGlobals::ensure();
-    static uno::Reference< uno::XInterface > xAText = (cppu::OWeakObject*)new SwXAutoTextContainer();
-    return xAText;
+    return (cppu::OWeakObject*)new SwXAutoTextContainer();
 }
 
 uno::Sequence< OUString > SAL_CALL SwXAutoTextContainer_getSupportedServiceNames() throw()
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index f1b4fb3..653cc8c 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -195,8 +195,7 @@ static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
 Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(
     const Reference< XMultiServiceFactory > & /*rSMgr*/) throw( Exception )
 {
-    static Reference< uno::XInterface >  xModule = (cppu::OWeakObject*)new SwXModule();
-    return xModule;
+    return (cppu::OWeakObject*)new SwXModule();
 }
 
 Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw()
commit 0ae82ba5d2b0ab81cac27efbb0226ed0f15d3b96
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 16 20:43:04 2015 +0000

    cut down some more unnecessary boost inclusion
    
    Change-Id: Ia997e243d28a54d2e3cc9714fe3e7e86d198797c

diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx
index 33287ce..b6278e0 100644
--- a/include/basegfx/color/bcolormodifier.hxx
+++ b/include/basegfx/color/bcolormodifier.hxx
@@ -25,12 +25,9 @@
 
 #include <osl/diagnose.h>
 
-#include <boost/shared_ptr.hpp>
-#include <boost/utility.hpp>
+#include <memory>
 #include <vector>
 
-
-
 namespace basegfx
 {
     /** base class to define color modifications
@@ -55,13 +52,15 @@ namespace basegfx
         operator); local values cannot be changed after construction. The
         instances are cheap and the idea is to create them on demand. To
         be able to reuse these as much as possible, a define for a
-        ::boost::shared_ptr named BColorModifierSharedPtr exists below.
+        std::shared_ptr named BColorModifierSharedPtr exists below.
         All usages should handle instances of BColorModifier encapsulated
         into these shared pointers.
     */
-    class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColorModifier : private boost::noncopyable
+    class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColorModifier
     {
     private:
+        BColorModifier(const BColorModifier&) SAL_DELETED_FUNCTION;
+        BColorModifier& operator=(const BColorModifier&) SAL_DELETED_FUNCTION;
     protected:
         // no one is allowed to incarnate the abstract base class
         // except derivations
@@ -69,7 +68,7 @@ namespace basegfx
 
     public:
         // no one should directly destroy it; all incarnations should be
-        // handled in a boost::shared_ptr of type BColorModifierSharedPtr
+        // handled in a std::shared_ptr of type BColorModifierSharedPtr
         virtual ~BColorModifier();
 
         // compare operator
@@ -374,7 +373,7 @@ namespace basegfx
 {
     /// typedef to allow working with shared instances of BColorModifier
     /// for the whole mechanism
-    typedef ::boost::shared_ptr< BColorModifier > BColorModifierSharedPtr;
+    typedef std::shared_ptr< BColorModifier > BColorModifierSharedPtr;
 
     /** Class to hold a stack of BColorModifierSharedPtrs and to get the modified color with
         applying all existing entry changes as defined in the stack. Instances of BColorModifier
diff --git a/include/basegfx/tools/unopolypolygon.hxx b/include/basegfx/tools/unopolypolygon.hxx
index 7aada89..3baca23 100644
--- a/include/basegfx/tools/unopolypolygon.hxx
+++ b/include/basegfx/tools/unopolypolygon.hxx
@@ -28,8 +28,6 @@
 #include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <basegfx/basegfxdllapi.h>
-#include <boost/utility.hpp>
-
 
 namespace basegfx
 {
@@ -42,7 +40,6 @@ namespace unotools
 
     class BASEGFX_DLLPUBLIC UnoPolyPolygon
         : private cppu::BaseMutex
-        , private boost::noncopyable
         , public UnoPolyPolygonBase
     {
     public:
@@ -99,6 +96,9 @@ namespace unotools
         virtual void modifying() const {}
 
     private:
+        UnoPolyPolygon(const UnoPolyPolygon&) SAL_DELETED_FUNCTION;
+        UnoPolyPolygon& operator=(const UnoPolyPolygon&) SAL_DELETED_FUNCTION;
+
         B2DPolyPolygon                        maPolyPoly;
         ::com::sun::star::rendering::FillRule meFillRule;
     };


More information about the Libreoffice-commits mailing list