]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetref.C
clear()->erase() ; lots of using directives for cxx
[lyx.git] / src / insets / insetref.C
index b10dcd2c03f2d5b6ac2bfcec7349a7ce5b0b439d..0df28abc6d3d3b5dc56c5d2ee2aefedff12dae1e 100644 (file)
@@ -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 += "<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;