}
+/// return true if the whole ParagraphList is deleted
+static bool isFullyDeleted(ParagraphList const & pars)
+{
+ pit_type const pars_size = static_cast<pit_type>(pars.size());
+
+ // check all paragraphs
+ for (pit_type pit = 0; pit < pars_size; ++pit) {
+ if (!pars[pit].empty()) // prevent assertion failure
+ if (!pars[pit].isDeleted(0, pars[pit].size()))
+ return false;
+ }
+ return true;
+}
+
+
void copySelectionHelper(Buffer const & buf, Text const & text,
pit_type startpit, pit_type endpit,
int start, int end, DocumentClass const * const dc, CutStack & cutstack)
}
-void setLabelWidthStringToSequence(pit_type const par_offset,
- ParagraphList & pars, docstring const & s)
-{
- pit_type offset = par_offset;
- // Find first of same layout in sequence
- while (!isFirstInSequence(offset, pars)) {
- offset = depthHook(offset, pars, pars[offset].getDepth());
- }
-
- // now apply label width string to every par
- // in sequence
- pit_type const end = pars.size();
- depth_type const depth = pars[offset].getDepth();
- Layout const & layout = pars[offset].layout();
- for (pit_type pit = offset; pit != end; ++pit) {
- while (pars[pit].getDepth() > depth)
- ++pit;
- if (pars[pit].getDepth() < depth)
- return;
- if (pars[pit].layout() != layout)
- return;
- pars[pit].setLabelWidthString(s);
- }
-}
-
-
int getEndLabel(pit_type p, ParagraphList const & pars)
{
pit_type pit = p;
}
-bool isFullyDeleted(ParagraphList const & pars)
-{
- pit_type const pars_size = static_cast<pit_type>(pars.size());
-
- // check all paragraphs
- for (pit_type pit = 0; pit < pars_size; ++pit) {
- if (!pars[pit].empty()) // prevent assertion failure
- if (!pars[pit].isDeleted(0, pars[pit].size()))
- return false;
- }
- return true;
-}
-
-
void acceptChanges(ParagraphList & pars, BufferParams const & bparams)
{
pit_type pars_size = static_cast<pit_type>(pars.size());
Font & font, Change & change, ErrorList & errorList);
///
void readParagraph(Paragraph & par, Lexer & lex, ErrorList & errorList);
+ /// Set Label Width string to all paragraphs of the same layout
+ /// and depth in a sequence.
+ void setLabelWidthStringToSequence(pit_type const par_offset, docstring const & s);
/// Owner Inset.
InsetText * owner_;
/// Is it the first par with same depth and layout?
bool isFirstInSequence(pit_type par, ParagraphList const & plist);
-/** Set Label Width string to all paragraphs of the same layout
- and depth in a sequence */
-void setLabelWidthStringToSequence(pit_type const par_offset,
- ParagraphList & pars, docstring const & s);
-
/** Check if the current paragraph is the last paragraph in a
proof environment */
int getEndLabel(pit_type par, ParagraphList const & plist);
/// accept the changes within the complete ParagraphList
void acceptChanges(ParagraphList & pars, BufferParams const & bparams);
-/// return true if the whole ParagraphList is deleted
-bool isFullyDeleted(ParagraphList const & pars);
-
} // namespace lyx
#endif // TEXT_H
}
+void Text::setLabelWidthStringToSequence(pit_type const par_offset,
+ docstring const & s)
+{
+ pit_type offset = par_offset;
+ // Find first of same layout in sequence
+ while (!isFirstInSequence(offset, pars_)) {
+ offset = depthHook(offset, pars_, pars_[offset].getDepth());
+ }
+
+ // now apply label width string to every par
+ // in sequence
+ pit_type const end = pars_.size();
+ depth_type const depth = pars_[offset].getDepth();
+ Layout const & layout = pars_[offset].layout();
+ for (pit_type pit = offset; pit != end; ++pit) {
+ while (pars_[pit].getDepth() > depth)
+ ++pit;
+ if (pars_[pit].getDepth() < depth)
+ return;
+ if (pars_[pit].layout() != layout)
+ return;
+ pars_[pit].setLabelWidthString(s);
+ }
+}
+
+
void Text::setParagraphs(Cursor & cur, docstring arg, bool merge)
{
LASSERT(cur.text(), /**/);
// Do this only once for a selected range of paragraphs
// of the same layout and depth.
if (par.getDepth() != priordepth || par.layout() != priorlayout)
- setLabelWidthStringToSequence(pit, pars_,
- params.labelWidthString());
+ setLabelWidthStringToSequence(pit, params.labelWidthString());
par.params().apply(params, par.layout());
priordepth = par.getDepth();
priorlayout = par.layout();
// Do this only once for a selected range of paragraphs
// of the same layout and depth.
if (par.getDepth() != priordepth || par.layout() != priorlayout)
- setLabelWidthStringToSequence(pit, pars_,
- par.params().labelWidthString());
+ setLabelWidthStringToSequence(pit,
+ par.params().labelWidthString());
par.params().apply(p, par.layout());
priordepth = par.getDepth();
priorlayout = par.layout();