mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
(temporarily) add a Buffer * Inset::buffer_ membert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23170 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
30fff63257
commit
e05e2b6b19
@ -217,21 +217,10 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
|
||||
ParIterator fend = par_iterator_end(in);
|
||||
|
||||
for (; fpit != fend; ++fpit) {
|
||||
InsetList::const_iterator lit = fpit->insetList().begin();
|
||||
InsetList::const_iterator eit = fpit->insetList().end();
|
||||
|
||||
for (; lit != eit; ++lit) {
|
||||
switch (lit->inset->lyxCode()) {
|
||||
case TABULAR_CODE: {
|
||||
InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
|
||||
it->buffer(&buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; // nothing
|
||||
}
|
||||
}
|
||||
InsetList::const_iterator it = fpit->insetList().begin();
|
||||
InsetList::const_iterator et = fpit->insetList().end();
|
||||
for (; it != et; ++it)
|
||||
it->inset->setBuffer(const_cast<Buffer *>(&buffer));
|
||||
}
|
||||
insertion.swap(in.paragraphs());
|
||||
|
||||
|
@ -75,7 +75,7 @@ namespace lyx {
|
||||
namespace Alert = frontend::Alert;
|
||||
|
||||
|
||||
Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
||||
Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
|
||||
{
|
||||
BufferParams const & params = buf.params();
|
||||
|
||||
@ -372,6 +372,13 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
||||
{
|
||||
Inset * inset = createInsetHelper(buf, cmd);
|
||||
if (inset)
|
||||
inset->setBuffer(&buf);
|
||||
return inset;
|
||||
}
|
||||
|
||||
Inset * readInset(Lexer & lex, Buffer const & buf)
|
||||
{
|
||||
|
@ -90,6 +90,13 @@ public:
|
||||
/// virtual base class destructor
|
||||
virtual ~Inset() {}
|
||||
|
||||
/// change associated Buffer
|
||||
virtual void setBuffer(Buffer * buffer) { buffer_ = buffer; }
|
||||
virtual void setBufferRecursively(Buffer *) {}
|
||||
/// retrieve associated Buffer
|
||||
virtual Buffer * buffer() { return buffer_; }
|
||||
virtual Buffer const * buffer() const { return buffer_; }
|
||||
|
||||
/// identification as math inset
|
||||
virtual InsetMath * asInsetMath() { return 0; }
|
||||
/// true for 'math' math inset, but not for e.g. mbox
|
||||
@ -477,7 +484,8 @@ public:
|
||||
enum { TEXT_TO_INSET_OFFSET = 4 };
|
||||
|
||||
protected:
|
||||
Inset() {}
|
||||
/// Constructor
|
||||
explicit Inset() : buffer_(0) {}
|
||||
|
||||
/// replicate ourselves
|
||||
friend class InsetList;
|
||||
@ -496,6 +504,8 @@ protected:
|
||||
* \sa getStatus
|
||||
*/
|
||||
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
|
||||
Buffer * buffer_;
|
||||
};
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -2869,14 +2869,17 @@ Tabular::BoxType Tabular::useParbox(idx_type cell) const
|
||||
InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
|
||||
col_type columns)
|
||||
: tabular(buf.params(), max(rows, row_type(1)),
|
||||
max(columns, col_type(1))), buffer_(&buf), scx_(0)
|
||||
{}
|
||||
max(columns, col_type(1))), scx_(0)
|
||||
{
|
||||
setBuffer(const_cast<Buffer *>(&buf)); // FIXME: remove later
|
||||
}
|
||||
|
||||
|
||||
InsetTabular::InsetTabular(InsetTabular const & tab)
|
||||
: Inset(tab), tabular(tab.tabular),
|
||||
buffer_(tab.buffer_), scx_(0)
|
||||
{}
|
||||
: Inset(tab), tabular(tab.tabular), scx_(0)
|
||||
{
|
||||
setBuffer(const_cast<Buffer *>(tab.buffer())); // FIXME: remove later
|
||||
}
|
||||
|
||||
|
||||
InsetTabular::~InsetTabular()
|
||||
@ -2891,18 +2894,6 @@ Inset * InsetTabular::clone() const
|
||||
}
|
||||
|
||||
|
||||
Buffer const & InsetTabular::buffer() const
|
||||
{
|
||||
return *buffer_;
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::buffer(Buffer const * b)
|
||||
{
|
||||
buffer_ = b;
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::insetAllowed(InsetCode code) const
|
||||
{
|
||||
if (code == MATHMACRO_CODE)
|
||||
@ -4867,7 +4858,7 @@ void InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
|
||||
return print_mailer_error("InsetTabularMailer", in, 2,
|
||||
"Tabular");
|
||||
|
||||
Buffer const & buffer = inset.buffer();
|
||||
Buffer const & buffer = *inset.buffer();
|
||||
inset.read(buffer, lex);
|
||||
}
|
||||
|
||||
@ -4876,7 +4867,7 @@ string const InsetTabularMailer::params2string(InsetTabular const & inset)
|
||||
{
|
||||
ostringstream data;
|
||||
data << name_ << ' ';
|
||||
inset.write(inset.buffer(), data);
|
||||
inset.write(*inset.buffer(), data);
|
||||
data << "\\end_inset\n";
|
||||
return data.str();
|
||||
}
|
||||
|
@ -740,11 +740,6 @@ public:
|
||||
///
|
||||
void addPreview(graphics::PreviewLoader &) const;
|
||||
|
||||
///
|
||||
Buffer const & buffer() const;
|
||||
|
||||
/// set the owning buffer
|
||||
void buffer(Buffer const * buf);
|
||||
/// lock cell with given index
|
||||
void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
||||
///
|
||||
@ -814,8 +809,6 @@ private:
|
||||
row_type row_start, row_type row_end,
|
||||
col_type col_start, col_type col_end) const;
|
||||
///
|
||||
Buffer const * buffer_;
|
||||
///
|
||||
mutable idx_type first_visible_cell;
|
||||
///
|
||||
mutable int scx_;
|
||||
|
Loading…
Reference in New Issue
Block a user