]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.h
scons/SConstruct: remove non-existent path to make "update_po" work
[lyx.git] / src / Paragraph.h
index 21a96719c91dce868fd5aef264a9744e7caf166e..b76a6fea8557888c5905f63da8d876fe7f08fa09 100644 (file)
 #ifndef PARAGRAPH_H
 #define PARAGRAPH_H
 
-#include "Changes.h"
-#include "InsetList.h"
 #include "lyxlayout_ptr_fwd.h"
 
-#include "insets/Inset.h" // only for Inset::Code
+#include "insets/InsetCode.h"
 
+#include "support/docstring.h"
+// FIXME: would be nice to forward declare odocstream instead of
+// including this:
+#include "support/docstream.h"
 
-namespace lyx {
+#include <vector>
 
+namespace lyx {
 
+class AuthorList;
 class Buffer;
 class BufferParams;
+class Change;
 class Counters;
 class Inset;
 class InsetBibitem;
 class LaTeXFeatures;
 class Inset_code;
+class InsetList;
 class Language;
 class Font;
 class Font_size;
@@ -73,8 +79,6 @@ public:
        };
        ///
        typedef char_type value_type;
-       ///
-       typedef std::vector<value_type> TextContainer;
 
        ///
        Paragraph();
@@ -87,11 +91,10 @@ public:
        ///
        int id() const;
 
-
        ///
        Language const * getParLanguage(BufferParams const &) const;
        ///
-       bool isRightToLeftPar(BufferParams const &) const;
+       bool isRTL(BufferParams const &) const;
        ///
        void changeLanguage(BufferParams const & bparams,
                            Language const * from, Language const * to);
@@ -113,16 +116,7 @@ public:
        void validate(LaTeXFeatures &) const;
 
        ///
-       int startTeXParParams(BufferParams const &, odocstream &, TexRow &,
-                             bool) const;
-
-       ///
-       int endTeXParParams(BufferParams const &, odocstream &, TexRow &,
-                           bool) const;
-
-
-       ///
-       bool simpleTeXOnePar(Buffer const &, BufferParams const &,
+       bool latex(Buffer const &, BufferParams const &,
                             Font const & outerfont, odocstream &,
                             TexRow & texrow, OutputParams const &) const;
 
@@ -160,7 +154,7 @@ public:
        ///
        Inset * inInset() const;
        ///
-       Inset::Code ownerCode() const;
+       InsetCode ownerCode() const;
        ///
        bool forceDefaultParagraphs() const;
 
@@ -186,17 +180,11 @@ public:
        /// is there a change within the given range ?
        bool isChanged(pos_type start, pos_type end) const;
        /// is there an unchanged char at the given pos ?
-       bool isUnchanged(pos_type pos) const {
-               return lookupChange(pos).type == Change::UNCHANGED;
-       }
+       bool isUnchanged(pos_type pos) const;
        /// is there an insertion at the given pos ?
-       bool isInserted(pos_type pos) const {
-               return lookupChange(pos).type == Change::INSERTED;
-       }
+       bool isInserted(pos_type pos) const;
        /// is there a deletion at the given pos ?
-       bool isDeleted(pos_type pos) const {
-               return lookupChange(pos).type == Change::DELETED;
-       }
+       bool isDeleted(pos_type pos) const;
 
        /// will the paragraph be physically merged with the next
        /// one if the imaginary end-of-par character is logically deleted?
@@ -292,6 +280,12 @@ public:
        ///
        void insert(pos_type pos, docstring const & str,
                    Font const & font, Change const & change);
+
+       ///
+       void appendString(docstring const & s, Font const & font,
+               Change const & change);
+       ///
+       void appendChar(value_type c, Font const & font, Change const & change);
        ///
        void insertChar(pos_type pos, value_type c, bool trackChanges);
        ///
@@ -307,21 +301,24 @@ public:
        void insertInset(pos_type pos, Inset * inset,
                         Font const &, Change const & change);
        ///
-       bool insetAllowed(Inset_code code);
+       bool insetAllowed(InsetCode code);
        ///
-       Inset * getInset(pos_type pos) {
-               return insetlist.get(pos);
-       }
+       Inset * getInset(pos_type pos);
        ///
-       Inset const * getInset(pos_type pos) const {
-               return insetlist.get(pos);
-       }
+       Inset const * getInset(pos_type pos) const;
+
+       /// Release inset at given position.
+       /// \warning does not honour change tracking!
+       /// Therefore, it should only be used for breaking and merging
+       /// paragraphs
+       Inset * releaseInset(pos_type pos);
 
        ///
-       bool isHfill(pos_type pos) const {
-               return isInset(pos)
-                      && getInset(pos)->lyxCode() == Inset::HFILL_CODE;
-       }
+       InsetList const & insetList() const;
+
+       ///
+       bool isHfill(pos_type pos) const;
+
        /// hinted by profiler
        bool isInset(pos_type pos) const {
                return getChar(pos) == static_cast<value_type>(META_INSET);
@@ -336,9 +333,6 @@ public:
        /// Note that digits in particular are considered as letters
        bool isLetter(pos_type pos) const;
 
-       /// returns -1 if inset not found
-       int getPositionOfInset(Inset const * inset) const;
-
        /// returns true if at least one line break or line separator has been deleted
        /// at the beginning of the paragraph (either physically or logically)
        bool stripLeadingSpaces(bool trackChanges);
@@ -368,28 +362,24 @@ public:
        /// by this author in the paragraph.
        void checkAuthors(AuthorList const & authorList);
 
-public:
-       ///
-       InsetList insetlist;
+       /// return the number of InsetOptArg in a paragraph
+       int numberOfOptArgs() const;
 
 private:
-
-       ///
-       LayoutPtr layout_;
        /**
         * Keeping this here instead of in the pimpl makes LyX >10% faster
         * for average tasks as buffer loading/switching etc.
         */
+       typedef std::vector<value_type> TextContainer;
+       ///
        TextContainer text_;
-       /// end of label
-       pos_type begin_of_body_;
 
        /// Pimpl away stuff
-       class Pimpl;
+       class Private;
        ///
-       friend class Paragraph::Pimpl;
+       friend class Paragraph::Private;
        ///
-       Pimpl * pimpl_;
+       Private * d;
 };
 
 } // namespace lyx