summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2014-10-03 15:45:17 +0200
committerJan Holesovsky <kendy@collabora.com>2014-10-20 12:09:52 +0000
commit7a4d272bc2220afd365d2f324b2aaaccaa16a39e (patch)
tree882f01983298f257e61eb7375eef287de79b788d /sw
parent8cca66b47ca6d94b21d740089b2a3bae1c0566ff (diff)
html export: Fix export of checked checkbox and radiobutton.
Change-Id: Ia77f9840df7508d96292aac63e65714a7892342f Reviewed-on: https://gerrit.libreoffice.org/12049 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_htmlexport.mk1
-rw-r--r--sw/qa/extras/htmlexport/data/checkbox-radiobutton.docbin0 -> 35328 bytes
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx20
-rw-r--r--sw/source/filter/html/htmlforw.cxx5
4 files changed, 25 insertions, 1 deletions
diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk
index d1900504a2a1..72a9fdac72b6 100644
--- a/sw/CppunitTest_sw_htmlexport.mk
+++ b/sw/CppunitTest_sw_htmlexport.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_htmlexport,\
canvas/source/factory/canvasfactory \
comphelper/util/comphelp \
configmgr/source/configmgr \
+ dbaccess/util/dba \
embeddedobj/util/embobj \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
diff --git a/sw/qa/extras/htmlexport/data/checkbox-radiobutton.doc b/sw/qa/extras/htmlexport/data/checkbox-radiobutton.doc
new file mode 100644
index 000000000000..17162a41012b
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/checkbox-radiobutton.doc
Binary files differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 94fb66727971..9e666a884bf6 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -164,6 +164,26 @@ DECLARE_HTMLEXPORT_TEST(testSkipImageEmbeddedDocument, "skipimage-embedded-docum
#endif
+DECLARE_HTMLEXPORT_TEST(testExportCheckboxRadioButtonState, "checkbox-radiobutton.doc")
+{
+ htmlDocPtr pDoc = parseHtml(maTempFile);
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPath(pDoc, "/html/body", 1);
+ assertXPath(pDoc, "/html/body/p[1]/input", "type", "checkbox");
+ assertXPath(pDoc, "/html/body/p[1]/input", "checked", "checked");
+ assertXPath(pDoc, "/html/body/p[2]/input", "type", "checkbox");
+ assertXPathNoAttribute(pDoc, "/html/body/p[2]/input", "checked");
+ assertXPath(pDoc, "/html/body/form/p[1]/input", "type", "checkbox");
+ assertXPath(pDoc, "/html/body/form/p[1]/input", "checked", "checked");
+ assertXPath(pDoc, "/html/body/form/p[2]/input", "type", "checkbox");
+ assertXPathNoAttribute(pDoc, "/html/body/form/p[2]/input", "checked");
+ assertXPath(pDoc, "/html/body/form/p[3]/input", "type", "radio");
+ assertXPath(pDoc, "/html/body/form/p[3]/input", "checked", "checked");
+ assertXPath(pDoc, "/html/body/form/p[4]/input", "type", "radio");
+ assertXPathNoAttribute(pDoc, "/html/body/form/p[4]/input", "checked");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 91eec2d00d42..7b226e956a30 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -760,6 +760,9 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
TRISTATE_FALSE != *(sal_Int16*) aTmp.getValue() )
{
sOptions += " " + OString(OOO_STRING_SVTOOLS_HTML_O_checked);
+ sOptions += "=\"";
+ sOptions += OString(OOO_STRING_SVTOOLS_HTML_O_checked);
+ sOptions += "\"";
}
aTmp = xPropSet->getPropertyValue(
@@ -987,7 +990,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
sOut = "\"";
}
- sOut = sOptions;
+ sOut += " " + sOptions;
if( TYPE_IMAGE == eType )
{