Juergen Spitzmueller wrote:
> Yes, that's true. The old code was broken as well. And that seems to be
> the reason why forceDefaultParagraph does not force Standard paragraphs in
> the output of tabulars (this is triggered by the Paragraph code and seems
> to work for ERT).
> Basically, we'd have to implement forceDefaultParagraphs in insettext and
> let insettext know when it is a non fixed-width tabular cell ...
With the problem that this cached information gets easily outdated. What
about the following: Add a forceDefaultParagraphs flag to Outputparams and
use that instead of Paragraph::forceDefault? The patch is not complete (ERT
is missing), but just a demonstration of teh idea.
Georg
Index: src/outputparams.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/outputparams.C,v
retrieving revision 1.4
diff -u -p -r1.4 outputparams.C
--- src/outputparams.C 9 Sep 2005 11:04:52 -0000 1.4
+++ src/outputparams.C 16 Nov 2005 09:35:57 -0000
@@ -18,7 +18,8 @@ OutputParams::OutputParams()
: flavor(LATEX), nice(false), moving_arg(false),
local_font(0), free_spacing(false), use_babel(false),
linelen(0), depth(0),
- exportdata(new ExportData)
+ exportdata(new ExportData),
+ forceDefaultParagraphs(false)
{}
Index: src/outputparams.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/outputparams.h,v
retrieving revision 1.14
diff -u -p -r1.14 outputparams.h
--- src/outputparams.h 9 Sep 2005 11:04:52 -0000 1.14
+++ src/outputparams.h 16 Nov 2005 09:35:57 -0000
@@ -89,6 +89,9 @@ public:
OutputParams instances.
*/
boost::shared_ptr<ExportData> exportdata;
+
+ ///
+ bool forceDefaultParagraphs;
};
#endif // NOT OUTPUTPARAMS_H
Index: src/output_latex.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/output_latex.C,v
retrieving revision 1.21
diff -u -p -r1.21 output_latex.C
--- src/output_latex.C 15 Jul 2005 11:14:08 -0000 1.21
+++ src/output_latex.C 16 Nov 2005 09:35:57 -0000
@@ -225,14 +225,14 @@ TeXOnePar(Buffer const & buf,
bool further_blank_line = false;
LyXLayout_ptr style;
- // In an an inset with unlimited length (all in one row),
+ OutputParams runparams = runparams_in;
+ // In an inset with unlimited length (all in one row),
// force layout to default
- if (!pit->forceDefaultParagraphs())
+ if (!runparams.forceDefaultParagraphs)
style = pit->layout();
else
style = bparams.getLyXTextClass().defaultLayout();
- OutputParams runparams = runparams_in;
runparams.moving_arg |= style->needprotect;
Language const * language = pit->getParLanguage(bparams);
@@ -277,9 +277,9 @@ TeXOnePar(Buffer const & buf,
texrow.newline();
}
- // In an an inset with unlimited length (all in one row),
+ // In an inset with unlimited length (all in one row),
// don't allow any special options in the paragraph
- if (!pit->forceDefaultParagraphs()) {
+ if (!runparams.forceDefaultParagraphs) {
if (pit->params().startOfAppendix()) {
os << "\\appendix\n";
texrow.newline();
@@ -396,7 +395,7 @@ paragraphs);
}
}
- if (!pit->forceDefaultParagraphs()) {
+ if (!runparams.forceDefaultParagraphs) {
further_blank_line = false;
if (further_blank_line) {
@@ -465,8 +464,8 @@ void latexParagraphs(Buffer const & buf,
// well we have to check if we are in an inset with unlimited
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
- // any environment other then "Standard" to be valid!
- if (!par->forceDefaultParagraphs()) {
+ // any environment other than "Standard" to be valid!
+ if (!runparams.forceDefaultParagraphs) {
LyXLayout_ptr const & layout = par->layout();
if (layout->intitle) {
Index: src/tabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular.C,v
retrieving revision 1.227
diff -u -p -r1.227 tabular.C
--- src/tabular.C 7 Sep 2005 10:37:00 -0000 1.227
+++ src/tabular.C 16 Nov 2005 09:35:57 -0000
@@ -1967,6 +1980,7 @@ int LyXTabular::TeXRow(ostream & os, row
idx_type cell = getCellNumber(i, 0);
int ret = TeXTopHLine(os, i);
+ OutputParams tmpparams = runparams;
for (col_type j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
@@ -1980,7 +1994,8 @@ int LyXTabular::TeXRow(ostream & os, row
if (rtl)
os << "\\R{";
- ret += inset->latex(buf, os, runparams);
+ tmpparams.forceDefaultParagraphs = getPWidth(cell).zero();
+ ret += inset->latex(buf, os, tmpparams);
if (rtl)
os << '}';
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.415
diff -u -p -r1.415 paragraph.C
--- src/paragraph.C 7 Nov 2005 11:28:11 -0000 1.415
+++ src/paragraph.C 16 Nov 2005 09:35:57 -0000
@@ -701,12 +701,6 @@ InsetBibitem * Paragraph::bibitem() cons
}
-bool Paragraph::forceDefaultParagraphs() const
-{
- return inInset() && inInset()->forceDefaultParagraphs(inInset());
-}
-
-
namespace {
// paragraphs inside floats need different alignment tags to avoid
@@ -883,8 +877,8 @@ bool Paragraph::simpleTeXOnePar(Buffer c
// well we have to check if we are in an inset with unlimited
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
- // any environment other then "Standard" to be valid!
- bool asdefault = forceDefaultParagraphs();
+ // any environment other than "Standard" to be valid!
+ bool asdefault = runparams.forceDefaultParagraphs;
if (asdefault) {
style = bparams.getLyXTextClass().defaultLayout();
Index: src/paragraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
retrieving revision 1.157
diff -u -p -r1.157 paragraph.h
--- src/paragraph.h 7 Sep 2005 10:36:59 -0000 1.157
+++ src/paragraph.h 16 Nov 2005 09:35:57 -0000
@@ -178,8 +177,6 @@ public:
InsetBase * inInset() const;
///
InsetBase::Code ownerCode() const;
- ///
- bool forceDefaultParagraphs() const;
///
lyx::pos_type size() const { return text_.size(); }