X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.cpp;h=364e1e9d034e5eaf06cc5515a5a7695719d9ccf3;hb=190439eccfb04b3a27b4e85b548245d3b1f4076a;hp=5fd559f10712bcde390269735519de54db3373fb;hpb=5577e877bb0a25a0919db09b10effe9f54ff1333;p=lyx.git diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 5fd559f107..364e1e9d03 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -35,8 +35,8 @@ #include "Paragraph.h" #include "ParagraphParameters.h" #include "ParIterator.h" -#include "Undo.h" +#include "insets/InsetBibitem.h" #include "insets/InsetBranch.h" #include "insets/InsetCommand.h" #include "insets/InsetFlex.h" @@ -234,8 +234,8 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, case MATH_HULL_CODE: { // check for equation labels and resolve duplicates - InsetMathHull & ins = static_cast(*it); - std::vector labels = ins.getLabels(); + InsetMathHull * ins = it->asInsetMath()->asHullInset(); + std::vector labels = ins->getLabels(); for (size_t i = 0; i != labels.size(); ++i) { if (!labels[i]) continue; @@ -251,19 +251,17 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, for (InsetIterator itt = inset_iterator_begin(in); itt != i_end; ++itt) { if (itt->lyxCode() == REF_CODE) { - InsetCommand & ref = - static_cast(*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(*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)); - if (mi.asRefInset()->getTarget() == oldname) - mi.asRefInset()->changeTarget(newname); + mi->setBuffer(const_cast(buffer)); + if (mi->asRefInset()->getTarget() == oldname) + mi->asRefInset()->changeTarget(newname); } } } @@ -272,7 +270,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, case LABEL_CODE: { // check for duplicates - InsetCommand & lab = static_cast(*it); + InsetLabel & lab = static_cast(*it); docstring const oldname = lab.getParam("name"); lab.updateCommand(oldname, false); // We need to update the buffer reference cache. @@ -310,7 +308,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, case BIBITEM_CODE: { // check for duplicates - InsetCommand & bib = static_cast(*it); + InsetBibitem & bib = static_cast(*it); docstring const oldkey = bib.getParam("key"); bib.updateCommand(oldkey, false); // We need to update the buffer reference cache. @@ -322,10 +320,9 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, for (InsetIterator itt = inset_iterator_begin(in); itt != i_end; ++itt) { if (itt->lyxCode() == CITE_CODE) { - InsetCommand & ref = - static_cast(*itt); - if (ref.getParam("key") == oldkey) - ref.setParam("key", newkey); + InsetCommand * ref = itt->asInsetCommand(); + if (ref->getParam("key") == oldkey) + ref->setParam("key", newkey); } } break;