try to pass a Buffer & to inset construction if some buffer(param)

access is needed


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23465 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-04 22:28:18 +00:00
parent bddf480792
commit a694476ac6
44 changed files with 137 additions and 159 deletions

View File

@ -167,9 +167,6 @@ public:
*/
bool file_fully_loaded;
/// our Text that should be wrapped in an InsetText
InsetText inset;
///
mutable TocBackend toc_backend;
@ -209,6 +206,9 @@ public:
mutable EmbeddedFileList bibfilesCache_;
mutable RefCache ref_cache_;
/// our Text that should be wrapped in an InsetText
InsetText inset;
};
/// Creates the per buffer temporary directory
@ -233,13 +233,11 @@ static FileName createBufferTmpDir()
Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_)
: parent_buffer(0), lyx_clean(true), bak_clean(true), unnamed(false),
read_only(readonly_), filename(file), file_fully_loaded(false),
inset(params), toc_backend(&parent), macro_lock(false),
toc_backend(&parent), macro_lock(false),
embedded_files(), timestamp_(0), checksum_(0), wa_(0),
undo_(parent)
{
temppath = createBufferTmpDir();
inset.setBuffer(parent);
inset.setAutoBreakRows(true);
lyxvc.setBuffer(&parent);
if (use_gui)
wa_ = new frontend::WorkAreaManager;
@ -251,6 +249,9 @@ Buffer::Buffer(string const & file, bool readonly)
{
LYXERR(Debug::INFO, "Buffer::Buffer()");
d->inset.setBuffer(*this);
d->inset.initParagraphs(*this);
d->inset.setAutoBreakRows(true);
d->inset.getText(0)->setMacrocontextPosition(par_iterator_begin());
}

View File

@ -225,7 +225,7 @@ void Text::setLayout(Cursor & cur, docstring const & layout)
lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN));
lyx::dispatch(FuncRequest(LFUN_LINE_END_SELECT));
lyx::dispatch(FuncRequest(LFUN_CUT));
Inset * inset = new InsetEnvironment(params, layout);
Inset * inset = new InsetEnvironment(bv.buffer(), layout);
insertInset(cur, inset);
//inset->edit(cur, true);
//lyx::dispatch(FuncRequest(LFUN_PASTE));

View File

