]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
DocBook: fix handling of footnotes.
[lyx.git] / src / insets / InsetText.cpp
index fa1f40c7afa14a9a18d9556cb6ce7fee138906c2..95d55b765b1c187d52bc0127d228c852e785019e 100644 (file)
@@ -184,6 +184,15 @@ void InsetText::read(Lexer & lex)
 }
 
 
+void InsetText::setOuterFont(BufferView & bv, FontInfo const & outer) const
+{
+       TextMetrics & tm = bv.textMetrics(&text_);
+       FontInfo tmpfont = getFont();
+       tmpfont.realize(outer);
+       tm.font_.fontInfo() = tmpfont;
+}
+
+
 void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        TextMetrics & tm = mi.base.bv->textMetrics(&text_);
@@ -191,11 +200,13 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
        //lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
 
        int const horiz_offset = leftOffset(mi.base.bv) + rightOffset(mi.base.bv);
-
-       // Hand font through to contained lyxtext:
-       tm.font_.fontInfo() = mi.base.font;
        mi.base.textwidth -= horiz_offset;
 
+       // Remember the full outer font
+       setOuterFont(*mi.base.bv, mi.base.font);
+       // and use it in these metrics computation.
+       mi.base.font = tm.font_.fontInfo();
+
        // This can happen when a layout has a left and right margin,
        // and the view is made very narrow. We can't do better than
        // to draw it partly out of view (bug 5890).
@@ -327,13 +338,14 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
                        || cmd.getArg(0) == insetName(lyxCode());
 
                if (!main_inset && target_inset) {
+                       UndoGroupHelper ugh(&buffer());
                        // Text::dissolveInset assumes that the cursor
                        // is inside the Inset.
-                       if (&cur.inset() != this)
+                       if (&cur.inset() != this) {
+                               cur.recordUndo();
                                cur.pushBackward(*this);
-                       cur.beginUndoGroup();
+                       }
                        text_.dispatch(cur, cmd);
-                       cur.endUndoGroup();
                } else
                        cur.undispatched();
                break;
@@ -699,7 +711,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
        // No need for labels that are generated from counters. They should be handled by the external DocBook processor.
 
        // With respect to XHTML, paragraphs are still allowed here.
-       if (!allowMultiPar())
+       if (runparams.docbook_consider_allow_multi_par && !allowMultiPar())
                runparams.docbook_make_pars = false;
        if (il.isPassThru())
                runparams.pass_thru = true;
@@ -933,9 +945,11 @@ bool InsetText::hasCProtectContent(bool fragile) const
 bool InsetText::insetAllowed(InsetCode code) const
 {
        switch (code) {
-       // Arguments and (plain) quotes are also allowed in PassThru insets
+       // Arguments, (plain) quotes and counter insets 
+       // are also allowed in PassThru insets
        case ARG_CODE:
        case QUOTE_CODE:
+       case COUNTER_CODE:
                return true;
        default:
                return !isPassThru();