[Libreoffice-commits] core.git: 2 commits - sc/source sd/source sfx2/source svl/source svx/source sw/source ucbhelper/source ucb/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Jun 6 18:58:32 UTC 2017


 sc/source/ui/cctrl/tbzoomsliderctrl.cxx                     |    2 
 sd/source/ui/app/tmplctrl.cxx                               |    2 
 sfx2/source/control/ctrlitem.cxx                            |    2 
 sfx2/source/control/dispatch.cxx                            |    4 
 sfx2/source/control/unoctitm.cxx                            |    6 
 sfx2/source/doc/objxtor.cxx                                 |    2 
 sfx2/source/statbar/stbitem.cxx                             |    2 
 sfx2/source/toolbox/tbxitem.cxx                             |    2 
 svl/source/items/itemset.cxx                                |    2 
 svx/source/stbctrls/zoomsliderctrl.cxx                      |    2 
 svx/source/svdraw/svdibrow.cxx                              |    2 
 sw/source/uibase/docvw/romenu.cxx                           |    2 
 sw/source/uibase/utlui/bookctrl.cxx                         |    2 
 sw/source/uibase/utlui/viewlayoutctrl.cxx                   |    2 
 ucb/source/core/provprox.cxx                                |    4 
 ucb/source/ucp/cmis/cmis_content.cxx                        |    8 
 ucb/source/ucp/cmis/cmis_repo_content.cxx                   |    4 
 ucb/source/ucp/file/filid.cxx                               |   13 -
 ucb/source/ucp/ftp/ftpcontent.cxx                           |   14 -
 ucb/source/ucp/ftp/ftpcontentidentifier.cxx                 |   13 -
 ucb/source/ucp/ftp/ftpcontentprovider.cxx                   |   14 -
 ucb/source/ucp/gio/gio_content.cxx                          |    9 -
 ucb/source/ucp/hierarchy/hierarchycontent.cxx               |   52 ------
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx            |   49 -----
 ucb/source/ucp/package/pkgcontent.cxx                       |   52 ------
 ucb/source/ucp/tdoc/tdoc_content.cxx                        |   51 ------
 ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx                |   14 -
 ucb/source/ucp/webdav-neon/webdavcontent.cxx                |   51 ------
 ucb/source/ucp/webdav/webdavcontent.cxx                     |   51 ------
 ucbhelper/source/provider/contentidentifier.cxx             |   15 -
 ucbhelper/source/provider/interactionrequest.cxx            |   99 ++----------
 ucbhelper/source/provider/simplenameclashresolverequest.cxx |   14 -
 32 files changed, 115 insertions(+), 446 deletions(-)

New commits:
commit cbcaff7510d557d345c15db97f52633c81939d41
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Jun 6 11:02:09 2017 +0200

    ucb: replace double checked locking patterns
    
    with thread safe local statics
    and prefix statics
    
    Change-Id: Iaa7c9056847f75612d6cf6c6e44d3896fca734de
    Reviewed-on: https://gerrit.libreoffice.org/38433
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx
index 1266576b17b3..271269a35feb 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -158,13 +158,13 @@ Sequence< Type > SAL_CALL UcbContentProviderProxy::getTypes()
     }
     else
     {
-        static cppu::OTypeCollection collection(
+        static cppu::OTypeCollection s_aCollection(
             CPPU_TYPE_REF( XTypeProvider ),
             CPPU_TYPE_REF( XServiceInfo ),
             CPPU_TYPE_REF( XContentProvider ),
             CPPU_TYPE_REF( XParameterizedContentProvider ),
             CPPU_TYPE_REF( XContentProviderSupplier ) );
-        return collection.getTypes();
+        return s_aCollection.getTypes();
     }
 }
 
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index def0db069191..4a8e75c65837 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1946,7 +1946,7 @@ namespace cmis
         {
             if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) )
             {
-                static cppu::OTypeCollection aFolderCollection
+                static cppu::OTypeCollection s_aFolderCollection
                     (CPPU_TYPE_REF( lang::XTypeProvider ),
                      CPPU_TYPE_REF( lang::XServiceInfo ),
                      CPPU_TYPE_REF( lang::XComponent ),
@@ -1958,7 +1958,7 @@ namespace cmis
                      CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                      CPPU_TYPE_REF( container::XChild ),
                      CPPU_TYPE_REF( ucb::XContentCreator ) );
-                return aFolderCollection.getTypes();
+                return s_aFolderCollection.getTypes();
             }
         }
         catch (const uno::RuntimeException&)
