src/paragraph.C
src/paragraph_funcs.C
src/rowpainter.C
+src/support/path_defines.C
src/text.C
src/text2.C
src/text3.C
tt->setSelectionRange(replacestring.length());
// Go back so that replacement string is also spellchecked
- for (string::size_type i = 0; i < replacestring.length() + 1; ++i)
+ for (string::size_type i = 0; i < replacestring.length() + 1; ++i)
tt->cursorLeft(this);
// FIXME: should be done through LFUN
/// return the visible top y
int top_y() const;
-
+
/// set the visible top y
- void top_y(int);
-
+ void top_y(int);
+
/// resize event has happened
void resize();
buffer_ = b;
top_y_ = 0;
-
+
// if we're quitting lyx, don't bother updating stuff
if (quitting)
return;
text->selection.end != bv_->text->xsel_cache.end))
{
bv_->text->xsel_cache = text->selection;
- sel = text->selectionAsString(bv_->buffer(), false);
+ sel = text->selectionAsString(*bv_->buffer(), false);
} else if (!text->selection.set()) {
sel = string();
bv_->text->xsel_cache.set(false);
screen().hideCursor();
bool const res = dispatch(ev);
-
+
// see workAreaKeyPress
cursor_timeout.restart();
screen().showCursor(*bv_);
string arg = ev.argument;
if (arg.empty()) {
- arg = bv_->getLyXText()->selectionAsString(buffer_,
+ arg = bv_->getLyXText()->selectionAsString(*buffer_,
false);
// FIXME
if (arg.size() > 100 || arg.empty()) {
// Get word or selection
bv_->getLyXText()->selectWordWhenUnderCursor(lyx::WHOLE_WORD);
- arg = bv_->getLyXText()->selectionAsString(buffer_, false);
+ arg = bv_->getLyXText()->selectionAsString(*buffer_, false);
// FIXME: where is getLyXText()->unselect(bv_) ?
}
}
+2003-08-28 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * most files: change to use const Buffer refs
+
2003-08-27 André Pönitz <poenitz@gmx.net>
* BufferView.[Ch]: remove getParentText, implement getParentLanguage
* BufferView_pimpl.[Ch]: to here
* frontends/screen.C:
* insets/insettabular.C:
- * insets/insettext.C: adjust
+ * insets/insettext.C: adjust
* rowpainter.[Ch] (paintRows): remove LyXText & argument
2003-08-27 Alfredo Braunstein <abraunst@libero.it>
* BufferView.[Ch]:
* BufferView_pimpl.[Ch] (updateInset): add an InsetOld * argument
-
+
2003-08-26 André Pönitz <poenitz@gmx.net>
* paragraph_func.[Ch] (outerPar): new function
* text2.C: remove Inset::par_owner
2003-08-25 Martin Vermeer <martin.vermeer@hut.fi>
-
+
* lyxrow_funcs.C:
* lyxtext.h:
* text.C:
2003-08-25 Alfredo Braunstein <abraunst@libero.it>
- * text2.C (redoParagraphInternal, redoParagraphs):
- * text.C (redoParagraph): add a call to updateRowPositions at the
+ * text2.C (redoParagraphInternal, redoParagraphs):
+ * text.C (redoParagraph): add a call to updateRowPositions at the
end of each 'metrics-like' call. Remove all others.
(getRow): remove the 'y-computing' version.
(getRowNearY): do not compute nor return the real y. Solve the
* lyxrow.[Ch]: add x_ and *fill_ members
- * lyxtext.h:
+ * lyxtext.h:
* text.C:
* rowpainter.C:
* text2.C: adjust/remove prepareToPrint() calls
* MenuBackend.C: fix branchlist related crash
-2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* BranchList.[Ch]:
* InsetList.[Ch]:
2003-08-15 Kayvan A. Sylvan <kayvan@sylvan.com>
* BufferView_pimpl.C: compile fix
-
+
2003-08-15 André Pönitz <poenitz@gmx.net>
* rowpainter.C: remove extra metrics calls
2003-08-05 Alfredo Braunstein <abraunst@libero.it>
- * text2.C (DEPM): fix part of bug 1255 and 1256
+ * text2.C (DEPM): fix part of bug 1255 and 1256
2003-08-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
ParagraphList::const_iterator pit = pars.begin();
ParagraphList::const_iterator pend = pars.end();
for (; pit != pend; ++pit) {
- asciiSel += pit->asString(&buffer, false);
+ asciiSel += pit->asString(buffer, false);
if (asciiSel.size() > 25) {
asciiSel.replace(22, string::npos, "...");
break;
action = LFUN_IMPORT;
break;
case MenuItem::ViewFormats:
- formats = Exporter::GetExportableFormats(view->buffer(), true);
+ formats = Exporter::GetExportableFormats(*view->buffer(), true);
action = LFUN_PREVIEW;
break;
case MenuItem::UpdateFormats:
- formats = Exporter::GetExportableFormats(view->buffer(), true);
+ formats = Exporter::GetExportableFormats(*view->buffer(), true);
action = LFUN_UPDATE;
break;
default:
- formats = Exporter::GetExportableFormats(view->buffer(), false);
+ formats = Exporter::GetExportableFormats(*view->buffer(), false);
action = LFUN_EXPORT;
}
sort(formats.begin(), formats.end(), compare_format());
return;
}
- lyx::toc::TocList toc_list = lyx::toc::getTocList(view->buffer());
+ lyx::toc::TocList toc_list = lyx::toc::getTocList(*view->buffer());
lyx::toc::TocList::const_iterator cit = toc_list.begin();
lyx::toc::TocList::const_iterator end = toc_list.end();
for (; cit != end; ++cit) {
std::list<Branch>::const_iterator cit = params.branchlist.begin();
std::list<Branch>::const_iterator end = params.branchlist.end();
-
+
for (int ii = 1; cit != end; ++cit, ++ii) {
string label = cit->getBranch();
int const action = lyxaction.
paragraphs.clear();
// Remove any previewed LaTeX snippets associated with this buffer.
- lyx::graphics::Previews::get().removeLoader(this);
+ lyx::graphics::Previews::get().removeLoader(*this);
}
ParagraphList::const_iterator pit = paragraphs.begin();
ParagraphList::const_iterator pend = paragraphs.end();
for (; pit != pend; ++pit)
- pit->write(this, ofs, params, depth);
+ pit->write(*this, ofs, params, depth);
// Write marker that shows file is complete
ofs << "\n\\end_document" << endl;
currlinelen += word.length();
word.erase();
}
- if (inset->ascii(this, buffer, linelen)) {
+ if (inset->ascii(*this, buffer, linelen)) {
// to be sure it breaks paragraph
currlinelen += linelen;
}
texrow.newline();
}
- latexParagraphs(this, paragraphs, os, texrow, runparams);
+ latexParagraphs(*this, paragraphs, os, texrow, runparams);
// add this just in case after all the paragraphs
os << endl;
if (c == Paragraph::META_INSET) {
InsetOld * inset = par->getInset(i);
- inset->linuxdoc(this, os);
+ inset->linuxdoc(*this, os);
font_old = font;
continue;
}
if (i || desc_on != 3) {
if (style->latexparam() == "CDATA")
os << "]]>";
- inset->docbook(this, os, false);
+ inset->docbook(*this, os, false);
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
}
for (inset_iterator it = inset_const_iterator_begin();
it != inset_const_iterator_end(); ++it) {
if (it->lyxCode() == InsetOld::BIBTEX_CODE)
- static_cast<InsetBibtex &>(*it).fillWithBibKeys(this, keys);
+ static_cast<InsetBibtex &>(*it).fillWithBibKeys(*this, keys);
else if (it->lyxCode() == InsetOld::INCLUDE_CODE)
static_cast<InsetInclude &>(*it).fillWithBibKeys(keys);
else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
bool BufferList::isLoaded(Buffer const * b) const
{
Assert(b);
-
+
BufferStorage::const_iterator cit =
find(bstore.begin(), bstore.end(), b);
return cit != bstore.end();
if (font.language() != ignore_language ||
font.number() != LyXFont::IGNORE) {
LyXCursor & cursor = text->cursor;
- text->computeBidiTables(text->cursor.par(), bv->buffer(),
+ text->computeBidiTables(text->cursor.par(), *bv->buffer(),
text->cursorRow());
if (cursor.boundary() !=
- text->isBoundary(bv->buffer(), *cursor.par(), cursor.pos(),
+ text->isBoundary(*bv->buffer(), *cursor.par(), cursor.pos(),
text->real_current_font))
text->setCursor(cursor.par(), cursor.pos(),
false, !cursor.boundary());
int const i = compare_ascii_no_case(a.From->prettyname(),
b.From->prettyname());
if (i == 0)
- return compare_ascii_no_case(a.To->prettyname(),
+ return compare_ascii_no_case(a.To->prettyname(),
b.To->prettyname()) < 0;
else
return i < 0;
run_latex = true;
string command = subst(conv.command, token_from, "");
lyxerr[Debug::FILES] << "Running " << command << endl;
- if (!runLaTeX(buffer, command, runparams))
+ if (!runLaTeX(*buffer, command, runparams))
return false;
} else {
if (conv.need_aux && !run_latex
lyxerr[Debug::FILES]
<< "Running " << latex_command_
<< " to update aux file"<< endl;
- runLaTeX(buffer, latex_command_, runparams);
+ runLaTeX(*buffer, latex_command_, runparams);
}
string infile2 = (conv.original_dir)
dvipdfm_options(buffer->params));
lyxerr[Debug::FILES] << "Calling " << command << endl;
- if (buffer)
- buffer->message(_("Executing command: ") + command);
+ buffer->message(_("Executing command: ") + command);
+
Systemcall::Starttype type = (dummy)
? Systemcall::DontWait : Systemcall::Wait;
Systemcall one;
int res;
- if (conv.original_dir && buffer) {
+ if (conv.original_dir) {
Path p(buffer->filePath());
res = one.startscript(type, command);
} else
" < " + QuoteName(infile2 + ".out") +
" > " + QuoteName(logfile);
one.startscript(Systemcall::Wait, command2);
- if (!scanLog(buffer, command, logfile))
+ if (!scanLog(*buffer, command, logfile))
return false;
}
}
-bool Converters::scanLog(Buffer const * buffer, string const & /*command*/,
+bool Converters::scanLog(Buffer const & buffer, string const & /*command*/,
string const & filename)
{
- if (!buffer)
- return false;
-
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
LaTeX latex("", runparams, filename, "");
int result = latex.scanLogFile(terr);
if (result & LaTeX::ERRORS)
- bufferErrors(*buffer, terr);
+ bufferErrors(buffer, terr);
return true;
}
class showMessage : public boost::signals::trackable {
public:
- showMessage(Buffer const * b) : buffer_(b) {};
- void operator()(string m)
+ showMessage(Buffer const & b) : buffer_(b) {};
+ void operator()(string const & m)
{
- buffer_->message(m);
+ buffer_.message(m);
}
private:
- Buffer const * buffer_;
+ Buffer const & buffer_;
};
}
-bool Converters::runLaTeX(Buffer const * buffer, string const & command,
+
+bool Converters::runLaTeX(Buffer const & buffer, string const & command,
LatexRunParams const & runparams)
{
- // when is this needed?
- if (!buffer)
- return false;
-
- buffer->busy(true);
- buffer->message(_("Running LaTeX..."));
+ buffer.busy(true);
+ buffer.message(_("Running LaTeX..."));
// do the LaTeX run(s)
- string name = buffer->getLatexName();
- LaTeX latex(command, runparams, name, buffer->filePath());
+ string name = buffer.getLatexName();
+ LaTeX latex(command, runparams, name, buffer.filePath());
TeXErrors terr;
showMessage show(buffer);
latex.message.connect(show);
int result = latex.run(terr);
if (result & LaTeX::ERRORS)
- bufferErrors(*buffer, terr);
+ bufferErrors(buffer, terr);
// check return value from latex.run().
if ((result & LaTeX::NO_LOGFILE)) {
_("An empty output file was generated."));
}
-
- buffer->busy(false);
+
+ buffer.busy(false);
int const ERROR_MASK =
LaTeX::NO_LOGFILE |
std::vector<Format const *> const
Converters::intToFormat(std::vector<int> const & input);
///
- bool scanLog(Buffer const * buffer, string const & command,
+ bool scanLog(Buffer const & buffer, string const & command,
string const & filename);
///
- bool runLaTeX(Buffer const * buffer, string const & command,
+ bool runLaTeX(Buffer const & buffer, string const & command,
LatexRunParams const &);
///
ConverterList converterlist_;
namespace {
-vector<string> const Backends(Buffer const * buffer)
+vector<string> const Backends(Buffer const & buffer)
{
vector<string> v;
- if (buffer->params.getLyXTextClass().isTeXClassAvailable())
- v.push_back(BufferFormat(*buffer));
+ if (buffer.params.getLyXTextClass().isTeXClassAvailable())
+ v.push_back(BufferFormat(buffer));
v.push_back("text");
return v;
}
string backend_format;
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
- vector<string> backends = Backends(buffer);
+ vector<string> backends = Backends(*buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {
for (vector<string>::const_iterator it = backends.begin();
it != backends.end(); ++it) {
string result_file;
if (!Export(buffer, format, true, result_file))
return false;
- return formats.view(buffer, result_file, format);
+ return formats.view(*buffer, result_file, format);
}
-bool Exporter::IsExportable(Buffer const * buffer, string const & format)
+bool Exporter::IsExportable(Buffer const & buffer, string const & format)
{
vector<string> backends = Backends(buffer);
for (vector<string>::const_iterator it = backends.begin();
vector<Format const *> const
-Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
+Exporter::GetExportableFormats(Buffer const & buffer, bool only_viewable)
{
vector<string> backends = Backends(buffer);
vector<Format const *> result =
bool Preview(Buffer * buffer, string const & format);
///
static
- bool IsExportable(Buffer const * buffer, string const & format);
+ bool IsExportable(Buffer const & buffer, string const & format);
///
static
std::vector<Format const *> const
- GetExportableFormats(Buffer const * buffer, bool only_viewable);
+ GetExportableFormats(Buffer const & buffer, bool only_viewable);
///
};
#endif
InsetCommandParams icp;
InsetCommandMailer::string2params(cmd.argument, icp);
InsetCitation * inset = new InsetCitation(icp);
- inset->setLoadingBuffer(bv->buffer(), false);
+ inset->setLoadingBuffer(*bv->buffer(), false);
return inset;
} else if (name == "ert") {
return inset;
} else if (name == "external") {
- Buffer const * buffer = cmd.view()->buffer();
+ Buffer const & buffer = *cmd.view()->buffer();
InsetExternal::Params iep;
InsetExternalMailer::string2params(cmd.argument,
- *buffer, iep);
+ buffer, iep);
InsetExternal * inset = new InsetExternal;
inset->setParams(iep, buffer);
return inset;
|| tmptok == "Greyedout") {
inset = new InsetNote(buf.params, tmptok);
} else if (tmptok == "Branch") {
- inset = new InsetBranch(buf.params, tmptok);
+ inset = new InsetBranch(buf.params, tmptok);
} else if (tmptok == "Include") {
InsetCommandParams p("Include");
inset = new InsetInclude(p, buf);
}
if (inset)
- inset->read(&buf, lex);
+ inset->read(buf, lex);
}
return inset;
}
-bool Formats::view(Buffer const * buffer, string const & filename,
+bool Formats::view(Buffer const & buffer, string const & filename,
string const & format_name) const
{
if (filename.empty())
if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) {
command += ' ' + lyxrc.view_dvi_paper_option;
- string paper_size = buffer->params.paperSizeName();
+ string paper_size = buffer.params.paperSizeName();
if (paper_size == "letter")
paper_size = "us";
command += ' ' + paper_size;
- if (buffer->params.orientation
- == ORIENTATION_LANDSCAPE)
+ if (buffer.params.orientation == ORIENTATION_LANDSCAPE)
command += 'r';
}
command = subst(command, token_path, QuoteName(OnlyPath(filename)));
lyxerr[Debug::FILES] << "Executing command: " << command << std::endl;
- buffer->message(_("Executing command: ") + command);
+ buffer.message(_("Executing command: ") + command);
Path p(OnlyPath(filename));
Systemcall one;
///
void setViewer(string const & name, string const & command);
///
- bool view(Buffer const * buffer, string const & filename,
+ bool view(Buffer const & buffer, string const & filename,
string const & format_name) const;
///
string const prettyName(string const & name) const;
+2003-08-28 Lars Gullik Bjønnes <larsbj@gullik.net>
-2003-08-16 Martin Vermeer <martin.vermeer@hut.fi>
+ * most files: change to use const buffer refs.
+
+2003-08-16 Martin Vermeer <martin.vermeer@hut.fi>
* ControlBranch.[Ch]:
* ControlDocument.C:
* Makefile.am: implements the 'branch
- inset' idea. This allows the output of various versions of a
- document from a single source version, selectively outputing or
+ inset' idea. This allows the output of various versions of a
+ document from a single source version, selectively outputing or
suppressing output of parts of the text.
This implementation contains a 'branch list editor' in a separate
tab of the document settings dialog. Branches are user definable
2003-07-30 Martin Vermeer <martin.vermeer@hut.fi>
* ControlNote.[Ch]: add i18n support.
-
+
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlToc.C (goTo): adjust for lyx::toc
if (c.type == Change::UNCHANGED)
return string();
- Author const & a(kernel().buffer()->authors().get(c.author));
+ Author const & a(kernel().buffer().authors().get(c.author));
string author(a.name());
font_->setLanguage(ignore_language);
else if (val == "reset")
- font_->setLanguage(kernel().buffer()->params.language);
+ font_->setLanguage(kernel().buffer().params.language);
else
font_->setLanguage(languages.getLanguage(val));
ControlCommand::initialiseParams(data);
vector<pair<string,string> > blist;
- kernel().buffer()->fillWithBibKeys(blist);
+ kernel().buffer().fillWithBibKeys(blist);
typedef std::map<string, string>::value_type InfoMapValue;
bool ControlCitation::usingNatbib() const
{
- return kernel().buffer()->params.use_natbib;
+ return kernel().buffer().params.use_natbib;
}
vector<biblio::CiteStyle> const cs =
biblio::getCiteStyles(usingNatbib());
- if (kernel().buffer()->params.use_numerical_citations)
+ if (kernel().buffer().params.use_numerical_citations)
styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
else
styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);
}
-Buffer const * ControlConnectBase::buffer() const
+Buffer const & ControlConnectBase::buffer() const
{
- return lv_.buffer();
+ return *lv_.buffer();
}
/// a wrapper for LyXView::buffer()
Buffer * buffer();
///
- Buffer const * buffer() const;
+ Buffer const & buffer() const;
/// a wrapper for LyXView::getLyXFunc()
LyXFunc & lyxfunc();
///
if (err.par_id == -1)
return;
- Buffer * const buf = kernel().buffer();
- ParIterator pit = buf->getParFromID(err.par_id);
+ Buffer & buf = kernel().buffer();
+ ParIterator pit = buf.getParFromID(err.par_id);
- if (pit == buf->par_iterator_end()) {
+ if (pit == buf.par_iterator_end()) {
lyxerr << "par id not found" << endl;
return;
}
bool ControlExternal::initialiseParams(string const & data)
{
params_.reset(new InsetExternal::Params);
- InsetExternalMailer::string2params(data, *kernel().buffer(), *params_);
+ InsetExternalMailer::string2params(data, kernel().buffer(), *params_);
return true;
}
void ControlExternal::dispatchParams()
{
string const lfun = InsetExternalMailer::params2string(params(),
- *kernel().buffer());
+ kernel().buffer());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
dialog().view().apply();
string const lfun =
- InsetExternalMailer::params2string(params(), *kernel().buffer());
+ InsetExternalMailer::params2string(params(), kernel().buffer());
kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
}
bool ControlGraphics::initialiseParams(string const & data)
{
InsetGraphicsParams params;
- InsetGraphicsMailer::string2params(data, *kernel().buffer(), params);
+ InsetGraphicsMailer::string2params(data, kernel().buffer(), params);
params_.reset(new InsetGraphicsParams(params));
return true;
}
{
InsetGraphicsParams tmp_params(params());
string const lfun =
- InsetGraphicsMailer::params2string(tmp_params, *kernel().buffer());
+ InsetGraphicsMailer::params2string(tmp_params, kernel().buffer());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
bool ControlLog::initialiseParams(string const &)
{
- logfile_ = kernel().buffer()->getLogName();
+ logfile_ = kernel().buffer().getLogName();
return true;
}
vector<string> const ControlRef::getLabelList(string const & name) const
{
- Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
- if (!buf)
- buf = kernel().buffer();
+ Buffer const & buf = *bufferlist.getBuffer(MakeAbsPath(name));
vector<string> list;
- buf->getLabelList(list);
+ buf.getLabelList(list);
return list;
}
int ControlRef::getBufferNum() const
{
vector<string> buffers = bufferlist.getFileNames();
- string const name = kernel().buffer()->fileName();
+ string const name = kernel().buffer().fileName();
vector<string>::const_iterator cit =
find(buffers.begin(), buffers.end(), name);
if (cit == buffers.end())
exports.push_back("lyx");
exports.push_back("text");
- if (buffer()->isLatex())
+#warning Can the doc ever be all/any of these at the same time? (Lgb)
+ // I think some if else if is in order.
+ if (buffer().isLatex())
exports.push_back("latex");
- if (buffer()->isLinuxDoc())
+ if (buffer().isLinuxDoc())
exports.push_back("linuxdoc");
- if (buffer()->isDocBook())
+ if (buffer().isDocBook())
exports.push_back("docbook");
- if (buffer()->isLiterate())
+ if (buffer().isLiterate())
exports.push_back("literate");
// Loop over these native formats and ascertain what formats we
SpellBase::Result res = SpellBase::OK;
// clear any old selection
- LyXText * text = bufferview()->getLyXText();
bufferview()->update();
while (res == SpellBase::OK || res == SpellBase::IGNORE) {
bool ControlTabular::initialiseParams(string const & data)
{
- Buffer * buffer = kernel().buffer();
- if (!buffer)
- return false;
+ Buffer & buffer = kernel().buffer();
- InsetTabular tmp(*buffer);
+ InsetTabular tmp(buffer);
int cell = InsetTabularMailer::string2params(data, tmp);
if (cell != -1) {
params_.reset(new LyXTabular(tmp.tabular));
string const ControlVCLog::getBufferFileName() const
{
- return kernel().buffer()->fileName();
+ return kernel().buffer().fileName();
}
void ControlVCLog::getVCLogFile(ostream & ss) const
{
- string const name = kernel().buffer()->lyxvc.getLogFile();
+ string const name = kernel().buffer().lyxvc.getLogFile();
std::ifstream in(name.c_str());
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
+#include "support/LAssert.h"
+
+using lyx::support::Assert;
+
Kernel::Kernel(LyXView & lyxview)
: lyxview_(lyxview)
{}
string const Kernel::bufferFilepath() const
{
- return buffer()->filePath();
+ return buffer().filePath();
}
Kernel::DocTypes Kernel::docType() const
{
- if (!buffer())
- return LATEX;
-
- if (buffer()->isLatex())
+ if (buffer().isLatex())
return LATEX;
- if (buffer()->isLiterate())
+ if (buffer().isLiterate())
return LITERATE;
- if (buffer()->isLinuxDoc())
+ if (buffer().isLinuxDoc())
return LINUXDOC;
return DOCBOOK;
}
-Buffer * Kernel::buffer()
+Buffer & Kernel::buffer()
{
- return lyxview_.buffer();
+ Assert(lyxview_.buffer());
+ return *lyxview_.buffer();
}
-Buffer const * Kernel::buffer() const
+Buffer const & Kernel::buffer() const
{
- return lyxview_.buffer();
+ Assert(lyxview_.buffer());
+ return *lyxview_.buffer();
}
LyXView & lyxview() { return lyxview_; }
LyXView const & lyxview() const { return lyxview_; }
- Buffer * buffer();
- Buffer const * buffer() const;
+ Buffer & buffer();
+ Buffer const & buffer() const;
BufferView * bufferview();
BufferView const * bufferview() const;
}
-bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
+bool LyXScreen::fitManualCursor(BufferView * bv, LyXText *,
int /*x*/, int y, int asc, int desc)
{
int const vheight = workarea().workHeight();
int const topy = bv->top_y();
int newtop = topy;
-
-
+
+
if (y + desc - topy >= vheight)
newtop = y - 3 * vheight / 4; // the scroll region must be so big!!
else if (y - asc < topy && topy > 0)
LyXCursor const & cursor = text->cursor;
int top_y = text->bv()->top_y();
int newtop = top_y;
- int const vheight = workarea().workHeight();
+ unsigned int const vheight = workarea().workHeight();
RowList::iterator row = text->cursorRow();
// FIXME! This is a HACK! The proper fix is to control the 'true'
// passed to WriteStream below:
- // int InsetFormula::latex(Buffer const *, ostream & os,
+ // int InsetFormula::latex(Buffer const &, ostream & os,
// LatexRunParams const & runparams) const
// {
// WriteStream wi(os, runparams.moving_arg, true);
for (; it != end; ++it)
if (it->lyxCode() == InsetOld::MATHMACRO_CODE)
- it->latex(&buffer_, os, runparams);
+ it->latex(buffer_, os, runparams);
// All equation lables appear as "(#)" + preview.sty's rendering of
// the label name
return;
Previews & previews = Previews::get();
- PreviewLoader & loader = previews.loader(view()->buffer());
+ PreviewLoader & loader = previews.loader(*view()->buffer());
addPreview(loader);
if (!snippet_.empty())
loader.startLoading();
return;
Previews & previews = Previews::get();
- PreviewLoader & loader = previews.loader(view()->buffer());
+ PreviewLoader & loader = previews.loader(*view()->buffer());
loader.remove(snippet_);
snippet_.erase();
pimage_ = 0;
if (!pimage_ || snippet_ != pimage_->snippet()) {
PreviewLoader & ploader =
- Previews::get().loader(view()->buffer());
+ Previews::get().loader(*view()->buffer());
pimage_ = ploader.preview(snippet_);
}
{}
-PreviewLoader & Previews::loader(Buffer const * buffer) const
+PreviewLoader & Previews::loader(Buffer const & buffer) const
{
- Assert(buffer);
-
- Impl::CacheType::iterator it = pimpl_->cache.find(buffer);
+ Impl::CacheType::iterator it = pimpl_->cache.find(&buffer);
if (it == pimpl_->cache.end()) {
- Impl::PreviewLoaderPtr ptr(new PreviewLoader(*buffer));
- pimpl_->cache[buffer] = ptr;
+ Impl::PreviewLoaderPtr ptr(new PreviewLoader(buffer));
+ pimpl_->cache[&buffer] = ptr;
return *ptr.get();
}
}
-void Previews::removeLoader(Buffer const * buffer) const
+void Previews::removeLoader(Buffer const & buffer) const
{
- if (!buffer)
- return;
-
- Impl::CacheType::iterator it = pimpl_->cache.find(buffer);
+ Impl::CacheType::iterator it = pimpl_->cache.find(&buffer);
if (it != pimpl_->cache.end())
pimpl_->cache.erase(it);
void Previews::generateBufferPreviews(Buffer const & buffer) const
{
- PreviewLoader & ploader = loader(&buffer);
+ PreviewLoader & ploader = loader(buffer);
Buffer::inset_iterator it = buffer.inset_const_iterator_begin();
Buffer::inset_iterator end = buffer.inset_const_iterator_end();
* We assert that (buffer != 0) but do not pass a Buffer &
* so that insets do not need to #include buffer.h
*/
- PreviewLoader & loader(Buffer const * buffer) const;
+ PreviewLoader & loader(Buffer const & buffer) const;
/** Called from the Buffer d-tor.
* If (buffer == 0), does nothing.
*/
- void removeLoader(Buffer const * buffer) const;
+ void removeLoader(Buffer const & buffer) const;
/** For a particular buffer, initiate the generation of previews
* for each and every snippetof LaTeX that's of interest with
+2003-08-28 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * most files: change to use const Buffer refs
+
2003-08-26 Martin Vermeer <martin.vermeer@hut.fi>
* insetfootlike.C: whitespace.
* insetref.C: require amsmath for eqref
-2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* Makefile.am:
* inset.h:
/// wrapper around the above
bool insetAllowed(InsetOld * in) const;
///
- virtual void write(Buffer const *, std::ostream &) const = 0;
+ virtual void write(Buffer const &, std::ostream &) const = 0;
///
- virtual void read(Buffer const *, LyXLex & lex) = 0;
+ virtual void read(Buffer const &, LyXLex & lex) = 0;
/// returns the number of rows (\n's) of generated tex code.
- virtual int latex(Buffer const *, std::ostream &,
+ virtual int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const = 0;
///
- virtual int ascii(Buffer const *,
+ virtual int ascii(Buffer const &,
std::ostream &, int linelen = 0) const = 0;
///
- virtual int linuxdoc(Buffer const *, std::ostream &) const = 0;
+ virtual int linuxdoc(Buffer const &, std::ostream &) const = 0;
///
- virtual int docbook(Buffer const *, std::ostream &, bool) const = 0;
+ virtual int docbook(Buffer const &, std::ostream &, bool) const = 0;
/// returns LyX code associated with the inset. Used for TOC, ...)
virtual InsetOld::Code lyxCode() const { return NO_CODE; }
// as a LyX 2.x command, and lyxlex is not enough smart to understand
// real LaTeX commands. Yes, that could be fixed, but would be a waste
// of time cause LyX3 won't use lyxlex anyway. (ale)
-void InsetBibitem::write(Buffer const *, std::ostream & os) const
+void InsetBibitem::write(Buffer const &, std::ostream & os) const
{
os << "\n\\bibitem ";
if (!getOptions().empty())
// This is necessary here because this is written without begin_inset
// This should be changed!!! (Jug)
-void InsetBibitem::read(Buffer const *, LyXLex & lex)
+void InsetBibitem::read(Buffer const &, LyXLex & lex)
{
if (lex.eatLine()) {
scanCommand(lex.getString());
}
-string const InsetBibitem::getScreenLabel(Buffer const *) const
+string const InsetBibitem::getScreenLabel(Buffer const &) const
{
return getContents() + " [" + getBibLabel() + ']';
}
// ale070405
-string const bibitemWidest(Buffer const * buffer)
+string const bibitemWidest(Buffer const & buffer)
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)
InsetBibitem const * bitem = 0;
LyXFont font;
- ParagraphList::const_iterator it = buffer->paragraphs.begin();
- ParagraphList::const_iterator end = buffer->paragraphs.end();
+ ParagraphList::const_iterator it = buffer.paragraphs.begin();
+ ParagraphList::const_iterator end = buffer.paragraphs.end();
for (; it != end; ++it) {
if (it->bibitem()) {
/** Currently \bibitem is used as a LyX2.x command,
so we need this method.
*/
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- virtual string const getScreenLabel(Buffer const *) const;
+ virtual string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
}
-string const InsetBibtex::getScreenLabel(Buffer const *) const
+string const InsetBibtex::getScreenLabel(Buffer const &) const
{
return _("BibTeX Generated References");
}
-int InsetBibtex::latex(Buffer const * buffer, ostream & os,
+int InsetBibtex::latex(Buffer const & buffer, ostream & os,
LatexRunParams const & runparams) const
{
// changing the sequence of the commands
}
if (!runparams.nice
- && IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
- style = MakeAbsPath(style, buffer->filePath());
+ && IsFileReadable(MakeAbsPath(style, buffer.filePath()) + ".bst")) {
+ style = MakeAbsPath(style, buffer.filePath());
}
if (!style.empty()) { // we want no \biblio...{}
// part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support
// all well
- if (!contains(buffer->params.getLyXTextClass().name(),
+ if (!contains(buffer.params.getLyXTextClass().name(),
"art")) {
- if (buffer->params.sides == LyXTextClass::OneSide) {
+ if (buffer.params.sides == LyXTextClass::OneSide) {
// oneside
os << "\\clearpage";
} else {
string db_out;
while (!adb.empty()) {
if (!runparams.nice &&
- IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
- adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
+ IsFileReadable(MakeAbsPath(adb, buffer.filePath())+".bib"))
+ adb = os::external_path(MakeAbsPath(adb, buffer.filePath()));
db_out += adb;
db_out += ',';
db_in = split(db_in, adb,',');
// This method returns a comma separated list of Bibtex entries
-void InsetBibtex::fillWithBibKeys(Buffer const * buffer,
+void InsetBibtex::fillWithBibKeys(Buffer const & buffer,
std::vector<std::pair<string, string> > & keys) const
{
- Assert(buffer);
- vector<string> const files = getFiles(*buffer);
+ vector<string> const files = getFiles(buffer);
for (vector<string>::const_iterator it = files.begin();
it != files.end(); ++ it) {
// This is a _very_ simple parser for Bibtex database
/// small wrapper for the time being
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetOld::Code lyxCode() const { return InsetOld::BIBTEX_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- void fillWithBibKeys(Buffer const * buffer,
+ void fillWithBibKeys(Buffer const & buffer,
std::vector<std::pair<string,string> > & keys) const;
///
std::vector<string> const getFiles(Buffer const &) const;
}
-void InsetBranch::write(Buffer const * buf, ostream & os) const
+void InsetBranch::write(Buffer const & buf, ostream & os) const
{
params_.write(os);
InsetCollapsable::write(buf, os);
}
-void InsetBranch::read(Buffer const * buf, LyXLex & lex)
+void InsetBranch::read(Buffer const & buf, LyXLex & lex)
{
if (lex.isOK()) {
lex.next();
return DISPATCHED;
}
case LFUN_INSET_EDIT:
- if (cmd.button() != mouse_button::button3)
+ if (cmd.button() != mouse_button::button3)
return InsetCollapsable::localDispatch(cmd);
return UNDISPATCHED;
case LFUN_INSET_DIALOG_UPDATE:
-int InsetBranch::latex(Buffer const * buf, ostream & os,
+int InsetBranch::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
- string const branch_sel = buf->params.branchlist.allSelected();
+ string const branch_sel = buf.params.branchlist.allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos)
return inset.latex(buf, os, runparams);
return 0;
}
-int InsetBranch::linuxdoc(Buffer const *, std::ostream &) const
-{
- return 0;
+int InsetBranch::linuxdoc(Buffer const &, std::ostream &) const
+{
+ return 0;
}
-int InsetBranch::docbook(Buffer const * buf, std::ostream & os, bool mixcont) const
+int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
{
// untested - MV
- string const branch_sel = buf->params.branchlist.allSelected();
- if (branch_sel.find(params_.branch, 0) != string::npos)
+ string const branch_sel = buf.params.branchlist.allSelected();
+ if (branch_sel.find(params_.branch, 0) != string::npos)
return inset.docbook(buf, os, mixcont);
return 0;
}
-int InsetBranch::ascii(Buffer const * buf, std::ostream & os, int ll) const
+int InsetBranch::ascii(Buffer const & buf, std::ostream & os, int ll) const
{
- string const branch_sel = buf->params.branchlist.allSelected();
+ string const branch_sel = buf.params.branchlist.allSelected();
if (branch_sel.find(params_.branch, 0) != string::npos) {
return inset.ascii(buf, os, ll);
}
branch = lex.getString();
}
}
-
#include "BranchList.h"
struct InsetBranchParams {
- ///
- void write(std::ostream & os) const;
- ///
- void read(LyXLex & lex);
- ///
- string branch;
+ ///
+ void write(std::ostream & os) const;
+ ///
+ void read(LyXLex & lex);
+ ///
+ string branch;
/// Hack -- MV
BranchList branchlist;
};
-
-
+
+
/** The Branch inset for alternative, conditional output.
*/
public:
///
-
- InsetBranch(BufferParams const &, string const &);
- /// Copy constructor
- InsetBranch(InsetBranch const &);
- ///
+
+ InsetBranch(BufferParams const &, string const &);
+ /// Copy constructor
+ InsetBranch(InsetBranch const &);
+ ///
~InsetBranch();
- ///
+ ///
virtual std::auto_ptr<InsetBase> clone() const;
///
string const editMessage() const;
///
InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
void setButtonLabel();
///
bool showInsetDialog(BufferView *) const;
///
- dispatch_result localDispatch(FuncRequest const &);
+ dispatch_result localDispatch(FuncRequest const &);
///
- int latex(Buffer const *, std::ostream &,
- LatexRunParams const &) const;
+ int latex(Buffer const &, std::ostream &,
+ LatexRunParams const &) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool) const;
+ int docbook(Buffer const &, std::ostream &, bool) const;
///
- int ascii(Buffer const *, std::ostream &, int) const;
+ int ascii(Buffer const &, std::ostream &, int) const;
///
void validate(LaTeXFeatures &) const;
///
InsetBranchParams const & params() const { return params_; }
///
void setParams(InsetBranchParams const & params) { params_ = params; }
-
+
private:
friend class InsetBranchParams;
}
-void InsetCaption::write(Buffer const * buf, ostream & os) const
+void InsetCaption::write(Buffer const & buf, ostream & os) const
{
os << "Caption\n";
writeParagraphData(buf, os);
}
-void InsetCaption::read(Buffer const * buf, LyXLex & lex)
+void InsetCaption::read(Buffer const & buf, LyXLex & lex)
{
#if 0
// We will enably this check again when the compability
}
-int InsetCaption::latex(Buffer const * buf, ostream & os,
+int InsetCaption::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
// This is a bit too simplistic to take advantage of
}
-int InsetCaption::ascii(Buffer const * /*buf*/,
+int InsetCaption::ascii(Buffer const & /*buf*/,
ostream & /*os*/, int /*linelen*/) const
{
// FIX: Implement me!
}
-int InsetCaption::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetCaption::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
int ret;
os << "<title>";
///
InsetCaption(BufferParams const &);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
virtual bool display() const;
///
///
virtual void draw(PainterInfo & pi, int x, int y) const;
///
- virtual int latex(Buffer const * buf, std::ostream & os,
+ virtual int latex(Buffer const & buf, std::ostream & os,
LatexRunParams const &) const;
///
- int ascii(Buffer const * buf, std::ostream & os, int linelen) const;
+ int ascii(Buffer const & buf, std::ostream & os, int linelen) const;
///
- int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
+ int docbook(Buffer const & buf, std::ostream & os, bool mixcont) const;
};
// reload the bibkey list
std::map<Buffer const *, bool> loading_buffer;
-string const getNatbibLabel(Buffer const * buffer,
+string const getNatbibLabel(Buffer const & buffer,
string const & citeType, string const & keyList,
string const & before, string const & after,
bool numerical)
// Only load the bibkeys once if we're loading up the buffer,
// else load them afresh each time.
- map<Buffer const *, bool>::iterator lit = loading_buffer.find(buffer);
+ map<Buffer const *, bool>::iterator lit = loading_buffer.find(&buffer);
if (lit == loading_buffer.end())
- loading_buffer[buffer] = true;
+ loading_buffer[&buffer] = true;
- bool loadkeys = !loading_buffer[buffer];
+ bool loadkeys = !loading_buffer[&buffer];
if (!loadkeys) {
- CachedMap::iterator kit = cached_keys.find(buffer);
+ CachedMap::iterator kit = cached_keys.find(&buffer);
loadkeys = kit == cached_keys.end();
}
// build the keylist
typedef vector<std::pair<string, string> > InfoType;
InfoType bibkeys;
- buffer->fillWithBibKeys(bibkeys);
+ buffer.fillWithBibKeys(bibkeys);
InfoType::const_iterator bit = bibkeys.begin();
InfoType::const_iterator bend = bibkeys.end();
if (infomap.empty())
return string();
- cached_keys[buffer] = infomap;
+ cached_keys[&buffer] = infomap;
}
- biblio::InfoMap infomap = cached_keys[buffer];
+ biblio::InfoMap infomap = cached_keys[&buffer];
// the natbib citation-styles
// CITET: author (year)
}
-string const InsetCitation::generateLabel(Buffer const * buffer) const
+string const InsetCitation::generateLabel(Buffer const & buffer) const
{
string const before = string();
string const after = getOptions();
string label;
- if (buffer->params.use_natbib) {
+ if (buffer.params.use_natbib) {
string cmd = getCmdName();
if (cmd == "cite") {
// We may be "upgrading" from an older LyX version.
// author/year info is not present in the biblio
// database, then getNatbibLabel will exit gracefully
// and we'll call getBasicLabel.
- if (buffer->params.use_numerical_citations)
+ if (buffer.params.use_numerical_citations)
cmd = "citep";
else
cmd = "citet";
}
label = getNatbibLabel(buffer, cmd, getContents(),
before, after,
- buffer->params.use_numerical_citations);
+ buffer.params.use_numerical_citations);
}
// Fallback to fail-safe
}
-InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const * buffer) const
+InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const & buffer) const
{
Cache::Style style = Cache::BASIC;
- if (buffer->params.use_natbib) {
- if (buffer->params.use_numerical_citations) {
+ if (buffer.params.use_natbib) {
+ if (buffer.params.use_numerical_citations) {
style = Cache::NATBIB_NUM;
} else {
style = Cache::NATBIB_AY;
}
-string const InsetCitation::getScreenLabel(Buffer const * buffer) const
+string const InsetCitation::getScreenLabel(Buffer const & buffer) const
{
Cache::Style const style = getStyle(buffer);
if (cache.params == params() && cache.style == style)
}
-void InsetCitation::setLoadingBuffer(Buffer const * buffer, bool state) const
+void InsetCitation::setLoadingBuffer(Buffer const & buffer, bool state) const
{
// Doesn't matter if there is no bv->buffer() entry in the map.
- loading_buffer[buffer] = state;
+ loading_buffer[&buffer] = state;
}
case LFUN_INSET_EDIT:
// A call to edit indicates that we're no longer loading the
// buffer but doing some real work.
- setLoadingBuffer(cmd.view()->buffer(), false);
+ setLoadingBuffer(*cmd.view()->buffer(), false);
InsetCommandMailer("citation", *this).showDialog(cmd.view());
return DISPATCHED;
}
-int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const
+int InsetCitation::ascii(Buffer const & buffer, ostream & os, int) const
{
if (cache.params == params() && cache.style == getStyle(buffer))
os << cache.generated_label;
// the \cite command is valid. Eg, the user has natbib enabled, inputs some
// citations and then changes his mind, turning natbib support off. The output
// should revert to \cite[]{}
-int InsetCitation::latex(Buffer const * buffer, ostream & os,
+int InsetCitation::latex(Buffer const & buffer, ostream & os,
LatexRunParams const &) const
{
os << "\\";
- if (buffer->params.use_natbib)
+ if (buffer.params.use_natbib)
os << getCmdName();
else
os << "cite";
string const before = string();
string const after = getOptions();
- if (!before.empty() && buffer->params.use_natbib)
+ if (!before.empty() && buffer.params.use_natbib)
os << '[' << before << "][" << after << ']';
else if (!after.empty())
os << '[' << after << ']';
return std::auto_ptr<InsetBase>(new InsetCitation(params()));
}
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
dispatch_result localDispatch(FuncRequest const & cmd);
is inserted. Tells us that the buffer is no longer being loaded
and that the cache of BibTeX keys should be reloaded in the future.
*/
- void setLoadingBuffer(Buffer const * buffer, bool state) const;
+ void setLoadingBuffer(Buffer const & buffer, bool state) const;
private:
struct Cache {
///
};
/// This function does the donkey work of creating the pretty label
- string const generateLabel(Buffer const *) const;
+ string const generateLabel(Buffer const &) const;
///
- Cache::Style getStyle(Buffer const * buffer) const;
+ Cache::Style getStyle(Buffer const & buffer) const;
///
mutable Cache cache;
}
-void InsetCollapsable::write(Buffer const * buf, ostream & os) const
+void InsetCollapsable::write(Buffer const & buf, ostream & os) const
{
os << "collapsed " << (collapsed_ ? "true" : "false") << "\n";
inset.writeParagraphData(buf, os);
}
-void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
+void InsetCollapsable::read(Buffer const & buf, LyXLex & lex)
{
if (lex.isOK()) {
lex.next();
}
-int InsetCollapsable::latex(Buffer const * buf, ostream & os,
+int InsetCollapsable::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
return inset.latex(buf, os, runparams);
}
-int InsetCollapsable::ascii(Buffer const * buf, ostream & os, int ll) const
+int InsetCollapsable::ascii(Buffer const & buf, ostream & os, int ll) const
{
return inset.ascii(buf, os, ll);
}
-int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetCollapsable::linuxdoc(Buffer const & buf, ostream & os) const
{
return inset.linuxdoc(buf, os);
}
-int InsetCollapsable::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetCollapsable::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
return inset.docbook(buf, os, mixcont);
}
///
InsetCollapsable(InsetCollapsable const & in);
///
- void read(Buffer const *, LyXLex &);
+ void read(Buffer const &, LyXLex &);
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
void metrics(MetricsInfo &, Dimension &) const;
///
///
RESULT localDispatch(FuncRequest const &);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int) const;
+ int ascii(Buffer const &, std::ostream &, int) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures & features) const;
/// FIXME, document
{
if (!set_label_) {
set_label_ = true;
- button_.update(getScreenLabel(mi.base.bv->buffer()),
+ button_.update(getScreenLabel(*mi.base.bv->buffer()),
editable() != NOT_EDITABLE);
}
button_.metrics(mi, dim);
}
-int InsetCommand::latex(Buffer const *, ostream & os,
+int InsetCommand::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
os << getCommand();
}
-int InsetCommand::ascii(Buffer const *, ostream &, int) const
+int InsetCommand::ascii(Buffer const &, ostream &, int) const
{
return 0;
}
-int InsetCommand::linuxdoc(Buffer const *, ostream &) const
+int InsetCommand::linuxdoc(Buffer const &, ostream &) const
{
return 0;
}
-int InsetCommand::docbook(Buffer const *, ostream &, bool) const
+int InsetCommand::docbook(Buffer const &, ostream &, bool) const
{
return 0;
}
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void write(Buffer const *, std::ostream & os) const
+ void write(Buffer const &, std::ostream & os) const
{ p_.write(os); }
///
- virtual void read(Buffer const *, LyXLex & lex)
+ virtual void read(Buffer const &, LyXLex & lex)
{ p_.read(lex); }
/// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand(c); };
///
- virtual int latex(Buffer const *, std::ostream &,
+ virtual int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- virtual int linuxdoc(Buffer const *, std::ostream &) const;
+ virtual int linuxdoc(Buffer const &, std::ostream &) const;
///
- virtual int docbook(Buffer const *, std::ostream &, bool) const;
+ virtual int docbook(Buffer const &, std::ostream &, bool) const;
///
InsetOld::Code lyxCode() const { return InsetOld::NO_CODE; }
///
virtual BufferView * view() const;
/// This should provide the text for the button
- virtual string const getScreenLabel(Buffer const *) const = 0;
+ virtual string const getScreenLabel(Buffer const &) const = 0;
private:
///
}
-void InsetEnvironment::write(Buffer const * buf, ostream & os) const
+void InsetEnvironment::write(Buffer const & buf, ostream & os) const
{
os << "Environment " << getInsetName() << "\n";
InsetText::write(buf, os);
}
-void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
+void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
{
InsetText::read(buf, lex);
}
}
-int InsetEnvironment::latex(Buffer const * buf, ostream & os,
+int InsetEnvironment::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
os << layout_->latexheader;
///
InsetEnvironment(InsetEnvironment const &);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
virtual std::auto_ptr<InsetBase> clone() const;
///
InsetOld::Code lyxCode() const { return InsetOld::ENVIRONMENT_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
string const editMessage() const;
}
-void InsetERT::read(Buffer const * buf, LyXLex & lex)
+void InsetERT::read(Buffer const & buf, LyXLex & lex)
{
bool token_found = false;
if (lex.isOK()) {
}
-void InsetERT::write(Buffer const * buf, ostream & os) const
+void InsetERT::write(Buffer const & buf, ostream & os) const
{
string st;
<< "status "<< st << "\n";
//inset.writeParagraphData(buf, os);
- string const layout(buf->params.getLyXTextClass().defaultLayoutName());
+ string const layout(buf.params.getLyXTextClass().defaultLayoutName());
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
for (; par != end; ++par) {
}
-int InsetERT::latex(Buffer const *, ostream & os,
+int InsetERT::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
}
-int InsetERT::ascii(Buffer const *, ostream &, int /*linelen*/) const
+int InsetERT::ascii(Buffer const &, ostream &, int /*linelen*/) const
{
return 0;
}
-int InsetERT::linuxdoc(Buffer const *, ostream & os) const
+int InsetERT::linuxdoc(Buffer const &, ostream & os) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
}
-int InsetERT::docbook(Buffer const *, ostream & os, bool) const
+int InsetERT::docbook(Buffer const &, ostream & os, bool) const
{
ParagraphList::iterator par = inset.paragraphs.begin();
ParagraphList::iterator end = inset.paragraphs.end();
///
InsetOld::Code lyxCode() const { return InsetOld::ERT_CODE; }
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
string const editMessage() const;
///
///
EDITABLE editable() const;
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *,
+ int ascii(Buffer const &,
std::ostream &, int linelen = 0) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures &) const {}
///
/// Substitute meta-variables in string s, makeing use of params and buffer.
string const doSubstitution(InsetExternal::Params const & params,
- Buffer const * buffer, string const & s);
+ Buffer const & buffer, string const & s);
/// Invoke the external editor.
-void editExternal(InsetExternal::Params const & params, Buffer const * buffer);
+void editExternal(InsetExternal::Params const & params, Buffer const & buffer);
} // namespace anon
Buffer const & buffer = *cmd.view()->buffer();
InsetExternal::Params p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
- editExternal(p, &buffer);
+ editExternal(p, buffer);
return DISPATCHED_NOUPDATE;
}
case LFUN_INSET_MODIFY: {
Assert(cmd.view());
- Buffer const * buffer = cmd.view()->buffer();
+ Buffer const & buffer = *cmd.view()->buffer();
InsetExternal::Params p;
- InsetExternalMailer::string2params(cmd.argument, *buffer, p);
+ InsetExternalMailer::string2params(cmd.argument, buffer, p);
setParams(p, buffer);
cmd.view()->updateInset(this);
return DISPATCHED;
string const getScreenLabel(InsetExternal::Params const & params,
- Buffer const * buffer)
+ Buffer const & buffer)
{
ExternalTemplate const * const ptr = getTemplatePtr(params);
if (!ptr)
}
-void InsetExternal::setParams(Params const & p, Buffer const * buffer)
+void InsetExternal::setParams(Params const & p, Buffer const & buffer)
{
// The stored params; what we would like to happen in an ideal world.
params_.filename = p.filename;
}
-void InsetExternal::write(Buffer const * buffer, ostream & os) const
+void InsetExternal::write(Buffer const & buffer, ostream & os) const
{
os << "External\n"
<< "\ttemplate " << params_.templatename << '\n';
if (!params_.filename.empty())
os << "\tfilename "
- << params_.filename.outputFilename(buffer->filePath())
+ << params_.filename.outputFilename(buffer.filePath())
<< '\n';
if (params_.display != defaultDisplayType)
}
-void InsetExternal::read(Buffer const * buffer, LyXLex & lex)
+void InsetExternal::read(Buffer const & buffer, LyXLex & lex)
{
enum ExternalTags {
EX_TEMPLATE = 1,
case EX_FILENAME: {
lex.next();
string const name = lex.getString();
- params.filename.set(name, buffer->filePath());
+ params.filename.set(name, buffer.filePath());
break;
}
int InsetExternal::write(string const & format,
- Buffer const * buf, ostream & os,
+ Buffer const & buf, ostream & os,
bool external_in_tmpdir) const
{
ExternalTemplate const * const et_ptr = getTemplatePtr(params_);
}
-int InsetExternal::latex(Buffer const * buf, ostream & os,
+int InsetExternal::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
// "nice" means that the buffer is exported to LaTeX format but not
// If we're running through the LaTeX compiler, we should write the
// generated files in the bufer's temporary directory.
bool const external_in_tmpdir =
- lyxrc.use_tempdir && !buf->tmppath.empty() && !runparams.nice;
+ lyxrc.use_tempdir && !buf.tmppath.empty() && !runparams.nice;
// If the template has specified a PDFLaTeX output, then we try and
// use that.
}
-int InsetExternal::ascii(Buffer const * buf, ostream & os, int) const
+int InsetExternal::ascii(Buffer const & buf, ostream & os, int) const
{
return write("Ascii", buf, os);
}
-int InsetExternal::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetExternal::linuxdoc(Buffer const & buf, ostream & os) const
{
return write("LinuxDoc", buf, os);
}
-int InsetExternal::docbook(Buffer const * buf, ostream & os, bool) const
+int InsetExternal::docbook(Buffer const & buf, ostream & os, bool) const
{
return write("DocBook", buf, os);
}
void InsetExternal::updateExternal(string const & format,
- Buffer const * buf,
+ Buffer const & buf,
bool external_in_tmpdir) const
{
ExternalTemplate const * const et_ptr = getTemplatePtr(params_);
if (external_in_tmpdir && !from_file.empty()) {
// We are running stuff through LaTeX
- from_file = copyFileToDir(buf->tmppath, from_file);
+ from_file = copyFileToDir(buf.tmppath, from_file);
if (from_file.empty())
return;
}
fi.getModificationTime()) >= 0) {
} else {
string const to_filebase = ChangeExtension(to_file, string());
- converters.convert(buf, from_file, to_filebase,
+ converters.convert(&buf, from_file, to_filebase,
from_format, to_format);
}
}
/// Substitute meta-variables in this string
string const doSubstitution(InsetExternal::Params const & params,
- Buffer const * buffer, string const & s)
+ Buffer const & buffer, string const & s)
{
string result;
- string const buffer_path = buffer ? buffer->filePath() : string();
+ string const buffer_path = buffer.filePath();
string const filename = params.filename.outputFilename(buffer_path);
string const basename = ChangeExtension(filename, string());
string const filepath = OnlyPath(filename);
string::size_type const end = result.find("\")", pos);
string const file = result.substr(pos + 12, end - (pos + 12));
string contents;
- if (buffer) {
- Path p(buffer->filePath());
- if (!IsFileReadable(file))
- Path p(buffer->tmppath);
- if (IsFileReadable(file))
- contents = GetFileContents(file);
- } else {
- contents = GetFileContents(file);
+ Path p(buffer.filePath());
+ if (!IsFileReadable(file)) {
+#warning Is this really working as intended?
+ Path p(buffer.tmppath);
}
+
+ if (IsFileReadable(file))
+ contents = GetFileContents(file);
+
result = subst(result,
("$$Contents(\"" + file + "\")").c_str(),
contents);
}
-void editExternal(InsetExternal::Params const & params, Buffer const * buffer)
+void editExternal(InsetExternal::Params const & params, Buffer const & buffer)
{
- if (!buffer)
- return;
-
ExternalTemplate const * const et_ptr = getTemplatePtr(params);
if (!et_ptr)
return;
string const command = doSubstitution(params, buffer, et.editCommand);
- Path p(buffer->filePath());
+ Path p(buffer.filePath());
Forkedcall call;
if (lyxerr.debugging()) {
lyxerr << "Executing '" << command << "' in '"
- << buffer->filePath() << '\'' << endl;
+ << buffer.filePath() << '\'' << endl;
}
call.startscript(Forkedcall::DontWait, command);
}
if (lex.isOK()) {
InsetExternal inset;
- inset.read(&buffer, lex);
+ inset.read(buffer, lex);
params = inset.params();
}
}
Buffer const & buffer)
{
InsetExternal inset;
- inset.setParams(params, &buffer);
+ inset.setParams(params, buffer);
ostringstream data;
data << name_ << ' ';
- inset.write(&buffer, data);
+ inset.write(buffer, data);
data << "\\end_inset\n";
return STRCONV(data.str());
}
///
virtual EDITABLE editable() const { return IS_EDITABLE; }
///
- virtual void write(Buffer const *, std::ostream &) const;
+ virtual void write(Buffer const &, std::ostream &) const;
///
- virtual void read(Buffer const *, LyXLex & lex);
+ virtual void read(Buffer const &, LyXLex & lex);
/** returns the number of rows (\n's) of generated tex code.
fragile == true means, that the inset should take care about
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
- virtual int latex(Buffer const *, std::ostream &,
+ virtual int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
/// write ASCII output to the ostream
- virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
+ virtual int ascii(Buffer const &, std::ostream &, int linelen) const;
/// write LinuxDoc output to the ostream
- virtual int linuxdoc(Buffer const *, std::ostream &) const;
+ virtual int linuxdoc(Buffer const &, std::ostream &) const;
/// write DocBook output to the ostream
- virtual int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ virtual int docbook(Buffer const &, std::ostream &, bool mixcont) const;
/// Updates needed features for this inset.
virtual void validate(LaTeXFeatures & features) const;
Params const & params() const;
/// Set the inset parameters.
- virtual void setParams(Params const &, Buffer const *);
+ virtual void setParams(Params const &, Buffer const &);
/** update the file represented by the template.
If \param external_in_tmpdir == true, then the generated file is
place in the buffer's temporary directory.
*/
- void updateExternal(string const &, Buffer const *,
+ void updateExternal(string const &, Buffer const &,
bool external_in_tmpdir) const;
private:
If \param external_in_tmpdir == true, then the generated file is
place in the buffer's temporary directory.
*/
- int write(string const & format, Buffer const *, std::ostream &,
+ int write(string const & format, Buffer const &, std::ostream &,
bool external_in_tmpdir = false) const;
/// the current params
}
-void InsetFloat::write(Buffer const * buf, ostream & os) const
+void InsetFloat::write(Buffer const & buf, ostream & os) const
{
params_.write(os);
InsetCollapsable::write(buf, os);
}
-void InsetFloat::read(Buffer const * buf, LyXLex & lex)
+void InsetFloat::read(Buffer const & buf, LyXLex & lex)
{
params_.read(lex);
- wide(params_.wide, buf->params);
+ wide(params_.wide, buf.params);
InsetCollapsable::read(buf, lex);
}
}
-int InsetFloat::latex(Buffer const * buf, ostream & os,
+int InsetFloat::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
- FloatList const & floats = buf->params.getLyXTextClass().floats();
+ FloatList const & floats = buf.params.getLyXTextClass().floats();
string const tmptype = (params_.wide ? params_.type + "*" : params_.type);
// Figure out the float placement to use.
// From lowest to highest:
// - document wide default placement
// - specific float placement
string placement;
- string const buf_placement = buf->params.float_placement;
+ string const buf_placement = buf.params.float_placement;
string const def_placement = floats.defaultPlacement(params_.type);
if (!params_.placement.empty()
&& params_.placement != def_placement) {
}
-int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetFloat::linuxdoc(Buffer const & buf, ostream & os) const
{
- FloatList const & floats = buf->params.getLyXTextClass().floats();
+ FloatList const & floats = buf.params.getLyXTextClass().floats();
string const tmptype = params_.type;
// Figure out the float placement to use.
// From lowest to highest:
// This is the same as latex, as linuxdoc is modeled after latex.
string placement;
- string const buf_placement = buf->params.float_placement;
+ string const buf_placement = buf.params.float_placement;
string const def_placement = floats.defaultPlacement(params_.type);
if (!params_.placement.empty()
&& params_.placement != def_placement) {
}
-int InsetFloat::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetFloat::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
os << '<' << params_.type << '>';
int const i = inset.docbook(buf, os, mixcont);
}
-void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
+void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
{
ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
ParIterator end(inset.paragraphs.end(), inset.paragraphs);
// Find a caption layout in one of the (child inset's) pars
for (; pit != end; ++pit) {
if (pit->layout()->name() == caplayout) {
- string const name = floatname(params_.type, buf->params);
+ string const name = floatname(params_.type, buf.params);
string const str =
tostr(toclist[name].size() + 1)
+ ". " + pit->asString(buf, false);
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
void validate(LaTeXFeatures & features) const;
///
///
InsetOld::Code lyxCode() const { return InsetOld::FLOAT_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
string const editMessage() const;
///
///
void wide(bool w, BufferParams const &);
///
- void addToToc(lyx::toc::TocList &, Buffer const *) const;
+ void addToToc(lyx::toc::TocList &, Buffer const &) const;
///
bool showInsetDialog(BufferView *) const;
///
}
-string const InsetFloatList::getScreenLabel(Buffer const * buf) const
+string const InsetFloatList::getScreenLabel(Buffer const & buf) const
{
- FloatList const & floats = buf->params.getLyXTextClass().floats();
+ FloatList const & floats = buf.params.getLyXTextClass().floats();
FloatList::const_iterator it = floats[getCmdName()];
if (it != floats.end())
return _(it->second.listName());
}
-void InsetFloatList::write(Buffer const *, ostream & os) const
+void InsetFloatList::write(Buffer const &, ostream & os) const
{
os << "FloatList " << getCmdName() << "\n";
}
-void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
+void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
{
- FloatList const & floats = buf->params.getLyXTextClass().floats();
+ FloatList const & floats = buf.params.getLyXTextClass().floats();
string token;
if (lex.eatLine()) {
}
-int InsetFloatList::latex(Buffer const * buf, ostream & os,
+int InsetFloatList::latex(Buffer const & buf, ostream & os,
LatexRunParams const &) const
{
- FloatList const & floats = buf->params.getLyXTextClass().floats();
+ FloatList const & floats = buf.params.getLyXTextClass().floats();
FloatList::const_iterator cit = floats[getCmdName()];
if (cit != floats.end()) {
}
-int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
+int InsetFloatList::ascii(Buffer const & buffer, ostream & os, int) const
{
os << getScreenLabel(buffer) << "\n\n";
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetOld::Code lyxCode() const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex &);
+ void read(Buffer const &, LyXLex &);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
+ int linuxdoc(Buffer const &, std::ostream &) const { return 0; }
///
- int docbook(Buffer const *, std::ostream &, bool) const { return 0; }
+ int docbook(Buffer const &, std::ostream &, bool) const { return 0; }
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
void validate(LaTeXFeatures & features) const;
private:
}
-int InsetFoot::latex(Buffer const * buf, ostream & os,
+int InsetFoot::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams_in) const
{
LatexRunParams runparams = runparams_in;
- if (buf) {
- runparams.moving_arg |= ownerPar(*buf, this).layout()->intitle;
- }
+ runparams.moving_arg |= ownerPar(buf, this).layout()->intitle;
os << "%\n\\footnote{";
}
-int InsetFoot::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetFoot::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
os << "<footnote>";
int const i = inset.docbook(buf, os, mixcont);
///
InsetOld::Code lyxCode() const { return InsetOld::FOOT_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
string const editMessage() const;
};
void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
{
InsetCollapsable::metrics(mi, dim);
- if (isOpen())
+ if (isOpen())
dim.wid = mi.base.textwidth;
dim_ = dim;
}
-void InsetFootlike::write(Buffer const * buf, ostream & os) const
+void InsetFootlike::write(Buffer const & buf, ostream & os) const
{
os << getInsetName() << "\n";
InsetCollapsable::write(buf, os);
///
void metrics(MetricsInfo &, Dimension &) const;
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
bool insetAllowed(InsetOld::Code) const;
/** returns true if, when outputing LaTeX, font changes should
}
-void InsetGraphics::write(Buffer const * buf, ostream & os) const
+void InsetGraphics::write(Buffer const & buf, ostream & os) const
{
os << "Graphics\n";
- params().Write(os, buf->filePath());
+ params().Write(os, buf.filePath());
}
-void InsetGraphics::read(Buffer const * buf, LyXLex & lex)
+void InsetGraphics::read(Buffer const & buf, LyXLex & lex)
{
string const token = lex.getString();
if (token == "Graphics")
- readInsetGraphics(lex, buf->filePath());
+ readInsetGraphics(lex, buf.filePath());
else
lyxerr[Debug::GRAPHICS] << "Not a Graphics inset!" << endl;
}
-string const InsetGraphics::prepareFile(Buffer const * buf,
+string const InsetGraphics::prepareFile(Buffer const & buf,
LatexRunParams const & runparams) const
{
// LaTeX can cope if the graphics file doesn't exist, so just return the
// filename.
string orig_file = params().filename.absFilename();
- string const rel_file = params().filename.relFilename(buf->filePath());
+ string const rel_file = params().filename.relFilename(buf.filePath());
if (!IsFileReadable(orig_file)) {
lyxerr[Debug::GRAPHICS]
// Uncompress the file if necessary.
// If it has been uncompressed in a previous call to
// prepareFile, do nothing.
- temp_file = MakeAbsPath(OnlyFilename(temp_file), buf->tmppath);
+ temp_file = MakeAbsPath(OnlyFilename(temp_file), buf.tmppath);
lyxerr[Debug::GRAPHICS]
<< "\ttemp_file: " << temp_file << endl;
if (graphic_->hasFileChanged() || !IsFileReadable(temp_file)) {
<< "\tthe orig file is: " << orig_file << endl;
if (lyxrc.use_tempdir) {
- temp_file = copyFileToDir(buf->tmppath, orig_file);
+ temp_file = copyFileToDir(buf.tmppath, orig_file);
if (temp_file.empty()) {
string str = bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
// if no special converter defined, than we take the default one
// from ImageMagic: convert from:inname.from to:outname.to
- if (!converters.convert(buf, temp_file, outfile_base, from, to)) {
+ if (!converters.convert(&buf, temp_file, outfile_base, from, to)) {
string const command =
LibFileSearch("scripts", "convertDefault.sh") +
' ' + from + ':' + temp_file + ' ' +
}
-int InsetGraphics::latex(Buffer const * buf, ostream & os,
+int InsetGraphics::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
// If there is no file specified or not existing,
<< params().filename.absFilename() << endl;
string const relative_file =
- params().filename.relFilename(buf->filePath());
+ params().filename.relFilename(buf.filePath());
// A missing (e)ps-extension is no problem for LaTeX, so
// we have to test three different cases
}
-int InsetGraphics::ascii(Buffer const *, ostream & os, int) const
+int InsetGraphics::ascii(Buffer const &, ostream & os, int) const
{
// No graphics in ascii output. Possible to use gifscii to convert
// images to ascii approximation.
}
-int InsetGraphics::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetGraphics::linuxdoc(Buffer const & buf, ostream & os) const
{
- string const file_name = buf->niceFile ?
- params().filename.relFilename(buf->filePath()):
+ string const file_name = buf.niceFile ?
+ params().filename.relFilename(buf.filePath()):
params().filename.absFilename();
os << "<eps file=\"" << file_name << "\">\n";
// For explanation on inserting graphics into DocBook checkout:
// http://en.tldp.org/LDP/LDP-Author-Guide/inserting-pictures.html
// See also the docbook guide at http://www.docbook.org/
-int InsetGraphics::docbook(Buffer const *, ostream & os,
+int InsetGraphics::docbook(Buffer const &, ostream & os,
bool /*mixcont*/) const
{
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
///
EDITABLE editable() const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
/** returns the number of rows (\n's) of generated tex code.
#fragile == true# means, that the inset should take care about
fragile commands by adding a #\protect# before.
*/
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
/** Tell LyX what the latex features you need i.e. what latex packages
you need to be included.
/// Create the options for the latex command.
string const createLatexOptions() const;
/// Convert the file if needed, and return the location of the file.
- string const prepareFile(Buffer const * buf, LatexRunParams const &) const;
+ string const prepareFile(Buffer const & buf, LatexRunParams const &) const;
///
InsetGraphicsParams params_;
{}
-int InsetHFill::latex(Buffer const *, ostream & os,
+int InsetHFill::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
os << getCommand();
}
-int InsetHFill::ascii(Buffer const *, ostream & os, int) const
+int InsetHFill::ascii(Buffer const &, ostream & os, int) const
{
os << '\t';
return 0;
}
-int InsetHFill::linuxdoc(Buffer const *, std::ostream & os) const
+int InsetHFill::linuxdoc(Buffer const &, std::ostream & os) const
{
os << '\n';
return 0;
}
-int InsetHFill::docbook(Buffer const *, std::ostream & os, bool) const
+int InsetHFill::docbook(Buffer const &, std::ostream & os, bool) const
{
os << '\n';
return 0;
}
-void InsetHFill::write(Buffer const *, ostream & os) const
+void InsetHFill::write(Buffer const &, ostream & os) const
{
os << "\n\\hfill \n";
}
return std::auto_ptr<InsetBase>(new InsetHFill);
}
///
- string const getScreenLabel(Buffer const *) const { return getContents(); }
+ string const getScreenLabel(Buffer const &) const { return getContents(); }
///
InsetOld::Code lyxCode() const { return InsetOld::HFILL_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool) const;
+ int docbook(Buffer const &, std::ostream &, bool) const;
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
bool directWrite() const { return true; }
};
}
-void InsetInclude::write(Buffer const *, ostream & os) const
+void InsetInclude::write(Buffer const &, ostream & os) const
+{
+ write(os);
+}
+
+
+void InsetInclude::write(ostream & os) const
{
os << "Include " << params_.cparams.getCommand() << '\n'
<< "preview " << tostr(params_.cparams.preview()) << '\n';
}
-void InsetInclude::read(Buffer const *, LyXLex & lex)
+void InsetInclude::read(Buffer const &, LyXLex & lex)
+{
+ read(lex);
+}
+
+
+void InsetInclude::read(LyXLex & lex)
{
params_.cparams.read(lex);
}
-string const InsetInclude::getScreenLabel(Buffer const *) const
+string const InsetInclude::getScreenLabel(Buffer const &) const
{
string temp;
}
-int InsetInclude::latex(Buffer const * buffer, ostream & os,
+int InsetInclude::latex(Buffer const & buffer, ostream & os,
LatexRunParams const & runparams) const
{
string incfile(params_.cparams.getContents());
Buffer * tmp = bufferlist.getBuffer(getFileName());
// FIXME: this should be a GUI warning
- if (tmp->params.textclass != buffer->params.textclass) {
+ if (tmp->params.textclass != buffer.params.textclass) {
lyxerr << "WARNING: Included file `"
<< MakeDisplayPath(getFileName())
<< "' has textclass `"
<< tmp->params.getLyXTextClass().name()
<< "' while parent file has textclass `"
- << buffer->params.getLyXTextClass().name()
+ << buffer.params.getLyXTextClass().name()
<< "'." << endl;
//return 0;
}
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".tex");
- if (!buffer->tmppath.empty() && !runparams.nice) {
+ if (!buffer.tmppath.empty() && !runparams.nice) {
incfile = subst(incfile, '/','@');
#ifdef __EMX__
incfile = subst(incfile, ':', '$');
#endif
- writefile = AddName(buffer->tmppath, incfile);
+ writefile = AddName(buffer.tmppath, incfile);
} else
writefile = getFileName();
writefile = ChangeExtension(writefile, ".tex");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- tmp->markDepClean(buffer->tmppath);
+ tmp->markDepClean(buffer.tmppath);
tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()),
runparams, false);
}
-int InsetInclude::ascii(Buffer const *, ostream & os, int) const
+int InsetInclude::ascii(Buffer const &, ostream & os, int) const
{
if (isVerbatim())
os << GetFileContents(getFileName());
}
-int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
+int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const
{
string incfile(params_.cparams.getContents());
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".sgml");
- if (!buffer->tmppath.empty() && !buffer->niceFile) {
+ if (!buffer.tmppath.empty() && !buffer.niceFile) {
incfile = subst(incfile, '/','@');
- writefile = AddName(buffer->tmppath, incfile);
+ writefile = AddName(buffer.tmppath, incfile);
} else
writefile = getFileName();
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
+ tmp->makeLinuxDocFile(writefile, buffer.niceFile, true);
}
if (isVerbatim()) {
}
-int InsetInclude::docbook(Buffer const * buffer, ostream & os,
+int InsetInclude::docbook(Buffer const & buffer, ostream & os,
bool /*mixcont*/) const
{
string incfile(params_.cparams.getContents());
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".sgml");
- if (!buffer->tmppath.empty() && !buffer->niceFile) {
+ if (!buffer.tmppath.empty() && !buffer.niceFile) {
incfile = subst(incfile, '/','@');
- writefile = AddName(buffer->tmppath, incfile);
+ writefile = AddName(buffer.tmppath, incfile);
} else
writefile = getFileName();
if (IsLyXFilename(getFileName()))
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- tmp->makeDocBookFile(writefile, buffer->niceFile, true);
+ tmp->makeDocBookFile(writefile, buffer.niceFile, true);
}
if (isVerbatim()) {
string incfile(params_.cparams.getContents());
string writefile;
- Buffer const * const b = bufferlist.getBuffer(getMasterFilename());
+ Buffer const & b = *bufferlist.getBuffer(getMasterFilename());
- if (b && !b->tmppath.empty() && !b->niceFile && !isVerbatim()) {
+ if (!b.tmppath.empty() && !b.niceFile && !isVerbatim()) {
incfile = subst(incfile, '/','@');
- writefile = AddName(b->tmppath, incfile);
+ writefile = AddName(b.tmppath, incfile);
} else
writefile = getFileName();
// a file got loaded
Buffer * const tmp = bufferlist.getBuffer(getFileName());
if (tmp) {
- if (b)
- tmp->niceFile = b->niceFile;
+ tmp->niceFile = b.niceFile;
tmp->validate(features);
}
}
} else {
if (!set_label_) {
set_label_ = true;
- button_.update(getScreenLabel(mi.base.bv->buffer()),
+ button_.update(getScreenLabel(*mi.base.bv->buffer()),
editable() != NOT_EDITABLE);
}
button_.metrics(mi, dim);
ostringstream os;
LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX;
- parent().latex(view()->buffer(), os, runparams);
+ parent().latex(*view()->buffer(), os, runparams);
return STRCONV(os.str());
}
if (lex.isOK()) {
InsetInclude inset(params);
- inset.read(0, lex);
+ inset.read(lex);
params = inset.params();
}
}
inset.set(params);
ostringstream data;
data << name_ << ' ';
- inset.write(0, data);
+ inset.write(data);
data << "\\end_inset\n";
return STRCONV(data.str());
}
{
return IS_EDITABLE;
}
- /// With lyx3 we won't overload these 3 methods
- void write(Buffer const *, std::ostream &) const;
///
- void read(Buffer const *, LyXLex &);
+ void write(Buffer const &, std::ostream &) const;
///
- int latex(Buffer const *, std::ostream &,
+ void read(Buffer const &, LyXLex &);
+ ///
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures &) const;
void addPreview(lyx::graphics::PreviewLoader &) const;
private:
+ friend class InsetIncludeMailer;
+
+ ///
+ void write(std::ostream &) const;
+ ///
+ void read(LyXLex &);
/// get the text displayed on the button
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
/// is this a verbatim include ?
bool isVerbatim() const;
/// get the filename of the master buffer
}
-string const InsetIndex::getScreenLabel(Buffer const *) const
+string const InsetIndex::getScreenLabel(Buffer const &) const
{
return _("Idx");
}
}
-int InsetIndex::docbook(Buffer const *, ostream & os, bool) const
+int InsetIndex::docbook(Buffer const &, ostream & os, bool) const
{
os << "<indexterm><primary>" << getContents()
<< "</primary></indexterm>";
{}
-string const InsetPrintIndex::getScreenLabel(Buffer const *) const
+string const InsetPrintIndex::getScreenLabel(Buffer const &) const
{
return _("Index");
}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetOld::Code lyxCode() const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
};
///
InsetOld::Code lyxCode() const;
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
void metrics(MetricsInfo &, Dimension &) const;
///
}
-int InsetLabel::latex(Buffer const *, ostream & os,
+int InsetLabel::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
os << escape(getCommand());
}
-int InsetLabel::ascii(Buffer const *, ostream & os, int) const
+int InsetLabel::ascii(Buffer const &, ostream & os, int) const
{
os << '<' << getContents() << '>';
return 0;
}
-int InsetLabel::linuxdoc(Buffer const *, ostream & os) const
+int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
{
os << "<label id=\"" << getContents() << "\" >";
return 0;
}
-int InsetLabel::docbook(Buffer const *, ostream & os, bool) const
+int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
{
os << "<anchor id=\"" << getContents() << "\">";
return 0;
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const { return getContents(); }
+ string const getScreenLabel(Buffer const &) const { return getContents(); }
///
EDITABLE editable() const { return IS_EDITABLE; }
///
///
void getLabelList(std::vector<string> &) const;
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
};
#endif
}
-void InsetLatexAccent::write(Buffer const *, ostream & os) const
+void InsetLatexAccent::write(Buffer const &, ostream & os) const
{
os << "\\i " << contents << "\n";
}
-void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
+void InsetLatexAccent::read(Buffer const &, LyXLex & lex)
{
lex.eatLine();
contents = lex.getString();
}
-int InsetLatexAccent::latex(Buffer const *, ostream & os,
+int InsetLatexAccent::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
os << contents;
}
-int InsetLatexAccent::ascii(Buffer const *, ostream & os, int) const
+int InsetLatexAccent::ascii(Buffer const &, ostream & os, int) const
{
os << contents;
return 0;
}
-int InsetLatexAccent::linuxdoc(Buffer const *, ostream & os) const
+int InsetLatexAccent::linuxdoc(Buffer const &, ostream & os) const
{
os << contents;
return 0;
}
-int InsetLatexAccent::docbook(Buffer const *, ostream & os, bool) const
+int InsetLatexAccent::docbook(Buffer const &, ostream & os, bool) const
{
os << contents;
return 0;
///
bool displayISO8859_9(PainterInfo & pi, int x, int y) const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
bool directWrite() const;
///
///
InsetList();
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
string const editMessage() const;
}
-int InsetMarginal::latex(Buffer const * buf, ostream & os,
+int InsetMarginal::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
os << "%\n\\marginpar{";
///
InsetOld::Code lyxCode() const { return InsetOld::MARGIN_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
string const editMessage() const;
}
-void InsetMinipage::write(Buffer const * buf, ostream & os) const
+void InsetMinipage::write(Buffer const & buf, ostream & os) const
{
params_.write(os);
InsetCollapsable::write(buf, os);
}
-void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
+void InsetMinipage::read(Buffer const & buf, LyXLex & lex)
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
}
-int InsetMinipage::latex(Buffer const * buf, ostream & os,
+int InsetMinipage::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
string s_pos;
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
virtual std::auto_ptr<InsetBase> clone() const;
///
///
InsetOld::Code lyxCode() const { return InsetOld::MINIPAGE_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
string const editMessage() const;
using std::endl;
-void InsetNewline::read(Buffer const *, LyXLex &)
+void InsetNewline::read(Buffer const &, LyXLex &)
{
/* Nothing to read */
}
-void InsetNewline::write(Buffer const *, ostream & os) const
+void InsetNewline::write(Buffer const &, ostream & os) const
{
os << "\n\\newline \n";
}
}
-int InsetNewline::latex(Buffer const *, ostream &,
+int InsetNewline::latex(Buffer const &, ostream &,
LatexRunParams const &) const
{
lyxerr << "Eek, calling InsetNewline::latex !" << endl;
}
-int InsetNewline::ascii(Buffer const *, ostream & os, int) const
+int InsetNewline::ascii(Buffer const &, ostream & os, int) const
{
os << '\n';
return 0;
}
-int InsetNewline::linuxdoc(Buffer const *, std::ostream & os) const
+int InsetNewline::linuxdoc(Buffer const &, std::ostream & os) const
{
os << '\n';
return 0;
}
-int InsetNewline::docbook(Buffer const *, std::ostream & os, bool) const
+int InsetNewline::docbook(Buffer const &, std::ostream & os, bool) const
{
os << '\n';
return 0;
virtual void draw(PainterInfo & pi, int x, int y) const;
- virtual int latex(Buffer const *, std::ostream &,
+ virtual int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
- virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
+ virtual int ascii(Buffer const &, std::ostream &, int linelen) const;
- virtual int linuxdoc(Buffer const *, std::ostream &) const;
+ virtual int linuxdoc(Buffer const &, std::ostream &) const;
- virtual int docbook(Buffer const *, std::ostream &, bool) const;
+ virtual int docbook(Buffer const &, std::ostream &, bool) const;
- virtual void read(Buffer const *, LyXLex & lex);
+ virtual void read(Buffer const &, LyXLex & lex);
- virtual void write(Buffer const * buf, std::ostream & os) const;
+ virtual void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
virtual bool directWrite() const { return true; }
};
}
-void InsetNote::write(Buffer const * buf, ostream & os) const
+void InsetNote::write(Buffer const & buf, ostream & os) const
{
params_.write(os);
InsetCollapsable::write(buf, os);
}
-void InsetNote::read(Buffer const * buf, LyXLex & lex)
+void InsetNote::read(Buffer const & buf, LyXLex & lex)
{
InsetCollapsable::read(buf, lex);
setButtonLabel();
}
-int InsetNote::latex(Buffer const * buf, ostream & os,
+int InsetNote::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
string const pt = params_.type;
}
-int InsetNote::linuxdoc(Buffer const * buf, std::ostream & os) const
+int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os) const
{
string const pt = params_.type;
}
-int InsetNote::docbook(Buffer const * buf, std::ostream & os, bool mixcont) const
+int InsetNote::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
{
string const pt = params_.type;
}
-int InsetNote::ascii(Buffer const * buf, std::ostream & os, int ll) const
+int InsetNote::ascii(Buffer const & buf, std::ostream & os, int ll) const
{
int i = 0;
string const pt = params_.type;
///
InsetOld::Code lyxCode() const { return InsetOld::NOTE_CODE; }
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
void setButtonLabel();
///
/// show the note dialog
bool showInsetDialog(BufferView * bv) const;
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool) const;
+ int docbook(Buffer const &, std::ostream &, bool) const;
///
- int ascii(Buffer const *, std::ostream &, int) const;
+ int ascii(Buffer const &, std::ostream &, int) const;
///
void validate(LaTeXFeatures &) const;
///
}
-void InsetOptArg::write(Buffer const * buf, ostream & os) const
+void InsetOptArg::write(Buffer const & buf, ostream & os) const
{
os << "OptArg" << "\n";
InsetCollapsable::write(buf, os);
}
-int InsetOptArg::latex(Buffer const *, ostream &,
+int InsetOptArg::latex(Buffer const &, ostream &,
LatexRunParams const &) const
{
return 0;
}
-int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
+int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
os << '[';
string const editMessage() const;
/// Standard LaTeX output -- short-circuited
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
/// Outputting the optional parameter of a LaTeX command
- int latexOptional(Buffer const *, std::ostream &,
+ int latexOptional(Buffer const &, std::ostream &,
LatexRunParams const &) const;
/// Write out tothe .lyx file
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
};
#endif // INSETOPTARG_H
}
-void InsetQuotes::write(Buffer const *, ostream & os) const
+void InsetQuotes::write(Buffer const &, ostream & os) const
{
string text;
text += language_char[language_];
}
-void InsetQuotes::read(Buffer const *, LyXLex & lex)
+void InsetQuotes::read(Buffer const &, LyXLex & lex)
{
lex.nextToken();
parseString(lex.getString());
}
-int InsetQuotes::latex(Buffer const * buf, ostream & os,
+int InsetQuotes::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
// How do we get the local language here??
- lyx::pos_type curr_pos = ownerPar(*buf, this).getPositionOfInset(this);
+ lyx::pos_type curr_pos = ownerPar(buf, this).getPositionOfInset(this);
Assert(curr_pos != -1);
#warning FIXME. We _must_ find another way to get the language. (Lgb)
parOwner()->getFont(buf->params, curr_pos).language()->babel();
#else
// And this is not the way... (Lgb)
- string const curr_lang = buf->params.language->lang();
+ string const curr_lang = buf.params.language->lang();
#endif
const int quoteind = quote_index[side_][language_];
string qstr;
}
-int InsetQuotes::ascii(Buffer const *, ostream & os, int) const
+int InsetQuotes::ascii(Buffer const &, ostream & os, int) const
{
os << '"';
return 0;
}
-int InsetQuotes::linuxdoc(Buffer const *, ostream & os) const
+int InsetQuotes::linuxdoc(Buffer const &, ostream & os) const
{
os << '"';
return 0;
}
-int InsetQuotes::docbook(Buffer const *, ostream & os, bool) const
+int InsetQuotes::docbook(Buffer const &, ostream & os, bool) const
{
if (times_ == DoubleQ) {
if (side_ == LeftQ)
LyXFont const convertFont(LyXFont const & font) const;
#endif
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures &) const;
///
}
-string const InsetRef::getScreenLabel(Buffer const *) const
+string const InsetRef::getScreenLabel(Buffer const &) const
{
string temp;
for (int i = 0; !types[i].latex_name.empty(); ++ i)
}
-int InsetRef::latex(Buffer const *, ostream & os,
+int InsetRef::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
if (getOptions().empty())
}
-int InsetRef::ascii(Buffer const *, ostream & os, int) const
+int InsetRef::ascii(Buffer const &, ostream & os, int) const
{
os << '[' << getContents() << ']';
return 0;
}
-int InsetRef::linuxdoc(Buffer const *, ostream & os) const
+int InsetRef::linuxdoc(Buffer const &, ostream & os) const
{
os << "<ref id=\"" << getContents()
<< "\" name=\"" << getOptions() << "\" >";
}
-int InsetRef::docbook(Buffer const *, ostream & os, bool) const
+int InsetRef::docbook(Buffer const &, ostream & os, bool) const
{
if (getOptions().empty()) {
os << "<xref linkend=\"" << getContents() << "\">";
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
///
bool display() const { return false; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures & features) const;
private:
}
-void InsetSpace::write(Buffer const *, ostream & os) const
+void InsetSpace::write(Buffer const &, ostream & os) const
{
string command;
switch (kind_) {
// This function will not be necessary when lyx3
-void InsetSpace::read(Buffer const *, LyXLex & lex)
+void InsetSpace::read(Buffer const &, LyXLex & lex)
{
lex.nextToken();
string const command = lex.getString();
}
-int InsetSpace::latex(Buffer const *, ostream & os,
+int InsetSpace::latex(Buffer const &, ostream & os,
LatexRunParams const & runparams) const
{
switch (kind_) {
}
-int InsetSpace::ascii(Buffer const *, ostream & os, int) const
+int InsetSpace::ascii(Buffer const &, ostream & os, int) const
{
switch (kind_) {
case NORMAL:
}
-int InsetSpace::linuxdoc(Buffer const *, ostream & os) const
+int InsetSpace::linuxdoc(Buffer const &, ostream & os) const
{
switch (kind_) {
case NORMAL:
}
-int InsetSpace::docbook(Buffer const *, ostream & os, bool) const
+int InsetSpace::docbook(Buffer const &, ostream & os, bool) const
{
switch (kind_) {
case NORMAL:
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
/// Will not be used when lyxf3
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
///
// In lyxf3 this will be just LaTeX
-void InsetSpecialChar::write(Buffer const *, ostream & os) const
+void InsetSpecialChar::write(Buffer const &, ostream & os) const
{
string command;
switch (kind_) {
// This function will not be necessary when lyx3
-void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
+void InsetSpecialChar::read(Buffer const &, LyXLex & lex)
{
lex.nextToken();
string const command = lex.getString();
}
-int InsetSpecialChar::latex(Buffer const *, ostream & os,
+int InsetSpecialChar::latex(Buffer const &, ostream & os,
LatexRunParams const &) const
{
switch (kind_) {
}
-int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
+int InsetSpecialChar::ascii(Buffer const &, ostream & os, int) const
{
switch (kind_) {
case HYPHENATION:
}
-int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
+int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os) const
{
switch (kind_) {
case HYPHENATION:
}
-int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
+int InsetSpecialChar::docbook(Buffer const &, ostream & os, bool) const
{
switch (kind_) {
case HYPHENATION:
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
/// Will not be used when lyxf3
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
///
}
-Buffer const * InsetTabular::buffer() const
+Buffer const & InsetTabular::buffer() const
{
- return buffer_;
+ return *buffer_;
}
}
-void InsetTabular::write(Buffer const * buf, ostream & os) const
+void InsetTabular::write(Buffer const & buf, ostream & os) const
{
os << "Tabular" << endl;
tabular.write(buf, os);
}
-void InsetTabular::read(Buffer const * buf, LyXLex & lex)
+void InsetTabular::read(Buffer const & buf, LyXLex & lex)
{
bool const old_format = (lex.getString() == "\\LyXTable");
updateLocal(bv);
break;
case LFUN_NEXT: {
- if (hs)
+ if (hs)
clearSelection();
int column = actcol;
unlockInsetInInset(bv, the_locking_inset);
}
-int InsetTabular::latex(Buffer const * buf, ostream & os,
+int InsetTabular::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
return tabular.latex(buf, os, runparams);
}
-int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
+int InsetTabular::ascii(Buffer const & buf, ostream & os, int ll) const
{
if (ll > 0)
- return tabular.ascii(buf, os, ownerPar(*buf, this).params().depth(),
+ return tabular.ascii(buf, os, ownerPar(buf, this).params().depth(),
false, 0);
return tabular.ascii(buf, os, 0, false, 0);
}
-int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetTabular::linuxdoc(Buffer const & buf, ostream & os) const
{
return tabular.linuxdoc(buf,os);
}
-int InsetTabular::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetTabular::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
int ret = 0;
InsetOld * master;
}
-void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const
+void InsetTabular::deleteLyXText(BufferView * /*bv*/, bool /*recursive*/) const
{
//resizeLyXText(bv, recursive);
}
true, true);
ostringstream os;
- paste_tabular->ascii(bv->buffer(), os,
+ paste_tabular->ascii(*bv->buffer(), os,
ownerPar(*bv->buffer(), this).params().depth(), true, '\t');
bv->stuffClipboard(STRCONV(os.str()));
return true;
if (!lex.isOK())
return -1;
- Buffer const * const buffer = inset.buffer();
- if (buffer)
- inset.read(buffer, lex);
+ Buffer const & buffer = inset.buffer();
+ inset.read(buffer, lex);
// We can't set the active cell, but we can tell the frontend
// what it is.
string const InsetTabularMailer::params2string(InsetTabular const & inset)
{
- Buffer const * const buffer = inset.buffer();
- if (!buffer)
- return string();
+ Buffer const & buffer = inset.buffer();
ostringstream data;
data << name_ << " \\active_cell " << inset.getActCell() << '\n';
///
virtual std::auto_ptr<InsetBase> clone() const;
///
- void read(Buffer const *, LyXLex &);
+ void read(Buffer const &, LyXLex &);
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
void metrics(MetricsInfo &, Dimension &) const;
///
///
RESULT localDispatch(FuncRequest const &);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
void validate(LaTeXFeatures & features) const;
///
///
virtual BufferView * view() const;
///
- Buffer const * buffer() const;
+ Buffer const & buffer() const;
/// set the owning buffer
void buffer(Buffer * b);
if (just_mark_erased) {
ParagraphList::iterator it = paragraphs.begin();
ParagraphList::iterator end = paragraphs.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
it->markErased();
return;
}
}
-void InsetText::write(Buffer const * buf, ostream & os) const
+void InsetText::write(Buffer const & buf, ostream & os) const
{
os << "Text\n";
writeParagraphData(buf, os);
}
-void InsetText::writeParagraphData(Buffer const * buf, ostream & os) const
+void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
{
ParagraphList::const_iterator it = paragraphs.begin();
ParagraphList::const_iterator end = paragraphs.end();
Paragraph::depth_type dth = 0;
for (; it != end; ++it) {
- it->write(buf, os, buf->params, dth);
+ it->write(buf, os, buf.params, dth);
}
}
-void InsetText::read(Buffer const * buf, LyXLex & lex)
+void InsetText::read(Buffer const & buf, LyXLex & lex)
{
string token;
Paragraph::depth_type depth = 0;
clear(false);
- if (buf->params.tracking_changes)
+ if (buf.params.tracking_changes)
paragraphs.begin()->trackChanges();
// delete the initial paragraph
}
// FIXME: ugly.
- const_cast<Buffer*>(buf)->readParagraph(lex, token, paragraphs, pit, depth);
+ const_cast<Buffer&>(buf).readParagraph(lex, token, paragraphs, pit, depth);
}
pit = paragraphs.begin();
case LFUN_DELETE:
if (text_.selection.set())
text_.cutSelection(true, false);
- else
+ else
text_.Delete();
updflag = true;
break;
string cur_layout = cpar()->layout()->name();
// Derive layout number from given argument (string)
- // and current buffer's textclass (number).
+ // and current buffer's textclass (number).
LyXTextClass const & tclass =
bv->buffer()->params.getLyXTextClass();
string layout = cmd.argument;
}
-int InsetText::latex(Buffer const * buf, ostream & os,
+int InsetText::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
TexRow texrow;
}
-int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const
+int InsetText::ascii(Buffer const & buf, ostream & os, int linelen) const
{
unsigned int lines = 0;
ParagraphList::const_iterator end = paragraphs.end();
ParagraphList::const_iterator it = beg;
for (; it != end; ++it) {
- string const tmp = buf->asciiParagraph(*it, linelen, it == beg);
+ string const tmp = buf.asciiParagraph(*it, linelen, it == beg);
lines += lyx::count(tmp.begin(), tmp.end(), '\n');
os << tmp;
}
}
-int InsetText::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetText::linuxdoc(Buffer const & buf, ostream & os) const
{
ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
const string name = pit->layout()->latexname();
if (name != "p")
sgml::openTag(os, 1, 0, name);
- buf->simpleLinuxDocOnePar(os, pit, 0);
+ buf.simpleLinuxDocOnePar(os, pit, 0);
if (name != "p")
sgml::closeTag(os, 1, 0, name);
}
}
-int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetText::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
unsigned int lines = 0;
break;
case LATEX_COMMAND:
- buf->error(ErrorItem(_("Error"), _("LatexType Command not allowed here.\n"), pit->id(), 0, pit->size()));
+ buf.error(ErrorItem(_("Error"), _("LatexType Command not allowed here.\n"), pit->id(), 0, pit->size()));
return -1;
break;
break;
}
- buf->simpleDocBookOnePar(os, pit, desc_on, depth + 1 + command_depth);
+ buf.simpleDocBookOnePar(os, pit, desc_on, depth + 1 + command_depth);
string end_tag;
// write closing SGML tags
}
-void InsetText::clearSelection(BufferView * bv)
+void InsetText::clearSelection(BufferView *)
{
text_.clearSelection();
}
/// empty inset to empty par, or just mark as erased
void clear(bool just_mark_erased);
///
- void read(Buffer const *, LyXLex &);
+ void read(Buffer const &, LyXLex &);
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
void metrics(MetricsInfo &, Dimension &) const;
///
///
RESULT localDispatch(FuncRequest const &);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const ;
+ int linuxdoc(Buffer const &, std::ostream &) const ;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const ;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const ;
///
void validate(LaTeXFeatures & features) const;
///
///
void init(InsetText const * ins);
///
- void writeParagraphData(Buffer const *, std::ostream &) const;
+ void writeParagraphData(Buffer const &, std::ostream &) const;
///
void setText(string const &, LyXFont const &);
///
///
RESULT moveDown(BufferView *);
///
- void setCharFont(Buffer const *, int pos, LyXFont const & font);
+ void setCharFont(Buffer const &, int pos, LyXFont const & font);
///
bool checkAndActivateInset(BufferView * bv, bool front);
///
///
InsetTheorem();
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
virtual InsetBase * clone() const;
///
///
void draw(PainterInfo & pi, int x, int y) const;
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
string const editMessage() const;
}
-string const InsetTOC::getScreenLabel(Buffer const *) const
+string const InsetTOC::getScreenLabel(Buffer const &) const
{
string const cmdname(getCmdName());
}
-int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
+int InsetTOC::ascii(Buffer const & buffer, ostream & os, int) const
{
os << getScreenLabel(buffer) << "\n\n";
}
-int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
+int InsetTOC::linuxdoc(Buffer const &, ostream & os) const
{
if (getCmdName() == "tableofcontents")
os << "<toc>";
}
-int InsetTOC::docbook(Buffer const *, ostream & os, bool) const
+int InsetTOC::docbook(Buffer const &, ostream & os, bool) const
{
if (getCmdName() == "tableofcontents")
os << "<toc></toc>";
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetOld::Code lyxCode() const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
private:
///
mutable unsigned int center_indent_;
}
-string const InsetUrl::getScreenLabel(Buffer const *) const
+string const InsetUrl::getScreenLabel(Buffer const &) const
{
string temp;
if (getCmdName() == "url")
}
-int InsetUrl::latex(Buffer const *, ostream & os,
+int InsetUrl::latex(Buffer const &, ostream & os,
LatexRunParams const & runparams) const
{
if (!getOptions().empty())
}
-int InsetUrl::ascii(Buffer const *, ostream & os, int) const
+int InsetUrl::ascii(Buffer const &, ostream & os, int) const
{
if (getOptions().empty())
os << '[' << getContents() << ']';
}
-int InsetUrl::linuxdoc(Buffer const *, ostream & os) const
+int InsetUrl::linuxdoc(Buffer const &, ostream & os) const
{
os << '<' << getCmdName()
<< " url=\"" << getContents() << "\""
}
-int InsetUrl::docbook(Buffer const *, ostream & os, bool) const
+int InsetUrl::docbook(Buffer const &, ostream & os, bool) const
{
os << "<ulink url=\"" << subst(getContents(),"&","&")
<< "\">" << getOptions() << "</ulink>";
///
void validate(LaTeXFeatures &) const;
///
- string const getScreenLabel(Buffer const *) const;
+ string const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
///
bool display() const { return false; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
};
#endif
}
-void InsetWrap::write(Buffer const * buf, ostream & os) const
+void InsetWrap::write(Buffer const & buf, ostream & os) const
{
params_.write(os);
InsetCollapsable::write(buf, os);
}
-void InsetWrap::read(Buffer const * buf, LyXLex & lex)
+void InsetWrap::read(Buffer const & buf, LyXLex & lex)
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
}
-int InsetWrap::latex(Buffer const * buf, ostream & os,
+int InsetWrap::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
os << "\\begin{floating" << params_.type << '}';
}
-int InsetWrap::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetWrap::docbook(Buffer const & buf, ostream & os, bool mixcont) const
{
os << '<' << params_.type << '>';
int const i = inset.docbook(buf, os, mixcont);
}
-void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
+void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
{
// Now find the caption in the float...
ParagraphList::iterator tmp = inset.paragraphs.begin();
for (; tmp != end; ++tmp) {
if (tmp->layout()->name() == caplayout) {
- string const name = floatname(params_.type, buf->params);
+ string const name = floatname(params_.type, buf.params);
string const str =
tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void read(Buffer const * buf, LyXLex & lex);
+ void read(Buffer const & buf, LyXLex & lex);
///
void validate(LaTeXFeatures & features) const;
///
///
InsetOld::Code lyxCode() const { return InsetOld::WRAP_CODE; }
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
string const editMessage() const;
///
bool insetAllowed(InsetOld::Code) const;
///
- void addToToc(lyx::toc::TocList &, Buffer const *) const;
+ void addToToc(lyx::toc::TocList &, Buffer const &) const;
///
bool showInsetDialog(BufferView *) const;
///
lyxrc.label_init_length < 0)
text.erase();
- string par_text = pit->asString(bv.buffer(), false);
+ string par_text = pit->asString(*bv.buffer(), false);
for (int i = 0; i < lyxrc.label_init_length; ++i) {
if (par_text.empty())
break;
string str2;
if (casesens) {
str1 = searchstr;
- str2 = text->selectionAsString(bv->buffer(), false);
+ str2 = text->selectionAsString(*bv->buffer(), false);
} else {
str1 = lowercase(searchstr);
- str2 = lowercase(text->selectionAsString(bv->buffer(), false));
+ str2 = lowercase(text->selectionAsString(*bv->buffer(), false));
}
if (str1 != str2) {
if (!find(bv, searchstr, fw, casesens, matchwrd) ||
switch (ev.action) {
case LFUN_EXPORT:
disable = ev.argument != "custom"
- && !Exporter::IsExportable(buf, ev.argument);
+ && !Exporter::IsExportable(*buf, ev.argument);
break;
case LFUN_UNDO:
disable = buf->undostack.empty();
disable = !buf->isLatex() || lyxrc.chktex_command == "none";
break;
case LFUN_BUILDPROG:
- disable = !Exporter::IsExportable(buf, "program");
+ disable = !Exporter::IsExportable(*buf, "program");
break;
case LFUN_LAYOUT_TABULAR:
}
if (name == "print") {
- disable = !Exporter::IsExportable(buf, "dvi") ||
+ disable = !Exporter::IsExportable(*buf, "dvi") ||
lyxrc.print_command == "none";
} else if (name == "character") {
UpdatableInset * tli = view()->theLockingInset();
{
return (meta_fake_bit != key_modifier::none);
}
-
/**
This class used to hold the mapping between buffer paragraphs and
screen rows. Nowadays, the Paragraphs take care of their rows
- themselves and this contains just most of the code for manipulating
- them and interaction with the Cursor.
+ themselves and this contains just most of the code for manipulating
+ them and interaction with the Cursor.
*/
// The inheritance from TextCursor should go. It's just there to ease
void setCurrentFont();
///
- bool isBoundary(Buffer const *, Paragraph const & par,
+ bool isBoundary(Buffer const &, Paragraph const & par,
lyx::pos_type pos) const;
///
- bool isBoundary(Buffer const *, Paragraph const & par,
+ bool isBoundary(Buffer const &, Paragraph const & par,
lyx::pos_type pos,
LyXFont const & font) const;
///
void computeBidiTables(ParagraphList::iterator pit,
- Buffer const *, RowList::iterator row) const;
+ Buffer const &, RowList::iterator row) const;
/// Maps positions in the visual string to positions in logical string.
lyx::pos_type log2vis(lyx::pos_type pos) const;
/// Maps positions in the logical string to positions in visual string.
private:
///
- void setCounter(Buffer const *, ParagraphList::iterator pit);
+ void setCounter(Buffer const &, ParagraphList::iterator pit);
///
void deleteWordForward();
///
+2003-08-28 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * most files: change to use const buffer refs
+
2003-08-19 Angus Leeming <leeming@lyx.org>
* most files: 'standardise' the header blurb.
}
-void InsetFormula::write(Buffer const *, ostream & os) const
+void InsetFormula::write(Buffer const &, ostream & os) const
{
WriteStream wi(os, false, false);
os << par_->fileInsetLabel() << ' ';
}
-int InsetFormula::latex(Buffer const *, ostream & os,
+int InsetFormula::latex(Buffer const &, ostream & os,
LatexRunParams const & runparams) const
{
WriteStream wi(os, runparams.moving_arg, true);
}
-int InsetFormula::ascii(Buffer const *, ostream & os, int) const
+int InsetFormula::ascii(Buffer const &, ostream & os, int) const
{
if (0 && display()) {
Dimension dim;
}
-int InsetFormula::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetFormula::linuxdoc(Buffer const & buf, ostream & os) const
{
return docbook(buf, os, false);
}
-int InsetFormula::docbook(Buffer const * buf, ostream & os, bool) const
+int InsetFormula::docbook(Buffer const & buf, ostream & os, bool) const
{
MathMLStream ms(os);
ms << MTag("equation");
}
-void InsetFormula::read(Buffer const *, LyXLex & lex)
+void InsetFormula::read(Buffer const &, LyXLex & lex)
{
mathed_parse_normal(par_, lex);
// remove extra 'mathrm' for chemistry stuff.
void draw(PainterInfo & pi, int x, int y) const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ int linuxdoc(Buffer const &, std::ostream &) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
// sel = "";
//else
- string sel = bv->getLyXText()->selectionAsString(bv->buffer(), false);
+ string sel = bv->getLyXText()->selectionAsString(*bv->buffer(), false);
if (sel.empty()) {
InsetFormula * f = new InsetFormula(bv);
}
-void InsetFormulaMacro::write(Buffer const *, ostream & os) const
+void InsetFormulaMacro::write(Buffer const &, ostream & os) const
{
os << "FormulaMacro ";
WriteStream wi(os, false, false);
}
-int InsetFormulaMacro::latex(Buffer const *, ostream & os,
+int InsetFormulaMacro::latex(Buffer const &, ostream & os,
LatexRunParams const & runparams) const
{
WriteStream wi(os, runparams.moving_arg, true);
}
-int InsetFormulaMacro::ascii(Buffer const *, ostream & os, int) const
+int InsetFormulaMacro::ascii(Buffer const &, ostream & os, int) const
{
WriteStream wi(os, false, true);
par()->write(wi);
}
-int InsetFormulaMacro::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetFormulaMacro::linuxdoc(Buffer const & buf, ostream & os) const
{
return ascii(buf, os, 0);
}
-int InsetFormulaMacro::docbook(Buffer const * buf, ostream & os, bool) const
+int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os, bool) const
{
return ascii(buf, os, 0);
}
-void InsetFormulaMacro::read(Buffer const *, LyXLex & lex)
+void InsetFormulaMacro::read(Buffer const &, LyXLex & lex)
{
read(lex.getStream());
}
void draw(PainterInfo & pi, int x, int y) const;
///
- void read(Buffer const *, LyXLex & lex);
+ void read(Buffer const &, LyXLex & lex);
///
- void write(Buffer const *, std::ostream & os) const;
+ void write(Buffer const &, std::ostream & os) const;
///
- int ascii(Buffer const *, std::ostream &, int linelen) const;
+ int ascii(Buffer const &, std::ostream &, int linelen) const;
///
- int latex(Buffer const *, std::ostream & os,
+ int latex(Buffer const &, std::ostream & os,
LatexRunParams const &) const;
///
- int linuxdoc(Buffer const *, std::ostream & os) const;
+ int linuxdoc(Buffer const &, std::ostream & os) const;
///
- int docbook(Buffer const *, std::ostream &, bool mixcont) const;
+ int docbook(Buffer const &, std::ostream &, bool mixcont) const;
///
virtual std::auto_ptr<InsetBase> clone() const;
}
-void Paragraph::write(Buffer const * buf, ostream & os,
+void Paragraph::write(Buffer const & buf, ostream & os,
BufferParams const & bparams,
depth_type & dth) const
{
// This one spits out the text of the paragraph
-bool Paragraph::simpleTeXOnePar(Buffer const * buf,
+bool Paragraph::simpleTeXOnePar(Buffer const & buf,
BufferParams const & bparams,
LyXFont const & outerfont,
ostream & os, TexRow & texrow,
// Convert the paragraph to a string.
// Used for building the table of contents
-string const Paragraph::asString(Buffer const * buffer, bool label) const
+string const Paragraph::asString(Buffer const & buffer, bool label) const
{
#if 0
string s;
}
-string const Paragraph::asString(Buffer const * buffer,
+string const Paragraph::asString(Buffer const & buffer,
pos_type beg, pos_type end, bool label) const
{
ostringstream os;
os << params().labelString() << ' ';
for (pos_type i = beg; i < end; ++i) {
- value_type const c = getUChar(buffer->params, i);
+ value_type const c = getUChar(buffer.params, i);
if (IsPrintable(c))
os << c;
else if (c == META_INSET)
bool isMultiLingual(BufferParams const &);
///
- string const asString(Buffer const *, bool label) const;
+ string const asString(Buffer const &, bool label) const;
///
- string const asString(Buffer const *, lyx::pos_type beg, lyx::pos_type end,
+ string const asString(Buffer const &, lyx::pos_type beg, lyx::pos_type end,
bool label) const;
///
- void write(Buffer const *, std::ostream &, BufferParams const &,
+ void write(Buffer const &, std::ostream &, BufferParams const &,
depth_type & depth) const;
///
void validate(LaTeXFeatures &) const;
///
- bool simpleTeXOnePar(Buffer const *, BufferParams const &,
+ bool simpleTeXOnePar(Buffer const &, BufferParams const &,
LyXFont const & outerfont, std::ostream &,
TexRow & texrow, LatexRunParams const &);
#include "insets/insethfill.h"
#include "insets/insetnewline.h"
-extern string bibitemWidest(Buffer const *);
+extern string bibitemWidest(Buffer const &);
using namespace lyx::support;
namespace {
ParagraphList::iterator
-TeXEnvironment(Buffer const * buf,
+TeXEnvironment(Buffer const & buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
LatexRunParams const & runparams);
ParagraphList::iterator
-TeXOnePar(Buffer const * buf,
+TeXOnePar(Buffer const & buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
ParagraphList::iterator
-TeXDeeper(Buffer const * buf,
+TeXDeeper(Buffer const & buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
ParagraphList::iterator
-TeXEnvironment(Buffer const * buf,
+TeXEnvironment(Buffer const & buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
{
lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl;
- BufferParams const & bparams = buf->params;
+ BufferParams const & bparams = buf.params;
LyXLayout_ptr const & style = pit->layout();
ParagraphList::iterator
-TeXOnePar(Buffer const * buf,
+TeXOnePar(Buffer const & buf,
ParagraphList const & paragraphs,
ParagraphList::iterator pit,
ostream & os, TexRow & texrow,
{
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
<< everypar << "'" << endl;
- BufferParams const & bparams = buf->params;
+ BufferParams const & bparams = buf.params;
InsetOld const * in = pit->inInset();
bool further_blank_line = false;
//
// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
//
-void latexParagraphs(Buffer const * buf,
+void latexParagraphs(Buffer const & buf,
ParagraphList const & paragraphs,
ostream & os,
TexRow & texrow,
{
bool was_title = false;
bool already_title = false;
- LyXTextClass const & tclass = buf->params.getLyXTextClass();
+ LyXTextClass const & tclass = buf.params.getLyXTextClass();
ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end();
inset = new InsetSpecialChar;
else
inset = new InsetSpace;
- inset->read(&buf, lex);
+ inset->read(buf, lex);
par.insertInset(par.size(), inset, font, change);
}
} else if (token == "\\i") {
InsetOld * inset = new InsetLatexAccent;
- inset->read(&buf, lex);
+ inset->read(buf, lex);
par.insertInset(par.size(), inset, font, change);
} else if (token == "\\backslash") {
par.insertChar(par.size(), '\\', font, change);
} else if (token == "\\newline") {
InsetOld * inset = new InsetNewline;
- inset->read(&buf, lex);
+ inset->read(buf, lex);
par.insertInset(par.size(), inset, font, change);
} else if (token == "\\LyXTable") {
InsetOld * inset = new InsetTabular(buf);
- inset->read(&buf, lex);
+ inset->read(buf, lex);
par.insertInset(par.size(), inset, font, change);
} else if (token == "\\bibitem") {
InsetCommandParams p("bibitem", "dummy");
InsetBibitem * inset = new InsetBibitem(p);
- inset->read(&buf, lex);
+ inset->read(buf, lex);
par.insertInset(par.size(), inset, font, change);
} else if (token == "\\hfill") {
par.insertInset(par.size(), new InsetHFill, font, change);
ParagraphList const & plist);
-void latexParagraphs(Buffer const * buf,
+void latexParagraphs(Buffer const & buf,
ParagraphList const & paragraphs,
std::ostream & ofs,
TexRow & texrow,
}
-void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
+void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
BufferParams const & bparams,
ostream & os,
TexRow & texrow,
LyXFont const & font,
LyXLayout const & style);
///
- void simpleTeXSpecialChars(Buffer const *, BufferParams const &,
+ void simpleTeXSpecialChars(Buffer const &, BufferParams const &,
std::ostream &, TexRow & texrow,
LatexRunParams const &,
LyXFont & font, LyXFont & running_font,
y_top += paintLengthMarker(_("Space above"), parparams.spaceTop(),
yo_ + y_top);
- Buffer const * buffer = bv_.buffer();
+ Buffer const & buffer = *bv_.buffer();
LyXLayout_ptr const & layout = pit_->layout();
- if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
+ if (buffer.params.paragraph_separation == BufferParams::PARSEP_SKIP) {
if (pit_ != text_.ownerParagraphs().begin()) {
if (layout->latextype == LATEX_PARAGRAPH
&& !pit_->getDepth()) {
- y_top += buffer->params.getDefSkip().inPixels(bv_);
+ y_top += buffer.params.getDefSkip().inPixels(bv_);
} else {
LyXLayout_ptr const & playout =
boost::prior(pit_)->layout();
if (playout->latextype == LATEX_PARAGRAPH
&& !boost::prior(pit_)->getDepth()) {
// is it right to use defskip here, too? (AS)
- y_top += buffer->params.getDefSkip().inPixels(bv_);
+ y_top += buffer.params.getDefSkip().inPixels(bv_);
}
}
}
// printed in an extra row and has a pagebreak at
// the top.
if (layout->labeltype == LABEL_COUNTER_CHAPTER) {
- if (buffer->params.secnumdepth >= 0) {
+ if (buffer.params.secnumdepth >= 0) {
float spacing_val = 1.0;
if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue();
} else {
- spacing_val = buffer->params.spacing.getValue();
+ spacing_val = buffer.params.spacing.getValue();
}
int const maxdesc =
if (!parparams.spacing().isDefault()) {
spacing_val = parparams.spacing().getValue();
} else {
- spacing_val = buffer->params.spacing.getValue();
+ spacing_val = buffer.params.spacing.getValue();
}
int maxdesc =
//const_cast<LyXText&>(text).updateRowPositions();
int const yy = yf - y;
int const y2 = bv.painter().paperHeight();
-
+
ParagraphList::iterator end = text.ownerParagraphs().end();
bool active = false;
return y;
}
-
} // namespace anon
else
return max(min_size, space_size);
}
-
-
}
-LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
+LyXTabular::LyXTabular(Buffer const & buf, InsetTabular * inset, LyXLex & lex)
{
owner_ = inset;
cur_cell = -1;
}
-void LyXTabular::write(Buffer const * buf, ostream & os) const
+void LyXTabular::write(Buffer const & buf, ostream & os) const
{
// header line
os << "<lyxtabular"
}
-void LyXTabular::read(Buffer const * buf, LyXLex & lex)
+void LyXTabular::read(Buffer const & buf, LyXLex & lex)
{
string line;
istream & is = lex.getStream();
int columns_arg;
if (!getTokenValue(line, "columns", columns_arg))
return;
- init(buf->params, rows_arg, columns_arg);
+ init(buf.params, rows_arg, columns_arg);
l_getline(is, line);
if (!prefixIs(line, "<features")) {
lyxerr << "Wrong tabular format (expected <features ...> got"
}
-int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf,
+int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const & buf,
LatexRunParams const & runparams) const
{
if (!is_long_tabular)
}
-int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
+int LyXTabular::TeXRow(ostream & os, int const i, Buffer const & buf,
LatexRunParams const & runparams) const
{
int ret = 0;
ret += TeXCellPreamble(os, cell);
InsetText & inset = getCellInset(cell);
- bool rtl = inset.paragraphs.begin()->isRightToLeftPar(buf->params) &&
+ bool rtl = inset.paragraphs.begin()->isRightToLeftPar(buf.params) &&
!inset.paragraphs.begin()->empty() && getPWidth(cell).zero();
if (rtl)
}
-int LyXTabular::latex(Buffer const * buf, ostream & os,
+int LyXTabular::latex(Buffer const & buf, ostream & os,
LatexRunParams const & runparams) const
{
int ret = 0;
}
-int LyXTabular::linuxdoc(Buffer const * buf, ostream & os) const
+int LyXTabular::linuxdoc(Buffer const & buf, ostream & os) const
{
os << "<tabular ca=\"";
for (int i = 0; i < columns_; ++i) {
if (isPartOfMultiColumn(i, j))
continue;
InsetText & inset = getCellInset(cell);
-
+
ret += inset.linuxdoc(buf, os);
if (isLastCellInRow(cell)) {
}
-int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const
+int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row) const
{
int ret = 0;
int cell = getFirstCellInRow(row);
}
-int LyXTabular::docbook(Buffer const * buf, ostream & os,
+int LyXTabular::docbook(Buffer const & buf, ostream & os,
bool /*mixcont*/) const
{
int ret = 0;
}
-int LyXTabular::asciiPrintCell(Buffer const * buf, ostream & os,
+int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
int cell, int row, int column,
vector<unsigned int> const & clen,
bool onlydata) const
}
-int LyXTabular::ascii(Buffer const * buf, ostream & os, int const depth,
+int LyXTabular::ascii(Buffer const & buf, ostream & os, int const depth,
bool onlydata, unsigned char delim) const
{
int ret = 0;
InsetTabular *, LyXTabular const &);
///
explicit
- LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
+ LyXTabular(Buffer const &, InsetTabular *, LyXLex & lex);
/// Returns true if there is a topline, returns false if not
bool topLine(int cell, bool onlycolumn = false) const;
///
int numberOfCellsInRow(int cell) const;
///
- void write(Buffer const *, std::ostream &) const;
+ void write(Buffer const &, std::ostream &) const;
///
- void read(Buffer const *, LyXLex &);
+ void read(Buffer const &, LyXLex &);
///
- int latex(Buffer const *, std::ostream &,
+ int latex(Buffer const &, std::ostream &,
LatexRunParams const &) const;
//
- int linuxdoc(Buffer const * buf, std::ostream & os) const;
+ int linuxdoc(Buffer const & buf, std::ostream & os) const;
///
- int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
+ int docbook(Buffer const & buf, std::ostream & os, bool mixcont) const;
///
- int ascii(Buffer const *, std::ostream &, int const depth,
+ int ascii(Buffer const &, std::ostream &, int const depth,
bool onlydata, unsigned char delim) const;
///
bool isMultiColumn(int cell, bool real = false) const;
///
int TeXCellPostamble(std::ostream &, int cell) const;
///
- int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
+ int TeXLongtableHeaderFooter(std::ostream &, Buffer const & buf,
LatexRunParams const &) const;
///
bool isValidRow(int const row) const;
///
- int TeXRow(std::ostream &, int const row, Buffer const * buf,
+ int TeXRow(std::ostream &, int const row, Buffer const & buf,
LatexRunParams const &) const;
///
// helper function for ASCII returns number of newlines
int asciiBottomHLine(std::ostream &, int row,
std::vector<unsigned int> const &) const;
///
- int asciiPrintCell(Buffer const *, std::ostream &,
+ int asciiPrintCell(Buffer const &, std::ostream &,
int cell, int row, int column,
std::vector<unsigned int> const &,
bool onlydata) const;
/// auxiliary function for docbook
- int docbookRow(Buffer const * buf, std::ostream & os, int row) const;
+ int docbookRow(Buffer const & buf, std::ostream & os, int row) const;
};
#endif
void LyXText::computeBidiTables(ParagraphList::iterator pit,
- Buffer const * buf, RowList::iterator row) const
+ Buffer const & buf, RowList::iterator row) const
{
bidi_same_direction = true;
if (!lyxrc.rtl_support) {
pos_type stack[2];
bool const rtl_par =
- pit->isRightToLeftPar(buf->params);
+ pit->isRightToLeftPar(buf.params);
int level = 0;
bool rtl = false;
bool rtl0 = false;
!pit->isLineSeparator(lpos + 1) &&
!pit->isNewline(lpos + 1))
? lpos + 1 : lpos;
- LyXFont font = pit->getFontSettings(buf->params, pos);
+ LyXFont font = pit->getFontSettings(buf.params, pos);
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
font.number() == LyXFont::ON &&
- pit->getFontSettings(buf->params, lpos - 1).number()
+ pit->getFontSettings(buf.params, lpos - 1).number()
== LyXFont::ON) {
- font = pit->getFontSettings(buf->params, lpos);
+ font = pit->getFontSettings(buf.params, lpos);
is_space = false;
}
// This method requires a previous call to ComputeBidiTables()
-bool LyXText::isBoundary(Buffer const * buf, Paragraph const & par,
+bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
pos_type pos) const
{
if (!lyxrc.rtl_support || pos == 0)
bool const rtl = bidi_level(pos - 1) % 2;
bool const rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2
- : par.isRightToLeftPar(buf->params);
+ : par.isRightToLeftPar(buf.params);
return rtl != rtl2;
}
-bool LyXText::isBoundary(Buffer const * buf, Paragraph const & par,
+bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
pos_type pos, LyXFont const & font) const
{
if (!lyxrc.rtl_support)
bool const rtl = font.isVisibleRightToLeft();
bool const rtl2 = bidi_InRange(pos)
? bidi_level(pos) % 2
- : par.isRightToLeftPar(buf->params);
+ : par.isRightToLeftPar(buf.params);
return rtl != rtl2;
}
int LyXText::rightMargin(ParagraphList::iterator pit,
- Buffer const & buf, Row const & row) const
+ Buffer const & buf, Row const &) const
{
LyXTextClass const & tclass = buf.params.getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout();
Row const & row) const
{
// maximum pixel width of a row.
- int width = workWidth()
+ int width = workWidth()
- rightMargin(pit, *bv()->buffer(), row);
// inset->textWidth() returns -1 via workWidth(),
font = getFont(pit, i);
endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
}
- w += singleWidth(pit, i, c, font);
+ w += singleWidth(pit, i, c, font);
++i;
}
}
switch (align) {
case LYX_ALIGN_BLOCK:
- {
+ {
int const ns = numberOfSeparators(*pit, rit);
- RowList::iterator next_row = boost::next(rit);
+ RowList::iterator next_row = boost::next(rit);
if (ns
&& next_row != pit->rows.end()
- && !pit->isNewline(next_row->pos() - 1)
+ && !pit->isNewline(next_row->pos() - 1)
) {
- fill_separator = w / ns;
- } else if (is_rtl) {
+ fill_separator = w / ns;
+ } else if (is_rtl) {
x += w;
}
break;
}
}
- computeBidiTables(pit, bv()->buffer(), rit);
+ computeBidiTables(pit, *bv()->buffer(), rit);
if (is_rtl) {
pos_type body_pos = pit->beginningOfBody();
pos_type last = lastPos(*pit, rit);
int pars_width = 0;
for ( ; start != end; ++start) {
int par_width = redoParagraphInternal(start);
- pars_width = std::max(par_width, pars_width);
+ pars_width = std::max(par_width, pars_width);
}
updateRowPositions();
return pars_width;
else if (selection.start.par() != selection.end.par())
bv()->owner()->message(_("Cannot index more than one paragraph!"));
else
- idxstring = selectionAsString(bv()->buffer(), false);
+ idxstring = selectionAsString(*bv()->buffer(), false);
// Reset cursors to their original position.
cursor = reset_cursor;
// set the counter of a paragraph. This includes the labels
-void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit)
+void LyXText::setCounter(Buffer const & buf, ParagraphList::iterator pit)
{
- LyXTextClass const & textclass = buf->params.getLyXTextClass();
+ LyXTextClass const & textclass = buf.params.getLyXTextClass();
LyXLayout_ptr const & layout = pit->layout();
if (pit != ownerParagraphs().begin()) {
ostringstream s;
- if (i >= 0 && i <= buf->params.secnumdepth) {
+ if (i >= 0 && i <= buf.params.secnumdepth) {
string numbertype;
string langtype;
// Is there a label? Useful for Chapter layout
if (!pit->params().appendix()) {
- s << buf->B_(layout->labelstring());
+ s << buf.B_(layout->labelstring());
} else {
- s << buf->B_(layout->labelstring_appendix());
+ s << buf.B_(layout->labelstring_appendix());
}
// Use of an integer is here less than elegant. For now.
numbertype = "sectioning";
} else {
numbertype = "appendix";
- if (pit->isRightToLeftPar(buf->params))
+ if (pit->isRightToLeftPar(buf.params))
langtype = "hebrew";
else
langtype = "latin";
}
// In biblio should't be following counters but...
} else {
- string s = buf->B_(layout->labelstring());
+ string s = buf.B_(layout->labelstring());
// the caption hack:
if (layout->labeltype == LABEL_SENSITIVE) {
isOK = true;
break;
} else {
- Paragraph const * owner = &ownerPar(*buf, in);
+ Paragraph const * owner = &ownerPar(buf, in);
tmppit = ownerParagraphs().begin();
for ( ; tmppit != end; ++tmppit)
if (&*tmppit == owner)
textclass.counters().step(fl.type());
// Doesn't work... yet.
- s = bformat(_("%1$s #:"), buf->B_(fl.name()));
+ s = bformat(_("%1$s #:"), buf.B_(fl.name()));
} else {
// par->SetLayout(0);
// s = layout->labelstring;
pit->params().depth(maxdepth);
// setCounter can potentially change the labelString.
- setCounter(bv()->buffer(), pit);
+ setCounter(*bv()->buffer(), pit);
string const & newLabel = pit->params().labelString();
// The character will not be inserted a second time
insertChar(Paragraph::META_INSET);
// If we enter a highly editable inset the cursor should be before
- // the inset. After an Undo LyX tries to call inset->edit(...)
+ // the inset. After an Undo LyX tries to call inset->edit(...)
// and fails if the cursor is behind the inset and getInset
// does not return the inset!
if (isHighlyEditableInset(inset))
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
// calls to stuffClipboard. (Lgb)
- bv()->stuffClipboard(selectionAsString(bv()->buffer(), true));
+ bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true));
// This doesn't make sense, if there is no selection
if (!selection.set())
void LyXText::copySelection()
{
// stuff the selection onto the X clipboard, from an explicit copy request
- bv()->stuffClipboard(selectionAsString(bv()->buffer(), true));
+ bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true));
// this doesnt make sense, if there is no selection
if (!selection.set())
RowList::iterator row = getRow(pit, pos);
int y = row->y();
-
+
RowList::iterator old_row = row;
// if we are before the first char of this row and are still in the
// same paragraph and there is a previous row then put the cursor on
real_current_font = getFont(pit, pos);
if (cursor.pos() == pit->size() &&
- isBoundary(bv()->buffer(), *pit, cursor.pos()) &&
+ isBoundary(*bv()->buffer(), *pit, cursor.pos()) &&
!cursor.boundary()) {
Language const * lang =
pit->getParLanguage(bv()->buffer()->params);
bool const rtl = (bidi_level(c) % 2 == 1);
if (left_side == rtl) {
++c;
- boundary = isBoundary(bv()->buffer(), *pit, c);
+ boundary = isBoundary(*bv()->buffer(), *pit, c);
}
}
bool boundary = cursor.boundary();
setCursor(cursor.par(), cursor.pos() - 1, true, false);
if (!internal && !boundary &&
- isBoundary(bv()->buffer(), *cursor.par(), cursor.pos() + 1))
+ isBoundary(*bv()->buffer(), *cursor.par(), cursor.pos() + 1))
setCursor(cursor.par(), cursor.pos() + 1, true, true);
} else if (cursor.par() != ownerParagraphs().begin()) {
// steps into the paragraph above
else if (!at_end) {
setCursor(cursor.par(), cursor.pos() + 1, true, false);
if (!internal &&
- isBoundary(bv()->buffer(), *cursor.par(), cursor.pos()))
+ isBoundary(*bv()->buffer(), *cursor.par(), cursor.pos()))
setCursor(cursor.par(), cursor.pos(), true, true);
} else if (boost::next(cursor.par()) != ownerParagraphs().end())
setCursor(boost::next(cursor.par()), 0);
ParagraphList::iterator endpit = boost::next(old_cursor.par());
while (endpit != ownerParagraphs().end() && endpit->getDepth())
++endpit;
-
+
recordUndo(bv(), Undo::DELETE, old_cursor.par(), boost::prior(endpit));
cursor = tmpcursor;
}
ParagraphList::iterator pit = cursor.par();
- nextRow(pit, rit);
+ nextRow(pit, rit);
LyXCursor cur;
setCursor(cur, pit, rit->pos(), false);
if (cur.y() < bv_owner->top_y() + bv()->workHeight())
}
-string const TextCursor::selectionAsString(Buffer const * buffer,
+string const TextCursor::selectionAsString(Buffer const & buffer,
bool label) const
{
if (!selection.set())
it should not be absolutely needed to move the cursor...
[even later]
Nevertheless, it should still be moved, in order to keep classes
- and interdependencies small.
+ and interdependencies small.
*/
// The structure that keeps track of the selections set.
///
void clearSelection();
///
- string const selectionAsString(Buffer const * buffer, bool label) const;
+ string const selectionAsString(Buffer const & buffer, bool label) const;
// actual cursor position
LyXCursor cursor;
}
-TocList const getTocList(Buffer const * buf)
+TocList const getTocList(Buffer const & buf)
{
TocList toclist;
- if (!buf)
- return toclist;
- LyXTextClass const & textclass = buf->params.getLyXTextClass();
+ LyXTextClass const & textclass = buf.params.getLyXTextClass();
- ParConstIterator pit = buf->par_iterator_begin();
- ParConstIterator end = buf->par_iterator_end();
+ ParConstIterator pit = buf.par_iterator_begin();
+ ParConstIterator end = buf.par_iterator_end();
for (; pit != end; ++pit) {
#ifdef WITH_WARNINGS
#warning bogus type (Lgb)
char const labeltype = pit->layout()->labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER
- && labeltype <= LABEL_COUNTER_CHAPTER + buf->params.tocdepth) {
+ && labeltype <= LABEL_COUNTER_CHAPTER + buf.params.tocdepth) {
// insert this into the table of contents
const int depth = max(0, labeltype - textclass.maxcounter());
TocItem const item(pit->id(), depth,
}
-vector<string> const getTypes(Buffer const * buffer)
+vector<string> const getTypes(Buffer const & buffer)
{
vector<string> types;
}
-void asciiTocList(string const & type, Buffer const * buffer, ostream & os)
+void asciiTocList(string const & type, Buffer const & buffer, ostream & os)
{
TocList const toc_list = getTocList(buffer);
TocList::const_iterator cit = toc_list.find(type);
typedef std::map<string, Toc> TocList;
///
-TocList const getTocList(Buffer const *);
+TocList const getTocList(Buffer const &);
///
-std::vector<string> const getTypes(Buffer const *);
+std::vector<string> const getTypes(Buffer const &);
///
-void asciiTocList(string const &, Buffer const *, std::ostream &);
+void asciiTocList(string const &, Buffer const &, std::ostream &);
/** Given the cmdName of the TOC param, returns the type used
by ControlToc::getContents() */