implement and use virtual bool neverIndent() (thereby fixing bug 2003)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10436 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2005-09-10 06:51:58 +00:00
parent 568ae274e5
commit 3382c78af9
9 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-08-10 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* text.C (leftMargin): test for insetbase's new neverIndent()
bool instead of listing each and every inset that does not
wish par indendation.
2005-09-09 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* buffer_funcs.C (setCounter): put the code to compute enum label

View File

@ -1,3 +1,13 @@
2005-08-10 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetbase.[Ch]: new bool neverIndent() which indicates if
an inset does not want paragraph indentation at all.
* insetcharstyle.h:
* insetert.h:
* insetoptarg.h: return true for neverIndent()
* insettext.[Ch]: return true for neverIndent() in case
of tabular cells (based on a crude guess).
2005-09-09 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetline.C: Add forgotten include

View File

@ -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

View File

@ -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);

View File

@ -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 &);
///

View File

@ -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:

View File

@ -442,6 +442,15 @@ void InsetText::addPreview(PreviewLoader & loader) const
}
//FIXME: instead of this hack, which only works by chance,
// cells should have their own insetcell type, which returns CELL_CODE!
bool InsetText::neverIndent() const
{
// this is only true for tabular cells
return !text_.isMainText() && lyxCode() == TEXT_CODE;
}
ParagraphList const & InsetText::paragraphs() const
{
return text_.paragraphs();

View File

@ -139,6 +139,8 @@ public:
bool insetAllowed(Code) const { return true; }
///
bool allowSpellCheck() const { return true; }
/// should paragraph indendation be ommitted in any case?
bool neverIndent() const;
///
InsetText(InsetText const &);

View File

@ -591,14 +591,12 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
&& !isFirstInSequence(pit, pars_)))
&& align == LYX_ALIGN_BLOCK
&& !par.params().noindent()
// in some insets, paragraphs are never indented
&& !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)
&& (par.layout() != tclass.defaultLayout()
|| bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT))