#include "support/lassert.h"
#include "support/convert.h"
#include "support/debug.h"
+#include "support/ExceptionMessage.h"
#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/Messages.h"
Paragraph * owner_;
/// In which Inset?
- Inset * inset_owner_;
+ Inset const * inset_owner_;
///
FontList fontlist_;
Paragraph::Private::Private(Private const & p, Paragraph * owner,
pos_type beg, pos_type end)
- : owner_(owner), inset_owner_(p.inset_owner_), fontlist_(p.fontlist_),
+ : owner_(owner), inset_owner_(p.inset_owner_),
params_(p.params_), changes_(p.changes_),
+ insetlist_(p.insetlist_, beg, end),
begin_of_body_(p.begin_of_body_), words_(p.words_),
layout_(p.layout_)
{
if (beg >= pos_type(p.text_.size()))
return;
text_ = p.text_.substr(beg, end - beg);
- InsetList::const_iterator icit = p.insetlist_.begin();
- InsetList::const_iterator iend = p.insetlist_.end();
- for (; icit != iend; ++icit) {
- if (icit->pos < beg)
- continue;
- if (icit->pos >= end)
- break;
- // Add a new entry in the insetlist_.
- insetlist_.insert(icit->inset, icit->pos - beg);
- }
+
FontList::const_iterator fcit = fontlist_.begin();
FontList::const_iterator fend = fontlist_.end();
for (; fcit != fend; ++fcit) {
bool Paragraph::eraseChar(pos_type pos, bool trackChanges)
{
- LASSERT(pos >= 0 && pos <= size(), /**/);
+ LASSERT(pos >= 0 && pos <= size(), return false);
// keep the logic here in sync with the logic of isMergedOnEndOfParDeletion()
case '|':
os.put(c);
return true;
+ case '\"':
+ // soul.sty breaks with \char`\"
+ os << "\\textquotedbl{}";
+ column += 14;
+ return true;
default:
return false;
}
}
-bool Paragraph::insetAllowed(InsetCode code)
-{
- return !d->inset_owner_ || d->inset_owner_->insetAllowed(code);
-}
-
-
void Paragraph::resetFonts(Font const & font)
{
d->fontlist_.clear();
bool Paragraph::forcePlainLayout() const
{
- Inset const * const inset = inInset();
- if (!inset)
- return true;
- return inset->forcePlainLayout();
+ return inInset().forcePlainLayout();
}
bool Paragraph::allowParagraphCustomization() const
{
- Inset const * const inset = inInset();
- if (!inset)
- return true;
- return inset->allowParagraphCustomization();
+ return inInset().allowParagraphCustomization();
}
bool Paragraph::usePlainLayout() const
{
- Inset const * const inset = inInset();
- if (!inset)
- return false;
- return inset->usePlainLayout();
+ return inInset().usePlainLayout();
}
bool asdefault = forcePlainLayout();
Layout const & style = asdefault ?
- bparams.documentClass().emptyLayout() :
+ bparams.documentClass().plainLayout() :
*d->layout_;
// Current base font for all inherited font changes, without any
}
-void Paragraph::setInsetOwner(Inset * inset)
+void Paragraph::setInsetOwner(Inset const * inset)
{
d->inset_owner_ = inset;
}
void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
{
if (usePlainLayout())
- setLayout(tclass.emptyLayout());
+ setLayout(tclass.plainLayout());
else
setLayout(tclass.defaultLayout());
}
-Inset * Paragraph::inInset() const
+Inset const & Paragraph::inInset() const
{
- return d->inset_owner_;
+ LASSERT(d->inset_owner_, throw ExceptionMessage(BufferException,
+ _("Memory problem"), _("Paragraph not properly initiliazed")));
+ return *d->inset_owner_;
}