From 396a90decb79a13a0ead2072cdacd52dcdf07842 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 23 Jul 2008 12:49:22 +0000 Subject: [PATCH] Ensure that the Buffer pointer is correctly set with Clipboard operations. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25844 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/CutAndPaste.cpp | 1 + src/InsetList.cpp | 9 +++++++++ src/InsetList.h | 2 ++ src/Paragraph.cpp | 6 ++++++ src/Paragraph.h | 2 ++ 5 files changed, 20 insertions(+) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 64718ae126..e878e30c1f 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -371,6 +371,7 @@ void putClipboard(ParagraphList const & paragraphs, FileName::tempName().absFilename() + "_clipboard.internal"); buffer->setUnnamed(true); buffer->paragraphs() = paragraphs; + buffer->inset().setBuffer(*buffer); buffer->params().setDocumentClass(docclass); ostringstream lyx; if (buffer->write(lyx)) diff --git a/src/InsetList.cpp b/src/InsetList.cpp index 088d3aa2d8..057c82d00e 100644 --- a/src/InsetList.cpp +++ b/src/InsetList.cpp @@ -61,6 +61,15 @@ InsetList::~InsetList() } +void InsetList::setBuffer(Buffer & b) +{ + List::iterator it = list_.begin(); + List::iterator end = list_.end(); + for (; it != end; ++it) + it->inset->setBuffer(b); +} + + InsetList::iterator InsetList::insetIterator(pos_type pos) { InsetTable search_elem(pos, 0); diff --git a/src/InsetList.h b/src/InsetList.h index 2664a87d17..f394c11a66 100644 --- a/src/InsetList.h +++ b/src/InsetList.h @@ -31,6 +31,8 @@ public: InsetList() {} /// InsetList(InsetList const &); + /// + void setBuffer(Buffer &); /// class InsetTable { diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index d3e8faccb4..09c13cc43b 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2565,6 +2565,12 @@ InsetList const & Paragraph::insetList() const } +void Paragraph::setBuffer(Buffer & b) +{ + d->insetlist_.setBuffer(b); +} + + Inset * Paragraph::releaseInset(pos_type pos) { Inset * inset = d->insetlist_.release(pos); diff --git a/src/Paragraph.h b/src/Paragraph.h index c83ede5975..b5c0cc2f9c 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -319,6 +319,8 @@ public: /// InsetList const & insetList() const; + /// + void setBuffer(Buffer &); /// bool isHfill(pos_type pos) const; -- 2.39.5