summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/package/pkgcontent.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-05-22 08:36:25 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-05-22 08:36:25 +0000
commitb1ce6dee1dbc9b636093c54eff067da37a591e47 (patch)
tree43a7482ef80e7cce4cae684d3d1a33cbf4fd75ee /ucb/source/ucp/package/pkgcontent.cxx
parent8faba4a236ff0b767f73e574eb1d314e9d36866f (diff)
INTEGRATION: CWS uno4 (1.46.12); FILE MERGED
2003/05/08 12:39:39 kso 1.46.12.1: #i13771# - fixed getTypes() member function implementation.
Diffstat (limited to 'ucb/source/ucp/package/pkgcontent.cxx')
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx69
1 files changed, 46 insertions, 23 deletions
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index 09578468291b..021610e2d1cf 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgcontent.cxx,v $
*
- * $Revision: 1.46 $
+ * $Revision: 1.47 $
*
- * last change: $Author: hr $ $Date: 2003-03-27 17:27:15 $
+ * last change: $Author: vg $ $Date: 2003-05-22 09:36:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,9 @@
**************************************************************************
*************************************************************************/
+#include "osl/getglobalmutex.hxx"
+#include "rtl/instance.hxx"
+
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
@@ -402,20 +405,14 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
XTYPEPROVIDER_COMMON_IMPL( Content );
//=========================================================================
-// virtual
-uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
- throw( uno::RuntimeException )
-{
- static cppu::OTypeCollection* pCollection = NULL;
- if ( !pCollection )
+namespace
+{
+ struct InitFolderTypes
{
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
- if ( !pCollection )
- {
- if ( isFolder() )
- {
- static cppu::OTypeCollection aCollection(
+ cppu::OTypeCollection * operator()()
+ {
+ static cppu::OTypeCollection aInstance(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -427,11 +424,15 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ),
CPPU_TYPE_REF( star::ucb::XContentCreator ) ); // !!
- pCollection = &aCollection;
- }
- else
- {
- static cppu::OTypeCollection aCollection(
+ return &aInstance;
+ }
+ };
+
+ struct InitDocTypes
+ {
+ cppu::OTypeCollection * operator()()
+ {
+ static cppu::OTypeCollection aInstance(
CPPU_TYPE_REF( lang::XTypeProvider ),
CPPU_TYPE_REF( lang::XServiceInfo ),
CPPU_TYPE_REF( lang::XComponent ),
@@ -442,12 +443,34 @@ 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;
- }
+ return &aInstance;
}
- }
+ };
+}
- return (*pCollection).getTypes();
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
+ throw( uno::RuntimeException )
+{
+ if ( isFolder() )
+ {
+ return (*rtl_Instance< cppu::OTypeCollection,
+ InitFolderTypes,
+ ::osl::MutexGuard,
+ ::osl::GetGlobalMutex >::create(
+ InitFolderTypes(),
+ ::osl::GetGlobalMutex() ) ).getTypes();
+ }
+ else
+ {
+ return (*rtl_Instance< cppu::OTypeCollection,
+ InitDocTypes,
+ ::osl::MutexGuard,
+ ::osl::GetGlobalMutex >::create(
+ InitDocTypes(),
+ ::osl::GetGlobalMutex() ) ).getTypes();
+ }
}
//=========================================================================