summaryrefslogtreecommitdiff
path: root/tools/source/rc
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-01-18 12:30:47 +0000
committerKurt Zenker <kz@openoffice.org>2005-01-18 12:30:47 +0000
commita3a14359585f29b9fc3230fdb036803fbcf187cf (patch)
tree3489ff533cb8c545f921027f4de3cfca6e179311 /tools/source/rc
parent29440df06cb1787e50f987a2bed64dd972c966eb (diff)
INTEGRATION: CWS res32bit2 (1.35.16); FILE MERGED
2005/01/17 16:38:23 pl 1.35.16.1: #i40403# make SetResMgr hack for ofa resource work again
Diffstat (limited to 'tools/source/rc')
-rw-r--r--tools/source/rc/resmgr.cxx77
1 files changed, 67 insertions, 10 deletions
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index b477e6de06..815c9d9e6d 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: resmgr.cxx,v $
*
- * $Revision: 1.35 $
+ * $Revision: 1.36 $
*
- * last change: $Author: obo $ $Date: 2005-01-03 17:14:02 $
+ * last change: $Author: kz $ $Date: 2005-01-18 13:30:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,6 +162,10 @@ static osl::Mutex& getResMgrMutex()
return *pResMgrMutex;
}
+static OUString* pGlobalPrefix = NULL;
+static com::sun::star::lang::Locale* pGlobalLocale = NULL;
+static std::list<ResMgr*>* pGlobalThreadList = NULL;
+
struct ImplSVResourceData
{
oslThreadKey pThreadKey;
@@ -170,19 +174,14 @@ struct ImplSVResourceData
pThreadKey = osl_createThreadKey( NULL );
}
- ResMgr* getThreadResMgr()
- {
- return (ResMgr*)osl_getThreadKeyData( pThreadKey );
- }
- void setThreadResMgr( ResMgr* pResMgr )
- {
- osl_setThreadKeyData( pThreadKey, pResMgr );
- }
+ ResMgr* getThreadResMgr();
+ void setThreadResMgr( ResMgr* pResMgr );
};
struct ImpContent;
class InternalResMgr
{
+ friend void ImplSVResourceData::setThreadResMgr(ResMgr*);
friend class ResMgr;
friend class SimpleResMgr;
friend class ResMgrContainer;
@@ -546,6 +545,41 @@ void ResMgrContainer::freeResMgr( InternalResMgr* pResMgr )
struct ResData : public rtl::Static< ImplSVResourceData, ResData > {};
+ResMgr* ImplSVResourceData::getThreadResMgr()
+{
+ ResMgr* pRet = (ResMgr*)osl_getThreadKeyData( pThreadKey );
+ if( ! pRet )
+ {
+ osl::Guard<osl::Mutex> aGuard( getResMgrMutex() );
+ if( pGlobalLocale && pGlobalPrefix )
+ {
+ InternalResMgr* pImpl = ResMgrContainer::get().getResMgr( *pGlobalPrefix, *pGlobalLocale, true );
+ if( pImpl )
+ {
+ pRet = ResMgr::ImplCreateResMgr( pImpl );
+ setThreadResMgr( pRet );
+ if( ! pGlobalThreadList )
+ pGlobalThreadList = new std::list<ResMgr*>();
+ pGlobalThreadList->push_back( pRet );
+ }
+ }
+ }
+ return pRet;
+}
+void ImplSVResourceData::setThreadResMgr( ResMgr* pResMgr )
+{
+ if( ! (pGlobalLocale && pGlobalPrefix) && pResMgr )
+ {
+ osl::Guard<osl::Mutex> aGuard( getResMgrMutex() );
+ if( ! (pGlobalLocale && pGlobalPrefix) )
+ {
+ pGlobalLocale = new com::sun::star::lang::Locale( pResMgr->ImplGetLocale() );
+ pGlobalPrefix = new OUString( pResMgr->ImplGetPrefix() );
+ }
+ }
+ osl_setThreadKeyData( pThreadKey, pResMgr );
+}
+
void Resource::TestRes()
{
if( ResData::get().getThreadResMgr() )
@@ -1009,6 +1043,18 @@ void ResMgr::DestroyAllResMgr()
{
{
osl::Guard<osl::Mutex> aGuard( getResMgrMutex() );
+
+ if( pGlobalThreadList )
+ {
+ while( ! pGlobalThreadList->empty() )
+ {
+ delete pGlobalThreadList->front();
+ pGlobalThreadList->pop_front();
+ }
+ delete pGlobalThreadList;
+ }
+ delete pGlobalLocale, pGlobalLocale = NULL;
+ delete pGlobalPrefix, pGlobalPrefix = NULL;
if( pEmptyBuffer )
{
@@ -1156,6 +1202,17 @@ void ResMgr::TestStack( const Resource* )
#endif
// -----------------------------------------------------------------------
+OUString ResMgr::ImplGetPrefix()
+{
+ return pImpRes ? pImpRes->aPrefix : OUString();
+}
+
+com::sun::star::lang::Locale ResMgr::ImplGetLocale()
+{
+ return pImpRes ? pImpRes->aLocale : com::sun::star::lang::Locale();
+}
+
+// -----------------------------------------------------------------------
BOOL ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const
{