diff options
-rw-r--r-- | sc/source/filter/xml/XMLCalculationSettingsContext.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLConsolidationContext.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLDetectiveContext.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLStylesImportHelper.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableShapeResizer.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableSourceContext.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlbodyi.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcoli.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 42 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlrowi.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlsubti.cxx | 15 |
11 files changed, 35 insertions, 55 deletions
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx index 98d7a41da7c7..cd4875a9079a 100644 --- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx +++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx @@ -157,11 +157,10 @@ void ScXMLCalculationSettingsContext::EndElement() xPropertySet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_NULLDATE)), uno::makeAny(aNullDate) ); if (GetScImport().GetDocument()) { - GetScImport().LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); ScDocOptions aDocOptions (GetScImport().GetDocument()->GetDocOptions()); aDocOptions.SetYear2000(nYear2000); GetScImport().GetDocument()->SetDocOptions(aDocOptions); - GetScImport().UnlockSolarMutex(); } } } diff --git a/sc/source/filter/xml/XMLConsolidationContext.cxx b/sc/source/filter/xml/XMLConsolidationContext.cxx index f075dfc68129..4be134c74f7d 100644 --- a/sc/source/filter/xml/XMLConsolidationContext.cxx +++ b/sc/source/filter/xml/XMLConsolidationContext.cxx @@ -57,7 +57,7 @@ ScXMLConsolidationContext::ScXMLConsolidationContext( bLinkToSource( sal_False ), bTargetAddr(sal_False) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); if( !xAttrList.is() ) return; sal_Int16 nAttrCount = xAttrList->getLength(); diff --git a/sc/source/filter/xml/XMLDetectiveContext.cxx b/sc/source/filter/xml/XMLDetectiveContext.cxx index 131dea72379d..3c52f96b558a 100644 --- a/sc/source/filter/xml/XMLDetectiveContext.cxx +++ b/sc/source/filter/xml/XMLDetectiveContext.cxx @@ -154,9 +154,8 @@ ScXMLDetectiveHighlightedContext::ScXMLDetectiveHighlightedContext( case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE: { sal_Int32 nOffset(0); - GetScImport().LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); bValid = ScRangeStringConverter::GetRangeFromString( aDetectiveObj.aSourceRange, sValue, GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ); - GetScImport().UnlockSolarMutex(); } break; case XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION: diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx index 3a4ea8384539..0906a2a016a8 100644 --- a/sc/source/filter/xml/XMLStylesImportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx @@ -578,7 +578,7 @@ void ScMyStylesImportHelper::AddCell(const com::sun::star::table::CellAddress& r void ScMyStylesImportHelper::InsertRow(const sal_Int32 nRow, const sal_Int32 nTab, ScDocument* pDoc) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); ScMyStylesSet::iterator aItr(aCellStyles.begin()); ScMyStylesSet::iterator aEndItr(aCellStyles.end()); while (aItr != aEndItr) @@ -586,12 +586,11 @@ void ScMyStylesImportHelper::InsertRow(const sal_Int32 nRow, const sal_Int32 nTa aItr->xRanges->InsertRow(nRow, nTab, pDoc); ++aItr; } - rImport.UnlockSolarMutex(); } void ScMyStylesImportHelper::InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* pDoc) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); ScMyStylesSet::iterator aItr(aCellStyles.begin()); ScMyStylesSet::iterator aEndItr(aCellStyles.end()); while (aItr != aEndItr) @@ -599,7 +598,6 @@ void ScMyStylesImportHelper::InsertCol(const sal_Int32 nCol, const sal_Int32 nTa aItr->xRanges->InsertCol(nCol, nTab, pDoc); ++aItr; } - rImport.UnlockSolarMutex(); } void ScMyStylesImportHelper::EndTable() diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx index 23e72c369267..67d0736473c8 100644 --- a/sc/source/filter/xml/XMLTableShapeResizer.cxx +++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx @@ -201,7 +201,7 @@ void ScMyShapeResizer::ResizeShapes() ScDocument* pDoc(rImport.GetDocument()); if ( pDoc && xIndex.is() ) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); while (aItr != aEndItr) { // #i78086# invalid cell position is used to call CreateChartListener only @@ -377,9 +377,6 @@ void ScMyShapeResizer::ResizeShapes() delete aItr->pRangeList; aItr = aShapes.erase(aItr); } - rImport.UnlockSolarMutex(); -// if (pCollection) -// pDoc->SetChartListenerCollection(pCollection); } } } diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx b/sc/source/filter/xml/XMLTableSourceContext.cxx index 9cc6d9a7090a..d3607a2ab279 100644 --- a/sc/source/filter/xml/XMLTableSourceContext.cxx +++ b/sc/source/filter/xml/XMLTableSourceContext.cxx @@ -117,7 +117,7 @@ void ScXMLTableSourceContext::EndElement() ScDocument* pDoc(GetScImport().GetDocument()); if (xLinkable.is() && pDoc) { - GetScImport().LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); if (pDoc->RenameTab( static_cast<SCTAB>(GetScImport().GetTables().GetCurrentSheet()), GetScImport().GetTables().GetCurrentSheetName(), sal_False, sal_True)) { @@ -140,7 +140,6 @@ void ScXMLTableSourceContext::EndElement() nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh ); } - GetScImport().UnlockSolarMutex(); } } } diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx index 7f92f82aa1a6..3f8539d9b37c 100644 --- a/sc/source/filter/xml/xmlbodyi.cxx +++ b/sc/source/filter/xml/xmlbodyi.cxx @@ -268,7 +268,9 @@ void ScXMLBodyContext::EndElement() SvXMLImportContext *pContext = new ScXMLCalculationSettingsContext( GetScImport(), XML_NAMESPACE_TABLE, GetXMLToken(XML_CALCULATION_SETTINGS), NULL ); pContext->EndElement(); } - GetScImport().LockSolarMutex(); + + ScXMLImport::MutexGuard aGuard(GetScImport()); + ScMyImpDetectiveOpArray* pDetOpArray = GetScImport().GetDetectiveOpArray(); ScDocument* pDoc = GetScImport().GetDocument(); ScMyImpDetectiveOp aDetOp; @@ -304,7 +306,6 @@ void ScXMLBodyContext::EndElement() pDoc->SetDocProtection(pProtection.get()); } } - GetScImport().UnlockSolarMutex(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 4b05c89dc4e2..fa2cc817fa7a 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -319,7 +319,7 @@ void ScXMLTableColsContext::EndElement() ScDocument* pDoc = GetScImport().GetDocument(); if (pDoc) { - rXMLImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(nSheet), sal_True); ScOutlineArray* pColArray = pOutlineTable ? pOutlineTable->GetColArray() : NULL; if (pColArray) @@ -327,7 +327,6 @@ void ScXMLTableColsContext::EndElement() sal_Bool bResized; pColArray->Insert(static_cast<SCCOL>(nGroupStartCol), static_cast<SCCOL>(nGroupEndCol), bResized, !bGroupDisplay, sal_True); } - rXMLImport.UnlockSolarMutex(); } } } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 36c9558533bd..fd3aa9f3c5ee 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2107,7 +2107,7 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque sal_Int32 nCount(rChangeProps.getLength()); if (nCount) { - LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(*this); sal_Int16 nTemp16(0); ScChangeViewSettings* pViewSettings(new ScChangeViewSettings()); for (sal_Int32 i = 0; i < nCount; ++i) @@ -2183,7 +2183,6 @@ void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Seque } } pDoc->SetChangeViewSettings(*pViewSettings); - UnlockSolarMutex(); } } } @@ -2316,18 +2315,19 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const rtl::OUStri lang::Locale aLocale; if (GetDocument() && (xProperties->getPropertyValue(sLocale) >>= aLocale)) { - LockSolarMutex(); - LocaleDataWrapper aLocaleData( GetDocument()->GetServiceManager(), aLocale ); - rtl::OUStringBuffer aBuffer(15); - aBuffer.appendAscii("#"); - aBuffer.append( aLocaleData.getNumThousandSep() ); - aBuffer.appendAscii("##0"); - aBuffer.append( aLocaleData.getNumDecimalSep() ); - aBuffer.appendAscii("00 [$"); - aBuffer.append(rCurrency); - aBuffer.appendAscii("]"); - UnlockSolarMutex(); - sFormatString = aBuffer.makeStringAndClear(); + { + ScXMLImport::MutexGuard aGuard(*this); + LocaleDataWrapper aLocaleData( GetDocument()->GetServiceManager(), aLocale ); + rtl::OUStringBuffer aBuffer(15); + aBuffer.appendAscii("#"); + aBuffer.append( aLocaleData.getNumThousandSep() ); + aBuffer.appendAscii("##0"); + aBuffer.append( aLocaleData.getNumDecimalSep() ); + aBuffer.appendAscii("00 [$"); + aBuffer.append(rCurrency); + aBuffer.appendAscii("]"); + sFormatString = aBuffer.makeStringAndClear(); + } sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, sal_True); if (nNewKey == -1) nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale); @@ -2601,7 +2601,7 @@ void ScXMLImport::SetStylesToRangesFinished() void SAL_CALL ScXMLImport::setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(*this); SvXMLImport::setTargetDocument( xDoc ); uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY); @@ -2615,7 +2615,6 @@ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::R uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY); if (xActionLockable.is()) xActionLockable->addActionLock(); - UnlockSolarMutex(); } // XServiceInfo @@ -2645,7 +2644,7 @@ throw(::com::sun::star::uno::RuntimeException) void SAL_CALL ScXMLImport::startDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ) { - LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(*this); SvXMLImport::startDocument(); if (pDoc && !pDoc->IsImportingXML()) { @@ -2669,8 +2668,6 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE pSheetData->StoreInitialNamespaces(rNamespaces); } } - - UnlockSolarMutex(); } sal_Int32 ScXMLImport::GetRangeType(const rtl::OUString sRangeType) const @@ -2807,7 +2804,7 @@ void ScXMLImport::SetNamedRanges() uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY); if (xNamedRange.is()) { - LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(*this); ScNamedRangeObj* pNamedRangeObj = ScNamedRangeObj::getImplementation( xNamedRange); if (pNamedRangeObj) { @@ -2817,7 +2814,6 @@ void ScXMLImport::SetNamedRanges() ScXMLConverter::ParseFormula( sTempContent, false); pNamedRangeObj->SetContentWithGrammar( sTempContent, (*aItr)->eGrammar); } - UnlockSolarMutex(); } } delete *aItr; @@ -2831,7 +2827,7 @@ void ScXMLImport::SetNamedRanges() void SAL_CALL ScXMLImport::endDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ) { - LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(*this); if (getImportFlags() & IMPORT_CONTENT) { if (GetModel().is()) @@ -2901,8 +2897,6 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE { ScModelObj::getImplementation(GetModel())->AfterXMLLoading(sal_True); } - - UnlockSolarMutex(); } // XEventListener diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index b1daf5d18575..aa0e0e367326 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -349,12 +349,11 @@ void ScXMLTableRowsContext::EndElement() ScDocument* pDoc(GetScImport().GetDocument()); if (pDoc) { - GetScImport().LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(GetScImport()); ScOutlineTable* pOutlineTable(pDoc->GetOutlineTable(static_cast<SCTAB>(nSheet), sal_True)); ScOutlineArray* pRowArray(pOutlineTable->GetRowArray()); sal_Bool bResized; pRowArray->Insert(static_cast<SCROW>(nGroupStartRow), static_cast<SCROW>(nGroupEndRow), bResized, !bGroupDisplay, sal_True); - GetScImport().UnlockSolarMutex(); } } } diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index e9b3b92dbf3c..b46abe6480a5 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -199,12 +199,11 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString& ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel()); if (pDoc) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); String sTabName(String::CreateFromAscii("Table")); pDoc->CreateValidTabName(sTabName); rtl::OUString sOUTabName(sTabName); xSheets->insertNewByName(sOUTabName, sal::static_int_cast<sal_Int16>(nCurrentSheet)); - rImport.UnlockSolarMutex(); } } } @@ -228,12 +227,11 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString& ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel()); if (pDoc) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); String sTabName(String::CreateFromAscii("Table")); pDoc->CreateValidTabName(sTabName); rtl::OUString sOUTabName(sTabName); xNamed->setName(sOUTabName); - rImport.UnlockSolarMutex(); } } } @@ -594,7 +592,8 @@ void ScMyTables::UpdateRowHeights() { if (rImport.GetModel().is()) { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); + // update automatic row heights // For sheets with any kind of shapes (including notes), @@ -628,14 +627,12 @@ void ScMyTables::UpdateRowHeights() pDoc->LockStreamValid( false ); } } - - rImport.UnlockSolarMutex(); } } void ScMyTables::DeleteTable() { - rImport.LockSolarMutex(); + ScXMLImport::MutexGuard aGuard(rImport); nCurrentColStylePos = 0; if (!maTables.empty()) @@ -673,8 +670,6 @@ void ScMyTables::DeleteTable() rImport.GetDocument()->SetTabProtection(static_cast<SCTAB>(nCurrentSheet), pProtect.get()); } - rImport.UnlockSolarMutex(); - //#95582#; find out whether it was possible to set the sheet name // test it here, because if it is a linked table the name is changed by importing // the linking informations |