summaryrefslogtreecommitdiff
path: root/include
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-06 11:31:38 +0200
commit32f45f1bca454659d17dea80499b635a43ae4490 (patch)
tree07f26115a3fe9e8f834601cd01b1642c1c8487c0 /include
parent490a607ab5f99ca2d3f5a6379fc5ac736eeb8654 (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) Change-Id: I7d60c6f6c1d0421e95b3dc9e8fff617f101919f5 Reviewed-on: https://gerrit.libreoffice.org/38356 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
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 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;