Juergen Spitzmueller wrote:
> > But I might be in favour.
>
> I'll have a look.

Here is the patch. Works like a charme, except for insettabular. I did not 
find a way to let the tabular cell's (or their insettexts, for that matter) 
return neverIndent() true, so I left the (par.ownerCode() != 
InsetBase::TEXT_CODE || isMainText()) hack in text.C.

Opinions?

Jürgen
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.624
diff -p -u -r1.624 text.C
--- text.C	15 Aug 2005 08:26:53 -0000	1.624
+++ text.C	7 Sep 2005 16:33:30 -0000
@@ -592,14 +592,14 @@ int LyXText::leftMargin(pit_type const p
 	           && !isFirstInSequence(pit, pars_)))
 	    && align == LYX_ALIGN_BLOCK
 	    && !par.params().noindent()
+	    // in some insets, paragraphs are never indented
+	    && !(par.inInset() && par.inInset()->neverIndent())
 	    // display style insets are always centered, omit indentation
 	    && !(!par.empty()
 		    && par.isInset(pos)
 		    && par.getInset(pos)->display())
-	    // in charstyles, tabulars and ert paragraphs are never indented!
-	    && ((par.ownerCode() != InsetBase::TEXT_CODE || isMainText())
-	            && par.ownerCode() != InsetBase::ERT_CODE
-		    && par.ownerCode() != InsetBase::CHARSTYLE_CODE)
+	    // there's obviously no better way to omit indendation in tabular cells :-(
+	    && (par.ownerCode() != InsetBase::TEXT_CODE || isMainText())
 	    && (par.layout() != tclass.defaultLayout()
 	        || bv()->buffer()->params().paragraph_separation ==
 	           BufferParams::PARSEP_INDENT))
Index: insets/insetbase.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbase.h,v
retrieving revision 1.57
diff -p -u -r1.57 insetbase.h
--- insets/insetbase.h	17 Jul 2005 01:13:35 -0000	1.57
+++ insets/insetbase.h	7 Sep 2005 16:33:33 -0000
@@ -338,6 +338,8 @@ public:
 	virtual bool display() const { return false; }
 	/// should we break lines after this inset?
 	virtual bool isLineSeparator() const { return false; }
+	/// should paragraph indendation be ommitted in any case?
+	virtual bool neverIndent() const { return false; }
 	/// dumps content to lyxerr
 	virtual void dump() const;
 	/// write inset in .lyx format
Index: insets/insetcharstyle.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.h,v
retrieving revision 1.14
diff -p -u -r1.14 insetcharstyle.h
--- insets/insetcharstyle.h	4 May 2005 11:21:14 -0000	1.14
+++ insets/insetcharstyle.h	7 Sep 2005 16:33:34 -0000
@@ -86,6 +86,9 @@ public:
 	///
 	InsetCharStyleParams const & params() const { return params_; }
 
+	/// should paragraph indendation be ommitted in any case?
+	bool neverIndent() const { return true; }
+
 protected:
 	InsetCharStyle(InsetCharStyle const &);
 	virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
Index: insets/insetert.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v
retrieving revision 1.111
diff -p -u -r1.111 insetert.h
--- insets/insetert.h	25 Nov 2004 19:13:04 -0000	1.111
+++ insets/insetert.h	7 Sep 2005 16:33:34 -0000
@@ -68,6 +68,8 @@ public:
 	void getDrawFont(LyXFont &) const;
 	///
 	bool forceDefaultParagraphs(InsetBase const *) const { return true; }
+	/// should paragraph indendation be ommitted in any case?
+	bool neverIndent() const { return true; }
 protected:
 	InsetERT(InsetERT const &);
 	///
Index: insets/insetoptarg.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetoptarg.h,v
retrieving revision 1.25
diff -p -u -r1.25 insetoptarg.h
--- insets/insetoptarg.h	11 May 2005 09:47:54 -0000	1.25
+++ insets/insetoptarg.h	7 Sep 2005 16:33:34 -0000
@@ -48,6 +48,9 @@ public:
 			  OutputParams const &) const;
 	/// Write out tothe .lyx file
 	void write(Buffer const & buf, std::ostream & os) const;
+
+	/// should paragraph indendation be ommitted in any case?
+	virtual bool neverIndent() const { return true; }
 protected:
 	InsetOptArg(InsetOptArg const &);
 private:

Reply via email to