[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/oox oox/CustomTarget_generated.mk oox/source sc/source writerfilter/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Tue Mar 11 03:40:28 PDT 2014
include/oox/core/contexthandler.hxx | 1
include/oox/core/filterbase.hxx | 5 -
include/oox/core/relations.hxx | 11 ++-
include/oox/core/xmlfilterbase.hxx | 2
include/oox/token/namespacemap.hxx | 11 ++-
oox/CustomTarget_generated.mk | 5 -
oox/source/core/contexthandler.cxx | 5 +
oox/source/core/fastparser.cxx | 19 ++++-
oox/source/core/filterdetect.cxx | 3
oox/source/core/relations.cxx | 37 ++++++++++
oox/source/core/xmlfilterbase.cxx | 36 +++++++++-
oox/source/docprop/ooxmldocpropimport.cxx | 9 ++
oox/source/drawingml/graphicshapecontext.cxx | 14 ++--
oox/source/ppt/dgmimport.cxx | 2
oox/source/ppt/pptimport.cxx | 4 -
oox/source/ppt/presentationfragmenthandler.cxx | 10 +-
oox/source/ppt/slidefragmenthandler.cxx | 4 -
oox/source/shape/ShapeContextHandler.cxx | 2
oox/source/token/namespacemap.cxx | 12 +++
oox/source/token/namespaces-strict.txt | 82 ++++++++++++++++++++++++
oox/source/token/namespaces.pl | 31 ++++++++-
sc/source/filter/inc/sheetdatabuffer.hxx | 2
sc/source/filter/oox/excelfilter.cxx | 2
sc/source/filter/oox/externallinkbuffer.cxx | 8 --
sc/source/filter/oox/sheetdatabuffer.cxx | 13 +++
sc/source/filter/oox/sheetdatacontext.cxx | 3
sc/source/filter/oox/workbookfragment.cxx | 17 ++--
sc/source/filter/oox/worksheetfragment.cxx | 8 +-
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 12 ++-
writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 32 +++++++++
30 files changed, 348 insertions(+), 54 deletions(-)
New commits:
commit 585bd120327508ad68816c8005cb36e1d3116351
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Feb 28 10:39:56 2014 +0100
handle OOXML strict namespaces
Change-Id: I198862388426161e3f054a5f128639c59f3c9d24
support OOXML strict documents in Calc
Conflicts:
oox/source/core/relations.cxx
Change-Id: I277d76aeec28e173d913ccc1506464afe4d09c6d
import date cells from OOXML
Change-Id: Id0b9ec034d559d489ca4ee2d1d6aca1bdf1beb9d
no need to add another layer of macros
Change-Id: I49992559a7d10127d55dbf0c7e257c86619fd8d6
fix one more relation type for OOXML strict
Change-Id: Ia63309271ac225883540ca0453fc5da21844d3ad
make more places aware of OOXML strict relations
Change-Id: I292217537eb592cbad9af11f87402baa9f4cc442
fix strict namespace list generation
The two perl scripts were apparently only generating the same order by
luck. It did not work on all systems.
Change-Id: Ib83ee5c6572d3bae2e2ac1846850bd65303e7d43
allow OOXML strict relationships in writer
Conflicts:
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
writerfilter/source/ooxml/OOXMLStreamImpl.cxx
Change-Id: I1c09280f68467748faedee19c4a66be3bc7d7aa3
make sure the two namespace lists are sorted the same way
Change-Id: I90b3182e10dbbfc8993010dd885509537d2fe537
fix OOXML strict chart import
Change-Id: I84a2fd575ced64d4774147063f13ebb8605c100f
add the xml strict namespaces to misc/namespaces.txt
Change-Id: Ie83b5c94f1f002851bff3b39b1d9b676a3e44aa1
Reviewed-on: https://gerrit.libreoffice.org/8515
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/include/oox/core/contexthandler.hxx b/include/oox/core/contexthandler.hxx
index 6111f98..468c8ce 100644
--- a/include/oox/core/contexthandler.hxx
+++ b/include/oox/core/contexthandler.hxx
@@ -71,6 +71,7 @@ public:
OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
/** Returns the full fragment path for the first relation of the passed type. */
OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rType ) const;
// com.sun.star.xml.sax.XFastContextHandler interface ---------------------
diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
index 6280f9d..03881fc 100644
--- a/include/oox/core/filterbase.hxx
+++ b/include/oox/core/filterbase.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_OOX_CORE_FILTERBASE_HXX
#define INCLUDED_OOX_CORE_FILTERBASE_HXX
-#include <memory>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
@@ -37,6 +36,8 @@
#include <oox/helper/storagebase.hxx>
#include <oox/dllapi.h>
+#include <boost/scoped_ptr.hpp>
+
namespace com { namespace sun { namespace star {
namespace awt { struct DeviceInfo; }
namespace frame { class XFrame; }
@@ -283,7 +284,7 @@ private:
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
private:
- ::std::auto_ptr< FilterBaseImpl > mxImpl;
+ boost::scoped_ptr< FilterBaseImpl > mxImpl;
};
// ============================================================================
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
index c94e293..05d00ad 100644
--- a/include/oox/core/relations.hxx
+++ b/include/oox/core/relations.hxx
@@ -30,11 +30,16 @@ namespace core {
// ============================================================================
-/** Expands to an OUString containing an 'officeDocument' relation type created
+/** Expands to an OUString containing an 'officeDocument' transitional relation type created
from the passed literal(!) ASCII(!) character array. */
#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+/** Expands to an OUString containing an 'officeDocument' strict relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE_STRICT( ascii ) \
+ ( "http://purl.oclc.org/ooxml/officeDocument/relationships/" ascii )
+
/** Expands to an OUString containing a 'package' relation type created from
the passed literal(!) ASCII(!) character array. */
#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
@@ -74,8 +79,11 @@ public:
const Relation* getRelationFromRelId( const OUString& rId ) const;
/** Returns the first relation with the passed type. */
const Relation* getRelationFromFirstType( const OUString& rType ) const;
+ /** Returns the first relation with the passed type. */
+ const Relation* getRelationFromFirstTypeFromOfficeDoc( const OUString& rType ) const;
/** Finds all relations associated with the passed type. */
RelationsRef getRelationsFromType( const OUString& rType ) const;
+ RelationsRef getRelationsFromTypeFromOfficeDoc( const OUString& rType ) const;
/** Returns the external target of the relation with the passed relation identifier. */
OUString getExternalTargetFromRelId( const OUString& rRelId ) const;
@@ -88,6 +96,7 @@ public:
OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
/** Returns the full fragment path for the first relation of the passed type. */
OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rType ) const;
private:
OUString maFragmentPath;
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index 604f220..351910d 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -101,6 +101,8 @@ public:
used for fragments referred by the root relations. */
OUString getFragmentPathFromFirstType( const OUString& rType );
+ OUString getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rPart );
+
/** Imports a fragment using the passed fragment handler, which contains
the full path to the fragment stream.
diff --git a/include/oox/token/namespacemap.hxx b/include/oox/token/namespacemap.hxx
index 2d2f2f3..cf1d0fd 100644
--- a/include/oox/token/namespacemap.hxx
+++ b/include/oox/token/namespacemap.hxx
@@ -29,7 +29,16 @@ namespace oox {
// ============================================================================
/** A map that contains all XML namespace URLs used in the filters. */
-struct NamespaceMap : public ::std::map< sal_Int32, OUString > { NamespaceMap(); };
+struct NamespaceMap
+{
+ std::map< sal_Int32, OUString > maTransitionalNamespaceMap;
+ std::map< sal_Int32, OUString > maStrictNamespaceMap;
+
+ NamespaceMap();
+
+ typedef std::map< sal_Int32, OUString >::iterator iterator;
+ typedef std::map< sal_Int32, OUString >::const_iterator const_iterator;
+};
/** Thread-save singleton of a map of all supported XML namespace URLs. */
struct StaticNamespaceMap : public ::rtl::Static< NamespaceMap, StaticNamespaceMap > {};
diff --git a/oox/CustomTarget_generated.mk b/oox/CustomTarget_generated.mk
index 92c8bf8..14789d6 100644
--- a/oox/CustomTarget_generated.mk
+++ b/oox/CustomTarget_generated.mk
@@ -27,7 +27,7 @@ $(oox_INC)/tokenhash.inc : $(oox_MISC)/tokenhash.gperf
$(GPERF) --compare-strncmp $< | sed -e 's/(char\*)0/(char\*)0, 0/g' | grep -v '^#line' > $@
define oox_GenTarget
-$(oox_MISC)/$(2)ids.inc $(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) : \
+$(oox_MISC)/$(2)ids.inc $(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) $(if $(4),$(oox_INC)/$(4)names.inc) : \
$(oox_GENHEADERPATH)/$(1).hxx
@touch $$@
@@ -37,12 +37,13 @@ $(oox_GENHEADERPATH)/$(1).hxx : $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt \
mkdir -p $(oox_MISC) $(oox_INC) $(oox_GENHEADERPATH)
perl $(oox_SRC)/$(1).pl $(oox_SRC)/$(1).txt $(oox_MISC)/$(2)ids.inc \
$(oox_INC)/$(2)names.inc $(if $(3),$(oox_MISC)/$(3)) \
+ $(if $(4),$(oox_SRC)/$(4).txt $(oox_INC)/$(4)names.inc) \
&& cat $(oox_SRC)/$(1).hxx.head $(oox_MISC)/$(2)ids.inc \
$(oox_SRC)/$(1).hxx.tail > $(oox_GENHEADERPATH)/$(1).hxx \
&& touch $$@
endef
-$(eval $(call oox_GenTarget,namespaces,namespace,namespaces.txt))
+$(eval $(call oox_GenTarget,namespaces,namespace,namespaces.txt,namespaces-strict))
$(eval $(call oox_GenTarget,properties,property,))
$(eval $(call oox_GenTarget,tokens,token,tokenhash.gperf))
diff --git a/oox/source/core/contexthandler.cxx b/oox/source/core/contexthandler.cxx
index 2d41797..ed80a55 100644
--- a/oox/source/core/contexthandler.cxx
+++ b/oox/source/core/contexthandler.cxx
@@ -77,6 +77,11 @@ OUString ContextHandler::getFragmentPathFromFirstType( const OUString& rType ) c
return mxBaseData->mxRelations->getFragmentPathFromFirstType( rType );
}
+OUString ContextHandler::getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rType ) const
+{
+ return mxBaseData->mxRelations->getFragmentPathFromFirstTypeFromOfficeDoc( rType );
+}
+
void ContextHandler::implSetLocator( const Reference< XLocator >& rxLocator )
{
mxBaseData->mxLocator = rxLocator;
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 70e12a8..2a62a8c 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -92,11 +92,19 @@ void FastParser::registerNamespace( sal_Int32 nNamespaceId ) throw( IllegalArgum
if( !mxParser.is() )
throw RuntimeException();
- const OUString* pNamespaceUrl = ContainerHelper::getMapElement( mrNamespaceMap, nNamespaceId );
+ // add handling for OOXML strict here
+ const OUString* pNamespaceUrl = ContainerHelper::getMapElement( mrNamespaceMap.maTransitionalNamespaceMap, nNamespaceId );
if( !pNamespaceUrl )
throw IllegalArgumentException();
mxParser->registerNamespace( *pNamespaceUrl, nNamespaceId );
+
+ //also register the OOXML strict namespaces for the same id
+ const OUString* pNamespaceStrictUrl = ContainerHelper::getMapElement( mrNamespaceMap.maStrictNamespaceMap, nNamespaceId );
+ if(pNamespaceStrictUrl && (*pNamespaceUrl != *pNamespaceStrictUrl))
+ {
+ mxParser->registerNamespace( *pNamespaceStrictUrl, nNamespaceId );
+ }
}
void FastParser::setDocumentHandler( const Reference< XFastDocumentHandler >& rxDocHandler ) throw( RuntimeException )
@@ -148,9 +156,16 @@ bool FastParser::hasNamespaceURL( const OUString& rPrefix ) const
sal_Int32 FastParser::getNamespaceId( const OUString& rUrl )
{
- for( NamespaceMap::const_iterator aIt = mrNamespaceMap.begin(), aEnd = mrNamespaceMap.end(); aIt != aEnd; ++aIt )
+ for( NamespaceMap::const_iterator aIt = mrNamespaceMap.maTransitionalNamespaceMap.begin(),
+ aEnd = mrNamespaceMap.maTransitionalNamespaceMap.end(); aIt != aEnd; ++aIt )
if( rUrl == aIt->second )
return aIt->first;
+
+ for( NamespaceMap::const_iterator aIt = mrNamespaceMap.maStrictNamespaceMap.begin(),
+ aEnd = mrNamespaceMap.maStrictNamespaceMap.end(); aIt != aEnd; ++aIt )
+ if( rUrl == aIt->second )
+ return aIt->first;
+
return 0;
}
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 0c68966..03eb80d 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -155,7 +155,8 @@ void SAL_CALL FilterDetectDocHandler::processingInstruction(
void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs )
{
OUString aType = rAttribs.getString( XML_Type, OUString() );
- if ( aType == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" )
+ if ( aType == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" // OOXML Transitional
+ || aType == "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument" ) //OOXML strict
{
Reference<XUriReferenceFactory> xFactory = UriReferenceFactory::create( mxContext );
try
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index b00fcea..78bb779 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -43,7 +43,20 @@ OUString lclAppendFileName( const OUString& rPath, const OUString& rFileName )
OUStringBuffer( rPath ).append( '/' ).append( rFileName ).makeStringAndClear();
}
-} // namespace
+OUString createOfficeDocRelationTypeTransitional(const OUString& rType)
+{
+ static const OUString aTransitionalBase("http://schemas.openxmlformats.org/officeDocument/2006/relationships/");
+ return aTransitionalBase + rType;
+}
+
+OUString createOfficeDocRelationTypeStrict(const OUString& rType)
+{
+ static const OUString aStrictBase("http://purl.oclc.org/ooxml/officeDocument/relationships/");
+ return aStrictBase + rType;
+}
+
+}
+
// ============================================================================
@@ -75,6 +88,16 @@ RelationsRef Relations::getRelationsFromType( const OUString& rType ) const
return xRelations;
}
+RelationsRef Relations::getRelationsFromTypeFromOfficeDoc( const OUString& rType ) const
+{
+ RelationsRef xRelations( new Relations( maFragmentPath ) );
+ for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( aIt->second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeTransitional(rType) ) ||
+ aIt->second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeStrict(rType) ))
+ (*xRelations)[ aIt->first ] = aIt->second;
+ return xRelations;
+}
+
OUString Relations::getExternalTargetFromRelId( const OUString& rRelId ) const
{
const Relation* pRelation = getRelationFromRelId( rRelId );
@@ -132,7 +155,17 @@ OUString Relations::getFragmentPathFromFirstType( const OUString& rType ) const
return pRelation ? getFragmentPathFromRelation( *pRelation ) : OUString();
}
-// ============================================================================
+OUString Relations::getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rType ) const
+{
+ OUString aTransitionalType(createOfficeDocRelationTypeTransitional(rType));
+ const Relation* pRelation = getRelationFromFirstType( aTransitionalType );
+ if(!pRelation)
+ {
+ OUString aStrictType = createOfficeDocRelationTypeStrict(rType);
+ pRelation = getRelationFromFirstType( aStrictType );
+ }
+ return pRelation ? getFragmentPathFromRelation( *pRelation ) : OUString();
+}
} // namespace core
} // namespace oox
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index c0a016d..cf996eb 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -120,16 +120,16 @@ struct NamespaceIds: public rtl::StaticWithInit<
NMSP_dmlDiagram,
NMSP_dmlChart,
NMSP_dmlChartDr,
- NMSP_dmlSpreadDr,
NMSP_vml,
NMSP_vmlOffice,
NMSP_vmlWord,
NMSP_vmlExcel,
NMSP_vmlPowerpoint,
- NMSP_xls,
- NMSP_ppt,
NMSP_ax,
+ NMSP_xls,
NMSP_xm,
+ NMSP_dmlSpreadDr,
+ NMSP_ppt,
NMSP_mce,
NMSP_mceTest,
NMSP_dsp,
@@ -236,6 +236,36 @@ OUString XmlFilterBase::getFragmentPathFromFirstType( const OUString& rType )
return importRelations( OUString() )->getFragmentPathFromFirstType( rType );
}
+namespace {
+
+OUString getTransitionalRelationshipOfficeDocType(const OUString& rPart)
+{
+ static const OUString aBase("http://schemas.openxmlformats.org/officeDocument/2006/relationships/");
+ return aBase + rPart;
+}
+
+OUString getStrictRelationshipOfficeDocType(const OUString& rPart)
+{
+ static const OUString aBase("http://purl.oclc.org/ooxml/officeDocument/relationships/");
+ return aBase + rPart;
+}
+
+}
+
+OUString XmlFilterBase::getFragmentPathFromFirstTypeFromOfficeDoc( const OUString& rPart )
+{
+ // importRelations() caches the relations map for subsequence calls
+ const OUString aTransitionalRelationshipType = getTransitionalRelationshipOfficeDocType(rPart);
+ OUString aFragment = importRelations( OUString() )->getFragmentPathFromFirstType( aTransitionalRelationshipType );
+ if(aFragment.isEmpty())
+ {
+ const OUString aStrictRelationshipType = getStrictRelationshipOfficeDocType(rPart);
+ aFragment = importRelations( OUString() )->getFragmentPathFromFirstType( aStrictRelationshipType );
+ }
+
+ return aFragment;
+}
+
bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHandler )
{
return importFragment(rxHandler, mxImpl->maFastParser);
diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx
index 2361bd1..b3b1ae6 100644
--- a/oox/source/docprop/ooxmldocpropimport.cxx
+++ b/oox/source/docprop/ooxmldocpropimport.cxx
@@ -131,12 +131,21 @@ void SAL_CALL DocumentPropertiesImport::importProperties(
throw IllegalArgumentException();
Sequence< InputSource > aCoreStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "metadata/core-properties" ) );
+ // OOXML strict
+ if( !aCoreStreams.hasElements() )
+ aCoreStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "metadata/core-properties" ) );
// MS Office seems to have a bug, so we have to do similar handling
if( !aCoreStreams.hasElements() )
aCoreStreams = lclGetRelatedStreams( rxSource, CREATE_PACKAGE_RELATION_TYPE( "metadata/core-properties" ) );
Sequence< InputSource > aExtStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "extended-properties" ) );
+ // OOXML strict
+ if( !aExtStreams.hasElements() )
+ aExtStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "extended-properties" ) );
Sequence< InputSource > aCustomStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "custom-properties" ) );
+ // OOXML strict
+ if( !aCustomStreams.hasElements() )
+ aCustomStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "custom-properties" ) );
if( aCoreStreams.hasElements() || aExtStreams.hasElements() || aCustomStreams.hasElements() )
{
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 4cf3366..e0818ac 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -122,17 +122,21 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme
case XML_graphicData : // CT_GraphicalObjectData
{
OUString sUri( rAttribs.getString( XML_uri ).get() );
- if ( sUri == "http://schemas.openxmlformats.org/presentationml/2006/ole" )
+ if ( sUri == "http://schemas.openxmlformats.org/presentationml/2006/ole" ||
+ sUri == "http://purl.oclc.org/ooxml/presentationml/ole" )
return new OleObjectGraphicDataContext( *this, mpShapePtr );
- else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/diagram" )
+ else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/diagram" ||
+ sUri == "http://purl.oclc.org/ooxml/drawingml/diagram" )
return new DiagramGraphicDataContext( *this, mpShapePtr );
- else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/chart" )
+ else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/chart" ||
+ sUri == "http://purl.oclc.org/ooxml/drawingml/chart" )
return new ChartGraphicDataContext( *this, mpShapePtr, mbEmbedShapesInChart );
- else if ( sUri.equalsAscii( "http://schemas.openxmlformats.org/drawingml/2006/table" ) )
+ else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/table" ||
+ sUri == "http://purl.oclc.org/ooxml/drawingml/table" )
return new table::TableContext( *this, mpShapePtr );
else
{
- OSL_TRACE( "OOX: Ignore graphicsData of %s", OUSTRING_TO_CSTR( sUri ) );
+ SAL_WARN("oox", "OOX: Ignore graphicsData of :" << sUri );
return 0;
}
}
diff --git a/oox/source/ppt/dgmimport.cxx b/oox/source/ppt/dgmimport.cxx
index 10d1614..602fb72 100644
--- a/oox/source/ppt/dgmimport.cxx
+++ b/oox/source/ppt/dgmimport.cxx
@@ -60,7 +60,7 @@ bool QuickDiagrammingImport::importDocument() throw()
OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
OUString aEmpty;
- OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "diagramLayout" ) );
+ OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "diagramLayout" );
Reference<drawing::XShapes> xParentShape(getParentShape(),
UNO_QUERY_THROW);
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 285ac2a..fc9dadf 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -77,9 +77,9 @@ bool PowerPointImport::importDocument() throw()
file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
- OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "officeDocument" ) );
+ OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" );
FragmentHandlerRef xPresentationFragmentHandler( new PresentationFragmentHandler( *this, aFragmentPath ) );
- maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "tableStyles" ) );
+ maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "tableStyles" );
return importFragment( xPresentationFragmentHandler );
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 826130c..4e400f1 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -163,13 +163,13 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, sal_Bool bFirst
FragmentHandlerRef xSlideFragmentHandler( new SlideFragmentHandler( rFilter, aSlideFragmentPath, pSlidePersistPtr, Slide ) );
// importing the corresponding masterpage/layout
- OUString aLayoutFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideLayout" ) );
- OUString aCommentFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) );
+ OUString aLayoutFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "slideLayout" );
+ OUString aCommentFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "comments" );
if ( !aLayoutFragmentPath.isEmpty() )
{
// importing layout
RelationsRef xLayoutRelations = rFilter.importRelations( aLayoutFragmentPath );
- OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideMaster" ) );
+ OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstTypeFromOfficeDoc( "slideMaster" );
if( !aMasterFragmentPath.isEmpty() )
{
// check if the corresponding masterpage+layout has already been imported
@@ -204,7 +204,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, sal_Bool bFirst
FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) );
// set the correct theme
- OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
+ OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "theme" );
if( !aThemeFragmentPath.isEmpty() )
{
std::map< OUString, oox::drawingml::ThemePtr >& rThemes( rFilter.getThemes() );
@@ -255,7 +255,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, sal_Bool bFirst
if(bImportNotesPage) {
// now importing the notes page
- OUString aNotesFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "notesSlide" ) );
+ OUString aNotesFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "notesSlide" );
if( !aNotesFragmentPath.isEmpty() )
{
Reference< XPresentationPage > xPresentationPage( xSlide, UNO_QUERY );
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 7ae3b0f..07076a0 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -54,7 +54,7 @@ SlideFragmentHandler::SlideFragmentHandler( XmlFilterBase& rFilter, const OUStri
, mpSlidePersistPtr( pPersistPtr )
, meShapeLocation( eShapeLocation )
{
- OUString aVMLDrawingFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "vmlDrawing" ) );
+ OUString aVMLDrawingFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "vmlDrawing" );
if( !aVMLDrawingFragmentPath.isEmpty() )
getFilter().importFragment( new oox::vml::DrawingFragment(
getFilter(), aVMLDrawingFragmentPath, *pPersistPtr->getDrawing() ) );
@@ -87,7 +87,7 @@ SlideFragmentHandler::~SlideFragmentHandler() throw()
{
// Import notesMaster
PowerPointImport& rFilter = dynamic_cast< PowerPointImport& >( getFilter() );
- OUString aNotesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "notesMaster" ) );
+ OUString aNotesFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "notesMaster" );
std::vector< SlidePersistPtr >& rMasterPages( rFilter.getMasterPages() );
std::vector< SlidePersistPtr >::iterator aIter( rMasterPages.begin() );
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 8286def..54fed81 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -246,7 +246,7 @@ void SAL_CALL ShapeContextHandler::startFastElement
if (!msRelationFragmentPath.isEmpty())
{
FragmentHandlerRef rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
- OUString aThemeFragmentPath = rFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
+ OUString aThemeFragmentPath = rFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "theme" );
if(!aThemeFragmentPath.isEmpty())
{
uno::Reference<xml::sax::XFastSAXSerializable> xDoc(mxFilterBase->importFragment(aThemeFragmentPath), uno::UNO_QUERY_THROW);
diff --git a/oox/source/token/namespacemap.cxx b/oox/source/token/namespacemap.cxx
index faa9f6b..3f582db 100644
--- a/oox/source/token/namespacemap.cxx
+++ b/oox/source/token/namespacemap.cxx
@@ -32,8 +32,18 @@ NamespaceMap::NamespaceMap()
{ -1, "" }
};
+ static const struct NamespaceStrictUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceStrictUrls[] =
+ {
+// include auto-generated C array with namespace URLs as C strings
+#include "namespaces-strictnames.inc"
+ { -1, "" }
+ };
+
for( const NamespaceUrl* pNamespaceUrl = spNamespaceUrls; pNamespaceUrl->mnId != -1; ++pNamespaceUrl )
- operator[]( pNamespaceUrl->mnId ) = OUString::createFromAscii( pNamespaceUrl->mpcUrl );
+ maTransitionalNamespaceMap[ pNamespaceUrl->mnId ] = OUString::createFromAscii( pNamespaceUrl->mpcUrl );
+
+ for( const NamespaceStrictUrl* pNamespaceUrl = spNamespaceStrictUrls; pNamespaceUrl->mnId != -1; ++pNamespaceUrl )
+ maStrictNamespaceMap[ pNamespaceUrl->mnId ] = OUString::createFromAscii( pNamespaceUrl->mpcUrl );
}
}
diff --git a/oox/source/token/namespaces-strict.txt b/oox/source/token/namespaces-strict.txt
new file mode 100644
index 0000000..9549483
--- /dev/null
+++ b/oox/source/token/namespaces-strict.txt
@@ -0,0 +1,82 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+# generic XML -----------------------------------------------------------------
+
+xml http://www.w3.org/XML/1998/namespace
+schema http://purl.oclc.org/ooxml/schemaLibrary/main
+
+# package ---------------------------------------------------------------------
+
+packageContentTypes http://schemas.openxmlformats.org/package/2006/content-types
+packageMetaCorePr http://schemas.openxmlformats.org/package/2006/metadata/core-properties
+packageRel http://schemas.openxmlformats.org/package/2006/relationships
+
+# office shared ---------------------------------------------------------------
+
+officeCustomPr http://purl.oclc.org/ooxml/officeDocument/custom-properties
+officeDocPropsVT http://purl.oclc.org/ooxml/officeDocument/docPropsVTypes
+officeExtPr http://purl.oclc.org/ooxml/officeDocument/extended-properties
+officeMath http://purl.oclc.org/ooxml/officeDocument/math
+officeRel http://purl.oclc.org/ooxml/officeDocument/relationships
+officeRelTheme http://purl.oclc.org/ooxml/officeDocument/relationships/theme
+
+# applications ----------------------------------------------------------------
+
+doc http://purl.oclc.org/ooxml/wordprocessingml/main
+xls http://purl.oclc.org/ooxml/spreadsheetml/main
+ppt http://purl.oclc.org/ooxml/presentationml/main
+
+# drawing ---------------------------------------------------------------------
+
+dml http://purl.oclc.org/ooxml/drawingml/main
+dsp http://schemas.microsoft.com/office/drawing/2008/diagram
+dmlChart http://purl.oclc.org/ooxml/drawingml/chart
+dmlChartDr http://purl.oclc.org/ooxml/drawingml/chartDrawing
+dmlDiagram http://purl.oclc.org/ooxml/drawingml/diagram
+dmlLockedCanvas http://purl.oclc.org/ooxml/drawingml/lockedCanvas
+dmlPicture http://purl.oclc.org/ooxml/drawingml/picture
+dmlSpreadDr http://purl.oclc.org/ooxml/drawingml/spreadsheetDrawing
+dmlWordDr http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing
+
+# VML -------------------------------------------------------------------------
+
+vml urn:schemas-microsoft-com:vml
+vmlExcel urn:schemas-microsoft-com:office:excel
+vmlOffice urn:schemas-microsoft-com:office:office
+vmlPowerpoint urn:schemas-microsoft-com:office:powerpoint
+vmlWord urn:schemas-microsoft-com:office:word
+
+# other -----------------------------------------------------------------------
+
+ax http://schemas.microsoft.com/office/2006/activeX
+dc http://purl.org/dc/elements/1.1/
+dcTerms http://purl.org/dc/terms/
+xm http://schemas.microsoft.com/office/excel/2006/main
+sprm http://sprm
+mce http://schemas.openxmlformats.org/markup-compatibility/2006
+mceTest http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2
+wps http://schemas.microsoft.com/office/word/2010/wordprocessingShape
+wpg http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
+wp14 http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
+w14 http://schemas.microsoft.com/office/word/2010/wordml
+
+# extlst namespaces
+
+# xlsExtLst for features introduced by excel 2010
+xlsExtLst http://schemas.microsoft.com/office/spreadsheetml/2009/9/main
diff --git a/oox/source/token/namespaces.pl b/oox/source/token/namespaces.pl
index 25ffdc2..c3dbb10 100644
--- a/oox/source/token/namespaces.pl
+++ b/oox/source/token/namespaces.pl
@@ -20,6 +20,8 @@ $ARGV0 = shift @ARGV;
$ARGV1 = shift @ARGV;
$ARGV2 = shift @ARGV;
$ARGV3 = shift @ARGV;
+$ARGV4 = shift @ARGV;
+$ARGV5 = shift @ARGV;
# parse input file
@@ -44,11 +46,35 @@ while( <INFILE> )
}
close( INFILE );
+# OOXML strict namespaces
+
+open( INFILE_STRICT, $ARGV4 ) or die "cannot open input file: $!";
+my %namespaces_strict;
+while( <INFILE_STRICT> )
+{
+ # trim newline
+ chomp( $_ );
+ # trim leading/trailing whitespace
+ $_ =~ s/^\s*//g;
+ $_ =~ s/\s*$//g;
+ # trim comments
+ $_ =~ s/^#.*//;
+ # skip empty lines
+ if( $_ )
+ {
+ # check for valid characters
+ $_ =~ /^([a-zA-Z][a-zA-Z0-9]*)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data";
+ $namespaces_strict{$1} = $2;
+ }
+}
+close( INFILE_STRICT );
+
# generate output files
open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
open( TXTFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!";
+open( NAMEFILE_STRICT, ">$ARGV5" ) or die "Error: cannot open output file: $!";
# number of bits to shift the namespace identifier
$shift = 16;
@@ -61,10 +87,13 @@ foreach( keys( %namespaces ) )
print( IDFILE "const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n" );
$id = $i << $shift;
print( NAMEFILE "{ $id, \"$namespaces{$_}\" },\n" );
+ print( NAMEFILE_STRICT "{ $id, \"$namespaces_strict{$_}\" },\n" );
print( TXTFILE "$id $_ $namespaces{$_}\n" );
+ print( TXTFILE "$id $_ $namespaces_strict{$_}\n" );
++$i;
}
close( IDFILE );
-close( nameFILE );
+close( NAMEFILE );
+close( NAMEFILE_STRICT );
close( TXTFILE );
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index ceb3a80..f84f91c 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -133,6 +133,8 @@ public:
void setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode );
/** Inserts a formula cell into the sheet. */
void setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens );
+ /** Inserts a ISO 8601 date cell into the sheet. */
+ void setDateCell( const CellModel& rModel, const OUString& rDateString );
/** Inserts the passed token array as array formula. */
void createArrayFormula(
diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index dc6fadb..6c2d6bd 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -101,7 +101,7 @@ bool ExcelFilter::importDocument() throw()
this variable (nonpro only). */
//OOX_DUMP_FILE( ::oox::dump::xlsb::Dumper );
- OUString aWorkbookPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "officeDocument" ) );
+ OUString aWorkbookPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" );
if( aWorkbookPath.isEmpty() )
return false;
diff --git a/sc/source/filter/oox/externallinkbuffer.cxx b/sc/source/filter/oox/externallinkbuffer.cxx
index c454ae89..5175527 100644
--- a/sc/source/filter/oox/externallinkbuffer.cxx
+++ b/sc/source/filter/oox/externallinkbuffer.cxx
@@ -563,19 +563,17 @@ ExternalNameRef ExternalLink::getNameByIndex( sal_Int32 nIndex ) const
// private --------------------------------------------------------------------
-#define OOX_TARGETTYPE_EXTLINK CREATE_OFFICEDOC_RELATION_TYPE( "externalLinkPath" )
-#define OOX_TARGETTYPE_LIBRARY CREATE_MSOFFICE_RELATION_TYPE( "xlExternalLinkPath/xlLibrary" )
-
void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUString& rTargetType )
{
meLinkType = LINKTYPE_UNKNOWN;
- if( rTargetType == OOX_TARGETTYPE_EXTLINK )
+ if( rTargetType == CREATE_OFFICEDOC_RELATION_TYPE( "externalLinkPath" ) ||
+ rTargetType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "externalLinkPath" ) )
{
maTargetUrl = getBaseFilter().getAbsoluteUrl( rTargetUrl );
if( !maTargetUrl.isEmpty() )
meLinkType = LINKTYPE_EXTERNAL;
}
- else if( rTargetType == OOX_TARGETTYPE_LIBRARY )
+ else if( rTargetType == CREATE_MSOFFICE_RELATION_TYPE( "xlExternalLinkPath/xlLibrary" ) )
{
meLinkType = LINKTYPE_LIBRARY;
meFuncLibType = getFormulaParser().getFuncLibTypeFromLibraryName( rTargetUrl );
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 70787ad..b3963df 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -223,6 +223,19 @@ void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCod
setCellFormat( rModel );
}
+void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& rDateString )
+{
+ ScDocument& rDoc = getScDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
+
+ double fValue = 0.0;
+ sal_uInt32 nFormatIndex;
+ bool bValid = pFormatter->IsNumberFormat( rDateString, nFormatIndex, fValue );
+
+ if(bValid)
+ setValueCell( rModel, fValue );
+}
+
void SheetDataBuffer::setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens )
{
mbPendingSharedFmla = false;
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index 227c1d9..c22930f 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -215,6 +215,9 @@ void SheetDataContext::onEndElement()
case XML_s:
mrSheetData.setStringCell( maCellData, maCellValue.toInt32() );
break;
+ case XML_d:
+ mrSheetData.setDateCell( maCellData, maCellValue );
+ break;
}
else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr.get() )
{
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index f4847cf..bf42f46 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -361,26 +361,26 @@ void WorkbookFragment::finalizeImport()
ISegmentProgressBarRef xGlobalSegment = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS );
// read the theme substream
- OUString aThemeFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
+ OUString aThemeFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "theme" );
if( !aThemeFragmentPath.isEmpty() )
importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme() ) );
xGlobalSegment->setPosition( 0.25 );
// read the styles substream (requires finalized theme buffer)
- OUString aStylesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "styles" ) );
+ OUString aStylesFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "styles" );
if( !aStylesFragmentPath.isEmpty() )
importOoxFragment( new StylesFragment( *this, aStylesFragmentPath ) );
xGlobalSegment->setPosition( 0.5 );
// read the shared string table substream (requires finalized styles buffer)
- OUString aSstFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "sharedStrings" ) );
+ OUString aSstFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "sharedStrings" );
if( !aSstFragmentPath.isEmpty() )
if (!importOoxFragment( new SharedStringsFragment( *this, aSstFragmentPath ) ))
importOoxFragment(new SharedStringsFragment(*this, aSstFragmentPath.replaceFirst("sharedStrings","SharedStrings")));
xGlobalSegment->setPosition( 0.75 );
// read the connections substream
- OUString aConnFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "connections" ) );
+ OUString aConnFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "connections" );
if( !aConnFragmentPath.isEmpty() )
importOoxFragment( new ConnectionsFragment( *this, aConnFragmentPath ) );
xGlobalSegment->setPosition( 1.0 );
@@ -415,14 +415,17 @@ void WorkbookFragment::finalizeImport()
// get the sheet type according to the relations type
WorksheetType eSheetType = SHEETTYPE_EMPTYSHEET;
- if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "worksheet" ) )
+ if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "worksheet" ) ||
+ pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "worksheet" ))
eSheetType = SHEETTYPE_WORKSHEET;
- else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "chartsheet" ) )
+ else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "chartsheet" ) ||
+ pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT( "chartsheet" ))
eSheetType = SHEETTYPE_CHARTSHEET;
else if( (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlMacrosheet" )) ||
(pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlIntlMacrosheet" )) )
eSheetType = SHEETTYPE_MACROSHEET;
- else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "dialogsheet" ) )
+ else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "dialogsheet" ) ||
+ pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE_STRICT(" dialogsheet" ))
eSheetType = SHEETTYPE_DIALOGSHEET;
OSL_ENSURE( eSheetType != SHEETTYPE_EMPTYSHEET, "WorkbookFragment::finalizeImport - unknown sheet type" );
if( eSheetType != SHEETTYPE_EMPTYSHEET )
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 927eb2b..8aef6c3 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -202,12 +202,12 @@ WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUSt
WorksheetFragmentBase( rHelper, rFragmentPath )
{
// import data tables related to this worksheet
- RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "table" ) );
+ RelationsRef xTableRels = getRelations().getRelationsFromTypeFromOfficeDoc( "table" );
for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
importOoxFragment( new TableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
// import comments related to this worksheet
- OUString aCommentsFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) );
+ OUString aCommentsFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "comments" );
if( !aCommentsFragmentPath.isEmpty() )
importOoxFragment( new CommentsFragment( *this, aCommentsFragmentPath ) );
}
@@ -472,12 +472,12 @@ void WorksheetFragment::initializeImport()
initializeWorksheetImport();
// import query table fragments related to this worksheet
- RelationsRef xQueryRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "queryTable" ) );
+ RelationsRef xQueryRels = getRelations().getRelationsFromTypeFromOfficeDoc( "queryTable" );
for( Relations::const_iterator aIt = xQueryRels->begin(), aEnd = xQueryRels->end(); aIt != aEnd; ++aIt )
importOoxFragment( new QueryTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
// import pivot table fragments related to this worksheet
- RelationsRef xPivotRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "pivotTable" ) );
+ RelationsRef xPivotRels = getRelations().getRelationsFromTypeFromOfficeDoc( "pivotTable" );
for( Relations::const_iterator aIt = xPivotRels->begin(), aEnd = xPivotRels->end(); aIt != aEnd; ++aIt )
importOoxFragment( new PivotTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
}
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index f272375..fdc0531 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -475,7 +475,8 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream)
mxRelationshipAccess.set((*dynamic_cast<OOXMLStreamImpl *>(mpStream.get())).accessDocumentStream(), uno::UNO_QUERY_THROW);
if (mxRelationshipAccess.is())
{
- OUString sCustomType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml");
+ static const OUString sCustomType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml");
+ static const OUString sCustomTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/customXml");
OUString sTarget("Target");
bool bFound = false;
sal_Int32 counter = 0;
@@ -491,7 +492,8 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream)
beans::StringPair aPair = aSeq[i];
// Need to resolve only customxml files from document relationships.
// Skipping other files.
- if (aPair.Second.compareTo(sCustomType) == 0)
+ if (aPair.Second.compareTo(sCustomType) == 0 ||
+ aPair.Second.compareTo(sCustomTypeStrict) == 0)
bFound = true;
else if(aPair.First.compareTo(sTarget) == 0 && bFound)
{
@@ -530,7 +532,8 @@ void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream)
mxRelationshipAccess.set((*dynamic_cast<OOXMLStreamImpl *>(mpStream.get())).accessDocumentStream(), uno::UNO_QUERY_THROW);
if (mxRelationshipAccess.is())
{
- OUString sCustomType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/control");
+ static const OUString sCustomType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/control");
+ static const OUString sCustomTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/control");
OUString sTarget("Target");
bool bFound = false;
sal_Int32 counter = 0;
@@ -546,7 +549,8 @@ void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream)
beans::StringPair aPair = aSeq[i];
// Need to resolve only ActiveX files from document relationships.
// Skipping other files.
- if (aPair.Second.compareTo(sCustomType) == 0)
+ if (aPair.Second.compareTo(sCustomType) == 0 ||
+ aPair.Second.compareTo(sCustomTypeStrict) == 0)
bFound = true;
else if(aPair.First.compareTo(sTarget) == 0 && bFound)
{
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index dd68754..90a9072 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -115,56 +115,85 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess>
static OUString sActiveXType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/control");
static OUString sActiveXBinType("http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary");
static OUString sSettingsType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings");
+ // OOXML strict
+ static OUString sDocumentTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument");
+ static OUString sStylesTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/styles");
+ static OUString sNumberingTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/numbering");
+ static OUString sFonttableTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable");
+ static OUString sFootnotesTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes");
+ static OUString sEndnotesTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes");
+ static OUString sCommentsTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/comments");
+ static OUString sThemeTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/theme");
+ static OUString sCustomTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/customXml");
+ static OUString sCustomPropsTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/customXmlProps");
+ static OUString sActiveXTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/control");
+ static OUString sGlossaryTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/glossaryDocument");
+ static OUString sSettingsTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/settings");
static OUString sTarget("Target");
static OUString sTargetMode("TargetMode");
static OUString sExternal("External");
static OUString sVBAProjectType("http://schemas.microsoft.com/office/2006/relationships/vbaProject");
OUString sStreamType;
+ OUString sStreamTypeStrict;
switch (nStreamType)
{
case VBAPROJECT:
sStreamType = sVBAProjectType;
+ sStreamTypeStrict = sVBAProjectType;
break;
case DOCUMENT:
sStreamType = sDocumentType;
+ sStreamTypeStrict = sDocumentTypeStrict;
break;
case STYLES:
sStreamType = sStylesType;
+ sStreamTypeStrict = sStylesTypeStrict;
break;
case NUMBERING:
sStreamType = sNumberingType;
+ sStreamTypeStrict = sNumberingTypeStrict;
break;
case FONTTABLE:
sStreamType = sFonttableType;
+ sStreamTypeStrict = sFonttableTypeStrict;
break;
case FOOTNOTES:
sStreamType = sFootnotesType;
+ sStreamTypeStrict = sFootnotesTypeStrict;
break;
case ENDNOTES:
sStreamType = sEndnotesType;
+ sStreamTypeStrict = sEndnotesTypeStrict;
break;
case COMMENTS:
sStreamType = sCommentsType;
+ sStreamTypeStrict = sCommentsTypeStrict;
break;
case THEME:
sStreamType = sThemeType;
+ sStreamTypeStrict = sThemeTypeStrict;
break;
case CUSTOMXML:
sStreamType = sCustomType;
+ sStreamTypeStrict = sCustomTypeStrict;
break;
case CUSTOMXMLPROPS:
sStreamType = sCustomPropsType;
+ sStreamTypeStrict = sCustomPropsTypeStrict;
break;
case ACTIVEX:
sStreamType = sActiveXType;
+ sStreamTypeStrict = sActiveXTypeStrict;
break;
case ACTIVEXBIN:
sStreamType = sActiveXBinType;
+ sStreamTypeStrict = sActiveXBinType;
break;
case SETTINGS:
sStreamType = sSettingsType;
+ sStreamTypeStrict = sSettingsTypeStrict;
break;
default:
break;
@@ -186,7 +215,8 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess>
beans::StringPair aPair = aSeq[i];
if (aPair.First.compareTo(sType) == 0 &&
- aPair.Second.compareTo(sStreamType) == 0)
+ ( aPair.Second.compareTo(sStreamType) == 0 ||
+ aPair.Second.compareTo(sStreamTypeStrict) == 0))
bFound = true;
else if (aPair.First.compareTo(sId) == 0 &&
aPair.Second.compareTo(rId) == 0)
More information about the Libreoffice-commits
mailing list