]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
Change Assert to BOOST_ASSERT.
[lyx.git] / src / text3.C
index 5f6b325f1a5a7775e3b4d69b157f42cef6d4251a..b3797f0333cc5c6fbcd8869bcc24212eb92fe945 100644 (file)
 #include <config.h>
 
 #include "lyxtext.h"
+
+#include "buffer.h"
+#include "bufferparams.h"
 #include "BufferView.h"
-#include "funcrequest.h"
-#include "lyxrc.h"
-#include "Lsstream.h"
 #include "debug.h"
-#include "buffer.h"
-#include "ParagraphParameters.h"
-#include "gettext.h"
 #include "factory.h"
+#include "funcrequest.h"
+#include "gettext.h"
 #include "intl.h"
 #include "language.h"
-#include "support/tostr.h"
-#include "support/lstrings.h"
-#include "support/LAssert.h"
-#include "frontends/LyXView.h"
+#include "lyxrc.h"
+#include "lyxrow.h"
+#include "paragraph.h"
+#include "ParagraphParameters.h"
+#include "text_funcs.h"
+#include "undo_funcs.h"
+#include "vspace.h"
+
 #include "frontends/Dialogs.h"
-#include "insets/insetspecialchar.h"
-#include "insets/insettext.h"
+#include "frontends/LyXView.h"
+
 #include "insets/insetcommand.h"
 #include "insets/insetnewline.h"
-#include "undo_funcs.h"
-#include "text_funcs.h"
+#include "insets/insetspecialchar.h"
+#include "insets/insettext.h"
+
+#include "support/lstrings.h"
+#include "support/tostr.h"
 
+#include "support/std_sstream.h"
+#include <clocale>
 
 using namespace lyx::support;
 using namespace bv_funcs;
 
 using std::endl;
 using std::find;
+
+using std::istringstream;
 using std::vector;
+
 using lyx::pos_type;
 
+
 extern string current_layout;
 extern int bibitemMaxWidth(BufferView *, LyXFont const &);
 
@@ -101,7 +113,7 @@ namespace {
                        return 0;
 
                // get inset dimensions
-               Assert(par->getInset(pos));
+               BOOST_ASSERT(par->getInset(pos));
 
                LyXFont const & font = text.getFont(par, pos);
 
@@ -436,7 +448,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_WORDRIGHT:
                if (!selection.mark())
                        bv->beforeChange(this);
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorLeftOneWord();
                else
                        cursorRightOneWord();
@@ -446,7 +458,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_WORDLEFT:
                if (!selection.mark())
                        bv->beforeChange(this);
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorRightOneWord();
                else
                        cursorLeftOneWord();
@@ -470,7 +482,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_RIGHTSEL:
                if (!selection.set())
                        selection.cursor = cursor;
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorLeft(bv);
                else
                        cursorRight(bv);
@@ -480,7 +492,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_LEFTSEL:
                if (!selection.set())
                        selection.cursor = cursor;
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorRight(bv);
                else
                        cursorLeft(bv);
@@ -544,7 +556,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_WORDRIGHTSEL:
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorLeftOneWord();
                else
                        cursorRightOneWord();
@@ -552,7 +564,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                break;
 
        case LFUN_WORDLEFTSEL:
-               if (cursor.par()->isRightToLeftPar(bv->buffer()->params))
+               if (cursor.par()->isRightToLeftPar(bv->buffer()->params()))
                        cursorRightOneWord();
                else
                        cursorLeftOneWord();
@@ -571,7 +583,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_RIGHT: {
-               bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
+               bool is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params());
                if (!selection.mark())
                        bv->beforeChange(this);
                if (is_rtl)
@@ -594,7 +606,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        case LFUN_LEFT: {
                // This is soooo ugly. Isn`t it possible to make
                // it simpler? (Lgb)
-               bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params);
+               bool const is_rtl = cursor.par()->isRightToLeftPar(bv->buffer()->params());
                if (!selection.mark())
                        bv->beforeChange(this);
                LyXCursor const cur = cursor;
@@ -780,7 +792,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
        case LFUN_BREAKPARAGRAPH:
                replaceSelection(bv->getLyXText());
-               breakParagraph(bv->buffer()->paragraphs, 0);
+               breakParagraph(bv->buffer()->paragraphs(), 0);
                bv->update();
                selection.cursor = cursor;
                bv->switchKeyMap();
@@ -789,7 +801,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
        case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
                replaceSelection(bv->getLyXText());
-               breakParagraph(bv->buffer()->paragraphs, 1);
+               breakParagraph(bv->buffer()->paragraphs(), 1);
                bv->update();
                selection.cursor = cursor;
                bv->switchKeyMap();
@@ -816,7 +828,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                }
                else {
-                       breakParagraph(bv->buffer()->paragraphs, 0);
+                       breakParagraph(bv->buffer()->paragraphs(), 0);
                }
                bv->update();
                selection.cursor = cur;
@@ -868,7 +880,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_INSET_SETTINGS:
-               Assert(bv->theLockingInset());
+               BOOST_ASSERT(bv->theLockingInset());
                bv->theLockingInset()->getLockingInset()->showInsetDialog(bv);
                break;
 
@@ -1043,7 +1055,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
                // Derive layout number from given argument (string)
                // and current buffer's textclass (number)
-               LyXTextClass const & tclass = bv->buffer()->params.getLyXTextClass();
+               LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
                bool hasLayout = tclass.hasLayout(cmd.argument);
                string layout = cmd.argument;
 
@@ -1133,10 +1145,10 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
                LyXLayout_ptr const & style = pit->layout();
 
+               BufferParams const & bufparams = bv->buffer()->params();
                if (style->pass_thru ||
-                               pit->getFontSettings(bv->buffer()->params,
-                                        pos).language()->lang() == "hebrew" ||
-                       (!bv->insertInset(new InsetQuotes(c, bv->buffer()->params))))
+                   pit->getFontSettings(bufparams,pos).language()->lang() == "hebrew" ||
+                   !bv->insertInset(new InsetQuotes(c, bufparams)))
                        bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
                break;
        }