]> git.lyx.org Git - features.git/commitdiff
Use Buffer const reference in most placees possible.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 28 Aug 2003 07:41:31 +0000 (07:41 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 28 Aug 2003 07:41:31 +0000 (07:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7623 a592a061-630c-0410-9148-cb99ea01b6c8

137 files changed:
po/POTFILES.in
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/ChangeLog
src/CutAndPaste.C
src/MenuBackend.C
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C
src/converter.C
src/converter.h
src/exporter.C
src/exporter.h
src/factory.C
src/format.C
src/format.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlChanges.C
src/frontends/controllers/ControlCharacter.C
src/frontends/controllers/ControlCitation.C
src/frontends/controllers/ControlConnections.C
src/frontends/controllers/ControlConnections.h
src/frontends/controllers/ControlErrorList.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/ControlLog.C
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlSendto.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTabular.C
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/Kernel.C
src/frontends/controllers/Kernel.h
src/frontends/screen.C
src/graphics/PreviewLoader.C
src/graphics/PreviewedInset.C
src/graphics/Previews.C
src/graphics/Previews.h
src/insets/ChangeLog
src/insets/inset.h
src/insets/insetbibitem.C
src/insets/insetbibitem.h
src/insets/insetbibtex.C
src/insets/insetbibtex.h
src/insets/insetbranch.C
src/insets/insetbranch.h
src/insets/insetcaption.C
src/insets/insetcaption.h
src/insets/insetcite.C
src/insets/insetcite.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/insetenv.C
src/insets/insetenv.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfloatlist.C
src/insets/insetfloatlist.h
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetfootlike.C
src/insets/insetfootlike.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insethfill.C
src/insets/insethfill.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetindex.C
src/insets/insetindex.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetlist.h
src/insets/insetmarginal.C
src/insets/insetmarginal.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insetnewline.C
src/insets/insetnewline.h
src/insets/insetnote.C
src/insets/insetnote.h
src/insets/insetoptarg.C
src/insets/insetoptarg.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insetspace.C
src/insets/insetspace.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettheorem.h
src/insets/insettoc.C
src/insets/insettoc.h
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/insetwrap.C
src/insets/insetwrap.h
src/lyx_cb.C
src/lyxfind.C
src/lyxfunc.C
src/lyxtext.h
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulabase.C
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/paragraph.C
src/paragraph.h
src/paragraph_funcs.C
src/paragraph_funcs.h
src/paragraph_pimpl.C
src/paragraph_pimpl.h
src/rowpainter.C
src/tabular.C
src/tabular.h
src/text.C
src/text2.C
src/text3.C
src/textcursor.C
src/textcursor.h
src/toc.C
src/toc.h

index 4942f1d64fefe58fa02133519e3c5f3e0785a943..8e758eff0c131c2d0abc379b2da3a2c086f6a9b2 100644 (file)
@@ -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
index 7c84ad5481b042fa711592c1e42caef62df3c8dc..9524b2740ec7f1a1684789356e9132febeb4e2d0 100644 (file)
@@ -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
index e9294d9423f7a3951e47e924fddaa66cd959e7a9..029c139c38cc37b8269e1b1284d7847f2219c8de 100644 (file)
@@ -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();
 
index 59716a1171ef4ff66cc460d2ae1dca7d866963f2..e7c10f33fdadc5bdfab4767e7af4e855c47f581a 100644 (file)
@@ -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_) ?
                        }
                }
index f7be9a0d7c3525931716b10d9b5aeff092e81b14..aee38a72a1c69d0bb65f54317cc3734a21e9feec 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * most files: change to use const Buffer refs
+
 2003-08-27  André Pönitz  <poenitz@gmx.net>
 
        * BufferView.[Ch]: remove getParentText, implement getParentLanguage
        * BufferView_pimpl.[Ch]: to here
        * frontends/screen.C:
        * insets/insettabular.C:
-       * insets/insettext.C: adjust  
+       * insets/insettext.C: adjust
        * rowpainter.[Ch] (paintRows): remove LyXText & argument
 
 2003-08-27  Alfredo Braunstein  <abraunst@libero.it>
 
        * BufferView.[Ch]:
        * BufferView_pimpl.[Ch] (updateInset): add an InsetOld * argument
-       
+
 2003-08-26  André Pönitz  <poenitz@gmx.net>
 
        * paragraph_func.[Ch] (outerPar): new function
@@ -36,7 +40,7 @@
        * text2.C: remove Inset::par_owner
 
 2003-08-25  Martin Vermeer  <martin.vermeer@hut.fi>
+
        * lyxrow_funcs.C:
        * lyxtext.h:
        * text.C:
@@ -45,8 +49,8 @@
 
 2003-08-25  Alfredo Braunstein  <abraunst@libero.it>
 
