]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
Don't output box width if it's 100% (default).
[lyx.git] / src / insets / InsetTOC.cpp
index 2e4939776f8558484a19c819453f4b1e0dd88666..7c7fa7c454279272d4b9b053d7de740fa6b8f8c1 100644 (file)
 
 #include "Buffer.h"
 #include "BufferParams.h"
+#include "Cursor.h"
 #include "DispatchResult.h"
 #include "Font.h"
+#include "FuncRequest.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "OutputParams.h"
@@ -58,6 +60,21 @@ docstring InsetTOC::screenLabel() const
 }
 
 
+void InsetTOC::doDispatch(Cursor & cur, FuncRequest & cmd) {
+       switch (cmd.action()) {
+       case LFUN_MOUSE_RELEASE:
+               if (!cur.selection() && cmd.button() == mouse_button::button1) {
+                       showInsetDialog(&cur.bv());
+                       cur.dispatched();
+               }
+               break;
+       
+       default:
+               InsetCommand::doDispatch(cur, cmd);
+       }
+}
+
+
 int InsetTOC::plaintext(odocstream & os, OutputParams const &) const
 {
        os << screenLabel() << "\n\n";
@@ -115,13 +132,13 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
                        continue;
                
                if (depth > lastdepth) {
-                       xs.cr();
+                       xs << html::CR();
                        // open as many tags as we need to open to get to this level
                        // this includes the tag for the current level
                        for (int i = lastdepth + 1; i <= depth; ++i) {
                                stringstream attr;
                                attr << "class='lyxtoc-" << i << "'";
-                               xs << html::StartTag("div", attr.str());
+                               xs << html::StartTag("div", attr.str()) << html::CR();
                        }
                        lastdepth = depth;
                }
@@ -129,18 +146,18 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
                        // close as many as we have to close to get back to this level
                        // this includes closing the last tag at this level
                        for (int i = lastdepth; i >= depth; --i) 
-                               xs << html::EndTag("div");
+                               xs << html::EndTag("div") << html::CR();
                        // now open our tag
                        stringstream attr;
                        attr << "class='lyxtoc-" << depth << "'";
-                       xs << html::StartTag("div", attr.str());
+                       xs << html::StartTag("div", attr.str()) << html::CR();
                        lastdepth = depth;
                } else {
                        // no change of level, so close and open
-                       xs << html::EndTag("div");
+                       xs << html::EndTag("div") << html::CR();
                        stringstream attr;
                        attr << "class='lyxtoc-" << depth << "'";
-                       xs << html::StartTag("div", attr.str());
+                       xs << html::StartTag("div", attr.str()) << html::CR();
                }
                
                // Now output TOC info for this entry
@@ -161,12 +178,12 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
                // FIXME XHTML 
                // There ought to be a simple way to customize this.
                // Maybe if we had an InsetLayout for TOC...
-               xs << XHTMLStream::NextRaw() << "&gt;";
+               xs << XHTMLStream::ESCAPE_NONE << "&gt;";
                xs << html::EndTag("a");                
        }
        for (int i = lastdepth; i > 0; --i) 
-               xs << html::EndTag("div");
-       xs << html::EndTag("div");
+               xs << html::EndTag("div") << html::CR();
+       xs << html::EndTag("div") << html::CR();
        return ods.str();
 }