]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.h
This is the first of a series of commits that will make InsetLayout a real class.
[lyx.git] / src / Paragraph.h
index 7e206deffe392aa175599ae957376187f9c408f3..e00f644f15b74305cf0d8d48443d46fe4f1b3935 100644 (file)
 #ifndef PARAGRAPH_H
 #define PARAGRAPH_H
 
+#include "FontEnums.h"
 #include "LayoutPtr.h"
 
 #include "insets/InsetCode.h"
 
-#include "support/docstring.h"
-// FIXME: would be nice to forward declare odocstream instead of
-// including this:
-#include "support/docstream.h"
+#include "support/strfwd.h"
+#include "support/types.h"
 
 namespace lyx {
 
@@ -59,11 +58,20 @@ public:
        pos_type first, last;
 };
 
+///
+enum TextCase {
+       ///
+       text_lowercase = 0,
+       ///
+       text_capitalization = 1,
+       ///
+       text_uppercase = 2
+};
+
 
 /// A Paragraph holds all text, attributes and insets in a text paragraph
-/// \todo FIXME: any reference to ParagraphMetrics (including inheritance)
-/// should go in order to complete the Model/View separation of this class.
-class Paragraph  {
+class Paragraph
+{
 public:
        ///
        Paragraph();
@@ -117,10 +125,6 @@ public:
                                   odocstream & os,
                                   OutputParams const & runparams) const;
 
-       /// Checks if the paragraph contains only text and no inset or font change.
-       bool onlyText(Buffer const & buf, Font const & outerfont,
-                     pos_type initial) const;
-
        /// Writes to stream the docbook representation
        void simpleDocBookOnePar(Buffer const & buf,
                                 odocstream &,
@@ -141,8 +145,11 @@ public:
        ///
        InsetCode ownerCode() const;
        ///
-       bool forceDefaultParagraphs() const;
-
+       bool forceEmptyLayout() const;
+       ///
+       bool allowParagraphCustomization() const;
+       ///
+       bool useEmptyLayout() const;
        ///
        pos_type size() const;
        ///
@@ -156,9 +163,6 @@ public:
        /// This is the item depth, only used by enumerate and itemize
        signed char itemdepth;
 
-       ///
-       InsetBibitem * bibitem() const;  // ale970302
-
        /// look up change at given pos
        Change const & lookupChange(pos_type pos) const;
 
@@ -223,6 +227,9 @@ public:
        /// (logically) erase the given range; return the number of chars actually erased
        int eraseChars(pos_type start, pos_type end, bool trackChanges);
 
+       ///
+       void resetFonts(Font const & font);
+
        /** Get uninstantiated font setting. Returns the difference
            between the characters font and the layoutfont.
            This is what is stored in the fonttable
@@ -236,8 +243,8 @@ public:
            font attached to this paragraph.
            If pos == -2, use the label font of the layout attached here.
            In all cases, the font is instantiated, i.e. does not have any
-           attributes with values Font::INHERIT, Font::IGNORE or
-           Font::TOGGLE.
+           attributes with values FONT_INHERIT, FONT_IGNORE or
+           FONT_TOGGLE.
        */
        Font const getFont(BufferParams const &, pos_type pos,
                              Font const & outerfont) const;
@@ -259,8 +266,8 @@ public:
        /// pos <= size() (there is a dummy font change at the end of each par)
        void setFont(pos_type pos, Font const & font);
        /// Returns the height of the highest font in range
-       Font_size highestFontInRange(pos_type startpos,
-                                       pos_type endpos, Font_size def_size) const;
+       FontSize highestFontInRange(pos_type startpos,
+                                       pos_type endpos, FontSize def_size) const;
        ///
        void insert(pos_type pos, docstring const & str,
                    Font const & font, Change const & change);
@@ -344,8 +351,19 @@ public:
        /// by this author in the paragraph.
        void checkAuthors(AuthorList const & authorList);
 
-       /// return the number of InsetOptArg in a paragraph
-       int numberOfOptArgs() const;
+       ///
+       void changeCase(BufferParams const & bparams, pos_type pos,
+               pos_type & right, TextCase action);
+
+       /// find \param str string inside Paragraph.
+       /// \return true if the specified string is at the specified position
+       /// \param del specifies whether deleted strings in ct mode will be considered
+       bool find(
+               docstring const & str, ///< string to search
+               bool cs, ///<
+               bool mw, ///<
+               pos_type pos, ///< start from here.
+               bool del = true) const;
 
 private:
        /// Pimpl away stuff