remove archaic Content.xml fallback
there's no evidence that Content.xml (or Meta.xml) was written by any released version to necessitate the fallback reportdesign Settings.xml and Style.xml fallbacks appear to be cargocult influenced by the Content.xml/Meta.xml examples Change-Id: I51d138344edaffc6d21e17c2d28047ea6316304e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93970 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
This commit is contained in:
@@ -382,15 +382,6 @@ ErrCode XMLFilter::impl_Import(
|
||||
: OUString("com.sun.star.comp.Chart.XMLContentImporter"),
|
||||
xStorage, xFactory, xGraphicStorageHandler, xImportInfo );
|
||||
nWarning = nWarning != ERRCODE_NONE ? nWarning : nContentWarning;
|
||||
|
||||
// import of "content.xml" didn't work - try old "Content.xml" stream
|
||||
if( nContentWarning != ERRCODE_NONE )
|
||||
{
|
||||
nWarning = impl_ImportStream(
|
||||
"Content.xml", // old content stream name
|
||||
"com.sun.star.office.sax.importer.Chart",
|
||||
xStorage, xFactory, xGraphicStorageHandler, xImportInfo );
|
||||
}
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
|
@@ -127,7 +127,6 @@ static ErrCode ReadThroughComponent(
|
||||
const uno::Reference< embed::XStorage >& xStorage,
|
||||
const uno::Reference<XComponent>& xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
const uno::Reference<XComponentContext> & rxContext,
|
||||
ODBFilter& _rFilter)
|
||||
{
|
||||
@@ -144,17 +143,8 @@ static ErrCode ReadThroughComponent(
|
||||
OUString sStreamName = OUString::createFromAscii(pStreamName);
|
||||
if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
|
||||
{
|
||||
// stream name not found! Then try the compatibility name.
|
||||
// if no stream can be opened, return immediately with OK signal
|
||||
|
||||
// do we even have an alternative name?
|
||||
if ( nullptr == pCompatibilityStreamName )
|
||||
return ERRCODE_NONE;
|
||||
|
||||
// if so, does the stream exist?
|
||||
sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
|
||||
if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
|
||||
return ERRCODE_NONE;
|
||||
// stream name not found! return immediately with OK signal
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
// get input stream
|
||||
@@ -349,7 +339,6 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
ErrCode nRet = ReadThroughComponent( xStorage
|
||||
,xModel
|
||||
,"settings.xml"
|
||||
,"Settings.xml"
|
||||
,GetComponentContext()
|
||||
,*this
|
||||
);
|
||||
@@ -358,7 +347,6 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
nRet = ReadThroughComponent( xStorage
|
||||
,xModel
|
||||
,"content.xml"
|
||||
,"Content.xml"
|
||||
,GetComponentContext()
|
||||
,*this
|
||||
);
|
||||
|
@@ -180,7 +180,6 @@ static ErrCode ReadThroughComponent(
|
||||
const uno::Reference< embed::XStorage >& xStorage,
|
||||
const uno::Reference<XComponent>& xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
const uno::Reference<XComponentContext> & rxContext,
|
||||
const Reference<document::XGraphicStorageHandler> & rxGraphicStorageHandler,
|
||||
const Reference<document::XEmbeddedObjectResolver>& _xEmbeddedObjectResolver,
|
||||
@@ -200,17 +199,8 @@ static ErrCode ReadThroughComponent(
|
||||
OUString sStreamName = OUString::createFromAscii(pStreamName);
|
||||
if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
|
||||
{
|
||||
// stream name not found! Then try the compatibility name.
|
||||
// if no stream can be opened, return immediately with OK signal
|
||||
|
||||
// do we even have an alternative name?
|
||||
if ( nullptr == pCompatibilityStreamName )
|
||||
return ERRCODE_NONE;
|
||||
|
||||
// if so, does the stream exist?
|
||||
sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
|
||||
if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
|
||||
return ERRCODE_NONE;
|
||||
// stream name not found! return immediately with OK signal
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
// get input stream
|
||||
@@ -488,7 +478,6 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
ErrCode nRet = ReadThroughComponent( xStorage
|
||||
,xModel
|
||||
,"meta.xml"
|
||||
,"Meta.xml"
|
||||
,GetComponentContext()
|
||||
,xGraphicStorageHandler
|
||||
,xEmbeddedObjectResolver
|
||||
@@ -512,7 +501,6 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
nRet = ReadThroughComponent( xStorage
|
||||
,xModel
|
||||
,"settings.xml"
|
||||
,"Settings.xml"
|
||||
,GetComponentContext()
|
||||
,xGraphicStorageHandler
|
||||
,xEmbeddedObjectResolver
|
||||
@@ -526,7 +514,6 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
nRet = ReadThroughComponent(xStorage
|
||||
,xModel
|
||||
,"styles.xml"
|
||||
,"Styles.xml"
|
||||
,GetComponentContext()
|
||||
,xGraphicStorageHandler
|
||||
,xEmbeddedObjectResolver
|
||||
@@ -540,7 +527,6 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
|
||||
nRet = ReadThroughComponent( xStorage
|
||||
,xModel
|
||||
,"content.xml"
|
||||
,"Content.xml"
|
||||
,GetComponentContext()
|
||||
,xGraphicStorageHandler
|
||||
,xEmbeddedObjectResolver
|
||||
|
@@ -70,7 +70,7 @@ class ScXMLImportWrapper
|
||||
const css::uno::Reference<css::frame::XModel>& xModel,
|
||||
const css::uno::Reference<css::xml::sax::XParser>& xParser,
|
||||
css::xml::sax::InputSource& aParserInput,
|
||||
const OUString& sComponentName, const OUString& sDocName, const OUString& sOldDocName,
|
||||
const OUString& sComponentName, const OUString& sDocName,
|
||||
const css::uno::Sequence<css::uno::Any>& aArgs,
|
||||
bool bMustBeSuccessfull);
|
||||
|
||||
|
@@ -107,7 +107,7 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo
|
||||
const uno::Reference<frame::XModel>& xModel, const uno::Reference<xml::sax::XParser>& xParser,
|
||||
xml::sax::InputSource& aParserInput,
|
||||
const OUString& sComponentName, const OUString& sDocName,
|
||||
const OUString& sOldDocName, const uno::Sequence<uno::Any>& aArgs,
|
||||
const uno::Sequence<uno::Any>& aArgs,
|
||||
bool bMustBeSuccessfull)
|
||||
{
|
||||
uno::Reference < io::XStream > xDocStream;
|
||||
@@ -122,11 +122,6 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo
|
||||
{
|
||||
if ( xStorage->hasByName(sDocName) && xStorage->isStreamElement( sDocName) )
|
||||
xDocStream = xStorage->openStreamElement( sDocName, embed::ElementModes::READ );
|
||||
else if (!sOldDocName.isEmpty() && xStorage->hasByName(sOldDocName) && xStorage->isStreamElement( sOldDocName) )
|
||||
{
|
||||
xDocStream = xStorage->openStreamElement( sOldDocName, embed::ElementModes::READ );
|
||||
sStream = sOldDocName;
|
||||
}
|
||||
else
|
||||
return ERRCODE_NONE;
|
||||
|
||||
@@ -433,7 +428,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
|
||||
xContext, xModel, xXMLParser, aParserInput,
|
||||
bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisMetaImporter")
|
||||
: OUString("com.sun.star.comp.Calc.XMLMetaImporter"),
|
||||
"meta.xml", "Meta.xml", aMetaArgs, false);
|
||||
"meta.xml", aMetaArgs, false);
|
||||
|
||||
SAL_INFO( "sc.filter", "meta import end" );
|
||||
}
|
||||
@@ -475,7 +470,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
|
||||
xContext, xModel, xXMLParser, aParserInput,
|
||||
bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisSettingsImporter")
|
||||
: OUString("com.sun.star.comp.Calc.XMLSettingsImporter"),
|
||||
"settings.xml", "", aSettingsArgs, false);
|
||||
"settings.xml", aSettingsArgs, false);
|
||||
|
||||
SAL_INFO( "sc.filter", "settings import end" );
|
||||
}
|
||||
@@ -489,7 +484,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
|
||||
bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisStylesImporter")
|
||||
: OUString("com.sun.star.comp.Calc.XMLStylesImporter"),
|
||||
"styles.xml",
|
||||
"", aStylesArgs, true);
|
||||
aStylesArgs, true);
|
||||
|
||||
SAL_INFO( "sc.filter", "styles import end" );
|
||||
}
|
||||
@@ -514,7 +509,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError )
|
||||
bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisContentImporter")
|
||||
: OUString("com.sun.star.comp.Calc.XMLContentImporter"),
|
||||
"content.xml",
|
||||
"Content.xml", aDocArgs,
|
||||
aDocArgs,
|
||||
true);
|
||||
|
||||
SAL_INFO( "sc.filter", "content import end" );
|
||||
|
@@ -29,7 +29,6 @@ static const OUString pFilterPowerPoint97AutoPlay( "MS PowerPoint 97 AutoPlay" )
|
||||
|
||||
// XML content stream
|
||||
static const OUString pStarDrawXMLContent( "content.xml" );
|
||||
static const OUString pStarDrawOldXMLContent( "Content.xml" );
|
||||
|
||||
#endif // INCLUDED_SD_INC_STRMNAME_H
|
||||
|
||||
|
@@ -312,7 +312,6 @@ ErrCode ReadThroughComponent(
|
||||
const uno::Reference < embed::XStorage >& xStorage,
|
||||
const Reference<XComponent>& xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
Reference<uno::XComponentContext> const & rxContext,
|
||||
const char* pFilterName,
|
||||
const Sequence<Any>& rFilterArguments,
|
||||
@@ -335,25 +334,8 @@ ErrCode ReadThroughComponent(
|
||||
|
||||
if (!bContainsStream )
|
||||
{
|
||||
// stream name not found! Then try the compatibility name.
|
||||
// if no stream can be opened, return immediately with OK signal
|
||||
|
||||
// do we even have an alternative name?
|
||||
if ( nullptr == pCompatibilityStreamName )
|
||||
return ERRCODE_NONE;
|
||||
|
||||
// if so, does the stream exist?
|
||||
sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
|
||||
try
|
||||
{
|
||||
bContainsStream = xStorage->isStreamElement(sStreamName);
|
||||
}
|
||||
catch (const container::NoSuchElementException&)
|
||||
{
|
||||
}
|
||||
|
||||
if (! bContainsStream )
|
||||
return ERRCODE_NONE;
|
||||
// stream name not found! return immediately with OK signal
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
// set Base URL
|
||||
@@ -626,26 +608,26 @@ bool SdXMLFilter::Import( ErrCode& nError )
|
||||
// read storage streams
|
||||
// #i103539#: always read meta.xml for generator
|
||||
nWarn = ReadThroughComponent(
|
||||
xStorage, xModelComp, "meta.xml", "Meta.xml", rxContext,
|
||||
xStorage, xModelComp, "meta.xml", rxContext,
|
||||
pServices->mpMeta,
|
||||
aEmptyArgs, aName, false );
|
||||
|
||||
if( meFilterMode != SdXMLFilterMode::Organizer )
|
||||
{
|
||||
nWarn2 = ReadThroughComponent(
|
||||
xStorage, xModelComp, "settings.xml", nullptr, rxContext,
|
||||
xStorage, xModelComp, "settings.xml", rxContext,
|
||||
pServices->mpSettings,
|
||||
aFilterArgs, aName, false );
|
||||
}
|
||||
|
||||
nRet = ReadThroughComponent(
|
||||
xStorage, xModelComp, "styles.xml", nullptr, rxContext,
|
||||
xStorage, xModelComp, "styles.xml", rxContext,
|
||||
pServices->mpStyles,
|
||||
aFilterArgs, aName, true );
|
||||
|
||||
if( !nRet && (meFilterMode != SdXMLFilterMode::Organizer) )
|
||||
nRet = ReadThroughComponent(
|
||||
xStorage, xModelComp, "content.xml", "Content.xml", rxContext,
|
||||
xStorage, xModelComp, "content.xml", rxContext,
|
||||
pServices->mpContent,
|
||||
aFilterArgs, aName, true );
|
||||
|
||||
|
@@ -636,8 +636,7 @@ IMPL_LINK_NOARG(SdTPAction, CheckFileHdl, weld::Widget&, void)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (xStorage->hasByName(pStarDrawXMLContent) ||
|
||||
xStorage->hasByName(pStarDrawOldXMLContent))
|
||||
if (xStorage->hasByName(pStarDrawXMLContent))
|
||||
{
|
||||
if (SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc(aFile))
|
||||
{
|
||||
|
@@ -717,16 +717,7 @@ bool SmDocShell::Load( SfxMedium& rMedium )
|
||||
if( SfxObjectShell::Load( rMedium ))
|
||||
{
|
||||
uno::Reference < embed::XStorage > xStorage = GetMedium()->GetStorage();
|
||||
if (
|
||||
(
|
||||
xStorage->hasByName( "content.xml" ) &&
|
||||
xStorage->isStreamElement( "content.xml" )
|
||||
) ||
|
||||
(
|
||||
xStorage->hasByName( "Content.xml" ) &&
|
||||
xStorage->isStreamElement( "Content.xml" )
|
||||
)
|
||||
)
|
||||
if (xStorage->hasByName("content.xml") && xStorage->isStreamElement("content.xml"))
|
||||
{
|
||||
// is this a fabulous math package ?
|
||||
Reference<css::frame::XModel> xModel(GetModel());
|
||||
|
@@ -195,7 +195,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium &rMedium)
|
||||
xStatusIndicator->setValue(nSteps++);
|
||||
|
||||
auto nWarn = ReadThroughComponent(
|
||||
rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml",
|
||||
rMedium.GetStorage(), xModelComp, "meta.xml",
|
||||
xContext, xInfoSet,
|
||||
(bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter"
|
||||
: "com.sun.star.comp.Math.XMLMetaImporter") );
|
||||
@@ -206,7 +206,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium &rMedium)
|
||||
xStatusIndicator->setValue(nSteps++);
|
||||
|
||||
nWarn = ReadThroughComponent(
|
||||
rMedium.GetStorage(), xModelComp, "settings.xml", nullptr,
|
||||
rMedium.GetStorage(), xModelComp, "settings.xml",
|
||||
xContext, xInfoSet,
|
||||
(bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter"
|
||||
: "com.sun.star.comp.Math.XMLSettingsImporter" ) );
|
||||
@@ -217,7 +217,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium &rMedium)
|
||||
xStatusIndicator->setValue(nSteps++);
|
||||
|
||||
nError = ReadThroughComponent(
|
||||
rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml",
|
||||
rMedium.GetStorage(), xModelComp, "content.xml",
|
||||
xContext, xInfoSet, "com.sun.star.comp.Math.XMLImporter" );
|
||||
}
|
||||
else
|
||||
@@ -351,7 +351,6 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(
|
||||
const uno::Reference< embed::XStorage >& xStorage,
|
||||
const Reference<XComponent>& xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
Reference<uno::XComponentContext> const & rxContext,
|
||||
Reference<beans::XPropertySet> const & rPropSet,
|
||||
const char* pFilterName )
|
||||
@@ -361,13 +360,6 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(
|
||||
|
||||
// open stream (and set parser input)
|
||||
OUString sStreamName = OUString::createFromAscii(pStreamName);
|
||||
if ( !xStorage->hasByName(sStreamName) || !xStorage->isStreamElement(sStreamName) )
|
||||
{
|
||||
// stream name not found! Then try the compatibility name.
|
||||
// do we even have an alternative name?
|
||||
if ( pCompatibilityStreamName )
|
||||
sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
|
||||
}
|
||||
|
||||
// get input stream
|
||||
try
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
const css::uno::Reference< css::embed::XStorage >& xStorage,
|
||||
const css::uno::Reference< css::lang::XComponent >& xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
css::uno::Reference< css::uno::XComponentContext > const & rxContext,
|
||||
css::uno::Reference< css::beans::XPropertySet > const & rPropSet,
|
||||
const char* pFilterName );
|
||||
|
@@ -1329,7 +1329,7 @@ void SmViewShell::Insert( SfxMedium& rMedium )
|
||||
uno::Reference <embed::XStorage> xStorage = rMedium.GetStorage();
|
||||
if (xStorage.is() && xStorage->getElementNames().hasElements())
|
||||
{
|
||||
if (xStorage->hasByName("content.xml") || xStorage->hasByName("Content.xml"))
|
||||
if (xStorage->hasByName("content.xml"))
|
||||
{
|
||||
// is this a fabulous math package ?
|
||||
Reference<css::frame::XModel> xModel(pDoc->GetModel());
|
||||
|
@@ -262,7 +262,6 @@ ErrCode ReadThroughComponent(
|
||||
uno::Reference<embed::XStorage> const & xStorage,
|
||||
uno::Reference<XComponent> const & xModelComponent,
|
||||
const char* pStreamName,
|
||||
const char* pCompatibilityStreamName,
|
||||
uno::Reference<uno::XComponentContext> const & rxContext,
|
||||
const char* pFilterName,
|
||||
const Sequence<Any>& rFilterArguments,
|
||||
@@ -285,25 +284,8 @@ ErrCode ReadThroughComponent(
|
||||
|
||||
if (!bContainsStream )
|
||||
{
|
||||
// stream name not found! Then try the compatibility name.
|
||||
// if no stream can be opened, return immediately with OK signal
|
||||
|
||||
// do we even have an alternative name?
|
||||
if ( nullptr == pCompatibilityStreamName )
|
||||
return ERRCODE_NONE;
|
||||
|
||||
// if so, does the stream exist?
|
||||
sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
|
||||
try
|
||||
{
|
||||
bContainsStream = xStorage->isStreamElement(sStreamName);
|
||||
}
|
||||
catch( container::NoSuchElementException& )
|
||||
{
|
||||
}
|
||||
|
||||
if (! bContainsStream )
|
||||
return ERRCODE_NONE;
|
||||
// stream name not found! return immediately with OK signal
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
// set Base URL
|
||||
@@ -823,7 +805,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
|
||||
|
||||
// #i103539#: always read meta.xml for generator
|
||||
ErrCode const nWarn = ReadThroughComponent(
|
||||
xStorage, xModelComp, "meta.xml", "Meta.xml", xContext,
|
||||
xStorage, xModelComp, "meta.xml", xContext,
|
||||
(bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter"
|
||||
: "com.sun.star.comp.Writer.XMLMetaImporter"),
|
||||
aEmptyArgs, rName, false );
|
||||
@@ -833,21 +815,21 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
|
||||
m_bInsertMode) )
|
||||
{
|
||||
nWarn2 = ReadThroughComponent(
|
||||
xStorage, xModelComp, "settings.xml", nullptr, xContext,
|
||||
xStorage, xModelComp, "settings.xml", xContext,
|
||||
(bOASIS ? "com.sun.star.comp.Writer.XMLOasisSettingsImporter"
|
||||
: "com.sun.star.comp.Writer.XMLSettingsImporter"),
|
||||
aFilterArgs, rName, false );
|
||||
}
|
||||
|
||||
nRet = ReadThroughComponent(
|
||||
xStorage, xModelComp, "styles.xml", nullptr, xContext,
|
||||
xStorage, xModelComp, "styles.xml", xContext,
|
||||
(bOASIS ? "com.sun.star.comp.Writer.XMLOasisStylesImporter"
|
||||
: "com.sun.star.comp.Writer.XMLStylesImporter"),
|
||||
aFilterArgs, rName, true );
|
||||
|
||||
if( !nRet && !(IsOrganizerMode() || m_aOption.IsFormatsOnly()) )
|
||||
nRet = ReadThroughComponent(
|
||||
xStorage, xModelComp, "content.xml", "Content.xml", xContext,
|
||||
xStorage, xModelComp, "content.xml", xContext,
|
||||
(bOASIS ? "com.sun.star.comp.Writer.XMLOasisContentImporter"
|
||||
: "com.sun.star.comp.Writer.XMLContentImporter"),
|
||||
aFilterArgs, rName, true );
|
||||
|
Reference in New Issue
Block a user