Uniformize Inset construction (passing Buffer * everywhere). Lots of cleanup to do still...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31901 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-11-08 15:53:21 +00:00
parent 1a915927b5
commit 82c7e15e64
75 changed files with 142 additions and 143 deletions

View File

@ -302,7 +302,7 @@ Buffer::Buffer(string const & file, bool readonly)
{
LYXERR(Debug::INFO, "Buffer::Buffer()");
d->inset = new InsetText(*this);
d->inset = new InsetText(this);
d->inset->setAutoBreakRows(true);
d->inset->getText(0)->setMacrocontextPosition(par_iterator_begin());
}

View File

@ -163,7 +163,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
}
}
InsetText in(buffer);
InsetText in(cur.buffer());
// Make sure there is no class difference.
in.paragraphs().clear();
// This works without copying any paragraph data because we have
@ -975,7 +975,7 @@ void pasteClipboardGraphics(Cursor & cur, ErrorList & /* errorList */,
return;
// create inset for graphic
InsetGraphics * inset = new InsetGraphics(*cur.buffer());
InsetGraphics * inset = new InsetGraphics(cur.buffer());
InsetGraphicsParams params;
params.filename = support::DocFileName(filename.absFilename());
inset->setParams(params);

View File

@ -2799,7 +2799,7 @@ int Paragraph::checkBiblio(Buffer const & buffer)
// There was no inset at the beginning, so we need to create one with
// the key and label of the one we erased.
InsetBibitem * inset =
new InsetBibitem(buffer, InsetCommandParams(BIBITEM_CODE));
new InsetBibitem(const_cast<Buffer *>(&buffer), InsetCommandParams(BIBITEM_CODE));
// restore values of previously deleted item in this par.
if (!oldkey.empty())
inset->setParam("key", oldkey);

View File

@ -274,8 +274,8 @@ InsetText const & Text::inset() const
void Text::readParToken(Paragraph & par, Lexer & lex,
string const & token, Font & font, Change & change, ErrorList & errorList)
{
Buffer const & buf = owner_->buffer();
BufferParams const & bp = buf.params();
Buffer * buf = const_cast<Buffer *>(&owner_->buffer());
BufferParams const & bp = buf->params();
if (token[0] != '\\') {
docstring dstr = lex.getDocString();
@ -397,18 +397,18 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
auto_ptr<Inset> inset;
inset.reset(new InsetSpecialChar);
inset->read(lex);
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
par.insertInset(par.size(), inset.release(), font, change);
} else if (token == "\\backslash") {
par.appendChar('\\', font, change);
} else if (token == "\\LyXTable") {
auto_ptr<Inset> inset(new InsetTabular(const_cast<Buffer &>(buf)));
auto_ptr<Inset> inset(new InsetTabular(buf));
inset->read(lex);
par.insertInset(par.size(), inset.release(), font, change);
} else if (token == "\\lyxline") {
auto_ptr<Inset> inset;
inset.reset(new InsetLine);
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
par.insertInset(par.size(), inset.release(), font, change);
} else if (token == "\\change_unchanged") {
change = Change(Change::UNCHANGED);

View File

@ -229,7 +229,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
{
Buffer & buffer = cur.bv().buffer();
BufferParams const & bparams = buffer.params();
Inset * inset = createInset(buffer, cmd);
Inset * inset = createInset(&buffer, cmd);
if (!inset)
return false;
@ -1051,7 +1051,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// before inserting into the document. See bug #5626.
bool loaded = bv->buffer().isFullyLoaded();
bv->buffer().setFullyLoaded(false);
Inset * inset = createInset(bv->buffer(), cmd);
Inset * inset = createInset(&bv->buffer(), cmd);
bv->buffer().setFullyLoaded(loaded);
if (inset) {
@ -1368,7 +1368,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
else
c = par.getChar(pos - 1);
string arg = to_utf8(cmd.argument());
cur.insert(new InsetQuotes(bv->buffer(), c, (arg == "single")
cur.insert(new InsetQuotes(cur.buffer(), c, (arg == "single")
? InsetQuotes::SingleQuotes : InsetQuotes::DoubleQuotes));
cur.posForward();
}
@ -1595,9 +1595,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
docstring ds = cur.selectionAsString(false);
cutSelection(cur, true, false);
FuncRequest cmd0(cmd, ds);
inset = createInset(cur.bv().buffer(), cmd0);
inset = createInset(cur.buffer(), cmd0);
} else {
inset = createInset(cur.bv().buffer(), cmd);
inset = createInset(cur.buffer(), cmd);
}
if (!inset)
break;

View File

@ -75,9 +75,9 @@ namespace lyx {
namespace Alert = frontend::Alert;
Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
{
BufferParams const & params = buf.params();
BufferParams const & params = buf->params();
try {
@ -151,7 +151,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case LFUN_FLOAT_INSERT: {
// check if the float type exists
string const argument = to_utf8(cmd.argument());
if (buf.params().documentClass().floats().typeExist(argument))
if (params.documentClass().floats().typeExist(argument))
return new InsetFloat(buf, argument);
lyxerr << "Non-existent float type: " << argument << endl;
}
@ -263,16 +263,16 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case EXTERNAL_CODE: {
InsetExternalParams iep;
InsetExternal::string2params(to_utf8(cmd.argument()), buf, iep);
InsetExternal::string2params(to_utf8(cmd.argument()), *buf, iep);
auto_ptr<InsetExternal> inset(new InsetExternal(buf));
inset->setBuffer(buf);
inset->setBuffer(*buf);
inset->setParams(iep);
return inset.release();
}
case GRAPHICS_CODE: {
InsetGraphicsParams igp;
InsetGraphics::string2params(to_utf8(cmd.argument()), buf, igp);
InsetGraphics::string2params(to_utf8(cmd.argument()), *buf, igp);
auto_ptr<InsetGraphics> inset(new InsetGraphics(buf));
inset->setParams(igp);
return inset.release();
@ -431,16 +431,16 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
}
Inset * createInset(Buffer & buf, FuncRequest const & cmd)
Inset * createInset(Buffer * buf, FuncRequest const & cmd)
{
Inset * inset = createInsetHelper(buf, cmd);
if (inset)
inset->setBuffer(buf);
inset->setBuffer(*buf);
return inset;
}
Inset * readInset(Lexer & lex, Buffer const & buf)
Inset * readInset(Lexer & lex, Buffer * buf)
{
// consistency check
if (lex.getString() != "\\begin_inset")
@ -518,7 +518,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
lex.next();
return 0;
}
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
} else {
// FIXME This branch should be made to use inset codes as the preceding
// branch does. Unfortunately, that will take some doing. It requires
@ -529,13 +529,13 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
if (tmptok == "Quotes") {
inset.reset(new InsetQuotes(buf));
} else if (tmptok == "External") {
inset.reset(new InsetExternal(const_cast<Buffer &>(buf)));
inset.reset(new InsetExternal(buf));
} else if (tmptok == "FormulaMacro") {
inset.reset(new MathMacroTemplate(&const_cast<Buffer &>(buf)));
inset.reset(new MathMacroTemplate(buf));
} else if (tmptok == "Formula") {
inset.reset(new InsetMathHull(&const_cast<Buffer &>(buf)));
inset.reset(new InsetMathHull(buf));
} else if (tmptok == "Graphics") {
inset.reset(new InsetGraphics(const_cast<Buffer &>(buf)));
inset.reset(new InsetGraphics(buf));
} else if (tmptok == "Note") {
inset.reset(new InsetNote(buf, tmptok));
} else if (tmptok == "Box") {
@ -555,7 +555,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
} else if (tmptok == "space") {
inset.reset(new InsetSpace);
} else if (tmptok == "Tabular") {
inset.reset(new InsetTabular(const_cast<Buffer &>(buf)));
inset.reset(new InsetTabular(buf));
} else if (tmptok == "Text") {
inset.reset(new InsetText(buf));
} else if (tmptok == "VSpace") {
@ -596,11 +596,11 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
// Set the buffer reference for proper parsing of some insets
// (InsetCollapsable for example)
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
inset->read(lex);
// Set again the buffer for insets that are created inside this inset
// (InsetMathHull for example).
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
}
return inset.release();
}

View File

@ -21,10 +21,10 @@ class Lexer;
/// creates inset according to 'cmd'
Inset * createInset(Buffer & buf, FuncRequest const & cmd);
Inset * createInset(Buffer * buf, FuncRequest const & cmd);
/// read inset from a file
Inset * readInset(Lexer & lex, Buffer const & buf);
Inset * readInset(Lexer & lex, Buffer * buf);
} // namespace lyx

View File

@ -42,7 +42,7 @@ namespace frontend {
GuiTabular::GuiTabular(GuiView & lv)
: GuiDialog(lv, "tabular", qt_("Table Settings")),
// tabular_ is initialised at dialog construction in initialiseParams()
tabular_(lv.currentBufferView()->buffer(), 0, 0)
tabular_(&(lv.currentBufferView()->buffer()), 0, 0)
{
active_cell_ = Tabular::npos;
@ -1126,7 +1126,7 @@ bool GuiTabular::initialiseParams(string const & data)
return true;
}
InsetTabular tmp(const_cast<Buffer &>(buffer()));
InsetTabular tmp(const_cast<Buffer *>(&buffer()));
InsetTabular::string2params(data, tmp);
tabular_ = Tabular(tmp.tabular);
return true;
@ -1139,7 +1139,7 @@ void GuiTabular::clearParams()
// is still open. At that time, the buffer might not be available
// anymore.
if (isBufferAvailable()) {
InsetTabular tmp(const_cast<Buffer &>(buffer()));
InsetTabular tmp(const_cast<Buffer *>(&buffer()));
tabular_ = tmp.tabular;
}
active_cell_ = Tabular::npos;

View File

@ -506,7 +506,7 @@ public:
protected:
/// Constructors
Inset(Buffer * buf = 0) : buffer_(buf) {}
Inset(Buffer * buf) : buffer_(buf) {}
Inset(Inset const &) : buffer_(0) {}
/// replicate ourselves

View File

@ -48,10 +48,10 @@ int InsetBibitem::key_counter = 0;
docstring const key_prefix = from_ascii("key-");
InsetBibitem::InsetBibitem(Buffer const & buf, InsetCommandParams const & p)
InsetBibitem::InsetBibitem(Buffer * buf, InsetCommandParams const & p)
: InsetCommand(p, "bibitem")
{
Inset::setBuffer(const_cast<Buffer &>(buf));
Inset::setBuffer(*buf);
buffer_->invalidateBibinfoCache();
if (getParam("key").empty())
setParam("key", key_prefix + convert<docstring>(++key_counter));

View File

@ -32,7 +32,7 @@ class InsetBibitem : public InsetCommand
{
public:
///
InsetBibitem(Buffer const &, InsetCommandParams const &);
InsetBibitem(Buffer *, InsetCommandParams const &);
///
virtual ~InsetBibitem();
///

View File

@ -51,10 +51,10 @@ namespace Alert = frontend::Alert;
namespace os = support::os;
InsetBibtex::InsetBibtex(Buffer const & buf, InsetCommandParams const & p)
InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p)
: InsetCommand(p, "bibtex")
{
Inset::setBuffer(const_cast<Buffer &>(buf));
Inset::setBuffer(const_cast<Buffer &>(*buf));
buffer_->invalidateBibinfoCache();
}

View File

@ -26,7 +26,7 @@ namespace lyx {
class InsetBibtex : public InsetCommand {
public:
///
InsetBibtex(Buffer const &, InsetCommandParams const &);
InsetBibtex(Buffer *, InsetCommandParams const &);
///
virtual ~InsetBibtex();
///

View File

@ -96,7 +96,7 @@ BoxTranslatorLoc const & boxtranslator_loc()
//
/////////////////////////////////////////////////////////////////////////
InsetBox::InsetBox(Buffer const & buffer, string const & label)
InsetBox::InsetBox(Buffer * buffer, string const & label)
: InsetCollapsable(buffer), params_(label)
{}

View File

@ -76,7 +76,7 @@ public:
Doublebox
};
///
InsetBox(Buffer const &, std::string const &);
InsetBox(Buffer *, std::string const &);
///
~InsetBox();
///

View File

@ -40,7 +40,7 @@ using namespace std;
namespace lyx {
InsetBranch::InsetBranch(Buffer const & buf, InsetBranchParams const & params)
InsetBranch::InsetBranch(Buffer * buf, InsetBranchParams const & params)
: InsetCollapsable(buf, InsetText::DefaultLayout), params_(params)
{}

View File

@ -43,7 +43,7 @@ class InsetBranch : public InsetCollapsable
{
public:
///
InsetBranch(Buffer const &, InsetBranchParams const &);
InsetBranch(Buffer *, InsetBranchParams const &);
///
~InsetBranch();

View File

@ -47,7 +47,7 @@ using namespace lyx::support;
namespace lyx {
InsetCaption::InsetCaption(Buffer const & buf)
InsetCaption::InsetCaption(Buffer * buf)
: InsetText(buf, InsetText::PlainLayout)
{
setAutoBreakRows(true);

View File

@ -21,7 +21,7 @@ namespace lyx {
class InsetCaption : public InsetText {
public:
///
InsetCaption(Buffer const &);
InsetCaption(Buffer *);
///
std::string const & type() const { return type_; }
/// return the mandatory argument (LaTeX format) only

View File

@ -41,7 +41,7 @@ using namespace std;
namespace lyx {
InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype)
InsetCollapsable::InsetCollapsable(Buffer * buf, InsetText::UsePlain ltype)
: InsetText(buf, ltype), status_(Open),
openinlined_(false), mouse_hover_(false)
{

View File

@ -33,7 +33,7 @@ namespace frontend { class Painter; }
class InsetCollapsable : public InsetText {
public:
///
InsetCollapsable(Buffer const &, InsetText::UsePlain = InsetText::PlainLayout);
InsetCollapsable(Buffer *, InsetText::UsePlain = InsetText::PlainLayout);
///
InsetCollapsable(InsetCollapsable const & rhs);
///

View File

@ -53,7 +53,7 @@ namespace lyx {
// place of the mailer name and recover that information?
InsetCommand::InsetCommand(InsetCommandParams const & p,
string const & mailer_name)
: p_(p),
: Inset(0), p_(p),
mailer_name_(mailer_name),
mouse_hover_(false)
{}

View File

@ -34,7 +34,7 @@ namespace lyx {
class InsetCommand : public Inset
{
public:
///
/// FIXME: pass Buffer here!
InsetCommand(InsetCommandParams const &, std::string const & mailer_name);
///
~InsetCommand();

View File

@ -44,7 +44,7 @@ using namespace lyx::support;
namespace lyx {
InsetERT::InsetERT(Buffer const & buf, CollapseStatus status)
InsetERT::InsetERT(Buffer * buf, CollapseStatus status)
: InsetCollapsable(buf)
{
status_ = status;

View File

@ -32,7 +32,7 @@ class Language;
class InsetERT : public InsetCollapsable {
public:
///
InsetERT(Buffer const &, CollapseStatus status = Open);
InsetERT(Buffer *, CollapseStatus status = Open);
///
~InsetERT();
///

View File

@ -364,10 +364,9 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
}
InsetExternal::InsetExternal(Buffer & buf)
: renderer_(new RenderButton)
InsetExternal::InsetExternal(Buffer * buf)
: Inset(buf), renderer_(new RenderButton)
{
Inset::setBuffer(buf);
}

View File

@ -94,7 +94,7 @@ class RenderBase;
class InsetExternal : public Inset, public boost::signals::trackable
{
public:
InsetExternal(Buffer &);
InsetExternal(Buffer *);
///
~InsetExternal();
///

View File

@ -30,7 +30,7 @@ using namespace std;
namespace lyx {
InsetFlex::InsetFlex(Buffer const & buf, string const & layoutName)
InsetFlex::InsetFlex(Buffer * buf, string const & layoutName)
: InsetCollapsable(buf), name_(layoutName)
{
status_= Collapsed;

View File

@ -23,7 +23,7 @@ namespace lyx {
class InsetFlex : public InsetCollapsable {
public:
///
InsetFlex(Buffer const &, std::string const & layoutName);
InsetFlex(Buffer *, std::string const & layoutName);
///
docstring name() const { return from_utf8(name_); }
///

View File

@ -110,7 +110,7 @@ namespace lyx {
// Lgb
InsetFloat::InsetFloat(Buffer const & buf, string const & type)
InsetFloat::InsetFloat(Buffer * buf, string const & type)
: InsetCollapsable(buf), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type));

View File

@ -51,7 +51,7 @@ class InsetFloat : public InsetCollapsable
{
public:
///
InsetFloat(Buffer const &, std::string const &);
InsetFloat(Buffer *, std::string const &);
///
~InsetFloat();

View File

@ -31,7 +31,7 @@ using namespace std;
namespace lyx {
InsetFoot::InsetFoot(Buffer const & buf)
InsetFoot::InsetFoot(Buffer * buf)
: InsetFootlike(buf)
{}

View File

@ -25,7 +25,7 @@ class InsetFoot : public InsetFootlike
{
public:
///
InsetFoot(Buffer const &);
InsetFoot(Buffer *);
private:
///
InsetCode lyxCode() const { return FOOT_CODE; }

View File

@ -24,7 +24,7 @@ using namespace std;
namespace lyx {
InsetFootlike::InsetFootlike(Buffer const & buf)
InsetFootlike::InsetFootlike(Buffer * buf)
: InsetCollapsable(buf)
{}

View File

@ -23,7 +23,7 @@ namespace lyx {
class InsetFootlike : public InsetCollapsable {
public:
///
InsetFootlike(Buffer const &);
InsetFootlike(Buffer *);
///
bool hasSettings() const { return false; }
private:

View File

@ -160,11 +160,10 @@ void readInsetGraphics(Lexer & lex, string const & bufpath,
} // namespace anon
InsetGraphics::InsetGraphics(Buffer & buf)
: graphic_label(sgml::uniqueID(from_ascii("graph"))),
InsetGraphics::InsetGraphics(Buffer * buf)
: Inset(buf), graphic_label(sgml::uniqueID(from_ascii("graph"))),
graphic_(new RenderGraphic(this))
{
Inset::setBuffer(buf);
}

View File

@ -33,7 +33,7 @@ class InsetGraphics : public Inset
{
public:
///
InsetGraphics(Buffer & buf);
InsetGraphics(Buffer * buf);
///
~InsetGraphics();

View File

@ -48,7 +48,7 @@ namespace lyx {
///////////////////////////////////////////////////////////////////////
InsetIndex::InsetIndex(Buffer const & buf, InsetIndexParams const & params)
InsetIndex::InsetIndex(Buffer * buf, InsetIndexParams const & params)
: InsetCollapsable(buf), params_(params)
{}

View File

@ -38,7 +38,7 @@ public:
class InsetIndex : public InsetCollapsable {
public:
///
InsetIndex(Buffer const &, InsetIndexParams const &);
InsetIndex(Buffer *, InsetIndexParams const &);
///
static std::string params2string(InsetIndexParams const &);
///

View File

@ -82,7 +82,7 @@ NameTranslator const & nameTranslator()
InsetInfo::InsetInfo(Buffer const & buf, string const & name)
InsetInfo::InsetInfo(Buffer * buf, string const & name)
: InsetCollapsable(buf), type_(UNKNOWN_INFO), name_()
{
setAutoBreakRows(true);
@ -355,7 +355,7 @@ void InsetInfo::updateInfo()
FileName file(to_utf8(icon_name));
if (!file.exists())
break;
InsetGraphics * inset = new InsetGraphics(buffer());
InsetGraphics * inset = new InsetGraphics(buffer_);
InsetGraphicsParams igp;
igp.filename = file;
inset->setParams(igp);

View File

@ -90,7 +90,7 @@ public:
};
///
InsetInfo(Buffer const & buf, std::string const & info = std::string());
InsetInfo(Buffer * buf, std::string const & info = std::string());
///
InsetCode lyxCode() const { return INFO_CODE; }
///

View File

@ -176,7 +176,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd)
InsetCommandParams p(REF_CODE, "ref");
p["reference"] = getParam("name");
cap::clearSelection();
cap::copyInset(cur, new InsetRef(buffer(), p), getParam("name"));
cap::copyInset(cur, new InsetRef(buffer_, p), getParam("name"));
break;
}

View File

@ -21,7 +21,7 @@ namespace lyx {
class InsetLine : public Inset {
public:
///
InsetLine() {}
InsetLine() : Inset(0) {}
///
InsetCode lyxCode() const { return LINE_CODE; }
///

View File

@ -51,7 +51,7 @@ using boost::regex;
char const lstinline_delimiters[] =
"!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
InsetListings::InsetListings(Buffer const & buf, InsetListingsParams const & par)
InsetListings::InsetListings(Buffer * buf, InsetListingsParams const & par)
: InsetCollapsable(buf)
{
status_ = par.status();

View File

@ -30,7 +30,7 @@ class InsetListings : public InsetCollapsable
{
public:
///
InsetListings(Buffer const &, InsetListingsParams const & par = InsetListingsParams());
InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams());
///
~InsetListings();
///

View File

@ -24,7 +24,7 @@
namespace lyx {
InsetMarginal::InsetMarginal(Buffer const & buf)
InsetMarginal::InsetMarginal(Buffer * buf)
: InsetFootlike(buf)
{}

View File

@ -25,7 +25,7 @@ namespace lyx {
class InsetMarginal : public InsetFootlike {
public:
///
InsetMarginal(Buffer const &);
InsetMarginal(Buffer *);
///
InsetCode lyxCode() const { return MARGIN_CODE; }
///

View File

@ -32,7 +32,7 @@ using namespace std;
namespace lyx {
InsetNewline::InsetNewline()
InsetNewline::InsetNewline() : Inset(0)
{}

View File

@ -44,7 +44,8 @@ public:
///
InsetNewline();
///
InsetNewline(InsetNewlineParams par) { params_.kind = par.kind; }
InsetNewline(InsetNewlineParams par) : Inset(0)
{ params_.kind = par.kind; }
///
static void string2params(std::string const &, InsetNewlineParams &);
///

View File

@ -34,12 +34,12 @@ using namespace std;
namespace lyx {
InsetNewpage::InsetNewpage()
InsetNewpage::InsetNewpage() : Inset(0)
{}
InsetNewpage::InsetNewpage(InsetNewpageParams const & params)
: params_(params)
: Inset(0), params_(params)
{}

View File

@ -115,7 +115,7 @@ void InsetNoteParams::read(Lexer & lex)
//
/////////////////////////////////////////////////////////////////////
InsetNote::InsetNote(Buffer const & buf, string const & label)
InsetNote::InsetNote(Buffer * buf, string const & label)
: InsetCollapsable(buf)
{
params_.type = notetranslator().find(label);

View File

@ -47,7 +47,7 @@ class InsetNote : public InsetCollapsable
{
public:
///
InsetNote(Buffer const &, std::string const &);
InsetNote(Buffer *, std::string const &);
///
~InsetNote();
///

View File

@ -21,7 +21,7 @@ using namespace std;
namespace lyx {
InsetOptArg::InsetOptArg(Buffer const & buf)
InsetOptArg::InsetOptArg(Buffer * buf)
: InsetCollapsable(buf)
{}

View File

@ -27,7 +27,7 @@ class InsetOptArg : public InsetCollapsable
{
public:
///
InsetOptArg(Buffer const &);
InsetOptArg(Buffer *);
/// Outputting the optional parameter of a LaTeX command
int latexOptional(odocstream &, OutputParams const &) const;

View File

@ -112,7 +112,7 @@ void InsetPhantomParams::read(Lexer & lex)
//
/////////////////////////////////////////////////////////////////////
InsetPhantom::InsetPhantom(Buffer const & buf, string const & label)
InsetPhantom::InsetPhantom(Buffer * buf, string const & label)
: InsetCollapsable(buf)
{
setDrawFrame(false);

View File

@ -47,7 +47,7 @@ class InsetPhantom : public InsetCollapsable
{
public:
///
InsetPhantom(Buffer const &, std::string const &);
InsetPhantom(Buffer *, std::string const &);
///
~InsetPhantom();
///

View File

@ -88,25 +88,27 @@ char const * const latex_quote_babel[2][5] = {
} // namespace anon
InsetQuotes::InsetQuotes(Buffer const & buf, string const & str)
InsetQuotes::InsetQuotes(Buffer * buf, string const & str) : Inset(buf)
{
parseString(str);
setBuffer(const_cast<Buffer &>(buf));
}
InsetQuotes::InsetQuotes(Buffer const & buf, char_type c)
: language_(buf.params().quotes_language), times_(buf.params().quotes_times)
InsetQuotes::InsetQuotes(Buffer * buf, char_type c) : Inset(buf)
{
if (buf) {
language_ = buf->params().quotes_language;
times_ = buf->params().quotes_times;
}
setSide(c);
setBuffer(const_cast<Buffer &>(buf));
}
InsetQuotes::InsetQuotes(Buffer const & buf, char_type c, QuoteTimes t)
: language_(buf.params().quotes_language), times_(t)
InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteTimes t)
: Inset(buf), times_(t)
{
if (buf)
language_ = buf->params().quotes_language;
setSide(c);
setBuffer(const_cast<Buffer &>(buf));
}

View File

@ -62,11 +62,11 @@ public:
\item etc.
\end{itemize}
*/
explicit InsetQuotes(Buffer const & buf, std::string const & str = "eld");
explicit InsetQuotes(Buffer * buf, std::string const & str = "eld");
/// Create the right quote inset after character c
InsetQuotes(Buffer const & buffer, char_type c);
InsetQuotes(Buffer * buffer, char_type c);
/// Direct access to inner/outer quotation marks
InsetQuotes(Buffer const & buf, char_type c, QuoteTimes t);
InsetQuotes(Buffer * buf, char_type c, QuoteTimes t);
///
docstring name() const;
///

View File

@ -32,8 +32,8 @@ using namespace std;
namespace lyx {
InsetRef::InsetRef(Buffer const & buf, InsetCommandParams const & p)
: InsetCommand(p, "ref"), isLatex(buf.isLatex())
InsetRef::InsetRef(Buffer * buf, InsetCommandParams const & p)
: InsetCommand(p, "ref"), isLatex(buf->isLatex())
{}

View File

@ -36,7 +36,7 @@ public:
static std::string const & getName(int type);
InsetRef(Buffer const & buffer, InsetCommandParams const &);
InsetRef(Buffer * buffer, InsetCommandParams const &);
///
bool isLabeled() const { return true; }

View File

@ -43,7 +43,7 @@ namespace lyx {
InsetSpace::InsetSpace(InsetSpaceParams const & params)
: params_(params)
: Inset(0), params_(params)
{}

View File

@ -95,7 +95,7 @@ class InsetSpace : public Inset
{
public:
///
InsetSpace() {}
InsetSpace() : Inset(0) {}
///
explicit InsetSpace(InsetSpaceParams const & par);
///

View File

@ -32,7 +32,7 @@ namespace lyx {
InsetSpecialChar::InsetSpecialChar(Kind k)
: kind_(k)
: Inset(0), kind_(k)
{}

View File

@ -45,7 +45,7 @@ public:
};
///
InsetSpecialChar() {}
InsetSpecialChar() : Inset(0) {}
///
explicit InsetSpecialChar(Kind k);
///

View File

@ -514,7 +514,7 @@ string const featureAsString(Tabular::Feature feature)
/////////////////////////////////////////////////////////////////////
Tabular::CellData::CellData(Buffer & buf)
Tabular::CellData::CellData(Buffer * buf)
: cellno(0),
width(0),
multicolumn(Tabular::CELL_NORMAL),
@ -528,7 +528,7 @@ Tabular::CellData::CellData(Buffer & buf)
rotate(false),
inset(new InsetTableCell(buf))
{
inset->setBuffer(const_cast<Buffer &>(buf));
inset->setBuffer(*buf);
}
@ -605,7 +605,7 @@ Tabular::ltType::ltType()
{}
Tabular::Tabular(Buffer & buffer, row_type rows_arg, col_type columns_arg)
Tabular::Tabular(Buffer * buffer, row_type rows_arg, col_type columns_arg)
{
init(buffer, rows_arg, columns_arg);
}
@ -624,10 +624,10 @@ void Tabular::setBuffer(Buffer & buffer)
// activates all lines and sets all widths to 0
void Tabular::init(Buffer & buf, row_type rows_arg,
void Tabular::init(Buffer * buf, row_type rows_arg,
col_type columns_arg)
{
buffer_ = &buf;
buffer_ = buf;
row_info = row_vector(rows_arg);
column_info = column_vector(columns_arg);
cell_info = cell_vvector(rows_arg, cell_vector(columns_arg, CellData(buf)));
@ -656,7 +656,7 @@ void Tabular::init(Buffer & buf, row_type rows_arg,
void Tabular::appendRow(idx_type const cell)
{
BufferParams const & bp = buffer().params();
BufferParams const & bp = buffer_->params();
row_type const row = cellRow(cell);
row_vector::iterator rit = row_info.begin() + row;
@ -671,7 +671,7 @@ void Tabular::appendRow(idx_type const cell)
for (row_type i = 0; i < nrows - 1; ++i)
swap(cell_info[i], old[i]);
cell_info = cell_vvector(nrows, cell_vector(ncols, CellData(buffer())));
cell_info = cell_vvector(nrows, cell_vector(ncols, CellData(buffer_)));
for (row_type i = 0; i <= row; ++i)
swap(cell_info[i], old[i]);
@ -733,7 +733,7 @@ void Tabular::appendColumn(idx_type const cell)
for (row_type r = 0; r < nrows; ++r) {
cell_info[r].insert(cell_info[r].begin() + c + 1,
CellData(buffer()));
CellData(buffer_));
#if 0
// FIXME: This code does not work. It deletes the cell's content and
// it triggers an assertion if the cursor is at pos > 0.
@ -1421,7 +1421,7 @@ void Tabular::read(Lexer & lex)
int columns_arg;
if (!getTokenValue(line, "columns", columns_arg))
return;
init(buffer(), rows_arg, columns_arg);
init(buffer_, rows_arg, columns_arg);
l_getline(is, line);
if (!prefixIs(line, "<features")) {
lyxerr << "Wrong tabular format (expected <features ...> got"
@ -2902,7 +2902,7 @@ Tabular::BoxType Tabular::useParbox(idx_type cell) const
//
/////////////////////////////////////////////////////////////////////
InsetTableCell::InsetTableCell(Buffer & buf)
InsetTableCell::InsetTableCell(Buffer * buf)
: InsetText(buf, InsetText::PlainLayout), isFixedWidth(false),
contentAlign(LYX_ALIGN_CENTER)
{}
@ -2964,12 +2964,11 @@ docstring InsetTableCell::asString(bool intoInsets)
//
/////////////////////////////////////////////////////////////////////
InsetTabular::InsetTabular(Buffer & buf, row_type rows,
InsetTabular::InsetTabular(Buffer * buf, row_type rows,
col_type columns)
: tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))), scx_(0),
: Inset(buf), tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))), scx_(0),
rowselect_(false), colselect_(false)
{
setBuffer(buf); // FIXME: remove later
}
@ -5211,7 +5210,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
col_type ocol = 0;
row_type row = 0;
if (usePaste) {
paste_tabular.reset(new Tabular(buffer(), rows, maxCols));
paste_tabular.reset(new Tabular(buffer_, rows, maxCols));
loctab = paste_tabular.get();
cols = 0;
dirtyTabularStack(true);

View File

@ -256,7 +256,7 @@ public:
static const idx_type npos = static_cast<idx_type>(-1);
/// constructor
Tabular(Buffer &, col_type columns_arg, row_type rows_arg);
Tabular(Buffer * buf, col_type columns_arg, row_type rows_arg);
/// Returns true if there is a topline, returns false if not
bool topLine(idx_type cell) const;
@ -465,7 +465,7 @@ public:
class CellData {
public:
///
CellData(Buffer &);
CellData(Buffer *);
///
CellData(CellData const &);
///
@ -598,7 +598,7 @@ public:
ltType endlastfoot;
///
void init(Buffer &, row_type rows_arg,
void init(Buffer *, row_type rows_arg,
col_type columns_arg);
///
void updateIndexes();
@ -662,7 +662,7 @@ class InsetTableCell : public InsetText
{
public:
///
InsetTableCell(Buffer & buf);
InsetTableCell(Buffer * buf);
///
InsetCode lyxCode() const { return CELL_CODE; }
///
@ -729,7 +729,7 @@ class InsetTabular : public Inset
{
public:
///
InsetTabular(Buffer &, row_type rows = 1,
InsetTabular(Buffer *, row_type rows = 1,
col_type columns = 1);
///
~InsetTabular();

View File

@ -74,10 +74,9 @@ using graphics::PreviewLoader;
/////////////////////////////////////////////////////////////////////
InsetText::InsetText(Buffer const & buf, UsePlain type)
: drawFrame_(false), frame_color_(Color_insetframe), text_(this)
InsetText::InsetText(Buffer * buf, UsePlain type)
: Inset(buf), drawFrame_(false), frame_color_(Color_insetframe), text_(this)
{
setBuffer(const_cast<Buffer &>(buf));
initParagraphs(type);
}

View File

@ -42,7 +42,7 @@ public:
/// \param useplain whether to use the plain layout
/// This is needed because we cannot call the virtual function
/// usePlainLayout() from within the constructor.
explicit InsetText(Buffer const & buffer, UsePlain type = DefaultLayout);
explicit InsetText(Buffer * buffer, UsePlain type = DefaultLayout);
///
InsetText(InsetText const &);
///

View File

@ -47,7 +47,7 @@ int const ADD_TO_VSPACE_WIDTH = 5;
InsetVSpace::InsetVSpace(VSpace const & space)
: space_(space)
: Inset(0), space_(space)
{}

View File

@ -22,7 +22,7 @@ class InsetVSpace : public Inset
{
public:
///
InsetVSpace() {}
InsetVSpace() : Inset(0) {}
///
InsetVSpace(VSpace const &);
///

View File

@ -39,7 +39,7 @@ using namespace std;
namespace lyx {
InsetWrap::InsetWrap(Buffer const & buf, string const & type)
InsetWrap::InsetWrap(Buffer * buf, string const & type)
: InsetCollapsable(buf)
{
setLabel(_("wrap: ") + floatName(type));

View File

@ -44,7 +44,7 @@ public:
class InsetWrap : public InsetCollapsable {
public:
///
InsetWrap(Buffer const &, std::string const &);
InsetWrap(Buffer *, std::string const &);
///
~InsetWrap();
///

View File

@ -1245,7 +1245,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
InsetCommandParams p(REF_CODE, "ref");
p["reference"] = label(row);
cap::clearSelection();
cap::copyInset(cur, new InsetRef(*cur.buffer(), p), label(row));
cap::copyInset(cur, new InsetRef(buffer_, p), label(row));
break;
}

View File

@ -32,15 +32,15 @@ using namespace std;
namespace lyx {
InsetMathMBox::InsetMathMBox(Buffer const & buffer) : text_(buffer)
InsetMathMBox::InsetMathMBox(Buffer * buffer) : InsetMath(buffer), text_(buffer)
{
text_.paragraphs().clear();
text_.paragraphs().push_back(Paragraph());
}
InsetMathMBox::InsetMathMBox(Buffer const & buffer, Layout const & layout)
: text_(buffer)
InsetMathMBox::InsetMathMBox(Buffer * buffer, Layout const & layout)
: InsetMath(buffer), text_(buffer)
{
text_.paragraphs().clear();
text_.paragraphs().push_back(Paragraph());

View File

@ -31,8 +31,8 @@ class BufferView;
class InsetMathMBox : public InsetMath {
public:
///
explicit InsetMathMBox(Buffer const & buffer);
explicit InsetMathMBox(Buffer const & buffer, Layout const & layout);
explicit InsetMathMBox(Buffer * buffer);
explicit InsetMathMBox(Buffer * buffer, Layout const & layout);
/// this stores metrics information in cache_
void metrics(MetricsInfo & mi, Dimension & dim) const;