X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetref.C;h=0df28abc6d3d3b5dc56c5d2ee2aefedff12dae1e;hb=3c8aba3b556871fb1100a2f98cd93d5d4e3f70c9;hp=b10dcd2c03f2d5b6ac2bfcec7349a7ce5b0b439d;hpb=188833d864794c9c1ec42a8361b93aaa718874ea;p=lyx.git diff --git a/src/insets/insetref.C b/src/insets/insetref.C index b10dcd2c03..0df28abc6d 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -16,6 +16,8 @@ #include "commandtags.h" #include "gettext.h" +using std::ostream; + extern BufferView * current_view; @@ -43,15 +45,10 @@ InsetRef::InsetRef(InsetCommand const & inscmd, Buffer * bf) } -InsetRef::~InsetRef() -{ -} - - -void InsetRef::Edit(int, int) +void InsetRef::Edit(BufferView * bv, int, int, unsigned int) { - current_view->owner()->getLyXFunc() - ->Dispatch(LFUN_REFGOTO, getContents().c_str()); + bv->owner()->getLyXFunc()-> + Dispatch(LFUN_REFGOTO, getContents().c_str()); } @@ -72,53 +69,48 @@ string InsetRef::getScreenLabel() const } -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 += "" ; - + os << ""; return 0; } -int InsetRef::DocBook(string & file) +int InsetRef::DocBook(ostream & os) const { - file += ""+ getOptions() +"" ; - + os << "" << getOptions() << ""; 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;