]> git.lyx.org Git - features.git/commitdiff
3 more percents...
authorAndré Pönitz <poenitz@gmx.net>
Mon, 18 Jul 2005 12:57:08 +0000 (12:57 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 18 Jul 2005 12:57:08 +0000 (12:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10323 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/paragraph.C
src/paragraph.h
src/support/textutils.h

index 7e3cd21e284d302ca933c6b10852e17071913c37..deebec57b793157d215e0ebca429619da8a4df3b 100644 (file)
@@ -1177,7 +1177,7 @@ InsetTabular::idx_type InsetTabular::getNearestCell(int x, int y) const
 {
        idx_type idx_min = 0;
        int dist_min = std::numeric_limits<int>::max();
-       for (idx_type i = 0; i < nargs(); ++i) {
+       for (idx_type i = 0, n = nargs(); i != n; ++i) {
                if (theCoords.getInsets().has(tabular.getCellInset(i).get())) {
                        int const d = dist(i, x, y);
                        if (d < dist_min) {
@@ -1795,12 +1795,6 @@ void InsetTabular::getSelection(LCursor & cur,
 }
 
 
-size_t InsetTabular::nargs() const
-{
-       return tabular.getNumberOfCells();
-}
-
-
 LyXText * InsetTabular::getText(int idx) const
 {
        return size_t(idx) < nargs() ? cell(idx)->getText(0) : 0;
index 7b8830a47de924b7b90e393bd07feff0a49b5e07..3a421375eb83a3b7917909a84c606033f86f34c1 100644 (file)
@@ -106,7 +106,7 @@ public:
        /// Appends \c list with all labels found within this inset.
        void getLabelList(Buffer const &, std::vector<std::string> & list) const;
        /// number of cells
-       size_t nargs() const;
+       size_t nargs() const { return tabular.getNumberOfCells(); }
        ///
        boost::shared_ptr<InsetText const> cell(idx_type) const;
        ///
index cf1b64320f8cad283ff8dff46f42e122002224e4..61ce57fe8ab43810fc8a217ef3bfacc69e4e9e82 100644 (file)
@@ -406,12 +406,6 @@ void InsetText::setViewCache(BufferView const * bv) const
 }
 
 
-LyXText * InsetText::getText(int i) const
-{
-       return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
-}
-
-
 void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
 {
 #ifdef WITH_WARNINGS
index 639591c1fd333d15df650001284b72a0262c7ff8..65bdbedd8eb7c656c358ec4c73b645a9828272c7 100644 (file)
@@ -100,7 +100,9 @@ public:
        /// Appends \c list with all labels found within this inset.
        void getLabelList(Buffer const &, std::vector<std::string> & list) const;
        ///
-       LyXText * getText(int) const;
+       LyXText * getText(int i) const {
+               return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
+       }
        ///
        bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
 
index 1c8905a331bbf1f9dafd88c45ef7a9d4a8df14a6..36eafed96a4b77d5a7f169fc93cdabe7788f7701 100644 (file)
@@ -300,20 +300,6 @@ bool Paragraph::insetAllowed(InsetBase_code code)
 }
 
 
-InsetBase * Paragraph::getInset(pos_type pos)
-{
-       BOOST_ASSERT(pos < size());
-       return insetlist.get(pos);
-}
-
-
-InsetBase const * Paragraph::getInset(pos_type pos) const
-{
-       BOOST_ASSERT(pos < size());
-       return insetlist.get(pos);
-}
-
-
 // Gets uninstantiated font setting at position.
 LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
                                         pos_type pos) const
@@ -1466,26 +1452,6 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
 }
 
 
-namespace {
-
-/// return true if the char is a meta-character for an inset
-inline
-bool IsInsetChar(char c)
-{
-       return (c == Paragraph::META_INSET);
-}
-
-} // namespace anon
-
-
-
-bool Paragraph::isHfill(pos_type pos) const
-{
-       return isInset(pos)
-               && getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
-}
-
-
 bool Paragraph::isNewline(pos_type pos) const
 {
        return isInset(pos)
@@ -1493,17 +1459,11 @@ bool Paragraph::isNewline(pos_type pos) const
 }
 
 
-bool Paragraph::isSeparator(pos_type pos) const
-{
-       return IsSeparatorChar(getChar(pos));
-}
-
-
 bool Paragraph::isLineSeparator(pos_type pos) const
 {
        value_type const c = getChar(pos);
        return IsLineSeparatorChar(c)
-               || (IsInsetChar(c) && getInset(pos) &&
+               || (c == Paragraph::META_INSET && getInset(pos) &&
                getInset(pos)->isLineSeparator());
 }
 
index 9eeef130fb4e96795582347e177d2e90193ef991..83337fbd14ff2acd26f6a5aa48686ce005288108 100644 (file)
@@ -323,23 +323,27 @@ public:
        ///
        bool insetAllowed(InsetBase_code code);
        ///
-       InsetBase * getInset(lyx::pos_type pos);
-       ///
-       InsetBase const * getInset(lyx::pos_type pos) const;
+       InsetBase * getInset(lyx::pos_type pos) {
+               return insetlist.get(pos);
+       }
        ///
-       InsetList insetlist;
-
+       InsetBase const * getInset(lyx::pos_type pos) const {
+               return insetlist.get(pos);
+       }
 
        ///
-       bool isHfill(lyx::pos_type pos) const;
+       bool isHfill(lyx::pos_type pos) const {
+       return isInset(pos)
+               && getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
+       }
        /// hinted by profiler
        bool isInset(lyx::pos_type pos) const {
                return getChar(pos) == static_cast<value_type>(META_INSET);
        }
        ///
        bool isNewline(lyx::pos_type pos) const;
-       ///
-       bool isSeparator(lyx::pos_type pos) const;
+       /// return true if the char is a word separator
+       bool isSeparator(lyx::pos_type pos) const { return getChar(pos) == ' '; }
        ///
        bool isLineSeparator(lyx::pos_type pos) const;
        /// True if the character/inset at this point can be part of a word
@@ -389,6 +393,11 @@ public:
 
        /// dump some information to lyxerr
        void dump() const;
+
+public:
+       ///
+       InsetList insetlist;
+
 private:
        /// cached dimensions of paragraph
        Dimension dim_;
@@ -405,6 +414,7 @@ private:
        /// end of label
        lyx::pos_type begin_of_body_;
 
+       /// Pimpl away stuff
        class Pimpl;
        ///
        friend class Paragraph::Pimpl;
index 19867e79edbc85829ac36c76f3f6e6ee829d4a6d..8c0ba08e8c6e2fb757171c8171f5c438b08d4d60 100644 (file)
 #ifndef TEXTUTILS_H
 #define TEXTUTILS_H
 
-/// return true if the char is a word separator
-inline
-bool IsSeparatorChar(char c)
-{
-       return c == ' ';
-}
-
 
 /// return true if the char is a line separator
 inline