]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettoc.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insettoc.C
index 876c9b0e75a41397c942c1c95fb4fdd5358ca041..53cb0189c0f39327a5f760ecdae76152b5b9827a 100644 (file)
@@ -5,7 +5,7 @@
  *
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 #include <config.h>
 
@@ -35,7 +35,7 @@ InsetTOC::~InsetTOC()
 }
 
 
-string const InsetTOC::getScreenLabel(Buffer const *) const
+string const InsetTOC::getScreenLabel(Buffer const &) const
 {
        string const cmdname(getCmdName());
 
@@ -54,6 +54,21 @@ InsetOld::Code InsetTOC::lyxCode() const
 }
 
 
+void InsetTOC::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       InsetCommand::metrics(mi, dim);
+       center_indent_ = (mi.base.textwidth - dim.wid) / 2;
+       dim.wid = mi.base.textwidth;
+       dim_ = dim;
+}
+
+
+void InsetTOC::draw(PainterInfo & pi, int x, int y) const
+{
+       InsetCommand::draw(pi, x + center_indent_, y);
+}
+
+
 dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
 {
        switch (cmd.action) {
@@ -66,7 +81,7 @@ dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
 }
 
 
-int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
+int InsetTOC::ascii(Buffer const & buffer, ostream & os, int) const
 {
        os << getScreenLabel(buffer) << "\n\n";
 
@@ -77,7 +92,7 @@ int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
 }
 
 
-int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
+int InsetTOC::linuxdoc(Buffer const &, ostream & os) const
 {
        if (getCmdName() == "tableofcontents")
                os << "<toc>";
@@ -85,7 +100,7 @@ int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetTOC::docbook(Buffer const *, ostream & os, bool) const
+int InsetTOC::docbook(Buffer const &, ostream & os, bool) const
 {
        if (getCmdName() == "tableofcontents")
                os << "<toc></toc>";