#include "support/LAssert.h"
#include "Lsstream.h"
+using namespace lyx::support;
ControlParagraph::ControlParagraph(Dialog & parent)
: Dialog::Controller(parent), ininset_(false)
{}
-void ControlParagraph::initialiseParams(string const & data)
+bool ControlParagraph::initialiseParams(string const & data)
{
- istringstream is(data);
+ istringstream is(STRCONV(data));
LyXLex lex(0,0);
lex.setStream(is);
// action == 1: update dialog, accept changes
// action == 2: update dialog, do not accept changes
int action = 0;
-
+
if (lex.isOK()) {
lex.next();
string const token = lex.getString();
lex.next();
bool const accept = lex.getBool();
action = accept ? 1 : 2;
- } else {
+ } else if (!token.empty()) {
// Unrecognised token
- lyx::Assert(0);
+ return false;
}
}
lex.next();
string const token = lex.getString();
+ if (token.empty())
+ continue;
+
int Int = 0;
if (token == "\\alignpossible" ||
token == "\\aligndefault" ||
Int = lex.getInteger();
} else {
// Unrecognised token
- break;
+ return false;
}
-
+
++nset;
if (token == "\\alignpossible") {
ininset_ = Int;
}
}
- lyx::Assert(nset == 3);
+ if (nset != 3) {
+ return false;
+ }
// If "update", then set the activation status of the button controller
if (action > 0) {
bool const accept = action == 1;
dialog().bc().valid(accept);
}
+ return true;
}
{
ostringstream data;
params().write(data);
- FuncRequest const fr(LFUN_PARAGRAPH_APPLY, data.str());
+ FuncRequest const fr(LFUN_PARAGRAPH_APPLY, STRCONV(data.str()));
kernel().dispatch(fr);
}
ParagraphParameters & ControlParagraph::params()
{
- lyx::Assert(params_.get());
+ Assert(params_.get());
return *params_;
}
ParagraphParameters const & ControlParagraph::params() const
{
- lyx::Assert(params_.get());
+ Assert(params_.get());
return *params_;
}