diff options
author | Niklas Nebel <nn@openoffice.org> | 2010-04-13 15:25:33 +0200 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2010-04-13 15:25:33 +0200 |
commit | 2975955db0512b8ba6ac4a543cedcf8e2fe1879c (patch) | |
tree | 34a0b031adabd5dae99533a53561043cbc31d896 /sc/source/filter/xml | |
parent | 9dea2514f97c24244c04c7a957b755f2f7427e6d (diff) |
fwk140: #i108978# copy sheets from stream only if a SFX event was notified before saving
Diffstat (limited to 'sc/source/filter/xml')
-rw-r--r-- | sc/source/filter/xml/sheetdata.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlwrap.cxx | 27 |
2 files changed, 30 insertions, 10 deletions
diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx index 66b1c2579dd4..947c1370fa4b 100644 --- a/sc/source/filter/xml/sheetdata.cxx +++ b/sc/source/filter/xml/sheetdata.cxx @@ -43,7 +43,8 @@ ScSheetSaveData::ScSheetSaveData() : mnStartTab( -1 ), mnStartOffset( -1 ), - maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) ) + maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) ), + mbInSupportedSave( false ) { } @@ -270,3 +271,13 @@ bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) cons return true; // success } +bool ScSheetSaveData::IsInSupportedSave() const +{ + return mbInSupportedSave; +} + +void ScSheetSaveData::SetInSupportedSave( bool bSet ) +{ + mbInSupportedSave = bSet; +} + diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index fde7f00bb05a..a8176cc7d955 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -78,6 +78,8 @@ #include "globstr.hrc" #include "scerrors.hxx" #include "XMLExportSharedData.hxx" +#include "docuno.hxx" +#include "sheetdata.hxx" #define MAP_LEN(x) x, sizeof(x) - 1 @@ -738,16 +740,23 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic uno::Reference<embed::XStorage> xTmpStorage = rDoc.GetDocumentShell()->GetStorage(); uno::Reference<io::XStream> xSrcStream; uno::Reference<io::XInputStream> xSrcInput; - try - { - if (xTmpStorage.is()) - xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ ); - if (xSrcStream.is()) - xSrcInput = xSrcStream->getInputStream(); - } - catch (uno::Exception&) + + // #i108978# If an embedded object is saved and no events are notified, don't use the stream + // because without the ...DONE events, stream positions aren't updated. + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xModel)->GetSheetSaveData(); + if (pSheetData && pSheetData->IsInSupportedSave()) { - // stream not available (for example, password protected) - save normally (xSrcInput is null) + try + { + if (xTmpStorage.is()) + xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ ); + if (xSrcStream.is()) + xSrcInput = xSrcStream->getInputStream(); + } + catch (uno::Exception&) + { + // stream not available (for example, password protected) - save normally (xSrcInput is null) + } } pExport->SetSourceStream( xSrcInput ); |