summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-06-02 10:57:23 +0200
committerJan Holesovsky <kendy@collabora.com>2017-06-05 16:32:24 +0200
commitd7c0761b5ce036b5e3d2ee0252e367bd7e81d5c5 (patch)
tree5e106b909d353bc1e6b6d9f8d5213654746adba2 /include
parent42b13c83fed7345418f2a2fc5062c33d0559b8ad (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. (cherry picked from commit 97fa7024ce608b7908aca369e8c643a5de9ebf78) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport9.cxx Change-Id: I7d60c6f6c1d0421e95b3dc9e8fff617f101919f5 Reviewed-on: https://gerrit.libreoffice.org/38357 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'include')
-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 2fdf4d93f4b0..245386c6a9ab 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;