]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
GuiNomencl.xxx: Rename to be in line with class name.
[lyx.git] / src / CutAndPaste.cpp
index 5fd559f10712bcde390269735519de54db3373fb..364e1e9d034e5eaf06cc5515a5a7695719d9ccf3 100644 (file)
@@ -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<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;
@@ -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<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);
                                        }
                                }
                        }
@@ -272,7 +270,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
 
                case LABEL_CODE: {
                        // check for duplicates
-                       InsetCommand & lab = static_cast<InsetCommand &>(*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.
@@ -310,7 +308,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
 
                case BIBITEM_CODE: {
                        // check for duplicates
-                       InsetCommand & bib = static_cast<InsetCommand &>(*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.
@@ -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<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;