From: Abdelrazak Younes Date: Sun, 9 Aug 2009 16:19:43 +0000 (+0000) Subject: Text::Inset(): now returns a reference in order to make clear that the owner is manda... X-Git-Tag: 2.0.0~5798 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=730a67e0d141d125be108174cb4e2159b2a7010a;p=features.git Text::Inset(): now returns a reference in order to make clear that the owner is mandatory. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30947 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Text.cpp b/src/Text.cpp index 3913feec99..8edbe2f0a6 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -79,6 +79,12 @@ namespace lyx { using cap::cutSelection; using cap::pasteParagraphList; +InsetText const & Text::inset() const +{ + return *owner_; +} + + void Text::readParToken(Paragraph & par, Lexer & lex, string const & token, Font & font, Change & change, ErrorList & errorList) { diff --git a/src/Text.h b/src/Text.h index 06850e5350..848f45b5ec 100644 --- a/src/Text.h +++ b/src/Text.h @@ -47,8 +47,8 @@ public: /// \warning a non standard layout on an empty paragraph doesn't // count as empty. bool empty() const; - - InsetText const * inset() const { return owner_; } + /// Access to owner InsetText. + InsetText const & inset() const; /// FontInfo layoutFont(pit_type pit) const; @@ -315,11 +315,7 @@ public: private: /// The InsetText owner shall have access to everything. friend class InsetText; - /// - ParagraphList pars_; - /// - bool autoBreakRows_; /// return past-the-last paragraph influenced by a layout /// change on pit pit_type undoSpan(pit_type pit); @@ -353,7 +349,10 @@ private: /// Owner Inset. InsetText * owner_; - + /// + ParagraphList pars_; + /// + bool autoBreakRows_; /// position of the text in the buffer. DocIterator macrocontext_position_; }; diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index dcc9744f07..20aa586a44 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -42,6 +42,8 @@ #include "TextClass.h" #include "VSpace.h" +#include "insets/InsetText.h" + #include "mathed/MacroTable.h" #include "mathed/MathMacroTemplate.h" @@ -1965,7 +1967,7 @@ int TextMetrics::leftMargin(int max_width, && align == LYX_ALIGN_BLOCK && !par.params().noindent() // in some insets, paragraphs are never indented - && !par.inInset().neverIndent() + && !text_->inset().neverIndent() // display style insets are always centered, omit indentation && !(!par.empty() && par.isInset(pos) diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 7166dd4d58..7b0c20213e 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -39,6 +39,8 @@ #include "Paragraph.h" #include "TextClass.h" +#include "insets/InsetText.h" + #include "support/debug.h" #include "support/filetools.h" #include "support/gettext.h" @@ -609,7 +611,7 @@ void GuiLayoutBox::updateContents(bool reset) // or we've moved from one inset to another DocumentClass const * text_class = &buffer->params().documentClass(); Inset const * inset = - &(owner_.view()->cursor().innerParagraph().inInset()); + &(owner_.view()->cursor().innerText()->inset()); if (!reset && text_class_ == text_class && inset_ == inset) { set(owner_.view()->cursor().innerParagraph().layout().name()); return; diff --git a/src/output_latex.cpp b/src/output_latex.cpp index cc551d8d1d..59c1140423 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -75,7 +75,7 @@ TeXDeeper(Buffer const & buf, ParagraphList const & paragraphs = text.paragraphs(); - bool const force_plain_layout = text.inset()->forcePlainLayout(); + bool const force_plain_layout = text.inset().forcePlainLayout(); while (par != paragraphs.end() && par->params().depth() == pit->params().depth()) { // FIXME This test should not be necessary. @@ -109,7 +109,7 @@ TeXEnvironment(Buffer const & buf, // FIXME This test should not be necessary. // We should perhaps issue an error if it is. - Layout const & style = text.inset()->forcePlainLayout() ? + Layout const & style = text.inset().forcePlainLayout() ? bparams.documentClass().plainLayout() : pit->layout(); ParagraphList const & paragraphs = text.paragraphs(); @@ -329,7 +329,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, // FIXME This check should not really be needed. // Perhaps we should issue an error if it is. - Layout const style = text.inset()->forcePlainLayout() ? + Layout const style = text.inset().forcePlainLayout() ? bparams.documentClass().plainLayout() : pit->layout(); runparams.moving_arg |= style.needprotect; @@ -830,7 +830,7 @@ void latexParagraphs(Buffer const & buf, lastpar = par; // FIXME This check should not be needed. We should // perhaps issue an error if it is. - Layout const & layout = text.inset()->forcePlainLayout() ? + Layout const & layout = text.inset().forcePlainLayout() ? tclass.plainLayout() : par->layout(); if (layout.intitle) {