+bool Paragraph::emptyTag() const
+{
+ for (pos_type i = 0; i < size(); ++i) {
+ if (isInset(i)) {
+ InsetBase const * inset = getInset(i);
+ InsetBase::Code lyx_code = inset->lyxCode();
+ if (lyx_code != InsetBase::TOC_CODE &&
+ lyx_code != InsetBase::INCLUDE_CODE &&
+ lyx_code != InsetBase::GRAPHICS_CODE &&
+ lyx_code != InsetBase::ERT_CODE &&
+ lyx_code != InsetBase::FLOAT_CODE &&
+ lyx_code != InsetBase::TABULAR_CODE) {
+ return false;
+ }
+ } else {
+ value_type c = getChar(i);
+ if (c != ' ' && c != '\t')
+ return false;
+ }
+ }
+ return true;
+}
+
+
+string Paragraph::getID(Buffer const & buf, OutputParams const & runparams) const
+{
+ for (pos_type i = 0; i < size(); ++i) {
+ if (isInset(i)) {
+ InsetBase const * inset = getInset(i);
+ InsetBase::Code lyx_code = inset->lyxCode();
+ if (lyx_code == InsetBase::LABEL_CODE) {
+ string const id = static_cast<InsetCommand const *>(inset)->getContents();
+ return "id=\"" + sgml::cleanID(buf, runparams, id) + "\"";
+ }
+ }
+
+ }
+ return string();
+}
+
+
+pos_type Paragraph::getFirstWord(Buffer const & buf, ostream & os, OutputParams const & runparams) const
+{
+ pos_type i;
+ for (i = 0; i < size(); ++i) {
+ if (isInset(i)) {
+ InsetBase const * inset = getInset(i);
+ inset->docbook(buf, os, runparams);
+ } else {
+ value_type c = getChar(i);
+ if (c == ' ')
+ break;
+ bool ws;
+ string str;
+ boost::tie(ws, str) = sgml::escapeChar(c);
+
+ os << str;
+ }
+ }
+ return i;
+}
+
+
+bool Paragraph::onlyText(Buffer const & buf, LyXFont const & outerfont, pos_type initial) const
+{
+ LyXFont font_old;
+
+ for (pos_type i = initial; i < size(); ++i) {
+ LyXFont font = getFont(buf.params(), i, outerfont);
+ if (isInset(i))
+ return false;
+ if (i != initial && font != font_old)
+ return false;
+ font_old = font;
+ }
+
+ return true;
+}
+
+