#include "FuncRequest.h"
#include "Language.h"
#include "lfuns.h"
-#include "LyXFont.h"
+#include "Font.h"
#include "LyXFunc.h" // only for setMessage()
#include "LyXRC.h"
#include "Row.h"
-#include "LyXText.h"
+#include "Text.h"
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "ParIterator.h"
for (size_t i = 0;; ++i) {
int xo;
int yo;
- InsetBase const * inset = &it.inset();
- std::map<InsetBase const *, Point> const & data =
+ Inset const * inset = &it.inset();
+ std::map<Inset const *, Point> const & data =
c.bv().coordCache().getInsets().getData();
- std::map<InsetBase const *, Point>::const_iterator I = data.find(inset);
+ std::map<Inset const *, Point>::const_iterator I = data.find(inset);
// FIXME: in the case where the inset is not in the cache, this
// means that no part of it is visible on screen. In this case
int x, int y, int xlow, int xhigh, int ylow, int yhigh)
{
BOOST_ASSERT(!cursor.empty());
- InsetBase & inset = cursor[0].inset();
+ Inset & inset = cursor[0].inset();
BufferView & bv = cursor.bv();
CoordCache::InnerParPosCache const & cache =
// << " xlow: " << xlow << " xhigh: " << xhigh
// << " ylow: " << ylow << " yhigh: " << yhigh
// << endl;
- InsetBase & inset = bv.buffer()->inset();
+ Inset & inset = bv.buffer()->inset();
DocIterator it = doc_iterator_begin(inset);
it.pit() = from;
DocIterator et = doc_iterator_end(inset);
return true;
}
+ docstring parbreak(Paragraph const & par)
+ {
+ odocstringstream ods;
+ ods << '\n';
+ // only add blank line if we're not in an ERT inset
+ if (par.ownerCode() != Inset::ERT_CODE)
+ ods << '\n';
+ return ods.str();
+ }
+
} // namespace anon
{}
-void Cursor::reset(InsetBase & inset)
+void Cursor::reset(Inset & inset)
{
clear();
push_back(CursorSlice(inset));
}
-void Cursor::push(InsetBase & p)
+void Cursor::push(Inset & p)
{
push_back(CursorSlice(p));
}
-void Cursor::pushLeft(InsetBase & p)
+void Cursor::pushLeft(Inset & p)
{
BOOST_ASSERT(!empty());
//lyxerr << "Entering inset " << t << " left" << endl;
BOOST_ASSERT(!empty());
for (int i = depth() - 1; i >= 0; --i) {
int res = operator[](i).inset().currentMode();
- if (res != InsetBase::UNDECIDED_MODE)
+ if (res != Inset::UNDECIDED_MODE)
return res;
}
- return InsetBase::TEXT_MODE;
+ return Inset::TEXT_MODE;
}
os << " ";
}
if (pos() != 0) {
- InsetBase const * inset = prevInset();
+ Inset const * inset = prevInset();
// prevInset() can return 0 in certain case.
if (inset)
prevInset()->infoize2(os);
//#define FILEDEBUG 1
-bool Cursor::isInside(InsetBase const * p)
+bool Cursor::isInside(Inset const * p)
{
for (size_t i = 0; i != depth(); ++i)
if (&operator[](i).inset() == p)
}
-void Cursor::leaveInset(InsetBase const & inset)
+void Cursor::leaveInset(Inset const & inset)
{
for (size_t i = 0; i != depth(); ++i) {
if (&operator[](i).inset() == &inset) {
}
-void Cursor::insert(InsetBase * inset)
+void Cursor::insert(Inset * inset)
{
if (inMathed())
insert(MathAtom(inset));
// First paragraph in selection
docstring result = pars[startpit].
- asString(buffer, startpos, pars[startpit].size(), label) + "\n\n";
+ asString(buffer, startpos, pars[startpit].size(), label)
+ + parbreak(pars[startpit]);
// The paragraphs in between (if any)
for (pit_type pit = startpit + 1; pit != endpit; ++pit) {
Paragraph const & par = pars[pit];
- result += par.asString(buffer, 0, par.size(), label) + "\n\n";
+ result += par.asString(buffer, 0, par.size(), label)
+ + parbreak(pars[pit]);
}
// Last paragraph in selection
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
- LyXText const & text = *sl.text();
- LyXFont font = text.getPar(sl.pit()).getFont(
+ Text const & text = *sl.text();
+ Font font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
return font.language()->encoding();
}
}
-LyXFont Cursor::getFont() const
+Font Cursor::getFont() const
{
// HACK. far from being perfect...
int s = 0;
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
- LyXText const & text = *sl.text();
- LyXFont font = text.getPar(sl.pit()).getFont(
+ Text const & text = *sl.text();
+ Font font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(),
sl.pos(),
outerFont(sl.pit(), text.paragraphs()));
bool Cursor::isRTL() const
{
- return top().paragraph().isRightToLeftPar(bv().buffer()->params());
+ return innerParagraph().isRightToLeftPar(bv().buffer()->params());
}