From: Vincent van Ravesteijn Date: Mon, 25 Oct 2010 23:20:05 +0000 (+0000) Subject: We don't want InsetCommand to have a function updateCommand while this is not a speci... X-Git-Tag: 2.0.0~2241 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=2e42a7b645794fe69be0d8d53cd3937fefc04e0a;p=features.git We don't want InsetCommand to have a function updateCommand while this is not a special function of an InsetCommand, but only accidentally a shared function of two children. So, in this case I think we should just (dynamically) cast these objecten and call their own insetCommand function. This also fixes compilation again. I forgot to cherry-pick all commits in git ;)... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35845 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index dba8e7bc58..e716cc3a81 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -36,6 +36,7 @@ #include "ParagraphParameters.h" #include "ParIterator.h" +#include "insets/InsetBibitem.h" #include "insets/InsetBranch.h" #include "insets/InsetCommand.h" #include "insets/InsetFlex.h" @@ -271,7 +272,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, case LABEL_CODE: { // check for duplicates - InsetCommand & lab = static_cast(*it); + InsetLabel & lab = dynamic_cast(*it); docstring const oldname = lab.getParam("name"); lab.updateCommand(oldname, false); // We need to update the buffer reference cache. @@ -309,7 +310,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, case BIBITEM_CODE: { // check for duplicates - InsetCommand & bib = static_cast(*it); + InsetBibitem & bib = dynamic_cast(*it); docstring const oldkey = bib.getParam("key"); bib.updateCommand(oldkey, false); // We need to update the buffer reference cache. diff --git a/src/insets/InsetBibitem.h b/src/insets/InsetBibitem.h index 200630355f..f42ddadb06 100644 --- a/src/insets/InsetBibitem.h +++ b/src/insets/InsetBibitem.h @@ -42,6 +42,8 @@ public: /// static bool isCompatibleCommand(std::string const & s) { return s == "bibitem"; } + /// + void updateCommand(docstring const & new_key, bool dummy = false); private: /// verify label and update references. /// Overloaded from Inset::initView. @@ -67,8 +69,6 @@ private: /// Update the counter of this inset void updateBuffer(ParIterator const &, UpdateType); /// - void updateCommand(docstring const & new_key, bool dummy = false); - /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// Inset * clone() const { return new InsetBibitem(*this); }