]> git.lyx.org Git - features.git/commitdiff
mostly s/Paragraph::layout(...)/Paragraph::setLayout(...)/
authorAndré Pönitz <poenitz@gmx.net>
Sat, 23 Feb 2008 16:45:38 +0000 (16:45 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 23 Feb 2008 16:45:38 +0000 (16:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23159 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
src/CutAndPaste.cpp
src/Layout.cpp
src/MenuBackend.cpp
src/Paragraph.cpp
src/Paragraph.h
src/Text.cpp
src/Text3.cpp
src/TextClass.cpp
src/TextClass.h
src/TextMetrics.cpp
src/TocBackend.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiToolbar.cpp
src/insets/Inset.cpp
src/insets/InsetBox.cpp
src/insets/InsetCaption.cpp
src/insets/InsetCollapsable.cpp
src/insets/InsetTabular.cpp
src/insets/InsetText.cpp
src/paragraph_funcs.cpp
src/rowpainter.cpp

index d2c1e63607282ff5ac0a3e0d3c2686f81ea9be41..019783f5e63ae437ad231f0b4a3bc8386394ab0b 100644 (file)
@@ -127,11 +127,11 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
 
        // Convert newline to paragraph break in ERT inset.
        // This should not be here!
-       if (pars[pit].inInset() &&
-           (pars[pit].inInset()->lyxCode() == ERT_CODE ||
-               pars[pit].inInset()->lyxCode() == LISTINGS_CODE)) {
-               for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
-                       for (pos_type j = 0; j < insertion[i].size(); ++j) {
+       Inset * inset = pars[pit].inInset();
+       if (inset && (inset->lyxCode() == ERT_CODE ||
+                       inset->lyxCode() == LISTINGS_CODE)) {
+               for (size_t i = 0; i != insertion.size(); ++i) {
+                       for (pos_type j = 0; j != insertion[i].size(); ++j) {
                                if (insertion[i].isNewline(j)) {
                                        // do not track deletion of newline
                                        insertion[i].eraseChar(j, false);
@@ -152,7 +152,7 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
                ParagraphList::iterator const end = insertion.end();
                for (ParagraphList::iterator par = insertion.begin();
                                par != end; ++par)
-                       par->layout(layout);
+                       par->setLayout(layout);
        }
 
        // Make sure there is no class difference.
@@ -421,9 +421,9 @@ void switchBetweenClasses(TextClassIndex const & oldtcindex,
                bool hasLayout = newtc.hasLayout(name);
 
                if (hasLayout)
-                       it->layout(newtc[name]);
+                       it->setLayout(newtc[name]);
                else
-                       it->layout(newtc.defaultLayout());
+                       it->setLayout(newtc.defaultLayout());
 
                if (!hasLayout && name != oldtc.defaultLayoutName()) {
                        docstring const s = bformat(
@@ -621,7 +621,7 @@ void copySelectionToStack(Cursor & cur, CutStack & cutstack)
                ParagraphList pars;
                Paragraph par;
                BufferParams const & bp = cur.buffer().params();
-               par.layout(bp.textClass().defaultLayout());
+               par.setLayout(bp.textClass().defaultLayout());
                par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
                pars.push_back(par);
                cutstack.push(make_pair(pars, bp.textClassIndex()));
@@ -648,7 +648,7 @@ void copySelection(Cursor & cur, docstring const & plaintext)
                ParagraphList pars;
                Paragraph par;
                BufferParams const & bp = cur.buffer().params();
-               par.layout(bp.textClass().defaultLayout());
+               par.setLayout(bp.textClass().defaultLayout());
                par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
                pars.push_back(par);
                theCuts.push(make_pair(pars, bp.textClassIndex()));
index c29f0bd1f8a0d0a0359e18410488b417a7e38952..7fedb3209c11fc16da9b7edc43a6c3d4626958e2 100644 (file)
@@ -223,14 +223,9 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass)
                                               << to_utf8(style) << "'\n"
                                               << "All layouts so far:"
                                               << endl;
-                                       TextClass::const_iterator it =
-                                               tclass.begin();
-                                       TextClass::const_iterator end =
-                                               tclass.end();
-                                       for (; it != end; ++it) {
-                                               lyxerr << to_utf8((*it)->name())
+                                       for (size_t i = 0; i != tclass.layoutCount(); ++i)
+                                               lyxerr << to_utf8(tclass.layout(i)->name())
                                                       << endl;
-                                       }
 
                                        //lexrc.printError("Cannot copy known "
                                        //               "style `$$Token'");
index 8d11cc4577654c783befc3080e7af314a325b9c6..fce89d6c25d5998d8b0230120869f4a74ae34ecf 100644 (file)
@@ -640,10 +640,10 @@ void expandFlexInsert(Menu & tomenu, Buffer const * buf, string s)
                                    FuncRequest(LFUN_NOACTION)));
                return;
        }
-       InsetLayouts const & insetlayouts =
-               buf->params().textClass().insetlayouts();
-       InsetLayouts::const_iterator cit = insetlayouts.begin();
-       InsetLayouts::const_iterator end = insetlayouts.end();
+       InsetLayouts const & insetLayouts =
+               buf->params().textClass().insetLayouts();
+       InsetLayouts::const_iterator cit = insetLayouts.begin();
+       InsetLayouts::const_iterator end = insetLayouts.end();
        for (; cit != end; ++cit) {
                docstring const label = cit->first;
                if (cit->second.lyxtype() == s)
index 2ab9a61a81bec8a91a56906e65c2b646cd5af093..293a62e8c8c6df76f7672a4af3e1b75695b98b9f 100644 (file)
@@ -1473,7 +1473,7 @@ char Paragraph::getAlign() const
 }
 
 
-docstring const & Paragraph::getLabelstring() const
+docstring const & Paragraph::labelString() const
 {
        return d->params_.labelString();
 }
@@ -2334,9 +2334,18 @@ LayoutPtr const & Paragraph::layout() const
 }
 
 
-void Paragraph::layout(LayoutPtr const & new_layout)
+void Paragraph::setLayout(LayoutPtr const & layout)
 {
-       d->layout_ = new_layout;
+       d->layout_ = layout;
+}
+
+
+void Paragraph::setEmptyOrDefaultLayout(TextClass const & tclass)
+{
+       if (useEmptyLayout())
+               setLayout(tclass.emptyLayout());
+       else
+               setLayout(tclass.defaultLayout());
 }
 
 
index e00f644f15b74305cf0d8d48443d46fe4f1b3935..3c9e533562d0bf2e6959df1a973727609a0df5a7 100644 (file)
@@ -43,6 +43,7 @@ class MetricsInfo;
 class OutputParams;
 class PainterInfo;
 class ParagraphParameters;
+class TextClass;
 class TexRow;
 
 
@@ -158,7 +159,9 @@ public:
        ///
        LayoutPtr const & layout() const;
        ///
-       void layout(LayoutPtr const & new_layout);
+       void setLayout(LayoutPtr const & layout);
+       ///
+       void setEmptyOrDefaultLayout(TextClass const & tc);
 
        /// This is the item depth, only used by enumerate and itemize
        signed char itemdepth;
@@ -201,7 +204,7 @@ public:
        void setBeginOfBody();
 
        ///
-       docstring const & getLabelstring() const;
+       docstring const & labelString() const;
 
        /// the next two functions are for the manual labels
        docstring const getLabelWidthString() const;
index 8422e43425b66eb0b8eedd98bb91828b92897bf2..456584b8c75341811f06bd2d63dbcc167a7ebab1 100644 (file)
@@ -125,12 +125,12 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
                                        tclass.defaultLayoutName();
                }
 
-               par.layout(bp.textClass()[layoutname]);
+               par.setLayout(bp.textClass()[layoutname]);
 
                // Test whether the layout is obsolete.
                LayoutPtr const & layout = par.layout();
                if (!layout->obsoleted_by().empty())
-                       par.layout(bp.textClass()[layout->obsoleted_by()]);
+                       par.setLayout(bp.textClass()[layout->obsoleted_by()]);
 
                par.params().read(lex);
 
@@ -340,8 +340,7 @@ bool Text::empty() const
 }
 
 
-double Text::spacing(Buffer const & buffer,
-               Paragraph const & par) const
+double Text::spacing(Buffer const & buffer, Paragraph const & par) const
 {
        if (par.params().spacing().isDefault())
                return buffer.params().spacing().getValue();
@@ -929,9 +928,9 @@ bool Text::handleBibitems(Cursor & cur)
 
        // otherwise reset to default
        if (par.useEmptyLayout())
-               cur.paragraph().layout(bufparams.textClass().emptyLayout());
+               cur.paragraph().setLayout(bufparams.textClass().emptyLayout());
        else
-               cur.paragraph().layout(bufparams.textClass().defaultLayout());
+               cur.paragraph().setLayout(bufparams.textClass().defaultLayout());
        return true;
 }
 
index 62e9129cbd5ac4c721e442d684412cd8e1ece507..4be361630a60dbdd76c6cc61483c13cc990fdbdb 100644 (file)
@@ -219,10 +219,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
        InsetText * insetText = dynamic_cast<InsetText *>(inset);
        if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) {
                // reset first par to default
-               LayoutPtr const layout = insetText->useEmptyLayout()
-                       ? bparams.textClass().emptyLayout()
-                       : bparams.textClass().defaultLayout();
-               cur.text()->paragraphs().begin()->layout(layout);
+               cur.text()->paragraphs().begin()
+                       ->setEmptyOrDefaultLayout(bparams.textClass());
                cur.pos() = 0;
                cur.pit() = 0;
                // Merge multiple paragraphs -- hack
@@ -268,8 +266,7 @@ static void outline(OutlineOp mode, Cursor & cur)
        ParagraphList::iterator finish = start;
        ParagraphList::iterator end = pars.end();
 
-       TextClass::const_iterator lit = buf.params().textClass().begin();
-       TextClass::const_iterator const lend = buf.params().textClass().end();
+       TextClass const & tc = buf.params().textClass();
 
        int const thistoclevel = start->layout()->toclevel;
        int toclevel;
@@ -344,20 +341,22 @@ static void outline(OutlineOp mode, Cursor & cur)
                }
                case OutlineIn:
                        buf.undo().recordUndo(cur);
-                       for (; lit != lend; ++lit) {
-                               if ((*lit)->toclevel == thistoclevel + 1 &&
-                                   start->layout()->labeltype == (*lit)->labeltype) {
-                                       start->layout((*lit));
+                       for (size_t i = 0; i != tc.layoutCount(); ++i) {
+                               LayoutPtr const & lt = tc.layout(i);
+                               if (lt->toclevel == thistoclevel + 1 &&
+                                   start->layout()->labeltype == lt->labeltype) {
+                                       start->setLayout(lt);
                                        break;
                                }
                        }
                        break;
                case OutlineOut:
                        buf.undo().recordUndo(cur);
-                       for (; lit != lend; ++lit) {
-                               if ((*lit)->toclevel == thistoclevel - 1 &&
-                                   start->layout()->labeltype == (*lit)->labeltype) {
-                                       start->layout((*lit));
+                       for (size_t i = 0; i != tc.layoutCount(); ++i) {
+                               LayoutPtr const & lt = tc.layout(i);
+                               if (lt->toclevel == thistoclevel - 1 &&
+                                   start->layout()->labeltype == lt->labeltype) {
+                                       start->setLayout(lt);
                                        break;
                                }
                        }
@@ -1390,11 +1389,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // add a separate paragraph for the caption inset
                pars.push_back(Paragraph());
                pars.back().setInsetOwner(pars[0].inInset());
-               if (pars.back().useEmptyLayout())
-                       pars.back().layout(tclass.emptyLayout());
-               else
-                       pars.back().layout(tclass.defaultLayout());
-
+               pars.back().setEmptyOrDefaultLayout(tclass);
                int cap_pit = pars.size() - 1;
 
                // if an empty inset was created, we create an additional empty
@@ -1403,10 +1398,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                if (!content) {
                        pars.push_back(Paragraph());
                        pars.back().setInsetOwner(pars[0].inInset());
-                       if (pars.back().useEmptyLayout())
-                               pars.back().layout(tclass.emptyLayout());
-                       else
-                               pars.back().layout(tclass.defaultLayout());
+                       pars.back().setEmptyOrDefaultLayout(tclass);
                }
 
                // reposition the cursor to the caption
@@ -1954,7 +1946,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_FLEX_INSERT: {
                code = FLEX_CODE;
                string s = cmd.getArg(0);
-               InsetLayout il =  cur.buffer().params().textClass().insetlayout(from_utf8(s));
+               InsetLayout il =  cur.buffer().params().textClass().insetLayout(from_utf8(s));
                if (il.lyxtype() != "charstyle" &&
                    il.lyxtype() != "custom" &&
                    il.lyxtype() != "element" &&
index c5dcd2ec13e971e9503ab54b8d9b121777087ef7..4df69a680c82375f2b45e84b6d37af3b57e929c0 100644 (file)
@@ -539,18 +539,14 @@ bool TextClass::read(FileName const & filename, ReadType rt)
 
        min_toclevel_ = Layout::NOT_IN_TOC;
        max_toclevel_ = Layout::NOT_IN_TOC;
-       const_iterator cit = begin();
-       const_iterator the_end = end();
-       for ( ; cit != the_end ; ++cit) {
-               int const toclevel = (*cit)->toclevel;
+       for (size_t i = 0; i != layoutCount(); ++i) {
+               int const toclevel = layout(i)->toclevel;
                if (toclevel != Layout::NOT_IN_TOC) {
                        if (min_toclevel_ == Layout::NOT_IN_TOC)
                                min_toclevel_ = toclevel;
                        else
-                               min_toclevel_ = min(min_toclevel_,
-                                                       toclevel);
-                       max_toclevel_ = max(max_toclevel_,
-                                                       toclevel);
+                               min_toclevel_ = min(min_toclevel_, toclevel);
+                       max_toclevel_ = max(max_toclevel_, toclevel);
                }
        }
        LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_
@@ -978,13 +974,13 @@ Counters & TextClass::counters() const
 // will invoke the layout object defined by name = 'CharStyle'.
 // If that doesn't work either, an empty object returns (shouldn't
 // happen).  -- Idea JMarc, comment MV
-InsetLayout const & TextClass::insetlayout(docstring const & name) const 
+InsetLayout const & TextClass::insetLayout(docstring const & name) const 
 {
        docstring n = name;
        while (!n.empty()) {
                if (insetlayoutlist_.count(n) > 0)
                        return insetlayoutlist_[n];
-               docstring::size_type i = n.find(':');
+               size_t i = n.find(':');
                if (i == string::npos)
                        break;
                n = n.substr(0,i);
index c29011ae1e41df198f5d7b83b1a4ee60c208c44f..db5906493d60915eb5a09fb11e0cccfa60b05da7 100644 (file)
@@ -58,8 +58,6 @@ class TextClass {
 public:
        /// The individual styles comprising the document class
        typedef std::vector<LayoutPtr> LayoutList;
-       /// Enumerate the paragraph styles.
-       typedef LayoutList::const_iterator const_iterator;
        /// Construct a layout with default values. Actual values loaded later.
        explicit
        TextClass(std::string const & = std::string(),
@@ -70,12 +68,12 @@ public:
        /// check whether the TeX class is available
        bool isTeXClassAvailable() const;
 
-       /// paragraph styles begin iterator.
-       const_iterator begin() const { return layoutlist_.begin(); }
-       /// paragraph styles end iterator
-       const_iterator end() const { return layoutlist_.end(); }
+       /// Enumerate the paragraph styles.
+       size_t layoutCount() const { return layoutlist_.size(); }
+       /// Access the paragraph styles.
+       LayoutPtr const & layout(size_t index) const { return layoutlist_[index]; }
 
-       ///Enum used with TextClass::read
+       /// Enum used with TextClass::read
        enum ReadType { 
                BASECLASS, //>This is a base class, i.e., top-level layout file
                MERGE, //>This is a file included in a layout file
@@ -116,9 +114,9 @@ public:
        /// The Counters present in this document class.
        Counters & counters() const;
        /// Inset layouts of this doc class
-       InsetLayouts & insetlayouts() const { return insetlayoutlist_; };
+       InsetLayouts & insetLayouts() const { return insetlayoutlist_; };
        ///
-       InsetLayout const & insetlayout(docstring const & name) const;
+       InsetLayout const & insetLayout(docstring const & name) const;
        ///
        docstring const & defaultLayoutName() const;
        ///
index 588971a0c9c78e8967cbdd6bcd369c01d2ebe59e..126e4a8422b28f901d016578cda23641dfa2fc36 100644 (file)
@@ -998,7 +998,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
                     || layout->labeltype == LABEL_BIBLIO
                     || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
                    && isFirstInSequence(pit, pars)
-                   && !par.getLabelstring().empty())
+                   && !par.labelString().empty())
                {
                        labeladdon = int(
                                  labelfont_metrics.maxHeight()
@@ -1810,9 +1810,9 @@ int TextMetrics::leftMargin(int max_width,
                        l_margin += theFontMetrics(buffer.params().getFont()).signedWidth(
                                layout->leftmargin);
                }
-               if (!par.getLabelstring().empty()) {
+               if (!par.labelString().empty()) {
                        l_margin += labelfont_metrics.signedWidth(layout->labelindent);
-                       l_margin += labelfont_metrics.width(par.getLabelstring());
+                       l_margin += labelfont_metrics.width(par.labelString());
                        l_margin += labelfont_metrics.width(layout->labelsep);
                }
                break;
@@ -1856,7 +1856,7 @@ int TextMetrics::leftMargin(int max_width,
                           LABEL_CENTERED_TOP_ENVIRONMENT) {
                        l_margin += labelfont_metrics.signedWidth(layout->labelindent);
                        l_margin += labelfont_metrics.width(layout->labelsep);
-                       l_margin += labelfont_metrics.width(par.getLabelstring());
+                       l_margin += labelfont_metrics.width(par.labelString());
                }
                break;
 
index cf40c4f8180e53ec873a00a94417beb62c6be4dd..00a55a987097d56475c809145c5bf1daa6e098a1 100644 (file)
@@ -125,8 +125,8 @@ void TocBackend::updateItem(ParConstIterator const & par_it)
                                break;
                        Paragraph const & par =
                                *static_cast<InsetOptArg&>(inset).paragraphs().begin();
-                       if (!toc_item->par_it_->getLabelstring().empty())
-                               tocstring = toc_item->par_it_->getLabelstring() + ' ';
+                       if (!toc_item->par_it_->labelString().empty())
+                               tocstring = toc_item->par_it_->labelString() + ' ';
                        tocstring += par.asString(*buffer_, false);
                        break;
                }
@@ -169,8 +169,8 @@ void TocBackend::update()
                                        break;
                                Paragraph const & par =
                                        *static_cast<InsetOptArg&>(inset).paragraphs().begin();
-                               if (!pit->getLabelstring().empty())
-                                       tocstring = pit->getLabelstring() + ' ';
+                               if (!pit->labelString().empty())
+                                       tocstring = pit->labelString() + ' ';
                                tocstring += par.asString(*buffer_, false);
                                break;
                        }
index dcfaf3985f82d12dbef25f4a32a1f68a1f7498b0..7ad3bd4f8332d585c9ec7f84a87ae9fdf5237f17 100644 (file)
@@ -518,7 +518,7 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)),
                this, SLOT(setLSpacing(int)));
-       connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)),
+       connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString &)),
                this, SLOT(change_adaptor()));
        connect(textLayoutModule->skipRB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
@@ -1363,15 +1363,13 @@ void GuiDocument::updateNumbering()
        int const toc = numberingModule->tocSL->value();
        QString const no = qt_("No");
        QString const yes = qt_("Yes");
-       TextClass::const_iterator end = tclass.end();
-       TextClass::const_iterator cit = tclass.begin();
        QTreeWidgetItem * item = 0;
-       for ( ; cit != end ; ++cit) {
-               int const toclevel = (*cit)->toclevel;
-               if (toclevel != Layout::NOT_IN_TOC
-                   && (*cit)->labeltype == LABEL_COUNTER) {
+       for (size_t i = 0; i != tclass.layoutCount(); ++i) {
+               Layout const & lt = *tclass.layout(i);
+               int const toclevel = lt.toclevel;
+               if (toclevel != Layout::NOT_IN_TOC && lt.labeltype == LABEL_COUNTER) {
                        item = new QTreeWidgetItem(numberingModule->tocTW);
-                       item->setText(0, toqstr(translateIfPossible((*cit)->name())));
+                       item->setText(0, toqstr(translateIfPossible(lt.name())));
                        item->setText(1, (toclevel <= depth) ? yes : no);
                        item->setText(2, (toclevel <= toc) ? yes : no);
                }
index 8cf7b87a85d632d7a0c216d62994781e9edf7f03..ab61ce352a6b4681bdfbcd15b563b2727ac3bf94 100644 (file)
@@ -323,11 +323,10 @@ void GuiLayoutBox::updateContents(bool reset)
        text_class_ = text_class;
 
        clear();
-       TextClass::const_iterator it = text_class_->begin();
-       TextClass::const_iterator const end = text_class_->end();
 
-       for (; it != end; ++it) {
-               docstring const & name = (*it)->name();
+       for (size_t i = 0; i != text_class_->layoutCount(); ++i) {
+               Layout const & lt = *text_class_->layout(i);
+               docstring const & name = lt.name();
                // if this inset requires the empty layout, we skip the default
                // layout
                if (name == text_class_->defaultLayoutName() && inset &&
@@ -359,14 +358,12 @@ void GuiLayoutBox::selected(const QString & str)
                return;
 
        docstring const name = qstring_to_ucs4(str);
-       TextClass::const_iterator it  = text_class_->begin();
-       TextClass::const_iterator const end = text_class_->end();
-       for (; it != end; ++it) {
-               docstring const & itname = (*it)->name();
-               //FIXME Comparing translated strings is not ideal.
-               //This should be done the way module names are handled
-               //in GuiDocument: viz, the untranslated name should be
-               //associated with the item via QComboBox::setItemData().
+       for (size_t i = 0; i != text_class_->layoutCount(); ++i) {
+               docstring const & itname = text_class_->layout(i)->name();
+               // FIXME: Comparing translated strings is not ideal.
+               // This should be done the way module names are handled
+               // in GuiDocument: viz, the untranslated name should be
+               // associated with the item via QComboBox::setItemData().
                if (translateIfPossible(itname) == name) {
                        FuncRequest const func(LFUN_LAYOUT, itname,
                                               FuncRequest::TOOLBAR);
index 778000d806dce63b33d33fcc1f7981cec79d0a0c..ed94df8ae323079c475353dba28b72d470097f40 100644 (file)
@@ -361,7 +361,7 @@ bool Inset::covers(BufferView const & bv, int x, int y) const
 
 InsetLayout const & Inset::getLayout(BufferParams const & bp) const
 {
-       return bp.textClass().insetlayout(name());  
+       return bp.textClass().insetLayout(name());  
 }
 
 
index 45ee674d9a2b5e927c708e6e465e9d6cdcd83e3f..71620c32139d2ca7ce7b0119b49c8f8bcf3681ff 100644 (file)
@@ -89,7 +89,7 @@ InsetBox::InsetBox(BufferParams const & bp, string const & label)
        : InsetCollapsable(bp), params_(label)
 {
        if (forceEmptyLayout())
-               paragraphs().back().layout(bp.textClass().emptyLayout());
+               paragraphs().back().setLayout(bp.textClass().emptyLayout());
 }
 
 
index ae240d7019836cee74b145f94c51acac6ee56de4..ae9e9eb5ecc09858ea15903fb81db80e066c376c 100644 (file)
@@ -64,7 +64,7 @@ InsetCaption::InsetCaption(BufferParams const & bp)
        setFrameColor(Color_captionframe);
        //FIXME Do we need to set all paragraphs here? or will there
        //always only be one?
-       paragraphs().back().layout(bp.textClass().emptyLayout());
+       paragraphs().back().setLayout(bp.textClass().emptyLayout());
 }
 
 
index 96f6765195261fbd36c8335f36847a7d2b290eed..e35f18906bf3efb651a0fd6f1370511a2780f754 100644 (file)
@@ -87,7 +87,7 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp,
        setAutoBreakRows(true);
        setDrawFrame(true);
        setFrameColor(Color_collapsableframe);
-       paragraphs().back().layout(bp.textClass().emptyLayout());
+       paragraphs().back().setLayout(bp.textClass().emptyLayout());
 }
 
 
@@ -134,7 +134,7 @@ void InsetCollapsable::setLayout(TextClassIndex tcindex)
 {
        textClass_ = tcindex;
        if (tcindex != TextClassIndex(-1)) {
-               layout_ = &textclasslist[tcindex].insetlayout(name());
+               layout_ = &textclasslist[tcindex].insetLayout(name());
                labelstring_ = layout_->labelstring();
        } else {
                layout_ = &TextClass::emptyInsetLayout();
index 658fa3e4fd380710325a0fc5fcf98af5a27bd74f..35ca668d1947f5a59be04c7b38cd42f20dd5ceda 100644 (file)
@@ -486,7 +486,7 @@ Tabular::cellstruct::cellstruct(BufferParams const & bp)
          rotate(false),
          inset(new InsetText(bp))
 {
-       inset->paragraphs().back().layout(bp.textClass().emptyLayout());
+       inset->paragraphs().back().setLayout(bp.textClass().emptyLayout());
 }
 
 
index 4ef8c941286ff851497a272477648e4e3b9daaae..4bb85a90642f818b874221d912f39c9870e5469e 100644 (file)
@@ -100,10 +100,7 @@ InsetText::InsetText(BufferParams const & bp)
 {
        paragraphs().push_back(Paragraph());
        Paragraph & ourpar = paragraphs().back();
-       if (useEmptyLayout())
-               ourpar.layout(bp.textClass().emptyLayout());
-       else
-               ourpar.layout(bp.textClass().defaultLayout());
+       ourpar.setEmptyOrDefaultLayout(bp.textClass());
        ourpar.setInsetOwner(this);
 }
 
@@ -140,7 +137,7 @@ void InsetText::clear()
        pars.clear();
        pars.push_back(Paragraph());
        pars.begin()->setInsetOwner(this);
-       pars.begin()->layout(old_layout);
+       pars.begin()->setLayout(old_layout);
 }
 
 
index c4d70e415a6a3daf8e57a926778f03df5b546694..2b2f5ab18314fcd6f62b35ae3bd8607e2dd56906 100644 (file)
@@ -77,18 +77,18 @@ void breakParagraph(BufferParams const & bparams,
        // without doing that we get a crash when typing <Return> at the
        // end of a paragraph
        if (par.useEmptyLayout())
-               tmp->layout(bparams.textClass().emptyLayout());
+               tmp->setLayout(bparams.textClass().emptyLayout());
        else
-               tmp->layout(bparams.textClass().defaultLayout());
+               tmp->setLayout(bparams.textClass().defaultLayout());
 
        // layout stays the same with latex-environments
        if (keep_layout) {
-               tmp->layout(par.layout());
+               tmp->setLayout(par.layout());
                tmp->setLabelWidthString(par.params().labelWidthString());
                tmp->params().depth(par.params().depth());
        } else if (par.params().depth() > 0) {
                Paragraph const & hook = pars[outerHook(par_offset, pars)];
-               tmp->layout(hook.layout());
+               tmp->setLayout(hook.layout());
                // not sure the line below is useful
                tmp->setLabelWidthString(par.params().labelWidthString());
                tmp->params().depth(hook.params().depth());
@@ -97,7 +97,7 @@ void breakParagraph(BufferParams const & bparams,
        bool const isempty = (par.allowEmpty() && par.empty());
 
        if (!isempty && (par.size() > pos || par.empty())) {
-               tmp->layout(par.layout());
+               tmp->setLayout(par.layout());
                tmp->params().align(par.params().align());
                tmp->setLabelWidthString(par.params().labelWidthString());
 
@@ -144,12 +144,12 @@ void breakParagraph(BufferParams const & bparams,
                par.params().clear();
                // do not lose start of appendix marker (bug 4212)
                par.params().startOfAppendix(soa);
-               par.layout(bparams.textClass().defaultLayout());
+               par.setLayout(bparams.textClass().defaultLayout());
        }
 
        // layout stays the same with latex-environments
        if (keep_layout) {
-               par.layout(tmp->layout());
+               par.setLayout(tmp->layout());
                par.setLabelWidthString(tmp->params().labelWidthString());
                par.params().depth(tmp->params().depth());
        }
index eba16563aced6644240af83a6745b9532d6844bd..e4e48d6c5226246c2bb955ace995a68c854f328c 100644 (file)
@@ -505,7 +505,7 @@ void RowPainter::paintFirst()
                FontInfo const font = getLabelFont();
                FontMetrics const & fm = theFontMetrics(font);
 
-               docstring const str = par_.getLabelstring();
+               docstring const str = par_.labelString();
                if (!str.empty()) {
                        double x = x_;
 
@@ -551,8 +551,8 @@ void RowPainter::paintFirst()
                layout->labeltype == LABEL_BIBLIO ||
                layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)) {
                FontInfo const font = getLabelFont();
-               if (!par_.getLabelstring().empty()) {
-                       docstring const str = par_.getLabelstring();
+               docstring const str = par_.labelString();
+               if (!str.empty()) {
                        double spacing_val = 1.0;
                        if (!parparams.spacing().isDefault())
                                spacing_val = parparams.spacing().getValue();