@@ -1973,7 +1973,7 @@ namespace cmis
                 uno::Reference<uno::XInterface>(), a);
         }
 
-        static cppu::OTypeCollection aFileCollection
+        static cppu::OTypeCollection s_aFileCollection
             (CPPU_TYPE_REF( lang::XTypeProvider ),
              CPPU_TYPE_REF( lang::XServiceInfo ),
              CPPU_TYPE_REF( lang::XComponent ),
@@ -1985,7 +1985,7 @@ namespace cmis
              CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
              CPPU_TYPE_REF( container::XChild ) );
 
-        return aFileCollection.getTypes();
+        return s_aFileCollection.getTypes();
     }
 
     uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index 208271edf104..e1754666879d 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -384,7 +384,7 @@ namespace cmis
 
     uno::Sequence< uno::Type > SAL_CALL RepoContent::getTypes()
     {
-        static cppu::OTypeCollection aFolderCollection
+        static cppu::OTypeCollection s_aFolderCollection
             (CPPU_TYPE_REF( lang::XTypeProvider ),
              CPPU_TYPE_REF( lang::XServiceInfo ),
              CPPU_TYPE_REF( lang::XComponent ),
@@ -395,7 +395,7 @@ namespace cmis
              CPPU_TYPE_REF( beans::XPropertyContainer ),
              CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
              CPPU_TYPE_REF( container::XChild ) );
-        return aFolderCollection.getTypes();
+        return s_aFolderCollection.getTypes();
     }
 
     list< uno::Reference< ucb::XContent > > RepoContent::getChildren( )
diff --git a/ucb/source/ucp/file/filid.cxx b/ucb/source/ucp/file/filid.cxx
index 220d19fbd1f2..9b5cb78d2809 100644
--- a/ucb/source/ucp/file/filid.cxx
+++ b/ucb/source/ucp/file/filid.cxx
@@ -86,18 +86,11 @@ FileContentIdentifier::getImplementationId()
 uno::Sequence< uno::Type > SAL_CALL
 FileContentIdentifier::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-    if ( !pCollection ) {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<XContentIdentifier>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 89c779b58285..287d7eb88bc4 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -152,13 +152,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL FTPContent::getImplementationId()
 
 css::uno::Sequence< css::uno::Type > SAL_CALL FTPContent::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-    if ( !pCollection )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                     cppu::UnoType<XTypeProvider>::get(),
                     cppu::UnoType<XServiceInfo>::get(),
                     cppu::UnoType<XContent>::get(),
@@ -166,10 +160,8 @@ css::uno::Sequence< css::uno::Type > SAL_CALL FTPContent::getTypes()
                     cppu::UnoType<XContentCreator>::get(),
                     cppu::UnoType<XChild>::get()
                 );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
index 683422366703..f60f800759e9 100644
--- a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx
@@ -79,18 +79,11 @@ FTPContentIdentifier::getImplementationId()
 Sequence<Type> SAL_CALL
 FTPContentIdentifier::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-    if ( !pCollection ) {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<XTypeProvider>::get(),
                 cppu::UnoType<XContentIdentifier>::get());
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index af214d9ea3a8..4630e22653a5 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -82,21 +82,13 @@ css::uno::Sequence< sal_Int8 > SAL_CALL FTPContentProvider::getImplementationId(
 
 css::uno::Sequence< css::uno::Type > SAL_CALL FTPContentProvider::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-    if ( !pCollection )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                     cppu::UnoType<XTypeProvider>::get(),
                     cppu::UnoType<XServiceInfo>::get(),
                     cppu::UnoType<XContentProvider>::get()
                 );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 1e7a4d55775b..c1bb36ff71c4 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -23,7 +23,6 @@
 #include <sal/macros.h>
 #include <osl/time.h>
 
