diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-12-17 17:54:21 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-12-18 10:31:10 +0100 |
commit | 4b113550df32f1aca3f3dd07dc23e338b8bbefec (patch) | |
tree | 1eb0b8c34cc2ebb563f8f5183d0a6989422dbfe3 /sw/source/filter/html | |
parent | 2b225483903fa495cee1a22ede4b20eb0b6da44e (diff) |
sw reqif-xhtml export: add a new RTFOLEMimeType parameter
This is similar to commit e0f20211a8048a87b078aa4cf0f28c0c847487ad (sw
reqif-xhtml import: add a new AllowedRTFOLEMimeTypes parameter,
2019-12-16), except that was for the import and this is for the import.
The situation was similar, SfxBaseModel::impl_store() still had the
custom store parameters, but later functions lost it, so at the end
OutHTML_FrameFormatOLENodeGrf() in the sw HTML export could not respect
it.
Fix the problem in a similar way, so the SfxMedium instance created for
the duration of the export provides the custom options via
SfxMedium::GetArgs().
(cherry picked from commit 037cd13af81f8a1169d01e95036ed942f261f9a6)
Conflicts:
include/sfx2/objsh.hxx
sfx2/source/doc/objstor.cxx
sfx2/source/doc/sfxbasemodel.cxx
sw/source/filter/html/wrthtml.cxx
sw/source/filter/html/wrthtml.hxx
Change-Id: I71d2c7920f42d98133f345703cfdfd50f0e8550c
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 5e35c8ebb6a5..36115cf4322f 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1527,6 +1527,12 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame SwDocShell* pDocSh = rHTMLWrt.pDoc->GetDocShell(); bool bObjectOpened = false; + OUString aRTFType = "text/rtf"; + if (!rHTMLWrt.m_aRTFOLEMimeType.isEmpty()) + { + aRTFType = rHTMLWrt.m_aRTFOLEMimeType; + } + if (rHTMLWrt.mbXHTML && pDocSh) { // Map native data to an outer <object> element. @@ -1557,7 +1563,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame if (SwReqIfReader::WrapOleInRtf(*pStream, aOutStream, *pOLENd)) { // Data always wrapped in RTF. - aFileType = "text/rtf"; + aFileType = aRTFType; } } } @@ -1576,7 +1582,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame if (SwReqIfReader::WrapOleInRtf(aMemory, aOutStream, *pOLENd)) { // Data always wrapped in RTF. - aFileType = "text/rtf"; + aFileType = aRTFType; } } else @@ -1603,6 +1609,10 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame uno::Reference<beans::XPropertySet> xOutStreamProps(xInStream, uno::UNO_QUERY); if (xOutStreamProps.is()) xOutStreamProps->getPropertyValue("MediaType") >>= aFileType; + if (!aRTFType.isEmpty()) + { + aFileType = aRTFType; + } } aFileName = URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(), aFileName); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 730b7a1ebd58..79f7e0822c14 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -79,6 +79,7 @@ #include <osl/file.hxx> #include <comphelper/scopeguard.hxx> #include <unotools/tempfile.hxx> +#include <comphelper/sequenceashashmap.hxx> #define MAX_INDENT_LEVEL 20 @@ -214,6 +215,15 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium) mbXHTML = true; } } + + comphelper::SequenceAsHashMap aStoreMap(rMedium.GetArgs()); + auto it = aStoreMap.find("RTFOLEMimeType"); + if (it == aStoreMap.end()) + { + return; + } + + it->second >>= m_aRTFOLEMimeType; } sal_uLong SwHTMLWriter::WriteStream() diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index e1097cb23b25..ed81edd7be62 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -409,6 +409,8 @@ public: /// Tracks which text portion attributes are currently open: a which id -> open count map. std::map<sal_uInt16, int> maStartedAttributes; + OUString m_aRTFOLEMimeType; + explicit SwHTMLWriter( const OUString& rBaseURL ); virtual ~SwHTMLWriter() override; |