X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=c5d1501417853a8f00df2b75b9138147f5af731a;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=16816f34140ed7d84b7c680d2402eeaf27e1cb49;hpb=b3128dc63b2c3ae44736da5427a9469932ac522e;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 16816f3414..c5d1501417 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -171,6 +171,31 @@ void mergeParagraph(BufferParams const & bparams, } +Text::Text(InsetText * owner, bool use_default_layout) + : owner_(owner), autoBreakRows_(false), undo_counter_(0) +{ + pars_.push_back(Paragraph()); + Paragraph & par = pars_.back(); + 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->setInsetOwner(owner); +} + + pit_type Text::depthHook(pit_type pit, depth_type depth) const { pit_type newpit = pit; @@ -485,8 +510,8 @@ class TextCompletionList : public CompletionList { public: /// - TextCompletionList(Cursor const & cur) - : buffer_(cur.buffer()), pos_(0) + TextCompletionList(Cursor const & cur, WordList const * list) + : buffer_(cur.buffer()), pos_(0), list_(list) {} /// virtual ~TextCompletionList() {} @@ -496,12 +521,12 @@ public: /// virtual size_t size() const { - return theWordList().size(); + return list_->size(); } /// virtual docstring const & data(size_t idx) const { - return theWordList().word(idx); + return list_->word(idx); } private: @@ -509,6 +534,8 @@ private: Buffer const * buffer_; /// size_t pos_; + /// + WordList const * list_; }; @@ -1988,7 +2015,8 @@ bool Text::completionSupported(Cursor const & cur) const CompletionList const * Text::createCompletionList(Cursor const & cur) const { - return new TextCompletionList(cur); + WordList const * list = theWordList(*cur.getFont().language()); + return new TextCompletionList(cur, list); }