]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCommandParams.cpp
Fix GRAPHICS_EDIT of InsetGraphics
[lyx.git] / src / insets / InsetCommandParams.cpp
index e749cb4b22b3b3f26cd3bb2c9dd4142496c78fd7..b803e188240c1fa1fa8aa38d9603e1828720ab66 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <config.h>
+#include <algorithm>
 
 #include "InsetCommandParams.h"
 
@@ -18,7 +19,6 @@
 #include "InsetBibtex.h"
 #include "InsetCitation.h"
 #include "InsetFloatList.h"
-#include "InsetHFill.h"
 #include "InsetHyperlink.h"
 #include "InsetInclude.h"
 #include "InsetIndex.h"
 using namespace std;
 using namespace lyx::support;
 
+
 namespace lyx {
 
-ParamInfo::ParamData::ParamData(std::string const & s, ParamType t) :
-       name_(s), type_(t)
+/////////////////////////////////////////////////////////////////////
+//
+// ParamInfo::ParamData
+//
+/////////////////////////////////////////////////////////////////////
+
+ParamInfo::ParamData::ParamData(std::string const & s, ParamType t)
+       : name_(s), type_(t)
 {}
 
 
 bool ParamInfo::ParamData::isOptional() const
 {
-       return type_ == ParamInfo::LATEX_OPTIONAL ||
-              type_ == ParamInfo::LATEX_KV_OPTIONAL;
+       return type_ == ParamInfo::LATEX_OPTIONAL
+           || type_ == ParamInfo::LATEX_KV_OPTIONAL;
 }
 
 
 bool ParamInfo::ParamData::isKeyValArg() const
 {
        return type_ == ParamInfo::LATEX_KV_REQUIRED 
-               || type_ == ParamInfo::LATEX_KV_OPTIONAL;
+           || type_ == ParamInfo::LATEX_KV_OPTIONAL;
 }
 
 
@@ -107,6 +114,13 @@ ParamInfo::ParamData const &
 }
 
 
+/////////////////////////////////////////////////////////////////////
+//
+// InsetCommandParams
+//
+/////////////////////////////////////////////////////////////////////
+
+
 InsetCommandParams::InsetCommandParams(InsetCode code)
        : insetCode_(code), preview_(false)
 {
@@ -135,8 +149,6 @@ ParamInfo const & InsetCommandParams::findInfo(
                return InsetCitation::findInfo(cmdName);        
        case FLOAT_LIST_CODE:
                return InsetFloatList::findInfo(cmdName);
-       case HFILL_CODE:
-               return InsetHFill::findInfo(cmdName);
        case HYPERLINK_CODE:
                return InsetHyperlink::findInfo(cmdName);
        case INCLUDE_CODE:
@@ -161,6 +173,12 @@ ParamInfo const & InsetCommandParams::findInfo(
 }
 
 
+std::string InsetCommandParams::insetType() const
+{
+       return insetName(insetCode_);
+}
+
+
 string InsetCommandParams::getDefaultCmd(InsetCode code) {
        switch (code) {
                case BIBITEM_CODE: 
@@ -171,8 +189,6 @@ string InsetCommandParams::getDefaultCmd(InsetCode code) {
                        return InsetCitation::defaultCommand();
                case FLOAT_LIST_CODE:
                        return InsetFloatList::defaultCommand();
-               case HFILL_CODE:
-                       return InsetHFill::defaultCommand();
                case HYPERLINK_CODE:
                        return InsetHyperlink::defaultCommand();
                case INCLUDE_CODE:
@@ -208,8 +224,6 @@ bool InsetCommandParams::isCompatibleCommand(
                        return InsetCitation::isCompatibleCommand(s);
                case FLOAT_LIST_CODE:
                        return InsetFloatList::isCompatibleCommand(s);
-               case HFILL_CODE:
-                       return InsetHFill::isCompatibleCommand(s);
                case HYPERLINK_CODE:
                        return InsetHyperlink::isCompatibleCommand(s);
                case INCLUDE_CODE:
@@ -265,7 +279,7 @@ void InsetCommandParams::read(Lexer & lex)
                string const test = lex.getString();
                if (test != "LatexCommand") {
                        lex.printError("InsetCommandParams: No LatexCommand line found.");
-                       throw ExceptionMessage(WarningException, _("InsetCommandParams error:"),
+                       throw ExceptionMessage(WarningException, _("InsetCommandParams error: "),
                                               _("Can't find LatexCommand line."));
                }
        }
@@ -471,7 +485,6 @@ docstring const & InsetCommandParams::operator[](string const & name) const
 docstring & InsetCommandParams::operator[](string const & name)
 {
        BOOST_ASSERT(info_.hasParam(name));
-       ParamInfo::ParamData const & pd = info_[name];
        return params_[name];
 }