summaryrefslogtreecommitdiff
path: root/include/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-06-02 10:57:23 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-06-02 14:53:29 +0200
commit97fa7024ce608b7908aca369e8c643a5de9ebf78 (patch)
tree72e7cff11d04d90b3b4a6a4f756d1e18e22018e7 /include/oox
parentf883a6b420efa7ed099448f7e6e5cadaa3bb275b (diff)
Related: tdf#108269 oox: allow recovering broken DOCM files
The content type inside an OOXML file differs for DOCX and DOCM. These must be in sync with the file extension, otherwise MSO refuses to open the file. We used to always write the DOCX content-type even for files which had the DOCM extension. Allow users to recover those broken files by detecting a "has docm extension but docx content-type" file as docm, so re-saving it will produce output that's accepted by MSO as well. Change-Id: I7d60c6f6c1d0421e95b3dc9e8fff617f101919f5 Reviewed-on: https://gerrit.libreoffice.org/38342 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include/oox')
-rw-r--r--include/oox/core/filterdetect.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx
index ca717418be99..f5932eab8af6 100644
--- a/include/oox/core/filterdetect.hxx
+++ b/include/oox/core/filterdetect.hxx
@@ -61,7 +61,7 @@ namespace core {
class FilterDetectDocHandler : public ::cppu::WeakImplHelper< css::xml::sax::XFastDocumentHandler >
{
public:
- explicit FilterDetectDocHandler( const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString& rFilter );
+ explicit FilterDetectDocHandler( const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString& rFilter, const OUString& rFileName );
virtual ~FilterDetectDocHandler() override;
// XFastDocumentHandler
@@ -81,7 +81,7 @@ public:
private:
void parseRelationship( const AttributeList& rAttribs );
- static OUString getFilterNameFromContentType( const OUString& rContentType );
+ static OUString getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName );
void parseContentTypesDefault( const AttributeList& rAttribs );
void parseContentTypesOverride( const AttributeList& rAttribs );
@@ -89,6 +89,7 @@ private:
typedef ::std::vector< sal_Int32 > ContextVector;
OUString& mrFilterName;
+ OUString maFileName;
ContextVector maContextStack;
OUString maTargetPath;
css::uno::Reference< css::uno::XComponentContext > mxContext;