#include "FuncRequest.h"
#include "FuncStatus.h"
#include "InsetIterator.h"
+#include "LyXFunc.h"
+#include "output_xhtml.h"
#include "ParIterator.h"
#include "sgml.h"
#include "Text.h"
{
bool enabled;
switch (cmd.action) {
- case LFUN_COPY_LABEL_AS_REF:
+ case LFUN_LABEL_INSERT_AS_REF:
+ case LFUN_LABEL_COPY_AS_REF:
enabled = true;
break;
default:
break;
}
- case LFUN_COPY_LABEL_AS_REF: {
+ case LFUN_LABEL_COPY_AS_REF: {
InsetCommandParams p(REF_CODE, "ref");
p["reference"] = getParam("name");
cap::clearSelection();
- cap::copyInset(cur, new InsetRef(*cur.buffer(), p), getParam("name"));
+ cap::copyInset(cur, new InsetRef(buffer(), p), getParam("name"));
+ break;
+ }
+
+ case LFUN_LABEL_INSERT_AS_REF: {
+ InsetCommandParams p(REF_CODE, "ref");
+ p["reference"] = getParam("name");
+ string const data = InsetCommand::params2string("ref", p);
+ lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
break;
}
}
+docstring InsetLabel::xhtml(odocstream & os, OutputParams const &) const
+{
+ os << "<a name=\"" << html::htmlize(getParam("name")) << "\"></a>";
+ return docstring();
+}
+
} // namespace lyx