diff options
author | Release Engineers <releng@openoffice.org> | 2008-12-01 12:31:27 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2008-12-01 12:31:27 +0000 |
commit | 3e33ac2ea6f2c78e86faab4acbf6c47e87a695ee (patch) | |
tree | 5acb00b118789ccdd61d5147474100c8a0094a7d /svtools/source/numbers | |
parent | 4f6b7ef2931e5527c31b650b3815e36378e5010c (diff) |
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104
2008-11-19 12:31:19 +0100 msc r263979 : i96104
2008-11-19 12:21:55 +0100 msc r263977 : i96104
2008-11-19 12:18:53 +0100 msc r263976 : i96104
2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set
2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry
2008-11-17 11:20:25 +0100 fs r263708 : #i10000#
2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1
2008-11-12 22:25:59 +0100 fs r263621 : #i96150#
2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34
2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34
2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled
2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come
2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively
2008-11-11 16:11:11 +0100 msc r263566 : #i96104#
2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added
2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added
2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases
2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync
2008-11-04 20:49:50 +0100 fs r263335 : docu formatting
2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts)
2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing
2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control
2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn
2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn
2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn
2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn
2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn
2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn
2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn
2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn
2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN
2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
Diffstat (limited to 'svtools/source/numbers')
-rw-r--r-- | svtools/source/numbers/numfmuno.cxx | 180 | ||||
-rw-r--r-- | svtools/source/numbers/numfmuno.hxx | 26 | ||||
-rw-r--r-- | svtools/source/numbers/numuno.cxx | 16 | ||||
-rw-r--r-- | svtools/source/numbers/supservs.cxx | 12 |
4 files changed, 124 insertions, 110 deletions
diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx index eba3cdf07540..5d9c88ec8760 100644 --- a/svtools/source/numbers/numfmuno.cxx +++ b/svtools/source/numbers/numfmuno.cxx @@ -135,15 +135,13 @@ LanguageType lcl_GetLanguage( const lang::Locale& rLocale ) //---------------------------------------------------------------------------------------- -SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() : - pSupplier(NULL) +SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() + :m_aMutex() { } SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj() { - if (pSupplier) - pSupplier->release(); } com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) @@ -154,38 +152,43 @@ com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvN // XNumberFormatter void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( - const uno::Reference<util::XNumberFormatsSupplier>& xSupplier ) + const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld; - SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( xSupplier ); - if (!pNew) - throw uno::RuntimeException(); // wrong object + // SYNCHRONIZED -> + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier ); + if (!pNew) + throw uno::RuntimeException(); // wrong object - if (pNew) - pNew->acquire(); - if (pSupplier) - pSupplier->release(); - pSupplier = pNew; + xAutoReleaseOld = xSupplier; + + xSupplier = pNew; + m_aMutex = xSupplier->getSharedMutex(); + } + // <- SYNCHRONIZED } uno::Reference<util::XNumberFormatsSupplier> SAL_CALL SvNumberFormatterServiceObj::getNumberFormatsSupplier() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); - return pSupplier; + ::osl::MutexGuard aGuard( m_aMutex ); + return xSupplier.get(); } sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat( sal_Int32 nKey, const rtl::OUString& aString ) throw(util::NotNumericException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -206,10 +209,10 @@ double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( sal_Int32 nKey, const rtl::OUString& aString ) throw(util::NotNumericException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); double fRet = 0.0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -229,10 +232,10 @@ double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { Color* pColor = NULL; @@ -248,10 +251,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 double fValue, util::Color aDefaultColor ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aStr; @@ -270,10 +273,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey, const rtl::OUString& aString ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -290,10 +293,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 const rtl::OUString& aString,util::Color aDefaultColor ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -313,10 +316,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) pFormatter->GetInputLineString(fValue, nKey, aRet); else @@ -332,10 +335,10 @@ rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString const lang::Locale& nLocale, sal_Bool bAllowEnglish ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aOutString; @@ -368,10 +371,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( util::Color aDefaultColor ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aOutString; @@ -427,17 +430,16 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedS //------------------------------------------------------------------------ -SvNumberFormatsObj::SvNumberFormatsObj(SvNumberFormatsSupplierObj* pParent) : - pSupplier(pParent) +SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex ) + :rSupplier( _rParent ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatsObj::~SvNumberFormatsObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XNumberFormats @@ -445,12 +447,12 @@ SvNumberFormatsObj::~SvNumberFormatsObj() uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) - return new SvNumberFormatObj( pSupplier, nKey ); + return new SvNumberFormatObj( rSupplier, nKey, m_aMutex ); else throw uno::RuntimeException(); } @@ -459,9 +461,9 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType const lang::Locale& nLocale, sal_Bool bCreate ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if ( pFormatter ) { sal_uInt32 nIndex = 0; @@ -485,10 +487,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const rtl::OUString& aFormat, const lang::Locale& nLocale, sal_Bool bScan ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -509,10 +511,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat, const lang::Locale& nLocale ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -540,10 +542,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFo const lang::Locale& nLocale, const lang::Locale& nNewLocale ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -570,13 +572,13 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFo void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + ::osl::MutexGuard aGuard( m_aMutex ); + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { pFormatter->DeleteEntry(nKey); - pSupplier->NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument + rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument } } @@ -585,10 +587,10 @@ rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -605,10 +607,10 @@ rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -623,10 +625,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLo sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -644,10 +646,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -662,10 +664,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const l sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); BOOL bRet = FALSE; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) bRet = pFormatter->IsCompatible( nOldType, nNewType ); else @@ -677,10 +679,10 @@ sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -717,18 +719,17 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNam //------------------------------------------------------------------------ -SvNumberFormatObj::SvNumberFormatObj(SvNumberFormatsSupplierObj* pParent, ULONG nK) : - pSupplier(pParent), - nKey(nK) +SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,nKey( nK ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatObj::~SvNumberFormatObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XPropertySet @@ -736,7 +737,7 @@ SvNumberFormatObj::~SvNumberFormatObj() uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatObj::getPropertySetInfo() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); static uno::Reference<beans::XPropertySetInfo> aRef = new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() ); return aRef; @@ -755,10 +756,10 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPro throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) { @@ -885,9 +886,9 @@ void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUStri uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValues() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) { @@ -979,17 +980,16 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceName //------------------------------------------------------------------------ -SvNumberFormatSettingsObj::SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj* pParent) : - pSupplier(pParent) +SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XPropertySet @@ -997,7 +997,7 @@ SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); static uno::Reference<beans::XPropertySetInfo> aRef = new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() ); return aRef; @@ -1009,9 +1009,9 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aString = aPropertyName; @@ -1042,7 +1042,7 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& else throw beans::UnknownPropertyException(); - pSupplier->SettingsChanged(); + rSupplier.SettingsChanged(); } else throw uno::RuntimeException(); @@ -1052,10 +1052,10 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUStri throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aString = aPropertyName; diff --git a/svtools/source/numbers/numfmuno.hxx b/svtools/source/numbers/numfmuno.hxx index d7ec25bf09b9..4148069fb37e 100644 --- a/svtools/source/numbers/numfmuno.hxx +++ b/svtools/source/numbers/numfmuno.hxx @@ -39,6 +39,8 @@ #include <com/sun/star/beans/XPropertyAccess.hpp> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> +#include <comphelper/sharedmutex.hxx> +#include <rtl/ref.hxx> class SvNumberformat; class SvNumberFormatter; @@ -53,7 +55,8 @@ class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: SvNumberFormatterServiceObj(); @@ -116,11 +119,11 @@ class SvNumberFormatsObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatsObj(); - SvNumberFormatsObj(SvNumberFormatsSupplierObj* pParent); + SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex); virtual ~SvNumberFormatsObj(); @@ -170,6 +173,9 @@ public: throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + +private: + SvNumberFormatsObj(); // never implemented }; @@ -179,11 +185,12 @@ class SvNumberFormatObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; - ULONG nKey; + SvNumberFormatsSupplierObj& rSupplier; + ULONG nKey; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatObj(SvNumberFormatsSupplierObj* pParent, ULONG nK); + SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ); virtual ~SvNumberFormatObj(); // XPropertySet @@ -253,10 +260,11 @@ class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj* pParent); + SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex); virtual ~SvNumberFormatSettingsObj(); diff --git a/svtools/source/numbers/numuno.cxx b/svtools/source/numbers/numuno.cxx index f7746a000a17..f91bf82b4e60 100644 --- a/svtools/source/numbers/numuno.cxx +++ b/svtools/source/numbers/numuno.cxx @@ -53,7 +53,8 @@ using namespace com::sun::star; class SvNumFmtSuppl_Impl { public: - SvNumberFormatter* pFormatter; + SvNumberFormatter* pFormatter; + mutable ::comphelper::SharedMutex aMutex; SvNumFmtSuppl_Impl(SvNumberFormatter* p) : pFormatter(p) {} @@ -77,6 +78,11 @@ SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj() delete pImpl; } +::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const +{ + return pImpl->aMutex; +} + SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const { return pImpl->pFormatter; @@ -103,17 +109,17 @@ void SvNumberFormatsSupplierObj::SettingsChanged() uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( pImpl->aMutex ); - return new SvNumberFormatSettingsObj( this ); + return new SvNumberFormatSettingsObj( *this, pImpl->aMutex ); } uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( pImpl->aMutex ); - return new SvNumberFormatsObj( this ); + return new SvNumberFormatsObj( *this, pImpl->aMutex ); } // XUnoTunnel diff --git a/svtools/source/numbers/supservs.cxx b/svtools/source/numbers/supservs.cxx index bcdbf86d7754..1035cd056406 100644 --- a/svtools/source/numbers/supservs.cxx +++ b/svtools/source/numbers/supservs.cxx @@ -32,6 +32,7 @@ #include "precompiled_svtools.hxx" #include "supservs.hxx" #include <com/sun/star/lang/Locale.hpp> +#include <comphelper/sharedmutex.hxx> #include <i18npool/mslangid.hxx> #include <tools/debug.hxx> #include <vos/mutex.hxx> @@ -91,8 +92,7 @@ Any SAL_CALL SvNumberFormatsSupplierServiceObject::queryAggregation( const Type& //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); - // the mutex of the base class .... hope we have a real (i.e. own) mutex sometimes + ::osl::MutexGuard aGuard( getSharedMutex() ); DBG_ASSERT(m_pOwnFormatter == NULL, "SvNumberFormatsSupplierServiceObject::initialize : already initialized !"); @@ -166,7 +166,7 @@ Sequence< ::rtl::OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSu //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); Reference< XOutputStream > xStream(_rxOutStream.get()); @@ -179,7 +179,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObj //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); Reference< XInputStream > xStream(_rxInStream.get()); @@ -191,7 +191,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObje //------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); return SvNumberFormatsSupplierObj::getNumberFormatSettings(); } @@ -199,7 +199,7 @@ Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumb //------------------------------------------------------------------------- Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); return SvNumberFormatsSupplierObj::getNumberFormats(); } |