#include "lyx_gui_misc.h"
#include "lyxcursor.h"
#include "gettext.h"
+#include "iterators.h"
#ifdef __GNUG__
#pragma implementation
}
// make sure there is no class difference
- SwitchLayoutsBetweenClasses(textclass, tc, buf);
+ SwitchLayoutsBetweenClasses(textclass, tc, buf,
+ current_view->buffer()->params);
// make the buf exactly the same layout than
// the cursor paragraph
int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
- textclass_type c2, Paragraph * par)
+ textclass_type c2,
+ Paragraph * par,
+ BufferParams const & bparams)
{
int ret = 0;
if (!par || c1 == c2)
return ret;
-
- while (par) {
+
+ ParIterator end = ParIterator();
+ for (ParIterator it = ParIterator(par); it != end; ++it) {
+ par = *it;
string const name = textclasslist.NameOfLayout(c1, par->layout);
int lay = 0;
pair<bool, layout_type> pp =
textclasslist.NumberOfLayout(c2, name);
if (pp.first) {
lay = pp.second;
- } else { // layout not found
- // use default layout "Standard" (0)
+ } else {
+ // not found: use default layout "Standard" (0)
lay = 0;
}
par->layout = lay;
+ textclasslist.NameOfClass(c1) + _(" to ")
+ textclasslist.NameOfClass(c2);
InsetError * new_inset = new InsetError(s);
- par->insertInset(0, new_inset);
+ par->insertInset(0, new_inset,
+ LyXFont(LyXFont::ALL_INHERIT,
+ bparams.language));
}
- par = par->next();
}
return ret;
}