#include <csignal>
#include <ctime>
+using namespace lyx::support;
+
using std::ostream;
using std::endl;
using std::fstream;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it) {
- it->inset = it->inset->clone();
+ // currently we hold Inset*, not InsetBase*
+ it->inset = static_cast<Inset*>(it->inset->clone());
// tell the new inset who is the boss now
it->inset->parOwner(this);
}
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it) {
- it->inset = it->inset->clone();
+ it->inset = static_cast<Inset*>(it->inset->clone());
// tell the new inset who is the boss now
it->inset->parOwner(this);
}
minibuffer_inset = 0;
if (minibuffer_char == Paragraph::META_INSET) {
if (getInset(pos)) {
- minibuffer_inset = getInset(pos)->clone();
+ minibuffer_inset = static_cast<Inset *>(getInset(pos)->clone());
} else {
minibuffer_inset = 0;
minibuffer_char = ' ';
Inset * Paragraph::getInset(pos_type pos)
{
- lyx::Assert(pos < size());
+ Assert(pos < size());
return insetlist.get(pos);
}
Inset const * Paragraph::getInset(pos_type pos) const
{
- lyx::Assert(pos < size());
+ Assert(pos < size());
return insetlist.get(pos);
}
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
pos_type pos) const
{
- lyx::Assert(pos <= size());
+ Assert(pos <= size());
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont const & outerfont) const
{
- lyx::Assert(pos >= 0);
+ Assert(pos >= 0);
LyXLayout_ptr const & lout = layout();
void Paragraph::setFont(pos_type pos, LyXFont const & font)
{
- lyx::Assert(pos <= size());
+ Assert(pos <= size());
// First, reduce font against layout/label font
// Update: The SetCharFont() routine in text2.C already
int Paragraph::stripLeadingSpaces()
{
- if (layout()->free_spacing || isFreeSpacing())
+ if (isFreeSpacing())
return 0;
int i = 0;
// Used for building the table of contents
string const Paragraph::asString(Buffer const * buffer, bool label) const
{
+#if 0
string s;
if (label && !params().labelString().empty())
s += params().labelString() + ' ';
}
return s;
+#else
+ // This should really be done by the caller and not here.
+ string ret(asString(buffer, 0, size(), label));
+ return subst(ret, '\n', ' ');
+#endif
}
Change::Type Paragraph::lookupChange(lyx::pos_type pos) const
{
- lyx::Assert(!size() || pos < size());
+ Assert(!size() || pos < size());
return pimpl_->lookupChange(pos);
}
Change const Paragraph::lookupChangeFull(lyx::pos_type pos) const
{
- lyx::Assert(!size() || pos < size());
+ Assert(!size() || pos < size());
return pimpl_->lookupChangeFull(pos);
}
LyXLayout_ptr const & Paragraph::layout() const
{
+/*
Inset * inset = inInset();
if (inset && inset->lyxCode() == Inset::ENVIRONMENT_CODE)
return static_cast<InsetEnvironment*>(inset)->layout();
+*/
return layout_;
}
bool Paragraph::isFreeSpacing() const
{
+ if (layout()->free_spacing)
+ return true;
+
// for now we just need this, later should we need this in some
// other way we can always add a function to Inset::() too.
if (pimpl_->inset_owner && pimpl_->inset_owner->owner())
}
+bool Paragraph::allowEmpty() const
+{
+ if (layout()->keepempty)
+ return true;
+ if (pimpl_->inset_owner && pimpl_->inset_owner->owner())
+ return (pimpl_->inset_owner->owner()->lyxCode() == Inset::ERT_CODE);
+ return false;
+}
+
+
bool operator==(Paragraph const & lhs, Paragraph const & rhs)
{
#warning FIXME this implementatoin must be completely wrong...