-#include <osl/doublecheckedlocking.h>
 #include <com/sun/star/beans/IllegalTypeException.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1176,7 +1175,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
 {
     if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) )
     {
-        static cppu::OTypeCollection aFolderCollection
+        static cppu::OTypeCollection s_aFolderCollection
             (CPPU_TYPE_REF( lang::XTypeProvider ),
              CPPU_TYPE_REF( lang::XServiceInfo ),
              CPPU_TYPE_REF( lang::XComponent ),
@@ -1188,11 +1187,11 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
              CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
              CPPU_TYPE_REF( container::XChild ),
              CPPU_TYPE_REF( ucb::XContentCreator ) );
-        return aFolderCollection.getTypes();
+        return s_aFolderCollection.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection aFileCollection
+        static cppu::OTypeCollection s_aFileCollection
             (CPPU_TYPE_REF( lang::XTypeProvider ),
              CPPU_TYPE_REF( lang::XServiceInfo ),
              CPPU_TYPE_REF( lang::XComponent ),
@@ -1204,7 +1203,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
              CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
              CPPU_TYPE_REF( container::XChild ) );
 
-        return aFileCollection.getTypes();
+        return s_aFileCollection.getTypes();
     }
 }
 
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index 8ff414b5816e..fe1750221fee 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -37,7 +37,6 @@
  *************************************************************************/
 #include <osl/diagnose.h>
 
-#include "osl/doublecheckedlocking.h"
 #include <rtl/ustring.h>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/beans/IllegalTypeException.hpp>
@@ -201,21 +200,9 @@ XTYPEPROVIDER_COMMON_IMPL( HierarchyContent );
 // virtual
 uno::Sequence< uno::Type > SAL_CALL HierarchyContent::getTypes()
 {
-    cppu::OTypeCollection * pCollection = nullptr;
-
     if ( isFolder() && !isReadOnly() )
     {
-        static cppu::OTypeCollection* pFolderTypes = nullptr;
-
-        pCollection = pFolderTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pFolderTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aFolderTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -226,29 +213,14 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyContent::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ),
-                    CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pFolderTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+                    CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+
+        return s_aFolderTypes.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
-        pCollection = pDocumentTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pDocumentTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aDocumentTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -259,17 +231,9 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyContent::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pDocumentTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return s_aDocumentTypes.getTypes();
+    }
 }
 
 
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index c632656f86c0..63f6a21bf9b0 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -29,7 +29,6 @@
 #include "hierarchydatasource.hxx"
 #include <osl/diagnose.h>
 
-#include "osl/doublecheckedlocking.h"
 #include <comphelper/processfactory.hxx>
 #include <comphelper/interfacecontainer2.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
