]> git.lyx.org Git - features.git/blobdiff - src/Text2.cpp
Move contents of paragraph_funcs.* to Text.h and Text.cpp.
[features.git] / src / Text2.cpp
index c55b9e2a42afc02b80afd5bbfd5182bf21c6e200..080fdc0c463e332b12ae32a7986cf1f9f0a3f164 100644 (file)
@@ -40,7 +40,6 @@
 #include "LyXFunc.h"
 #include "LyXRC.h"
 #include "Paragraph.h"
-#include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
@@ -85,7 +84,7 @@ FontInfo Text::layoutFont(pit_type const pit) const
                // now, because Inset::getLayout() will return a default-constructed
                // InsetLayout, and that e.g. sets the foreground color to red. So we
                // need to do some work to make that possible.
-               InsetCollapsable const * icp = pars_[pit].inInset().asInsetCollapsable();
+               InsetCollapsable const * icp = owner_->asInsetCollapsable();
                if (!icp)
                        return lf;
                FontInfo icf = icp->getLayout().font();
@@ -502,41 +501,6 @@ void Text::insertInset(Cursor & cur, Inset * inset)
 }
 
 
-// needed to insert the selection
-void Text::insertStringAsLines(Cursor & cur, docstring const & str)
-{
-       cur.buffer()->insertStringAsLines(pars_, cur.pit(), cur.pos(),
-               cur.current_font, str, autoBreakRows_);
-}
-
-
-// turn double CR to single CR, others are converted into one
-// blank. Then insertStringAsLines is called
-void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str)
-{
-       docstring linestr = str;
-       bool newline_inserted = false;
-
-       for (string::size_type i = 0, siz = linestr.size(); i < siz; ++i) {
-               if (linestr[i] == '\n') {
-                       if (newline_inserted) {
-                               // we know that \r will be ignored by
-                               // insertStringAsLines. Of course, it is a dirty
-                               // trick, but it works...
-                               linestr[i - 1] = '\r';
-                               linestr[i] = '\n';
-                       } else {
-                               linestr[i] = ' ';
-                               newline_inserted = true;
-                       }
-               } else if (isPrintable(linestr[i])) {
-                       newline_inserted = false;
-               }
-       }
-       insertStringAsLines(cur, linestr);
-}
-
-
 bool Text::setCursor(Cursor & cur, pit_type par, pos_type pos,
                        bool setfont, bool boundary)
 {