#include <config.h>
-
#include "BufferView.h"
#include "ControlDocument.h"
#include "ViewBase.h"
#include "lyxfind.h"
#include "buffer.h"
+#include "errorlist.h"
#include "language.h"
#include "lyx_main.h"
#include "lyxtextclass.h"
#include "support/lstrings.h"
#include "support/filetools.h"
-#include "support/BoostFormat.h"
-
using std::endl;
ControlDocument::ControlDocument(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), bp_(0)
-{
-}
+{}
+
ControlDocument::~ControlDocument()
{}
if (!bufferIsAvailable())
return;
-
classApply();
view().apply();
buffer()->params = *bp_;
lv_.message(_("Converting document to new document class..."));
- int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
- old_class, new_class,
- lv_.buffer()->paragraphs);
- if (!ret)
- return;
+ ErrorList el;
+ CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class,
+ lv_.buffer()->paragraphs,
+ el);
- string s;
-#if USE_BOOST_FORMAT
- if (ret == 1) {
- boost::format fmt(_("One paragraph could not be converted\n"
- "into the document class %1$s."));
- fmt % textclasslist[new_class].name();
- s = fmt.str();
- } else {
- boost::format fmt(_("%1$s paragraphs could not be converted\n"
- "into the document class %2$s."));
- fmt % tostr(ret);
- fmt % textclasslist[new_class].name();
- s = fmt.str();
- }
-#else
- if (ret == 1) {
- s += _("One paragraph could not be converted\n"
- "into the document class ");
- s += textclasslist[new_class].name() + ".";
- } else {
- s += tostr(ret);
- s += _(" paragraphs could not be converted\n"
- "into the document class ");
- s += textclasslist[new_class].name() + ".";
- }
-#endif
- Alert::warning(_("Class conversion errors"), s);
+ bufferview()->setErrorList(el);
+ bufferview()->showErrorList(_("Class switch"));
}
if (success)
return success;
- string s;
-
-#if USE_BOOST_FORMAT
- boost::format fmt(_("The document could not be converted\n"
- "into the document class %1$s."));
- fmt % textclasslist[tc].name();
- s = fmt.str();
-#else
- s += _("The document could not be converted\n"
- "into the document class ");
- s += textclasslist[tc].name() + ".";
-#endif
+ string s = bformat(_("The document could not be converted\n"
+ "into the document class %1$s."),
+ textclasslist[tc].name());
Alert::error(_("Could not change class"), s);
return success;
defaults.params = params();
// add an empty paragraph. Is this enough?
- Paragraph * par = new Paragraph;
- par->layout(params().getLyXTextClass().defaultLayout());
+ Paragraph par;
+ par.layout(params().getLyXTextClass().defaultLayout());
defaults.paragraphs.push_back(par);
defaults.writeFile(defaults.fileName());