summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/htmlplug.cxx6
-rw-r--r--sw/source/filter/html/swhtml.cxx19
-rw-r--r--sw/source/filter/html/swhtml.hxx3
3 files changed, 27 insertions, 1 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index fc224925153a..4d5d58d23ade 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -554,7 +554,11 @@ bool SwHTMLParser::InsertEmbed()
StreamMode::READ);
uno::Reference<io::XInputStream> xInStream;
SvMemoryStream aMemoryStream;
- if (aType == "text/rtf")
+
+ // Allow any MIME type that starts with magic, unless a set of allowed types are
+ // specified.
+ auto it = m_aAllowedRTFOLEMimeTypes.find(aType);
+ if (m_aAllowedRTFOLEMimeTypes.empty() || it != m_aAllowedRTFOLEMimeTypes.end())
{
OString aMagic("{\\object");
OString aHeader(read_uInt8s_ToOString(aFileStream, aMagic.getLength()));
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index b2e0f520b961..2ed9ed17625f 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -118,6 +118,8 @@
#include <sfx2/viewfrm.hxx>
#include <svx/svdobj.hxx>
#include <officecfg/Office/Writer.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/sequence.hxx>
#include <swerror.h>
#include <hints.hxx>
@@ -433,6 +435,23 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn,
if (rNamespace == "reqif-xhtml")
m_bReqIF = true;
}
+
+ // Extract load parameters which are specific to this filter.
+ if (!pMed)
+ {
+ return;
+ }
+
+ comphelper::SequenceAsHashMap aLoadMap(pMed->GetArgs());
+ auto it = aLoadMap.find("AllowedRTFOLEMimeTypes");
+ if (it == aLoadMap.end())
+ {
+ return;
+ }
+
+ uno::Sequence<OUString> aTypes;
+ it->second >>= aTypes;
+ m_aAllowedRTFOLEMimeTypes = comphelper::sequenceToContainer<std::set<OUString>>(aTypes);
}
SwHTMLParser::~SwHTMLParser()
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index dc31880f3ec0..d4f9876e3ab6 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -35,6 +35,7 @@
#include <vector>
#include <deque>
#include <stack>
+#include <set>
class SfxMedium;
class SfxViewFrame;
@@ -470,6 +471,8 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener
*/
std::stack<SwOLENode*> m_aEmbeds;
+ std::set<OUString> m_aAllowedRTFOLEMimeTypes;
+
void DeleteFormImpl();
void DocumentDetected();