-       * text2.C (redoParagraphInternal, redoParagraphs): 
-       * text.C (redoParagraph): add a call to updateRowPositions at the 
+       * text2.C (redoParagraphInternal, redoParagraphs):
+       * text.C (redoParagraph): add a call to updateRowPositions at the
        end of each 'metrics-like' call. Remove all others.
        (getRow): remove the 'y-computing' version.
        (getRowNearY): do not compute nor return the real y. Solve the
@@ -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
 
        * MenuBackend.C: fix branchlist related crash
 
-2003-08-17  Martin Vermeer  <martin.vermeer@hut.fi>    
+2003-08-17  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * BranchList.[Ch]:
        * InsetList.[Ch]:
 2003-08-15  Kayvan A. Sylvan <kayvan@sylvan.com>
 
        * BufferView_pimpl.C: compile fix
-       
+
 2003-08-15  André Pönitz  <poenitz@gmx.net>
 
        * rowpainter.C: remove extra metrics calls
 
 2003-08-05  Alfredo Braunstein  <abraunst@libero.it>
 
-       * text2.C (DEPM): fix part of bug 1255 and 1256 
+       * text2.C (DEPM): fix part of bug 1255 and 1256
 
 2003-08-05  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
index ff2bea62ab27875b3733860787ba12ddac32b3a7..627067bcee7ae07c9e1d535cabe92596084643ce 100644 (file)
@@ -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;
index d5c1214887f09b7c30fc24ccb64f331faa8b693b..ef780bbc7aa32a43a7d0de61181733588cb57e58 100644 (file)
@@ -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<Branch>::const_iterator cit = params.branchlist.begin();
        std::list<Branch>::const_iterator end = params.branchlist.end();
-       
+
        for (int ii = 1; cit != end; ++cit, ++ii) {
                string label = cit->getBranch();
                int const action = lyxaction.
index 60ec4d88c65e8cf6af02d2119658c77807d9038b..7649cb69eca5f683bac2faaa4c67ec03e4a07f94 100644 (file)
@@ -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 << "<![CDATA[";
                        }
