#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
+#include "TextClass.h"
#include "insets/InsetBibitem.h"
#include "insets/InsetBranch.h"
case MATH_HULL_CODE: {
// check for equation labels and resolve duplicates
- InsetMathHull & ins = static_cast<InsetMathHull &>(*it);
- std::vector<InsetLabel *> labels = ins.getLabels();
+ InsetMathHull * ins = it->asInsetMath()->asHullInset();
+ std::vector<InsetLabel *> labels = ins->getLabels();
for (size_t i = 0; i != labels.size(); ++i) {
if (!labels[i])
continue;
for (InsetIterator itt = inset_iterator_begin(in);
itt != i_end; ++itt) {
if (itt->lyxCode() == REF_CODE) {
- InsetCommand & ref =
- static_cast<InsetCommand &>(*itt);
- if (ref.getParam("reference") == oldname)
- ref.setParam("reference", newname);
+ InsetCommand * ref = itt->asInsetCommand();
+ if (ref->getParam("reference") == oldname)
+ ref->setParam("reference", newname);
} else if (itt->lyxCode() == MATH_REF_CODE) {
- InsetMathHull & mi =
- static_cast<InsetMathHull &>(*itt);
+ InsetMathHull * mi = itt->asInsetMath()->asHullInset();
// this is necessary to prevent an uninitialized
// buffer when the RefInset is in a MathBox.
// FIXME audit setBuffer calls
- mi.setBuffer(const_cast<Buffer &>(buffer));
- if (mi.asRefInset()->getTarget() == oldname)
- mi.asRefInset()->changeTarget(newname);
+ mi->setBuffer(const_cast<Buffer &>(buffer));
+ if (mi->asRefInset()->getTarget() == oldname)
+ mi->asRefInset()->changeTarget(newname);
}
}
}
case LABEL_CODE: {
// check for duplicates
- InsetLabel & lab = dynamic_cast<InsetLabel &>(*it);
+ InsetLabel & lab = static_cast<InsetLabel &>(*it);
docstring const oldname = lab.getParam("name");
lab.updateCommand(oldname, false);
// We need to update the buffer reference cache.
case BIBITEM_CODE: {
// check for duplicates
- InsetBibitem & bib = dynamic_cast<InsetBibitem &>(*it);
+ InsetBibitem & bib = static_cast<InsetBibitem &>(*it);
docstring const oldkey = bib.getParam("key");
bib.updateCommand(oldkey, false);
// We need to update the buffer reference cache.
for (InsetIterator itt = inset_iterator_begin(in);
itt != i_end; ++itt) {
if (itt->lyxCode() == CITE_CODE) {
- InsetCommand & ref =
- static_cast<InsetCommand &>(*itt);
- if (ref.getParam("key") == oldkey)
- ref.setParam("key", newkey);
+ InsetCommand * ref = itt->asInsetCommand();
+ if (ref->getParam("key") == oldkey)
+ ref->setParam("key", newkey);
}
}
break;
// create inset for graphic
InsetGraphics * inset = new InsetGraphics(cur.buffer());
InsetGraphicsParams params;
- params.filename = support::DocFileName(filename.absFileName());
+ params.filename = support::DocFileName(filename.absFileName(), false);
inset->setParams(params);
cur.recordUndo();
cur.insert(inset);