]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetfloat.C
ws changes only
[lyx.git] / src / insets / insetfloat.C
index 0db037a0da8f5e9025cdb60450db76e224301da4..0f0ba8a817347305f8acb8c1a78e84cce080aa0c 100644 (file)
@@ -6,15 +6,15 @@
  * \author Jürgen Vigna
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "insetfloat.h"
-#include "insettext.h"
 
 #include "buffer.h"
+#include "bufferparams.h"
 #include "BufferView.h"
 #include "debug.h"
 #include "Floating.h"
 #include "gettext.h"
 #include "iterators.h"
 #include "LaTeXFeatures.h"
-#include "Lsstream.h"
-#include "lyxfont.h"
+#include "LColor.h"
 #include "lyxlex.h"
-#include "lyxtext.h"
-#include "Lsstream.h"
+#include "paragraph.h"
 
-#include "support/LOstream.h"
 #include "support/lstrings.h"
 #include "support/tostr.h"
 
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
+#include "support/std_sstream.h"
 
-using namespace lyx::support;
+using lyx::support::contains;
 
-using std::ostream;
 using std::endl;
+using std::string;
 using std::auto_ptr;
+using std::istringstream;
+using std::ostream;
+using std::ostringstream;
 
 
 // With this inset it will be possible to support the latex package
@@ -162,9 +161,8 @@ InsetFloat::~InsetFloat()
 
 dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
 {
-       InsetOld::RESULT result = UNDISPATCHED;
-
        switch (cmd.action) {
+
        case LFUN_INSET_MODIFY: {
                InsetFloatParams params;
                InsetFloatMailer::string2params(cmd.argument, params);
@@ -172,23 +170,19 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
                params_.placement = params.placement;
                params_.wide      = params.wide;
 
-               wide(params_.wide, cmd.view()->buffer()->params);
+               wide(params_.wide, cmd.view()->buffer()->params());
                cmd.view()->updateInset(this);
-               result = DISPATCHED;
+               return DISPATCHED;
        }
-       break;
 
        case LFUN_INSET_DIALOG_UPDATE: {
-               InsetFloatMailer mailer(*this);
-               mailer.updateDialog(cmd.view());
+               InsetFloatMailer(*this).updateDialog(cmd.view());
+               return DISPATCHED;
        }
-       break;
 
        default:
-               result = InsetCollapsable::localDispatch(cmd);
+               return InsetCollapsable::localDispatch(cmd);
        }
-
-       return result;
 }
 
 
@@ -197,14 +191,13 @@ void InsetFloatParams::write(ostream & os) const
        os << "Float " // getInsetName()
           << type << '\n';
 
-       if (!placement.empty()) {
+       if (!placement.empty())
                os << "placement " << placement << "\n";
-       }
-       if (wide) {
+
+       if (wide)
                os << "wide true\n";
-       } else {
+       else
                os << "wide false\n";
-       }
 }
 
 
@@ -236,17 +229,17 @@ void InsetFloatParams::read(LyXLex & lex)
 }
 
 
-void InsetFloat::write(Buffer const * buf, ostream & os) const
+void InsetFloat::write(Buffer const & buf, ostream & os) const
 {
        params_.write(os);
        InsetCollapsable::write(buf, os);
 }
 
 
-void InsetFloat::read(Buffer const * buf, LyXLex & lex)
+void InsetFloat::read(Buffer const & buf, LyXLex & lex)
 {
        params_.read(lex);
-       wide(params_.wide, buf->params);
+       wide(params_.wide, buf.params());
        InsetCollapsable::read(buf, lex);
 }
 
@@ -274,10 +267,10 @@ string const InsetFloat::editMessage() const
 }
 
 
-int InsetFloat::latex(Buffer const * buf, ostream & os,
+int InsetFloat::latex(Buffer const & buf, ostream & os,
                      LatexRunParams const & runparams) const
 {
-       FloatList const & floats = buf->params.getLyXTextClass().floats();
+       FloatList const & floats = buf.params().getLyXTextClass().floats();
        string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
        // Figure out the float placement to use.
        // From lowest to highest:
@@ -285,7 +278,7 @@ int InsetFloat::latex(Buffer const * buf, ostream & os,
        // - document wide default placement
        // - specific float placement
        string placement;
-       string const buf_placement = buf->params.float_placement;
+       string const buf_placement = buf.params().float_placement;
        string const def_placement = floats.defaultPlacement(params_.type);
        if (!params_.placement.empty()
            && params_.placement != def_placement) {
@@ -316,9 +309,9 @@ int InsetFloat::latex(Buffer const * buf, ostream & os,
 }
 
 
-int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
 {
-       FloatList const & floats = buf->params.getLyXTextClass().floats();
+       FloatList const & floats = buf.params().getLyXTextClass().floats();
        string const tmptype =  params_.type;
        // Figure out the float placement to use.
        // From lowest to highest:
@@ -328,7 +321,7 @@ int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const
        // This is the same as latex, as linuxdoc is modeled after latex.
 
        string placement;
-       string const buf_placement = buf->params.float_placement;
+       string const buf_placement = buf.params().float_placement;
        string const def_placement = floats.defaultPlacement(params_.type);
        if (!params_.placement.empty()
            && params_.placement != def_placement) {
@@ -353,7 +346,7 @@ int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const
 }
 
 
-int InsetFloat::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetFloat::docbook(Buffer const & buf, ostream & os, bool mixcont) const
 {
        os << '<' << params_.type << '>';
        int const i = inset.docbook(buf, os, mixcont);
@@ -400,7 +393,7 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
 }
 
 
-void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
+void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
 {
        ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
        ParIterator end(inset.paragraphs.end(), inset.paragraphs);
@@ -408,7 +401,7 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
        // Find a caption layout in one of the (child inset's) pars
        for (; pit != end; ++pit) {
                if (pit->layout()->name() == caplayout) {
-                       string const name = floatname(params_.type, buf->params);
+                       string const name = floatname(params_.type, buf.params());
                        string const str =
                                tostr(toclist[name].size() + 1)
                                + ". " + pit->asString(buf, false);
@@ -440,7 +433,7 @@ void InsetFloatMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
@@ -471,5 +464,5 @@ string const InsetFloatMailer::params2string(InsetFloatParams const & params)
        ostringstream data;
        data << name_ << ' ';
        params.write(data);
-       return STRCONV(data.str());
+       return data.str();
 }