mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
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:
parent
2a2128c0f3
commit
730a67e0d1
@ -79,6 +79,12 @@ namespace lyx {
|
|||||||
using cap::cutSelection;
|
using cap::cutSelection;
|
||||||
using cap::pasteParagraphList;
|
using cap::pasteParagraphList;
|
||||||
|
|
||||||
|
InsetText const & Text::inset() const
|
||||||
|
{
|
||||||
|
return *owner_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Text::readParToken(Paragraph & par, Lexer & lex,
|
void Text::readParToken(Paragraph & par, Lexer & lex,
|
||||||
string const & token, Font & font, Change & change, ErrorList & errorList)
|
string const & token, Font & font, Change & change, ErrorList & errorList)
|
||||||
{
|
{
|
||||||
|
13
src/Text.h
13
src/Text.h
@ -47,8 +47,8 @@ public:
|
|||||||
/// \warning a non standard layout on an empty paragraph doesn't
|
/// \warning a non standard layout on an empty paragraph doesn't
|
||||||
// count as empty.
|
// count as empty.
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
/// Access to owner InsetText.
|
||||||
InsetText const * inset() const { return owner_; }
|
InsetText const & inset() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
FontInfo layoutFont(pit_type pit) const;
|
FontInfo layoutFont(pit_type pit) const;
|
||||||
@ -315,11 +315,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
/// The InsetText owner shall have access to everything.
|
/// The InsetText owner shall have access to everything.
|
||||||
friend class InsetText;
|
friend class InsetText;
|
||||||
///
|
|
||||||
ParagraphList pars_;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool autoBreakRows_;
|
|
||||||
/// return past-the-last paragraph influenced by a layout
|
/// return past-the-last paragraph influenced by a layout
|
||||||
/// change on pit
|
/// change on pit
|
||||||
pit_type undoSpan(pit_type pit);
|
pit_type undoSpan(pit_type pit);
|
||||||
@ -353,7 +349,10 @@ private:
|
|||||||
|
|
||||||
/// Owner Inset.
|
/// Owner Inset.
|
||||||
InsetText * owner_;
|
InsetText * owner_;
|
||||||
|
///
|
||||||
|
ParagraphList pars_;
|
||||||
|
///
|
||||||
|
bool autoBreakRows_;
|
||||||
/// position of the text in the buffer.
|
/// position of the text in the buffer.
|
||||||
DocIterator macrocontext_position_;
|
DocIterator macrocontext_position_;
|
||||||
};
|
};
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
#include "VSpace.h"
|
#include "VSpace.h"
|
||||||
|
|
||||||
|
#include "insets/InsetText.h"
|
||||||
|
|
||||||
#include "mathed/MacroTable.h"
|
#include "mathed/MacroTable.h"
|
||||||
#include "mathed/MathMacroTemplate.h"
|
#include "mathed/MathMacroTemplate.h"
|
||||||
|
|
||||||
@ -1965,7 +1967,7 @@ int TextMetrics::leftMargin(int max_width,
|
|||||||
&& align == LYX_ALIGN_BLOCK
|
&& align == LYX_ALIGN_BLOCK
|
||||||
&& !par.params().noindent()
|
&& !par.params().noindent()
|
||||||
// in some insets, paragraphs are never indented
|
// in some insets, paragraphs are never indented
|
||||||
&& !par.inInset().neverIndent()
|
&& !text_->inset().neverIndent()
|
||||||
// display style insets are always centered, omit indentation
|
// display style insets are always centered, omit indentation
|
||||||
&& !(!par.empty()
|
&& !(!par.empty()
|
||||||
&& par.isInset(pos)
|
&& par.isInset(pos)
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "Paragraph.h"
|
#include "Paragraph.h"
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
|
|
||||||
|
#include "insets/InsetText.h"
|
||||||
|
|
||||||
#include "support/debug.h"
|
#include "support/debug.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/gettext.h"
|
#include "support/gettext.h"
|
||||||
@ -609,7 +611,7 @@ void GuiLayoutBox::updateContents(bool reset)
|
|||||||
// or we've moved from one inset to another
|
// or we've moved from one inset to another
|
||||||
DocumentClass const * text_class = &buffer->params().documentClass();
|
DocumentClass const * text_class = &buffer->params().documentClass();
|
||||||
Inset const * inset =
|
Inset const * inset =
|
||||||
&(owner_.view()->cursor().innerParagraph().inInset());
|
&(owner_.view()->cursor().innerText()->inset());
|
||||||
if (!reset && text_class_ == text_class && inset_ == inset) {
|
if (!reset && text_class_ == text_class && inset_ == inset) {
|
||||||
set(owner_.view()->cursor().innerParagraph().layout().name());
|
set(owner_.view()->cursor().innerParagraph().layout().name());
|
||||||
return;
|
return;
|
||||||
|
@ -75,7 +75,7 @@ TeXDeeper(Buffer const & buf,
|
|||||||
|
|
||||||
ParagraphList const & paragraphs = text.paragraphs();
|
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() &&
|
while (par != paragraphs.end() &&
|
||||||
par->params().depth() == pit->params().depth()) {
|
par->params().depth() == pit->params().depth()) {
|
||||||
// FIXME This test should not be necessary.
|
// FIXME This test should not be necessary.
|
||||||
@ -109,7 +109,7 @@ TeXEnvironment(Buffer const & buf,
|
|||||||
|
|
||||||
// FIXME This test should not be necessary.
|
// FIXME This test should not be necessary.
|
||||||
// We should perhaps issue an error if it is.
|
// 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();
|
bparams.documentClass().plainLayout() : pit->layout();
|
||||||
|
|
||||||
ParagraphList const & paragraphs = text.paragraphs();
|
ParagraphList const & paragraphs = text.paragraphs();
|
||||||
@ -329,7 +329,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
|
|||||||
|
|
||||||
// FIXME This check should not really be needed.
|
// FIXME This check should not really be needed.
|
||||||
// Perhaps we should issue an error if it is.
|
// 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();
|
bparams.documentClass().plainLayout() : pit->layout();
|
||||||
|
|
||||||
runparams.moving_arg |= style.needprotect;
|
runparams.moving_arg |= style.needprotect;
|
||||||
@ -830,7 +830,7 @@ void latexParagraphs(Buffer const & buf,
|
|||||||
lastpar = par;
|
lastpar = par;
|
||||||
// FIXME This check should not be needed. We should
|
// FIXME This check should not be needed. We should
|
||||||
// perhaps issue an error if it is.
|
// perhaps issue an error if it is.
|
||||||
Layout const & layout = text.inset()->forcePlainLayout() ?
|
Layout const & layout = text.inset().forcePlainLayout() ?
|
||||||
tclass.plainLayout() : par->layout();
|
tclass.plainLayout() : par->layout();
|
||||||
|
|
||||||
if (layout.intitle) {
|
if (layout.intitle) {
|
||||||
|
Loading…
Reference in New Issue
Block a user