Kaydet (Commit) 37be7a3f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Export fieldmark check boxes as HTML checkboxes.

Change-Id: Ida4572f43ad2c797bb71607b37237bd7630d0d58
üst 4bb253b8
......@@ -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 );
......
......@@ -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 )
{
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment