+BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
+ BufferView::UpdateCodes uc2)
+{
+ return static_cast<BufferView::UpdateCodes>
+ (static_cast<int>(uc1) | static_cast<int>(uc2));
+}
+
+
+bool BufferView::dispatch(FuncRequest const & ev)
+{
+ return pimpl_->dispatch(ev);
+}
+
+
+void BufferView::scroll(int lines)
+{
+ pimpl_->scroll(lines);
+}
+
+
+// Inserts a file into current document
+bool BufferView::insertLyXFile(string const & filen)
+ //
+ // Copyright CHT Software Service GmbH
+ // Uwe C. Schroeder
+ //
+ // Insert a LyXformat - file into current buffer
+ //
+ // Moved from lyx_cb.C (Lgb)
+{
+ if (filen.empty())
+ return false;
+
+ string const fname = MakeAbsPath(filen);
+
+ // check if file exist
+ FileInfo const fi(fname);
+
+ if (!fi.readable()) {
+ string const file = MakeDisplayPath(fname, 50);
+ string const text =
+ bformat(_("The specified document\n%1$s\ncould not be read."), file);
+ Alert::error(_("Could not read document"), text);
+ return false;
+ }
+
+ beforeChange(text);
+
+ ifstream ifs(fname.c_str());
+ if (!ifs) {
+ string const file = MakeDisplayPath(fname, 50);
+ string const text =
+ bformat(_("Could not open the specified document %1$s\n"), file);
+ Alert::error(_("Could not open file"), text);
+ return false;
+ }
+
+ int const c = ifs.peek();
+
+ LyXLex lex(0, 0);
+ lex.setStream(ifs);
+
+ bool res = true;
+
+ text->breakParagraph(buffer()->paragraphs);
+
+ if (c == '#') {
+ // FIXME: huh ? No we won't !
+ lyxerr[Debug::INFO] << "Will insert file with header" << endl;
+ res = buffer()->readFile(lex, fname, ParagraphList::iterator(text->cursor.par()));
+ } else {
+ lyxerr[Debug::INFO] << "Will insert file without header"
+ << endl;
+ res = buffer()->readBody(lex, ParagraphList::iterator(text->cursor.par()));
+ }
+
+ resize();
+ return res;
+}
+
+
+void BufferView::showErrorList(string const & action) const
+{
+ if (getErrorList().size()) {
+ string const title = bformat(_("LyX: %1$s errors (%2$s)"), action, buffer()->fileName());
+ owner()->getDialogs().show("errorlist", title);
+ pimpl_->errorlist_.clear();
+ }
+}
+
+
+ErrorList const &
+BufferView::getErrorList() const
+{
+ return pimpl_->errorlist_;
+}
+
+
+void BufferView::setCursorFromRow(int row)
+{
+ int tmpid = -1;
+ int tmppos = -1;
+
+ buffer()->texrow.getIdFromRow(row, tmpid, tmppos);
+
+ ParagraphList::iterator texrowpar;
+
+ if (tmpid == -1) {
+ texrowpar = text->ownerParagraphs().begin();
+ tmppos = 0;
+ } else {
+ texrowpar = buffer()->getParFromID(tmpid).pit();
+ }
+ text->setCursor(texrowpar, tmppos);
+}
+
+
+bool BufferView::insertInset(InsetOld * inset, string const & lout)
+{
+ return pimpl_->insertInset(inset, lout);
+}
+
+
+void BufferView::gotoLabel(string const & label)
+{
+ for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
+ it != buffer()->inset_iterator_end(); ++it) {
+ vector<string> labels;
+ it->getLabelList(labels);
+ if (find(labels.begin(),labels.end(),label)
+ != labels.end()) {
+ beforeChange(text);
+ text->setCursor(it.getPar(), it.getPos());
+ text->selection.cursor = text->cursor;
+ update(text, BufferView::SELECT);
+ return;
+ }
+ }
+}
+
+
+void BufferView::undo()