From b881ed2d5a4d26b062556d6d417c8f4624741878 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 28 Aug 2003 07:41:31 +0000 Subject: [PATCH] Use Buffer const reference in most placees possible. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7623 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/POTFILES.in | 1 + src/BufferView.C | 2 +- src/BufferView.h | 6 +- src/BufferView_pimpl.C | 10 +-- src/ChangeLog | 22 +++--- src/CutAndPaste.C | 2 +- src/MenuBackend.C | 10 +-- src/buffer.C | 14 ++-- src/bufferlist.C | 2 +- src/bufferview_funcs.C | 4 +- src/converter.C | 50 ++++++------- src/converter.h | 4 +- src/exporter.C | 14 ++-- src/exporter.h | 4 +- src/factory.C | 10 +-- src/format.C | 9 +-- src/format.h | 2 +- src/frontends/controllers/ChangeLog | 11 ++- src/frontends/controllers/ControlChanges.C | 2 +- src/frontends/controllers/ControlCharacter.C | 2 +- src/frontends/controllers/ControlCitation.C | 6 +- .../controllers/ControlConnections.C | 4 +- .../controllers/ControlConnections.h | 2 +- src/frontends/controllers/ControlErrorList.C | 6 +- src/frontends/controllers/ControlExternal.C | 6 +- src/frontends/controllers/ControlGraphics.C | 4 +- src/frontends/controllers/ControlLog.C | 2 +- src/frontends/controllers/ControlRef.C | 8 +- src/frontends/controllers/ControlSendto.C | 10 ++- .../controllers/ControlSpellchecker.C | 1 - src/frontends/controllers/ControlTabular.C | 6 +- src/frontends/controllers/ControlVCLog.C | 4 +- src/frontends/controllers/Kernel.C | 25 ++++--- src/frontends/controllers/Kernel.h | 4 +- src/frontends/screen.C | 8 +- src/graphics/PreviewLoader.C | 4 +- src/graphics/PreviewedInset.C | 6 +- src/graphics/Previews.C | 19 ++--- src/graphics/Previews.h | 4 +- src/insets/ChangeLog | 6 +- src/insets/inset.h | 12 +-- src/insets/insetbibitem.C | 12 +-- src/insets/insetbibitem.h | 6 +- src/insets/insetbibtex.C | 21 +++--- src/insets/insetbibtex.h | 6 +- src/insets/insetbranch.C | 27 ++++--- src/insets/insetbranch.h | 46 ++++++------ src/insets/insetcaption.C | 10 +-- src/insets/insetcaption.h | 10 +-- src/insets/insetcite.C | 46 ++++++------ src/insets/insetcite.h | 12 +-- src/insets/insetcollapsable.C | 12 +-- src/insets/insetcollapsable.h | 12 +-- src/insets/insetcommand.C | 10 +-- src/insets/insetcommand.h | 14 ++-- src/insets/insetenv.C | 6 +- src/insets/insetenv.h | 6 +- src/insets/insetert.C | 14 ++-- src/insets/insetert.h | 12 +-- src/insets/insetexternal.C | 75 +++++++++---------- src/insets/insetexternal.h | 18 ++--- src/insets/insetfloat.C | 24 +++--- src/insets/insetfloat.h | 12 +-- src/insets/insetfloatlist.C | 16 ++-- src/insets/insetfloatlist.h | 14 ++-- src/insets/insetfoot.C | 8 +- src/insets/insetfoot.h | 4 +- src/insets/insetfootlike.C | 4 +- src/insets/insetfootlike.h | 2 +- src/insets/insetgraphics.C | 32 ++++---- src/insets/insetgraphics.h | 14 ++-- src/insets/insethfill.C | 10 +-- src/insets/insethfill.h | 12 +-- src/insets/insetinclude.C | 65 +++++++++------- src/insets/insetinclude.h | 22 ++++-- src/insets/insetindex.C | 6 +- src/insets/insetindex.h | 6 +- src/insets/insetlabel.C | 8 +- src/insets/insetlabel.h | 10 +-- src/insets/insetlatexaccent.C | 12 +-- src/insets/insetlatexaccent.h | 12 +-- src/insets/insetlist.h | 4 +- src/insets/insetmarginal.C | 2 +- src/insets/insetmarginal.h | 2 +- src/insets/insetminipage.C | 6 +- src/insets/insetminipage.h | 6 +- src/insets/insetnewline.C | 12 +-- src/insets/insetnewline.h | 12 +-- src/insets/insetnote.C | 12 +-- src/insets/insetnote.h | 12 +-- src/insets/insetoptarg.C | 6 +- src/insets/insetoptarg.h | 6 +- src/insets/insetquotes.C | 16 ++-- src/insets/insetquotes.h | 12 +-- src/insets/insetref.C | 10 +-- src/insets/insetref.h | 10 +-- src/insets/insetspace.C | 12 +-- src/insets/insetspace.h | 12 +-- src/insets/insetspecialchar.C | 12 +-- src/insets/insetspecialchar.h | 12 +-- src/insets/insettabular.C | 33 ++++---- src/insets/insettabular.h | 14 ++-- src/insets/insettext.C | 36 ++++----- src/insets/insettext.h | 16 ++-- src/insets/insettheorem.h | 4 +- src/insets/insettoc.C | 8 +- src/insets/insettoc.h | 8 +- src/insets/inseturl.C | 10 +-- src/insets/inseturl.h | 10 +-- src/insets/insetwrap.C | 12 +-- src/insets/insetwrap.h | 10 +-- src/lyx_cb.C | 2 +- src/lyxfind.C | 4 +- src/lyxfunc.C | 7 +- src/lyxtext.h | 12 +-- src/mathed/ChangeLog | 4 + src/mathed/formula.C | 12 +-- src/mathed/formula.h | 12 +-- src/mathed/formulabase.C | 2 +- src/mathed/formulamacro.C | 12 +-- src/mathed/formulamacro.h | 12 +-- src/paragraph.C | 10 +-- src/paragraph.h | 8 +- src/paragraph_funcs.C | 30 ++++---- src/paragraph_funcs.h | 2 +- src/paragraph_pimpl.C | 2 +- src/paragraph_pimpl.h | 2 +- src/rowpainter.C | 19 ++--- src/tabular.C | 28 +++---- src/tabular.h | 22 +++--- src/text.C | 36 ++++----- src/text2.C | 42 +++++------ src/text3.C | 2 +- src/textcursor.C | 2 +- src/textcursor.h | 4 +- src/toc.C | 16 ++-- src/toc.h | 6 +- 137 files changed, 824 insertions(+), 819 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 4942f1d64f..8e758eff0c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -183,6 +183,7 @@ src/mathed/ref_inset.C src/paragraph.C src/paragraph_funcs.C src/rowpainter.C +src/support/path_defines.C src/text.C src/text2.C src/text3.C diff --git a/src/BufferView.C b/src/BufferView.C index 7c84ad5481..9524b2740e 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -456,7 +456,7 @@ void BufferView::replaceWord(string const & replacestring) 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 diff --git a/src/BufferView.h b/src/BufferView.h index e9294d9423..029c139c38 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -66,10 +66,10 @@ public: /// 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(); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 59716a1171..e7c10f33fd 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -306,7 +306,7 @@ void BufferView::Pimpl::buffer(Buffer * b) buffer_ = b; top_y_ = 0; - + // if we're quitting lyx, don't bother updating stuff if (quitting) return; @@ -590,7 +590,7 @@ void BufferView::Pimpl::selectionRequested() 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); @@ -988,7 +988,7 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & ev) screen().hideCursor(); bool const res = dispatch(ev); - + // see workAreaKeyPress cursor_timeout.restart(); screen().showCursor(*bv_); @@ -1259,14 +1259,14 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) 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_) ? } } diff --git a/src/ChangeLog b/src/ChangeLog index f7be9a0d7c..aee38a72a1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-08-28 Lars Gullik Bjønnes + + * most files: change to use const Buffer refs + 2003-08-27 André Pönitz * BufferView.[Ch]: remove getParentText, implement getParentLanguage @@ -17,14 +21,14 @@ * 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 * BufferView.[Ch]: * BufferView_pimpl.[Ch] (updateInset): add an InsetOld * argument - + 2003-08-26 André Pönitz * paragraph_func.[Ch] (outerPar): new function @@ -36,7 +40,7 @@ * text2.C: remove Inset::par_owner 2003-08-25 Martin Vermeer - + * lyxrow_funcs.C: * lyxtext.h: * text.C: @@ -45,8 +49,8 @@ 2003-08-25 Alfredo Braunstein - * 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 @@ -61,7 +65,7 @@ * lyxrow.[Ch]: add x_ and *fill_ members - * lyxtext.h: + * lyxtext.h: * text.C: * rowpainter.C: * text2.C: adjust/remove prepareToPrint() calls @@ -100,7 +104,7 @@ * MenuBackend.C: fix branchlist related crash -2003-08-17 Martin Vermeer +2003-08-17 Martin Vermeer * BranchList.[Ch]: * InsetList.[Ch]: @@ -128,7 +132,7 @@ 2003-08-15 Kayvan A. Sylvan * BufferView_pimpl.C: compile fix - + 2003-08-15 André Pönitz * rowpainter.C: remove extra metrics calls @@ -213,7 +217,7 @@ 2003-08-05 Alfredo Braunstein - * 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 diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index ff2bea62ab..627067bcee 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -68,7 +68,7 @@ CutAndPaste::availableSelections(Buffer const & buffer) 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; diff --git a/src/MenuBackend.C b/src/MenuBackend.C index d5c1214887..ef780bbc7a 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -440,15 +440,15 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, LyXView const * view) 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()); @@ -594,7 +594,7 @@ void expandToc(Menu & tomenu, LyXView const * view) 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) { @@ -658,7 +658,7 @@ void expandBranches(Menu & tomenu, LyXView const * view) std::list::const_iterator cit = params.branchlist.begin(); std::list::const_iterator end = params.branchlist.end(); - + for (int ii = 1; cit != end; ++cit, ++ii) { string label = cit->getBranch(); int const action = lyxaction. diff --git a/src/buffer.C b/src/buffer.C index 60ec4d88c6..7649cb69ec 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -169,7 +169,7 @@ Buffer::~Buffer() paragraphs.clear(); // Remove any previewed LaTeX snippets associated with this buffer. - lyx::graphics::Previews::get().removeLoader(this); + lyx::graphics::Previews::get().removeLoader(*this); } @@ -697,7 +697,7 @@ bool Buffer::do_writeFile(ostream & ofs) const 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; @@ -873,7 +873,7 @@ string const Buffer::asciiParagraph(Paragraph const & par, 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; } @@ -1036,7 +1036,7 @@ void Buffer::makeLaTeXFile(ostream & os, 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; @@ -1485,7 +1485,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os, if (c == Paragraph::META_INSET) { InsetOld * inset = par->getInset(i); - inset->linuxdoc(this, os); + inset->linuxdoc(*this, os); font_old = font; continue; } @@ -1855,7 +1855,7 @@ void Buffer::simpleDocBookOnePar(ostream & os, 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 << " > & keys) con for (inset_iterator it = inset_const_iterator_begin(); it != inset_const_iterator_end(); ++it) { if (it->lyxCode() == InsetOld::BIBTEX_CODE) - static_cast(*it).fillWithBibKeys(this, keys); + static_cast(*it).fillWithBibKeys(*this, keys); else if (it->lyxCode() == InsetOld::INCLUDE_CODE) static_cast(*it).fillWithBibKeys(keys); else if (it->lyxCode() == InsetOld::BIBITEM_CODE) { diff --git a/src/bufferlist.C b/src/bufferlist.C index 0f597d6a1a..de6b49f5bc 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -319,7 +319,7 @@ bool BufferList::exists(string const & s) const bool BufferList::isLoaded(Buffer const * b) const { Assert(b); - + BufferStorage::const_iterator cit = find(bstore.begin(), bstore.end(), b); return cit != bstore.end(); diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 4d0b6e8760..1742f69441 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -390,10 +390,10 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall) 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()); diff --git a/src/converter.C b/src/converter.C index 1ccbbccfec..f5a6c8ffde 100644 --- a/src/converter.C +++ b/src/converter.C @@ -126,7 +126,7 @@ bool operator<(Converter const & a, Converter const & b) 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; @@ -317,7 +317,7 @@ bool Converters::convert(Buffer const * buffer, 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 @@ -325,7 +325,7 @@ bool Converters::convert(Buffer const * buffer, 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) @@ -350,13 +350,13 @@ bool Converters::convert(Buffer const * buffer, 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 @@ -379,7 +379,7 @@ bool Converters::convert(Buffer const * buffer, " < " + QuoteName(infile2 + ".out") + " > " + QuoteName(logfile); one.startscript(Systemcall::Wait, command2); - if (!scanLog(buffer, command, logfile)) + if (!scanLog(*buffer, command, logfile)) return false; } @@ -484,12 +484,9 @@ bool Converters::formatIsUsed(string const & format) } -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, ""); @@ -497,7 +494,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & /*command*/, int result = latex.scanLogFile(terr); if (result & LaTeX::ERRORS) - bufferErrors(*buffer, terr); + bufferErrors(buffer, terr); return true; } @@ -506,37 +503,34 @@ namespace { 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)) { @@ -549,8 +543,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command, _("An empty output file was generated.")); } - - buffer->busy(false); + + buffer.busy(false); int const ERROR_MASK = LaTeX::NO_LOGFILE | diff --git a/src/converter.h b/src/converter.h index 7b3202a555..943e03e9a3 100644 --- a/src/converter.h +++ b/src/converter.h @@ -126,10 +126,10 @@ private: std::vector const Converters::intToFormat(std::vector 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_; diff --git a/src/exporter.C b/src/exporter.C index 5f81ff01a3..2f3ee40683 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -36,11 +36,11 @@ using std::find; namespace { -vector const Backends(Buffer const * buffer) +vector const Backends(Buffer const & buffer) { vector 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; } @@ -54,7 +54,7 @@ bool Exporter::Export(Buffer * buffer, string const & format, string backend_format; LatexRunParams runparams; runparams.flavor = LatexRunParams::LATEX; - vector backends = Backends(buffer); + vector backends = Backends(*buffer); if (find(backends.begin(), backends.end(), format) == backends.end()) { for (vector::const_iterator it = backends.begin(); it != backends.end(); ++it) { @@ -133,11 +133,11 @@ bool Exporter::Preview(Buffer * buffer, string const & format) 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 backends = Backends(buffer); for (vector::const_iterator it = backends.begin(); @@ -149,7 +149,7 @@ bool Exporter::IsExportable(Buffer const * buffer, string const & format) vector const -Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable) +Exporter::GetExportableFormats(Buffer const & buffer, bool only_viewable) { vector backends = Backends(buffer); vector result = diff --git a/src/exporter.h b/src/exporter.h index 64db46612a..629d7f473f 100644 --- a/src/exporter.h +++ b/src/exporter.h @@ -34,11 +34,11 @@ public: 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 const - GetExportableFormats(Buffer const * buffer, bool only_viewable); + GetExportableFormats(Buffer const & buffer, bool only_viewable); /// }; #endif diff --git a/src/factory.C b/src/factory.C index 617ccc7d91..18bbb04dc2 100644 --- a/src/factory.C +++ b/src/factory.C @@ -199,7 +199,7 @@ InsetOld * createInset(FuncRequest const & cmd) 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") { @@ -210,10 +210,10 @@ InsetOld * createInset(FuncRequest const & cmd) 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; @@ -367,7 +367,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf) || 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); @@ -411,7 +411,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf) } if (inset) - inset->read(&buf, lex); + inset->read(buf, lex); } return inset; diff --git a/src/format.C b/src/format.C index 869bfb4d52..d69d4ecb12 100644 --- a/src/format.C +++ b/src/format.C @@ -150,7 +150,7 @@ void Formats::setViewer(string const & name, string const & command) } -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()) @@ -174,12 +174,11 @@ bool Formats::view(Buffer const * buffer, string const & filename, 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'; } @@ -191,7 +190,7 @@ bool Formats::view(Buffer const * buffer, string const & filename, 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; diff --git a/src/format.h b/src/format.h index c4ca8f4095..f95224bab4 100644 --- a/src/format.h +++ b/src/format.h @@ -96,7 +96,7 @@ public: /// 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; diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index fe38f3ed82..3d20043222 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,11 +1,14 @@ +2003-08-28 Lars Gullik Bjønnes -2003-08-16 Martin Vermeer + * most files: change to use const buffer refs. + +2003-08-16 Martin Vermeer * 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 @@ -38,7 +41,7 @@ 2003-07-30 Martin Vermeer * ControlNote.[Ch]: add i18n support. - + 2003-07-27 Lars Gullik Bjønnes * ControlToc.C (goTo): adjust for lyx::toc diff --git a/src/frontends/controllers/ControlChanges.C b/src/frontends/controllers/ControlChanges.C index 7b98845111..5690ad30ae 100644 --- a/src/frontends/controllers/ControlChanges.C +++ b/src/frontends/controllers/ControlChanges.C @@ -49,7 +49,7 @@ string const ControlChanges::getChangeAuthor() 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()); diff --git a/src/frontends/controllers/ControlCharacter.C b/src/frontends/controllers/ControlCharacter.C index 2d180a9b4f..718d67d0b7 100644 --- a/src/frontends/controllers/ControlCharacter.C +++ b/src/frontends/controllers/ControlCharacter.C @@ -218,7 +218,7 @@ void ControlCharacter::setLanguage(string const & val) 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)); diff --git a/src/frontends/controllers/ControlCitation.C b/src/frontends/controllers/ControlCitation.C index c7710ae69f..9a741df9a3 100644 --- a/src/frontends/controllers/ControlCitation.C +++ b/src/frontends/controllers/ControlCitation.C @@ -32,7 +32,7 @@ bool ControlCitation::initialiseParams(string const & data) ControlCommand::initialiseParams(data); vector > blist; - kernel().buffer()->fillWithBibKeys(blist); + kernel().buffer().fillWithBibKeys(blist); typedef std::map::value_type InfoMapValue; @@ -70,7 +70,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const bool ControlCitation::usingNatbib() const { - return kernel().buffer()->params.use_natbib; + return kernel().buffer().params.use_natbib; } @@ -81,7 +81,7 @@ vector const ControlCitation::getCiteStrings(string const & key) const vector 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); diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index 1f46435779..322de9263c 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -84,9 +84,9 @@ Buffer * ControlConnectBase::buffer() } -Buffer const * ControlConnectBase::buffer() const +Buffer const & ControlConnectBase::buffer() const { - return lv_.buffer(); + return *lv_.buffer(); } diff --git a/src/frontends/controllers/ControlConnections.h b/src/frontends/controllers/ControlConnections.h index c763167aa0..b37ff9c7e3 100644 --- a/src/frontends/controllers/ControlConnections.h +++ b/src/frontends/controllers/ControlConnections.h @@ -85,7 +85,7 @@ protected: /// a wrapper for LyXView::buffer() Buffer * buffer(); /// - Buffer const * buffer() const; + Buffer const & buffer() const; /// a wrapper for LyXView::getLyXFunc() LyXFunc & lyxfunc(); /// diff --git a/src/frontends/controllers/ControlErrorList.C b/src/frontends/controllers/ControlErrorList.C index 044f610467..a4eee56d3b 100644 --- a/src/frontends/controllers/ControlErrorList.C +++ b/src/frontends/controllers/ControlErrorList.C @@ -59,10 +59,10 @@ void ControlErrorList::goTo(int item) 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; } diff --git a/src/frontends/controllers/ControlExternal.C b/src/frontends/controllers/ControlExternal.C index 42ea2b049b..5097b18d25 100644 --- a/src/frontends/controllers/ControlExternal.C +++ b/src/frontends/controllers/ControlExternal.C @@ -36,7 +36,7 @@ ControlExternal::ControlExternal(Dialog & parent) 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; } @@ -50,7 +50,7 @@ void ControlExternal::clearParams() void ControlExternal::dispatchParams() { string const lfun = InsetExternalMailer::params2string(params(), - *kernel().buffer()); + kernel().buffer()); kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun)); } @@ -75,7 +75,7 @@ void ControlExternal::editExternal() dialog().view().apply(); string const lfun = - InsetExternalMailer::params2string(params(), *kernel().buffer()); + InsetExternalMailer::params2string(params(), kernel().buffer()); kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun)); } diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index 8abe31dae2..4133c5b958 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -47,7 +47,7 @@ ControlGraphics::ControlGraphics(Dialog & parent) 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; } @@ -63,7 +63,7 @@ void ControlGraphics::dispatchParams() { 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)); } diff --git a/src/frontends/controllers/ControlLog.C b/src/frontends/controllers/ControlLog.C index d4e69aba59..1c4a590c9f 100644 --- a/src/frontends/controllers/ControlLog.C +++ b/src/frontends/controllers/ControlLog.C @@ -21,7 +21,7 @@ ControlLog::ControlLog(Dialog & parent) bool ControlLog::initialiseParams(string const &) { - logfile_ = kernel().buffer()->getLogName(); + logfile_ = kernel().buffer().getLogName(); return true; } diff --git a/src/frontends/controllers/ControlRef.C b/src/frontends/controllers/ControlRef.C index 2cb096f723..23c57b569a 100644 --- a/src/frontends/controllers/ControlRef.C +++ b/src/frontends/controllers/ControlRef.C @@ -33,11 +33,9 @@ ControlRef::ControlRef(Dialog & d) vector 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 list; - buf->getLabelList(list); + buf.getLabelList(list); return list; } @@ -70,7 +68,7 @@ vector const ControlRef::getBufferList() const int ControlRef::getBufferNum() const { vector buffers = bufferlist.getFileNames(); - string const name = kernel().buffer()->fileName(); + string const name = kernel().buffer().fileName(); vector::const_iterator cit = find(buffers.begin(), buffers.end(), name); if (cit == buffers.end()) diff --git a/src/frontends/controllers/ControlSendto.C b/src/frontends/controllers/ControlSendto.C index e5874c056d..f39e2ab04e 100644 --- a/src/frontends/controllers/ControlSendto.C +++ b/src/frontends/controllers/ControlSendto.C @@ -43,13 +43,15 @@ vector const ControlSendto::allFormats() const 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 diff --git a/src/frontends/controllers/ControlSpellchecker.C b/src/frontends/controllers/ControlSpellchecker.C index e8802c35f6..eee37433f1 100644 --- a/src/frontends/controllers/ControlSpellchecker.C +++ b/src/frontends/controllers/ControlSpellchecker.C @@ -148,7 +148,6 @@ void ControlSpellchecker::check() SpellBase::Result res = SpellBase::OK; // clear any old selection - LyXText * text = bufferview()->getLyXText(); bufferview()->update(); while (res == SpellBase::OK || res == SpellBase::IGNORE) { diff --git a/src/frontends/controllers/ControlTabular.C b/src/frontends/controllers/ControlTabular.C index 1f33daa09f..253a2ce583 100644 --- a/src/frontends/controllers/ControlTabular.C +++ b/src/frontends/controllers/ControlTabular.C @@ -26,11 +26,9 @@ ControlTabular::ControlTabular(Dialog & parent) 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)); diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C index d5ed84deae..0964e7b20f 100644 --- a/src/frontends/controllers/ControlVCLog.C +++ b/src/frontends/controllers/ControlVCLog.C @@ -30,13 +30,13 @@ ControlVCLog::ControlVCLog(Dialog & parent) 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()); diff --git a/src/frontends/controllers/Kernel.C b/src/frontends/controllers/Kernel.C index 5a1d6b20bb..ee39718eaa 100644 --- a/src/frontends/controllers/Kernel.C +++ b/src/frontends/controllers/Kernel.C @@ -19,6 +19,10 @@ #include "frontends/Dialogs.h" #include "frontends/LyXView.h" +#include "support/LAssert.h" + +using lyx::support::Assert; + Kernel::Kernel(LyXView & lyxview) : lyxview_(lyxview) {} @@ -59,19 +63,16 @@ bool Kernel::isBufferReadonly() const 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; @@ -90,13 +91,15 @@ BufferView const * Kernel::bufferview() const } -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(); } diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h index 45b2c4964a..9e35603ef2 100644 --- a/src/frontends/controllers/Kernel.h +++ b/src/frontends/controllers/Kernel.h @@ -88,8 +88,8 @@ public: 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; diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 8134d61ea2..66826c0d18 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -224,14 +224,14 @@ void LyXScreen::toggleCursor(BufferView & bv) } -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) @@ -252,7 +252,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text) 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(); diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 772a9abaf1..2e96ca3f43 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -579,7 +579,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const // 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); @@ -596,7 +596,7 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const 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 diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index 47ac36ae6f..5274123487 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -51,7 +51,7 @@ void PreviewedInset::generatePreview() return; Previews & previews = Previews::get(); - PreviewLoader & loader = previews.loader(view()->buffer()); + PreviewLoader & loader = previews.loader(*view()->buffer()); addPreview(loader); if (!snippet_.empty()) loader.startLoading(); @@ -89,7 +89,7 @@ void PreviewedInset::removePreview() return; Previews & previews = Previews::get(); - PreviewLoader & loader = previews.loader(view()->buffer()); + PreviewLoader & loader = previews.loader(*view()->buffer()); loader.remove(snippet_); snippet_.erase(); pimage_ = 0; @@ -104,7 +104,7 @@ bool PreviewedInset::previewReady() const if (!pimage_ || snippet_ != pimage_->snippet()) { PreviewLoader & ploader = - Previews::get().loader(view()->buffer()); + Previews::get().loader(*view()->buffer()); pimage_ = ploader.preview(snippet_); } diff --git a/src/graphics/Previews.C b/src/graphics/Previews.C index b5ec0f4bd7..0cbd21b398 100644 --- a/src/graphics/Previews.C +++ b/src/graphics/Previews.C @@ -60,15 +60,13 @@ Previews::~Previews() {} -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(); } @@ -76,12 +74,9 @@ PreviewLoader & Previews::loader(Buffer const * buffer) const } -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); @@ -90,7 +85,7 @@ void Previews::removeLoader(Buffer const * buffer) const 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(); diff --git a/src/graphics/Previews.h b/src/graphics/Previews.h index 9c454d1e5d..630b49f814 100644 --- a/src/graphics/Previews.h +++ b/src/graphics/Previews.h @@ -39,12 +39,12 @@ public: * 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 diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 4b3d230a1e..0a7cf3e439 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-08-28 Lars Gullik Bjønnes + + * most files: change to use const Buffer refs + 2003-08-26 Martin Vermeer * insetfootlike.C: whitespace. @@ -48,7 +52,7 @@ * insetref.C: require amsmath for eqref -2003-08-17 Martin Vermeer +2003-08-17 Martin Vermeer * Makefile.am: * inset.h: diff --git a/src/insets/inset.h b/src/insets/inset.h index 414c78b22e..4ccb05d740 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -178,19 +178,19 @@ public: /// 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; } diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index ff10c841a7..a9d5fde47f 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -87,7 +87,7 @@ void InsetBibitem::setCounter(int c) // 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()) @@ -98,7 +98,7 @@ void InsetBibitem::write(Buffer const *, std::ostream & os) const // 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()); @@ -119,7 +119,7 @@ string const InsetBibitem::getBibLabel() const } -string const InsetBibitem::getScreenLabel(Buffer const *) const +string const InsetBibitem::getScreenLabel(Buffer const &) const { return getContents() + " [" + getBibLabel() + ']'; } @@ -146,7 +146,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const &) // 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) @@ -154,8 +154,8 @@ string const bibitemWidest(Buffer const * buffer) 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()) { diff --git a/src/insets/insetbibitem.h b/src/insets/insetbibitem.h index d0f0b4f2dc..c2d5797ab6 100644 --- a/src/insets/insetbibitem.h +++ b/src/insets/insetbibitem.h @@ -35,11 +35,11 @@ public: /** 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; } /// diff --git a/src/insets/insetbibtex.C b/src/insets/insetbibtex.C index 8603d09d38..80d2cd832c 100644 --- a/src/insets/insetbibtex.C +++ b/src/insets/insetbibtex.C @@ -92,13 +92,13 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd) } -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 @@ -120,8 +120,8 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, } 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...{} @@ -134,9 +134,9 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, // 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 { @@ -160,8 +160,8 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, 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,','); @@ -198,11 +198,10 @@ vector const InsetBibtex::getFiles(Buffer const & buffer) const // This method returns a comma separated list of Bibtex entries -void InsetBibtex::fillWithBibKeys(Buffer const * buffer, +void InsetBibtex::fillWithBibKeys(Buffer const & buffer, std::vector > & keys) const { - Assert(buffer); - vector const files = getFiles(*buffer); + vector const files = getFiles(buffer); for (vector::const_iterator it = files.begin(); it != files.end(); ++ it) { // This is a _very_ simple parser for Bibtex database diff --git a/src/insets/insetbibtex.h b/src/insets/insetbibtex.h index c5ac7ba795..9911bf48a5 100644 --- a/src/insets/insetbibtex.h +++ b/src/insets/insetbibtex.h @@ -33,16 +33,16 @@ public: /// 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 > & keys) const; /// std::vector const getFiles(Buffer const &) const; diff --git a/src/insets/insetbranch.C b/src/insets/insetbranch.C index c059cea72e..655d3694c0 100644 --- a/src/insets/insetbranch.C +++ b/src/insets/insetbranch.C @@ -73,14 +73,14 @@ string const InsetBranch::editMessage() 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(); @@ -129,7 +129,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd) 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: @@ -148,35 +148,35 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd) -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); } @@ -260,4 +260,3 @@ void InsetBranchParams::read(LyXLex & lex) branch = lex.getString(); } } - diff --git a/src/insets/insetbranch.h b/src/insets/insetbranch.h index 6b0526d62a..dc42e85a48 100644 --- a/src/insets/insetbranch.h +++ b/src/insets/insetbranch.h @@ -17,17 +17,17 @@ #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. */ @@ -35,44 +35,44 @@ class InsetBranch : public InsetCollapsable { 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 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; diff --git a/src/insets/insetcaption.C b/src/insets/insetcaption.C index 81466a5f41..3bc71ac4d7 100644 --- a/src/insets/insetcaption.C +++ b/src/insets/insetcaption.C @@ -41,14 +41,14 @@ InsetCaption::InsetCaption(BufferParams const & bp) } -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 @@ -104,7 +104,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const } -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 @@ -119,7 +119,7 @@ int InsetCaption::latex(Buffer const * buf, ostream & os, } -int InsetCaption::ascii(Buffer const * /*buf*/, +int InsetCaption::ascii(Buffer const & /*buf*/, ostream & /*os*/, int /*linelen*/) const { // FIX: Implement me! @@ -127,7 +127,7 @@ int InsetCaption::ascii(Buffer const * /*buf*/, } -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 << ""; diff --git a/src/insets/insetcaption.h b/src/insets/insetcaption.h index c62e20ec5b..eecdf464ff 100644 --- a/src/insets/insetcaption.h +++ b/src/insets/insetcaption.h @@ -22,9 +22,9 @@ public: /// 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; /// @@ -34,12 +34,12 @@ public: /// 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; }; diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 4c687d9e2e..d0cf1c7f48 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -36,7 +36,7 @@ namespace { // 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) @@ -46,13 +46,13 @@ string const getNatbibLabel(Buffer const * buffer, // 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(); } @@ -60,7 +60,7 @@ string const getNatbibLabel(Buffer const * buffer, // 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(); @@ -72,10 +72,10 @@ string const getNatbibLabel(Buffer const * buffer, 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) @@ -240,13 +240,13 @@ InsetCitation::~InsetCitation() } -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. @@ -254,14 +254,14 @@ string const InsetCitation::generateLabel(Buffer const * buffer) const // 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 @@ -273,12 +273,12 @@ string const InsetCitation::generateLabel(Buffer const * buffer) const } -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; @@ -289,7 +289,7 @@ InsetCitation::Cache::Style InsetCitation::getStyle(Buffer const * buffer) const } -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) @@ -318,10 +318,10 @@ string const InsetCitation::getScreenLabel(Buffer const * buffer) const } -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; } @@ -331,7 +331,7 @@ dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd) 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; @@ -341,7 +341,7 @@ dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd) } -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; @@ -355,11 +355,11 @@ int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const // 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"; @@ -373,7 +373,7 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os, 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 << ']'; diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 21a568c83a..a38e133f62 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -29,15 +29,15 @@ public: 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); @@ -47,7 +47,7 @@ public: 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 { /// @@ -72,9 +72,9 @@ private: }; /// 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; diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index f8a4d2fcd5..2ea0f2f908 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -84,14 +84,14 @@ bool InsetCollapsable::insertInset(BufferView * bv, InsetOld * in) } -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(); @@ -252,26 +252,26 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd) } -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); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index f67f441127..b50e61dadb 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -42,9 +42,9 @@ public: /// 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; /// @@ -75,14 +75,14 @@ public: /// 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 diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 009119d21d..f09ff6369b 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -43,7 +43,7 @@ void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const { 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); @@ -66,7 +66,7 @@ void InsetCommand::setParams(InsetCommandParams const & p) } -int InsetCommand::latex(Buffer const *, ostream & os, +int InsetCommand::latex(Buffer const &, ostream & os, LatexRunParams const &) const { os << getCommand(); @@ -74,19 +74,19 @@ int InsetCommand::latex(Buffer const *, ostream & os, } -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; } diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 822ab18cd6..489c68e7a7 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -37,22 +37,22 @@ public: /// 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; } @@ -81,7 +81,7 @@ protected: /// 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: /// diff --git a/src/insets/insetenv.C b/src/insets/insetenv.C index c180a8f781..86bfc50a77 100644 --- a/src/insets/insetenv.C +++ b/src/insets/insetenv.C @@ -46,14 +46,14 @@ auto_ptr<InsetBase> InsetEnvironment::clone() const } -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); } @@ -65,7 +65,7 @@ string const InsetEnvironment::editMessage() const } -int InsetEnvironment::latex(Buffer const * buf, ostream & os, +int InsetEnvironment::latex(Buffer const & buf, ostream & os, LatexRunParams const & runparams) const { os << layout_->latexheader; diff --git a/src/insets/insetenv.h b/src/insets/insetenv.h index 58c50bfede..5a1758f1cd 100644 --- a/src/insets/insetenv.h +++ b/src/insets/insetenv.h @@ -22,15 +22,15 @@ public: /// 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; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index a0a7071fdd..5cc6ba64c9 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -112,7 +112,7 @@ InsetERT::~InsetERT() } -void InsetERT::read(Buffer const * buf, LyXLex & lex) +void InsetERT::read(Buffer const & buf, LyXLex & lex) { bool token_found = false; if (lex.isOK()) { @@ -182,7 +182,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex) } -void InsetERT::write(Buffer const * buf, ostream & os) const +void InsetERT::write(Buffer const & buf, ostream & os) const { string st; @@ -202,7 +202,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const << "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) { @@ -325,7 +325,7 @@ void InsetERT::lfunMouseMotion(FuncRequest const & cmd) } -int InsetERT::latex(Buffer const *, ostream & os, +int InsetERT::latex(Buffer const &, ostream & os, LatexRunParams const &) const { ParagraphList::iterator par = inset.paragraphs.begin(); @@ -357,13 +357,13 @@ int InsetERT::latex(Buffer const *, ostream & os, } -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(); @@ -390,7 +390,7 @@ int InsetERT::linuxdoc(Buffer const *, ostream & os) const } -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(); diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 064455d0a6..7c9868123d 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -49,9 +49,9 @@ public: /// 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; /// @@ -64,15 +64,15 @@ public: /// 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 {} /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 84167ff165..126eb30651 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -68,10 +68,10 @@ unsigned int defaultLyxScale = 100; /// 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 @@ -141,16 +141,16 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd) 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; @@ -216,7 +216,7 @@ ExternalTemplate const * getTemplatePtr(InsetExternal::Params const & params) string const getScreenLabel(InsetExternal::Params const & params, - Buffer const * buffer) + Buffer const & buffer) { ExternalTemplate const * const ptr = getTemplatePtr(params); if (!ptr) @@ -234,7 +234,7 @@ InsetExternal::Params const & InsetExternal::params() const } -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; @@ -272,14 +272,14 @@ void InsetExternal::setParams(Params const & p, Buffer const * buffer) } -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) @@ -291,7 +291,7 @@ void InsetExternal::write(Buffer const * buffer, ostream & os) const } -void InsetExternal::read(Buffer const * buffer, LyXLex & lex) +void InsetExternal::read(Buffer const & buffer, LyXLex & lex) { enum ExternalTags { EX_TEMPLATE = 1, @@ -326,7 +326,7 @@ void InsetExternal::read(Buffer const * buffer, LyXLex & lex) case EX_FILENAME: { lex.next(); string const name = lex.getString(); - params.filename.set(name, buffer->filePath()); + params.filename.set(name, buffer.filePath()); break; } @@ -376,7 +376,7 @@ void InsetExternal::read(Buffer const * buffer, LyXLex & lex) 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_); @@ -400,7 +400,7 @@ int InsetExternal::write(string const & format, } -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 @@ -408,7 +408,7 @@ int InsetExternal::latex(Buffer const * buf, ostream & os, // 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. @@ -428,19 +428,19 @@ int InsetExternal::latex(Buffer const * buf, ostream & os, } -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); } @@ -469,7 +469,7 @@ void InsetExternal::validate(LaTeXFeatures & features) const void InsetExternal::updateExternal(string const & format, - Buffer const * buf, + Buffer const & buf, bool external_in_tmpdir) const { ExternalTemplate const * const et_ptr = getTemplatePtr(params_); @@ -518,7 +518,7 @@ void InsetExternal::updateExternal(string const & format, 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; } @@ -536,7 +536,7 @@ void InsetExternal::updateExternal(string const & format, 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); } } @@ -546,10 +546,10 @@ namespace { /// 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); @@ -567,15 +567,15 @@ string const doSubstitution(InsetExternal::Params const & params, 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); @@ -585,11 +585,8 @@ string const doSubstitution(InsetExternal::Params const & params, } -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; @@ -600,11 +597,11 @@ void editExternal(InsetExternal::Params const & params, Buffer const * buffer) 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); } @@ -655,7 +652,7 @@ void InsetExternalMailer::string2params(string const & in, if (lex.isOK()) { InsetExternal inset; - inset.read(&buffer, lex); + inset.read(buffer, lex); params = inset.params(); } } @@ -666,10 +663,10 @@ InsetExternalMailer::params2string(InsetExternal::Params const & 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()); } diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index 68aa10af4c..ee84b58304 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -56,9 +56,9 @@ public: /// 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 @@ -66,14 +66,14 @@ public: 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; @@ -88,13 +88,13 @@ public: 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: @@ -108,7 +108,7 @@ 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 diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index b46e114f5e..197de9e410 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -230,17 +230,17 @@ void InsetFloatParams::read(LyXLex & lex) } -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); } @@ -268,10 +268,10 @@ string const InsetFloat::editMessage() const } -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: @@ -279,7 +279,7 @@ int InsetFloat::latex(Buffer const * buf, ostream & os, // - 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) { @@ -310,9 +310,9 @@ int InsetFloat::latex(Buffer const * buf, ostream & os, } -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: @@ -322,7 +322,7 @@ int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const // 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) { @@ -347,7 +347,7 @@ int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const } -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); @@ -394,7 +394,7 @@ void InsetFloat::wide(bool w, BufferParams const & bp) } -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); @@ -402,7 +402,7 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const // 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); diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 904d50fdd0..e1000de629 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -47,9 +47,9 @@ public: /// 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; /// @@ -57,12 +57,12 @@ public: /// 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; /// @@ -74,7 +74,7 @@ public: /// 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; /// diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C index 8d3c16fec3..72289b435c 100644 --- a/src/insets/insetfloatlist.C +++ b/src/insets/insetfloatlist.C @@ -50,9 +50,9 @@ InsetFloatList::~InsetFloatList() } -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()); @@ -67,15 +67,15 @@ InsetOld::Code InsetFloatList::lyxCode() const } -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()) { @@ -125,10 +125,10 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd) } -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()) { @@ -155,7 +155,7 @@ int InsetFloatList::latex(Buffer const * buf, ostream & os, } -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"; diff --git a/src/insets/insetfloatlist.h b/src/insets/insetfloatlist.h index 04b6a17544..b4d14e035c 100644 --- a/src/insets/insetfloatlist.h +++ b/src/insets/insetfloatlist.h @@ -36,24 +36,24 @@ public: /// 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: diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 9dd6fe202e..cc047e2a9b 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -58,13 +58,11 @@ string const InsetFoot::editMessage() const } -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{"; @@ -75,7 +73,7 @@ int InsetFoot::latex(Buffer const * buf, ostream & os, } -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); diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index 647cdc93c4..600ad8bcd2 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -31,10 +31,10 @@ public: /// 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; }; diff --git a/src/insets/insetfootlike.C b/src/insets/insetfootlike.C index bf3ac571f2..63c55040a9 100644 --- a/src/insets/insetfootlike.C +++ b/src/insets/insetfootlike.C @@ -46,13 +46,13 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in) 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); diff --git a/src/insets/insetfootlike.h b/src/insets/insetfootlike.h index 36f7bcf06a..c6489f53d3 100644 --- a/src/insets/insetfootlike.h +++ b/src/insets/insetfootlike.h @@ -26,7 +26,7 @@ public: /// 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 diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 0c67703e80..647e9c525a 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -223,19 +223,19 @@ InsetOld::EDITABLE InsetGraphics::editable() const } -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; @@ -328,13 +328,13 @@ string const InsetGraphics::createLatexOptions() const } -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] @@ -364,7 +364,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf, // 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)) { @@ -411,7 +411,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf, << "\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."), @@ -439,7 +439,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf, // 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 + ' ' + @@ -461,7 +461,7 @@ string const InsetGraphics::prepareFile(Buffer const * buf, } -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, @@ -471,7 +471,7 @@ int InsetGraphics::latex(Buffer const * buf, ostream & os, << 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 @@ -539,7 +539,7 @@ int InsetGraphics::latex(Buffer const * buf, ostream & os, } -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. @@ -552,10 +552,10 @@ int InsetGraphics::ascii(Buffer const *, ostream & os, int) const } -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"; @@ -567,7 +567,7 @@ int InsetGraphics::linuxdoc(Buffer const * buf, ostream & os) const // 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 diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 99111e565e..e35ecaec8b 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -42,22 +42,22 @@ public: /// 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. @@ -95,7 +95,7 @@ private: /// 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_; diff --git a/src/insets/insethfill.C b/src/insets/insethfill.C index cd3e8a4209..07007bd038 100644 --- a/src/insets/insethfill.C +++ b/src/insets/insethfill.C @@ -21,7 +21,7 @@ InsetHFill::InsetHFill() {} -int InsetHFill::latex(Buffer const *, ostream & os, +int InsetHFill::latex(Buffer const &, ostream & os, LatexRunParams const &) const { os << getCommand(); @@ -29,27 +29,27 @@ int InsetHFill::latex(Buffer const *, ostream & os, } -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"; } diff --git a/src/insets/insethfill.h b/src/insets/insethfill.h index eb2359be04..7951275c05 100644 --- a/src/insets/insethfill.h +++ b/src/insets/insethfill.h @@ -24,20 +24,20 @@ public: 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; } }; diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 1dceaaedd6..7e1af317bb 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -218,14 +218,26 @@ auto_ptr<InsetBase> InsetInclude::clone() const } -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); @@ -242,7 +254,7 @@ void InsetInclude::read(Buffer const *, LyXLex & lex) } -string const InsetInclude::getScreenLabel(Buffer const *) const +string const InsetInclude::getScreenLabel(Buffer const &) const { string temp; @@ -297,7 +309,7 @@ bool InsetInclude::loadIfNeeded() const } -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()); @@ -310,13 +322,13 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os, 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; } @@ -324,19 +336,19 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os, // 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); @@ -365,7 +377,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os, } -int InsetInclude::ascii(Buffer const *, ostream & os, int) const +int InsetInclude::ascii(Buffer const &, ostream & os, int) const { if (isVerbatim()) os << GetFileContents(getFileName()); @@ -373,7 +385,7 @@ int InsetInclude::ascii(Buffer const *, ostream & os, int) const } -int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const +int InsetInclude::linuxdoc(Buffer const & buffer, ostream & os) const { string incfile(params_.cparams.getContents()); @@ -386,9 +398,9 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const // 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(); @@ -398,7 +410,7 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const 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()) { @@ -412,7 +424,7 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const } -int InsetInclude::docbook(Buffer const * buffer, ostream & os, +int InsetInclude::docbook(Buffer const & buffer, ostream & os, bool /*mixcont*/) const { string incfile(params_.cparams.getContents()); @@ -426,9 +438,9 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os, // 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())) @@ -437,7 +449,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os, 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()) { @@ -457,11 +469,11 @@ void InsetInclude::validate(LaTeXFeatures & features) const 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(); @@ -480,8 +492,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const // 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); } } @@ -519,7 +530,7 @@ void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const } 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); @@ -581,7 +592,7 @@ string const InsetInclude::PreviewImpl::latexString() const ostringstream os; LatexRunParams runparams; runparams.flavor = LatexRunParams::LATEX; - parent().latex(view()->buffer(), os, runparams); + parent().latex(*view()->buffer(), os, runparams); return STRCONV(os.str()); } @@ -648,7 +659,7 @@ void InsetIncludeMailer::string2params(string const & in, if (lex.isOK()) { InsetInclude inset(params); - inset.read(0, lex); + inset.read(lex); params = inset.params(); } } @@ -661,7 +672,7 @@ InsetIncludeMailer::params2string(InsetInclude::Params const & params) inset.set(params); ostringstream data; data << name_ << ' '; - inset.write(0, data); + inset.write(data); data << "\\end_inset\n"; return STRCONV(data.str()); } diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index 3f55c76d55..4e90013fdd 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -86,19 +86,19 @@ public: { 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; @@ -109,8 +109,14 @@ public: 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 diff --git a/src/insets/insetindex.C b/src/insets/insetindex.C index 111a83800e..be034b8a9c 100644 --- a/src/insets/insetindex.C +++ b/src/insets/insetindex.C @@ -39,7 +39,7 @@ InsetIndex::~InsetIndex() } -string const InsetIndex::getScreenLabel(Buffer const *) const +string const InsetIndex::getScreenLabel(Buffer const &) const { return _("Idx"); } @@ -73,7 +73,7 @@ dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd) } -int InsetIndex::docbook(Buffer const *, ostream & os, bool) const +int InsetIndex::docbook(Buffer const &, ostream & os, bool) const { os << "<indexterm><primary>" << getContents() << "</primary></indexterm>"; @@ -102,7 +102,7 @@ InsetPrintIndex::~InsetPrintIndex() {} -string const InsetPrintIndex::getScreenLabel(Buffer const *) const +string const InsetPrintIndex::getScreenLabel(Buffer const &) const { return _("Index"); } diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h index cb90a519ca..4676ac8b24 100644 --- a/src/insets/insetindex.h +++ b/src/insets/insetindex.h @@ -32,13 +32,13 @@ public: /// 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; }; @@ -61,7 +61,7 @@ public: /// InsetOld::Code lyxCode() const; /// - string const getScreenLabel(Buffer const *) const; + string const getScreenLabel(Buffer const &) const; /// void metrics(MetricsInfo &, Dimension &) const; /// diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 1d164b0c20..1554760f81 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -78,7 +78,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) } -int InsetLabel::latex(Buffer const *, ostream & os, +int InsetLabel::latex(Buffer const &, ostream & os, LatexRunParams const &) const { os << escape(getCommand()); @@ -86,21 +86,21 @@ int InsetLabel::latex(Buffer const *, ostream & os, } -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; diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 32a12788ba..60af5c7f6b 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -28,7 +28,7 @@ public: /// 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; } /// @@ -36,14 +36,14 @@ public: /// 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 diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index eff62bd10e..a0a364ce29 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -601,13 +601,13 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const } -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(); @@ -615,7 +615,7 @@ void InsetLatexAccent::read(Buffer const *, LyXLex & lex) } -int InsetLatexAccent::latex(Buffer const *, ostream & os, +int InsetLatexAccent::latex(Buffer const &, ostream & os, LatexRunParams const &) const { os << contents; @@ -623,21 +623,21 @@ int InsetLatexAccent::latex(Buffer const *, ostream & os, } -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; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 7c7ea976ed..c209f37915 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -42,18 +42,18 @@ public: /// 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; /// diff --git a/src/insets/insetlist.h b/src/insets/insetlist.h index 8b130f2063..ae46031241 100644 --- a/src/insets/insetlist.h +++ b/src/insets/insetlist.h @@ -23,11 +23,11 @@ public: /// 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; diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 73e0687f77..853219bf14 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -54,7 +54,7 @@ string const InsetMarginal::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{"; diff --git a/src/insets/insetmarginal.h b/src/insets/insetmarginal.h index 271f395740..a1cbfa0016 100644 --- a/src/insets/insetmarginal.h +++ b/src/insets/insetmarginal.h @@ -30,7 +30,7 @@ public: /// 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; diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 5111184a34..ecf9ed6d81 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -192,14 +192,14 @@ void InsetMinipage::Params::read(LyXLex & lex) } -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); @@ -241,7 +241,7 @@ string const InsetMinipage::editMessage() const } -int InsetMinipage::latex(Buffer const * buf, ostream & os, +int InsetMinipage::latex(Buffer const & buf, ostream & os, LatexRunParams const & runparams) const { string s_pos; diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index 07a65cc1f1..1a2efe1265 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -62,9 +62,9 @@ public: /// 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; /// @@ -72,7 +72,7 @@ public: /// 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; diff --git a/src/insets/insetnewline.C b/src/insets/insetnewline.C index 1a0074ad02..eb7db91402 100644 --- a/src/insets/insetnewline.C +++ b/src/insets/insetnewline.C @@ -29,13 +29,13 @@ using std::ostream; 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"; } @@ -51,7 +51,7 @@ void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const } -int InsetNewline::latex(Buffer const *, ostream &, +int InsetNewline::latex(Buffer const &, ostream &, LatexRunParams const &) const { lyxerr << "Eek, calling InsetNewline::latex !" << endl; @@ -59,21 +59,21 @@ int InsetNewline::latex(Buffer const *, ostream &, } -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; diff --git a/src/insets/insetnewline.h b/src/insets/insetnewline.h index 3c8644bbaa..855a5bacad 100644 --- a/src/insets/insetnewline.h +++ b/src/insets/insetnewline.h @@ -30,18 +30,18 @@ public: 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; } }; diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index efa2de5d91..ad66b0f92c 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -74,14 +74,14 @@ string const InsetNote::editMessage() const } -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(); @@ -167,7 +167,7 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd) } -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; @@ -194,7 +194,7 @@ int InsetNote::latex(Buffer const * buf, ostream & os, } -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; @@ -213,7 +213,7 @@ int InsetNote::linuxdoc(Buffer const * buf, std::ostream & os) const } -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; @@ -232,7 +232,7 @@ int InsetNote::docbook(Buffer const * buf, std::ostream & os, bool mixcont) cons } -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; diff --git a/src/insets/insetnote.h b/src/insets/insetnote.h index 2c7c0473a4..9924c0c7fc 100644 --- a/src/insets/insetnote.h +++ b/src/insets/insetnote.h @@ -46,9 +46,9 @@ public: /// 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(); /// @@ -58,14 +58,14 @@ public: /// 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; /// diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index 5cc80dc429..a1f92a5805 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -61,21 +61,21 @@ string const InsetOptArg::editMessage() 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 << '['; diff --git a/src/insets/insetoptarg.h b/src/insets/insetoptarg.h index 3f53aeccf5..6abba7f934 100644 --- a/src/insets/insetoptarg.h +++ b/src/insets/insetoptarg.h @@ -36,13 +36,13 @@ public: 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 diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 90e611627a..6e094c0a27 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -232,7 +232,7 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const } -void InsetQuotes::write(Buffer const *, ostream & os) const +void InsetQuotes::write(Buffer const &, ostream & os) const { string text; text += language_char[language_]; @@ -242,7 +242,7 @@ void InsetQuotes::write(Buffer const *, ostream & os) const } -void InsetQuotes::read(Buffer const *, LyXLex & lex) +void InsetQuotes::read(Buffer const &, LyXLex & lex) { lex.nextToken(); parseString(lex.getString()); @@ -253,11 +253,11 @@ void InsetQuotes::read(Buffer const *, LyXLex & lex) } -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) @@ -267,7 +267,7 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os, 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; @@ -305,21 +305,21 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os, } -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) diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 18d0c271a8..e7068f10da 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -78,18 +78,18 @@ public: 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; /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 56bde45fb5..c4affe9143 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -60,7 +60,7 @@ dispatch_result InsetRef::localDispatch(FuncRequest const & cmd) } -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) @@ -79,7 +79,7 @@ string const InsetRef::getScreenLabel(Buffer const *) const } -int InsetRef::latex(Buffer const *, ostream & os, +int InsetRef::latex(Buffer const &, ostream & os, LatexRunParams const &) const { if (getOptions().empty()) @@ -92,14 +92,14 @@ int InsetRef::latex(Buffer const *, ostream & os, } -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() << "\" >"; @@ -107,7 +107,7 @@ int InsetRef::linuxdoc(Buffer const *, ostream & os) const } -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() << "\">"; diff --git a/src/insets/insetref.h b/src/insets/insetref.h index e58110c414..69dff7cac5 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -48,7 +48,7 @@ public: /// dispatch_result localDispatch(FuncRequest const & cmd); /// - string const getScreenLabel(Buffer const *) const; + string const getScreenLabel(Buffer const &) const; /// EDITABLE editable() const { return IS_EDITABLE; } /// @@ -56,14 +56,14 @@ public: /// 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: diff --git a/src/insets/insetspace.C b/src/insets/insetspace.C index dad2c9636d..801bf188bd 100644 --- a/src/insets/insetspace.C +++ b/src/insets/insetspace.C @@ -101,7 +101,7 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const } -void InsetSpace::write(Buffer const *, ostream & os) const +void InsetSpace::write(Buffer const &, ostream & os) const { string command; switch (kind_) { @@ -135,7 +135,7 @@ void InsetSpace::write(Buffer const *, ostream & os) const // 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(); @@ -161,7 +161,7 @@ void InsetSpace::read(Buffer const *, LyXLex & lex) } -int InsetSpace::latex(Buffer const *, ostream & os, +int InsetSpace::latex(Buffer const &, ostream & os, LatexRunParams const & runparams) const { switch (kind_) { @@ -194,7 +194,7 @@ int InsetSpace::latex(Buffer const *, ostream & os, } -int InsetSpace::ascii(Buffer const *, ostream & os, int) const +int InsetSpace::ascii(Buffer const &, ostream & os, int) const { switch (kind_) { case NORMAL: @@ -212,7 +212,7 @@ int InsetSpace::ascii(Buffer const *, ostream & os, int) const } -int InsetSpace::linuxdoc(Buffer const *, ostream & os) const +int InsetSpace::linuxdoc(Buffer const &, ostream & os) const { switch (kind_) { case NORMAL: @@ -232,7 +232,7 @@ int InsetSpace::linuxdoc(Buffer const *, ostream & os) const } -int InsetSpace::docbook(Buffer const *, ostream & os, bool) const +int InsetSpace::docbook(Buffer const &, ostream & os, bool) const { switch (kind_) { case NORMAL: diff --git a/src/insets/insetspace.h b/src/insets/insetspace.h index 67c9294346..e8c0fc829e 100644 --- a/src/insets/insetspace.h +++ b/src/insets/insetspace.h @@ -58,18 +58,18 @@ public: /// 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; /// diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index 08f0889751..018ac6763e 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -111,7 +111,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) 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_) { @@ -136,7 +136,7 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const // 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(); @@ -156,7 +156,7 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex) } -int InsetSpecialChar::latex(Buffer const *, ostream & os, +int InsetSpecialChar::latex(Buffer const &, ostream & os, LatexRunParams const &) const { switch (kind_) { @@ -180,7 +180,7 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, } -int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const +int InsetSpecialChar::ascii(Buffer const &, ostream & os, int) const { switch (kind_) { case HYPHENATION: @@ -200,7 +200,7 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const } -int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const +int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os) const { switch (kind_) { case HYPHENATION: @@ -220,7 +220,7 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const } -int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const +int InsetSpecialChar::docbook(Buffer const &, ostream & os, bool) const { switch (kind_) { case HYPHENATION: diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 7f7391629e..cddd3e237f 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -50,18 +50,18 @@ public: /// 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; /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index fd20f0a99d..fc9b4834a2 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -201,9 +201,9 @@ auto_ptr<InsetBase> InsetTabular::clone() const } -Buffer const * InsetTabular::buffer() const +Buffer const & InsetTabular::buffer() const { - return buffer_; + return *buffer_; } @@ -220,14 +220,14 @@ void InsetTabular::buffer(Buffer * b) } -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"); @@ -856,7 +856,7 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd) updateLocal(bv); break; case LFUN_NEXT: { - if (hs) + if (hs) clearSelection(); int column = actcol; unlockInsetInInset(bv, the_locking_inset); @@ -1085,29 +1085,29 @@ InsetOld::RESULT InsetTabular::localDispatch(FuncRequest const & cmd) } -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; @@ -1980,7 +1980,7 @@ bool InsetTabular::insetHit(BufferView *, int x, int) const } -void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const +void InsetTabular::deleteLyXText(BufferView * /*bv*/, bool /*recursive*/) const { //resizeLyXText(bv, recursive); } @@ -2245,7 +2245,7 @@ bool InsetTabular::copySelection(BufferView * bv) 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; @@ -2712,9 +2712,8 @@ int InsetTabularMailer::string2params(string const & in, InsetTabular & inset) 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. @@ -2724,9 +2723,7 @@ int InsetTabularMailer::string2params(string const & in, InsetTabular & inset) 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'; diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index fef1a0f1c8..f3f6781e71 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -69,9 +69,9 @@ public: /// 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; /// @@ -108,14 +108,14 @@ public: /// 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; /// @@ -201,7 +201,7 @@ public: /// virtual BufferView * view() const; /// - Buffer const * buffer() const; + Buffer const & buffer() const; /// set the owning buffer void buffer(Buffer * b); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 53e160cc79..eb69bb6640 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -146,7 +146,7 @@ void InsetText::clear(bool just_mark_erased) 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; } @@ -167,32 +167,32 @@ auto_ptr<InsetBase> InsetText::clone() const } -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 @@ -214,7 +214,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex) } // 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(); @@ -838,7 +838,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd) case LFUN_DELETE: if (text_.selection.set()) text_.cutSelection(true, false); - else + else text_.Delete(); updflag = true; break; @@ -907,7 +907,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd) 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; @@ -965,7 +965,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd) } -int InsetText::latex(Buffer const * buf, ostream & os, +int InsetText::latex(Buffer const & buf, ostream & os, LatexRunParams const & runparams) const { TexRow texrow; @@ -974,7 +974,7 @@ int InsetText::latex(Buffer const * buf, ostream & os, } -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; @@ -982,7 +982,7 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const 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; } @@ -990,7 +990,7 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const } -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(); @@ -1003,7 +1003,7 @@ int InsetText::linuxdoc(Buffer const * buf, ostream & os) const 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); } @@ -1011,7 +1011,7 @@ int InsetText::linuxdoc(Buffer const * buf, ostream & os) const } -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; @@ -1067,7 +1067,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const 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; @@ -1119,7 +1119,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const 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 @@ -1605,7 +1605,7 @@ int InsetText::scroll(bool recursive) const } -void InsetText::clearSelection(BufferView * bv) +void InsetText::clearSelection(BufferView *) { text_.clearSelection(); } diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 70558ed342..6c8b773dca 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -62,9 +62,9 @@ public: /// 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; /// @@ -85,14 +85,14 @@ public: /// 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; /// @@ -120,7 +120,7 @@ public: /// 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 &); /// @@ -247,7 +247,7 @@ private: /// 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); /// diff --git a/src/insets/insettheorem.h b/src/insets/insettheorem.h index f4d2d3ed73..465479ba0b 100644 --- a/src/insets/insettheorem.h +++ b/src/insets/insettheorem.h @@ -23,7 +23,7 @@ public: /// InsetTheorem(); /// - void write(Buffer const * buf, std::ostream & os) const; + void write(Buffer const & buf, std::ostream & os) const; /// virtual InsetBase * clone() const; /// @@ -33,7 +33,7 @@ public: /// 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; diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index 8c8f732c58..53cb0189c0 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -35,7 +35,7 @@ InsetTOC::~InsetTOC() } -string const InsetTOC::getScreenLabel(Buffer const *) const +string const InsetTOC::getScreenLabel(Buffer const &) const { string const cmdname(getCmdName()); @@ -81,7 +81,7 @@ dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd) } -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"; @@ -92,7 +92,7 @@ int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const } -int InsetTOC::linuxdoc(Buffer const *, ostream & os) const +int InsetTOC::linuxdoc(Buffer const &, ostream & os) const { if (getCmdName() == "tableofcontents") os << "<toc>"; @@ -100,7 +100,7 @@ int InsetTOC::linuxdoc(Buffer const *, ostream & os) const } -int InsetTOC::docbook(Buffer const *, ostream & os, bool) const +int InsetTOC::docbook(Buffer const &, ostream & os, bool) const { if (getCmdName() == "tableofcontents") os << "<toc></toc>"; diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 465c6cf5a8..77ce3e338e 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -35,17 +35,17 @@ public: /// 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_; diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 619e8b5dbb..c60b5f620b 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -54,7 +54,7 @@ dispatch_result InsetUrl::localDispatch(FuncRequest const & cmd) } -string const InsetUrl::getScreenLabel(Buffer const *) const +string const InsetUrl::getScreenLabel(Buffer const &) const { string temp; if (getCmdName() == "url") @@ -78,7 +78,7 @@ string const InsetUrl::getScreenLabel(Buffer const *) const } -int InsetUrl::latex(Buffer const *, ostream & os, +int InsetUrl::latex(Buffer const &, ostream & os, LatexRunParams const & runparams) const { if (!getOptions().empty()) @@ -90,7 +90,7 @@ int InsetUrl::latex(Buffer const *, ostream & os, } -int InsetUrl::ascii(Buffer const *, ostream & os, int) const +int InsetUrl::ascii(Buffer const &, ostream & os, int) const { if (getOptions().empty()) os << '[' << getContents() << ']'; @@ -100,7 +100,7 @@ int InsetUrl::ascii(Buffer const *, ostream & os, int) const } -int InsetUrl::linuxdoc(Buffer const *, ostream & os) const +int InsetUrl::linuxdoc(Buffer const &, ostream & os) const { os << '<' << getCmdName() << " url=\"" << getContents() << "\"" @@ -110,7 +110,7 @@ int InsetUrl::linuxdoc(Buffer const *, ostream & os) const } -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>"; diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index a9a82a1279..94a6e446cd 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -37,20 +37,20 @@ public: /// 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 diff --git a/src/insets/insetwrap.C b/src/insets/insetwrap.C index 77b59e2a8c..8eb58801b3 100644 --- a/src/insets/insetwrap.C +++ b/src/insets/insetwrap.C @@ -145,14 +145,14 @@ void InsetWrapParams::read(LyXLex & lex) } -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); @@ -178,7 +178,7 @@ string const InsetWrap::editMessage() const } -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 << '}'; @@ -194,7 +194,7 @@ int InsetWrap::latex(Buffer const * buf, ostream & os, } -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); @@ -233,7 +233,7 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const } -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(); @@ -241,7 +241,7 @@ void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const 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); diff --git a/src/insets/insetwrap.h b/src/insets/insetwrap.h index 223f9be437..4e78a2d634 100644 --- a/src/insets/insetwrap.h +++ b/src/insets/insetwrap.h @@ -44,9 +44,9 @@ public: /// 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; /// @@ -54,16 +54,16 @@ public: /// 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; /// diff --git a/src/lyx_cb.C b/src/lyx_cb.C index d148852bc1..2699d8156d 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -434,7 +434,7 @@ string const getPossibleLabel(BufferView const & bv) 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; diff --git a/src/lyxfind.C b/src/lyxfind.C index 9b3b2d0106..fe37598adb 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -189,10 +189,10 @@ int replace(BufferView * bv, 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) || diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 603dbf47b6..8ee9a726b5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -319,7 +319,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const 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(); @@ -345,7 +345,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const 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: @@ -553,7 +553,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const } 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(); @@ -1978,4 +1978,3 @@ bool LyXFunc::wasMetaKey() const { return (meta_fake_bit != key_modifier::none); } - diff --git a/src/lyxtext.h b/src/lyxtext.h index abf6aae77f..6fbbc6f7db 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -41,8 +41,8 @@ class Dimension; /** 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 @@ -240,10 +240,10 @@ public: 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; @@ -354,7 +354,7 @@ public: /// 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. @@ -423,7 +423,7 @@ public: private: /// - void setCounter(Buffer const *, ParagraphList::iterator pit); + void setCounter(Buffer const &, ParagraphList::iterator pit); /// void deleteWordForward(); /// diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 3feae06bb5..724152d0b9 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/src/mathed/formula.C b/src/mathed/formula.C index a2bd901a52..524d8f2bfc 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -116,7 +116,7 @@ auto_ptr<InsetBase> InsetFormula::clone() const } -void InsetFormula::write(Buffer const *, ostream & os) const +void InsetFormula::write(Buffer const &, ostream & os) const { WriteStream wi(os, false, false); os << par_->fileInsetLabel() << ' '; @@ -124,7 +124,7 @@ void InsetFormula::write(Buffer const *, ostream & os) const } -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); @@ -133,7 +133,7 @@ int InsetFormula::latex(Buffer const *, ostream & os, } -int InsetFormula::ascii(Buffer const *, ostream & os, int) const +int InsetFormula::ascii(Buffer const &, ostream & os, int) const { if (0 && display()) { Dimension dim; @@ -153,13 +153,13 @@ int InsetFormula::ascii(Buffer const *, ostream & os, int) const } -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"); @@ -176,7 +176,7 @@ int InsetFormula::docbook(Buffer const * buf, ostream & os, bool) const } -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. diff --git a/src/mathed/formula.h b/src/mathed/formula.h index 415eba86b3..f2b3e2fe69 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -38,18 +38,18 @@ public: 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; diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 004e045025..1676e73cde 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -892,7 +892,7 @@ void mathDispatchCreation(FuncRequest const & cmd, bool display) // 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); diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 39ab932540..6e0bc6b8ef 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -70,7 +70,7 @@ auto_ptr<InsetBase> InsetFormulaMacro::clone() const } -void InsetFormulaMacro::write(Buffer const *, ostream & os) const +void InsetFormulaMacro::write(Buffer const &, ostream & os) const { os << "FormulaMacro "; WriteStream wi(os, false, false); @@ -78,7 +78,7 @@ void InsetFormulaMacro::write(Buffer const *, ostream & os) const } -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); @@ -87,7 +87,7 @@ int InsetFormulaMacro::latex(Buffer const *, ostream & os, } -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); @@ -95,19 +95,19 @@ int InsetFormulaMacro::ascii(Buffer const *, ostream & os, int) const } -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()); } diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 0db2759a0c..34bfc15e9d 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -36,18 +36,18 @@ public: 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; diff --git a/src/paragraph.C b/src/paragraph.C index 3fb2ea1194..ccd07dab81 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -130,7 +130,7 @@ Paragraph::~Paragraph() } -void Paragraph::write(Buffer const * buf, ostream & os, +void Paragraph::write(Buffer const & buf, ostream & os, BufferParams const & bparams, depth_type & dth) const { @@ -818,7 +818,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams, // 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, @@ -1131,7 +1131,7 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams) // 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; @@ -1159,7 +1159,7 @@ string const Paragraph::asString(Buffer const * buffer, bool label) const } -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; @@ -1168,7 +1168,7 @@ string const Paragraph::asString(Buffer const * buffer, 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) diff --git a/src/paragraph.h b/src/paragraph.h index f668965f1b..6f0c26648d 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -79,13 +79,13 @@ public: 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; @@ -103,7 +103,7 @@ public: /// - bool simpleTeXOnePar(Buffer const *, BufferParams const &, + bool simpleTeXOnePar(Buffer const &, BufferParams const &, LyXFont const & outerfont, std::ostream &, TexRow & texrow, LatexRunParams const &); diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index 5001c4cbe5..c13bf6e706 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -37,7 +37,7 @@ #include "insets/insethfill.h" #include "insets/insetnewline.h" -extern string bibitemWidest(Buffer const *); +extern string bibitemWidest(Buffer const &); using namespace lyx::support; @@ -298,14 +298,14 @@ int getEndLabel(ParagraphList::iterator p, ParagraphList const & plist) 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, @@ -314,7 +314,7 @@ TeXOnePar(Buffer const * buf, ParagraphList::iterator -TeXDeeper(Buffer const * buf, +TeXDeeper(Buffer const & buf, ParagraphList const & paragraphs, ParagraphList::iterator pit, ostream & os, TexRow & texrow, @@ -340,7 +340,7 @@ TeXDeeper(Buffer const * buf, ParagraphList::iterator -TeXEnvironment(Buffer const * buf, +TeXEnvironment(Buffer const & buf, ParagraphList const & paragraphs, ParagraphList::iterator pit, ostream & os, TexRow & texrow, @@ -348,7 +348,7 @@ TeXEnvironment(Buffer const * buf, { lyxerr[Debug::LATEX] << "TeXEnvironment... " << &*pit << endl; - BufferParams const & bparams = buf->params; + BufferParams const & bparams = buf.params; LyXLayout_ptr const & style = pit->layout(); @@ -465,7 +465,7 @@ InsetOptArg * optArgInset(Paragraph const & par) ParagraphList::iterator -TeXOnePar(Buffer const * buf, +TeXOnePar(Buffer const & buf, ParagraphList const & paragraphs, ParagraphList::iterator pit, ostream & os, TexRow & texrow, @@ -474,7 +474,7 @@ TeXOnePar(Buffer const * buf, { 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; @@ -720,7 +720,7 @@ TeXOnePar(Buffer const * buf, // // 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, @@ -729,7 +729,7 @@ void latexParagraphs(Buffer const * buf, { 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(); @@ -929,27 +929,27 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok 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); diff --git a/src/paragraph_funcs.h b/src/paragraph_funcs.h index 85910c9453..7a7c763f0d 100644 --- a/src/paragraph_funcs.h +++ b/src/paragraph_funcs.h @@ -62,7 +62,7 @@ int getEndLabel(ParagraphList::iterator pit, ParagraphList const & plist); -void latexParagraphs(Buffer const * buf, +void latexParagraphs(Buffer const & buf, ParagraphList const & paragraphs, std::ostream & ofs, TexRow & texrow, diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 399d528b98..8c0573d7ee 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -480,7 +480,7 @@ bool Paragraph::Pimpl::isTextAt(string const & str, pos_type pos) const } -void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, +void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf, BufferParams const & bparams, ostream & os, TexRow & texrow, diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index 26d2b0c3d9..e636af459d 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -158,7 +158,7 @@ struct Paragraph::Pimpl { 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, diff --git a/src/rowpainter.C b/src/rowpainter.C index 1e4e9e26c7..a59e8385bb 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -691,22 +691,22 @@ void RowPainter::paintFirst() 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_); } } } @@ -746,12 +746,12 @@ void RowPainter::paintFirst() // 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 = @@ -794,7 +794,7 @@ void RowPainter::paintFirst() if (!parparams.spacing().isDefault()) { spacing_val = parparams.spacing().getValue(); } else { - spacing_val = buffer->params.spacing.getValue(); + spacing_val = buffer.params.spacing.getValue(); } int maxdesc = @@ -1050,7 +1050,7 @@ int paintRows(BufferView const & bv, LyXText const & text, //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; @@ -1076,7 +1076,6 @@ int paintRows(BufferView const & bv, LyXText const & text, return y; } - } // namespace anon @@ -1128,5 +1127,3 @@ int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp) else return max(min_size, space_size); } - - diff --git a/src/tabular.C b/src/tabular.C index f08fe4fdf9..10e0b797ae 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -370,7 +370,7 @@ LyXTabular::LyXTabular(BufferParams const & bp, } -LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex) +LyXTabular::LyXTabular(Buffer const & buf, InsetTabular * inset, LyXLex & lex) { owner_ = inset; cur_cell = -1; @@ -1149,7 +1149,7 @@ int LyXTabular::right_column_of_cell(int cell) const } -void LyXTabular::write(Buffer const * buf, ostream & os) const +void LyXTabular::write(Buffer const & buf, ostream & os) const { // header line os << "<lyxtabular" @@ -1295,7 +1295,7 @@ void LyXTabular::setHeaderFooterRows(int hr, int fhr, int fr, int lfr) } -void LyXTabular::read(Buffer const * buf, LyXLex & lex) +void LyXTabular::read(Buffer const & buf, LyXLex & lex) { string line; istream & is = lex.getStream(); @@ -1318,7 +1318,7 @@ void LyXTabular::read(Buffer const * buf, LyXLex & lex) 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" @@ -1961,7 +1961,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const } -int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const * buf, +int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const & buf, LatexRunParams const & runparams) const { if (!is_long_tabular) @@ -2061,7 +2061,7 @@ bool LyXTabular::isValidRow(int const row) const } -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; @@ -2074,7 +2074,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf, 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) @@ -2097,7 +2097,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf, } -int LyXTabular::latex(Buffer const * buf, ostream & os, +int LyXTabular::latex(Buffer const & buf, ostream & os, LatexRunParams const & runparams) const { int ret = 0; @@ -2205,7 +2205,7 @@ int LyXTabular::latex(Buffer const * buf, ostream & os, } -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) { @@ -2229,7 +2229,7 @@ int LyXTabular::linuxdoc(Buffer const * buf, ostream & os) const if (isPartOfMultiColumn(i, j)) continue; InsetText & inset = getCellInset(cell); - + ret += inset.linuxdoc(buf, os); if (isLastCellInRow(cell)) { @@ -2246,7 +2246,7 @@ int LyXTabular::linuxdoc(Buffer const * buf, ostream & os) const } -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); @@ -2297,7 +2297,7 @@ int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const } -int LyXTabular::docbook(Buffer const * buf, ostream & os, +int LyXTabular::docbook(Buffer const & buf, ostream & os, bool /*mixcont*/) const { int ret = 0; @@ -2473,7 +2473,7 @@ int LyXTabular::asciiBottomHLine(ostream & os, int row, } -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 @@ -2523,7 +2523,7 @@ int LyXTabular::asciiPrintCell(Buffer const * buf, ostream & os, } -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; diff --git a/src/tabular.h b/src/tabular.h index 62c4c658da..c2ac148da6 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -178,7 +178,7 @@ public: 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; @@ -277,18 +277,18 @@ public: /// 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; @@ -546,12 +546,12 @@ public: /// 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 @@ -562,12 +562,12 @@ public: 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 diff --git a/src/text.C b/src/text.C index 65429e1e8b..b558bd680b 100644 --- a/src/text.C +++ b/src/text.C @@ -270,7 +270,7 @@ bool LyXText::bidi_InRange(lyx::pos_type pos) const 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) { @@ -308,7 +308,7 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit, 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; @@ -321,12 +321,12 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit, !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; } @@ -397,7 +397,7 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit, // 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) @@ -412,12 +412,12 @@ bool LyXText::isBoundary(Buffer const * buf, Paragraph const & par, 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) @@ -426,7 +426,7 @@ bool LyXText::isBoundary(Buffer const * buf, Paragraph const & par, 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; } @@ -607,7 +607,7 @@ int LyXText::leftMargin(ParagraphList::iterator pit, Row const & row) const 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(); @@ -656,7 +656,7 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit, 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(), @@ -813,7 +813,7 @@ int LyXText::fill(ParagraphList::iterator pit, font = getFont(pit, i); endPosOfFontSpan = pit->getEndPosOfFontSpan(i); } - w += singleWidth(pit, i, c, font); + w += singleWidth(pit, i, c, font); ++i; } } @@ -1467,15 +1467,15 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, 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; @@ -1489,7 +1489,7 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit, } } - 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); diff --git a/src/text2.C b/src/text2.C index da8ebec8b1..2675333c6d 100644 --- a/src/text2.C +++ b/src/text2.C @@ -596,7 +596,7 @@ int LyXText::redoParagraphs(ParagraphList::iterator start, 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; @@ -753,7 +753,7 @@ string LyXText::getStringToIndex() 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; @@ -853,9 +853,9 @@ void LyXText::setParagraph(bool line_top, bool line_bottom, // 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()) { @@ -913,7 +913,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) ostringstream s; - if (i >= 0 && i <= buf->params.secnumdepth) { + if (i >= 0 && i <= buf.params.secnumdepth) { string numbertype; string langtype; @@ -921,9 +921,9 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) // 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. @@ -932,7 +932,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) numbertype = "sectioning"; } else { numbertype = "appendix"; - if (pit->isRightToLeftPar(buf->params)) + if (pit->isRightToLeftPar(buf.params)) langtype = "hebrew"; else langtype = "latin"; @@ -986,7 +986,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) } // 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) { @@ -1003,7 +1003,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) 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) @@ -1026,7 +1026,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit) 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; @@ -1072,7 +1072,7 @@ void LyXText::updateCounters() pit->params().depth(maxdepth); // setCounter can potentially change the labelString. - setCounter(bv()->buffer(), pit); + setCounter(*bv()->buffer(), pit); string const & newLabel = pit->params().labelString(); @@ -1093,7 +1093,7 @@ void LyXText::insertInset(InsetOld * inset) // 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)) @@ -1112,7 +1112,7 @@ void LyXText::cutSelection(bool doclear, bool realcut) // 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()) @@ -1177,7 +1177,7 @@ void LyXText::cutSelection(bool doclear, bool realcut) 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()) @@ -1360,7 +1360,7 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit, 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 @@ -1493,7 +1493,7 @@ void LyXText::setCurrentFont() 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); @@ -1594,7 +1594,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit, 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); } } @@ -1648,7 +1648,7 @@ void LyXText::cursorLeft(bool internal) 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 @@ -1669,7 +1669,7 @@ void LyXText::cursorRight(bool internal) 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); @@ -1867,7 +1867,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) 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; diff --git a/src/text3.C b/src/text3.C index 35cacddf2f..98dd18cc0b 100644 --- a/src/text3.C +++ b/src/text3.C @@ -336,7 +336,7 @@ void LyXText::cursorNext() } 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()) diff --git a/src/textcursor.C b/src/textcursor.C index 76002a3884..c8d225990c 100644 --- a/src/textcursor.C +++ b/src/textcursor.C @@ -60,7 +60,7 @@ void TextCursor::clearSelection() } -string const TextCursor::selectionAsString(Buffer const * buffer, +string const TextCursor::selectionAsString(Buffer const & buffer, bool label) const { if (!selection.set()) diff --git a/src/textcursor.h b/src/textcursor.h index 5399e0caa2..739ca0da2b 100644 --- a/src/textcursor.h +++ b/src/textcursor.h @@ -30,7 +30,7 @@ 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. @@ -66,7 +66,7 @@ struct TextCursor { /// 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; diff --git a/src/toc.C b/src/toc.C index 79754f6428..f321ddb67f 100644 --- a/src/toc.C +++ b/src/toc.C @@ -63,16 +63,14 @@ string const getType(string const & cmdName) } -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) @@ -80,7 +78,7 @@ TocList const getTocList(Buffer const * buf) 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, @@ -109,7 +107,7 @@ TocList const getTocList(Buffer const * buf) } -vector<string> const getTypes(Buffer const * buffer) +vector<string> const getTypes(Buffer const & buffer) { vector<string> types; @@ -126,7 +124,7 @@ vector<string> const getTypes(Buffer const * buffer) } -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); diff --git a/src/toc.h b/src/toc.h index 13de17b454..e0f10cfa06 100644 --- a/src/toc.h +++ b/src/toc.h @@ -52,13 +52,13 @@ typedef std::vector<TocItem> Toc; 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() */ -- 2.39.2