sw/source/filter/html/htmlatr.cxx |    8 ++++++
 sw/source/filter/html/wrthtml.cxx |   47 ++++++++++++++++++++++++++++++++++++++
 sw/source/filter/html/wrthtml.hxx |    1 
 3 files changed, 56 insertions(+)

New commits:
commit d0baa04104959f7723aa041862fbc497af1a84b2
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Wed Jun 4 11:17:18 2014 -0400

    Export fieldmark check boxes as HTML checkboxes.
    
    (cherry picked from commit 37be7a3f5d7871d87e7116ada3efaa94ae5ffd68)
    
    Conflicts:
        sw/source/filter/html/wrthtml.cxx
    
    Change-Id: Ida4572f43ad2c797bb71607b37237bd7630d0d58

diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index a0a532c..5d16458 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2533,6 +2533,14 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const 
SwCntntNode& rNode )
                         sOut += ";";
                         rWrt.Strm().WriteCharPtr( sOut.getStr() );
                     }
+                    else if (c == CH_TXT_ATR_FORMELEMENT)
+                    {
+                        // Placeholder for a single-point fieldmark.
+
+                        SwPosition aMarkPos = *rWrt.pCurPam->GetPoint();
+                        aMarkPos.nContent += nStrPos - 
aMarkPos.nContent.GetIndex();
+                        rHTMLWrt.OutPointFieldmarks(aMarkPos);
+                    }
                     else
                         HTMLOutFuncs::Out_Char( rWrt.Strm(), (sal_Unicode)c, 
aContext, &rHTMLWrt.aNonConvertableCharacters );
 
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 2e9b9e7..100518f 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -77,6 +77,8 @@
 #include <statstr.hrc>
 #include <swerror.h>
 #include <rtl/strbuf.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <xmloff/odffields.hxx>
 
 #define MAX_INDENT_LEVEL 20
 
@@ -1068,6 +1070,51 @@ void SwHTMLWriter::OutBookmarks()
     }
 }
 
+void SwHTMLWriter::OutPointFieldmarks( const SwPosition& rPos )
+{
+    // "point" fieldmarks that occupy single character space, as opposed to
+    // range fieldmarks that are associated with start and end points.
+
+    const IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+    if (!pMarkAccess)
+        return;
+
+    const sw::mark::IFieldmark* pMark = pMarkAccess->getFieldmarkFor(rPos);
+    if (!pMark)
+        return;
+
+    if (pMark->GetFieldname() == ODF_FORMCHECKBOX)
+    {
+        const sw::mark::ICheckboxFieldmark* pCheckBox =
+            dynamic_cast<const sw::mark::ICheckboxFieldmark*>(pMark);
+
+        if (pCheckBox)
+        {
+            OString aOut("<");
+            aOut += OOO_STRING_SVTOOLS_HTML_input;
+            aOut += " ";
+            aOut += OOO_STRING_SVTOOLS_HTML_O_type;
+            aOut += "=\"";
+            aOut += OOO_STRING_SVTOOLS_HTML_IT_checkbox;
+            aOut += "\"";
+
+            if (pCheckBox->IsChecked())
+            {
+                aOut += " ";
+                aOut += OOO_STRING_SVTOOLS_HTML_O_checked;
+                aOut += "=\"";
+                aOut += OOO_STRING_SVTOOLS_HTML_O_checked;
+                aOut += "\"";
+            }
+
+            aOut += "/>";
+            Strm().WriteCharPtr(aOut.getStr());
+        }
+    }
+
+    // TODO : Handle other single-point fieldmark types here (if any).
+}
+
 void SwHTMLWriter::OutImplicitMark( const OUString& rMark,
                                     const sal_Char *pMarkType )
 {
diff --git a/sw/source/filter/html/wrthtml.hxx 
b/sw/source/filter/html/wrthtml.hxx
index adf80c8..70b6f4a 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -410,6 +410,7 @@ public:
     // gebe alle an in aktuellen Ansatz stehenden 
::com::sun::star::text::Bookmarks aus
     void OutAnchor( const OUString& rName );
     void OutBookmarks();
+    void OutPointFieldmarks( const SwPosition& rPos );
     void OutImplicitMark( const OUString& rMark, const sal_Char *pMarkType );
     void OutHyperlinkHRefValue( const OUString& rURL );
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to