@@ -2023,7 +2023,7 @@ void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys) con
        for (inset_iterator it = inset_const_iterator_begin();
                it != inset_const_iterator_end(); ++it) {
                if (it->lyxCode() == InsetOld::BIBTEX_CODE)
-                       static_cast<InsetBibtex &>(*it).fillWithBibKeys(this, keys);
+                       static_cast<InsetBibtex &>(*it).fillWithBibKeys(*this, keys);
                else if (it->lyxCode() == InsetOld::INCLUDE_CODE)
                        static_cast<InsetInclude &>(*it).fillWithBibKeys(keys);
                else if (it->lyxCode() == InsetOld::BIBITEM_CODE) {
index 0f597d6a1a120bc6031dbdbf4ad7751ecc62f37f..de6b49f5bcaebcffb1ab80418b2b16358bd052b8 100644 (file)
@@ -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();
index 4d0b6e8760309c042c79df96b3284c10666f44e7..1742f69441c020af5e37ae6eb58933d8388546aa 100644 (file)
@@ -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());
index 1ccbbccfec22c32691495d1aacb62865cb19a0db..f5a6c8ffdecd65ee22df7efa8ec0ef21b97a7979 100644 (file)
@@ -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 |
index 7b3202a55517650f8a659f1e10aec555825c77ee..943e03e9a361497cd2da749a5b80fffacd1391f1 100644 (file)
@@ -126,10 +126,10 @@ private:
        std::vector<Format const *> const
        Converters::intToFormat(std::vector<int> const & input);
        ///
-       bool scanLog(Buffer const * buffer, string const & command,
+       bool scanLog(Buffer const & buffer, string const & command,
                     string const & filename);
        ///
-       bool runLaTeX(Buffer const * buffer, string const & command,
+       bool runLaTeX(Buffer const & buffer, string const & command,
                      LatexRunParams const &);
        ///
        ConverterList converterlist_;
index 5f81ff01a30296876c8a7d0c05f556b6e387bca7..2f3ee4068372b1b86b5b266b16af9f29aca4c279 100644 (file)
@@ -36,11 +36,11 @@ using std::find;
 
 namespace {
 
-vector<string> const Backends(Buffer const * buffer)
+vector<string> const Backends(Buffer const & buffer)
 {
        vector<string> v;
-       if (buffer->params.getLyXTextClass().isTeXClassAvailable())
-               v.push_back(BufferFormat(*buffer));
+       if (buffer.params.getLyXTextClass().isTeXClassAvailable())
+               v.push_back(BufferFormat(buffer));
        v.push_back("text");
        return v;
 }
@@ -54,7 +54,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        string backend_format;
        LatexRunParams runparams;
        runparams.flavor = LatexRunParams::LATEX;
-       vector<string> backends = Backends(buffer);
+       vector<string> backends = Backends(*buffer);
        if (find(backends.begin(), backends.end(), format) == backends.end()) {
                for (vector<string>::const_iterator it = backends.begin();
                     it != backends.end(); ++it) {
@@ -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<string> backends = Backends(buffer);
        for (vector<string>::const_iterator it = backends.begin();
@@ -149,7 +149,7 @@ bool Exporter::IsExportable(Buffer const * buffer, string const & format)
 
 
 vector<Format const *> const
-Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
+Exporter::GetExportableFormats(Buffer const & buffer, bool only_viewable)
 {
        vector<string> backends = Backends(buffer);
        vector<Format const *> result =
index 64db46612ae9cd3eb8302238a0316bf04f4a599e..629d7f473f6e783603a428300363b4ba6ea5b5da 100644 (file)
@@ -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<Format const *> const
-       GetExportableFormats(Buffer const * buffer, bool only_viewable);
+       GetExportableFormats(Buffer const & buffer, bool only_viewable);
        ///
 };
 #endif
index 617ccc7d9147988a8a05ac99631ec318542cf130..18bbb04dc2c8d494653f85ef8f2cc5eee337caec 100644 (file)
@@ -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;
index 869bfb4d52ff02bf40a30f048cd054240236fcd6..d69d4ecb12a5a5d6fa19b2f06a89981db9fefa84 100644 (file)
@@ -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;
index c4ca8f4095cadee0bfeb191bc9fdb0aa22458d1a..f95224bab422e33192b37c8c23054786229ae498 100644 (file)
@@ -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;
index fe38f3ed82ac850e19bfbd4510d125459105e7c9..3d20043222948da1051868d87dc03c5f5c64499d 100644 (file)
@@ -1,11 +1,14 @@
+2003-08-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
-2003-08-16  Martin Vermeer  <martin.vermeer@hut.fi>    
+       * most files: change to use const buffer refs.
+
+2003-08-16  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * ControlBranch.[Ch]:
        * ControlDocument.C:
        * Makefile.am: implements the 'branch
-       inset' idea. This allows the output of various versions of a 
-       document from a single source version, selectively outputing or 
+       inset' idea. This allows the output of various versions of a
+       document from a single source version, selectively outputing or
        suppressing output of parts of the text.
        This implementation contains a 'branch list editor' in a separate
        tab of the document settings dialog. Branches are user definable
@@ -38,7 +41,7 @@
 2003-07-30  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * ControlNote.[Ch]: add i18n support.
-       
+
 2003-07-27  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * ControlToc.C (goTo): adjust for lyx::toc
index 7b9884511123b27fcb6dbcc016f5a55d14eccd16..5690ad30ae27989bf8aff122866c31d010b79c31 100644 (file)
@@ -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());
 
index 2d180a9b4fecb8b2bf8eebd85e46f002dea00b53..718d67d0b773b4293c6f726d8f9f0b54d87d6824 100644 (file)
@@ -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));
index c7710ae69f431f6ef6a662ad9d0c3cefa7fc4154..9a741df9a379df38f23c0e525a1add3908f8b36f 100644 (file)
@@ -32,7 +32,7 @@ bool ControlCitation::initialiseParams(string const & data)
        ControlCommand::initialiseParams(data);
 
        vector<pair<string,string> > blist;
-       kernel().buffer()->fillWithBibKeys(blist);
+       kernel().buffer().fillWithBibKeys(blist);
 
        typedef std::map<string, string>::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<string> const ControlCitation::getCiteStrings(string const & key) const
        vector<biblio::CiteStyle> const cs =
                biblio::getCiteStyles(usingNatbib());
 
-       if (kernel().buffer()->params.use_numerical_citations)
+       if (kernel().buffer().params.use_numerical_citations)
                styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
        else
                styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);
index 1f46435779d518bebdabd34d5b429892919dd2b6..322de9263cd6762f472e72e20d23d1a1693bdfcd 100644 (file)
@@ -84,9 +84,9 @@ Buffer * ControlConnectBase::buffer()
 }
 
 
-Buffer const * ControlConnectBase::buffer() const
+Buffer const & ControlConnectBase::buffer() const
 {
-       return lv_.buffer();
+       return *lv_.buffer();
 }
 
 
index c763167aa0652b680dd4fbed6150786e2581da32..b37ff9c7e3bba946caa6633cab51435fbdb91825 100644 (file)
@@ -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();
        ///
index 044f61046705a6cb5a45612e38b75113c5eb3bf6..a4eee56d3b8b126e47ec7737fad533d8d268b24d 100644 (file)
@@ -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;
        }
index 42ea2b049b64a97f9ae3f4efe0d946d7abce4a66..5097b18d254c711fdaf1494432e52d8229707b5a 100644 (file)
@@ -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));
 }
 