@ -102,44 +102,44 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case LFUN_FLEX_INSERT: {
string s = cmd.getArg(0);
return new InsetFlex(params, params.documentClassPtr(), s);
return new InsetFlex(buf, buf.params().documentClassPtr(), s);
}
case LFUN_NOTE_INSERT: {
string arg = cmd.getArg(0);
if (arg.empty())
arg = "Note";
return new InsetNote(params, arg);
return new InsetNote(buf, arg);
}
case LFUN_BOX_INSERT: {
string arg = cmd.getArg(0);
if (arg.empty())
arg = "Boxed";
return new InsetBox(params, arg);
return new InsetBox(buf, arg);
}
case LFUN_BRANCH_INSERT: {
docstring arg = cmd.argument();
if (arg.empty())
arg = from_ascii("none");
return new InsetBranch(params, InsetBranchParams(arg));
return new InsetBranch(buf, InsetBranchParams(arg));
}
case LFUN_ERT_INSERT:
return new InsetERT(params);
return new InsetERT(buf);
case LFUN_LISTING_INSERT:
return new InsetListings(params);
return new InsetListings(buf);
case LFUN_FOOTNOTE_INSERT:
return new InsetFoot(params);
return new InsetFoot(buf);
case LFUN_MARGINALNOTE_INSERT:
return new InsetMarginal(params);
return new InsetMarginal(buf);
case LFUN_OPTIONAL_INSERT:
return new InsetOptArg(params);
return new InsetOptArg(buf);
case LFUN_BIBITEM_INSERT:
return new InsetBibitem(InsetCommandParams(BIBITEM_CODE));
@ -147,8 +147,8 @@ 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 (params.documentClass().floats().typeExist(argument))
return new InsetFloat(params, argument);
if (buf.params().documentClass().floats().typeExist(argument))
return new InsetFloat(buf, argument);
lyxerr << "Non-existent float type: " << argument << endl;
}
@ -156,7 +156,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
// check if the float type exists
string const argument = to_utf8(cmd.argument());
if (params.documentClass().floats().typeExist(argument)) {
auto_ptr<InsetFloat> p(new InsetFloat(params, argument));
auto_ptr<InsetFloat> p(new InsetFloat(buf, argument));
p->wide(true, params);
return p.release();
}
@ -167,13 +167,13 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case LFUN_WRAP_INSERT: {
string const argument = to_utf8(cmd.argument());
if (argument == "figure" || argument == "table")
return new InsetWrap(params, argument);
return new InsetWrap(buf, argument);
lyxerr << "Non-existent wrapfig type: " << argument << endl;
return 0;
}
case LFUN_INDEX_INSERT:
return new InsetIndex(params);
return new InsetIndex(buf);
case LFUN_NOMENCL_INSERT: {
InsetCommandParams icp(NOMENCL_CODE);
@ -195,7 +195,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
}
case LFUN_CAPTION_INSERT: {
auto_ptr<InsetCaption> inset(new InsetCaption(params));
auto_ptr<InsetCaption> inset(new InsetCaption(buf));
inset->setAutoBreakRows(true);
inset->setDrawFrame(true);
inset->setFrameColor(Color_captionframe);
@ -212,10 +212,10 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
return new InsetTOC(InsetCommandParams(TOC_CODE));
case LFUN_ENVIRONMENT_INSERT:
return new InsetEnvironment(params, cmd.argument());
return new InsetEnvironment(buf, cmd.argument());
case LFUN_INFO_INSERT:
return new InsetInfo(params, to_utf8(cmd.argument()));
return new InsetInfo(buf, to_utf8(cmd.argument()));
#if 0
case LFUN_THEOREM_INSERT:
return new InsetTheorem;
@ -250,13 +250,13 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case ERT_CODE: {
InsetCollapsable::CollapseStatus st;
InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
return new InsetERT(params, st);
return new InsetERT(buf, st);
}
case LISTINGS_CODE: {
InsetListingsParams par;
InsetListingsMailer::string2params(to_utf8(cmd.argument()), par);
return new InsetListings(params, par);
return new InsetListings(buf, par);
}
case EXTERNAL_CODE: {
@ -288,7 +288,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
}
case INDEX_CODE:
return new InsetIndex(params);
return new InsetIndex(buf);
case NOMENCL_CODE: {
InsetCommandParams icp(code);
@ -305,7 +305,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case REF_CODE: {
InsetCommandParams icp(code);
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
return new InsetRef(icp, buf);
return new InsetRef(buf, icp);
}
case TOC_CODE: {
@ -446,7 +446,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
break;
case REF_CODE:
if (!inscmd["name"].empty() || !inscmd["reference"].empty())
inset.reset(new InsetRef(inscmd, buf));
inset.reset(new InsetRef(buf, inscmd));
break;
case TOC_CODE:
inset.reset(new InsetTOC(inscmd));
@ -478,58 +478,58 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
} else if (tmptok == "Graphics") {
inset.reset(new InsetGraphics);
} else if (tmptok == "Note") {
inset.reset(new InsetNote(buf.params(), tmptok));
inset.reset(new InsetNote(buf, tmptok));
} else if (tmptok == "Box") {
inset.reset(new InsetBox(buf.params(), tmptok));
inset.reset(new InsetBox(buf, tmptok));
} else if (tmptok == "Flex") {
lex.next();
string s = lex.getString();
inset.reset(new InsetFlex(buf.params(),
inset.reset(new InsetFlex(buf,
buf.params().documentClassPtr(), s));
} else if (tmptok == "Branch") {
inset.reset(new InsetBranch(buf.params(),
inset.reset(new InsetBranch(buf,
InsetBranchParams()));
} else if (tmptok == "Environment") {
lex.next();
inset.reset(new InsetEnvironment(buf.params(), lex.getDocString()));
inset.reset(new InsetEnvironment(buf, lex.getDocString()));
} else if (tmptok == "ERT") {
inset.reset(new InsetERT(buf.params()));
inset.reset(new InsetERT(buf));
} else if (tmptok == "listings") {
inset.reset(new InsetListings(buf.params()));
inset.reset(new InsetListings(buf));
} else if (tmptok == "InsetSpace") {
inset.reset(new InsetSpace);
} else if (tmptok == "Tabular") {
inset.reset(new InsetTabular(buf));
} else if (tmptok == "Text") {
inset.reset(new InsetText(buf.params()));
inset.reset(new InsetText(buf));
} else if (tmptok == "VSpace") {
inset.reset(new InsetVSpace);
} else if (tmptok == "Foot") {
inset.reset(new InsetFoot(buf.params()));
inset.reset(new InsetFoot(buf));
} else if (tmptok == "Marginal") {
inset.reset(new InsetMarginal(buf.params()));
inset.reset(new InsetMarginal(buf));
} else if (tmptok == "OptArg") {
inset.reset(new InsetOptArg(buf.params()));
inset.reset(new InsetOptArg(buf));
} else if (tmptok == "Float") {
lex.next();
string tmptok = lex.getString();
inset.reset(new InsetFloat(buf.params(), tmptok));
inset.reset(new InsetFloat(buf, tmptok));
} else if (tmptok == "Wrap") {
lex.next();
string tmptok = lex.getString();
inset.reset(new InsetWrap(buf.params(), tmptok));
inset.reset(new InsetWrap(buf, tmptok));
#if 0
} else if (tmptok == "Theorem") {
inset.reset(new InsetList);
#endif
} else if (tmptok == "Caption") {
inset.reset(new InsetCaption(buf.params()));
inset.reset(new InsetCaption(buf));
} else if (tmptok == "Index") {
inset.reset(new InsetIndex(buf.params()));
inset.reset(new InsetIndex(buf));
} else if (tmptok == "FloatList") {
inset.reset(new InsetFloatList);
} else if (tmptok == "Info") {
inset.reset(new InsetInfo(buf.params()));
inset.reset(new InsetInfo(buf));
} else {
lyxerr << "unknown Inset type '" << tmptok
<< "'" << endl;

View File

@ -85,11 +85,11 @@ BoxTranslatorLoc const & boxtranslator_loc()
} // anon
InsetBox::InsetBox(BufferParams const & bp, string const & label)
: InsetCollapsable(bp), params_(label)
InsetBox::InsetBox(Buffer const & buffer, string const & label)
: InsetCollapsable(buffer), params_(label)
{
if (forceEmptyLayout())
paragraphs().back().setLayout(bp.documentClass().emptyLayout());
paragraphs().back().setLayout(buffer.params().documentClass().emptyLayout());
}

View File

@ -58,7 +58,7 @@ public:
class InsetBox : public InsetCollapsable {
public:
///
InsetBox(BufferParams const &, std::string const &);
InsetBox(Buffer const &, std::string const &);
///
~InsetBox();
///

View File

@ -33,14 +33,8 @@ using namespace std;
namespace lyx {
InsetBranch::InsetBranch(BufferParams const & bp,
InsetBranchParams const & params)
: InsetCollapsable(bp), params_(params)
{}
InsetBranch::InsetBranch(InsetBranch const & in)
: InsetCollapsable(in), params_(in.params_)
InsetBranch::InsetBranch(Buffer const & buf, InsetBranchParams const & params)
: InsetCollapsable(buf), params_(params)
{}
@ -50,12 +44,6 @@ InsetBranch::~InsetBranch()
}
Inset * InsetBranch::clone() const
{
return new InsetBranch(*this);
}
docstring InsetBranch::editMessage() const
{
return _("Opened Branch Inset");

View File

@ -37,7 +37,7 @@ public:
class InsetBranch : public InsetCollapsable {
public:
///
InsetBranch(BufferParams const &, InsetBranchParams const &);
InsetBranch(Buffer const &, InsetBranchParams const &);
///
~InsetBranch();
///
@ -83,16 +83,14 @@ public:
docstring toolTip(BufferView const & bv, int x, int y) const;
protected:
///
InsetBranch(InsetBranch const &);
///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
docstring name() const { return from_ascii("Branch"); }
private:
///
friend class InsetBranchParams;
virtual Inset * clone() const;
///
Inset * clone() const { return new InsetBranch(*this); }
///
InsetBranchParams params_;
};

View File

@ -56,15 +56,14 @@ InsetCaption::InsetCaption(InsetCaption const & ic)
}
InsetCaption::InsetCaption(BufferParams const & bp)
: InsetText(bp)
InsetCaption::InsetCaption(Buffer const & buf)
: InsetText(buf)
{
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_captionframe);
//FIXME Do we need to set all paragraphs here? or will there
//always only be one?
paragraphs().back().setLayout(bp.documentClass().emptyLayout());
// There will always be only one
paragraphs().back().setLayout(buf.params().documentClass().emptyLayout());
}

View File

@ -22,7 +22,7 @@ class InsetCaption : public InsetText {
public:
///
InsetCaption(InsetCaption const &);
InsetCaption(BufferParams const &);
InsetCaption(Buffer const &);
///
virtual ~InsetCaption() {}
///

View File

@ -77,16 +77,16 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
}
InsetCollapsable::InsetCollapsable(BufferParams const & bp,
InsetCollapsable::InsetCollapsable(Buffer const & buf,
CollapseStatus status, DocumentClass * dc)
: InsetText(bp), status_(status),
: InsetText(buf), status_(status),
openinlined_(false), autoOpen_(false), mouse_hover_(false)
{
setLayout(dc);
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
paragraphs().back().setLayout(bp.documentClass().emptyLayout());
paragraphs().back().setLayout(buf.params().documentClass().emptyLayout());
}

View File

@ -38,7 +38,7 @@ namespace frontend { class Painter; }
class InsetCollapsable : public InsetText {
public:
///
InsetCollapsable(BufferParams const &,
InsetCollapsable(Buffer const &,
CollapseStatus status = Inset::Open, DocumentClass * tc = 0);
///
InsetCollapsable(InsetCollapsable const & rhs);

View File

@ -43,8 +43,8 @@ using namespace lyx::support;
namespace lyx {
InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
: InsetCollapsable(bp, status)
InsetERT::InsetERT(Buffer const & buf, CollapseStatus status)
: InsetCollapsable(buf, status)
{}

View File

@ -33,7 +33,7 @@ class Language;
class InsetERT : public InsetCollapsable {
public:
///
InsetERT(BufferParams const &, CollapseStatus status = Open);
InsetERT(Buffer const &, CollapseStatus status = Open);
#if 0
///
InsetERT(BufferParams const &,

View File

@ -12,22 +12,23 @@
#include "InsetEnvironment.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "support/gettext.h"
#include "Layout.h"
#include "OutputParams.h"
#include "output_latex.h"
#include "TexRow.h"
#include "TextClass.h"
#include "support/gettext.h"
using namespace std;
namespace lyx {
InsetEnvironment::InsetEnvironment
(BufferParams const & bp, docstring const & name)
: InsetText(bp), layout_(bp.documentClass()[name]), name_(name)
InsetEnvironment::InsetEnvironment(Buffer const & buf, docstring const & name)
: InsetText(buf), layout_(buf.params().documentClass()[name]), name_(name)
{
setAutoBreakRows(true);
setDrawFrame(true);
@ -39,12 +40,6 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
{}
Inset * InsetEnvironment::clone() const
{
return new InsetEnvironment(*this);
}
void InsetEnvironment::write(ostream & os) const
{
os << "Environment " << to_utf8(name()) << "\n";

View File

@ -21,7 +21,7 @@ namespace lyx {
class InsetEnvironment : public InsetText {
public:
///
InsetEnvironment(BufferParams const &, docstring const & name);
InsetEnvironment(Buffer const &, docstring const & name);
///
docstring name() const { return name_; }
///
@ -48,7 +48,7 @@ protected:
InsetEnvironment(InsetEnvironment const &);
private:
///
Inset * clone() const;
Inset * clone() const { return new InsetEnvironment(*this); }
/// the layout
LayoutPtr layout_;
///

View File

@ -39,9 +39,9 @@ using namespace std;
namespace lyx {
InsetFlex::InsetFlex(BufferParams const & bp,
InsetFlex::InsetFlex(Buffer const & buf,
DocumentClass * dc, string const & layoutName)
: InsetCollapsable(bp, Collapsed, dc),
: InsetCollapsable(buf, Collapsed, dc),
name_(layoutName)
{
setLayout(dc); // again, because now the name is initialized
@ -55,12 +55,6 @@ InsetFlex::InsetFlex(InsetFlex const & in)
{}
Inset * InsetFlex::clone() const
{
return new InsetFlex(*this);
}
docstring InsetFlex::editMessage() const
{
return _("Opened Flex Inset");

View File

@ -23,7 +23,7 @@ namespace lyx {
class InsetFlex : public InsetCollapsable {
public:
///
InsetFlex(BufferParams const &, DocumentClass * dc,
InsetFlex(Buffer const &, DocumentClass * dc,
std::string const & layoutName);
///
docstring name() const { return from_utf8(name_); }
@ -55,7 +55,7 @@ protected:
InsetFlex(InsetFlex const &);
private:
virtual Inset * clone() const;
Inset * clone() const { return new InsetFlex(*this); }
///
std::string name_;

View File

@ -111,10 +111,10 @@ namespace lyx {
// Lgb
InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
: InsetCollapsable(bp), name_(from_utf8(type))
InsetFloat::InsetFloat(Buffer const & buf, string const & type)
: InsetCollapsable(buf), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type, bp));
setLabel(_("float: ") + floatName(type, buf.params()));
params_.type = type;
}

View File

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

View File

@ -35,8 +35,8 @@ using namespace std;
namespace lyx {
InsetFoot::InsetFoot(BufferParams const & bp)
: InsetFootlike(bp)
InsetFoot::InsetFoot(Buffer const & buf)
: InsetFootlike(buf)
{}
@ -45,12 +45,6 @@ InsetFoot::InsetFoot(InsetFoot const & in)
{}
Inset * InsetFoot::clone() const
{
return new InsetFoot(*this);
}
docstring InsetFoot::editMessage() const
{
return _("Opened Footnote Inset");

View File

@ -24,7 +24,7 @@ namespace lyx {
class InsetFoot : public InsetFootlike {
public:
///
InsetFoot(BufferParams const &);
InsetFoot(Buffer const &);
///
InsetCode lyxCode() const { return FOOT_CODE; }
///
@ -45,7 +45,7 @@ public:
protected:
InsetFoot(InsetFoot const &);
private:
Inset * clone() const;
Inset * clone() const { return new InsetFoot(*this); }
};

View File

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

View File

@ -23,7 +23,7 @@ namespace lyx {
class InsetFootlike : public InsetCollapsable {
public:
///
InsetFootlike(BufferParams const &);
InsetFootlike(Buffer const &);
///
InsetFootlike(InsetFootlike const &);
///

View File

@ -29,8 +29,8 @@ using namespace std;
namespace lyx {
InsetIndex::InsetIndex(BufferParams const & bp)
: InsetCollapsable(bp)
InsetIndex::InsetIndex(Buffer const & buf)
: InsetCollapsable(buf)
{}

View File

@ -26,7 +26,7 @@ class LaTeXFeatures;
class InsetIndex : public InsetCollapsable {
public:
///
InsetIndex(BufferParams const &);
InsetIndex(Buffer const &);
///
InsetIndex(InsetIndex const &);
///

View File

@ -44,8 +44,8 @@ using namespace lyx::support;
namespace lyx {
InsetInfo::InsetInfo(BufferParams const & bp, string const & name)
: InsetText(bp), type_(UNKNOWN_INFO), name_(),
InsetInfo::InsetInfo(Buffer const & buf, string const & name)
: InsetText(buf), type_(UNKNOWN_INFO), name_(),
mouse_hover_(false)
{
setAutoBreakRows(true);

View File

@ -84,7 +84,7 @@ public:
};
///
InsetInfo(BufferParams const & bp, std::string const & info = std::string());
InsetInfo(Buffer const & buf, std::string const & info = std::string());
///
Inset * editXY(Cursor & cur, int x, int y);
///

View File

@ -41,8 +41,8 @@ namespace lyx {
char const lstinline_delimiters[] =
"!*()-=+|;:'\"`,<.>/?QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
InsetListings::InsetListings(BufferParams const & bp, InsetListingsParams const & par)
: InsetCollapsable(bp, par.status())
InsetListings::InsetListings(Buffer const & buf, InsetListingsParams const & par)
: InsetCollapsable(buf, par.status())
{}

View File

@ -27,7 +27,7 @@ namespace lyx {
class InsetListings : public InsetCollapsable {
public:
///
InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams());
InsetListings(Buffer const &, InsetListingsParams const & par = InsetListingsParams());
///
~InsetListings();
///

View File

@ -25,8 +25,8 @@
namespace lyx {
InsetMarginal::InsetMarginal(BufferParams const & bp)
: InsetFootlike(bp)
InsetMarginal::InsetMarginal(Buffer const & buf)
: InsetFootlike(buf)
{}

View File

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

View File

@ -106,8 +106,8 @@ void InsetNoteParams::read(Lexer & lex)
}
InsetNote::InsetNote(BufferParams const & bp, string const & label)
: InsetCollapsable(bp)
InsetNote::InsetNote(Buffer const & buf, string const & label)
: InsetCollapsable(buf)
{
params_.type = notetranslator().find(label);
}

View File

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

View File

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

View File

@ -25,7 +25,7 @@ namespace lyx {
*/
class InsetOptArg : public InsetCollapsable {
public:
InsetOptArg(BufferParams const &);
InsetOptArg(Buffer const &);
/// code of the inset
InsetCode lyxCode() const { return OPTARG_CODE; }

View File

@ -94,8 +94,8 @@ InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t)
}
InsetQuotes::InsetQuotes(char_type c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
InsetQuotes::InsetQuotes(Buffer const & buf, char_type c)
: language_(buf.params().quotes_language), times_(buf.params().quotes_times)
{
getPosition(c);
}

View File

@ -69,7 +69,7 @@ public:
*/
explicit InsetQuotes(std::string const & str = "eld");
/// Create the right quote inset after character c
InsetQuotes(char_type c, BufferParams const & params);
InsetQuotes(Buffer const & buffer, char_type c);
/// Direct access to inner/outer quotation marks
InsetQuotes(char_type c, quote_language l, quote_times t);
///

View File

@ -33,7 +33,7 @@ using namespace std;
namespace lyx {
InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
InsetRef::InsetRef(Buffer const & 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(InsetCommandParams const &, Buffer const &);
InsetRef(Buffer const & buffer, InsetCommandParams const &);
/// verify label and reference.
/**

View File

@ -472,7 +472,7 @@ string const featureAsString(Tabular::Feature feature)
/////////////////////////////////////////////////////////////////////
Tabular::CellData::CellData(Buffer const & buffer)
Tabular::CellData::CellData(Buffer const & buf)
: cellno(0),
width(0),
multicolumn(Tabular::CELL_NORMAL),
@ -484,10 +484,10 @@ Tabular::CellData::CellData(Buffer const & buffer)
right_line(false),
usebox(BOX_NONE),
rotate(false),
inset(new InsetText(buffer.params()))
inset(new InsetText(buf))
{
inset->setBuffer(const_cast<Buffer &>(buffer));
inset->paragraphs().back().setLayout(buffer.params().documentClass().emptyLayout());
inset->setBuffer(const_cast<Buffer &>(buf));
inset->paragraphs().back().setLayout(buf.params().documentClass().emptyLayout());
}

View File

@ -98,13 +98,10 @@ private:
/////////////////////////////////////////////////////////////////////
InsetText::InsetText(BufferParams const & bp)
InsetText::InsetText(Buffer const & buf)
: drawFrame_(false), frame_color_(Color_insetframe)
{
paragraphs().push_back(Paragraph());
Paragraph & ourpar = paragraphs().back();
ourpar.setEmptyOrDefaultLayout(bp.documentClass());
ourpar.setInsetOwner(this);
initParagraphs(buf);
}
@ -123,6 +120,16 @@ InsetText::InsetText()
{}
void InsetText::initParagraphs(Buffer const & buf)
{
BOOST_ASSERT(paragraphs().empty());
buffer_ = const_cast<Buffer *>(&buf);
paragraphs().push_back(Paragraph());
Paragraph & ourpar = paragraphs().back();
ourpar.setEmptyOrDefaultLayout(buf.params().documentClass());
ourpar.setInsetOwner(this);
}
void InsetText::setParagraphOwner()
{
for_each(paragraphs().begin(), paragraphs().end(),

View File

@ -34,11 +34,13 @@ class InsetTabular;
class InsetText : public Inset {
public:
///
explicit InsetText(BufferParams const &);
explicit InsetText(Buffer const & buffer);
///
InsetText();
///
InsetText(InsetText const &);
///
void initParagraphs(Buffer const & buffer);
///
Dimension const dimension(BufferView const &) const;

View File

@ -39,10 +39,10 @@ using namespace std;
namespace lyx {
InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
: InsetCollapsable(bp), name_(from_utf8(type))
InsetWrap::InsetWrap(Buffer const & buf, string const & type)
: InsetCollapsable(buf), name_(from_utf8(type))
{
setLabel(_("wrap: ") + floatName(type, bp));
setLabel(_("wrap: ") + floatName(type, buf.params()));
params_.type = type;
params_.lines = 0;
params_.placement = "o";

View File

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