summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-12-17 17:54:21 +0100
committerGülşah Köse <gulsah.kose@collabora.com>2020-06-16 21:52:52 +0200
commit38e00e1dc967ebc7d94c5360ad57a3ae98d1cddb (patch)
tree80bfd1b3dff6ce75c5869987d542fc105ac87b78 /sw/source/filter
parentb13a612d22e10e38fd78776e7365ec30f0c84361 (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(). Change-Id: I71d2c7920f42d98133f345703cfdfd50f0e8550c Reviewed-on: https://gerrit.libreoffice.org/85321 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96477 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/htmlplug.cxx14
-rw-r--r--sw/source/filter/html/wrthtml.cxx10
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
3 files changed, 24 insertions, 2 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index a0da671de733..ce22cfcd274e 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1513,6 +1513,12 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
SwDocShell* pDocSh = rHTMLWrt.m_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.
@@ -1543,7 +1549,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;
}
}
}
@@ -1562,7 +1568,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
@@ -1589,6 +1595,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 76ce6fb781a6..1157b27dd29d 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -82,6 +82,7 @@
#include <osl/file.hxx>
#include <comphelper/scopeguard.hxx>
#include <unotools/tempfile.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#define MAX_INDENT_LEVEL 20
@@ -188,6 +189,15 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
const OUString sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
SetupFilterOptions(sFilterOptions);
+
+ comphelper::SequenceAsHashMap aStoreMap(rMedium.GetArgs());
+ auto it = aStoreMap.find("RTFOLEMimeType");
+ if (it == aStoreMap.end())
+ {
+ return;
+ }
+
+ it->second >>= m_aRTFOLEMimeType;
}
void SwHTMLWriter::SetupFilterOptions(const OUString& rFilterOptions)
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 805643817003..8cc06647016b 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -405,6 +405,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;
+
/// Construct an instance of SwHTMLWriter and optionally give it
/// the filter options directly, which can also be set via SetupFilterOptions().
explicit SwHTMLWriter( const OUString& rBaseURL, const OUString& rFilterOptions = "" );