index 8abe31dae2b76f5ae2ca3cf5b03e3e7c6d5a4316..4133c5b9587574a3d3ed2d590683b072e73bb8f5 100644 (file)
@@ -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));
 }
 
index d4e69aba591c95420d654287d54c153e94da0825..1c4a590c9fb4c4e6793100e6a519a55e63fa7887 100644 (file)
@@ -21,7 +21,7 @@ ControlLog::ControlLog(Dialog & parent)
 
 bool ControlLog::initialiseParams(string const &)
 {
-       logfile_ = kernel().buffer()->getLogName();
+       logfile_ = kernel().buffer().getLogName();
        return true;
 }
 
index 2cb096f7235920a685469fece3a54c8615cbffe2..23c57b569ad6f67c34246b7d00e54c6539b71a16 100644 (file)
@@ -33,11 +33,9 @@ ControlRef::ControlRef(Dialog & d)
 
 vector<string> const ControlRef::getLabelList(string const & name) const
 {
-       Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
-       if (!buf)
-               buf = kernel().buffer();
+       Buffer const & buf = *bufferlist.getBuffer(MakeAbsPath(name));
        vector<string> list;
-       buf->getLabelList(list);
+       buf.getLabelList(list);
        return list;
 }
 
@@ -70,7 +68,7 @@ vector<string> const ControlRef::getBufferList() const
 int ControlRef::getBufferNum() const
 {
        vector<string> buffers = bufferlist.getFileNames();
-       string const name = kernel().buffer()->fileName();
+       string const name = kernel().buffer().fileName();
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
        if (cit == buffers.end())
index e5874c056dd569efd0e39563f5df4345304dfc9c..f39e2ab04e8286518e3c28ee932a9af47717aeb1 100644 (file)
@@ -43,13 +43,15 @@ vector<Format const *> 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
index e8802c35f6f001fc877b927345af088cd41d5fab..eee37433f1a3cee7ce6f38843632a0da35e1d643 100644 (file)
@@ -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) {
index 1f33daa09f9c9818ba7cf696dc43c33db01234d3..253a2ce58358c8be2e678a76ab6a9686b5223480 100644 (file)
@@ -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));
index d5ed84deaeeb27d029b1f31b0501fcdb6c3fd857..0964e7b20f2867001939b8de32132a95cde8e187 100644 (file)
@@ -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());
 
index 5a1d6b20bbc2d43037e64d329110a18e88d650d6..ee39718eaabbe7dec9ecbd7aa8c207de77b33827 100644 (file)
 #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();
 }
index 45b2c4964aa9d2fd82c38db7efe417c7990f8513..9e35603ef218a0dc0d0cb74a6e32ff2b21432d48 100644 (file)
@@ -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;
index 8134d61ea23b2dc7657fa78af84d74a4d9bba81e..66826c0d18a3e1ee9a796d69e310a8e1e076507d 100644 (file)
@@ -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();
 
index 772a9abaf13e7d0cc5c57a68e501509cc2ccbc8e..2e96ca3f4313621d972a47b052b054327f0ecc13 100644 (file)
@@ -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
index 47ac36ae6fb522fab923e9ff2e9ce549b3e9ea12..52741234878f4205e4c5b090570d5cf615d50f76 100644 (file)
@@ -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_);
        }
 
index b5ec0f4bd719ba5d225c425a70d50df97b57023f..0cbd21b39847aed4c137da5cee547685de64fcc4 100644 (file)
@@ -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();
index 9c454d1e5d8e880b294697a2aec62a4964071f49..630b49f8140ff7e6c349aa4b919b4b2e070552cc 100644 (file)
@@ -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
index 4b3d230a1ebdea715d089dd39695467891cb9018..0a7cf3e439c62d7b9b1ae152afcaa05379cb3886 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * most files: change to use const Buffer refs
+
 2003-08-26  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * insetfootlike.C: whitespace.
@@ -48,7 +52,7 @@
 
        * insetref.C: require amsmath for eqref
 
-2003-08-17  Martin Vermeer  <martin.vermeer@hut.fi>    
+2003-08-17  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * Makefile.am:
        * inset.h:
index 414c78b22e469981bad6f858a3f8ee86ff8492b0..4ccb05d740b4dc0011dcc1d06e73c7dc6755fa51 100644 (file)
@@ -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; }
index ff10c841a7a3efae5a6eceb7424f367b456d6327..a9d5fde47f9dcd5c2e7a97496389f9cc06c9e2f9 100644 (file)
@@ -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()) {
index d0f0b4f2dc6a2d3cae2bc2e95173bf48d7d47d2b..c2d5797ab6d6f846eddb27b8db98a6cf5e0f118e 100644 (file)
@@ -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; }
        ///
index 8603d09d381378584f5c4ab3be995289038bede4..80d2cd832c942a129df44fc1f7924fd641b2b839 100644 (file)
@@ -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<string> 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<std::pair<string, string> > & keys) const
 {
-       Assert(buffer);
-       vector<string> const files = getFiles(*buffer);
+       vector<string> const files = getFiles(buffer);
        for (vector<string>::const_iterator it = files.begin();
             it != files.end(); ++ it) {
                // This is a _very_ simple parser for Bibtex database
index c5ac7ba795e1e4f24d1b75d57573df527a7761da..9911bf48a56bae01bc89d6623b4cbca2606a251c 100644 (file)
@@ -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<std::pair<string,string> > & keys) const;
        ///
        std::vector<string> const getFiles(Buffer const &) const;
index c059cea72eb756050775a9b310b6c3b6cd5489bf..655d3694c01f6e79f9474815d0fc1aaaeaa1e3c5 100644 (file)
@@ -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();
        }
 }
-
index 6b0526d62adb6e2880489981ed49c72108d858e9..dc42e85a48f0e59c5639134e83f3ca73809b7027 100644 (file)
 #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<InsetBase> clone() const;
        ///
        string const editMessage() const;
        ///
        InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
        ///
-       void write(Buffer const *, std::ostream &) const;
+       void write(Buffer const &, std::ostream &) const;
        ///
-       void read(Buffer const * buf, LyXLex & lex);
+       void read(Buffer const & buf, LyXLex & lex);
        ///
        void setButtonLabel();
        ///
        bool showInsetDialog(BufferView *) const;
        ///
-       dispatch_result localDispatch(FuncRequest const &);
+       dispatch_result localDispatch(FuncRequest const &);
        ///
-       int latex(Buffer const *, std::ostream &,
-                       LatexRunParams const &) const;
+       int latex(Buffer const &, std::ostream &,
+                       LatexRunParams const &) const;
        ///
-       int linuxdoc(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const &, std::ostream &) const;
        ///
-       int docbook(Buffer const *, std::ostream &, bool) const;
+       int docbook(Buffer const &, std::ostream &, bool) const;
        ///
-       int ascii(Buffer const *, std::ostream &, int) const;
+       int ascii(Buffer const &, std::ostream &, int) const;
        ///
        void validate(LaTeXFeatures &) const;
        ///
        InsetBranchParams const & params() const { return params_; }
        ///
        void setParams(InsetBranchParams const & params) { params_ = params; }
-       
+
 private:
        friend class InsetBranchParams;
 
index 81466a5f4145c977b719d48fb7c7947414730f6e..3bc71ac4d7e4d4d592e9e45937bacb64b0e0c640 100644 (file)
@@ -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 << "<title>";
index c62e20ec5b8192d507ff312960521e4c15e71a69..eecdf464ff7ae75a993b6319b37e7a39c31c1f37 100644 (file)
@@ -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;
 };
 
 
index 4c687d9e2ec70c88c119a8a1a8c5628966b2314f..d0cf1c7f48fcd67b11648f54060fde98466353a9 100644 (file)
@@ -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 << ']';
index 21a568c83a692c3067cf8eece4db60cef1e19fa2..a38e133f62677d576394d4e759041a7f4cb55732 100644 (file)
@@ -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;
index f8a4d2fcd50d2a6edb157823168c7422615d9b0d..2ea0f2f90849f8cb7054bd34af923db364f9cd47 100644 (file)
@@ -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);
 }
index f67f44112726e38a3711f57bcc43be13ff0dd2b7..b50e61dadb05c94ea3aa2e9b9783909dd81731b4 100644 (file)
@@ -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
index 009119d21dc121290fd5a0e984579aa105b92474..f09ff6369b8e4c15a223a0072e3b1374c625d4fd 100644 (file)
@@ -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;
 }
index 822ab18cd6f229396bdc7e0626fa7ebc33ad2412..489c68e7a782ac12a23c4f7ebb641228cffb7b2a 100644 (file)
@@ -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:
        ///
index c180a8f7819f6ff068d209eee394b3a5d442ddcf..86bfc50a773cb35d73e83199c4992a0ec7d61615 100644 (file)
@@ -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;
index 58c50bfeded0830a5ebd7feba2047257bb53626c..5a1758f1cdb0414ab21910be21e57f2b5fab9ad9 100644 (file)
@@ -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;
index a0a7071fdd4b15d7435bed97b4c87e3b55d15f77..5cc6ba64c99498d76d9eda6e9c11573953c2ebf0 100644 (file)
@@ -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();
index 064455d0a6eaace31121963bab360456d500dd2f..7c9868123d88b1de7f7572b28318adaa0af8f327 100644 (file)
@@ -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 {}
        ///
