summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-04-22 10:27:38 +0200
committerobo <obo@openoffice.org>2010-04-22 10:27:38 +0200
commit84ecce10a00f6a44958aab4b26c538922938f41e (patch)
tree59284d9e679ffdacd326cf334ba1db9c9699f645
parent5db9beb9555033bb5f0a6e8edfcd0de3e489457d (diff)
parentd03ec60181a92c29f0e0efe9e39696fbb50c7cd6 (diff)
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx4
-rw-r--r--sc/inc/sheetdata.hxx5
-rw-r--r--sc/source/filter/xml/sheetdata.cxx13
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx27
-rw-r--r--sc/source/ui/docshell/docsh.cxx19
5 files changed, 56 insertions, 12 deletions
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 7fe65ffb8..ececb51ed 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -86,7 +86,7 @@ void lcl_applyDefaultStyle(
void lcl_ensureCorrectLabelPlacement( const Reference< beans::XPropertySet >& xProp, const uno::Sequence < sal_Int32 >& rAvailablePlacements )
{
sal_Int32 nLabelPlacement=0;
- if( xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement )
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement) )
{
bool bValid = false;
for( sal_Int32 nN = 0; nN < rAvailablePlacements.getLength(); nN++ )
@@ -112,7 +112,7 @@ void lcl_resetLabelPlacementIfDefault( const Reference< beans::XPropertySet >& x
{
sal_Int32 nLabelPlacement=0;
- if( xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement )
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement) )
{
if( nDefaultPlacement == nLabelPlacement )
xProp->setPropertyValue( C2U("LabelPlacement"), uno::Any() );
diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx
index 56f9c6b5d..ca8dea513 100644
--- a/sc/inc/sheetdata.hxx
+++ b/sc/inc/sheetdata.hxx
@@ -132,6 +132,8 @@ class ScSheetSaveData
ScNoteStyleEntry maPreviousNote;
+ bool mbInSupportedSave;
+
public:
ScSheetSaveData();
~ScSheetSaveData();
@@ -174,6 +176,9 @@ public:
const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; }
const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; }
const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; }
+
+ bool IsInSupportedSave() const;
+ void SetInSupportedSave( bool bSet );
};
#endif
diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx
index 66b1c2579..947c1370f 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 772240613..86e344598 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 );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index e64aa4372..ebd7a5b50 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -746,19 +746,38 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( !bSuccess )
SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
}
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(true);
}
break;
+ case SFX_EVENT_SAVEASDOC:
+ case SFX_EVENT_SAVETODOC:
+ // #i108978# If no event is sent before saving, there will also be no "...DONE" event,
+ // and SAVE/SAVEAS can't be distinguished from SAVETO. So stream copying is only enabled
+ // if there is a SAVE/SAVEAS/SAVETO event first.
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(true);
+ break;
case SFX_EVENT_SAVEDOCDONE:
{
if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
{
}
UseSheetSaveEntries(); // use positions from saved file for next saving
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
}
break;
case SFX_EVENT_SAVEASDOCDONE:
// new positions are used after "save" and "save as", but not "save to"
UseSheetSaveEntries(); // use positions from saved file for next saving
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
+ break;
+ case SFX_EVENT_SAVETODOCDONE:
+ // only reset the flag, don't use the new positions
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
break;
default:
{