From d8a6b5bfd0baa02a4ba03f8c9e9c618baf41b03f Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 28 Feb 2008 01:42:02 +0000 Subject: [PATCH] Remove TextClassPtr without losing the type safety it provided. See these threads: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg136112.html http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg136062.html http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg135997.html for some background. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23299 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/scons_manifest.py | 1 - src/Buffer.cpp | 14 ++++---- src/BufferParams.cpp | 39 +++++++++++----------- src/BufferParams.h | 28 ++++++++-------- src/BufferView.cpp | 2 +- src/CutAndPaste.cpp | 52 ++++++++++++++++------------- src/CutAndPaste.h | 9 +++-- src/LaTeXFeatures.cpp | 12 +++---- src/LyXFunc.cpp | 22 ++++++------ src/LyXFunc.h | 4 +-- src/Makefile.am | 1 - src/MenuBackend.cpp | 8 ++--- src/Paragraph.cpp | 4 +-- src/ParagraphMetrics.cpp | 2 +- src/Text.cpp | 18 ++++------ src/Text2.cpp | 4 +-- src/Text3.cpp | 17 +++++----- src/TextClass.cpp | 22 +++++------- src/TextClass.h | 45 +++++++++++++++---------- src/TextClassPtr.h | 22 ------------ src/TextMetrics.cpp | 2 +- src/TocBackend.cpp | 4 +-- src/buffer_funcs.cpp | 4 +-- src/factory.cpp | 8 ++--- src/frontends/qt4/GuiDocument.cpp | 4 +-- src/frontends/qt4/GuiToc.cpp | 2 +- src/frontends/qt4/GuiToolbar.cpp | 2 +- src/frontends/qt4/GuiToolbars.h | 5 ++- src/insets/Inset.cpp | 2 +- src/insets/InsetBibitem.cpp | 2 +- src/insets/InsetBibtex.cpp | 5 ++- src/insets/InsetBox.cpp | 2 +- src/insets/InsetBranch.cpp | 4 +-- src/insets/InsetCaption.cpp | 6 ++-- src/insets/InsetCollapsable.cpp | 18 +++++----- src/insets/InsetCollapsable.h | 10 ++---- src/insets/InsetERT.cpp | 3 +- src/insets/InsetEnvironment.cpp | 2 +- src/insets/InsetFlex.cpp | 6 ++-- src/insets/InsetFlex.h | 2 +- src/insets/InsetFloat.cpp | 4 +-- src/insets/InsetFloatList.cpp | 6 ++-- src/insets/InsetFoot.cpp | 2 +- src/insets/InsetInclude.cpp | 6 ++-- src/insets/InsetInfo.cpp | 2 +- src/insets/InsetListings.cpp | 2 +- src/insets/InsetNote.cpp | 2 +- src/insets/InsetTabular.cpp | 6 ++-- src/insets/InsetText.cpp | 2 +- src/insets/InsetWrap.cpp | 2 +- src/output_docbook.cpp | 4 +-- src/output_latex.cpp | 8 ++--- src/paragraph_funcs.cpp | 4 +-- src/sgml.cpp | 4 +-- 54 files changed, 223 insertions(+), 250 deletions(-) delete mode 100644 src/TextClassPtr.h diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 485d5ae27a..5314186d11 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -113,7 +113,6 @@ src_header_files = Split(''' TexRow.h Text.h TextClass.h - TextClassPtr.h TextMetrics.h Thesaurus.h TocBackend.h diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 3a6109c6c3..2031d6a66f 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -522,7 +522,7 @@ int Buffer::readHeader(Lexer & lex) s, -1, 0, 0)); } - params().makeTextClass(); + params().makeDocumentClass(); return unknown_tokens; } @@ -1186,19 +1186,19 @@ void Buffer::writeLaTeXSource(odocstream & os, bool Buffer::isLatex() const { - return params().textClass().outputType() == LATEX; + return params().documentClass().outputType() == LATEX; } bool Buffer::isLiterate() const { - return params().textClass().outputType() == LITERATE; + return params().documentClass().outputType() == LITERATE; } bool Buffer::isDocBook() const { - return params().textClass().outputType() == DOCBOOK; + return params().documentClass().outputType() == DOCBOOK; } @@ -1229,7 +1229,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname, d->texrow.reset(); - TextClass const & tclass = params().textClass(); + DocumentClass const & tclass = params().documentClass(); string const top_element = tclass.latexname(); if (!only_body) { @@ -1284,7 +1284,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname, << " file was created by LyX " << lyx_version << "\n See http://www.lyx.org/ for more information -->\n"; - params().textClass().counters().reset(); + params().documentClass().counters().reset(); loadChildDocuments(); @@ -2535,7 +2535,7 @@ vector Buffer::exportableFormats(bool only_viewable) const vector Buffer::backends() const { vector v; - if (params().textClass().isTeXClassAvailable()) { + if (params().documentClass().isTeXClassAvailable()) { v.push_back(bufferFormat()); // FIXME: Don't hardcode format names here, but use a flag if (v.back() == "latex") diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index bed6a23deb..14389a7f7a 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -315,7 +315,7 @@ BufferParams::BufferParams() : pimpl_(new Impl) { setBaseClass(defaultBaseclass()); - makeTextClass(); + makeDocumentClass(); paragraph_separation = PARSEP_INDENT; quotes_language = InsetQuotes::EnglishQ; fontsize = "default"; @@ -483,7 +483,7 @@ string const BufferParams::readToken(Lexer & lex, string const & token, // FIXME: this warning will be given even if there exists a local .cls // file. Even worse, the .lyx file can not be compiled or exported // because the textclass is marked as unavilable. - if (!textClass().isTeXClassAvailable()) { + if (!documentClass().isTeXClassAvailable()) { docstring const msg = bformat(_("The layout file requested by this document,\n" "%1$s.layout,\n" @@ -820,7 +820,7 @@ void BufferParams::writeFile(ostream & os) const void BufferParams::validate(LaTeXFeatures & features) const { - features.require(textClass().requires()); + features.require(documentClass().requires()); if (outputChanges) { bool dvipost = LaTeXFeatures::isAvailable("dvipost"); @@ -862,7 +862,7 @@ void BufferParams::validate(LaTeXFeatures & features) const // AMS Style is at document level if (use_amsmath == package_on - || textClass().provides("amsmath")) + || documentClass().provides("amsmath")) features.require("amsmath"); if (use_esint == package_on) features.require("esint"); @@ -903,7 +903,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, { os << "\\documentclass"; - TextClass const & tclass = textClass(); + DocumentClass const & tclass = documentClass(); ostringstream clsoptions; // the document class options. @@ -1244,7 +1244,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // hyperref, see // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html if (language->lang() == "japanese-plain" && - !textClass().provides("japanese")) { + !documentClass().provides("japanese")) { //load babel in case it was not loaded due to an empty language list if (language_options.str().empty()) lyxpreamble += "\\usepackage{babel}\n"; @@ -1262,7 +1262,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // use hyperref explicitely when it is required if (features.isRequired("hyperref")) { odocstringstream oss; - pdfoptions().writeLaTeX(oss, textClass().provides("hyperref")); + pdfoptions().writeLaTeX(oss, documentClass().provides("hyperref")); lyxpreamble += oss.str(); } @@ -1371,19 +1371,20 @@ bool BufferParams::hasClassDefaults() const } -TextClass const & BufferParams::textClass() const +DocumentClass const & BufferParams::documentClass() const { - return *textClass_; + return *doc_class_; } -TextClassPtr BufferParams::textClassPtr() const { - return textClass_; +DocumentClass * BufferParams::documentClassPtr() const { + return doc_class_; } -void BufferParams::setTextClass(TextClassPtr tc) { - textClass_ = tc; +void BufferParams::setDocumentClass(DocumentClass const * const tc) { + // evil, but this function is evil + doc_class_ = const_cast(tc); } @@ -1408,9 +1409,9 @@ BaseClassIndex BufferParams::baseClass() const } -void BufferParams::makeTextClass() +void BufferParams::makeDocumentClass() { - textClass_ = TextClassBundle::get().newClass(baseclasslist[baseClass()]); + doc_class_ = &(DocumentClassBundle::get().newClass(baseclasslist[baseClass()])); //FIXME It might be worth loading the children's modules here, //just as we load their bibliographies and such, instead of just @@ -1427,7 +1428,7 @@ void BufferParams::makeTextClass() "probably need to reconfigure LyX.\n"), from_utf8(modName)); frontend::Alert::warning(_("Module not available"), msg + _("Some layouts may not be available.")); - lyxerr << "BufferParams::makeTextClass(): Module " << + lyxerr << "BufferParams::makeDocumentClass(): Module " << modName << " requested but not found in module list." << endl; continue; @@ -1440,7 +1441,7 @@ void BufferParams::makeTextClass() frontend::Alert::warning(_("Package not available"), msg); } FileName layout_file = libFileSearch("layouts", lm->getFilename()); - if (!textClass_->read(layout_file, TextClass::MODULE)) { + if (!doc_class_->read(layout_file, TextClass::MODULE)) { docstring const msg = bformat(_("Error reading module %1$s\n"), from_utf8(modName)); frontend::Alert::warning(_("Read Error"), msg); @@ -1479,7 +1480,7 @@ void BufferParams::clearLayoutModules() Font const BufferParams::getFont() const { - FontInfo f = textClass().defaultfont(); + FontInfo f = documentClass().defaultfont(); if (fontsDefaultFamily == "rmdefault") f.setFamily(ROMAN_FAMILY); else if (fontsDefaultFamily == "sfdefault") @@ -1929,7 +1930,7 @@ biblio::CiteEngine BufferParams::getEngine() const { // FIXME the class should provide the numerical/ // authoryear choice - if (textClass().provides("natbib") + if (documentClass().provides("natbib") && cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL) return biblio::ENGINE_NATBIB_AUTHORYEAR; return cite_engine_; diff --git a/src/BufferParams.h b/src/BufferParams.h index 35089e1858..c8fe76fe63 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -18,7 +18,6 @@ #include "Font.h" #include "BiblioInfo.h" #include "paper.h" -#include "TextClassPtr.h" #include "insets/InsetQuotes.h" @@ -36,6 +35,7 @@ class AuthorList; class BaseClassIndex; class BranchList; class Bullet; +class DocumentClass; class Encoding; class Language; class Lexer; @@ -109,27 +109,27 @@ public: ///Get the LyX TextClass (that is, the layout file) this document is using. BaseClassIndex baseClass() const; /// Set the LyX TextClass (that is, the layout file) this document is using. - /// NOTE: This does not call makeTextClass() to update the local TextClass. - /// That needs to be done manually. + /// NOTE: This does not call makeDocumentClass() to update the local + /// DocumentClass. That needs to be done manually. bool setBaseClass(BaseClassIndex); /// Adds the module information to the baseClass information to - /// create our local TextClass. - void makeTextClass(); - /// Returns the TextClass currently in use: the BaseClass as modified + /// create our local DocumentClass. + void makeDocumentClass(); + /// Returns the DocumentClass currently in use: the BaseClass as modified /// by modules. - TextClass const & textClass() const; - /// Returns a pointer to the TextClass currently in use: the BaseClass - /// as modified by modules. (See \file TextClassPtr.h for the typedef.) - TextClassPtr textClassPtr() const; + DocumentClass const & documentClass() const; + /// \return A pointer to the DocumentClass currently in use: the BaseClass + /// as modified by modules. + DocumentClass * documentClassPtr() const; /// This bypasses the baseClass and sets the textClass directly. /// Should be called with care and would be better not being here, /// but it seems to be needed by CutAndPaste::putClipboard(). - void setTextClass(TextClassPtr); + void setDocumentClass(DocumentClass const * const); /// List of modules in use std::vector const & getModules() const; /// Add a module to the list of modules in use. /// Returns true if module was successfully added. - /// The makeClass variable signals whether to call makeTextClass. This + /// The makeClass variable signals whether to call makeDocumentClass. This /// need not be done if we know this isn't the final time through, or if /// the BufferParams do not represent the parameters for an actual buffer /// (as in GuiDocument). @@ -327,8 +327,8 @@ private: /// for use with natbib biblio::CiteEngine cite_engine_; - /// the possibly modular TextClass actually in use - TextClassPtr textClass_; + /// + DocumentClass * doc_class_; /// typedef std::vector LayoutModuleList; /// diff --git a/src/BufferView.cpp b/src/BufferView.cpp index c6d5b6aee8..dbe396c070 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1887,7 +1887,7 @@ void BufferView::insertLyXFile(FileName const & fname) el = buf.errorList("Parse"); buffer_.undo().recordUndo(d->cursor_); cap::pasteParagraphList(d->cursor_, buf.paragraphs(), - buf.params().textClassPtr(), el); + buf.params().documentClassPtr(), el); res = _("Document %1$s inserted."); } else { res = _("Could not insert document %1$s"); diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 48453cdd63..975cf789c9 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -70,7 +70,7 @@ namespace { typedef pair PitPosPair; -typedef limited_stack > CutStack; +typedef limited_stack > CutStack; CutStack theCuts(10); // persistent selection, cleared until the next selection @@ -106,7 +106,7 @@ bool checkPastePossible(int index) pair pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, - TextClassPtr textclass, ErrorList & errorlist) + DocumentClass const * const docclass, ErrorList & errorlist) { Buffer const & buffer = cur.buffer(); pit_type pit = cur.pit(); @@ -120,7 +120,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, // Make a copy of the CaP paragraphs. ParagraphList insertion = parlist; - TextClassPtr const tc = buffer.params().textClassPtr(); + DocumentClass const * const tc = buffer.params().documentClassPtr(); // Now remove all out of the pars which is NOT allowed in the // new environment and set also another font if that is required. @@ -148,7 +148,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, // supposed to be the default, not just if it is forced if (cur.inset().useEmptyLayout()) { LayoutPtr const layout = - buffer.params().textClass().emptyLayout(); + buffer.params().documentClass().emptyLayout(); ParagraphList::iterator const end = insertion.end(); for (ParagraphList::iterator par = insertion.begin(); par != end; ++par) @@ -162,7 +162,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist, // since we store pointers to insets at some places and we don't // want to invalidate them. insertion.swap(in.paragraphs()); - cap::switchBetweenClasses(textclass, tc, in, errorlist); + cap::switchBetweenClasses(docclass, tc, in, errorlist); insertion.swap(in.paragraphs()); ParagraphList::iterator tmpbuf = insertion.begin(); @@ -317,15 +317,15 @@ PitPosPair eraseSelectionHelper(BufferParams const & params, } -void putClipboard(ParagraphList const & paragraphs, TextClassPtr textclass, - docstring const & plaintext) +void putClipboard(ParagraphList const & paragraphs, + DocumentClass const * const docclass, docstring const & plaintext) { // For some strange reason gcc 3.2 and 3.3 do not accept // Buffer buffer(string(), false); Buffer buffer("", false); buffer.setUnnamed(true); buffer.paragraphs() = paragraphs; - buffer.params().setTextClass(textclass); + buffer.params().setDocumentClass(docclass); ostringstream lyx; if (buffer.write(lyx)) theClipboard().put(lyx.str(), plaintext); @@ -336,7 +336,7 @@ void putClipboard(ParagraphList const & paragraphs, TextClassPtr textclass, void copySelectionHelper(Buffer const & buf, ParagraphList & pars, pit_type startpit, pit_type endpit, - int start, int end, TextClassPtr tc, CutStack & cutstack) + int start, int end, DocumentClass const * const dc, CutStack & cutstack) { BOOST_ASSERT(0 <= start && start <= pars[startpit].size()); BOOST_ASSERT(0 <= end && end <= pars[endpit].size()); @@ -372,7 +372,8 @@ void copySelectionHelper(Buffer const & buf, ParagraphList & pars, // do not copy text (also nested in insets) which is marked as deleted acceptChanges(copy_pars, buf.params()); - cutstack.push(make_pair(copy_pars, tc)); + DocumentClass * d = const_cast(dc); + cutstack.push(make_pair(copy_pars, d)); } } // namespace anon @@ -392,8 +393,8 @@ docstring grabAndEraseSelection(Cursor & cur) } -void switchBetweenClasses(TextClassPtr const & oldone, - TextClassPtr const & newone, InsetText & in, ErrorList & errorlist) +void switchBetweenClasses(DocumentClass const * const oldone, + DocumentClass const * const newone, InsetText & in, ErrorList & errorlist) { errorlist.clear(); @@ -401,8 +402,8 @@ void switchBetweenClasses(TextClassPtr const & oldone, if (oldone == newone) return; - TextClass const & oldtc = *oldone; - TextClass const & newtc = *newone; + DocumentClass const & oldtc = *oldone; + DocumentClass const & newtc = *newone; // layouts ParIterator end = par_iterator_end(in); @@ -410,7 +411,9 @@ void switchBetweenClasses(TextClassPtr const & oldone, docstring const name = it->layout()->name(); bool hasLayout = newtc.hasLayout(name); - if (hasLayout) + if (in.useEmptyLayout()) + it->setLayout(newtc.emptyLayout()); + else if (hasLayout) it->setLayout(newtc[name]); else it->setLayout(newtc.defaultLayout()); @@ -518,7 +521,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut) text->paragraphs(), begpit, endpit, cur.selBegin().pos(), endpos, - bp.textClassPtr(), theCuts); + bp.documentClassPtr(), theCuts); // Stuff what we got on the clipboard. // Even if there is no selection. putClipboard(theCuts[0].first, theCuts[0].second, @@ -602,7 +605,7 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack) copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(), pos, cur.selEnd().pos(), - cur.buffer().params().textClassPtr(), cutstack); + cur.buffer().params().documentClassPtr(), cutstack); dirtyTabularStack(false); } @@ -611,10 +614,11 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack) ParagraphList pars; Paragraph par; BufferParams const & bp = cur.buffer().params(); - par.setLayout(bp.textClass().defaultLayout()); + // FIXME This should be the empty layout...right? + par.setLayout(bp.documentClass().emptyLayout()); par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED)); pars.push_back(par); - cutstack.push(make_pair(pars, bp.textClassPtr())); + cutstack.push(make_pair(pars, bp.documentClassPtr())); } } @@ -638,10 +642,10 @@ void copySelection(Cursor & cur, docstring const & plaintext) ParagraphList pars; Paragraph par; BufferParams const & bp = cur.buffer().params(); - par.setLayout(bp.textClass().defaultLayout()); + par.setLayout(bp.documentClass().emptyLayout()); par.insert(0, plaintext, Font(), Change(Change::UNCHANGED)); pars.push_back(par); - theCuts.push(make_pair(pars, bp.textClassPtr())); + theCuts.push(make_pair(pars, bp.documentClassPtr())); } else { copySelectionToStack(cur, theCuts); } @@ -692,7 +696,7 @@ docstring selection(size_t sel_index) void pasteParagraphList(Cursor & cur, ParagraphList const & parlist, - TextClassPtr textclass, ErrorList & errorList) + DocumentClass const * const docclass, ErrorList & errorList) { if (cur.inTexted()) { Text * text = cur.text(); @@ -702,7 +706,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist, PitPosPair ppp; boost::tie(ppp, endpit) = - pasteSelectionHelper(cur, parlist, textclass, errorList); + pasteSelectionHelper(cur, parlist, docclass, errorList); updateLabels(cur.buffer()); cur.clearSelection(); text->setCursor(cur, ppp.first, ppp.second); @@ -745,7 +749,7 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs) if (buffer.readString(lyx)) { cur.recordUndo(); pasteParagraphList(cur, buffer.paragraphs(), - buffer.params().textClassPtr(), errorList); + buffer.params().documentClassPtr(), errorList); cur.setSelection(); return; } diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index 622ccf644b..3796966f09 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -14,8 +14,6 @@ #ifndef CUTANDPASTE_H #define CUTANDPASTE_H -#include "TextClassPtr.h" - #include "support/docstring.h" #include "frontends/Clipboard.h" @@ -26,6 +24,7 @@ using lyx::frontend::Clipboard; namespace lyx { +class DocumentClass; class ErrorList; class InsetText; class Cursor; @@ -100,15 +99,15 @@ void pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index); /// Paste the paragraph list \p parlist at the position given by \p cur. /// Does not handle undo. Does only work in text, not mathed. void pasteParagraphList(Cursor & cur, ParagraphList const & parlist, - TextClassPtr textclass, ErrorList & errorList); + DocumentClass const * const textclass, ErrorList & errorList); /** Needed to switch between different classes. This works * for a list of paragraphs beginning with the specified par. * It changes layouts and character styles. */ -void switchBetweenClasses(TextClassPtr const & c1, - TextClassPtr const & c2, InsetText & in, ErrorList &); +void switchBetweenClasses(DocumentClass const * const c1, + DocumentClass const * const c2, InsetText & in, ErrorList &); /// Get the current selection as a string. Does not change the selection. /// Does only work if the whole selection is in mathed. diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 903b87c722..7bd0944d3e 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -375,7 +375,7 @@ void LaTeXFeatures::useLayout(docstring const & layoutname) return; } - TextClass const & tclass = params_.textClass(); + DocumentClass const & tclass = params_.documentClass(); if (tclass.hasLayout(layoutname)) { // Is this layout already in usedLayouts? if (find(usedLayouts_.begin(), usedLayouts_.end(), layoutname) @@ -409,7 +409,7 @@ bool LaTeXFeatures::isRequired(string const & name) const bool LaTeXFeatures::mustProvide(string const & name) const { - return isRequired(name) && !params_.textClass().provides(name); + return isRequired(name) && !params_.documentClass().provides(name); } @@ -439,7 +439,7 @@ void LaTeXFeatures::useFloat(string const & name) // We only need float.sty if we use non builtin floats, or if we // use the "H" modifier. This includes modified table and // figure floats. (Lgb) - Floating const & fl = params_.textClass().floats().getType(name); + Floating const & fl = params_.documentClass().floats().getType(name); if (!fl.type().empty() && !fl.builtin()) { require("float"); } @@ -555,7 +555,7 @@ int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); string const LaTeXFeatures::getPackages() const { ostringstream packages; - TextClass const & tclass = params_.textClass(); + DocumentClass const & tclass = params_.documentClass(); // FIXME: currently, we can only load packages and macros known // to LyX. @@ -828,7 +828,7 @@ string const LaTeXFeatures::getBabelOptions() const docstring const LaTeXFeatures::getTClassPreamble() const { // the text class specific preamble - TextClass const & tclass = params_.textClass(); + DocumentClass const & tclass = params_.documentClass(); odocstringstream tcpreamble; tcpreamble << tclass.preamble(); @@ -903,7 +903,7 @@ BufferParams const & LaTeXFeatures::bufferParams() const void LaTeXFeatures::getFloatDefinitions(ostream & os) const { - FloatList const & floats = params_.textClass().floats(); + FloatList const & floats = params_.documentClass().floats(); // Here we will output the code to create the needed float styles. // We will try to do this as minimal as possible. diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 717d686f1c..b5789e0069 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -1539,7 +1539,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) Buffer * buffer = lyx_view_->buffer(); - TextClassPtr oldClass = buffer->params().textClassPtr(); + DocumentClass * oldClass = buffer->params().documentClassPtr(); Cursor & cur = view()->cursor(); cur.recordUndoFullDocument(); @@ -1583,10 +1583,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_LAYOUT_MODULES_CLEAR: { BOOST_ASSERT(lyx_view_); Buffer * buffer = lyx_view_->buffer(); - TextClassPtr oldClass = buffer->params().textClassPtr(); + DocumentClass * oldClass = buffer->params().documentClassPtr(); view()->cursor().recordUndoFullDocument(); buffer->params().clearLayoutModules(); - buffer->params().makeTextClass(); + buffer->params().makeDocumentClass(); updateLayout(oldClass, buffer); updateFlags = Update::Force | Update::FitCursor; break; @@ -1595,10 +1595,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_LAYOUT_MODULE_ADD: { BOOST_ASSERT(lyx_view_); Buffer * buffer = lyx_view_->buffer(); - TextClassPtr oldClass = buffer->params().textClassPtr(); + DocumentClass * oldClass = buffer->params().documentClassPtr(); view()->cursor().recordUndoFullDocument(); buffer->params().addLayoutModule(argument); - buffer->params().makeTextClass(); + buffer->params().makeDocumentClass(); updateLayout(oldClass, buffer); updateFlags = Update::Force | Update::FitCursor; break; @@ -1624,10 +1624,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd) break; //Save the old, possibly modular, layout for use in conversion. - TextClassPtr oldClass = buffer->params().textClassPtr(); + DocumentClass * oldClass = buffer->params().documentClassPtr(); view()->cursor().recordUndoFullDocument(); buffer->params().setBaseClass(new_class); - buffer->params().makeTextClass(); + buffer->params().makeDocumentClass(); updateLayout(oldClass, buffer); updateFlags = Update::Force | Update::FitCursor; break; @@ -1636,11 +1636,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_LAYOUT_RELOAD: { BOOST_ASSERT(lyx_view_); Buffer * buffer = lyx_view_->buffer(); - TextClassPtr oldClass = buffer->params().textClassPtr(); + DocumentClass * oldClass = buffer->params().documentClassPtr(); BaseClassIndex const tc = buffer->params().baseClass(); baseclasslist.reset(tc); buffer->params().setBaseClass(tc); - buffer->params().makeTextClass(); + buffer->params().makeDocumentClass(); updateLayout(oldClass, buffer); updateFlags = Update::Force | Update::FitCursor; break; @@ -1866,14 +1866,14 @@ bool LyXFunc::wasMetaKey() const } -void LyXFunc::updateLayout(TextClassPtr oldlayout,Buffer * buffer) +void LyXFunc::updateLayout(DocumentClass * oldlayout,Buffer * buffer) { lyx_view_->message(_("Converting document to new document class...")); StableDocIterator backcur(view()->cursor()); ErrorList & el = buffer->errorList("Class Switch"); cap::switchBetweenClasses( - oldlayout, buffer->params().textClassPtr(), + oldlayout, buffer->params().documentClassPtr(), static_cast(buffer->inset()), el); view()->setCursor(backcur.asDocIterator(&(buffer->inset()))); diff --git a/src/LyXFunc.h b/src/LyXFunc.h index a97d85b2c6..3b062b8f53 100644 --- a/src/LyXFunc.h +++ b/src/LyXFunc.h @@ -17,7 +17,6 @@ #include "KeySequence.h" #include "lfuns.h" -#include "TextClassPtr.h" #include "support/docstring.h" @@ -25,6 +24,7 @@ namespace lyx { class Buffer; class BufferView; +class DocumentClass; class FuncRequest; class FuncStatus; class KeySymbol; @@ -134,7 +134,7 @@ private: /// bool ensureBufferClean(BufferView * bv); /// - void updateLayout(TextClassPtr oldlayout, Buffer * buffer); + void updateLayout(DocumentClass * oldlayout, Buffer * buffer); }; /// Implementation is in LyX.cpp diff --git a/src/Makefile.am b/src/Makefile.am index e016291948..c2119a1705 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -262,7 +262,6 @@ HEADERFILESCORE = \ TexStream.h \ Text.h \ TextClass.h \ - TextClassPtr.h \ TextMetrics.h \ TocBackend.h \ ToolbarBackend.h \ diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 6e4f6a38fb..df4de67b54 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -598,7 +598,7 @@ void expandFloatListInsert(Menu & tomenu, Buffer const * buf) return; } - FloatList const & floats = buf->params().textClass().floats(); + FloatList const & floats = buf->params().documentClass().floats(); FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator end = floats.end(); for (; cit != end; ++cit) { @@ -619,7 +619,7 @@ void expandFloatInsert(Menu & tomenu, Buffer const * buf) return; } - FloatList const & floats = buf->params().textClass().floats(); + FloatList const & floats = buf->params().documentClass().floats(); FloatList::const_iterator cit = floats.begin(); FloatList::const_iterator end = floats.end(); for (; cit != end; ++cit) { @@ -641,7 +641,7 @@ void expandFlexInsert(Menu & tomenu, Buffer const * buf, string s) return; } TextClass::InsetLayouts const & insetLayouts = - buf->params().textClass().insetLayouts(); + buf->params().documentClass().insetLayouts(); TextClass::InsetLayouts::const_iterator cit = insetLayouts.begin(); TextClass::InsetLayouts::const_iterator end = insetLayouts.end(); for (; cit != end; ++cit) { @@ -741,7 +741,7 @@ void expandToc(Menu & tomenu, Buffer const * buf) tomenu.add(MenuItem(MenuItem::Command, _("Master Document"), f)); } - FloatList const & floatlist = buf->params().textClass().floats(); + FloatList const & floatlist = buf->params().documentClass().floats(); TocList const & toc_list = buf->tocBackend().tocs(); TocList::const_iterator cit = toc_list.begin(); TocList::const_iterator end = toc_list.end(); diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index ada2517b3b..176ad2eec3 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1522,7 +1522,7 @@ docstring const Paragraph::translateIfPossible(docstring const & s, docstring Paragraph::expandLabel(LayoutPtr const & layout, BufferParams const & bparams, bool process_appendix) const { - TextClass const & tclass = bparams.textClass(); + DocumentClass const & tclass = bparams.documentClass(); docstring fmt; if (process_appendix && d->params_.appendix()) @@ -1827,7 +1827,7 @@ bool Paragraph::latex(BufferParams const & bparams, bool asdefault = forceEmptyLayout(); if (asdefault) - style = bparams.textClass().defaultLayout(); + style = bparams.documentClass().emptyLayout(); else style = d->layout_; diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp index b249f01d9b..12f387d18f 100644 --- a/src/ParagraphMetrics.cpp +++ b/src/ParagraphMetrics.cpp @@ -198,7 +198,7 @@ void ParagraphMetrics::dump() const int ParagraphMetrics::rightMargin(BufferView const & bv) const { BufferParams const & params = bv.buffer().params(); - TextClass const & tclass = params.textClass(); + DocumentClass const & tclass = params.documentClass(); frontend::FontMetrics const & fm = theFontMetrics(params.getFont()); int const r_margin = bv.rightMargin() diff --git a/src/Text.cpp b/src/Text.cpp index 7db3b5db2d..4d6df2e7d5 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -96,7 +96,7 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex, font = Font(inherit_font, bp.language); change = Change(Change::UNCHANGED); - TextClass const & tclass = bp.textClass(); + DocumentClass const & tclass = bp.documentClass(); if (layoutname.empty()) layoutname = tclass.defaultLayoutName(); @@ -125,12 +125,12 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex, tclass.defaultLayoutName(); } - par.setLayout(bp.textClass()[layoutname]); + par.setLayout(bp.documentClass()[layoutname]); // Test whether the layout is obsolete. LayoutPtr const & layout = par.layout(); if (!layout->obsoleted_by().empty()) - par.setLayout(bp.textClass()[layout->obsoleted_by()]); + par.setLayout(bp.documentClass()[layout->obsoleted_by()]); par.params().read(lex); @@ -355,7 +355,7 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic) Paragraph & cpar = cur.paragraph(); pit_type cpit = cur.pit(); - TextClass const & tclass = cur.buffer().params().textClass(); + DocumentClass const & tclass = cur.buffer().params().documentClass(); LayoutPtr const & layout = cpar.layout(); // this is only allowed, if the current paragraph is not empty @@ -915,11 +915,7 @@ bool Text::handleBibitems(Cursor & cur) } // otherwise reset to default - if (par.useEmptyLayout()) - cur.paragraph().setLayout(bufparams.textClass().emptyLayout()); - else - cur.paragraph().setLayout(bufparams.textClass().defaultLayout()); - return true; + cur.paragraph().setEmptyOrDefaultLayout(bufparams.documentClass()); } @@ -979,7 +975,7 @@ bool Text::backspacePos0(Cursor & cur) bool needsUpdate = false; BufferParams const & bufparams = cur.buffer().params(); - TextClass const & tclass = bufparams.textClass(); + DocumentClass const & tclass = bufparams.documentClass(); ParagraphList & plist = cur.text()->paragraphs(); Paragraph const & par = cur.paragraph(); Cursor prevcur = cur; @@ -1104,7 +1100,7 @@ bool Text::dissolveInset(Cursor & cur) { for (; it != it_end; it++) it->changeLanguage(b.params(), latex_language, b.language()); - pasteParagraphList(cur, plist, b.params().textClassPtr(), + pasteParagraphList(cur, plist, b.params().documentClassPtr(), b.errorList("Paste")); // restore position cur.pit() = min(cur.lastpit(), spit); diff --git a/src/Text2.cpp b/src/Text2.cpp index 39300ba3f7..fa0ed179b3 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -199,7 +199,7 @@ void Text::setLayout(Buffer const & buffer, pit_type start, pit_type end, BOOST_ASSERT(start != end); BufferParams const & bufparams = buffer.params(); - LayoutPtr const & lyxlayout = bufparams.textClass()[layout]; + LayoutPtr const & lyxlayout = bufparams.documentClass()[layout]; for (pit_type pit = start; pit != end; ++pit) { Paragraph & par = pars_[pit]; @@ -218,7 +218,7 @@ void Text::setLayout(Cursor & cur, docstring const & layout) // special handling of new environment insets BufferView & bv = cur.bv(); BufferParams const & params = bv.buffer().params(); - LayoutPtr const & lyxlayout = params.textClass()[layout]; + LayoutPtr const & lyxlayout = params.documentClass()[layout]; if (lyxlayout->is_environment) { // move everything in a new environment inset LYXERR(Debug::DEBUG, "setting layout " << to_utf8(layout)); diff --git a/src/Text3.cpp b/src/Text3.cpp index 1a7f3f1b8b..f40d37f8d8 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -220,7 +220,7 @@ static bool doInsertInset(Cursor & cur, Text * text, if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) { // reset first par to default cur.text()->paragraphs().begin() - ->setEmptyOrDefaultLayout(bparams.textClass()); + ->setEmptyOrDefaultLayout(bparams.documentClass()); cur.pos() = 0; cur.pit() = 0; // Merge multiple paragraphs -- hack @@ -229,8 +229,8 @@ static bool doInsertInset(Cursor & cur, Text * text, } else { // reset surrounding par to default docstring const layoutname = insetText->useEmptyLayout() - ? bparams.textClass().emptyLayoutName() - : bparams.textClass().defaultLayoutName(); + ? bparams.documentClass().emptyLayoutName() + : bparams.documentClass().defaultLayoutName(); cur.leaveInset(*inset); text->setLayout(cur, layoutname); } @@ -266,7 +266,7 @@ static void outline(OutlineOp mode, Cursor & cur) ParagraphList::iterator finish = start; ParagraphList::iterator end = pars.end(); - TextClass const & tc = buf.params().textClass(); + DocumentClass const & tc = buf.params().documentClass(); int const thistoclevel = start->layout()->toclevel; int toclevel; @@ -1011,7 +1011,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) Paragraph const & para = cur.paragraph(); docstring const old_layout = para.layout()->name(); - TextClass const & tclass = bv->buffer().params().textClass(); + DocumentClass const & tclass = bv->buffer().params().documentClass(); if (layout.empty()) layout = tclass.defaultLayoutName(); @@ -1384,7 +1384,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.posForward(); ParagraphList & pars = cur.text()->paragraphs(); - TextClass const & tclass = bv->buffer().params().textClass(); + DocumentClass const & tclass = bv->buffer().params().documentClass(); // add a separate paragraph for the caption inset pars.push_back(Paragraph()); @@ -1675,7 +1675,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) break; case LFUN_FLOAT_LIST: { - TextClass const & tclass = bv->buffer().params().textClass(); + DocumentClass const & tclass = bv->buffer().params().documentClass(); if (tclass.floats().typeExist(to_utf8(cmd.argument()))) { cur.recordUndo(); if (cur.selection()) @@ -1946,7 +1946,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_FLEX_INSERT: { code = FLEX_CODE; string s = cmd.getArg(0); - InsetLayout il = cur.buffer().params().textClass().insetLayout(from_utf8(s)); + InsetLayout il = + cur.buffer().params().documentClass().insetLayout(from_utf8(s)); if (il.lyxtype() != "charstyle" && il.lyxtype() != "custom" && il.lyxtype() != "element" && diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 740a4c336b..a36e169072 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -1131,28 +1131,24 @@ bool TextClass::hasTocLevels() const } -TextClassPtr TextClassBundle::newClass(TextClass const & baseClass) +DocumentClass & DocumentClassBundle::newClass(TextClass const & baseClass) { - TextClass * tc = new TextClass(baseClass); - tc_list_.push_back(tc); - return tc; + DocumentClass dc(baseClass); + tc_list_.push_back(dc); + return tc_list_.back(); } -TextClassBundle & TextClassBundle::get() +DocumentClassBundle & DocumentClassBundle::get() { - static TextClassBundle singleton; + static DocumentClassBundle singleton; return singleton; } -TextClassBundle::~TextClassBundle() -{ - std::list::iterator it = tc_list_.begin(); - std::list::iterator end = tc_list_.end(); - for (; it != end; ++it) - delete *it; -} +DocumentClass::DocumentClass(TextClass const & tc) + : TextClass(tc) +{} ostream & operator<<(ostream & os, PageSides p) diff --git a/src/TextClass.h b/src/TextClass.h index 23175a2b9d..ff64c7d4d4 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -14,7 +14,6 @@ #include "FontInfo.h" #include "LayoutEnums.h" #include "LayoutPtr.h" -#include "TextClassPtr.h" #include "insets/InsetLayout.h" @@ -32,10 +31,10 @@ namespace lyx { namespace support { class FileName; } -class Layout; -class Lexer; class Counters; class FloatList; +class Layout; +class Lexer; /// A TextClass represents a collection of layout information: At the @@ -292,34 +291,44 @@ private: }; +/// This class amounts to little more than a `strong typedef'. +/// Its purpose is to control the creation of TextClass objects +/// within the DocumentClassBundle. +/// These TextClasses represent the layout information that is +/// associated with a given buffer. +class DocumentClass : public TextClass { +private: + /// Constructs a DocumentClass based upon a TextClass. + DocumentClass(TextClass const & tc); + /// The only class that can create a DocumentClass is + /// DocumentClassBundle, which calls the private constructor. + friend class DocumentClassBundle; +}; + + /// This is simply a container for the text classes generated when modules /// are read, so that they stay in memory for use by Insets, CutAndPaste, -/// and the like. Since they're constructed via new, they wouldn't actually -/// disappear without this class---but this class holds the pointers to them -/// so that they don't leak. +/// and the like. /// FIXME Some sort of garbage collection or reference counting wouldn't /// be a bad idea here. It might be enough to check when a Buffer is closed -/// (or makeTextClass is called) whether the old TextClass is in use anywhere. +/// (or makeDocumentClass is called) whether the old DocumentClass is in use +/// anywhere. /// /// This is a singleton class. Its sole instance is accessed via -/// TextClassBundle::get(). -/// -/// See \file TextClassPtr.h for the definition of TextClassPtr. -class TextClassBundle { +/// DocumentClassBundle::get(). +class DocumentClassBundle { public: /// \return Pointer to a new class equal to baseClass - TextClassPtr newClass(TextClass const & baseClass); + DocumentClass & newClass(TextClass const & baseClass); /// \return The sole instance of this class. - static TextClassBundle & get(); - /// - ~TextClassBundle(); + static DocumentClassBundle & get(); private: /// control instantiation - TextClassBundle() {}; + DocumentClassBundle() {} /// noncopyable - TextClassBundle(TextClassBundle const &); + DocumentClassBundle(DocumentClassBundle const &); /// - std::list tc_list_; + std::list tc_list_; }; diff --git a/src/TextClassPtr.h b/src/TextClassPtr.h deleted file mode 100644 index 07e6a36bef..0000000000 --- a/src/TextClassPtr.h +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -/** - * \file TextClassPtr.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * Full author contact details are available in file CREDITS. - */ -#ifndef TEXTCLASS_PTR_H -#define TEXTCLASS_PTR_H - -namespace lyx { - -class TextClass; - -// This largely useless typedef is scheduled to be replaced by -// something better. -typedef TextClass * TextClassPtr; - -} // namespace lyx - -#endif diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index db45eb842e..74f8d29b8d 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1764,7 +1764,7 @@ int TextMetrics::leftMargin(int max_width, BOOST_ASSERT(pos <= par.size()); Buffer const & buffer = bv_->buffer(); //lyxerr << "TextMetrics::leftMargin: pit: " << pit << " pos: " << pos << endl; - TextClass const & tclass = buffer.params().textClass(); + DocumentClass const & tclass = buffer.params().documentClass(); LayoutPtr const & layout = par.layout(); docstring parindent = layout->parindent; diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 77929a5f5d..9e558aab30 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -108,7 +108,7 @@ void TocBackend::updateItem(ParConstIterator const & par_it) } BufferParams const & bufparams = buffer_->params(); - const int min_toclevel = bufparams.textClass().min_toclevel(); + const int min_toclevel = bufparams.documentClass().min_toclevel(); TocIterator toc_item = item("tableofcontents", par_it); @@ -146,7 +146,7 @@ void TocBackend::update() tocs_.clear(); BufferParams const & bufparams = buffer_->params(); - const int min_toclevel = bufparams.textClass().min_toclevel(); + const int min_toclevel = bufparams.documentClass().min_toclevel(); Toc & toc = tocs_["tableofcontents"]; ParConstIterator pit = buffer_->par_iterator_begin(); diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp index 94dd94a00b..6c081b67c3 100644 --- a/src/buffer_funcs.cpp +++ b/src/buffer_funcs.cpp @@ -294,7 +294,7 @@ bool needEnumCounterReset(ParIterator const & it) // set the label of a paragraph. This includes the counters. void setLabel(Buffer const & buf, ParIterator & it) { - TextClass const & textclass = buf.params().textClass(); + DocumentClass const & textclass = buf.params().documentClass(); Paragraph & par = it.paragraph(); LayoutPtr const & layout = par.layout(); Counters & counters = textclass.counters(); @@ -481,7 +481,7 @@ void updateLabels(Buffer const & buf, bool childonly) { Buffer const * const master = buf.masterBuffer(); // Use the master text class also for child documents - TextClass const & textclass = master->params().textClass(); + DocumentClass const & textclass = master->params().documentClass(); if (!childonly) { // If this is a child document start with the master diff --git a/src/factory.cpp b/src/factory.cpp index 2dd57eec95..9d317b94b0 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -102,7 +102,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) case LFUN_FLEX_INSERT: { string s = cmd.getArg(0); - return new InsetFlex(params, params.textClassPtr(), s); + return new InsetFlex(params, params.documentClassPtr(), s); } case LFUN_NOTE_INSERT: { @@ -147,7 +147,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) case LFUN_FLOAT_INSERT: { // check if the float type exists string const argument = to_utf8(cmd.argument()); - if (params.textClass().floats().typeExist(argument)) + if (params.documentClass().floats().typeExist(argument)) return new InsetFloat(params, argument); lyxerr << "Non-existent float type: " << argument << endl; } @@ -155,7 +155,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd) case LFUN_FLOAT_WIDE_INSERT: { // check if the float type exists string const argument = to_utf8(cmd.argument()); - if (params.textClass().floats().typeExist(argument)) { + if (params.documentClass().floats().typeExist(argument)) { auto_ptr p(new InsetFloat(params, argument)); p->wide(true, params); return p.release(); @@ -485,7 +485,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf) lex.next(); string s = lex.getString(); inset.reset(new InsetFlex(buf.params(), - buf.params().textClassPtr(), s)); + buf.params().documentClassPtr(), s)); } else if (tmptok == "Branch") { inset.reset(new InsetBranch(buf.params(), InsetBranchParams())); diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index bf694e826b..9e3edc0e9e 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1354,7 +1354,7 @@ void GuiDocument::updateEmbeddedFileList() void GuiDocument::updateNumbering() { - TextClass const & tclass = bp_.textClass(); + DocumentClass const & tclass = bp_.documentClass(); numberingModule->tocTW->setUpdatesEnabled(false); numberingModule->tocTW->clear(); @@ -1441,7 +1441,7 @@ void GuiDocument::apply(BufferParams & params) params.language = lyx::languages.getLanguage(lang_[pos]); // numbering - if (params.textClass().hasTocLevels()) { + if (params.documentClass().hasTocLevels()) { params.tocdepth = numberingModule->tocSL->value(); params.secnumdepth = numberingModule->depthSL->value(); } diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 3dd5ea1b2e..87709c0eca 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -236,7 +236,7 @@ docstring GuiToc::guiName(string const & type) const if (type == "label") return _("Labels and References"); - FloatList const & floats = buffer().params().textClass().floats(); + FloatList const & floats = buffer().params().documentClass().floats(); if (floats.typeExist(type)) return _(floats.getType(type).listName()); diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index bd889cae39..1951870d9c 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -307,7 +307,7 @@ void GuiLayoutBox::updateContents(bool reset) return; } - TextClass const * text_class = &buffer->params().textClass(); + DocumentClass const * text_class = &buffer->params().documentClass(); Inset const * inset = owner_.view()->cursor().innerParagraph().inInset(); diff --git a/src/frontends/qt4/GuiToolbars.h b/src/frontends/qt4/GuiToolbars.h index 0b9d23cb3a..49ac3a5af3 100644 --- a/src/frontends/qt4/GuiToolbars.h +++ b/src/frontends/qt4/GuiToolbars.h @@ -14,14 +14,13 @@ #ifndef GUI_TOOLBARS_H #define GUI_TOOLBARS_H -#include "TextClassPtr.h" - #include "support/docstring.h" #include namespace lyx { +class DocumentClass; class ToolbarInfo; namespace frontend { @@ -86,7 +85,7 @@ private: ToolbarsMap toolbars_; /// The last textclass layout list in the layout choice selector - TextClassPtr last_textclass_; + DocumentClass * last_textclass_; }; diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 8a028096de..a59a0e36f3 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -387,7 +387,7 @@ bool Inset::covers(BufferView const & bv, int x, int y) const InsetLayout const & Inset::getLayout(BufferParams const & bp) const { - return bp.textClass().insetLayout(name()); + return bp.documentClass().insetLayout(name()); } diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index 1fcfda3b09..e0a14e68b8 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -208,7 +208,7 @@ void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it) /// Update the counters of this inset and of its contents void InsetBibitem::updateLabels(ParIterator const &) { - Counters & counters = buffer().params().textClass().counters(); + Counters & counters = buffer().params().documentClass().counters(); docstring const bibitem = from_ascii("bibitem"); if (counters.hasCounter(bibitem) && getParam("label").empty()) { counters.step(bibitem); diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 4d79ffa7fa..a54b0b4a3a 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -293,7 +293,7 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const "BibTeX will be unable to find it.")); } - if (!db_out.empty() && buffer().params().use_bibtopic){ + if (!db_out.empty() && buffer().params().use_bibtopic) { os << "\\begin{btSect}{" << db_out << "}\n"; docstring btprint = getParam("btprint"); if (btprint.empty()) @@ -310,8 +310,7 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const // 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().textClass().name(), - "art")) { + if (!contains(buffer().params().documentClass().name(), "art")) { if (buffer().params().sides == OneSide) { // oneside os << "\\clearpage"; diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index c40c3c54a0..9744ccd3f0 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -89,7 +89,7 @@ InsetBox::InsetBox(BufferParams const & bp, string const & label) : InsetCollapsable(bp), params_(label) { if (forceEmptyLayout()) - paragraphs().back().setLayout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.documentClass().emptyLayout()); } diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 9d968e7aa9..3da72ae1d1 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -76,7 +76,7 @@ void InsetBranch::read(Lexer & lex) } -docstring InsetBranch::toolTip(BufferView const & bv, int x, int y) const +docstring InsetBranch::toolTip(BufferView const &, int, int) const { return _("Branch: ") + params_.branch; } @@ -224,7 +224,7 @@ void InsetBranch::updateLabels(ParIterator const & it) if (isBranchSelected()) InsetCollapsable::updateLabels(it); else { - TextClass const & tclass = buffer().params().textClass(); + DocumentClass const & tclass = buffer().params().documentClass(); Counters savecnt = tclass.counters(); InsetCollapsable::updateLabels(it); tclass.counters() = savecnt; diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 8cb5151a32..1c968b4a01 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -57,14 +57,14 @@ InsetCaption::InsetCaption(InsetCaption const & ic) InsetCaption::InsetCaption(BufferParams const & bp) - : InsetText(bp), textclass_(bp.textClass()) + : InsetText(bp), textclass_(bp.documentClass()) { setAutoBreakRows(true); setDrawFrame(true); setFrameColor(Color_captionframe); //FIXME Do we need to set all paragraphs here? or will there //always only be one? - paragraphs().back().setLayout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.documentClass().emptyLayout()); } @@ -277,7 +277,7 @@ int InsetCaption::getOptArg(odocstream & os, void InsetCaption::updateLabels(ParIterator const & it) { - TextClass const & tclass = buffer().params().textClass(); + DocumentClass const & tclass = buffer().params().documentClass(); Counters & cnts = tclass.counters(); string const & type = cnts.current_float(); // Memorize type for addToToc(). diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 25e2cff787..870f75ac37 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -78,21 +78,20 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const InsetCollapsable::InsetCollapsable(BufferParams const & bp, - CollapseStatus status, TextClassPtr tc) + CollapseStatus status, DocumentClass * dc) : InsetText(bp), status_(status), openinlined_(false), autoOpen_(false), mouse_hover_(false) { - setLayout(tc); + setLayout(dc); setAutoBreakRows(true); setDrawFrame(true); setFrameColor(Color_collapsableframe); - paragraphs().back().setLayout(bp.textClass().emptyLayout()); + paragraphs().back().setLayout(bp.documentClass().emptyLayout()); } InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs) : InsetText(rhs), - textClass_(rhs.textClass_), layout_(rhs.layout_), labelstring_(rhs.labelstring_), button_dim(rhs.button_dim), @@ -125,15 +124,14 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const void InsetCollapsable::setLayout(BufferParams const & bp) { - setLayout(bp.textClassPtr()); + setLayout(bp.documentClassPtr()); } -void InsetCollapsable::setLayout(TextClassPtr tc) +void InsetCollapsable::setLayout(DocumentClass const * const dc) { - textClass_ = tc; - if ( textClass_ != 0 ) { - layout_ = &textClass_->insetLayout(name()); + if (dc != 0) { + layout_ = &(dc->insetLayout(name())); labelstring_ = layout_->labelstring(); } else { layout_ = &TextClass::emptyInsetLayout(); @@ -795,7 +793,7 @@ void InsetCollapsable::setStatus(Cursor & cur, CollapseStatus status) docstring InsetCollapsable::floatName( string const & type, BufferParams const & bp) const { - FloatList const & floats = bp.textClass().floats(); + FloatList const & floats = bp.documentClass().floats(); FloatList::const_iterator it = floats[type]; // FIXME UNICODE return (it == floats.end()) ? from_ascii(type) : bp.B_(it->second.name()); diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 3b6f4c1e08..c137579635 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -19,7 +19,6 @@ #include "Box.h" #include "TextClass.h" -#include "TextClassPtr.h" #include @@ -40,7 +39,7 @@ class InsetCollapsable : public InsetText { public: /// InsetCollapsable(BufferParams const &, - CollapseStatus status = Inset::Open, TextClassPtr tc = 0); + CollapseStatus status = Inset::Open, DocumentClass * tc = 0); /// InsetCollapsable(InsetCollapsable const & rhs); /// @@ -59,7 +58,7 @@ public: void setLayout(BufferParams const &); /// (Re-)set the character style parameters from \p tc according /// to name() - void setLayout(TextClassPtr tc); + void setLayout(DocumentClass const * const tc); /// virtual bool useEmptyLayout() { return true; } /// @@ -171,10 +170,7 @@ protected: virtual void resetParagraphsFont(); private: - /// text class to keep the InsetLayout above in memory - /// FIXME This probably isn't needed now - TextClassPtr textClass_; - /// cache for the layout_. Make sure it is in sync with the text class! + /// cache for the layout_. Make sure it is in sync with the document class! InsetLayout const * layout_; /// Dimension dimensionCollapsed() const; diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index 1ea0783a88..937696f058 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -115,8 +115,7 @@ int InsetERT::docbook(odocstream & os, OutputParams const &) const void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd) { BufferParams const & bp = cur.buffer().params(); - LayoutPtr const layout = - bp.textClass().emptyLayout(); + LayoutPtr const layout = bp.documentClass().emptyLayout(); //lyxerr << "\nInsetERT::doDispatch (begin): cmd: " << cmd << endl; switch (cmd.action) { diff --git a/src/insets/InsetEnvironment.cpp b/src/insets/InsetEnvironment.cpp index 1e2455e491..69b33e7254 100644 --- a/src/insets/InsetEnvironment.cpp +++ b/src/insets/InsetEnvironment.cpp @@ -27,7 +27,7 @@ namespace lyx { InsetEnvironment::InsetEnvironment (BufferParams const & bp, docstring const & name) - : InsetText(bp), layout_(bp.textClass()[name]), name_(name) + : InsetText(bp), layout_(bp.documentClass()[name]), name_(name) { setAutoBreakRows(true); setDrawFrame(true); diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp index 45e8b739d7..70679bf78d 100644 --- a/src/insets/InsetFlex.cpp +++ b/src/insets/InsetFlex.cpp @@ -40,11 +40,11 @@ namespace lyx { InsetFlex::InsetFlex(BufferParams const & bp, - TextClassPtr tc, string const & layoutName) - : InsetCollapsable(bp, Collapsed, tc), + DocumentClass * dc, string const & layoutName) + : InsetCollapsable(bp, Collapsed, dc), name_(layoutName) { - setLayout(tc); // again, because now the name is initialized + setLayout(dc); // again, because now the name is initialized packages_ = getLayout().requires(); preamble_ = getLayout().preamble(); } diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h index 99418de104..4250617eb4 100644 --- a/src/insets/InsetFlex.h +++ b/src/insets/InsetFlex.h @@ -23,7 +23,7 @@ namespace lyx { class InsetFlex : public InsetCollapsable { public: /// - InsetFlex(BufferParams const &,TextClassPtr tc, + InsetFlex(BufferParams const &, DocumentClass * dc, std::string const & layoutName); /// docstring name() const { return from_utf8(name_); } diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index e0fbb0194b..b7c34f02aa 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -175,7 +175,7 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetFloat::updateLabels(ParIterator const & it) { - Counters & cnts = buffer().params().textClass().counters(); + Counters & cnts = buffer().params().documentClass().counters(); string const saveflt = cnts.current_float(); // Tell to captions what the current float is @@ -282,7 +282,7 @@ docstring InsetFloat::editMessage() const int InsetFloat::latex(odocstream & os, OutputParams const & runparams) const { - FloatList const & floats = buffer().params().textClass().floats(); + FloatList const & floats = buffer().params().documentClass().floats(); string tmptype = params_.type; if (params_.sideways) tmptype = "sideways" + params_.type; diff --git a/src/insets/InsetFloatList.cpp b/src/insets/InsetFloatList.cpp index 745712a34b..3251b50936 100644 --- a/src/insets/InsetFloatList.cpp +++ b/src/insets/InsetFloatList.cpp @@ -68,7 +68,7 @@ bool InsetFloatList::isCompatibleCommand(string const & s) docstring InsetFloatList::screenLabel() const { - FloatList const & floats = buffer().params().textClass().floats(); + FloatList const & floats = buffer().params().documentClass().floats(); FloatList::const_iterator it = floats[to_ascii(getParam("type"))]; if (it != floats.end()) return buffer().B_(it->second.listName()); @@ -85,7 +85,7 @@ void InsetFloatList::write(ostream & os) const void InsetFloatList::read(Lexer & lex) { - FloatList const & floats = buffer().params().textClass().floats(); + FloatList const & floats = buffer().params().documentClass().floats(); string token; if (lex.eatLine()) { @@ -113,7 +113,7 @@ void InsetFloatList::read(Lexer & lex) int InsetFloatList::latex(odocstream & os, OutputParams const &) const { - FloatList const & floats = buffer().params().textClass().floats(); + FloatList const & floats = buffer().params().documentClass().floats(); FloatList::const_iterator cit = floats[to_ascii(getParam("type"))]; if (cit != floats.end()) { diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 68ab63daf5..5a97a3c8df 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -59,7 +59,7 @@ docstring InsetFoot::editMessage() const void InsetFoot::updateLabels(ParIterator const & it) { - TextClass const & tclass = buffer().params().textClass(); + DocumentClass const & tclass = buffer().params().documentClass(); Counters & cnts = tclass.counters(); docstring const foot = from_ascii("footnote"); Paragraph const & outer = it.paragraph(); diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 0e0ace5bc4..5d9cd9426b 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -447,8 +447,8 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const "has textclass `%2$s'\n" "while parent file has textclass `%3$s'."), included_file.displayName(), - from_utf8(tmp->params().textClass().name()), - from_utf8(masterBuffer->params().textClass().name())); + from_utf8(tmp->params().documentClass().name()), + from_utf8(masterBuffer->params().documentClass().name())); Alert::warning(_("Different textclasses"), text); //return 0; } @@ -898,7 +898,7 @@ void InsetInclude::updateLabels(ParIterator const &) listings_label_.clear(); return; } - Counters & counters = buffer().params().textClass().counters(); + Counters & counters = buffer().params().documentClass().counters(); docstring const cnt = from_ascii("listing"); listings_label_ = buffer().B_("Program Listing"); if (counters.hasCounter(cnt)) { diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index c10d619ee9..aeaece2b28 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -242,7 +242,7 @@ void InsetInfo::updateInfo() else if (name_ == "path") setText(from_utf8(buffer().filePath()), bp.getFont(), false); else if (name_ == "class") - setText(from_utf8(bp.textClass().name()), bp.getFont(), false); + setText(from_utf8(bp.documentClass().name()), bp.getFont(), false); else setText(_("Unknown buffer info"), bp.getFont(), false); break; diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 5bf4e8cbd7..c4497ded2f 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -71,7 +71,7 @@ Inset::DisplayType InsetListings::display() const void InsetListings::updateLabels(ParIterator const & it) { - Counters & cnts = buffer().params().textClass().counters(); + Counters & cnts = buffer().params().documentClass().counters(); string const saveflt = cnts.current_float(); // Tell to captions what the current float is diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index 11b37a0f63..4c11a1e89e 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -213,7 +213,7 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetNote::updateLabels(ParIterator const & it) { - TextClass const & tclass = buffer().params().textClass(); + DocumentClass const & tclass = buffer().params().documentClass(); Counters savecnt = tclass.counters(); InsetCollapsable::updateLabels(it); tclass.counters() = savecnt; diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 19583ecbf6..20dbba81d9 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -487,7 +487,7 @@ Tabular::CellData::CellData(Buffer const & buffer) inset(new InsetText(buffer.params())) { inset->setBuffer(const_cast(buffer)); - inset->paragraphs().back().setLayout(buffer.params().textClass().emptyLayout()); + inset->paragraphs().back().setLayout(buffer.params().documentClass().emptyLayout()); } @@ -1097,7 +1097,7 @@ void toggleFixedWidth(Cursor & cur, InsetText * inset, bool fixedWidth) cur.push(*inset); // undo information has already been recorded inset->getText(0)->setLayout(cur.bv().buffer(), 0, cur.lastpit() + 1, - bp.textClass().emptyLayoutName()); + bp.documentClass().emptyLayoutName()); cur.pop(); } @@ -3175,7 +3175,7 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection) void InsetTabular::updateLabels(ParIterator const & it) { // In a longtable, tell captions what the current float is - Counters & cnts = buffer().params().textClass().counters(); + Counters & cnts = buffer().params().documentClass().counters(); string const saveflt = cnts.current_float(); if (tabular.isLongTabular()) cnts.current_float("table"); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index d6975558aa..83f705dbf0 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -103,7 +103,7 @@ InsetText::InsetText(BufferParams const & bp) { paragraphs().push_back(Paragraph()); Paragraph & ourpar = paragraphs().back(); - ourpar.setEmptyOrDefaultLayout(bp.textClass()); + ourpar.setEmptyOrDefaultLayout(bp.documentClass()); ourpar.setInsetOwner(this); } diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index 91d0808de8..580c8c5a9c 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -107,7 +107,7 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetWrap::updateLabels(ParIterator const & it) { - Counters & cnts = buffer().params().textClass().counters(); + Counters & cnts = buffer().params().documentClass().counters(); string const saveflt = cnts.current_float(); // Tell to captions what the current float is diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 05f001f410..0efc7d6e73 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -101,7 +101,7 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf, ParagraphList::const_iterator const & pbegin, ParagraphList::const_iterator const & pend) { - LayoutPtr const & defaultstyle = buf.params().textClass().defaultLayout(); + LayoutPtr const & defaultstyle = buf.params().documentClass().defaultLayout(); for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) { if (par != pbegin) os << '\n'; @@ -127,7 +127,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, ParagraphList::const_iterator const & pend) { ParagraphList::const_iterator par = pbegin; - LayoutPtr const & defaultstyle = buf.params().textClass().defaultLayout(); + LayoutPtr const & defaultstyle = buf.params().documentClass().defaultLayout(); LayoutPtr const & bstyle = par->layout(); string item_tag; diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 9d2e08d988..335c7d01f9 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -109,7 +109,7 @@ TeXEnvironment(Buffer const & buf, BufferParams const & bparams = buf.params(); LayoutPtr const & style = pit->forceEmptyLayout() ? - bparams.textClass().emptyLayout() : pit->layout(); + bparams.documentClass().emptyLayout() : pit->layout(); ParagraphList const & paragraphs = text.paragraphs(); @@ -309,7 +309,7 @@ TeXOnePar(Buffer const & buf, // In an inset with unlimited length (all in one row), // force layout to default LayoutPtr const style = pit->forceEmptyLayout() ? - bparams.textClass().emptyLayout() : pit->layout(); + bparams.documentClass().emptyLayout() : pit->layout(); OutputParams runparams = runparams_in; runparams.moving_arg |= style->needprotect; @@ -477,7 +477,7 @@ TeXOnePar(Buffer const & buf, } } - bool const useSetSpace = bparams.textClass().provides("SetSpace"); + bool const useSetSpace = bparams.documentClass().provides("SetSpace"); if (pit->allowParagraphCustomization()) { if (pit->params().startOfAppendix()) { os << "\\appendix\n"; @@ -741,7 +741,7 @@ void latexParagraphs(Buffer const & buf, bool was_title = false; bool already_title = false; BufferParams const & bparams = buf.params(); - TextClass const & tclass = bparams.textClass(); + DocumentClass const & tclass = bparams.documentClass(); ParagraphList const & paragraphs = text.paragraphs(); ParagraphList::const_iterator par = paragraphs.begin(); ParagraphList::const_iterator endpar = paragraphs.end(); diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index 7d984f61ad..e8241050b0 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -76,7 +76,7 @@ void breakParagraph(BufferParams const & bparams, tmp->setInsetOwner(par.inInset()); // without doing that we get a crash when typing at the // end of a paragraph - tmp->setEmptyOrDefaultLayout(bparams.textClass()); + tmp->setEmptyOrDefaultLayout(bparams.documentClass()); // layout stays the same with latex-environments if (keep_layout) { @@ -141,7 +141,7 @@ void breakParagraph(BufferParams const & bparams, par.params().clear(); // do not lose start of appendix marker (bug 4212) par.params().startOfAppendix(soa); - par.setEmptyOrDefaultLayout(bparams.textClass()); + par.setEmptyOrDefaultLayout(bparams.documentClass()); } // layout stays the same with latex-environments diff --git a/src/sgml.cpp b/src/sgml.cpp index 68d922e76e..1611f32495 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -121,7 +121,7 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, // and adds a number for uniqueness. // If you know what you are doing, you can set allowed=="" // to disable this mangling. - TextClass const & tclass = buf.params().textClass(); + DocumentClass const & tclass = buf.params().documentClass(); docstring const allowed = from_ascii( runparams.flavor == OutputParams::XML ? ".-_:" : tclass.options()); @@ -204,7 +204,7 @@ void sgml::openTag(Buffer const & buf, odocstream & os, LayoutPtr const & style = par.layout(); string const & name = style->latexname(); string param = style->latexparam(); - Counters & counters = buf.params().textClass().counters(); + Counters & counters = buf.params().documentClass().counters(); string id = par.getID(buf, runparams); -- 2.39.5