Kaydet (Commit) 0b3d0fb2 authored tarafından Michael Stahl's avatar Michael Stahl

fdo#78159: fix import of OOoXML embedded objects

MimeConfigurationHelper::GetDefaultFilterFromServiceName() checks that
there is both an import and an export filter, and for OOoXML the export
has been removed; tweak the check to require only import for OOoXML.

Currently it still works invoke the OOoXML filter, but it is clearly
better to store the embedded documents only in ODF, so tweak
OCommonEmbeddedObject::store* methods to do that.

(regression from aeeaccf5)

Change-Id: Ib71f23fd110cbd4b570517f2dde2c53e3aa6301d
üst 68741d00
......@@ -743,7 +743,12 @@ OUString MimeConfigurationHelper::GetDefaultFilterFromServiceName( const OUStrin
sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( "Flags", (sal_Int32)0 );
// that should be import, export, own filter and not a template filter ( TemplatePath flag )
sal_Int32 nRequired = ( SFX_FILTER_OWN | SFX_FILTER_EXPORT | SFX_FILTER_IMPORT );
sal_Int32 const nRequired = (SFX_FILTER_OWN
// fdo#78159 for OOoXML, there is code to convert
// to ODF in OCommonEmbeddedObject::store*
// so accept it even though there's no export
| (SOFFICE_FILEFORMAT_60 == nVersion ? 0 : SFX_FILTER_EXPORT)
| SFX_FILTER_IMPORT );
if ( ( ( nFlags & nRequired ) == nRequired ) && !( nFlags & SFX_FILTER_TEMPLATEPATH ) )
{
// if there are more than one filter the preffered one should be used
......
......@@ -1165,6 +1165,12 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed::
{
SAL_WARN( "embeddedobj.common", "Can not retrieve target storage media type!" );
}
if (nTargetStorageFormat == SOFFICE_FILEFORMAT_60)
{
SAL_INFO("embeddedobj.common", "fdo#78159: Storing OOoXML as ODF");
nTargetStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
// setting MediaType is done later anyway, no need to do it here
}
try
{
......@@ -1294,6 +1300,12 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed::
{
SAL_WARN( "embeddedobj.common", "Can not retrieve target storage media type!" );
}
if (nTargetStorageFormat == SOFFICE_FILEFORMAT_60)
{
SAL_INFO("embeddedobj.common", "fdo#78159: Storing OOoXML as ODF");
nTargetStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
// setting MediaType is done later anyway, no need to do it here
}
try
{
......@@ -1579,6 +1591,12 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
{
SAL_WARN( "embeddedobj.common", "Can not retrieve storage media type!" );
}
if (nStorageFormat == SOFFICE_FILEFORMAT_60)
{
SAL_INFO("embeddedobj.common", "fdo#78159: Storing OOoXML as ODF");
nStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
// setting MediaType is done later anyway, no need to do it here
}
aGuard.clear();
StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment