]> git.lyx.org Git - lyx.git/blobdiff - src/output_linuxdoc.C
and this
[lyx.git] / src / output_linuxdoc.C
index 213112b490dcffbe83bb82000377f28362391aff..060593c0e506b756fa8f6facc38ced0628852d64 100644 (file)
 #include "bufferparams.h"
 #include "paragraph.h"
 #include "paragraph_funcs.h"
+#include "ParagraphList_fwd.h"
 #include "ParagraphParameters.h"
 #include "sgml.h"
 
 #include <stack>
 
-#ifdef HAVE_LOCALE
-#endif
-
 using std::ostream;
 using std::stack;
 using std::vector;
@@ -35,20 +33,19 @@ void linuxdocParagraphs(Buffer const & buf,
                        ostream & os,
                        OutputParams const & runparams)
 {
-       
+
        Paragraph::depth_type depth = 0; // paragraph depth
        string item_name;
        vector<string> environment_stack(5);
 
-       ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
-       ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
+       ParagraphList::const_iterator pit = paragraphs.begin();
+       ParagraphList::const_iterator pend = paragraphs.end();
        for (; pit != pend; ++pit) {
                LyXLayout_ptr const & style = pit->layout();
                // treat <toc> as a special case for compatibility with old code
-               if (pit->isInset(0)) {
-                       InsetOld * inset = pit->getInset(0);
-                       InsetOld::Code lyx_code = inset->lyxCode();
-                       if (lyx_code == InsetOld::TOC_CODE) {
+               if (!pit->empty() && pit->isInset(0)) {
+                       InsetBase const * inset = pit->getInset(0);
+                       if (inset->lyxCode() == InsetOld::TOC_CODE) {
                                string const temp = "toc";
                                sgml::openTag(os, depth, false, temp);
                                continue;
@@ -92,8 +89,7 @@ void linuxdocParagraphs(Buffer const & buf,
 
                case LATEX_ENVIRONMENT:
                case LATEX_ITEM_ENVIRONMENT:
-               case LATEX_BIB_ENVIRONMENT:
-               {
+               case LATEX_BIB_ENVIRONMENT: {
                        string const & latexname = style->latexname();
 
                        if (depth == pit->params().depth()
@@ -136,7 +132,8 @@ void linuxdocParagraphs(Buffer const & buf,
                        break;
                }
 
-               pit->simpleLinuxDocOnePar(buf, os, outerFont(pit, paragraphs),
+               pit->simpleLinuxDocOnePar(buf, os,
+                       outerFont(pit - paragraphs.begin(), paragraphs),
                                          runparams, depth);
 
                os << "\n";
@@ -160,5 +157,3 @@ void linuxdocParagraphs(Buffer const & buf,
        for (int i = depth; i >= 0; --i)
                sgml::closeTag(os, depth, false, environment_stack[i]);
 }
-
-