OK, here's another go, along the lines of the suggestions made in my last message. The point of this is basically to introduce a new type, DocumentClass. These are just TextClass objects, basically, but they are specifically the ones that represent the layout information for a Buffer, and they are the ones held in the TextClassBundle, now renamed as a DocumentClassBundle. The point of this, of course, is to make sure that, when we mean to be talking about a DocumentClass, we're talking about a DocumentClass and not some other kind of TextClass; and we also strictly control the creation of DocumentClass objects, so that they must be created as members of the DocumentClassBundle.

There is more that could be done here. Maybe Buffer::doc_class_ should be a DocumentClass& instead of a DocumentClass*. But the point of this is just to get rid of TextClassPtr without losing the type safety that it had provided.

Most of the action, again, is in TextClass.{h,cpp}. The rest is mostly just adjustment to the type change. I've also taken the opportunity to make some things const that weren't before.

Comments appreciated.

Richard

Index: src/TextClass.h
===================================================================
--- src/TextClass.h	(revision 23261)
+++ src/TextClass.h	(working copy)
@@ -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 support { class FileName; }
 
+class Counters;
+class FloatList;
 class Layout;
 class Lexer;
-class Counters;
-class FloatList;
 
 
 /// A TextClass represents a collection of layout information: At the 
@@ -292,34 +291,44 @@
 };
 
 
+/// 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 {
+public:
+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.
 ///
 /// 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<TextClassPtr> tc_list_;
+	std::list<DocumentClass> tc_list_;
 };
 
 
Index: src/TextClass.cpp
===================================================================
--- src/TextClass.cpp	(revision 23261)
+++ src/TextClass.cpp	(working copy)
@@ -1131,28 +1131,24 @@
 }
 
 
-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<TextClassPtr>::iterator it  = tc_list_.begin();
-	std::list<TextClassPtr>::iterator end = tc_list_.end();
-	for (; it != end; ++it)
-		delete *it;
-}
+DocumentClass::DocumentClass(TextClass const & tc) :
+	TextClass(tc)
+{}
 
 
 ostream & operator<<(ostream & os, PageSides p)
Index: src/BufferParams.h
===================================================================
--- src/BufferParams.h	(revision 23261)
+++ src/BufferParams.h	(working copy)
@@ -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 BaseClassIndex;
 class BranchList;
 class Bullet;
+class DocumentClass;
 class Encoding;
 class Language;
 class Lexer;
@@ -118,13 +118,13 @@
 	/// Returns the TextClass 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;
+	/// \return A pointer to the DocumentClass currently in use: the BaseClass 
+	/// as modified by modules. 
+	DocumentClass * documentClass() 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 setTextClass(DocumentClass const * const);
 	/// List of modules in use
 	std::vector<std::string> const & getModules() const;
 	/// Add a module to the list of modules in use.
@@ -327,9 +327,9 @@
 
 	/// for use with natbib
 	biblio::CiteEngine cite_engine_;
-	/// the possibly modular TextClass actually in use
-	TextClassPtr textClass_;
 	///
+	DocumentClass * doc_class_;
+	///
 	typedef std::vector<std::string> LayoutModuleList;
 	/// 
 	LayoutModuleList layoutModules_;
Index: src/BufferParams.cpp
===================================================================
--- src/BufferParams.cpp	(revision 23261)
+++ src/BufferParams.cpp	(working copy)
@@ -1373,17 +1373,18 @@
 
 TextClass const & BufferParams::textClass() const
 {
-	return *textClass_;
+	return *doc_class_;
 }
 
 
-TextClassPtr BufferParams::textClassPtr() const {
-	return textClass_;
+DocumentClass * BufferParams::documentClass() const {
+	return doc_class_;
 }
 
 
-void BufferParams::setTextClass(TextClassPtr tc) {
-	textClass_ = tc;
+void BufferParams::setTextClass(DocumentClass const * const tc) {
+	// evil, but this function is evil
+	doc_class_ = const_cast<DocumentClass *>(tc);
 }
 
 
@@ -1410,7 +1411,7 @@
 
 void BufferParams::makeTextClass()
 {
-	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 
@@ -1440,7 +1441,7 @@
 			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);
Index: src/BufferView.cpp
===================================================================
--- src/BufferView.cpp	(revision 23261)
+++ src/BufferView.cpp	(working copy)
@@ -1887,7 +1887,7 @@
 		el = buf.errorList("Parse");
 		buffer_.undo().recordUndo(d->cursor_);
 		cap::pasteParagraphList(d->cursor_, buf.paragraphs(),
-					     buf.params().textClassPtr(), el);
+					     buf.params().documentClass(), el);
 		res = _("Document %1$s inserted.");
 	} else {
 		res = _("Could not insert document %1$s");
Index: src/CutAndPaste.h
===================================================================
--- src/CutAndPaste.h	(revision 23261)
+++ src/CutAndPaste.h	(working copy)
@@ -14,8 +14,6 @@
 #ifndef CUTANDPASTE_H
 #define CUTANDPASTE_H
 
-#include "TextClassPtr.h"
-
 #include "support/docstring.h"
 
 #include "frontends/Clipboard.h"
@@ -27,6 +25,7 @@
 namespace lyx {
 
 class Buffer;
+class DocumentClass;
 class ErrorList;
 class InsetText;
 class Cursor;
@@ -101,15 +100,15 @@
 /// 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.
Index: src/CutAndPaste.cpp
===================================================================
--- src/CutAndPaste.cpp	(revision 23261)
+++ src/CutAndPaste.cpp	(working copy)
@@ -70,7 +70,7 @@
 
 typedef pair<pit_type, int> PitPosPair;
 
-typedef limited_stack<pair<ParagraphList, TextClassPtr> > CutStack;
+typedef limited_stack<pair<ParagraphList, DocumentClass const *> > CutStack;
 
 CutStack theCuts(10);
 // persistent selection, cleared until the next selection
@@ -106,7 +106,7 @@
 
 pair<PitPosPair, pit_type>
 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 @@
 
 	// Make a copy of the CaP paragraphs.
 	ParagraphList insertion = parlist;
-	TextClassPtr const tc = buffer.params().textClassPtr();
+	DocumentClass const * const tc = buffer.params().documentClass();
 
 	// Now remove all out of the pars which is NOT allowed in the
 	// new environment and set also another font if that is required.
@@ -162,7 +162,7 @@
 	// 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 @@
 }
 
 
-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().setTextClass(docclass);
 	ostringstream lyx;
 	if (buffer.write(lyx))
 		theClipboard().put(lyx.str(), plaintext);
@@ -336,7 +336,7 @@
 
 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 @@
 	// 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<DocumentClass *>(dc);
+	cutstack.push(make_pair(copy_pars, d));
 }
 
 } // namespace anon
@@ -392,8 +393,8 @@
 }
 
 
-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 @@
 	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);
@@ -518,7 +519,7 @@
 				text->paragraphs(),
 				begpit, endpit,
 				cur.selBegin().pos(), endpos,
-				bp.textClassPtr(), theCuts);
+				bp.documentClass(), theCuts);
 			// Stuff what we got on the clipboard.
 			// Even if there is no selection.
 			putClipboard(theCuts[0].first, theCuts[0].second,
@@ -602,7 +603,7 @@
 
 		copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
 			pos, cur.selEnd().pos(), 
-			cur.buffer().params().textClassPtr(), cutstack);
+			cur.buffer().params().documentClass(), cutstack);
 		dirtyTabularStack(false);
 	}
 
@@ -614,7 +615,7 @@
 		par.setLayout(bp.textClass().defaultLayout());
 		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.documentClass()));
 	}
 }
 
@@ -641,7 +642,7 @@
 		par.setLayout(bp.textClass().defaultLayout());
 		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.documentClass()));
 	} else {
 		copySelectionToStack(cur, theCuts);
 	}
@@ -692,7 +693,7 @@
 
 
 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 +703,7 @@
 		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 +746,7 @@
 			if (buffer.readString(lyx)) {
 				cur.recordUndo();
 				pasteParagraphList(cur, buffer.paragraphs(),
-					buffer.params().textClassPtr(), errorList);
+					buffer.params().documentClass(), errorList);
 				cur.setSelection();
 				return;
 			}
Index: src/factory.cpp
===================================================================
--- src/factory.cpp	(revision 23261)
+++ src/factory.cpp	(working copy)
@@ -102,7 +102,7 @@
 
 		case LFUN_FLEX_INSERT: {
 			string s = cmd.getArg(0);
-			return new InsetFlex(params, params.textClassPtr(), s);
+			return new InsetFlex(params, params.documentClass(), s);
 		}
 
 		case LFUN_NOTE_INSERT: {
@@ -484,7 +484,7 @@
 			lex.next();
 			string s = lex.getString();
 			inset.reset(new InsetFlex(buf.params(), 
-				buf.params().textClassPtr(), s));
+				buf.params().documentClass(), s));
 		} else if (tmptok == "Branch") {
 			inset.reset(new InsetBranch(buf.params(),
 						    InsetBranchParams()));
Index: src/LyXFunc.h
===================================================================
--- src/LyXFunc.h	(revision 23261)
+++ src/LyXFunc.h	(working copy)
@@ -17,7 +17,6 @@
 
 #include "KeySequence.h"
 #include "lfuns.h"
-#include "TextClassPtr.h"
 
 #include "support/docstring.h"
 
@@ -25,6 +24,7 @@
 
 class Buffer;
 class BufferView;
+class DocumentClass;
 class FuncRequest;
 class FuncStatus;
 class KeySymbol;
@@ -136,7 +136,7 @@
 	///
 	bool ensureBufferClean(BufferView * bv);
 	///
-	void updateLayout(TextClassPtr oldlayout, Buffer * buffer);
+	void updateLayout(DocumentClass * oldlayout, Buffer * buffer);
 };
 
 /// Implementation is in LyX.cpp
Index: src/LyXFunc.cpp
===================================================================
--- src/LyXFunc.cpp	(revision 23261)
+++ src/LyXFunc.cpp	(working copy)
@@ -1538,7 +1538,7 @@
 			
 			Buffer * buffer = lyx_view_->buffer();
 
-			TextClassPtr oldClass = buffer->params().textClassPtr();
+			DocumentClass * oldClass = buffer->params().documentClass();
 
 			Cursor & cur = view()->cursor();
 			cur.recordUndoFullDocument();
@@ -1582,7 +1582,7 @@
 		case LFUN_LAYOUT_MODULES_CLEAR: {
 			BOOST_ASSERT(lyx_view_);
 			Buffer * buffer = lyx_view_->buffer();
-			TextClassPtr oldClass = buffer->params().textClassPtr();
+			DocumentClass * oldClass = buffer->params().documentClass();
 			view()->cursor().recordUndoFullDocument();
 			buffer->params().clearLayoutModules();
 			buffer->params().makeTextClass();
@@ -1594,7 +1594,7 @@
 		case LFUN_LAYOUT_MODULE_ADD: {
 			BOOST_ASSERT(lyx_view_);
 			Buffer * buffer = lyx_view_->buffer();
-			TextClassPtr oldClass = buffer->params().textClassPtr();
+			DocumentClass * oldClass = buffer->params().documentClass();
 			view()->cursor().recordUndoFullDocument();
 			buffer->params().addLayoutModule(argument);
 			buffer->params().makeTextClass();
@@ -1623,7 +1623,7 @@
 				break;
 
 			//Save the old, possibly modular, layout for use in conversion.
-			TextClassPtr oldClass = buffer->params().textClassPtr();
+			DocumentClass * oldClass = buffer->params().documentClass();
 			view()->cursor().recordUndoFullDocument();
 			buffer->params().setBaseClass(new_class);
 			buffer->params().makeTextClass();
@@ -1635,7 +1635,7 @@
 		case LFUN_LAYOUT_RELOAD: {
 			BOOST_ASSERT(lyx_view_);
 			Buffer * buffer = lyx_view_->buffer();
-			TextClassPtr oldClass = buffer->params().textClassPtr();
+			DocumentClass * oldClass = buffer->params().documentClass();
 			BaseClassIndex const tc = buffer->params().baseClass();
 			baseclasslist.reset(tc);
 			buffer->params().setBaseClass(tc);
@@ -1875,14 +1875,14 @@
 }
 
 
-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().documentClass(),
 			static_cast<InsetText &>(buffer->inset()), el);
 
 	view()->setCursor(backcur.asDocIterator(&(buffer->inset())));
Index: src/Text.cpp
===================================================================
--- src/Text.cpp	(revision 23261)
+++ src/Text.cpp	(working copy)
@@ -1104,7 +1104,7 @@
 		for (; it != it_end; it++)
 			it->changeLanguage(b.params(), latex_language, b.language());
 
-		pasteParagraphList(cur, plist, b.params().textClassPtr(),
+		pasteParagraphList(cur, plist, b.params().documentClass(),
 				   b.errorList("Paste"));
 		// restore position
 		cur.pit() = min(cur.lastpit(), spit);
Index: src/frontends/qt4/GuiToolbars.h
===================================================================
--- src/frontends/qt4/GuiToolbars.h	(revision 23261)
+++ src/frontends/qt4/GuiToolbars.h	(working copy)
@@ -14,14 +14,13 @@
 #ifndef GUI_TOOLBARS_H
 #define GUI_TOOLBARS_H
 
-#include "TextClassPtr.h"
-
 #include "support/docstring.h"
 
 #include <map>
 
 namespace lyx {
 
+class DocumentClass;
 class ToolbarInfo;
 
 namespace frontend {
@@ -86,7 +85,7 @@
 	ToolbarsMap toolbars_;
 
 	/// The last textclass layout list in the layout choice selector
-	TextClassPtr last_textclass_;
+	DocumentClass * last_textclass_;
 };
 
 
Index: src/insets/InsetCollapsable.h
===================================================================
--- src/insets/InsetCollapsable.h	(revision 23261)
+++ src/insets/InsetCollapsable.h	(working copy)
@@ -19,7 +19,6 @@
 
 #include "Box.h"
 #include "TextClass.h"
-#include "TextClassPtr.h"
 
 #include <string>
 
@@ -42,7 +41,7 @@
 	InsetCollapsable(
 		BufferParams const &,
 		CollapseStatus status = Inset::Open,
-		TextClassPtr tc = 0
+		DocumentClass * tc = 0
 		);
 	///
 	InsetCollapsable(InsetCollapsable const & rhs);
@@ -64,7 +63,7 @@
 	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; }
 	///
@@ -177,10 +176,7 @@
 	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;
Index: src/insets/InsetCollapsable.cpp
===================================================================
--- src/insets/InsetCollapsable.cpp	(revision 23261)
+++ src/insets/InsetCollapsable.cpp	(working copy)
@@ -78,11 +78,11 @@
 
 
 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);
@@ -92,7 +92,6 @@
 
 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 @@
 
 void InsetCollapsable::setLayout(BufferParams const & bp)
 {
-	setLayout(bp.textClassPtr());
+	setLayout(bp.documentClass());
 }
 
 
-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();
Index: src/insets/InsetFlex.h
===================================================================
--- src/insets/InsetFlex.h	(revision 23261)
+++ src/insets/InsetFlex.h	(working copy)
@@ -26,7 +26,7 @@
 class InsetFlex : public InsetCollapsable {
 public:
 	///
-	InsetFlex(BufferParams const &,TextClassPtr tc, 
+	InsetFlex(BufferParams const &, DocumentClass * dc, 
 			string const & layoutName);
 	///
 	docstring name() const { return from_utf8(name_); }
Index: src/insets/InsetFlex.cpp
===================================================================
--- src/insets/InsetFlex.cpp	(revision 23261)
+++ src/insets/InsetFlex.cpp	(working copy)
@@ -40,11 +40,11 @@
 
 
 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();
 }
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 23261)
+++ src/Makefile.am	(working copy)
@@ -262,7 +262,6 @@
 	TexStream.h \
 	Text.h \
 	TextClass.h \
-	TextClassPtr.h \
 	TextMetrics.h \
 	TocBackend.h \
 	ToolbarBackend.h \
Index: development/scons/scons_manifest.py
===================================================================
--- development/scons/scons_manifest.py	(revision 23261)
+++ development/scons/scons_manifest.py	(working copy)
@@ -113,7 +113,6 @@
     TexRow.h
     Text.h
     TextClass.h
-    TextClassPtr.h
     TextMetrics.h
     Thesaurus.h
     TocBackend.h

Reply via email to