index 84167ff165a35fd42d49bbe5e9c2a04238f5b60a..126eb3065179d7d10bbdca2f7497825542257063 100644 (file)
@@ -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());
 }
index 68aa10af4c40bce9ee79f817e9227815c8ef38ab..ee84b58304b0c4bb45c9840542acdce03c64efb2 100644 (file)
@@ -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
index b46e114f5e48e2a0a393a9d5104e224405ea4f16..197de9e4106c1d37bce6c0a46b31ce73738cf675 100644 (file)
@@ -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);
index 904d50fdd052081fb5db59a2975abe0916d2c487..e1000de62908164ab14c17f6437f77bfb84e73de 100644 (file)
@@ -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;
        ///
index 8d3c16fec3c0e7561d5628cc989a00d0e0dd1539..72289b435c5df1a19ec6b8d04914cb61a4d26e6b 100644 (file)
@@ -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";
 
index 04b6a17544af2ef7bfd4fc531f0a59079ea296f4..b4d14e035ca316fc8f232af2ac828fc01f1f4625 100644 (file)
@@ -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:
index 9dd6fe202effff6baa60da3329abe4f2cdfb3439..cc047e2a9ba47912eab93372b4441aa760fcd22d 100644 (file)
@@ -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);
index 647cdc93c43b980669ac05a6e6c4ed291df57507..600ad8bcd2dc74211b36a56a158dbe6034823218 100644 (file)
@@ -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;
 };
index bf3ac571f2ff95042b424d8f2ef7ae25c8b49a00..63c55040a9b8ebf893d00a4d75cfd5a9986aac67 100644 (file)
@@ -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);
index 36f7bcf06afb740145c0febff872bee5f66ec517..c6489f53d399b392d87e7c1b3578451f2cefde47 100644 (file)
@@ -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
index 0c67703e80329a67b3d3bcd30a2d893a0989bb64..647e9c525a480e9e246d2aed72c144b1c02081b2 100644 (file)
@@ -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
index 99111e565e8b1b867cb57b9857003194010ef0d2..e35ecaec8bbb6d4ac9bc8534fc69a0f7315653c3 100644 (file)
@@ -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_;
index cd3e8a420918970a2f81fc83e2a729d8b79844f3..07007bd038e57d0b9be656e43021315aaf9403b1 100644 (file)
@@ -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";
 }
index eb2359be044aa8dd641cb1489b03a5a85b1c4848..7951275c05d28f5e7a40fce4ef4b0fc2cc4dc1b3 100644 (file)
@@ -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; }
 };
index 1dceaaedd603e548056066acf94aa23255d56498..7e1af317bb7dacbda3fa09b1a6df5150e1f5c601 100644 (file)
@@ -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());
 }
index 3f55c76d551a21aca720add81c4632fe8f08c2b1..4e90013fddb0424aeebdfa50652a605b341a1796 100644 (file)
@@ -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
index 111a83800eb7b8125092e32f8904bd17a345c9ef..be034b8a9cd024b4f021e1609474ad9b0cddd877 100644 (file)
@@ -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");
 }
index cb90a519cae83241b5465b00d7facbad1cba4bfe..4676ac8b24e09a5e212309cb75911f1f663bcdba 100644 (file)
@@ -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; 
        ///
index 1d164b0c20d2ed0be83e68a941f139d3e5044a9e..1554760f81a4fb127833e8ff7db978e902abde85 100644 (file)
@@ -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;
index 32a12788baf4e02076f2be54d2d0ed35b50e333f..60af5c7f6b26cc7ea73f514311300e700743cc78 100644 (file)
@@ -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
index eff62bd10e9807dfe654091b8fa85341123ca2dc..a0a364ce29d118069aa7890c27dc963cd4dedf78 100644 (file)
@@ -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;
index 7c7ea976ed162bd5001271c2dbb1b87462125995..c209f379158745d887e0dc0cd086d66b6621889b 100644 (file)
@@ -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;
        ///
index 8b130f2063d75e787b0e895847287ec96d6260e7..ae460312410763cf6404889e5f466b66e461972c 100644 (file)
@@ -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;
index 73e0687f775e5966ab32b13d20d929f64fc16985..853219bf143e23f40ead018b96cfe6cfafd7caec 100644 (file)
@@ -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{";
index 271f39574076e0606bf11a0a1997f9ab1f5029ea..a1cbfa0016f09d040c9be823e9e2b53f439f2052 100644 (file)
@@ -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;
index 5111184a345a22f39f885c21fad20e4166fa35a2..ecf9ed6d81d7f6fc050ba69e24f608eb6b810fa0 100644 (file)
@@ -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;
index 07a65cc1f1502bd0917f9120cd5e4b982a621bc6..1a2efe1265edbf04634670d2eef6ad2911865003 100644 (file)
@@ -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;
index 1a0074ad0247619770d7b3c3e2b94e033435e8b3..eb7db91402833c2f44ba9a836b35166c33c8d7f7 100644 (file)
@@ -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;
index 3c8644bbaaab5ab1a42e1911bb553b245f74fd52..855a5bacad17e9a11abdc330a9a6e92664906b7c 100644 (file)
@@ -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; }
 };
index efa2de5d91761358f3819030c4beb4cff4e6c19a..ad66b0f92c8f430cd9c70545ecfd6a0cbf8759a6 100644 (file)
@@ -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;
index 2c7c0473a41f691398bbda07d83a2a13ceae678d..9924c0c7fc8139384dc13c9c196aeb4bb29c8d18 100644 (file)
@@ -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;
        ///
index 5cc80dc4298e69fa570efe549a8eee7cdfcd6557..a1f92a5805c03b9cb2418281a29775f05224a671 100644 (file)
@@ -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 << '[';
index 3f53aeccf5751de267318fa5616711ac8d00a575..6abba7f9342ae211363153e2bfdc41cd1cc94a3a 100644 (file)
@@ -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
index 90e611627a15e372221c77a43ceadc278fe1cbfc..6e094c0a278ada61db898055cb67212963156821 100644 (file)
@@ -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)
index 18d0c271a829b9fdffedb04fdab77454179ff1d6..e7068f10dadb946ee3f43609cdd9f43544a2e9a0 100644 (file)
@@ -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;
        ///
index 56bde45fb579f2a63aabd7e8c3f8547532721240..c4affe9143683c3378234f064257c5691d60b0fb 100644 (file)
@@ -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() << "\">";
index e58110c414759446e2cdf8db8992e18ddd96e168..69dff7cac5392c9e45380e501e328ec86f4b1c5c 100644 (file)
@@ -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:
index dad2c9636d894898895212050a58fe3b7867af72..801bf188bd99d602ac500d167d3fa77063ba8f99 100644 (file)
@@ -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:
index 67c92943467415e1369cc97d6e4ce611240d212d..e8c0fc829e1ce66ea7e6c398a02faa3e02382700 100644 (file)
@@ -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;
        ///
index 08f08897516e7c39567cca48cd1ce23d1c183ee0..018ac6763e3de80193be15bd41a227769b13759b 100644 (file)
@@ -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:
index 7f7391629e00619cff63feee6676f02ce5e1f0f9..cddd3e237f0a2f7c5b4051956b3753b8f57e31f2 100644 (file)
@@ -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;
        ///
index fd20f0a99de6fad60a171cc94bc6f9abc0b30b5c..fc9b4834a284dd3366922c95cdc6047e3c6219b9 100644 (file)
@@ -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';
index fef1a0f1c80a02877c086e0938adb27d7af28111..f3f6781e7120f35dcc35f1d15190b10e9b7b7b4c 100644 (file)
@@ -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);
index 53e160cc790e62f2f78295b5f147e1d039306bac..eb69bb6640fdcefa6713aa8e43f6cfc86ba85c07 100644 (file)
@@ -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();
 }
index 70558ed3427dafa60b6f54177549ff359fa2d809..6c8b773dca3f647db1dc209829afde145bac6032 100644 (file)
@@ -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);
        ///
index f4d2d3ed731a776d8d5c109114d35cc85cad4b33..465479ba0b5d970b5236d26db124e8ff9c7537ba 100644 (file)
@@ -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;
index 8c8f732c588e1ec3074da680e807d5b617bd6d34..53cb0189c0f39327a5f760ecdae76152b5b9827a 100644 (file)
@@ -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>";
index 465c6cf5a810b28cea1bec3cfd344fae8de189b0..77ce3e338ea216c3321c24b046dd3434fe279fb7 100644 (file)
@@ -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_;
index 619e8b5dbb958c13af5c6e46c2088a91d6fe8e25..c60b5f620bbf10421ddc6b2c6df4dd64a3657239 100644 (file)
@@ -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(),"&","&amp;")
           << "\">" << getOptions() << "</ulink>";
index a9a82a1279ccb5c27e39a4b0700d9474c483aae7..94a6e446cd2a438c88d737ca67fbaf491e1a9754 100644 (file)
@@ -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
index 77b59e2a8c8bc3954640f9a9c05c8b457761756f..8eb58801b3783318a2da48e175770c6bac3fb9fb 100644 (file)
@@ -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);
index 223f9be437c55610f8cbcb3464bfe792d9094f38..4e78a2d634ec368ad643a2b068af0231a25781de 100644 (file)
@@ -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;
        ///
