]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.h
PrefShortcuts: list all shortcuts (bound and unbound), using a better implementation
[lyx.git] / src / Paragraph.h
index ea1d679d7c056a425f8ce51d607d9c1876d7c8a2..4e8a3d9f796b0e31fd69bca1e2f263d3a4c783ba 100644 (file)
 #ifndef PARAGRAPH_H
 #define PARAGRAPH_H
 
-#include "Changes.h"
-#include "Dimension.h"
-#include "InsetList.h"
 #include "lyxlayout_ptr_fwd.h"
-#include "Row.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;
@@ -93,7 +97,7 @@ public:
        ///
        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);
@@ -162,7 +166,7 @@ public:
        ///
        Inset * inInset() const;
        ///
-       Inset::Code ownerCode() const;
+       InsetCode ownerCode() const;
        ///
        bool forceDefaultParagraphs() const;
 
@@ -172,9 +176,9 @@ public:
        bool empty() const { return text_.empty(); }
 
        ///
-       Layout_ptr const & layout() const;
+       LayoutPtr const & layout() const;
        ///
-       void layout(Layout_ptr const & new_layout);
+       void layout(LayoutPtr const & new_layout);
 
        /// This is the item depth, only used by enumerate and itemize
        signed char itemdepth;
@@ -188,17 +192,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?
@@ -236,7 +234,7 @@ public:
        docstring const translateIfPossible(docstring const & label,
                BufferParams const & bparams) const;
        /// Expand the counters for the labelstring of \c layout
-       docstring expandLabel(Layout_ptr const &, BufferParams const &,
+       docstring expandLabel(LayoutPtr const &, BufferParams const &,
                bool process_appendix = true) const;
        /// Actual paragraph alignment used
        char getAlign() const;
@@ -245,7 +243,7 @@ public:
        /// The maximal possible depth of a paragraph after this one
        depth_type getMaxDepthAfter() const;
        ///
-       void applyLayout(Layout_ptr const & new_layout);
+       void applyLayout(LayoutPtr const & new_layout);
 
        /// (logically) erase the char at pos; return true if it was actually erased
        bool eraseChar(pos_type pos, bool trackChanges);
@@ -309,21 +307,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);
@@ -356,8 +357,6 @@ public:
        ParagraphParameters & params();
        ///
        ParagraphParameters const & params() const;
-       ///
-       bool hfillExpansion(Row const & row, pos_type pos) const;
 
        /// Check if we are in a Biblio environment and insert or
        /// delete InsetBibitems as necessary.
@@ -368,14 +367,14 @@ public:
        /// was previously past that position. Return 0 otherwise.
        int checkBiblio(bool track_changes);
 
-public:
-       ///
-       InsetList insetlist;
+       /// For each author, set 'used' to true if there is a change
+       /// by this author in the paragraph.
+       void checkAuthors(AuthorList const & authorList);
 
 private:
 
        ///
-       Layout_ptr layout_;
+       LayoutPtr layout_;
        /**
         * Keeping this here instead of in the pimpl makes LyX >10% faster
         * for average tasks as buffer loading/switching etc.