]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / Text.cpp
index 16816f34140ed7d84b7c680d2402eeaf27e1cb49..c5d1501417853a8f00df2b75b9138147f5af731a 100644 (file)
@@ -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);
 }