@@ -607,49 +606,21 @@ XTYPEPROVIDER_COMMON_IMPL( HierarchyDataAccess );
 // virtual
 uno::Sequence< uno::Type > SAL_CALL HierarchyDataAccess::getTypes()
 {
-    cppu::OTypeCollection * pCollection = nullptr;
-
     if ( m_bReadOnly )
     {
-        static cppu::OTypeCollection* pReadOnlyTypes = nullptr;
-
-        pCollection = pReadOnlyTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pReadOnlyTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aReadOnlyTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
                     CPPU_TYPE_REF( container::XHierarchicalNameAccess ),
                     CPPU_TYPE_REF( container::XNameAccess ),
                     CPPU_TYPE_REF( util::XChangesNotifier ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pReadOnlyTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+
+        return s_aReadOnlyTypes.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection* pReadWriteTypes = nullptr;
-
-        pCollection = pReadWriteTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pReadWriteTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aReadWriteTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -658,17 +629,9 @@ uno::Sequence< uno::Type > SAL_CALL HierarchyDataAccess::getTypes()
                     CPPU_TYPE_REF( container::XNameContainer ),
                     CPPU_TYPE_REF( util::XChangesBatch ),
                     CPPU_TYPE_REF( util::XChangesNotifier ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pReadWriteTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return s_aReadWriteTypes.getTypes();
+    }
 }
 
 
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index 72d0ec5acb99..7550d7eef252 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -24,7 +24,6 @@
  *************************************************************************/
 #include <osl/diagnose.h>
 
-#include "osl/doublecheckedlocking.h"
 #include <rtl/ustring.h>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/beans/IllegalTypeException.hpp>
@@ -317,21 +316,9 @@ XTYPEPROVIDER_COMMON_IMPL( Content );
 // virtual
 uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
 {
-    cppu::OTypeCollection * pCollection = nullptr;
-
     if ( isFolder() )
     {
-        static cppu::OTypeCollection* pFolderTypes = nullptr;
-
-        pCollection = pFolderTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pFolderTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aFolderTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -342,29 +329,14 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ),
-                    CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pFolderTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+                    CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+        return s_aFolderTypes.getTypes();
+
     }
     else
     {
-        static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
-        pCollection = pDocumentTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pDocumentTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aDocumentTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -375,17 +347,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pDocumentTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return s_aDocumentTypes.getTypes();
+    }
 }
 
 
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index 60bfdc12db2f..ec53ad152588 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -25,7 +25,6 @@
  *************************************************************************/
 
 #include "osl/diagnose.h"
-#include "osl/doublecheckedlocking.h"
 #include "rtl/ustrbuf.hxx"
 #include "com/sun/star/beans/IllegalTypeException.hpp"
 #include "com/sun/star/beans/PropertyAttribute.hpp"
@@ -216,21 +215,9 @@ XTYPEPROVIDER_COMMON_IMPL( Content );
 // virtual
 uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
 {
-    cppu::OTypeCollection * pCollection = nullptr;
-
     if ( m_aProps.isContentCreator() )
     {
-        static cppu::OTypeCollection* pFolderTypes = nullptr;
-
-        pCollection = pFolderTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pFolderTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aFolderTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -241,29 +228,13 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ),
-                    CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pFolderTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+                    CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+        return s_aFolderTypes.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
-        pCollection = pDocumentTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pDocumentTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aDocumentTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                     CPPU_TYPE_REF( lang::XServiceInfo ),
                     CPPU_TYPE_REF( lang::XComponent ),
@@ -274,17 +245,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                     CPPU_TYPE_REF( beans::XPropertyContainer ),
                     CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                     CPPU_TYPE_REF( container::XChild ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pDocumentTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return s_aDocumentTypes.getTypes();
+    }
 }
 
 
diff --git a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
index 439f60df4b34..d3690722c641 100644
--- a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx
@@ -118,19 +118,11 @@ InteractionSupplyPassword::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionSupplyPassword::getTypes()
 {
-    static cppu::OTypeCollection * pCollection = nullptr;
-    if ( !pCollection )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionPassword>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 29b026db5165..d8679c095364 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -36,7 +36,6 @@
 #include <memory>
 #include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
-#include <osl/doublecheckedlocking.h>
 #include <rtl/uri.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <officecfg/Inet.hxx>
@@ -369,21 +368,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
     {
     }
 
-    cppu::OTypeCollection * pCollection = nullptr;
-
     if ( bFolder )
     {
-        static cppu::OTypeCollection* pFolderTypes = nullptr;
-
-        pCollection = pFolderTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pFolderTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aFolderTypes(
                     CPPU_TYPE_REF( lang::XTypeProvider ),
                         CPPU_TYPE_REF( lang::XServiceInfo ),
                         CPPU_TYPE_REF( lang::XComponent ),
@@ -394,29 +381,13 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                         CPPU_TYPE_REF( beans::XPropertyContainer ),
                         CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                         CPPU_TYPE_REF( container::XChild ),
-                        CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pFolderTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+                        CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+        return s_aFolderTypes.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
-        pCollection = pDocumentTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pDocumentTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aDocumentTypes(
                         CPPU_TYPE_REF( lang::XTypeProvider ),
                         CPPU_TYPE_REF( lang::XServiceInfo ),
                         CPPU_TYPE_REF( lang::XComponent ),
@@ -427,17 +398,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                         CPPU_TYPE_REF( beans::XPropertyContainer ),
                         CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                         CPPU_TYPE_REF( container::XChild ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pDocumentTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return s_aDocumentTypes.getTypes();
+    }
 }
 
 
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 2fcbb2b200fb..b9d93fa9c907 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -19,7 +19,6 @@
 
 #include <memory>
 #include <osl/diagnose.h>
-#include <osl/doublecheckedlocking.h>
 #include <rtl/uri.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <ucbhelper/contentidentifier.hxx>
@@ -358,18 +357,8 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
 
     if ( bFolder )
     {
-        static cppu::OTypeCollection* pFolderTypes = nullptr;
-
-        pCollection = pFolderTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pFolderTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
-                    CPPU_TYPE_REF( lang::XTypeProvider ),
+        static cppu::OTypeCollection s_aFolderTypes(
+                        CPPU_TYPE_REF( lang::XTypeProvider ),
                         CPPU_TYPE_REF( lang::XServiceInfo ),
                         CPPU_TYPE_REF( lang::XComponent ),
                         CPPU_TYPE_REF( ucb::XContent ),
@@ -379,29 +368,13 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                         CPPU_TYPE_REF( beans::XPropertyContainer ),
                         CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                         CPPU_TYPE_REF( container::XChild ),
-                        CPPU_TYPE_REF( ucb::XContentCreator ) ); // !!
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pFolderTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
+                        CPPU_TYPE_REF( ucb::XContentCreator ) );
+
+        return s_aFolderTypes.getTypes();
     }
     else
     {
-        static cppu::OTypeCollection* pDocumentTypes = nullptr;
-
-        pCollection = pDocumentTypes;
-        if ( !pCollection )
-        {
-            osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-
-            pCollection = pDocumentTypes;
-            if ( !pCollection )
-            {
-                static cppu::OTypeCollection aCollection(
+        static cppu::OTypeCollection s_aDocumentTypes(
                         CPPU_TYPE_REF( lang::XTypeProvider ),
                         CPPU_TYPE_REF( lang::XServiceInfo ),
                         CPPU_TYPE_REF( lang::XComponent ),
@@ -412,17 +385,9 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
                         CPPU_TYPE_REF( beans::XPropertyContainer ),
                         CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
                         CPPU_TYPE_REF( container::XChild ) );
-                pCollection = &aCollection;
-                OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-                pDocumentTypes = pCollection;
-            }
-        }
-        else {
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-        }
-    }
 
-    return (*pCollection).getTypes();
+        return  s_aDocumentTypes.getTypes();
+    }
 }
 
 
diff --git a/ucbhelper/source/provider/contentidentifier.cxx b/ucbhelper/source/provider/contentidentifier.cxx
index 16a682682365..0026ca072c92 100644
--- a/ucbhelper/source/provider/contentidentifier.cxx
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -27,7 +27,6 @@
 #include <ucbhelper/contentidentifier.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/queryinterface.hxx>
-#include <osl/mutex.hxx>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -128,19 +127,11 @@ ContentIdentifier::getImplementationId()
 Sequence< css::uno::Type > SAL_CALL
 ContentIdentifier::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                     cppu::UnoType<XTypeProvider>::get(),
                     cppu::UnoType<XContentIdentifier>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx
index 5738187bdf0f..9f4119c8bdb7 100644
--- a/ucbhelper/source/provider/interactionrequest.cxx
+++ b/ucbhelper/source/provider/interactionrequest.cxx
@@ -25,7 +25,6 @@
  *************************************************************************/
 #include <ucbhelper/interactionrequest.hxx>
 
-#include <osl/mutex.hxx>
 #include <osl/diagnose.h>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/queryinterface.hxx>
@@ -146,19 +145,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionRequest::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionRequest::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionRequest>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -251,19 +242,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionAbort::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionAbort::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionAbort>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -326,19 +309,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionRetry::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionRetry::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionRetry>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -401,19 +376,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionApprove::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionApprove::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionApprove>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -476,19 +443,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionDisapprove::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionDisapprove::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<task::XInteractionDisapprove>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -553,19 +512,11 @@ InteractionSupplyAuthentication::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<ucb::XInteractionSupplyAuthentication2>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
@@ -771,19 +722,11 @@ InteractionReplaceExistingData::getImplementationId()
 // virtual
 uno::Sequence< uno::Type > SAL_CALL InteractionReplaceExistingData::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<ucb::XInteractionReplaceExistingData>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 
diff --git a/ucbhelper/source/provider/simplenameclashresolverequest.cxx b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
index cd94391ad8c5..668b512ab10d 100644
--- a/ucbhelper/source/provider/simplenameclashresolverequest.cxx
+++ b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
@@ -105,19 +105,11 @@ uno::Sequence< sal_Int8 > SAL_CALL InteractionSupplyName::getImplementationId()
 
 uno::Sequence< uno::Type > SAL_CALL InteractionSupplyName::getTypes()
 {
-    static cppu::OTypeCollection* pCollection = nullptr;
-      if ( !pCollection )
-      {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pCollection )
-        {
-            static cppu::OTypeCollection collection(
+    static cppu::OTypeCollection s_aCollection(
                 cppu::UnoType<lang::XTypeProvider>::get(),
                 cppu::UnoType<ucb::XInteractionSupplyName>::get() );
-            pCollection = &collection;
-        }
-    }
-    return (*pCollection).getTypes();
+
+    return s_aCollection.getTypes();
 }
 
 void SAL_CALL InteractionSupplyName::select()
commit ca8a4a7abc81a53a88fc0daa61447f9562f532f5
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jun 6 20:55:51 2017 +0200

    Eliminate dynamic_cast<const SfxVoidItem*>, use SfxPoolItem::IsVoidItem()
    
    Change-Id: I09dafffd64dd107e802d016494d884f32363521a

diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 7b99fd1459a9..357e6d25635f 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -62,7 +62,7 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState
     ScZoomSliderWnd*        pBox = static_cast<ScZoomSliderWnd*>(rTbx.GetItemWindow( nId ));
     OSL_ENSURE( pBox ,"Control not found!" );
 
-    if ( SfxItemState::DEFAULT != eState || dynamic_cast<const SfxVoidItem*>( pState) !=  nullptr )
+    if ( SfxItemState::DEFAULT != eState || pState->IsVoidItem() )
     {
         SvxZoomSliderItem aZoomSliderItem( 100 );
         pBox->Disable();
diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx
index 685d39d6d889..9203201f59f0 100644
--- a/sd/source/ui/app/tmplctrl.cxx
+++ b/sd/source/ui/app/tmplctrl.cxx
@@ -76,7 +76,7 @@ SdTemplateControl::~SdTemplateControl()
 void SdTemplateControl::StateChanged(
     sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if ( dynamic_cast< const SfxStringItem *>( pState ) !=  nullptr )
     {
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index bfcb183f8a83..cd22920f144e 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -293,7 +293,7 @@ SfxItemState SfxControllerItem::GetItemState
                 ? SfxItemState::DISABLED
                 : IsInvalidItem(pState)
                     ? SfxItemState::DONTCARE
-                    : dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr && !pState->Which()
+                    : pState->IsVoidItem() && !pState->Which()
                         ? SfxItemState::UNKNOWN
                         : SfxItemState::DEFAULT;
 }
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 9c4a0edcab0e..15b445663deb 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1882,7 +1882,7 @@ bool SfxDispatcher::FillState_(const SfxSlotServer& rSvr, SfxItemSet& rState,
                   pItem;
                   pItem = aIter.NextItem() )
             {
-                if ( !IsInvalidItem(pItem) && dynamic_cast< const SfxVoidItem *>( pItem ) ==  nullptr )
+                if ( !IsInvalidItem(pItem) && !pItem->IsVoidItem() )
                 {
                     sal_uInt16 nSlotId = rState.GetPool()->GetSlotId(pItem->Which());
                     SAL_INFO_IF(
@@ -2084,7 +2084,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, css::uno::Any& rAny )
         else
         {
             css::uno::Any aState;
-            if ( dynamic_cast< const SfxVoidItem *>( pItem ) ==  nullptr )
+            if ( !pItem->IsVoidItem() )
             {
                 sal_uInt16 nSubId( 0 );
                 SfxItemPool& rPool = pShell->GetPool();
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 895bacb5e19d..169c0344a216 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -746,7 +746,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                             {
                                 if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
                                     bSuccess = pBoolItem->GetValue();
-                                else if ( dynamic_cast< const SfxVoidItem *>( pItem ) ==  nullptr )
+                                else if ( !pItem->IsVoidItem() )
                                     bSuccess = true;  // all other types are true
                             }
                             // else bSuccess = false look to line 664 it is false
@@ -808,7 +808,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
                 aEvent.State = css::frame::DispatchResultState::FAILURE;
 
             aEvent.Source = static_cast<css::frame::XDispatch*>(pDispatch);
-            if ( bSuccess && pItem && dynamic_cast< const SfxVoidItem *>( pItem ) ==  nullptr )
+            if ( bSuccess && pItem && !pItem->IsVoidItem() )
             {
                 sal_uInt16 nSubId( 0 );
                 if ( eMapUnit == MapUnit::MapTwip )
@@ -924,7 +924,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
     if (bNotify)
     {
         css::uno::Any aState;
-        if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && dynamic_cast< const SfxVoidItem *>( pState ) ==  nullptr )
+        if ( ( eState >= SfxItemState::DEFAULT ) && pState && !IsInvalidItem( pState ) && !pState->IsVoidItem() )
         {
             // Retrieve metric from pool to have correct sub ID when calling QueryValue
             sal_uInt16     nSubId( 0 );
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index d17203cf5328..7b605d2684c0 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -610,7 +610,7 @@ bool SfxObjectShell::PrepareClose
                 pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs );
             }
 
-            if ( !pPoolItem || dynamic_cast< const SfxVoidItem *>( pPoolItem ) != nullptr || ( dynamic_cast< const SfxBoolItem *>( pPoolItem ) != nullptr && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) )
+            if ( !pPoolItem || pPoolItem->IsVoidItem() || ( dynamic_cast< const SfxBoolItem *>( pPoolItem ) != nullptr && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) )
                 return false;
         }
         else if ( RET_CANCEL == nRet )
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index 5d1cf9c460bd..12c977e8e5b0 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -410,7 +410,7 @@ void SfxStatusBarControl::StateChanged
         pBar->SetItemText( nSID, pStr->GetValue() );
     else
     {
-        DBG_ASSERT( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr,
+        DBG_ASSERT( eState != SfxItemState::DEFAULT || pState->IsVoidItem(),
                     "wrong SfxPoolItem subclass in SfxStatusBarControl" );
         pBar->SetItemText( nSID, OUString() );
     }
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 5aed453f2392..daa9787f620a 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -374,7 +374,7 @@ SfxItemState SfxToolBoxControl::GetItemState(
                 ? SfxItemState::DISABLED
                 : IsInvalidItem(pState)
                     ? SfxItemState::DONTCARE
-                    : dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr && !pState->Which()
+                    : pState->IsVoidItem() && !pState->Which()
                         ? SfxItemState::UNKNOWN
                         : SfxItemState::DEFAULT;
 }
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index ddd821d85218..0b46705239f0 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -917,7 +917,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
                         }
 #ifdef DBG_UTIL
                         const SfxPoolItem *pItem = *ppFnd;
-                        if ( dynamic_cast<const SfxVoidItem *>(pItem) != nullptr || !pItem->Which() )
+                        if ( pItem->IsVoidItem() || !pItem->Which() )
                             SAL_INFO("svl.items", "SFX_WARNING: Getting disabled Item");
 #endif
                         return **ppFnd;
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 3c871557c00c..be0b0721f260 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -168,7 +168,7 @@ SvxZoomSliderControl::~SvxZoomSliderControl()
 
 void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if ( (SfxItemState::DEFAULT != eState) || dynamic_cast<const SfxVoidItem*>( pState) !=  nullptr )
+    if ( (SfxItemState::DEFAULT != eState) || pState->IsVoidItem() )
     {
         GetStatusBar().SetItemText( GetId(), "" );
         mxImpl->mbValuesSet   = false;
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 77bf2c1a3243..a83797f3c11a 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -920,7 +920,7 @@ void SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItemS
             if (eState!=SfxItemState::DISABLED) {
                 const SfxPoolItem& rItem=pSet->Get(nWhich);
                 sal_uInt16 nIndent=0;
-                if (dynamic_cast<const SfxVoidItem *>(&rItem) == nullptr && dynamic_cast<const SfxSetItem *>(&rItem) == nullptr
+                if (!rItem.IsVoidItem() && dynamic_cast<const SfxSetItem *>(&rItem) == nullptr
                         && (!IsItemIneffective(nWhich,pSet,nIndent) || bDontHideIneffectiveItems)) {
                     OUString aCommentStr;
 
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index a06abe1b5a1f..64f90004230e 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -68,7 +68,7 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
         xMenu->EnableItem(nMID);
         if (_pItem)
         {
-            xMenu->CheckItem(nMID, dynamic_cast< const SfxVoidItem *>( _pItem.get() ) ==  nullptr &&
+            xMenu->CheckItem(nMID, !_pItem->IsVoidItem() &&
                             dynamic_cast< const SfxBoolItem *>( _pItem.get() ) !=  nullptr &&
                             static_cast<SfxBoolItem*>(_pItem.get())->GetValue());
             //remove full screen entry when not in full screen mode
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 73bababd218a..620bd42a8d3b 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -74,7 +74,7 @@ SwBookmarkControl::~SwBookmarkControl()
 void SwBookmarkControl::StateChanged(
     sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if( eState != SfxItemState::DEFAULT || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pState))
     {
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 95f4196f2aa0..abda424dbf8f 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -60,7 +60,7 @@ SwViewLayoutControl::~SwViewLayoutControl()
 
 void SwViewLayoutControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if ( SfxItemState::DEFAULT != eState || dynamic_cast< const SfxVoidItem *>( pState ) !=  nullptr )
+    if ( SfxItemState::DEFAULT != eState || pState->IsVoidItem() )
         GetStatusBar().SetItemText( GetId(), OUString() );
     else
     {


More information about the Libreoffice-commits mailing list