From f5a0bad734f24ed5a774abc9f9086725c232babc Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 16 Sep 2003 13:43:30 +0000 Subject: [PATCH] Define a wrapper LyXFont_size for LyXFont::FONT_SIZE. Use it in paragraph.[Ch], allowing the removal of #include "lyxfont.h" from paragraph.h. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7772 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 9 +++++++++ src/insets/ChangeLog | 4 ++++ src/insets/insetbibitem.C | 1 + src/lyxfont.h | 13 +++++++++++++ src/paragraph.C | 4 ++-- src/paragraph.h | 9 ++++----- 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 24d007561e..b49edb0215 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2003-09-16 Angus Leeming + + * lyxfont.h (LyXFont_size): a wrapper class for LyXFont::FONT_SIZE. + + * paragraph.[Ch] (highestFontInRange): use LyXFont_size as function + arg/return type. + + * paragraph.h: remove #include "lyxfont.h". Forward declare LyXFont_size. + 2003-09-16 Angus Leeming * paragraph.C (IsInsetChar): new function in namespace anon, moved out of diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 0798436326..022715c02a 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-09-16 Angus Leeming + + * insetbibitem.C: add #include "lyxfont.h". + 2003-09-16 Lars Gullik Bjønnes * insetgraphics.C: diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index db28388306..2f21e403d9 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -14,6 +14,7 @@ #include "buffer.h" #include "BufferView.h" #include "funcrequest.h" +#include "lyxfont.h" #include "lyxlex.h" #include "paragraph.h" diff --git a/src/lyxfont.h b/src/lyxfont.h index 88f2a2f47c..193f0059be 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -357,6 +357,19 @@ private: }; +/** \c LyXFont_size is a wrapper for LyXFont::FONT_SIZE. + * It can be forward-declared andpassed as a function argument without + * having to expose lyxfont.h. + */ +class LyXFont_size { + LyXFont::FONT_SIZE val_; +public: + LyXFont_size(LyXFont::FONT_SIZE val) : val_(val) {} + operator LyXFont::FONT_SIZE() const{ return val_; } +}; + + + inline LyXFont::FONT_SHAPE LyXFont::shape() const { diff --git a/src/paragraph.C b/src/paragraph.C index 671e3af713..084f59d191 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -406,9 +406,9 @@ LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams, /// Returns the height of the highest font in range -LyXFont::FONT_SIZE +LyXFont_size Paragraph::highestFontInRange(pos_type startpos, pos_type endpos, - LyXFont::FONT_SIZE const def_size) const + LyXFont_size def_size) const { if (pimpl_->fontlist.empty()) return def_size; diff --git a/src/paragraph.h b/src/paragraph.h index fa2a4eb92a..e06fe95de7 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -19,7 +19,6 @@ #include "changes.h" #include "InsetList.h" #include "lyxlayout_ptr_fwd.h" -#include "lyxfont.h" // Just for LyXFont::FONT_SIZE #include "RowList_fwd.h" #include "insets/inset.h" // Just for InsetOld::Code @@ -36,6 +35,7 @@ class InsetBibitem; class Language; class LaTeXFeatures; class LatexRunParams; +class LyXFont_size; class ParagraphParameters; class TexRow; class UpdatableInset; @@ -243,10 +243,9 @@ public: /// pos <= size() (there is a dummy font change at the end of each par) void setFont(lyx::pos_type pos, LyXFont const & font); /// Returns the height of the highest font in range - LyXFont::FONT_SIZE - highestFontInRange(lyx::pos_type startpos, - lyx::pos_type endpos, - LyXFont::FONT_SIZE const def_size) const; + LyXFont_size highestFontInRange(lyx::pos_type startpos, + lyx::pos_type endpos, + LyXFont_size def_size) const; /// void insertChar(lyx::pos_type pos, value_type c); /// -- 2.39.2