summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-04 11:17:18 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-04 11:26:21 -0400
commitd0baa04104959f7723aa041862fbc497af1a84b2 (patch)
tree16c329d4e5f340f0edb2df0a71a9caf4d1a1051e
parentb8cda0d73c0311e71f99cf8d7283abcf62164e30 (diff)
Export fieldmark check boxes as HTML checkboxes.
(cherry picked from commit 37be7a3f5d7871d87e7116ada3efaa94ae5ffd68) Conflicts: sw/source/filter/html/wrthtml.cxx Change-Id: Ida4572f43ad2c797bb71607b37237bd7630d0d58
-rw-r--r--sw/source/filter/html/htmlatr.cxx8
-rw-r--r--sw/source/filter/html/wrthtml.cxx47
-rw-r--r--sw/source/filter/html/wrthtml.hxx1
3 files changed, 56 insertions, 0 deletions
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index a0a532c0b010..5d164582668d 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 2e9b9e7568b4..100518fa03c9 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 adf80c80fc96..70b6f4aa41bf 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 );