summaryrefslogtreecommitdiff
path: root/framework/source/layoutmanager/layoutmanager.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-01 11:39:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-01 15:21:18 +0100
commit8d1aeb01ea025f6644401c3a9e01cb36a8ae367c (patch)
tree982e083d5665a1885266c82956b8e1402d88f5d3 /framework/source/layoutmanager/layoutmanager.cxx
parent7b9449986d841e2649e24a3045e6b821e4016438 (diff)
overly static
Diffstat (limited to 'framework/source/layoutmanager/layoutmanager.cxx')
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx40
1 files changed, 28 insertions, 12 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 847766c2a662..a7bc56cbd954 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -90,6 +90,7 @@
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/uno3.hxx>
#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
#include <unotools/cmdoptions.hxx>
#include <algorithm>
@@ -3212,24 +3213,39 @@ void SAL_CALL LayoutManager::getFastPropertyValue( uno::Any& aValue, sal_Int32 n
LayoutManager_PBase::getFastPropertyValue( aValue, nHandle );
}
-::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper()
+namespace detail
{
- static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL;
-
- if( pInfoHelper == NULL )
+ class InfoHelperBuilder : private ::boost::noncopyable
{
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- if( pInfoHelper == NULL )
+ private:
+ ::cppu::OPropertyArrayHelper *m_pInfoHelper;
+ public:
+ InfoHelperBuilder(const LayoutManager &rManager)
{
uno::Sequence< beans::Property > aProperties;
- describeProperties( aProperties );
- static ::cppu::OPropertyArrayHelper aInfoHelper( aProperties, sal_True );
- pInfoHelper = &aInfoHelper;
+ rManager.describeProperties(aProperties);
+ m_pInfoHelper = new ::cppu::OPropertyArrayHelper(aProperties, sal_True);
+ }
+ ~InfoHelperBuilder()
+ {
+ delete m_pInfoHelper;
}
- }
- return(*pInfoHelper);
+ ::cppu::OPropertyArrayHelper& getHelper() { return *m_pInfoHelper; }
+ };
+}
+namespace
+{
+ struct theInfoHelper :
+ public rtl::StaticWithArg< detail::InfoHelperBuilder, LayoutManager,
+ theInfoHelper >
+ {
+ };
+}
+
+::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper()
+{
+ return theInfoHelper::get(*this).getHelper();
}
uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo() throw (uno::RuntimeException)