-namespace {
-
-void changeRefsIfUnique(BufferView & bv, string const & from, string const & to)
-{
- // Check if the label 'from' appears more than once
- vector<string> labels;
- bv.buffer()->getLabelList(labels);
-
- if (lyx::count(labels.begin(), labels.end(), from) > 1)
- return;
-
- InsetBase::Code code = InsetBase::REF_CODE;
-
- ParIterator it = bv.buffer()->par_iterator_begin();
- ParIterator end = bv.buffer()->par_iterator_end();
- for ( ; it != end; ++it) {
- bool changed_inset = false;
- for (InsetList::iterator it2 = it->insetlist.begin();
- it2 != it->insetlist.end(); ++it2) {
- if (it2->inset->lyxCode() == code) {
- InsetCommand * inset = static_cast<InsetCommand *>(it2->inset);
- if (inset->getContents() == from) {
- inset->setContents(to);
- //inset->setButtonLabel();
- changed_inset = true;
- }
- }
- }
- }
-}
-
-} // namespace anon
-
-
-DispatchResult
-InsetLabel::priv_dispatch(LCursor & cur, FuncRequest const & cmd)