I forget this in rev 19515.

* InsetInclude: loadIfNeeded()
- make it non anonymous (used in loadChildDocuments()).
- now return the loaded buffer.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19520 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-08-13 19:40:54 +00:00
parent 63895cc32e
commit 4e7e580f54
2 changed files with 8 additions and 8 deletions

View File

@ -384,16 +384,17 @@ Buffer * getChildBuffer(Buffer const & buffer, InsetCommandParams const & params
return childBuffer; return childBuffer;
} }
} // namespace anon
/// return true if the file is or got loaded.
bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params) Buffer * loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
{ {
if (isVerbatim(params) || isListings(params)) if (isVerbatim(params) || isListings(params))
return false; return 0;
FileName const included_file = includedFilename(buffer, params); FileName const included_file = includedFilename(buffer, params);
if (!isLyXFilename(included_file.absFilename())) if (!isLyXFilename(included_file.absFilename()))
return false; return 0;
Buffer * buf = theBufferList().getBuffer(included_file.absFilename()); Buffer * buf = theBufferList().getBuffer(included_file.absFilename());
if (!buf) { if (!buf) {
@ -416,13 +417,10 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
return buf; return buf;
} }
buf->setParentName(parentFilename(buffer)); buf->setParentName(parentFilename(buffer));
return true; return buf;
} }
} // namespace anon
int InsetInclude::latex(Buffer const & buffer, odocstream & os, int InsetInclude::latex(Buffer const & buffer, odocstream & os,
OutputParams const & runparams) const OutputParams const & runparams) const
{ {

View File

@ -159,6 +159,8 @@ private:
InsetInclude & inset_; InsetInclude & inset_;
}; };
/// return loaded Buffer or zero if the file loading did not proceed.
Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params);
} // namespace lyx } // namespace lyx