]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Clarify some comments.
[lyx.git] / src / Text.cpp
index 5803c2d4ad07e1fca7be0574d645a9090801e26c..66c6090aa22c9abb40d8d9561fcdf82ddb7cbcb2 100644 (file)
@@ -170,6 +170,40 @@ void mergeParagraph(BufferParams const & bparams,
        pars.erase(boost::next(pars.begin(), par_offset + 1));
 }
 
+// Initialization of the counter for the paragraph id's,
+//
+// FIXME: There should be a more intelligent way to generate and use the
+// paragraph ids per buffer instead a global static counter for all InsetText
+// in the running program.
+static int paragraph_id = -1;
+
+Text::Text(InsetText * owner, bool use_default_layout)
+       : owner_(owner), autoBreakRows_(false), undo_counter_(0)
+{
+       pars_.push_back(Paragraph());
+       Paragraph & par = pars_.back();
+       par.setId(++paragraph_id);
+       par.setInsetOwner(owner);
+       DocumentClass const & dc = owner->buffer().params().documentClass();
+       if (use_default_layout)
+               par.setDefaultLayout(dc);
+       else
+               par.setPlainLayout(dc);
+}
+
+
+Text::Text(InsetText * owner, Text const & text)
+       : owner_(owner), autoBreakRows_(text.autoBreakRows_), undo_counter_(0)
+{
+       pars_ = text.pars_;
+       ParagraphList::iterator const end = pars_.end();
+       ParagraphList::iterator it = pars_.begin();
+       for (; it != end; ++it) {
+               it->setId(++paragraph_id);
+               it->setInsetOwner(owner);
+       }
+}
+
 
 pit_type Text::depthHook(pit_type pit, depth_type depth) const
 {