summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/filter/html/wrthtml.cxx120
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
2 files changed, 94 insertions, 28 deletions
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 2808da051611..af92e3d46330 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -194,7 +194,53 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
const OUString sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
SetupFilterOptions(sFilterOptions);
- comphelper::SequenceAsHashMap aStoreMap(rMedium.GetArgs());
+ SetupFilterFromPropertyValues(rMedium.GetArgs());
+}
+
+void SwHTMLWriter::SetupFilterOptions(const OUString& rFilterOptions)
+{
+ comphelper::SequenceAsHashMap aStoreMap;
+ if (rFilterOptions.indexOf("SkipImages") >= 0)
+ {
+ aStoreMap["SkipImages"] <<= true;
+ }
+ else if (rFilterOptions.indexOf("SkipHeaderFooter") >= 0)
+ {
+ aStoreMap["SkipHeaderFooter"] <<= true;
+ }
+ else if (rFilterOptions.indexOf("EmbedImages") >= 0)
+ {
+ aStoreMap["EmbedImages"] <<= true;
+ }
+
+ // this option can be "on" together with any of above
+ if (rFilterOptions.indexOf("NoLineLimit") >= 0)
+ {
+ aStoreMap["NoLineLimit"] <<= true;
+ }
+
+ const uno::Sequence<OUString> aOptionSeq
+ = comphelper::string::convertCommaSeparated(rFilterOptions);
+ static const OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
+ for (const auto& rOption : aOptionSeq)
+ {
+ if (rOption == "XHTML")
+ {
+ aStoreMap["XHTML"] <<= true;
+ }
+ else if (rOption.startsWith(aXhtmlNsKey))
+ {
+ aStoreMap["XhtmlNs"] <<= rOption.copy(aXhtmlNsKey.getLength());
+ }
+ }
+
+ SetupFilterFromPropertyValues(aStoreMap.getAsConstPropertyValueList());
+}
+
+void SwHTMLWriter::SetupFilterFromPropertyValues(
+ const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues)
+{
+ comphelper::SequenceAsHashMap aStoreMap(rPropertyValues);
auto it = aStoreMap.find("RTFOLEMimeType");
if (it != aStoreMap.end())
{
@@ -214,47 +260,65 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
it->second >>= nVal;
m_nShapeDPI.emplace(nVal);
}
-}
-void SwHTMLWriter::SetupFilterOptions(const OUString& rFilterOptions)
-{
- if (rFilterOptions.indexOf("SkipImages") >= 0)
+ it = aStoreMap.find("SkipImages");
+ if (it != aStoreMap.end())
{
- mbSkipImages = true;
+ bool bVal{};
+ it->second >>= bVal;
+ mbSkipImages = bVal;
}
- else if (rFilterOptions.indexOf("SkipHeaderFooter") >= 0)
+
+ it = aStoreMap.find("SkipHeaderFooter");
+ if (it != aStoreMap.end())
{
- mbSkipHeaderFooter = true;
+ bool bVal{};
+ it->second >>= bVal;
+ mbSkipHeaderFooter = bVal;
}
- else if (rFilterOptions.indexOf("EmbedImages") >= 0)
+
+ it = aStoreMap.find("EmbedImages");
+ if (it != aStoreMap.end())
{
- mbEmbedImages = true;
+ bool bVal{};
+ it->second >>= bVal;
+ mbEmbedImages = bVal;
}
- // this option can be "on" together with any of above
- if (rFilterOptions.indexOf("NoLineLimit") >= 0)
+ it = aStoreMap.find("NoLineLimit");
+ if (it != aStoreMap.end())
{
- m_nWishLineLen = -1;
+ bool bVal{};
+ it->second >>= bVal;
+ if (bVal)
+ {
+ m_nWishLineLen = -1;
+ }
}
- const uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(rFilterOptions);
- static const OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
- for (const auto& rOption : aOptionSeq)
+ it = aStoreMap.find("XHTML");
+ if (it != aStoreMap.end())
{
- if (rOption == "XHTML")
- mbXHTML = true;
- else if (rOption.startsWith(aXhtmlNsKey))
+ bool bVal{};
+ it->second >>= bVal;
+ mbXHTML = bVal;
+ }
+
+ it = aStoreMap.find("XhtmlNs");
+ if (it != aStoreMap.end())
+ {
+ OUString aVal;
+ it->second >>= aVal;
+
+ maNamespace = aVal.toUtf8();
+ if (maNamespace == "reqif-xhtml")
{
- maNamespace = rOption.copy(aXhtmlNsKey.getLength()).toUtf8();
- if (maNamespace == "reqif-xhtml")
- {
- mbReqIF = true;
- // XHTML is always just a fragment inside ReqIF.
- mbSkipHeaderFooter = true;
- }
- // XHTML namespace implies XHTML.
- mbXHTML = true;
+ mbReqIF = true;
+ // XHTML is always just a fragment inside ReqIF.
+ mbSkipHeaderFooter = true;
}
+ // XHTML namespace implies XHTML.
+ mbXHTML = true;
}
}
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index bf6806b1ae95..c5cd5dbe0780 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -276,6 +276,8 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
protected:
ErrCode WriteStream() override;
void SetupFilterOptions(SfxMedium& rMedium) override;
+ void SetupFilterFromPropertyValues(
+ const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues);
public:
std::vector<OUString> m_aImgMapNames; // written image maps