summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-03-01 16:05:30 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-12-04 07:17:09 +0000
commit02d54922c060a42190bbb5757433fc7189008a33 (patch)
treede6a3d4fd63d6bdbafbebe0776f62800f5d9aa86 /sc
parenta3330e1b9b1e196b59c65f0bedf1e071cb927682 (diff)
sw34bf04: #i103539#: always import meta.xml, to extract the BuildId:
SvXMLMetaDocumentContext: refactor to not require DocumentProperties, and always set the BuildId from the meta:generator element. {Sc,Sd,Sw}XMLImport::CreateMetaContext(): always create context. sc, sd: add OrganizerMode property to ODF import. Conflicts: sc/source/filter/xml/xmlimprt.cxx sc/source/filter/xml/xmlwrap.cxx
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx25
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx33
2 files changed, 42 insertions, 16 deletions
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 8f5a24e5cd90..688000e64138 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2137,13 +2137,15 @@ SvXMLImportContext *ScXMLImport::CreateMetaContext(
{
SvXMLImportContext* pContext = NULL;
- if( !IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
+ if (getImportFlags() & IMPORT_META)
{
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> const xDocProps(
+ (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
pContext = new SvXMLMetaDocumentContext(*this,
XML_NAMESPACE_OFFICE, rLocalName,
- xDPS->getDocumentProperties());
+ xDocProps);
}
if( !pContext )
@@ -2872,6 +2874,25 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
pSheetData->StoreInitialNamespaces(rNamespaces);
}
}
+
+ uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() );
+ uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo(
+ xImportInfo.is() ? xImportInfo->getPropertySetInfo() : 0);
+ if (xPropertySetInfo.is())
+ {
+ ::rtl::OUString const sOrganizerMode(
+ RTL_CONSTASCII_USTRINGPARAM("OrganizerMode"));
+ if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
+ {
+ sal_Bool bStyleOnly(sal_False);
+ if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
+ {
+ bLoadDoc = !bStyleOnly;
+ }
+ }
+ }
+
+ UnlockSolarMutex();
}
sal_Int32 ScXMLImport::GetRangeType(const rtl::OUString sRangeType) const
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 435006bab937..b1c4338cbfa5 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -361,6 +361,8 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError)
{ MAP_LEN( "BuildId" ), 0, &::getCppuType( (OUString *)0 ), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ MAP_LEN( "VBACompatibilityMode" ), 0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ MAP_LEN( "ScriptConfiguration" ), 0, &::getCppuType((uno::Reference<container::XNameAccess> *)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "OrganizerMode" ), 0, &::getBooleanCppuType(),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ NULL, 0, 0, NULL, 0, 0 }
};
@@ -420,26 +422,29 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError)
}
}
+ if (bStylesOnly)
+ {
+ ::rtl::OUString const sOrganizerMode(
+ RTL_CONSTASCII_USTRINGPARAM("OrganizerMode"));
+ xInfoSet->setPropertyValue(sOrganizerMode, uno::makeAny(sal_True));
+ }
+
sal_Bool bOasis = ( SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60 );
+ // #i103539#: always read meta.xml for generator
sal_uInt32 nMetaRetval(0);
- if(!bStylesOnly)
- {
- uno::Sequence<uno::Any> aMetaArgs(1);
- uno::Any* pMetaArgs = aMetaArgs.getArray();
- pMetaArgs[0] <<= xInfoSet;
+ uno::Sequence<uno::Any> aMetaArgs(1);
+ uno::Any* pMetaArgs = aMetaArgs.getArray();
+ pMetaArgs[0] <<= xInfoSet;
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import start" );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import start" );
- nMetaRetval = ImportFromComponent(xServiceFactory, xModel, xXMLParser, aParserInput,
- bOasis ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLOasisMetaImporter"))
- : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLMetaImporter")),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Meta.xml")), aMetaArgs,
- false);
+ nMetaRetval = ImportFromComponent(xServiceFactory, xModel, xXMLParser, aParserInput,
+ bOasis ? rtl::OUString("com.sun.star.comp.Calc.XMLOasisMetaImporter")
+ : rtl::OUString("com.sun.star.comp.Calc.XMLMetaImporter"),
+ "meta.xml", "Meta.xml", aMetaArgs, false);
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import end" );
- }
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import end" );
SvXMLGraphicHelper* pGraphicHelper = NULL;
uno::Reference< document::XGraphicObjectResolver > xGrfContainer;