diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-04 11:17:18 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-04 11:23:55 -0400 |
commit | 37be7a3f5d7871d87e7116ada3efaa94ae5ffd68 (patch) | |
tree | d3b7378a9936394b031a62579b50acac9b326ef7 /sw/source | |
parent | 4bb253b87b4af963c5cf99862ad0a6856b225ec5 (diff) |
Export fieldmark check boxes as HTML checkboxes.
Change-Id: Ida4572f43ad2c797bb71607b37237bd7630d0d58
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 46 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 1 |
3 files changed, 55 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 5fb5ba142b20..425721a10476 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -78,6 +78,7 @@ #include <swerror.h> #include <rtl/strbuf.hxx> #include <IDocumentSettingAccess.hxx> +#include <xmloff/odffields.hxx> #define MAX_INDENT_LEVEL 20 @@ -1069,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 ); |