index d148852bc185468a9dbc228377dd3af2392e5a16..2699d8156d53ec4972fc5199c9a311ed760310de 100644 (file)
@@ -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;
index 9b3b2d01063ac13639be7ebc28b7b8a00ea8c628..fe37598adb0a24526c7145427b938958053c54a6 100644 (file)
@@ -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) ||
index 603dbf47b61c503b6f30a50d48a022320fbf4a7f..8ee9a726b52ede8da419ae72b82eeb911b8818d0 100644 (file)
@@ -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);
 }
-
index abf6aae77f838cee6d1c41d4515210a8d6433d88..6fbbc6f7db5ccd962da6e3ea65ddd708ddc8f11d 100644 (file)
@@ -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();
        ///
index 3feae06bb574bdd0dec668d79550818ca8ca72f6..724152d0b9615a021ac9cb096b2146010a6f8cd7 100644 (file)
@@ -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.
index a2bd901a526370b96aa3a8f2457b6ece30430662..524d8f2bfc9d1a47c90f03198b762c94b8227610 100644 (file)
@@ -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.
index 415eba86b3a2d54f7a141f50516062b88d398f83..f2b3e2fe69904c7a9947430936798c6871d8c18a 100644 (file)
@@ -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;
index 004e04502505d1239daedaf2990e7d6a4c249c6a..1676e73cde80bb232dc8032d463d426e944f3314 100644 (file)
@@ -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);
index 39ab9325401bde56f23a94e7d151e9f8f2577d76..6e0bc6b8ef6377e8eee364cb2f185202add1475b 100644 (file)
@@ -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());
 }
index 0db2759a0c7b8682d637202d3ad90dab310388c9..34bfc15e9d920b762c07696897add7d448ed0f45 100644 (file)
@@ -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;
index 3fb2ea1194108ed0b9469f6901c30ce940123efc..ccd07dab819bd54ea80bd506c54535dc27373e7a 100644 (file)
@@ -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)
index f668965f1bd31cfa6af515cec0beb8ee0d6be54c..6f0c26648dcfeef62b8c697e26b92c5959717115 100644 (file)
@@ -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 &);
 
index 5001c4cbe5b651e5c9777a2d0e3f3b0ff01b527e..c13bf6e706ee48188bda7c738fdb1db24e894b57 100644 (file)
@@ -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);
index 85910c94533a2d779f67d64aafd62431e622cd7e..7a7c763f0dbc0f640b6ff3751388ed9b65720815 100644 (file)
@@ -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,
index 399d528b988ef66b65711264782daa06edd464bd..8c0573d7ee34895561e251244f640e1f262bad60 100644 (file)
@@ -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,
index 26d2b0c3d9e0a692f59a70b51630d9f6522502e7..e636af459d30a377dafd30e7899ac4a4a33c4e4c 100644 (file)
@@ -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,
index 1e4e9e26c7c11665b9be901baac361db84999a7a..a59e8385bbda8be267fc7b6cb4aaada930b43ce6 100644 (file)
@@ -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);
 }
-
-
index f08fe4fdf9b8b3d482de9ec5716c26e6cad673bc..10e0b797ae4f84c7e10221b1a97a1c68d1d56022 100644 (file)
@@ -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;
index 62c4c658da2ecde16970a1217272fe2e7e3fbceb..c2ac148da6805277dc5041288b0d44e82735ff3f 100644 (file)
@@ -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
index 65429e1e8bc92ddacba1f504f73f9de9aff12151..b558bd680bd85cf59d01cf5ed6777ffc78bb4f77 100644 (file)
@@ -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);
index da8ebec8b1f50a237988883d2c6dd584a3ab15f7..2675333c6d95da86568412629036ffe15d908d42 100644 (file)
@@ -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;
 
index 35cacddf2f6c084ecfe04f1b15f069e771fb6d96..98dd18cc0b03aeaa0c6bafad2268e7657aa80040 100644 (file)
@@ -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())
index 76002a388456fa7f7155335d665669858abd8c90..c8d225990cfb841ba36252ead1ee1b1ab284b6bb 100644 (file)
@@ -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())
index 5399e0caa23b9c721cf7b177791e29bc6dcd890d..739ca0da2b46eeaf69fa047236c2c85a7efa7df3 100644 (file)
@@ -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;
index 79754f642867d6269b998e7159ce585774ab88ca..f321ddb67fb135405b9e3371bd9d1efd4d91a791 100644 (file)
--- 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);
index 13de17b454725003698e233d79d52144814ccf21..e0f10cfa06f7cb0435d95001b2694db70cf47f27 100644 (file)
--- 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() */