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
This commit is contained in:
Abdelrazak Younes 2009-08-09 16:19:43 +00:00
parent 2a2128c0f3
commit 730a67e0d1
5 changed files with 22 additions and 13 deletions

View File

@ -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)
{

View File

@ -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_;
};

View File

@ -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)

View File

@ -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;

View File

@ -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) {