#include "commandtags.h"
#include "gettext.h"
+using std::ostream;
+
extern BufferView * current_view;
}
-InsetRef::~InsetRef()
-{
-}
-
-
-void InsetRef::Edit(int, int)
+void InsetRef::Edit(BufferView * bv, int, int, unsigned int)
{
- current_view->getOwner()->getLyXFunc()
- ->Dispatch(LFUN_REFGOTO, getContents().c_str());
+ bv->owner()->getLyXFunc()->
+ Dispatch(LFUN_REFGOTO, getContents().c_str());
}
else
temp += _("Ref: ");
temp += getContents();
- if(!current_view->currentBuffer()->isLatex()
+ if(!current_view->buffer()->isLatex()
&& !getOptions().empty()) {
temp += "||";
temp += getOptions();
}
-int InsetRef::Latex(FILE * file, signed char /*fragile*/)
+int InsetRef::Latex(ostream & os,
+ bool /*fragile*/, bool /*fs*/) const
{
if(getOptions().empty())
- fprintf(file, "%s", escape(getCommand()).c_str());
+ os << escape(getCommand());
else {
string ns;
- InsetCommand clone= InsetCommand(getCmdName(),getContents(),ns);
- fprintf(file, "%s", escape(clone.getCommand()).c_str());
+ InsetCommand clone = InsetCommand(getCmdName(),
+ getContents(), ns);
+ os << escape(clone.getCommand());
}
return 0;
}
-int InsetRef::Latex(string & file, signed char /*fragile*/)
+int InsetRef::Ascii(ostream & os) const
{
- if(getOptions().empty())
- file += escape(getCommand());
- else {
- string ns;
- InsetCommand clone= InsetCommand(getCmdName(),getContents(),ns);
- file += escape(clone.getCommand());
- }
+ os << "[" << getContents() << "]";
return 0;
}
-int InsetRef::Linuxdoc(string & file)
+int InsetRef::Linuxdoc(ostream & os) const
{
- file += "<ref id=\"" + getContents()
- + "\" name=\""+ getOptions() +"\" >" ;
-
+ os << "<ref id=\"" << getContents()
+ << "\" name=\"" << getOptions() << "\" >";
return 0;
}
-int InsetRef::DocBook(string & file)
+int InsetRef::DocBook(ostream & os) const
{
- file += "<link linkend=\"" + getContents()
- + "\">"+ getOptions() +"</link>" ;
-
+ os << "<link linkend=\"" << getContents()
+ << "\">" << getOptions() << "</link>";
return 0;
}
// This function escapes 8-bit characters and other problematic characters
// It's exactly the same code as in insetlabel.C.
-string InsetRef::escape(string const & lab) const {
+string InsetRef::escape(string const & lab) const
+{
char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
string enc;
for (string::size_type i = 0; i < lab.length(); ++i) {
- unsigned char c=lab[i];
- if (c >= 128 || c=='=' || c=='%') {
+ unsigned char c= lab[i];
+ if (c >= 128 || c == '=' || c == '%') {
enc += '=';
enc += hexdigit[c>>4];
enc += hexdigit[c & 15];